From 4d6a76730501a55e696971845c90f364a3921512 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 29 Jun 2003 10:59:36 +0000 Subject: [PATCH] a few fixes git-svn-id: file:///svn/phpbb/trunk@4184 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_display.php | 2 +- phpBB/includes/functions_posting.php | 2 +- phpBB/includes/message_parser.php | 9 +++++++ phpBB/install/install.php | 5 ++++ phpBB/language/en/lang_main.php | 2 ++ phpBB/posting.php | 30 ++++++++++----------- phpBB/templates/subSilver/posting_body.html | 5 ++++ phpBB/viewtopic.php | 3 ++- 8 files changed, 39 insertions(+), 19 deletions(-) diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index e80d29c89f..ea1f8315fa 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -44,7 +44,7 @@ function display_forums($root_data = '', $display_moderators = TRUE) break; default: - $sql_from = '(' . FORUMS_TABLE . ' f LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id)'; + $sql_from = '(' . FORUMS_TABLE . ' f LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id))'; break; } $lastread_select = ', ft.mark_time '; diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index b27c88c3cf..55662b3815 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -124,7 +124,7 @@ function format_display(&$message, &$signature, $uid, $siguid, $html, $bbcode, $ $signature = ''; } - return; + return $message; } // Update Last Post Informations diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 5d58845303..e05f7c8de4 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -830,9 +830,18 @@ class parse_message { $this->warn_msg[] = $user->lang['NO_DELETE_POLL_OPTIONS']; } + elseif ($poll_data['poll_max_options'] > sizeof($poll['poll_options'])) + { + $this->warn_msg[] = $user->lang['TOO_MANY_USER_OPTIONS']; + } $poll['poll_title'] = (!empty($poll_data['poll_title'])) ? trim(htmlspecialchars(strip_tags($poll_data['poll_title']))) : ''; $poll['poll_length'] = (!empty($poll_data['poll_length'])) ? intval($poll_data['poll_length']) : 0; + + if (empty($poll['poll_title']) && $poll['poll_options_size']) + { + $this->warn_msg[] = $user->lang['NO_POLL_TITLE']; + } } $poll['poll_start'] = $poll_data['poll_start']; diff --git a/phpBB/install/install.php b/phpBB/install/install.php index 8b16a148fe..bb0713c6ca 100644 --- a/phpBB/install/install.php +++ b/phpBB/install/install.php @@ -194,6 +194,11 @@ if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$language) } } +if (!$language) +{ + $language = $default_language; +} + include($phpbb_root_path . 'language/' . $language . '/lang_main.'.$phpEx); include($phpbb_root_path . 'language/' . $language . '/lang_admin.'.$phpEx); diff --git a/phpBB/language/en/lang_main.php b/phpBB/language/en/lang_main.php index a840603bc2..407051c7ba 100644 --- a/phpBB/language/en/lang_main.php +++ b/phpBB/language/en/lang_main.php @@ -642,7 +642,9 @@ $lang = array( 'TOO_FEW_POLL_OPTIONS' => 'You must enter at least two poll options', 'TOO_MANY_POLL_OPTIONS' => 'You have tried to enter too many poll options', + 'NO_POLL_TITLE' => 'You have to enter a poll title', 'NO_DELETE_POLL_OPTIONS'=> 'You cannot delete existing poll options', + 'TOO_MANY_USER_OPTIONS' => 'You cannot specify more Options per User than existing poll options', 'GENERAL_UPLOAD_ERROR' => 'Could not upload Attachment to %s', 'TOO_MANY_ATTACHMENTS' => 'Cannot add another attacment, %d is the maxmimum.', diff --git a/phpBB/posting.php b/phpBB/posting.php index 3747c79e29..dd41f0991a 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -221,7 +221,6 @@ if ($sql != '') $db->sql_freeresult($result); } - $message_parser = new parse_message(0); // <- TODO: add constant (MSG_POST/MSG_PM) @@ -479,7 +478,6 @@ if ($mode == 'delete' && $poster_id == $user->data['user_id'] && $auth->acl_get( trigger_error($user->lang['CANNOT_DELETE_REPLIED']); } - if ($mode == 'delete') { trigger_error('USER_CANNOT_DELETE'); @@ -642,18 +640,10 @@ if ($submit || $preview || $refresh) if ($mode != 'edit' || $message_md5 != $post_checksum || $status_switch || $preview) { // Parse message - if ($result = $message_parser->parse($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, $img_status, $flash_status)) - { - $error[] = $result; - } + $message_parser->parse($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, $img_status, $flash_status); } - $result = $message_parser->parse_attachments($mode, $post_id, $submit, $preview, $refresh); - - if (count($result)) - { - $error[] = implode('
', $result); - } + $message_parser->parse_attachments($mode, $post_id, $submit, $preview, $refresh); if ($mode != 'edit' && !$preview && !$refresh && !$auth->acl_get('f_ignoreflood', $forum_id)) { @@ -707,10 +697,7 @@ if ($submit || $preview || $refresh) ); $poll = array(); - if (($result = $message_parser->parse_poll($poll, $poll_data)) != '') - { - $error[] = $result; - } + $message_parser->parse_poll($poll, $poll_data); $poll_options = $poll['poll_options']; $poll_title = $poll['poll_title']; @@ -739,6 +726,11 @@ if ($submit || $preview || $refresh) } } + if (sizeof($message_parser->warn_msg)) + { + $error[] = implode('
', $message_parser->warn_msg); + } + // Store message, sync counters if (!sizeof($error) && $submit) { @@ -1081,6 +1073,12 @@ if (($mode == 'post' || ($mode == 'edit' && $post_id == $topic_first_post_id && 'POLL_LENGTH' => $poll_length) ); } +else if ($mode == 'edit' && !empty($poll_last_vote) && ($auth->acl_get('f_poll', $forum_id) || $auth->acl_get('m_edit', $forum_id))) +{ + $template->assign_vars(array( + 'S_POLL_DELETE' => ($mode == 'edit' && !empty($poll_options) && ($auth->acl_get('f_delete', $forum_id) || $auth->acl_get('m_delete', $forum_id))) ? true : false) + ); +} // Attachment entry if ($auth->acl_get('f_attach', $forum_id) || $auth->acl_get('m_edit', $forum_id)) diff --git a/phpBB/templates/subSilver/posting_body.html b/phpBB/templates/subSilver/posting_body.html index 39be6ebbea..f0f6c21f44 100644 --- a/phpBB/templates/subSilver/posting_body.html +++ b/phpBB/templates/subSilver/posting_body.html @@ -290,6 +290,11 @@ function checkForm() + + + {L_POLL_DELETE} + + {S_HIDDEN_FIELDS}      diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 51938a4923..ddbf82b345 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -538,6 +538,7 @@ if (!empty($poll_start)) ORDER BY poll_option_id'; $result = $db->sql_query($sql); + $poll_info = array(); while ($row = $db->sql_fetchrow($result)) { $poll_info[] = $row; @@ -577,7 +578,7 @@ if (!empty($poll_start)) } $s_can_vote = (((!sizeof($voted_id) && $auth->acl_get('f_vote', $forum_id)) || $auth->acl_get('f_votechg', $forum_id)) && - ($poll_length != 0 && $poll_start + $poll_length > time()) && + (($poll_length != 0 && $poll_start + $poll_length > time()) || ($poll_length == 0)) && $topic_status != ITEM_LOCKED && $forum_status != ITEM_LOCKED) ? true : false; $s_display_results = (!$s_can_vote || ($s_can_vote && sizeof($voted_id)) || $_GET['vote'] = 'viewresult') ? true : false;