aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2011-11-18 19:14:06 +0100
committerNils Adermann <naderman@naderman.de>2011-11-18 19:14:06 +0100
commitaddf81f62e69e23b4f31fc48997ac38683b88ebf (patch)
tree4078d3786e8c84f253aa80a73214c2d5ad2de00a /phpBB/includes/functions.php
parent5068c0588733f80a8433aea1cd6f763819caa9f7 (diff)
parent03918f7fd2fd790d5ebd4330f9f913bfcc206f91 (diff)
downloadforums-addf81f62e69e23b4f31fc48997ac38683b88ebf.tar
forums-addf81f62e69e23b4f31fc48997ac38683b88ebf.tar.gz
forums-addf81f62e69e23b4f31fc48997ac38683b88ebf.tar.bz2
forums-addf81f62e69e23b4f31fc48997ac38683b88ebf.tar.xz
forums-addf81f62e69e23b4f31fc48997ac38683b88ebf.zip
Merge branch 'develop' into feature/extension-manager
* develop: (93 commits) [ticket/10157] Add notification to update cpfs when installing a language. [ticket/10185] Always set board startdate on conversion [ticket/10419] Reword the language strings [ticket/9361] View correct error messages when editing account information [ticket/10457] Undefined variable $request, when print-viewing PMs [ticket/10452] Fix xHTML errors when print-viewing PMs [ticket/9066] Move regex into get_preg_expression function and add tests [ticket/10254] Add "phpBB Group" to "Modified by" in prosilver stylesheet.css [ticket/10254] Removing the subsilver2 NOTE, incompatible with phpBB.com. [ticket/10254] Removing the NOTE as it is incompatible with phpBB.com. [ticket/10254] Remove subsilver2 as default style on theme. [ticket/10254] Remove style names from themes and fix some informations on it. [ticket/7138] Allow simple header and footer for trigger_error() messages [ticket/9066] Disallow some database prefix to prevent same errors and problems [ticket/10365] Fix up S_POST_UNAPPROVED check, make it easier to read [ticket/10437] Do not display announcements that are waiting for approval [ticket/10087] Organize bans in acp_baninto optgroups [ticket/8616] Include old U_INBOX var for BC [ticket/10435] Remove global announcement from forums total topic count [ticket/10435] Readd local announcements to total topic count in viewforum ... Conflicts: phpBB/install/database_update.php
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php30
1 files changed, 20 insertions, 10 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 822ac5b8d6..92273bf08c 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1654,7 +1654,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, $request;
+ global $db, $tracking_topics, $user, $config, $auth, $request;
// Determine the users last forum mark time if not given.
if ($mark_time_forum === false)
@@ -1677,6 +1677,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'])
@@ -1692,7 +1696,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);
@@ -1716,7 +1721,8 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti
FROM ' . TOPICS_TABLE . '
WHERE forum_id = ' . $forum_id . '
AND topic_last_post_time > ' . $mark_time_forum . '
- AND topic_moved_id = 0';
+ AND topic_moved_id = 0 ' .
+ $sql_update_unapproved;
$result = $db->sql_query($sql);
$check_forum = $tracking_topics['tf'][$forum_id];
@@ -1901,7 +1907,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) ? ' ... ' : $separator;
+ $page_string .= ($start_cnt > 1) ? '<span class="page-dots"> ... </span>' : $separator;
for ($i = $start_cnt + 1; $i < $end_cnt; $i++)
{
@@ -1912,7 +1918,7 @@ function generate_pagination($base_url, $num_items, $per_page, $start_item, $add
}
}
- $page_string .= ($end_cnt < $total_pages) ? ' ... ' : $separator;
+ $page_string .= ($end_cnt < $total_pages) ? '<span class="page-dots"> ... </span>' : $separator;
}
else
{
@@ -3256,6 +3262,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 '';
@@ -4570,6 +4580,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
'T_STYLESHEET_LINK' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/stylesheet.css',
'T_STYLESHEET_LANG_LINK' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/' . $user->lang_name . '/stylesheet.css',
'T_STYLESHEET_NAME' => $user->theme['theme_name'],
+ 'T_JQUERY_LINK' => ($config['load_jquery_cdn'] && !empty($config['load_jquery_url'])) ? $config['load_jquery_url'] : "{$web_path}assets/javascript/jquery.js",
+ 'S_JQUERY_FALLBACK' => ($config['load_jquery_cdn']) ? true : false,
'T_THEME_NAME' => $user->theme['theme_path'],
'T_THEME_LANG_NAME' => $user->data['user_lang'],
@@ -4627,15 +4639,13 @@ function page_footer($run_cron = true)
if ($auth->acl_get('a_') && defined('DEBUG_EXTRA'))
{
- if (function_exists('memory_get_usage'))
+ if (function_exists('memory_get_peak_usage'))
{
- if ($memory_usage = memory_get_usage())
+ if ($memory_usage = memory_get_peak_usage())
{
- global $base_memory_usage;
- $memory_usage -= $base_memory_usage;
$memory_usage = get_formatted_filesize($memory_usage);
- $debug_output .= ' | Memory Usage: ' . $memory_usage;
+ $debug_output .= ' | Peak Memory Usage: ' . $memory_usage;
}
}