mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
- re-enable polls (user is now able to decide if users are able to change votes if this feature is enabled within the given forum)
git-svn-id: file:///svn/phpbb/trunk@4981 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
76f9c1bdad
commit
e593bcf3d7
18 changed files with 260 additions and 149 deletions
|
@ -265,17 +265,21 @@ function get_moderators(&$forum_moderators, $forum_id = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// User authorisation levels output
|
// User authorisation levels output
|
||||||
function gen_forum_auth_level($mode, &$forum_id)
|
function gen_forum_auth_level($mode, $forum_id)
|
||||||
{
|
{
|
||||||
global $SID, $template, $auth, $user;
|
global $SID, $template, $auth, $user;
|
||||||
|
|
||||||
$rules = array('post', 'reply', 'edit', 'delete', 'attach');
|
$rules = array(
|
||||||
|
($auth->acl_get('f_post', $forum_id)) ? $user->lang['RULES_POST_CAN'] : $user->lang['RULES_POST_CANNOT'],
|
||||||
|
($auth->acl_get('f_reply', $forum_id)) ? $user->lang['RULES_REPLY_CAN'] : $user->lang['RULES_REPLY_CANNOT'],
|
||||||
|
($auth->acl_gets('f_edit', 'm_edit', $forum_id)) ? $user->lang['RULES_EDIT_CAN'] : $user->lang['RULES_EDIT_CANNOT'],
|
||||||
|
($auth->acl_gets('f_delete', 'm_delete', $forum_id)) ? $user->lang['RULES_DELETE_CAN'] : $user->lang['RULES_DELETE_CANNOT'],
|
||||||
|
($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach', $forum_id)) ? $user->lang['RULES_ATTACH_CAN'] : $user->lang['RULES_ATTACH_CANNOT']
|
||||||
|
);
|
||||||
|
|
||||||
foreach ($rules as $rule)
|
foreach ($rules as $rule)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('rules', array(
|
$template->assign_block_vars('rules', array('RULE' => $rule));
|
||||||
'RULE' => ($auth->acl_get('f_' . $rule, intval($forum_id))) ? $user->lang['RULES_' . strtoupper($rule) . '_CAN'] : $user->lang['RULES_' . strtoupper($rule) . '_CANNOT'])
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -105,7 +105,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||||
{
|
{
|
||||||
$active_forum_ary['forum_id'][] = $forum_id;
|
$active_forum_ary['forum_id'][] = $forum_id;
|
||||||
$active_forum_ary['enable_icons'][] = $row['enable_icons'];
|
$active_forum_ary['enable_icons'][] = $row['enable_icons'];
|
||||||
$active_forum_ary['forum_topics'] += $row['forum_topics'];
|
$active_forum_ary['forum_topics'] += ($auth->acl_get('m_approve', $forum_id)) ? $row['forum_topics_real'] : $row['forum_topics'];
|
||||||
$active_forum_ary['forum_posts'] += $row['forum_posts'];
|
$active_forum_ary['forum_posts'] += $row['forum_posts'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||||
$subforums[$parent_id]['name'][$forum_id] = $row['forum_name'];
|
$subforums[$parent_id]['name'][$forum_id] = $row['forum_name'];
|
||||||
|
|
||||||
// Include subforum topic/post counts in parent counts
|
// Include subforum topic/post counts in parent counts
|
||||||
$forum_rows[$parent_id]['forum_topics'] += $row['forum_topics'];
|
$forum_rows[$parent_id]['forum_topics'] += ($auth->acl_get('m_approve', $forum_id)) ? $row['forum_topics_real'] : $row['forum_topics'];
|
||||||
|
|
||||||
// Do not list redirects in LINK Forums as Posts.
|
// Do not list redirects in LINK Forums as Posts.
|
||||||
if ($row['forum_type'] != FORUM_LINK)
|
if ($row['forum_type'] != FORUM_LINK)
|
||||||
|
@ -313,7 +313,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
|
||||||
'FORUM_NAME' => $row['forum_name'],
|
'FORUM_NAME' => $row['forum_name'],
|
||||||
'FORUM_DESC' => $row['forum_desc'],
|
'FORUM_DESC' => $row['forum_desc'],
|
||||||
$l_post_click_count => $post_click_count,
|
$l_post_click_count => $post_click_count,
|
||||||
'TOPICS' => $row['forum_topics'],
|
'TOPICS' => ($auth->acl_get('m_approve', $row['forum_id'])) ? $row['forum_topics_real'] : $row['forum_topics'],
|
||||||
'LAST_POST_TIME' => $last_post_time,
|
'LAST_POST_TIME' => $last_post_time,
|
||||||
'LAST_POSTER' => $last_poster,
|
'LAST_POSTER' => $last_poster,
|
||||||
'MODERATORS' => $moderators_list,
|
'MODERATORS' => $moderators_list,
|
||||||
|
|
|
@ -68,7 +68,7 @@ function generate_smilies($mode, $forum_id)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('emoticon', array(
|
$template->assign_block_vars('emoticon', array(
|
||||||
'SMILEY_CODE' => $row['code'],
|
'SMILEY_CODE' => $row['code'],
|
||||||
'SMILEY_IMG' => $config['smilies_path'] . '/' . $row['smile_url'],
|
'SMILEY_IMG' => $phpbb_root_path . $config['smilies_path'] . '/' . $row['smile_url'],
|
||||||
'SMILEY_WIDTH' => $row['smile_width'],
|
'SMILEY_WIDTH' => $row['smile_width'],
|
||||||
'SMILEY_HEIGHT' => $row['smile_height'],
|
'SMILEY_HEIGHT' => $row['smile_height'],
|
||||||
'SMILEY_DESC' => $row['emoticon'])
|
'SMILEY_DESC' => $row['emoticon'])
|
||||||
|
|
|
@ -501,7 +501,7 @@ function place_pm_into_folder($global_privmsgs_rules, $release = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($full_folder_action != FULL_FOLDER_MOVE)
|
if ($full_folder_action < 0)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . "
|
$sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . "
|
||||||
SET folder_id = $dest_folder, new = 0
|
SET folder_id = $dest_folder, new = 0
|
||||||
|
|
|
@ -995,60 +995,56 @@ class parse_message extends bbcode_firstpass
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse Poll
|
// Parse Poll
|
||||||
function parse_poll(&$poll, $poll_data)
|
function parse_poll(&$poll)
|
||||||
{
|
{
|
||||||
global $auth, $forum_id, $user, $config;
|
global $auth, $user, $config;
|
||||||
|
|
||||||
// Need a second look at
|
$poll_max_options = $poll['poll_max_options'];
|
||||||
return;
|
|
||||||
/*
|
|
||||||
// Process poll options
|
|
||||||
if ($poll_data['poll_option_text'] && (($auth->acl_get('f_poll', $forum_id) && !$poll_data['poll_last_vote']) || $auth->acl_get('m_edit', $forum_id)))
|
|
||||||
{
|
|
||||||
$message = $this->message;
|
|
||||||
$this->message = $poll_data['poll_option_text'];
|
|
||||||
|
|
||||||
if (($result = $this->parse($poll_data['enable_html'], $poll_data['enable_bbcode'], $poll_data['bbcode_uid'], $poll_data['enable_urls'], $poll_data['enable_smilies'], false)) != '')
|
// Parse Poll Option text ;)
|
||||||
{
|
$tmp_message = $this->message;
|
||||||
$this->warn_msg[] = $result;
|
$this->message = $poll['poll_option_text'];
|
||||||
}
|
$bbcode_bitfield = $this->bbcode_bitfield;
|
||||||
|
|
||||||
$poll_data['poll_option_text'] = $this->message;
|
$poll['poll_option_text'] = $this->parse($poll['enable_html'], $poll['enable_bbcode'], $poll['enable_urls'], $poll['enable_smilies'], $poll['img_status'], false, false, false);
|
||||||
$this->message = $message;
|
|
||||||
unset($message);
|
|
||||||
|
|
||||||
$poll['poll_options'] = explode("\n", trim($poll_data['poll_option_text']));
|
$this->bbcode_bitfield |= $bbcode_bitfield;
|
||||||
|
$this->message = $tmp_message;
|
||||||
|
|
||||||
|
// Parse Poll Title
|
||||||
|
$tmp_message = $this->message;
|
||||||
|
$this->message = $poll['poll_title'];
|
||||||
|
$bbcode_bitfield = $this->bbcode_bitfield;
|
||||||
|
|
||||||
|
$poll['poll_title'] = $this->parse($poll['enable_html'], $poll['enable_bbcode'], $poll['enable_urls'], $poll['enable_smilies'], $poll['img_status'], false, false, false);
|
||||||
|
|
||||||
|
$this->bbcode_bitfield |= $bbcode_bitfield;
|
||||||
|
$this->message = $tmp_message;
|
||||||
|
|
||||||
|
unset($tmp_message);
|
||||||
|
|
||||||
|
$poll['poll_options'] = explode("\n", trim($poll['poll_option_text']));
|
||||||
$poll['poll_options_size'] = sizeof($poll['poll_options']);
|
$poll['poll_options_size'] = sizeof($poll['poll_options']);
|
||||||
|
|
||||||
if (sizeof($poll['poll_options']) == 1)
|
if (sizeof($poll['poll_options']) == 1)
|
||||||
{
|
{
|
||||||
$this->warn_msg[] = $user->lang['TOO_FEW_POLL_OPTIONS'];
|
$this->warn_msg[] = $user->lang['TOO_FEW_POLL_OPTIONS'];
|
||||||
}
|
}
|
||||||
elseif (sizeof($poll['poll_options']) > intval($config['max_poll_options']))
|
else if ($poll['poll_options_size'] > (int) $config['max_poll_options'])
|
||||||
{
|
{
|
||||||
$this->warn_msg[] = $user->lang['TOO_MANY_POLL_OPTIONS'];
|
$this->warn_msg[] = $user->lang['TOO_MANY_POLL_OPTIONS'];
|
||||||
}
|
}
|
||||||
elseif (sizeof($poll['poll_options']) < $poll['poll_options_size'])
|
else if ($poll_max_options > $poll['poll_options_size'])
|
||||||
{
|
|
||||||
$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'];
|
$this->warn_msg[] = $user->lang['TOO_MANY_USER_OPTIONS'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$poll['poll_title'] = ($poll_data['poll_title']) ? $poll_data['poll_title'] : '';
|
|
||||||
$poll['poll_length'] = ($poll_data['poll_length']) ? intval($poll_data['poll_length']) : 0;
|
|
||||||
|
|
||||||
if (!$poll['poll_title'] && $poll['poll_options_size'])
|
if (!$poll['poll_title'] && $poll['poll_options_size'])
|
||||||
{
|
{
|
||||||
$this->warn_msg[] = $user->lang['NO_POLL_TITLE'];
|
$this->warn_msg[] = $user->lang['NO_POLL_TITLE'];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$poll['poll_start'] = $poll_data['poll_start'];
|
$poll['poll_max_options'] = ($poll['poll_max_options'] < 1) ? 1 : (($poll['poll_max_options'] > $config['max_poll_options']) ? $config['max_poll_options'] : $poll['poll_max_options']);
|
||||||
$poll['poll_max_options'] = ($poll_data['poll_max_options'] < 1) ? 1 : (($poll_data['poll_max_options'] > $config['max_poll_options']) ? $config['max_poll_options'] : $poll_data['poll_max_options']);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -751,7 +751,7 @@ class user extends session
|
||||||
static $imgs;
|
static $imgs;
|
||||||
global $phpbb_root_path;
|
global $phpbb_root_path;
|
||||||
|
|
||||||
if (empty($imgs[$img . $suffix]) || $width)
|
if (empty($imgs[$img . $suffix]) || $width !== false)
|
||||||
{
|
{
|
||||||
if (!isset($this->theme['primary'][$img]) || !$this->theme['primary'][$img])
|
if (!isset($this->theme['primary'][$img]) || !$this->theme['primary'][$img])
|
||||||
{
|
{
|
||||||
|
@ -760,7 +760,7 @@ class user extends session
|
||||||
return $imgs[$img . $suffix];
|
return $imgs[$img . $suffix];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$width)
|
if ($width === false)
|
||||||
{
|
{
|
||||||
list($imgsrc, $height, $width) = explode('*', $this->theme['primary'][$img]);
|
list($imgsrc, $height, $width) = explode('*', $this->theme['primary'][$img]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,9 +153,9 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
|
||||||
|
|
||||||
'ONLINE_IMG' => (!$config['load_onlinetrack']) ? '' : (($user_info['online']) ? $user->img('btn_online', $user->lang['ONLINE']) : $user->img('btn_offline', $user->lang['OFFLINE'])),
|
'ONLINE_IMG' => (!$config['load_onlinetrack']) ? '' : (($user_info['online']) ? $user->img('btn_online', $user->lang['ONLINE']) : $user->img('btn_offline', $user->lang['OFFLINE'])),
|
||||||
'DELETE_IMG' => $user->img('btn_delete', $user->lang['DELETE_PM']),
|
'DELETE_IMG' => $user->img('btn_delete', $user->lang['DELETE_PM']),
|
||||||
'IP_IMG' => $user->img('btn_ip', $user->lang['VIEW_IP']),
|
'INFO_IMG' => $user->img('btn_info', $user->lang['VIEW_PM_INFO']),
|
||||||
'REPORT_IMG' => $user->img('btn_report', $user->lang['REPORT_PM']),
|
'REPORT_IMG' => $user->img('btn_report', $user->lang['REPORT_PM']),
|
||||||
'REPORTED_IMG' => $user->img('icon_reported', $user->lang['REPORTED_MESSAGE']),
|
'REPORTED_IMG' => $user->img('icon_reported', $user->lang['MESSAGE_REPORTED_MESSAGE']),
|
||||||
'PROFILE_IMG' => $user->img('btn_profile', $user->lang['READ_PROFILE']),
|
'PROFILE_IMG' => $user->img('btn_profile', $user->lang['READ_PROFILE']),
|
||||||
'EMAIL_IMG' => $user->img('btn_email', $user->lang['SEND_EMAIL']),
|
'EMAIL_IMG' => $user->img('btn_email', $user->lang['SEND_EMAIL']),
|
||||||
'QUOTE_IMG' => $user->img('btn_quote', $user->lang['POST_QUOTE_PM']),
|
'QUOTE_IMG' => $user->img('btn_quote', $user->lang['POST_QUOTE_PM']),
|
||||||
|
@ -171,7 +171,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
|
||||||
|
|
||||||
'U_MCP_REPORT' => "{$phpbb_root_path}mcp.$phpEx$SID&mode=pm_details&p=" . $message_row['msg_id'],
|
'U_MCP_REPORT' => "{$phpbb_root_path}mcp.$phpEx$SID&mode=pm_details&p=" . $message_row['msg_id'],
|
||||||
'U_REPORT' => ($config['auth_report_pm'] && $auth->acl_get('u_pm_report')) ? "{$phpbb_root_path}report.$phpEx$SID&pm=" . $message_row['msg_id'] : '',
|
'U_REPORT' => ($config['auth_report_pm'] && $auth->acl_get('u_pm_report')) ? "{$phpbb_root_path}report.$phpEx$SID&pm=" . $message_row['msg_id'] : '',
|
||||||
'U_IP' => ($auth->acl_get('m_ip') && $message_row['message_reported']) ? "{$phpbb_root_path}mcp.$phpEx?sid=" . $user->session_id . "&mode=pm_details&p=" . $message_row['msg_id'] . '#ip' : '',
|
'U_INFO' => ($auth->acl_get('m_') && ($message_row['message_reported'] || $message_row['forwarded'])) ? "{$phpbb_root_path}mcp.$phpEx$SID&mode=pm_details&p=" . $message_row['msg_id'] : '',
|
||||||
'U_DELETE' => ($auth->acl_get('u_pm_delete')) ? "$url&mode=compose&action=delete&f=$folder_id&p=" . $message_row['msg_id'] : '',
|
'U_DELETE' => ($auth->acl_get('u_pm_delete')) ? "$url&mode=compose&action=delete&f=$folder_id&p=" . $message_row['msg_id'] : '',
|
||||||
'U_AUTHOR_PROFILE' => "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u=" . $author_id,
|
'U_AUTHOR_PROFILE' => "{$phpbb_root_path}memberlist.$phpEx$SID&mode=viewprofile&u=" . $author_id,
|
||||||
'U_EMAIL' => $user_info['email'],
|
'U_EMAIL' => $user_info['email'],
|
||||||
|
@ -201,7 +201,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_REQUEST['view'] != 'print')
|
if (!isset($_REQUEST['view']) || $_REQUEST['view'] != 'print')
|
||||||
{
|
{
|
||||||
// Message History
|
// Message History
|
||||||
if (message_history($msg_id, $user->data['user_id'], $message_row, $folder))
|
if (message_history($msg_id, $user->data['user_id'], $message_row, $folder))
|
||||||
|
|
|
@ -802,8 +802,9 @@ CREATE TABLE phpbb_topics (
|
||||||
poll_title varchar(255) NOT NULL,
|
poll_title varchar(255) NOT NULL,
|
||||||
poll_start int(11) DEFAULT '0' NOT NULL,
|
poll_start int(11) DEFAULT '0' NOT NULL,
|
||||||
poll_length int(11) DEFAULT '0' NOT NULL,
|
poll_length int(11) DEFAULT '0' NOT NULL,
|
||||||
poll_max_options tinyint(4) UNSIGNED NOT NULL DEFAULT '1',
|
poll_max_options tinyint(4) UNSIGNED DEFAULT '1' NOT NULL,
|
||||||
poll_last_vote int(11),
|
poll_last_vote int(11) UNSIGNED DEFAULT '0',
|
||||||
|
poll_vote_change tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
|
||||||
PRIMARY KEY (topic_id),
|
PRIMARY KEY (topic_id),
|
||||||
KEY forum_id (forum_id),
|
KEY forum_id (forum_id),
|
||||||
KEY forum_id_type (forum_id, topic_type),
|
KEY forum_id_type (forum_id, topic_type),
|
||||||
|
|
|
@ -333,6 +333,7 @@ $lang += array(
|
||||||
'SORT_BY' => 'Sort by',
|
'SORT_BY' => 'Sort by',
|
||||||
'SORT_JOINED' => 'Joined Date',
|
'SORT_JOINED' => 'Joined Date',
|
||||||
'SORT_LOCATION' => 'Location',
|
'SORT_LOCATION' => 'Location',
|
||||||
|
'SORT_RANK' => 'Rank',
|
||||||
'SORT_TOPIC_TITLE' => 'Topic Title',
|
'SORT_TOPIC_TITLE' => 'Topic Title',
|
||||||
'SORT_USERNAME' => 'Username',
|
'SORT_USERNAME' => 'Username',
|
||||||
'SPLIT_TOPIC' => 'Split Topic',
|
'SPLIT_TOPIC' => 'Split Topic',
|
||||||
|
|
|
@ -136,6 +136,8 @@ $lang += array(
|
||||||
'POLL_OPTIONS' => 'Poll options',
|
'POLL_OPTIONS' => 'Poll options',
|
||||||
'POLL_OPTIONS_EXPLAIN' => 'Place each option on a new line. You may enter up to <b>%d</b> options',
|
'POLL_OPTIONS_EXPLAIN' => 'Place each option on a new line. You may enter up to <b>%d</b> options',
|
||||||
'POLL_QUESTION' => 'Poll question',
|
'POLL_QUESTION' => 'Poll question',
|
||||||
|
'POLL_VOTE_CHANGE' => 'Allow Vote Change',
|
||||||
|
'POLL_VOTE_CHANGE_EXPLAIN' => 'If enabled users are able to change their vote.',
|
||||||
'POSTED_ATTACHMENTS' => 'Posted attachments',
|
'POSTED_ATTACHMENTS' => 'Posted attachments',
|
||||||
'POST_ANNOUNCEMENT' => 'Announce',
|
'POST_ANNOUNCEMENT' => 'Announce',
|
||||||
'POST_DELETED' => 'Your message has been deleted successfully',
|
'POST_DELETED' => 'Your message has been deleted successfully',
|
||||||
|
|
|
@ -119,6 +119,7 @@ $lang += array(
|
||||||
|
|
||||||
'EDIT_DRAFT_EXPLAIN' => 'Here you are able to edit your draft.',
|
'EDIT_DRAFT_EXPLAIN' => 'Here you are able to edit your draft.',
|
||||||
'EMAIL_REMIND' => 'This must be the email address you supplied when registering.',
|
'EMAIL_REMIND' => 'This must be the email address you supplied when registering.',
|
||||||
|
'EMAIL_PM' => 'Email PM',
|
||||||
'EMPTY_DRAFT' => 'You must enter a message to submit your changes',
|
'EMPTY_DRAFT' => 'You must enter a message to submit your changes',
|
||||||
'EMPTY_DRAFT_TITLE' => 'You must enter a draft title',
|
'EMPTY_DRAFT_TITLE' => 'You must enter a draft title',
|
||||||
'EXPORT_AS_XML' => 'Export as XML',
|
'EXPORT_AS_XML' => 'Export as XML',
|
||||||
|
@ -168,6 +169,7 @@ $lang += array(
|
||||||
'MAX_FOLDER_REACHED' => 'Maximum number of allowed user defined folder reached',
|
'MAX_FOLDER_REACHED' => 'Maximum number of allowed user defined folder reached',
|
||||||
'MESSAGE_COLOURS' => 'Message Colours',
|
'MESSAGE_COLOURS' => 'Message Colours',
|
||||||
'MESSAGE_HISTORY' => 'Message History',
|
'MESSAGE_HISTORY' => 'Message History',
|
||||||
|
'MESSAGE_REPORTED' => 'Click to view reports',
|
||||||
'MESSAGE_REPORTED_MESSAGE' => 'Reported Message',
|
'MESSAGE_REPORTED_MESSAGE' => 'Reported Message',
|
||||||
'MESSAGE_STORED' => 'The message has been send successfully',
|
'MESSAGE_STORED' => 'The message has been send successfully',
|
||||||
'MINIMUM_KARMA' => 'Minimum User Karma',
|
'MINIMUM_KARMA' => 'Minimum User Karma',
|
||||||
|
@ -319,6 +321,7 @@ $lang += array(
|
||||||
'VIEW_NEXT_HISTORY' => 'Next PM in history',
|
'VIEW_NEXT_HISTORY' => 'Next PM in history',
|
||||||
'VIEW_NEXT_PM' => 'Next PM',
|
'VIEW_NEXT_PM' => 'Next PM',
|
||||||
'VIEW_PM' => 'View Message',
|
'VIEW_PM' => 'View Message',
|
||||||
|
'VIEW_PM_INFO' => 'Message Details',
|
||||||
'VIEW_PM_MESSAGE' => '1 Message',
|
'VIEW_PM_MESSAGE' => '1 Message',
|
||||||
'VIEW_PM_MESSAGES' => '%d Messages',
|
'VIEW_PM_MESSAGES' => '%d Messages',
|
||||||
'VIEW_PREVIOUS_HISTORY' => 'Previous PM in history',
|
'VIEW_PREVIOUS_HISTORY' => 'Previous PM in history',
|
||||||
|
|
|
@ -716,7 +716,7 @@ switch ($mode)
|
||||||
|
|
||||||
// Are we looking at a usergroup? If so, fetch additional info
|
// Are we looking at a usergroup? If so, fetch additional info
|
||||||
// and further restrict the user info query
|
// and further restrict the user info query
|
||||||
$sql_from = '';
|
$sql_from = $sql_where = '';
|
||||||
if ($mode == 'group')
|
if ($mode == 'group')
|
||||||
{
|
{
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT *
|
||||||
|
@ -783,7 +783,7 @@ switch ($mode)
|
||||||
'AVATAR_IMG' => $avatar_img,
|
'AVATAR_IMG' => $avatar_img,
|
||||||
'RANK_IMG' => $rank_img,
|
'RANK_IMG' => $rank_img,
|
||||||
|
|
||||||
'U_PM' => ($auth->acl_get('u_sendpm')) ? "ucp.$phpEx$SID&i=pm&mode=compose&g=$group_id" : '',)
|
'U_PM' => ($auth->acl_get('u_sendpm') && $group_receive_pm && $config['allow_mass_pm']) ? "ucp.$phpEx$SID&i=pm&mode=compose&g=$group_id" : '',)
|
||||||
);
|
);
|
||||||
|
|
||||||
$sql_from = ', ' . USER_GROUP_TABLE . ' ug ';
|
$sql_from = ', ' . USER_GROUP_TABLE . ' ug ';
|
||||||
|
@ -915,18 +915,18 @@ switch ($mode)
|
||||||
'SEARCH_IMG' => $user->img('btn_search', $user->lang['SEARCH']),
|
'SEARCH_IMG' => $user->img('btn_search', $user->lang['SEARCH']),
|
||||||
|
|
||||||
'U_FIND_MEMBER' => (!empty($config['load_search']) || $auth->acl_get('a_')) ? "memberlist.$phpEx$SID&mode=searchuser" : '',
|
'U_FIND_MEMBER' => (!empty($config['load_search']) || $auth->acl_get('a_')) ? "memberlist.$phpEx$SID&mode=searchuser" : '',
|
||||||
'U_SORT_USERNAME' => "memberlist.$phpEx$SID&sk=a&sd=" . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),
|
'U_SORT_USERNAME' => $pagination_url . '&sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),
|
||||||
'U_SORT_FROM' => "memberlist.$phpEx$SID&sk=b&sd=" . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
|
'U_SORT_FROM' => $pagination_url . '&sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
|
||||||
'U_SORT_JOINED' => "memberlist.$phpEx$SID&sk=c&sd=" . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),
|
'U_SORT_JOINED' => $pagination_url . '&sk=c&sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),
|
||||||
'U_SORT_POSTS' => "memberlist.$phpEx$SID&sk=d&sd=" . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),
|
'U_SORT_POSTS' => $pagination_url . '&sk=d&sd=' . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),
|
||||||
'U_SORT_EMAIL' => "memberlist.$phpEx$SID&sk=e&sd=" . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),
|
'U_SORT_EMAIL' => $pagination_url . '&sk=e&sd=' . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),
|
||||||
'U_SORT_WEBSITE' => "memberlist.$phpEx$SID&sk=f&sd=" . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
|
'U_SORT_WEBSITE' => $pagination_url . '&sk=f&sd=' . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
|
||||||
'U_SORT_ICQ' => "memberlist.$phpEx$SID&sk=g&sd=" . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'),
|
'U_SORT_ICQ' => $pagination_url . '&sk=g&sd=' . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'),
|
||||||
'U_SORT_AIM' => "memberlist.$phpEx$SID&sk=h&sd=" . (($sort_key == 'h' && $sort_dir == 'a') ? 'd' : 'a'),
|
'U_SORT_AIM' => $pagination_url . '&sk=h&sd=' . (($sort_key == 'h' && $sort_dir == 'a') ? 'd' : 'a'),
|
||||||
'U_SORT_MSN' => "memberlist.$phpEx$SID&sk=i&sd=" . (($sort_key == 'i' && $sort_dir == 'a') ? 'd' : 'a'),
|
'U_SORT_MSN' => $pagination_url . '&sk=i&sd=' . (($sort_key == 'i' && $sort_dir == 'a') ? 'd' : 'a'),
|
||||||
'U_SORT_YIM' => "memberlist.$phpEx$SID&sk=j&sd=" . (($sort_key == 'j' && $sort_dir == 'a') ? 'd' : 'a'),
|
'U_SORT_YIM' => $pagination_url . '&sk=j&sd=' . (($sort_key == 'j' && $sort_dir == 'a') ? 'd' : 'a'),
|
||||||
'U_SORT_ACTIVE' => "memberlist.$phpEx$SID&sk=k&sd=" . (($sort_key == 'k' && $sort_dir == 'a') ? 'd' : 'a'),
|
'U_SORT_ACTIVE' => $pagination_url . '&sk=k&sd=' . (($sort_key == 'k' && $sort_dir == 'a') ? 'd' : 'a'),
|
||||||
'U_SORT_RANK' => "memberlist.$phpEx$SID&sk=l&sd=" . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a'),
|
'U_SORT_RANK' => $pagination_url . '&sk=l&sd=' . (($sort_key == 'l' && $sort_dir == 'a') ? 'd' : 'a'),
|
||||||
|
|
||||||
'S_SHOW_GROUP' => ($mode == 'group') ? true : false,
|
'S_SHOW_GROUP' => ($mode == 'group') ? true : false,
|
||||||
'S_MODE_SELECT' => $s_sort_key,
|
'S_MODE_SELECT' => $s_sort_key,
|
||||||
|
|
|
@ -138,7 +138,7 @@ if ($sql)
|
||||||
|
|
||||||
$post_edit_locked = (isset($post_edit_locked)) ? (int) $post_edit_locked : 0;
|
$post_edit_locked = (isset($post_edit_locked)) ? (int) $post_edit_locked : 0;
|
||||||
|
|
||||||
$user->setup(array('posting', 'mcp'), $forum_style);
|
$user->setup(array('posting', 'mcp', 'viewtopic'), $forum_style);
|
||||||
|
|
||||||
if ($forum_password)
|
if ($forum_password)
|
||||||
{
|
{
|
||||||
|
@ -154,6 +154,7 @@ if ($sql)
|
||||||
$post_subject = (in_array($mode, array('quote', 'edit', 'delete'))) ? $post_subject : ((isset($topic_title)) ? $topic_title : '');
|
$post_subject = (in_array($mode, array('quote', 'edit', 'delete'))) ? $post_subject : ((isset($topic_title)) ? $topic_title : '');
|
||||||
|
|
||||||
$topic_time_limit = (isset($topic_time_limit)) ? (($topic_time_limit) ? (int) $topic_time_limit / 86400 : (int) $topic_time_limit) : 0;
|
$topic_time_limit = (isset($topic_time_limit)) ? (($topic_time_limit) ? (int) $topic_time_limit / 86400 : (int) $topic_time_limit) : 0;
|
||||||
|
|
||||||
$poll_length = (isset($poll_length)) ? (($poll_length) ? (int) $poll_length / 86400 : (int) $poll_length) : 0;
|
$poll_length = (isset($poll_length)) ? (($poll_length) ? (int) $poll_length / 86400 : (int) $poll_length) : 0;
|
||||||
$poll_start = (isset($poll_start)) ? (int) $poll_start : 0;
|
$poll_start = (isset($poll_start)) ? (int) $poll_start : 0;
|
||||||
$poll_options = array();
|
$poll_options = array();
|
||||||
|
@ -179,6 +180,7 @@ if ($sql)
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$orig_poll_options_size = sizeof($poll_options);
|
||||||
$message_parser = new parse_message();
|
$message_parser = new parse_message();
|
||||||
|
|
||||||
if (isset($post_text))
|
if (isset($post_text))
|
||||||
|
@ -492,7 +494,6 @@ if ($load && $drafts)
|
||||||
if ($submit || $preview || $refresh)
|
if ($submit || $preview || $refresh)
|
||||||
{
|
{
|
||||||
$topic_cur_post_id = request_var('topic_cur_post_id', 0);
|
$topic_cur_post_id = request_var('topic_cur_post_id', 0);
|
||||||
|
|
||||||
$subject = request_var('subject', '');
|
$subject = request_var('subject', '');
|
||||||
|
|
||||||
if (strcmp($subject, strtoupper($subject)) == 0 && $subject)
|
if (strcmp($subject, strtoupper($subject)) == 0 && $subject)
|
||||||
|
@ -532,19 +533,35 @@ if ($submit || $preview || $refresh)
|
||||||
$status_switch = 1;
|
$status_switch = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($poll_delete && (($mode == 'edit' && $poll_options && !$poll_last_vote && $poster_id == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id)))
|
|
||||||
{
|
|
||||||
// Delete Poll
|
// Delete Poll
|
||||||
|
if ($poll_delete && $mode == 'edit' && $poll_options &&
|
||||||
|
((!$poll_last_vote && $poster_id == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id)))
|
||||||
|
{
|
||||||
|
switch (SQL_LAYER)
|
||||||
|
{
|
||||||
|
case 'mysql4':
|
||||||
$sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . ', ' . POLL_VOTES_TABLE . "
|
$sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . ', ' . POLL_VOTES_TABLE . "
|
||||||
WHERE topic_id = $topic_id";
|
WHERE topic_id = $topic_id";
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . "
|
||||||
|
WHERE topic_id = $topic_id";
|
||||||
|
$db->sql_query($sql);
|
||||||
|
|
||||||
|
$sql = 'DELETE FROM ' . POLL_VOTES_TABLE . "
|
||||||
|
WHERE topic_id = $topic_id";
|
||||||
|
$db->sql_query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
$topic_sql = array(
|
$topic_sql = array(
|
||||||
'poll_title' => '',
|
'poll_title' => '',
|
||||||
'poll_start' => 0,
|
'poll_start' => 0,
|
||||||
'poll_length' => 0,
|
'poll_length' => 0,
|
||||||
'poll_last_vote' => 0,
|
'poll_last_vote' => 0,
|
||||||
'poll_max_options' => 0
|
'poll_max_options' => 0,
|
||||||
|
'poll_vote_change' => 0
|
||||||
);
|
);
|
||||||
|
|
||||||
$sql = 'UPDATE ' . TOPICS_TABLE . '
|
$sql = 'UPDATE ' . TOPICS_TABLE . '
|
||||||
|
@ -552,7 +569,8 @@ if ($submit || $preview || $refresh)
|
||||||
WHERE topic_id = $topic_id";
|
WHERE topic_id = $topic_id";
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$poll_title = $poll_length = $poll_option_text = $poll_max_options = '';
|
$poll_title = $poll_option_text = '';
|
||||||
|
$poll_vote_change = $poll_max_options = $poll_length = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -560,9 +578,9 @@ if ($submit || $preview || $refresh)
|
||||||
$poll_length = request_var('poll_length', 0);
|
$poll_length = request_var('poll_length', 0);
|
||||||
$poll_option_text = request_var('poll_option_text', '');
|
$poll_option_text = request_var('poll_option_text', '');
|
||||||
$poll_max_options = request_var('poll_max_options', 1);
|
$poll_max_options = request_var('poll_max_options', 1);
|
||||||
|
$poll_vote_change = ($auth->acl_get('f_votechg', $forum_id) && isset($_POST['poll_vote_change'])) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// If replying/quoting and last post id has changed
|
// If replying/quoting and last post id has changed
|
||||||
// give user option to continue submit or return to post
|
// give user option to continue submit or return to post
|
||||||
// notify and show user the post made between his request and the final submit
|
// notify and show user the post made between his request and the final submit
|
||||||
|
@ -644,26 +662,42 @@ if ($submit || $preview || $refresh)
|
||||||
$error[] = $user->lang['EMPTY_SUBJECT'];
|
$error[] = $user->lang['EMPTY_SUBJECT'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$poll_data = array(
|
$poll_last_vote = (isset($poll_last_vote)) ? $poll_last_vote : 0;
|
||||||
|
|
||||||
|
if ($poll_option_text &&
|
||||||
|
($mode == 'post' || ($mode == 'edit' && $post_id == $topic_first_post_id && (!$poll_last_vote || $auth->acl_get('m_edit', $forum_id))))
|
||||||
|
&& $auth->acl_get('f_poll', $forum_id))
|
||||||
|
{
|
||||||
|
$poll = array(
|
||||||
'poll_title' => $poll_title,
|
'poll_title' => $poll_title,
|
||||||
'poll_length' => $poll_length,
|
'poll_length' => $poll_length,
|
||||||
'poll_max_options' => $poll_max_options,
|
'poll_max_options' => $poll_max_options,
|
||||||
'poll_option_text' => $poll_option_text,
|
'poll_option_text' => $poll_option_text,
|
||||||
'poll_start' => $poll_start,
|
'poll_start' => $poll_start,
|
||||||
'poll_last_vote' => (isset($poll_last_vote)) ? $poll_last_vote : 0,
|
'poll_last_vote' => $poll_last_vote,
|
||||||
|
'poll_vote_change' => $poll_vote_change,
|
||||||
'enable_html' => $enable_html,
|
'enable_html' => $enable_html,
|
||||||
'enable_bbcode' => $enable_bbcode,
|
'enable_bbcode' => $enable_bbcode,
|
||||||
'bbcode_uid' => $message_parser->bbcode_uid,
|
|
||||||
'enable_urls' => $enable_urls,
|
'enable_urls' => $enable_urls,
|
||||||
'enable_smilies' => $enable_smilies
|
'enable_smilies' => $enable_smilies,
|
||||||
|
'img_status' => $img_status
|
||||||
);
|
);
|
||||||
|
|
||||||
$poll = array();
|
$message_parser->parse_poll($poll);
|
||||||
$message_parser->parse_poll($poll, $poll_data);
|
|
||||||
|
|
||||||
$poll_options = isset($poll['poll_options']) ? $poll['poll_options'] : '';
|
$poll_options = isset($poll['poll_options']) ? $poll['poll_options'] : '';
|
||||||
$poll_title = isset($poll['poll_title']) ? $poll['poll_title'] : '';
|
$poll_title = isset($poll['poll_title']) ? $poll['poll_title'] : '';
|
||||||
|
|
||||||
|
if ($poll_last_vote && ($poll['poll_options_size'] < $orig_poll_options_size))
|
||||||
|
{
|
||||||
|
$message_parser->warn_msg[] = $user->lang['NO_DELETE_POLL_OPTIONS'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$poll = array();
|
||||||
|
}
|
||||||
|
|
||||||
// Check topic type
|
// Check topic type
|
||||||
if ($topic_type != POST_NORMAL && ($mode == 'post' || ($mode == 'edit' && $topic_first_post_id == $post_id)))
|
if ($topic_type != POST_NORMAL && ($mode == 'post' || ($mode == 'edit' && $topic_first_post_id == $post_id)))
|
||||||
{
|
{
|
||||||
|
@ -836,19 +870,35 @@ if (!sizeof($error) && $preview)
|
||||||
$preview_subject = censor_text($subject);
|
$preview_subject = censor_text($subject);
|
||||||
|
|
||||||
// Poll Preview
|
// Poll Preview
|
||||||
if (($mode == 'post' || ($mode == 'edit' && $post_id == $topic_first_post_id && !$poll_last_vote)) && ($auth->acl_get('f_poll', $forum_id) || $auth->acl_get('m_edit', $forum_id)) && $poll_title)
|
if (($mode == 'post' || ($mode == 'edit' && $post_id == $topic_first_post_id && (!$poll_last_vote || $auth->acl_get('m_edit', $forum_id))))
|
||||||
|
&& $auth->acl_get('f_poll', $forum_id))
|
||||||
{
|
{
|
||||||
|
$parse_poll = new parse_message($poll_title);
|
||||||
|
$parse_poll->bbcode_uid = $message_parser->bbcode_uid;
|
||||||
|
$parse_poll->bbcode_bitfield = $message_parser->bbcode_bitfield;
|
||||||
|
|
||||||
|
$parse_poll->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies);
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_HAS_POLL_OPTIONS'=> (sizeof($poll_options)),
|
'S_HAS_POLL_OPTIONS'=> (sizeof($poll_options)),
|
||||||
'POLL_QUESTION' => $poll_title)
|
'S_IS_MULTI_CHOICE' => ($poll_max_options > 1) ? true : false,
|
||||||
|
|
||||||
|
'POLL_QUESTION' => $parse_poll->message,
|
||||||
|
|
||||||
|
'L_POLL_LENGTH' => ($poll_length) ? sprintf($user->lang['POLL_RUN_TILL'], $user->format_date($poll_length + $poll_start)) : '',
|
||||||
|
'L_MAX_VOTES' => ($poll_max_options == 1) ? $user->lang['MAX_OPTION_SELECT'] : sprintf($user->lang['MAX_OPTIONS_SELECT'], $poll_max_options))
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($poll_options as $option)
|
$parse_poll->message = implode("\n", $poll_options);
|
||||||
|
$parse_poll->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies);
|
||||||
|
$preview_poll_options = explode('<br />', $parse_poll->message);
|
||||||
|
unset($parse_poll);
|
||||||
|
|
||||||
|
foreach ($preview_poll_options as $option)
|
||||||
{
|
{
|
||||||
$template->assign_block_vars('poll_option', array(
|
$template->assign_block_vars('poll_option', array('POLL_OPTION_CAPTION' => $option));
|
||||||
'POLL_OPTION_CAPTION' => $option)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
unset($preview_poll_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attachment Preview
|
// Attachment Preview
|
||||||
|
@ -892,6 +942,20 @@ if (($mode == 'reply' || $mode == 'quote') && !$preview && !$refresh)
|
||||||
$attachment_data = $message_parser->attachment_data;
|
$attachment_data = $message_parser->attachment_data;
|
||||||
$filename_data = $message_parser->filename_data;
|
$filename_data = $message_parser->filename_data;
|
||||||
$post_text = $message_parser->message;
|
$post_text = $message_parser->message;
|
||||||
|
|
||||||
|
if (sizeof($poll_options) && $poll_title)
|
||||||
|
{
|
||||||
|
$message_parser->message = $poll_title;
|
||||||
|
$message_parser->bbcode_uid = $bbcode_uid;
|
||||||
|
|
||||||
|
$message_parser->decode_message();
|
||||||
|
$poll_title = $message_parser->message;
|
||||||
|
|
||||||
|
$message_parser->message = implode("\n", $poll_options);
|
||||||
|
$message_parser->decode_message();
|
||||||
|
$poll_options = explode("\n", $message_parser->message);
|
||||||
|
}
|
||||||
|
|
||||||
unset($message_parser);
|
unset($message_parser);
|
||||||
|
|
||||||
// MAIN POSTING PAGE BEGINS HERE
|
// MAIN POSTING PAGE BEGINS HERE
|
||||||
|
@ -1038,26 +1102,23 @@ $template->assign_vars(array(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Poll entry
|
// Poll entry
|
||||||
if (($mode == 'post' || ($mode == 'edit' && $post_id == $topic_first_post_id && !$poll_last_vote)) && ($auth->acl_get('f_poll', $forum_id) || $auth->acl_get('m_edit', $forum_id)))
|
if (($mode == 'post' || ($mode == 'edit' && $post_id == $topic_first_post_id && (!$poll_last_vote || $auth->acl_get('m_edit', $forum_id))))
|
||||||
|
&& $auth->acl_get('f_poll', $forum_id))
|
||||||
{
|
{
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_SHOW_POLL_BOX' => true,
|
'S_SHOW_POLL_BOX' => true,
|
||||||
|
'S_POLL_VOTE_CHANGE' => ($auth->acl_get('f_votechg', $forum_id)),
|
||||||
'S_POLL_DELETE' => ($mode == 'edit' && $poll_options && ((!$poll_last_vote && $poster_id == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))),
|
'S_POLL_DELETE' => ($mode == 'edit' && $poll_options && ((!$poll_last_vote && $poster_id == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))),
|
||||||
|
|
||||||
'L_POLL_OPTIONS_EXPLAIN'=> sprintf($user->lang['POLL_OPTIONS_EXPLAIN'], $config['max_poll_options']),
|
'L_POLL_OPTIONS_EXPLAIN'=> sprintf($user->lang['POLL_OPTIONS_EXPLAIN'], $config['max_poll_options']),
|
||||||
|
|
||||||
|
'VOTE_CHANGE_CHECKED' => (isset($poll_vote_change) && $poll_vote_change) ? ' checked="checked"' : '',
|
||||||
'POLL_TITLE' => (isset($poll_title)) ? $poll_title : '',
|
'POLL_TITLE' => (isset($poll_title)) ? $poll_title : '',
|
||||||
'POLL_OPTIONS' => (isset($poll_options) && $poll_options) ? implode("\n", $poll_options) : '',
|
'POLL_OPTIONS' => (isset($poll_options) && $poll_options) ? implode("\n", $poll_options) : '',
|
||||||
'POLL_MAX_OPTIONS' => (isset($poll_max_options)) ? (int) $poll_max_options : 1,
|
'POLL_MAX_OPTIONS' => (isset($poll_max_options)) ? (int) $poll_max_options : 1,
|
||||||
'POLL_LENGTH' => $poll_length)
|
'POLL_LENGTH' => $poll_length)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if ($mode == 'edit' && $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' && $poll_options && ($auth->acl_get('f_delete', $forum_id) || $auth->acl_get('m_delete', $forum_id))))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Attachment entry
|
// Attachment entry
|
||||||
// Not using acl_gets here, because it is using OR logic
|
// Not using acl_gets here, because it is using OR logic
|
||||||
|
@ -1371,7 +1432,8 @@ function submit_post($mode, $subject, $username, $topic_type, $poll, $data, $upd
|
||||||
'poll_title' => $poll['poll_title'],
|
'poll_title' => $poll['poll_title'],
|
||||||
'poll_start' => ($poll['poll_start']) ? $poll['poll_start'] : $current_time,
|
'poll_start' => ($poll['poll_start']) ? $poll['poll_start'] : $current_time,
|
||||||
'poll_max_options' => $poll['poll_max_options'],
|
'poll_max_options' => $poll['poll_max_options'],
|
||||||
'poll_length' => $poll['poll_length'] * 86400)
|
'poll_length' => ($poll['poll_length'] * 86400),
|
||||||
|
'poll_vote_change' => $poll['poll_vote_change'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1406,9 +1468,10 @@ function submit_post($mode, $subject, $username, $topic_type, $poll, $data, $upd
|
||||||
'poll_title' => ($poll['poll_options']) ? $poll['poll_title'] : '',
|
'poll_title' => ($poll['poll_options']) ? $poll['poll_title'] : '',
|
||||||
'poll_start' => ($poll['poll_options']) ? (($poll['poll_start']) ? $poll['poll_start'] : $current_time) : 0,
|
'poll_start' => ($poll['poll_options']) ? (($poll['poll_start']) ? $poll['poll_start'] : $current_time) : 0,
|
||||||
'poll_max_options' => ($poll['poll_options']) ? $poll['poll_max_options'] : 1,
|
'poll_max_options' => ($poll['poll_options']) ? $poll['poll_max_options'] : 1,
|
||||||
'poll_length' => ($poll['poll_options']) ? $poll['poll_length'] * 86400 : 0,
|
'poll_length' => ($poll['poll_options']) ? ($poll['poll_length'] * 86400) : 0,
|
||||||
|
'poll_vote_change' => $poll['poll_vote_change'],
|
||||||
|
|
||||||
'topic_attachment' => ($post_mode == 'edit_topic') ? ((sizeof($data['filename_data']['physical_filename'])) ? 1 : 0) : $data['topic_attachment']
|
'topic_attachment' => ($post_mode == 'edit_topic') ? ((isset($data['filename_data']['physical_filename']) && sizeof($data['filename_data']['physical_filename'])) ? 1 : 0) : $data['topic_attachment']
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1561,7 +1624,7 @@ function submit_post($mode, $subject, $username, $topic_type, $poll, $data, $upd
|
||||||
if (sizeof($poll['poll_options']) < sizeof($cur_poll_options))
|
if (sizeof($poll['poll_options']) < sizeof($cur_poll_options))
|
||||||
{
|
{
|
||||||
$sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . '
|
$sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . '
|
||||||
WHERE poll_option_id > ' . sizeof($poll['poll_options']) . '
|
WHERE poll_option_id >= ' . sizeof($poll['poll_options']) . '
|
||||||
AND topic_id = ' . $data['topic_id'];
|
AND topic_id = ' . $data['topic_id'];
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,21 +7,26 @@
|
||||||
<td class="row3" colspan="2"><span class="gensmall">{L_ADD_POLL_EXPLAIN}</span></td>
|
<td class="row3" colspan="2"><span class="gensmall">{L_ADD_POLL_EXPLAIN}</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="row1"><b class="genmed">{L_POLL_QUESTION}</b></td>
|
<td class="row1"><b class="genmed">{L_POLL_QUESTION}:</b></td>
|
||||||
<td class="row2"><input class="post" type="text" name="poll_title" size="50" maxlength="255" value="{POLL_TITLE}" /></td>
|
<td class="row2"><input class="post" type="text" name="poll_title" size="50" maxlength="255" value="{POLL_TITLE}" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="row1"><b class="genmed">{L_POLL_OPTIONS}</b><br /><span class="gensmall">{L_POLL_OPTIONS_EXPLAIN}</span></td>
|
<td class="row1"><b class="genmed">{L_POLL_OPTIONS}:</b><br /><span class="gensmall">{L_POLL_OPTIONS_EXPLAIN}</span></td>
|
||||||
<td class="row2"><textarea style="width:450px" name="poll_option_text" rows="5" cols="35">{POLL_OPTIONS}</textarea></td>
|
<td class="row2"><textarea style="width:450px" name="poll_option_text" rows="5" cols="35">{POLL_OPTIONS}</textarea></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="row1"><b class="genmed">{L_POLL_MAX_OPTIONS}</b><br /><span class="gensmall">{L_POLL_MAX_OPTIONS_EXPLAIN}</span></td>
|
<td class="row1"><b class="genmed">{L_POLL_MAX_OPTIONS}:</b><br /><span class="gensmall">{L_POLL_MAX_OPTIONS_EXPLAIN}</span></td>
|
||||||
<td class="row2"><input class="post" type="text" name="poll_max_options" size="3" maxlength="3" value="{POLL_MAX_OPTIONS}" /></td>
|
<td class="row2"><input class="post" type="text" name="poll_max_options" size="3" maxlength="3" value="{POLL_MAX_OPTIONS}" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="row1"><b class="genmed">{L_POLL_FOR}</b></td>
|
<td class="row1"><b class="genmed">{L_POLL_FOR}</b></td>
|
||||||
<td class="row2"><input class="post" type="text" name="poll_length" size="3" maxlength="3" value="{POLL_LENGTH}" /> <b class="gen">{L_DAYS}</b> <span class="gensmall">{L_POLL_FOR_EXPLAIN}</span></td>
|
<td class="row2"><input class="post" type="text" name="poll_length" size="3" maxlength="3" value="{POLL_LENGTH}" /> <b class="gen">{L_DAYS}</b> <span class="gensmall">{L_POLL_FOR_EXPLAIN}</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<!-- IF S_POLL_VOTE_CHANGE -->
|
||||||
|
<tr>
|
||||||
|
<td class="row1"><b class="genmed">{L_POLL_VOTE_CHANGE}:</b><br /><span class="gensmall">{L_POLL_VOTE_CHANGE_EXPLAIN}</span></td>
|
||||||
|
<td class="row2"><input type="checkbox" name="poll_vote_change"{VOTE_CHANGE_CHECKED} /></td>
|
||||||
|
<!-- ENDIF -->
|
||||||
<!-- IF S_POLL_DELETE -->
|
<!-- IF S_POLL_DELETE -->
|
||||||
<tr>
|
<tr>
|
||||||
<td class="row1"><b class="genmed">{L_POLL_DELETE}</b></td>
|
<td class="row1"><b class="genmed">{L_POLL_DELETE}</b></td>
|
||||||
|
|
|
@ -12,19 +12,31 @@
|
||||||
<td class="row2" colspan="2"><br clear="all" />
|
<td class="row2" colspan="2"><br clear="all" />
|
||||||
<table cellspacing="0" cellpadding="4" border="0" align="center">
|
<table cellspacing="0" cellpadding="4" border="0" align="center">
|
||||||
<tr>
|
<tr>
|
||||||
<td align="center"><span class="gen"><b>{POLL_QUESTION}</b></span></td>
|
<td align="center"><span class="gen"><b>{POLL_QUESTION}</b></span><br /><span class="gensmall">{L_POLL_LENGTH}</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="center"><table cellspacing="0" cellpadding="2" border="0">
|
<td align="center">
|
||||||
|
<table cellspacing="0" cellpadding="2" border="0">
|
||||||
<!-- BEGIN poll_option -->
|
<!-- BEGIN poll_option -->
|
||||||
<tr>
|
<tr>
|
||||||
<td><input type="radio" name="vote_id" value="" /> </td>
|
<td>
|
||||||
|
<!-- IF S_IS_MULTI_CHOICE -->
|
||||||
|
<input type="checkbox" name="vote_id" value="" />
|
||||||
|
<!-- ELSE -->
|
||||||
|
<input type="radio" name="vote_id" value="" />
|
||||||
|
<!-- ENDIF -->
|
||||||
|
</td>
|
||||||
<td><span class="gen">{poll_option.POLL_OPTION_CAPTION}</span></td>
|
<td><span class="gen">{poll_option.POLL_OPTION_CAPTION}</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- END poll_option -->
|
<!-- END poll_option -->
|
||||||
</table></td>
|
</table>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table></td>
|
<tr>
|
||||||
|
<td align="center"><span class="gensmall">{L_MAX_VOTES}</span></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -143,7 +143,7 @@
|
||||||
|
|
||||||
<table width="100%" cellspacing="0">
|
<table width="100%" cellspacing="0">
|
||||||
<tr valign="middle">
|
<tr valign="middle">
|
||||||
<td class="gensmall" align="right"><!-- IF U_REPORT --><a href="{U_REPORT}">{REPORT_IMG}</a> <!-- ENDIF --> <!-- IF U_IP --><a href="{U_IP}">{IP_IMG}</a> <!-- ENDIF --> <!-- IF U_DELETE --><a href="{U_DELETE}">{DELETE_IMG}</a> <!-- ENDIF --></td>
|
<td class="gensmall" align="right"><!-- IF U_REPORT --><a href="{U_REPORT}">{REPORT_IMG}</a> <!-- ENDIF --> <!-- IF U_INFO --><a href="{U_INFO}">{INFO_IMG}</a> <!-- ENDIF --> <!-- IF U_DELETE --><a href="{U_DELETE}">{DELETE_IMG}</a> <!-- ENDIF --></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,13 @@
|
||||||
<!-- BEGIN poll_option -->
|
<!-- BEGIN poll_option -->
|
||||||
<tr>
|
<tr>
|
||||||
<!-- IF S_CAN_VOTE -->
|
<!-- IF S_CAN_VOTE -->
|
||||||
<td><!-- IF S_IS_MULTI_CHOICE --><input type="checkbox" name="vote_id[]" value="{poll_option.POLL_OPTION_ID}"<!-- IF poll_option.POLL_OPTION_VOTED --> checked="checked"<!-- ENDIF -->/><!-- ELSE --><input type="radio" name="vote_id[]" value="{poll_option.POLL_OPTION_ID}"<!-- IF poll_option.POLL_OPTION_VOTED --> checked="checked"<!-- ENDIF --> /><!-- ENDIF --> </td>
|
<td>
|
||||||
|
<!-- IF S_IS_MULTI_CHOICE -->
|
||||||
|
<input type="checkbox" name="vote_id[]" value="{poll_option.POLL_OPTION_ID}"<!-- IF poll_option.POLL_OPTION_VOTED --> checked="checked"<!-- ENDIF --> />
|
||||||
|
<!-- ELSE -->
|
||||||
|
<input type="radio" name="vote_id[]" value="{poll_option.POLL_OPTION_ID}"<!-- IF poll_option.POLL_OPTION_VOTED --> checked="checked"<!-- ENDIF --> />
|
||||||
|
<!-- ENDIF -->
|
||||||
|
</td>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
<td><span class="gen">{poll_option.POLL_OPTION_CAPTION}</span></td>
|
<td><span class="gen">{poll_option.POLL_OPTION_CAPTION}</span></td>
|
||||||
<!-- IF S_DISPLAY_RESULTS -->
|
<!-- IF S_DISPLAY_RESULTS -->
|
||||||
|
|
|
@ -172,7 +172,7 @@ if ($user->data['user_id'] != ANONYMOUS)
|
||||||
// whereupon we join on the forum_id passed as a parameter ... this
|
// whereupon we join on the forum_id passed as a parameter ... this
|
||||||
// is done so navigation, forum name, etc. remain consistent with where
|
// is done so navigation, forum name, etc. remain consistent with where
|
||||||
// user clicked to view a global topic
|
// user clicked to view a global topic
|
||||||
$sql = 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_attachment, t.topic_status, t.topic_approved, t.topic_replies_real, t.topic_replies, t.topic_last_post_id, t.topic_last_poster_id, t.topic_last_post_time, t.topic_poster, t.topic_time, t.topic_time_limit, t.topic_type, t.topic_bumped, t.topic_bumper, t.poll_max_options, t.poll_start, t.poll_length, t.poll_title, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_type, f.forum_id, f.forum_style, f.forum_password, f.forum_rules, f.forum_rules_link, f.forum_rules_flags, f.forum_rules_bbcode_uid, f.forum_rules_bbcode_bitfield' . $extra_fields . '
|
$sql = 'SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_attachment, t.topic_status, t.topic_approved, t.topic_replies_real, t.topic_replies, t.topic_first_post_id, t.topic_last_post_id, t.topic_last_poster_id, t.topic_last_post_time, t.topic_poster, t.topic_time, t.topic_time_limit, t.topic_type, t.topic_bumped, t.topic_bumper, t.poll_max_options, t.poll_start, t.poll_length, t.poll_title, t.poll_vote_change, f.forum_name, f.forum_desc, f.forum_parents, f.parent_id, f.left_id, f.right_id, f.forum_status, f.forum_type, f.forum_id, f.forum_style, f.forum_password, f.forum_rules, f.forum_rules_link, f.forum_rules_flags, f.forum_rules_bbcode_uid, f.forum_rules_bbcode_bitfield' . $extra_fields . '
|
||||||
FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f' . $join_sql_table . "
|
FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f' . $join_sql_table . "
|
||||||
WHERE $join_sql
|
WHERE $join_sql
|
||||||
AND (f.forum_id = t.forum_id
|
AND (f.forum_id = t.forum_id
|
||||||
|
@ -510,10 +510,12 @@ $template->assign_vars(array(
|
||||||
// Does this topic contain a poll?
|
// Does this topic contain a poll?
|
||||||
if (!empty($poll_start))
|
if (!empty($poll_start))
|
||||||
{
|
{
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT o.*, p.bbcode_bitfield, p.bbcode_uid
|
||||||
FROM ' . POLL_OPTIONS_TABLE . '
|
FROM ' . POLL_OPTIONS_TABLE . ' o, ' . POSTS_TABLE . " p
|
||||||
WHERE topic_id = ' . $topic_id . '
|
WHERE o.topic_id = $topic_id
|
||||||
ORDER BY poll_option_id';
|
AND p.post_id = $topic_first_post_id
|
||||||
|
AND p.topic_id = o.topic_id
|
||||||
|
ORDER BY o.poll_option_id";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$poll_info = array();
|
$poll_info = array();
|
||||||
|
@ -550,7 +552,7 @@ if (!empty($poll_start))
|
||||||
}
|
}
|
||||||
|
|
||||||
$s_can_vote = (((!sizeof($cur_voted_id) && $auth->acl_get('f_vote', $forum_id)) ||
|
$s_can_vote = (((!sizeof($cur_voted_id) && $auth->acl_get('f_vote', $forum_id)) ||
|
||||||
$auth->acl_get('f_votechg', $forum_id)) &&
|
($auth->acl_get('f_votechg', $forum_id) && $poll_vote_change)) &&
|
||||||
(($poll_length != 0 && $poll_start + $poll_length > time()) || $poll_length == 0) &&
|
(($poll_length != 0 && $poll_start + $poll_length > time()) || $poll_length == 0) &&
|
||||||
$topic_status != ITEM_LOCKED &&
|
$topic_status != ITEM_LOCKED &&
|
||||||
$forum_status != ITEM_LOCKED) ? true : false;
|
$forum_status != ITEM_LOCKED) ? true : false;
|
||||||
|
@ -632,10 +634,27 @@ if (!empty($poll_start))
|
||||||
$poll_total += $poll_option['poll_option_total'];
|
$poll_total += $poll_option['poll_option_total'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($poll_info[0]['bbcode_bitfield'])
|
||||||
|
{
|
||||||
|
include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx);
|
||||||
|
$poll_bbcode = new bbcode();
|
||||||
|
|
||||||
|
for ($i = 0, $j = sizeof($poll_info); $i < $j; $i++)
|
||||||
|
{
|
||||||
|
$poll_bbcode->bbcode_second_pass($poll_info[$i]['poll_option_text'], $poll_info[$i]['bbcode_uid'], $poll_option['bbcode_bitfield']);
|
||||||
|
$poll_info[$i]['poll_option_text'] = smilie_text($poll_info[$i]['poll_option_text']);
|
||||||
|
$poll_info[$i]['poll_option_text'] = str_replace("\n", '<br />', censor_text($poll_info[$i]['poll_option_text']));
|
||||||
|
}
|
||||||
|
|
||||||
|
$poll_bbcode->bbcode_second_pass($poll_title, $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield']);
|
||||||
|
$poll_title = smilie_text($poll_title);
|
||||||
|
$poll_title = str_replace("\n", '<br />', censor_text($poll_title));
|
||||||
|
|
||||||
|
unset($poll_bbcode);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($poll_info as $poll_option)
|
foreach ($poll_info as $poll_option)
|
||||||
{
|
{
|
||||||
$poll_option['poll_option_text'] = censor_text($poll_option['poll_option_text']);
|
|
||||||
|
|
||||||
$option_pct = ($poll_total > 0) ? $poll_option['poll_option_total'] / $poll_total : 0;
|
$option_pct = ($poll_total > 0) ? $poll_option['poll_option_total'] / $poll_total : 0;
|
||||||
$option_pct_txt = sprintf("%.1d%%", ($option_pct * 100));
|
$option_pct_txt = sprintf("%.1d%%", ($option_pct * 100));
|
||||||
|
|
||||||
|
@ -650,7 +669,7 @@ if (!empty($poll_start))
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'POLL_QUESTION' => censor_text($poll_title),
|
'POLL_QUESTION' => $poll_title,
|
||||||
'TOTAL_VOTES' => $poll_total,
|
'TOTAL_VOTES' => $poll_total,
|
||||||
'POLL_LEFT_CAP_IMG' => $user->img('poll_left'),
|
'POLL_LEFT_CAP_IMG' => $user->img('poll_left'),
|
||||||
'POLL_RIGHT_CAP_IMG'=> $user->img('poll_right'),
|
'POLL_RIGHT_CAP_IMG'=> $user->img('poll_right'),
|
||||||
|
@ -667,8 +686,7 @@ if (!empty($poll_start))
|
||||||
'U_VIEW_RESULTS' => $viewtopic_url . '&view=viewpoll')
|
'U_VIEW_RESULTS' => $viewtopic_url . '&view=viewpoll')
|
||||||
);
|
);
|
||||||
|
|
||||||
unset($poll_info);
|
unset($poll_info, $voted_id);
|
||||||
unset($voted_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the user is trying to reach the second half of the topic, fetch it starting from the end
|
// If the user is trying to reach the second half of the topic, fetch it starting from the end
|
||||||
|
|
Loading…
Add table
Reference in a new issue