From 2a93f4784879ab47011ee66ff60fb86e5f6839f9 Mon Sep 17 00:00:00 2001 From: Repellent Date: Fri, 24 Apr 2026 19:25:38 +0500 Subject: [PATCH] =?UTF-8?q?fix=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=B0=20?= =?UTF-8?q?=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D1=80?= =?UTF-8?q?=D0=B8=D0=B5=D0=B2=20+=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D1=88=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- class/poll.php | 65 +++++++++------- templates/poll_form.tpl | 161 +++++++++++++++++++--------------------- 2 files changed, 114 insertions(+), 112 deletions(-) diff --git a/class/poll.php b/class/poll.php index 0291ce3..642e795 100644 --- a/class/poll.php +++ b/class/poll.php @@ -458,38 +458,51 @@ class Poll * @param string $text * @param string $title */ - function pollCommentShow($tpl_dir, $lang_file, $pid, $theme, $errors='', $text='', $title='') - { - global $AVE_DB, $AVE_Template; +function pollCommentShow($tpl_dir, $lang_file, $pid, $theme, $errors='', $text='', $title='') +{ + global $AVE_DB, $AVE_Template; - $AVE_Template->config_load($lang_file, 'displayform'); + $AVE_Template->config_load($lang_file, 'displayform'); + $pid = (int)$pid; - $row = $AVE_DB->Query(" - SELECT * - FROM " . PREFIX . "_module_poll - WHERE id = '" . $pid . "' - LIMIT 1 - ")->FetchRow(); - $groups = explode(',', $row->poll_groups_id); + $row = $AVE_DB->Query(" + SELECT * + FROM " . PREFIX . "_module_poll + WHERE id = '" . $pid . "' + LIMIT 1 + ")->FetchRow(); - if ($row->poll_status == 1 && $row->poll_can_comment == 1 && in_array(UGROUP, $groups)) - { - $AVE_Template->assign('cancomment', 1); - } - $AVE_Template->assign('max_chars', $this->_commentwords); + if (!$row) { + $row = new stdClass(); + $row->poll_groups_id = ''; + $row->poll_status = 0; + $row->poll_can_comment = 0; + $row->poll_anti_spam = 0; + if (empty($errors)) $errors = "Опрос с ID {$pid} не найден"; + } - if (isset($row->poll_anti_spam) && $row->poll_anti_spam == 1 && function_exists('imagettftext') && function_exists('imagejpeg')) - { - $AVE_Template->assign('anti_spam', 1); - } + $groups = explode(',', $row->poll_groups_id ?? ''); - if (!empty($errors)) $AVE_Template->assign('errors', $errors); + if ($row->poll_status == 1 && $row->poll_can_comment == 1 && in_array(UGROUP, $groups)) + { + $AVE_Template->assign('cancomment', 1); + } + + $AVE_Template->assign('max_chars', $this->_commentwords); - $AVE_Template->assign('theme_folder', $theme); - $AVE_Template->assign('title', $title); - $AVE_Template->assign('text', $text); - $AVE_Template->display($tpl_dir . 'poll_form.tpl'); - } + if (isset($row->poll_anti_spam) && $row->poll_anti_spam == 1 && function_exists('imagettftext') && function_exists('imagejpeg')) + { + $AVE_Template->assign('anti_spam', 1); + } + + if (!empty($errors)) $AVE_Template->assign('errors', $errors); + + $AVE_Template->assign('theme_folder', $theme); + $AVE_Template->assign('title', $title); + $AVE_Template->assign('text', $text); + + $AVE_Template->display($tpl_dir . 'poll_form.tpl'); +} /** * Метод создания нового комментария (UTF-8 Only) diff --git a/templates/poll_form.tpl b/templates/poll_form.tpl index 046faac..61a73a3 100644 --- a/templates/poll_form.tpl +++ b/templates/poll_form.tpl @@ -1,93 +1,82 @@ - - - - -{#POLL_ADD_COMMENT#} - - - - +{* Заголовок окна *} +
{#POLL_ADD_COMMENT#}
- +
+ {if $cancomment != 1} +
+ + {#POLL_COMMENT_ERROR#} +
+
+ +
+ {else} +
+ {if $errors} +
+
    + {foreach from=$errors item=error}
  • {$error|escape}
  • {/foreach} +
+
+ {/if} - +
+ + +
-
{#POLL_ADD_COMMENT#}
+
+ + +
+ {#POLL_CHARSET_LEFT#}: {$max_chars} +
+
-
- {if $cancomment != 1} -

{#POLL_COMMENT_ERROR#}

-

 

-

- {else} - - {if $errors}
    - {foreach from=$errors item=error}
  • {$error|escape}
  • - {/foreach} -
{/if} -
- - -

+ {if $anti_spam == 1} +
+
+ + captcha + +
+
+ {/if} -
- -{* - {#POLL_CHARSET_LEFT#} -*} - -
- - {if $anti_spam == 1} -
-{* - -
-
- - -*} -

- -
-
-
-

-
- {/if} - -

-   - -

- - {/if} +
+ + +
+ + {/if}
- - +