aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php39
1 files changed, 29 insertions, 10 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 98a2b3028b..852fc683f2 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1880,7 +1880,7 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s
*/
function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time = false, $mark_time_forum = false)
{
- global $db, $tracking_topics, $user, $config;
+ global $db, $tracking_topics, $user, $config, $auth;
// Determine the users last forum mark time if not given.
if ($mark_time_forum === false)
@@ -1903,6 +1903,10 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti
}
}
+ // Handle update of unapproved topics info.
+ // Only update for moderators having m_approve permission for the forum.
+ $sql_update_unapproved = ($auth->acl_get('m_approve', $forum_id)) ? '': 'AND t.topic_approved = 1';
+
// Check the forum for any left unread topics.
// If there are none, we mark the forum as read.
if ($config['load_db_lastread'] && $user->data['is_registered'])
@@ -1918,7 +1922,8 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti
LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id'] . ')
WHERE t.forum_id = ' . $forum_id . '
AND t.topic_last_post_time > ' . $mark_time_forum . '
- AND t.topic_moved_id = 0
+ AND t.topic_moved_id = 0 ' .
+ $sql_update_unapproved . '
AND (tt.topic_id IS NULL OR tt.mark_time < t.topic_last_post_time)
GROUP BY t.forum_id';
$result = $db->sql_query_limit($sql, 1);
@@ -1938,11 +1943,12 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti
}
else
{
- $sql = 'SELECT topic_id
- FROM ' . TOPICS_TABLE . '
- WHERE forum_id = ' . $forum_id . '
- AND topic_last_post_time > ' . $mark_time_forum . '
- AND topic_moved_id = 0';
+ $sql = 'SELECT t.topic_id
+ FROM ' . TOPICS_TABLE . ' t
+ WHERE t.forum_id = ' . $forum_id . '
+ AND t.topic_last_post_time > ' . $mark_time_forum . '
+ AND t.topic_moved_id = 0 ' .
+ $sql_update_unapproved;
$result = $db->sql_query($sql);
$check_forum = $tracking_topics['tf'][$forum_id];
@@ -2127,7 +2133,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
$start_cnt = min(max(1, $on_page - 4), $total_pages - 5);
$end_cnt = max(min($total_pages, $on_page + 4), 6);
- $page_string .= ($start_cnt > 1) ? ' ... ' : $seperator;
+ $page_string .= ($start_cnt > 1) ? '<span class="page-dots"> ... </span>' : $seperator;
for ($i = $start_cnt + 1; $i < $end_cnt; $i++)
{
@@ -2138,7 +2144,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
}
}
- $page_string .= ($end_cnt < $total_pages) ? ' ... ' : $seperator;
+ $page_string .= ($end_cnt < $total_pages) ? '<span class="page-dots"> ... </span>' : $seperator;
}
else
{
@@ -3486,6 +3492,10 @@ function get_preg_expression($mode)
$inline = ($mode == 'relative_url') ? ')' : '';
return "(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})*(?:/(?:[a-z0-9\-._~!$&'($inline*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'($inline*+,;=:@/?|]+|%[\dA-F]{2})*)?";
break;
+
+ case 'table_prefix':
+ return '#^[a-zA-Z][a-zA-Z0-9_]*$#';
+ break;
}
return '';
@@ -4368,7 +4378,7 @@ function phpbb_http_login($param)
*/
function page_header($page_title = '', $display_online_list = true, $item_id = 0, $item = 'forum')
{
- global $db, $config, $template, $SID, $_SID, $user, $auth, $phpEx, $phpbb_root_path;
+ global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path;
if (defined('HEADER_INC'))
{
@@ -4521,6 +4531,15 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
$s_search_hidden_fields['sid'] = $_SID;
}
+ if (!empty($_EXTRA_URL))
+ {
+ foreach ($_EXTRA_URL as $url_param)
+ {
+ $url_param = explode('=', $url_param, 2);
+ $s_hidden_fields[$url_param[0]] = $url_param[1];
+ }
+ }
+
// The following assigns all _common_ variables that may be used at any point in a template.
$template->assign_vars(array(
'SITENAME' => $config['sitename'],