a few fixes

git-svn-id: file:///svn/phpbb/trunk@4184 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2003-06-29 10:59:36 +00:00
parent b85637fc1a
commit 4d6a767305
8 changed files with 39 additions and 19 deletions

View file

@ -44,7 +44,7 @@ function display_forums($root_data = '', $display_moderators = TRUE)
break; break;
default: 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; break;
} }
$lastread_select = ', ft.mark_time '; $lastread_select = ', ft.mark_time ';

View file

@ -124,7 +124,7 @@ function format_display(&$message, &$signature, $uid, $siguid, $html, $bbcode, $
$signature = ''; $signature = '';
} }
return; return $message;
} }
// Update Last Post Informations // Update Last Post Informations

View file

@ -830,9 +830,18 @@ class parse_message
{ {
$this->warn_msg[] = $user->lang['NO_DELETE_POLL_OPTIONS']; $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_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; $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']; $poll['poll_start'] = $poll_data['poll_start'];

View file

@ -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_main.'.$phpEx);
include($phpbb_root_path . 'language/' . $language . '/lang_admin.'.$phpEx); include($phpbb_root_path . 'language/' . $language . '/lang_admin.'.$phpEx);

View file

@ -642,7 +642,9 @@ $lang = array(
'TOO_FEW_POLL_OPTIONS' => 'You must enter at least two poll options', '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', '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', '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', 'GENERAL_UPLOAD_ERROR' => 'Could not upload Attachment to %s',
'TOO_MANY_ATTACHMENTS' => 'Cannot add another attacment, %d is the maxmimum.', 'TOO_MANY_ATTACHMENTS' => 'Cannot add another attacment, %d is the maxmimum.',

View file

@ -221,7 +221,6 @@ if ($sql != '')
$db->sql_freeresult($result); $db->sql_freeresult($result);
} }
$message_parser = new parse_message(0); // <- TODO: add constant (MSG_POST/MSG_PM) $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']); trigger_error($user->lang['CANNOT_DELETE_REPLIED']);
} }
if ($mode == 'delete') if ($mode == 'delete')
{ {
trigger_error('USER_CANNOT_DELETE'); trigger_error('USER_CANNOT_DELETE');
@ -642,18 +640,10 @@ if ($submit || $preview || $refresh)
if ($mode != 'edit' || $message_md5 != $post_checksum || $status_switch || $preview) if ($mode != 'edit' || $message_md5 != $post_checksum || $status_switch || $preview)
{ {
// Parse message // Parse message
if ($result = $message_parser->parse($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, $img_status, $flash_status)) $message_parser->parse($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, $img_status, $flash_status);
{
$error[] = $result;
}
} }
$result = $message_parser->parse_attachments($mode, $post_id, $submit, $preview, $refresh); $message_parser->parse_attachments($mode, $post_id, $submit, $preview, $refresh);
if (count($result))
{
$error[] = implode('<br />', $result);
}
if ($mode != 'edit' && !$preview && !$refresh && !$auth->acl_get('f_ignoreflood', $forum_id)) if ($mode != 'edit' && !$preview && !$refresh && !$auth->acl_get('f_ignoreflood', $forum_id))
{ {
@ -707,10 +697,7 @@ if ($submit || $preview || $refresh)
); );
$poll = array(); $poll = array();
if (($result = $message_parser->parse_poll($poll, $poll_data)) != '') $message_parser->parse_poll($poll, $poll_data);
{
$error[] = $result;
}
$poll_options = $poll['poll_options']; $poll_options = $poll['poll_options'];
$poll_title = $poll['poll_title']; $poll_title = $poll['poll_title'];
@ -739,6 +726,11 @@ if ($submit || $preview || $refresh)
} }
} }
if (sizeof($message_parser->warn_msg))
{
$error[] = implode('<br />', $message_parser->warn_msg);
}
// Store message, sync counters // Store message, sync counters
if (!sizeof($error) && $submit) if (!sizeof($error) && $submit)
{ {
@ -1081,6 +1073,12 @@ if (($mode == 'post' || ($mode == 'edit' && $post_id == $topic_first_post_id &&
'POLL_LENGTH' => $poll_length) '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 // Attachment entry
if ($auth->acl_get('f_attach', $forum_id) || $auth->acl_get('m_edit', $forum_id)) if ($auth->acl_get('f_attach', $forum_id) || $auth->acl_get('m_edit', $forum_id))

View file

@ -290,6 +290,11 @@ function checkForm()
<!-- ENDIF --> <!-- ENDIF -->
<!-- IF S_SHOW_POLL_BOX --> <!-- IF S_SHOW_POLL_BOX -->
<!-- INCLUDE posting_poll_body.html --> <!-- INCLUDE posting_poll_body.html -->
<!-- ELSEIF S_POLL_DELETE -->
<tr>
<td class="row1"><span class="genmed"><b>{L_POLL_DELETE}</b></span></td>
<td class="row2"><input type="checkbox" name="poll_delete" /></td>
</tr>
<!-- ENDIF --> <!-- ENDIF -->
<tr> <tr>
<td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="liteoption" type="submit" tabindex="5" name="preview" value="{L_PREVIEW}" />&nbsp; <input class="mainoption" type="submit" accesskey="s" tabindex="6" name="post" value="{L_SUBMIT}" /><!-- IF S_SAVE_ALLOWED -->&nbsp; <input class="liteoption" type="submit" accesskey="k" tabindex="8" name="save" value="{L_SAVE}" /><!-- ENDIF -->&nbsp; <input class="liteoption" type="submit" accesskey="c" tabindex="7" name="cancel" value="{L_CANCEL}" /></td> <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="liteoption" type="submit" tabindex="5" name="preview" value="{L_PREVIEW}" />&nbsp; <input class="mainoption" type="submit" accesskey="s" tabindex="6" name="post" value="{L_SUBMIT}" /><!-- IF S_SAVE_ALLOWED -->&nbsp; <input class="liteoption" type="submit" accesskey="k" tabindex="8" name="save" value="{L_SAVE}" /><!-- ENDIF -->&nbsp; <input class="liteoption" type="submit" accesskey="c" tabindex="7" name="cancel" value="{L_CANCEL}" /></td>

View file

@ -538,6 +538,7 @@ if (!empty($poll_start))
ORDER BY poll_option_id'; ORDER BY poll_option_id';
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$poll_info = array();
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$poll_info[] = $row; $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)) && $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 && $topic_status != ITEM_LOCKED &&
$forum_status != ITEM_LOCKED) ? true : false; $forum_status != ITEM_LOCKED) ? true : false;
$s_display_results = (!$s_can_vote || ($s_can_vote && sizeof($voted_id)) || $_GET['vote'] = 'viewresult') ? true : false; $s_display_results = (!$s_can_vote || ($s_can_vote && sizeof($voted_id)) || $_GET['vote'] = 'viewresult') ? true : false;