aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2008-12-24 14:44:19 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2008-12-24 14:44:19 +0000
commit3cd007c49d776b4e76f939dbd7d7c328bd09abe9 (patch)
tree287c795585bd490712255b17d0962ce5e838c36b /phpBB
parentac37f87105173ae50c357c96ffee43ef4d4b41f5 (diff)
downloadforums-3cd007c49d776b4e76f939dbd7d7c328bd09abe9.tar
forums-3cd007c49d776b4e76f939dbd7d7c328bd09abe9.tar.gz
forums-3cd007c49d776b4e76f939dbd7d7c328bd09abe9.tar.bz2
forums-3cd007c49d776b4e76f939dbd7d7c328bd09abe9.tar.xz
forums-3cd007c49d776b4e76f939dbd7d7c328bd09abe9.zip
change cache:: to phpbb_cache::
git-svn-id: file:///svn/phpbb/trunk@9226 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/common.php11
-rw-r--r--phpBB/download/file.php12
-rw-r--r--phpBB/includes/classes/cache.php373
-rw-r--r--phpBB/includes/functions_content.php6
-rw-r--r--phpBB/includes/functions_display.php2
-rw-r--r--phpBB/includes/functions_posting.php6
-rw-r--r--phpBB/includes/functions_user.php2
-rw-r--r--phpBB/install/database_update.php16
-rw-r--r--phpBB/install/index.php16
-rw-r--r--phpBB/memberlist.php2
-rw-r--r--phpBB/modules/acp/acp_styles.php2
-rw-r--r--phpBB/modules/mcp/mcp_forum.php2
-rw-r--r--phpBB/modules/mcp/mcp_post.php2
-rw-r--r--phpBB/modules/mcp/mcp_queue.php2
-rw-r--r--phpBB/modules/mcp/mcp_reports.php10
-rw-r--r--phpBB/modules/mcp/mcp_topic.php2
-rw-r--r--phpBB/modules/ucp/ucp_pm_viewfolder.php2
-rw-r--r--phpBB/modules/ucp/ucp_pm_viewmessage.php2
-rw-r--r--phpBB/search.php2
-rw-r--r--phpBB/viewforum.php4
-rw-r--r--phpBB/viewtopic.php6
21 files changed, 222 insertions, 260 deletions
diff --git a/phpBB/common.php b/phpBB/common.php
index 882e782ebb..8e4bf8a331 100644
--- a/phpBB/common.php
+++ b/phpBB/common.php
@@ -217,15 +217,6 @@ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('
unset($dbpasswd);
// Grab global variables, re-cache if necessary
-$config = cache::obtain_config();
-
-// Add own hook handler
-require(PHPBB_ROOT_PATH . 'includes/hooks/index.' . PHP_EXT);
-$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));
-
-foreach (cache::obtain_hooks() as $hook)
-{
- @include(PHPBB_ROOT_PATH . 'includes/hooks/' . $hook . '.' . PHP_EXT);
-}
+$config = phpbb_cache::obtain_config();
?> \ No newline at end of file
diff --git a/phpBB/download/file.php b/phpBB/download/file.php
index d1f6316551..7923a5988d 100644
--- a/phpBB/download/file.php
+++ b/phpBB/download/file.php
@@ -17,7 +17,7 @@ if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
-// Thank you sun.
+// Thank you sun.
if (isset($_SERVER['CONTENT_TYPE']))
{
if ($_SERVER['CONTENT_TYPE'] === 'application/x-java-archive')
@@ -35,11 +35,11 @@ if (request::is_set('avatar', request::GET))
// worst-case default
$browser = (!empty($_SERVER['HTTP_USER_AGENT'])) ? htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT']) : 'msie 6.0';
- $config = cache::obtain_config();
+ $config = phpbb_cache::obtain_config();
$filename = request::variable('avatar', '', false, request::GET);
$avatar_group = false;
$exit = false;
-
+
if ($filename[0] === 'g')
{
$avatar_group = true;
@@ -66,8 +66,8 @@ if (request::is_set('avatar', request::GET))
header("HTTP/1.0 403 Forbidden");
$exit = true;
}
-
-
+
+
if (!$exit)
{
if (!$filename)
@@ -133,7 +133,7 @@ if ($attachment['is_orphan'])
}
// Obtain all extensions...
- $extensions = cache::obtain_attach_extensions(true);
+ $extensions = phpbb_cache::obtain_extensions();
}
else
{
diff --git a/phpBB/includes/classes/cache.php b/phpBB/includes/classes/cache.php
index f537b52b3f..eeeae58989 100644
--- a/phpBB/includes/classes/cache.php
+++ b/phpBB/includes/classes/cache.php
@@ -3,7 +3,7 @@
*
* @package acm
* @version $Id$
-* @copyright (c) 2005 phpBB Group
+* @copyright (c) 2005, 2008 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
@@ -17,81 +17,95 @@ if (!defined('IN_PHPBB'))
}
/**
-* Class for grabbing/handling cached entries, extends acm_file or acm_db depending on the setup
+* Class for obtaining cached entries, for example censor word list, configuration...
* @package acm
*/
-class cache
+class phpbb_cache
{
/**
+ * We do not want this object instantiable
+ */
+ private function ___construct() { }
+
+ /**
+ * Required phpBB objects
+ */
+ public $phpbb_required = array('config', 'acm', 'db');
+
+ /**
+ * Optional phpBB objects
+ */
+ public $phpbb_optional = array();
+
+ /**
* Get config values
+ *
+ * @return array configuration
+ * @access public
*/
public static function obtain_config()
{
- global $db, $cache;
-
- if (($config = $cache->get('config')) !== false)
+ if ((phpbb::$config = phpbb::$acm->get('#config')) !== false)
{
$sql = 'SELECT config_name, config_value
FROM ' . CONFIG_TABLE . '
WHERE is_dynamic = 1';
- $result = $db->sql_query($sql);
+ $result = phpbb::$db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
+ while ($row = phpbb::$db->sql_fetchrow($result))
{
- $config[$row['config_name']] = $row['config_value'];
+ phpbb::$config[$row['config_name']] = $row['config_value'];
}
- $db->sql_freeresult($result);
+ phpbb::$db->sql_freeresult($result);
}
else
{
- $config = $cached_config = array();
+ phpbb::$config = $cached_config = array();
$sql = 'SELECT config_name, config_value, is_dynamic
FROM ' . CONFIG_TABLE;
- $result = $db->sql_query($sql);
+ $result = phpbb::$db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
+ while ($row = phpbb::$db->sql_fetchrow($result))
{
if (!$row['is_dynamic'])
{
$cached_config[$row['config_name']] = $row['config_value'];
}
- $config[$row['config_name']] = $row['config_value'];
+ phpbb::$config[$row['config_name']] = $row['config_value'];
}
- $db->sql_freeresult($result);
+ phpbb::$db->sql_freeresult($result);
- $cache->put('config', $cached_config);
+ phpbb::$acm->put('#config', $cached_config);
}
- return $config;
+ return phpbb::$config;
}
/**
- * Obtain list of naughty words and build preg style replacement arrays for use by the
- * calling script
+ * Obtain list of naughty words and build preg style replacement arrays for use by the calling script
+ *
+ * @return array Censored words
+ * @access public
*/
public static function obtain_word_list()
{
- global $cache;
-
- if (($censors = $cache->get('_word_censors')) === false)
+ if (($censors = phpbb::$acm->get('word_censors')) === false)
{
- global $db;
-
$sql = 'SELECT word, replacement
FROM ' . WORDS_TABLE;
- $result = $db->sql_query($sql);
+ $result = phpbb::$db->sql_query($sql);
$censors = array();
- while ($row = $db->sql_fetchrow($result))
+ while ($row = phpbb::$db->sql_fetchrow($result))
{
$censors['match'][] = '#(?<!\w)(' . str_replace('\*', '\w*?', preg_quote($row['word'], '#')) . ')(?!\w)#i';
$censors['replace'][] = $row['replacement'];
}
- $db->sql_freeresult($result);
+ phpbb::$db->sql_freeresult($result);
- $cache->put('_word_censors', $censors);
+ phpbb::$acm->put('word_censors', $censors);
}
return $censors;
@@ -99,32 +113,31 @@ class cache
/**
* Obtain currently listed icons
+ *
+ * @return array Icons
+ * @access public
*/
public static function obtain_icons()
{
- global $cache;
-
- if (($icons = $cache->get('_icons')) === false)
+ if (($icons = phpbb::$acm->get('icons')) === false)
{
- global $db;
-
// Topic icons
$sql = 'SELECT *
FROM ' . ICONS_TABLE . '
ORDER BY icons_order';
- $result = $db->sql_query($sql);
+ $result = phpbb::$db->sql_query($sql);
$icons = array();
- while ($row = $db->sql_fetchrow($result))
+ while ($row = phpbb::$db->sql_fetchrow($result))
{
$icons[$row['icons_id']]['img'] = $row['icons_url'];
$icons[$row['icons_id']]['width'] = (int) $row['icons_width'];
$icons[$row['icons_id']]['height'] = (int) $row['icons_height'];
$icons[$row['icons_id']]['display'] = (bool) $row['display_on_posting'];
}
- $db->sql_freeresult($result);
+ phpbb::$db->sql_freeresult($result);
- $cache->put('_icons', $icons);
+ phpbb::$acm->put('icons', $icons);
}
return $icons;
@@ -132,22 +145,21 @@ class cache
/**
* Obtain ranks
+ *
+ * @return Ranks
+ * @access public
*/
public static function obtain_ranks()
{
- global $cache;
-
- if (($ranks = $cache->get('_ranks')) === false)
+ if (($ranks = phpbb::$acm->get('ranks')) === false)
{
- global $db;
-
$sql = 'SELECT *
FROM ' . RANKS_TABLE . '
ORDER BY rank_min DESC';
- $result = $db->sql_query($sql);
+ $result = phpbb::$db->sql_query($sql);
$ranks = array();
- while ($row = $db->sql_fetchrow($result))
+ while ($row = phpbb::$db->sql_fetchrow($result))
{
if ($row['rank_special'])
{
@@ -165,120 +177,146 @@ class cache
);
}
}
- $db->sql_freeresult($result);
+ phpbb::$db->sql_freeresult($result);
- $cache->put('_ranks', $ranks);
+ phpbb::$acm->put('ranks', $ranks);
}
return $ranks;
}
/**
- * Obtain allowed extensions
- *
- * @param mixed $forum_id If false then check for private messaging, if int then check for forum id. If true, then only return extension informations.
+ * Put attachment extensions data into cache
*
- * @return array allowed extensions array.
+ * @return array Cached extensions
+ * @access private
*/
- public static function obtain_attach_extensions($forum_id)
+ private static function cache_extensions()
{
- global $cache;
-
- if (($extensions = $cache->get('_extensions')) === false)
+ $extensions = array(
+ '_allowed_post' => array(),
+ '_allowed_pm' => array(),
+ );
+
+ // The rule is to only allow those extensions defined. ;)
+ $sql = 'SELECT e.extension, g.*
+ FROM ' . EXTENSIONS_TABLE . ' e, ' . EXTENSION_GROUPS_TABLE . ' g
+ WHERE e.group_id = g.group_id
+ AND (g.allow_group = 1 OR g.allow_in_pm = 1)';
+ $result = phpbb::$db->sql_query($sql);
+
+ while ($row = phpbb::$db->sql_fetchrow($result))
{
- global $db;
-
- $extensions = array(
- '_allowed_post' => array(),
- '_allowed_pm' => array(),
+ $extension = strtolower(trim($row['extension']));
+
+ $extensions[$extension] = array(
+ 'display_cat' => (int) $row['cat_id'],
+ 'download_mode' => (int) $row['download_mode'],
+ 'upload_icon' => trim($row['upload_icon']),
+ 'max_filesize' => (int) $row['max_filesize'],
+ 'allow_group' => $row['allow_group'],
+ 'allow_in_pm' => $row['allow_in_pm'],
);
- // The rule is to only allow those extensions defined. ;)
- $sql = 'SELECT e.extension, g.*
- FROM ' . EXTENSIONS_TABLE . ' e, ' . EXTENSION_GROUPS_TABLE . ' g
- WHERE e.group_id = g.group_id
- AND (g.allow_group = 1 OR g.allow_in_pm = 1)';
- $result = $db->sql_query($sql);
+ $allowed_forums = ($row['allowed_forums']) ? unserialize(trim($row['allowed_forums'])) : array();
- while ($row = $db->sql_fetchrow($result))
+ // Store allowed extensions forum wise
+ if ($row['allow_group'])
{
- $extension = strtolower(trim($row['extension']));
-
- $extensions[$extension] = array(
- 'display_cat' => (int) $row['cat_id'],
- 'download_mode' => (int) $row['download_mode'],
- 'upload_icon' => trim($row['upload_icon']),
- 'max_filesize' => (int) $row['max_filesize'],
- 'allow_group' => $row['allow_group'],
- 'allow_in_pm' => $row['allow_in_pm'],
- );
-
- $allowed_forums = ($row['allowed_forums']) ? unserialize(trim($row['allowed_forums'])) : array();
-
- // Store allowed extensions forum wise
- if ($row['allow_group'])
- {
- $extensions['_allowed_post'][$extension] = (!sizeof($allowed_forums)) ? 0 : $allowed_forums;
- }
-
- if ($row['allow_in_pm'])
- {
- $extensions['_allowed_pm'][$extension] = 0;
- }
+ $extensions['_allowed_post'][$extension] = (!sizeof($allowed_forums)) ? 0 : $allowed_forums;
}
- $db->sql_freeresult($result);
- $cache->put('_extensions', $extensions);
+ if ($row['allow_in_pm'])
+ {
+ $extensions['_allowed_pm'][$extension] = 0;
+ }
}
+ phpbb::$db->sql_freeresult($result);
+
+ phpbb::$acm->put('extensions', $extensions);
+ return $extensions;
+ }
- // Forum post
- if ($forum_id === false)
+ /**
+ * Obtain allowed attachment extensions in private messages
+ *
+ * @return array Allowed extensions
+ * @access public
+ */
+ public static function obtain_extensions_pm()
+ {
+ if (($extensions = phpbb::$acm->get('extensions')) === false)
{
- // We are checking for private messages, therefore we only need to get the pm extensions...
- $return = array('_allowed_' => array());
+ $extensions = self::cache_extensions();
+ }
- foreach ($extensions['_allowed_pm'] as $extension => $check)
- {
- $return['_allowed_'][$extension] = 0;
- $return[$extension] = $extensions[$extension];
- }
+ // We are checking for private messages, therefore we only need to get the pm extensions...
+ $result = array('_allowed_' => array());
- $extensions = $return;
- }
- else if ($forum_id === true)
+ foreach ($extensions['_allowed_pm'] as $extension => $check)
{
- return $extensions;
+ $result['_allowed_'][$extension] = 0;
+ $result[$extension] = $extensions[$extension];
}
- else
+
+ return $result;
+ }
+
+ /**
+ * Obtain allowed attachment extensions in specific forum
+ *
+ * @param int $forum_id The forum id
+ * @return array Allowed extensions within the specified forum
+ * @access public
+ */
+ public static function obtain_extensions_forum($forum_id)
+ {
+ if (($extensions = phpbb::$acm->get('extensions')) === false)
{
- $forum_id = (int) $forum_id;
- $return = array('_allowed_' => array());
+ $extensions = self::cache_extensions();
+ }
+
+ $forum_id = (int) $forum_id;
+ $result = array('_allowed_' => array());
- foreach ($extensions['_allowed_post'] as $extension => $check)
+ foreach ($extensions['_allowed_post'] as $extension => $check)
+ {
+ // Check for allowed forums
+ if (is_array($check))
{
- // Check for allowed forums
- if (is_array($check))
- {
- $allowed = (!in_array($forum_id, $check)) ? false : true;
- }
- else
- {
- $allowed = true;
- }
+ $allowed = (!in_array($forum_id, $check)) ? false : true;
+ }
+ else
+ {
+ $allowed = true;
+ }
- if ($allowed)
- {
- $return['_allowed_'][$extension] = 0;
- $return[$extension] = $extensions[$extension];
- }
+ if ($allowed)
+ {
+ $result['_allowed_'][$extension] = 0;
+ $result[$extension] = $extensions[$extension];
}
+ }
- $extensions = $return;
+ if (!isset($result['_allowed_']))
+ {
+ $result['_allowed_'] = array();
}
- if (!isset($extensions['_allowed_']))
+ return $result;
+ }
+
+ /**
+ * Obtain general attachment extension information
+ *
+ * @return array Cached extension information
+ * @access public
+ */
+ public static function obtain_extensions()
+ {
+ if (($extensions = phpbb::$acm->get('extensions')) === false)
{
- $extensions['_allowed_'] = array();
+ $extensions = self::cache_extensions();
}
return $extensions;
@@ -286,47 +324,45 @@ class cache
/**
* Obtain active bots
+ *
+ * @return array Active bots
+ * @access public
*/
public static function obtain_bots()
{
- global $cache;
-
- if (($bots = $cache->get('_bots')) === false)
+ if (($bots = phpbb::$acm->get('bots')) === false)
{
- global $db;
-
+ // @todo We order by last visit date. This way we are able to safe some cycles by checking the most active ones first.
$sql = 'SELECT user_id, bot_agent, bot_ip
FROM ' . BOTS_TABLE . '
WHERE bot_active = 1
- ORDER BY ' . $db->sql_function('length_varchar', 'bot_agent') . 'DESC';
- $result = $db->sql_query($sql);
+ ORDER BY ' . phpbb::$db->sql_function('length_varchar', 'bot_agent') . 'DESC';
+ $result = phpbb::$db->sql_query($sql);
$bots = array();
- while ($row = $db->sql_fetchrow($result))
+ while ($row = phpbb::$db->sql_fetchrow($result))
{
$bots[] = $row;
}
- $db->sql_freeresult($result);
+ phpbb::$db->sql_freeresult($result);
- $cache->put('_bots', $bots);
+ phpbb::$acm->put('bots', $bots);
}
return $bots;
}
/**
- * Obtain cfg file data
- *
- * @param array $theme An array containing the path to the item
+ * Obtain Styles .cfg file data
*
+ * @param array $theme An array containing the path to the items
* @param string $item The specific item to get: 'theme', 'template', or 'imageset'
- *
+ * @return array The configuration
+ * @access public
*/
public static function obtain_cfg_item($theme, $item = 'theme')
{
- global $config, $cache;
-
- $parsed_array = $cache->get('_cfg_' . $item . '_' . $theme[$item . '_path']);
+ $parsed_array = phpbb::$acm->get('cfg_' . $item . '_' . $theme[$item . '_path']);
if ($parsed_array === false)
{
@@ -341,7 +377,7 @@ class cache
return $parsed_array;
}
- if (!isset($parsed_array['filetime']) || (($config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime'])))
+ if (!isset($parsed_array['filetime']) || ((phpbb::$config['load_tplcompile'] && @filemtime($filename) > $parsed_array['filetime'])))
{
$reparse = true;
}
@@ -352,7 +388,7 @@ class cache
$parsed_array = parse_cfg_file($filename);
$parsed_array['filetime'] = @filemtime($filename);
- $cache->put('_cfg_' . $item . '_' . $theme[$item . '_path'], $parsed_array);
+ phpbb::$acm->put('cfg_' . $item . '_' . $theme[$item . '_path'], $parsed_array);
}
return $parsed_array;
@@ -360,63 +396,30 @@ class cache
/**
* Obtain disallowed usernames
+ *
+ * @return array Disallowed usernames
+ * @access public
*/
public static function obtain_disallowed_usernames()
{
- global $cache;
-
- if (($usernames = $cache->get('_disallowed_usernames')) === false)
+ if (($usernames = phpbb::$acm->get('disallowed_usernames')) === false)
{
- global $db;
-
$sql = 'SELECT disallow_username
FROM ' . DISALLOW_TABLE;
- $result = $db->sql_query($sql);
+ $result = phpbb::$db->sql_query($sql);
$usernames = array();
- while ($row = $db->sql_fetchrow($result))
+ while ($row = phpbb::$db->sql_fetchrow($result))
{
$usernames[] = str_replace('%', '.*?', preg_quote(utf8_clean_string($row['disallow_username']), '#'));
}
- $db->sql_freeresult($result);
+ phpbb::$db->sql_freeresult($result);
- $cache->put('_disallowed_usernames', $usernames);
+ phpbb::$acm->put('disallowed_usernames', $usernames);
}
return $usernames;
}
-
- /**
- * Obtain hooks...
- */
- public static function obtain_hooks()
- {
- global $cache;
-
- if (($hook_files = $cache->get('_hooks')) === false)
- {
- $hook_files = array();
-
- // Now search for hooks...
- $dh = @opendir(PHPBB_ROOT_PATH . 'includes/hooks/');
-
- if ($dh)
- {
- while (($file = readdir($dh)) !== false)
- {
- if (strpos($file, 'hook_') === 0 && substr($file, -(strlen(PHP_EXT) + 1)) === '.' . PHP_EXT)
- {
- $hook_files[] = substr($file, 0, -(strlen(PHP_EXT) + 1));
- }
- }
- closedir($dh);
- }
-
- $cache->put('_hooks', $hook_files);
- }
-
- return $hook_files;
- }
}
?> \ No newline at end of file
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index 875c711c4e..e497a61920 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -682,7 +682,7 @@ function censor_text($text)
}
else
{
- $censors = cache::obtain_word_list();
+ $censors = phpbb_cache::obtain_word_list();
}
}
@@ -754,7 +754,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
if (empty($extensions) || !is_array($extensions))
{
- $extensions = cache::obtain_attach_extensions($forum_id);
+ $extensions = phpbb_cache::obtain_extensions_forum($forum_id);
}
// Look for missing attachment information...
@@ -1069,7 +1069,7 @@ function extension_allowed($forum_id, $extension, &$extensions)
if (empty($extensions))
{
global $cache;
- $extensions = cache::obtain_attach_extensions($forum_id);
+ $extensions = phpbb_cache::obtain_extensions_forum($forum_id);
}
return (!isset($extensions['_allowed_'][$extension])) ? false : true;
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index bda91d1471..9fa6a2bf01 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -1156,7 +1156,7 @@ function get_user_rank($user_id, $user_rank, $user_posts, &$rank_title, &$rank_i
if (empty($ranks))
{
global $cache;
- $ranks = cache::obtain_ranks();
+ $ranks = phpbb_cache::obtain_ranks();
}
if (!empty($user_rank))
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index b4f6252078..c7749539ae 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -248,7 +248,7 @@ function posting_gen_topic_icons($mode, $icon_id)
global $config, $template, $cache;
// Grab icons
- $icons = cache::obtain_icons();
+ $icons = phpbb_cache::obtain_icons();
if (!$icon_id)
{
@@ -376,7 +376,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
return $filedata;
}
- $extensions = cache::obtain_attach_extensions((($is_message) ? false : (int) $forum_id));
+ $extensions = ($is_message) ? phpbb_cache::obtain_extensions_pm() : phpbb_cache::obtain_extensions_forum($forum_id);
$upload->set_allowed_extensions(array_keys($extensions['_allowed_']));
$file = ($local) ? $upload->local_upload($local_storage, $local_filedata) : $upload->form_upload($form_name);
@@ -998,7 +998,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
$extensions = $attachments = array();
if ($has_attachments && $auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id))
{
- $extensions = cache::obtain_attach_extensions($forum_id);
+ $extensions = phpbb_cache::obtain_extensions_forum($forum_id);
// Get attachments...
$sql = 'SELECT *
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 5b398b2bc0..49b48cbdb5 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -1420,7 +1420,7 @@ function validate_username($username, $allowed_username = false)
return 'USERNAME_TAKEN';
}
- $bad_usernames = cache::obtain_disallowed_usernames();
+ $bad_usernames = phpbb_cache::obtain_disallowed_usernames();
foreach ($bad_usernames as $bad_username)
{
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index e43e8ad142..583ec0861f 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -86,22 +86,6 @@ $user = new user();
$cache = new acm();
$db = new $sql_db();
-// Add own hook handler, if present. :o
-if (file_exists(PHPBB_ROOT_PATH . 'includes/hooks/index.' . PHP_EXT))
-{
- require(PHPBB_ROOT_PATH . 'includes/hooks/index.' . PHP_EXT);
- $phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));
-
- foreach (cache::obtain_hooks() as $hook)
- {
- @include(PHPBB_ROOT_PATH . 'includes/hooks/' . $hook . '.' . PHP_EXT);
- }
-}
-else
-{
- $phpbb_hook = false;
-}
-
// Connect to DB
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false);
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
index d43d0f529a..a68cdab988 100644
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -249,22 +249,6 @@ $auth = new auth();
$cache = new acm();
$template = new template();
-// Add own hook handler, if present. :o
-if (file_exists(PHPBB_ROOT_PATH . 'includes/hooks/index.' . PHP_EXT))
-{
- require(PHPBB_ROOT_PATH . 'includes/hooks/index.' . PHP_EXT);
- $phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));
-
- foreach (cache::obtain_hooks() as $hook)
- {
- @include(PHPBB_ROOT_PATH . 'includes/hooks/' . $hook . '.' . PHP_EXT);
- }
-}
-else
-{
- $phpbb_hook = false;
-}
-
// Set some standard variables we want to force
$config = array(
'load_tplcompile' => '1'
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index f1663382eb..63ea760994 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -64,7 +64,7 @@ $sort_dir = request_var('sd', 'a');
// Grab rank information for later
-$ranks = cache::obtain_ranks();
+$ranks = phpbb_cache::obtain_ranks();
// What do you want to do today? ... oops, I think that line is taken ...
diff --git a/phpBB/modules/acp/acp_styles.php b/phpBB/modules/acp/acp_styles.php
index 03abe01dbc..dc366a1ff6 100644
--- a/phpBB/modules/acp/acp_styles.php
+++ b/phpBB/modules/acp/acp_styles.php
@@ -1660,7 +1660,7 @@ parse_css_file = {PARSE_CSS_FILE}
$theme_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}'), array($mode, $style_row['theme_name'], $style_row['theme_copyright'], $config['version']), $this->theme_cfg);
// Read old cfg file
- $items = cache::obtain_cfg_item($style_row, 'theme');
+ $items = phpbb_cache::obtain_cfg_item($style_row, 'theme');
if (!isset($items['parse_css_file']))
{
diff --git a/phpBB/modules/mcp/mcp_forum.php b/phpBB/modules/mcp/mcp_forum.php
index ef28d5efd0..547ed00da3 100644
--- a/phpBB/modules/mcp/mcp_forum.php
+++ b/phpBB/modules/mcp/mcp_forum.php
@@ -134,7 +134,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
));
// Grab icons
- $icons = cache::obtain_icons();
+ $icons = phpbb_cache::obtain_icons();
$topic_rows = array();
diff --git a/phpBB/modules/mcp/mcp_post.php b/phpBB/modules/mcp/mcp_post.php
index 5717242541..9cb5b2cdae 100644
--- a/phpBB/modules/mcp/mcp_post.php
+++ b/phpBB/modules/mcp/mcp_post.php
@@ -140,7 +140,7 @@ function mcp_post_details($id, $mode, $action)
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
{
- $extensions = cache::obtain_attach_extensions($post_info['forum_id']);
+ $extensions = phpbb_cache::obtain_extensions_forum($post_info['forum_id']);
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
diff --git a/phpBB/modules/mcp/mcp_queue.php b/phpBB/modules/mcp/mcp_queue.php
index 0db75dd268..2fa80602fe 100644
--- a/phpBB/modules/mcp/mcp_queue.php
+++ b/phpBB/modules/mcp/mcp_queue.php
@@ -140,7 +140,7 @@ class mcp_queue
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
{
- $extensions = cache::obtain_attach_extensions($post_info['forum_id']);
+ $extensions = phpbb_cache::obtain_extensions_forum($post_info['forum_id']);
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
diff --git a/phpBB/modules/mcp/mcp_reports.php b/phpBB/modules/mcp/mcp_reports.php
index 7e6bae1dc1..63d145eb49 100644
--- a/phpBB/modules/mcp/mcp_reports.php
+++ b/phpBB/modules/mcp/mcp_reports.php
@@ -149,7 +149,7 @@ class mcp_reports
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
{
- $extensions = cache::obtain_attach_extensions($post_info['forum_id']);
+ $extensions = phpbb_cache::obtain_extensions_forum($post_info['forum_id']);
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
@@ -425,7 +425,7 @@ class mcp_reports
'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start),
'TOPIC_ID' => $topic_id,
'TOTAL' => $total,
- 'TOTAL_REPORTS' => ($total == 1) ? $user->lang['LIST_REPORT'] : sprintf($user->lang['LIST_REPORTS'], $total),
+ 'TOTAL_REPORTS' => ($total == 1) ? $user->lang['LIST_REPORT'] : sprintf($user->lang['LIST_REPORTS'], $total),
)
);
@@ -610,13 +610,13 @@ function close_report($report_id_list, $mode, $action)
$messenger->send($reporter['user_notify_type']);
}
}
-
+
foreach ($post_info as $post)
{
$forum_ids[$post['forum_id']] = $post['forum_id'];
$topic_ids[$post['topic_id']] = $post['topic_id'];
}
-
+
unset($notify_reporters, $post_info, $reports);
$messenger->save_queue();
@@ -648,7 +648,7 @@ function close_report($report_id_list, $mode, $action)
{
$return_topic = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 't=' . current($topic_ids) . '&amp;f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />';
}
-
+
trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_forum . $return_topic . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>'));
}
}
diff --git a/phpBB/modules/mcp/mcp_topic.php b/phpBB/modules/mcp/mcp_topic.php
index bd1bc4f659..7da6891c07 100644
--- a/phpBB/modules/mcp/mcp_topic.php
+++ b/phpBB/modules/mcp/mcp_topic.php
@@ -171,7 +171,7 @@ function mcp_topic_view($id, $mode, $action)
$extensions = $attachments = array();
if ($topic_info['topic_attachment'] && sizeof($post_id_list))
{
- $extensions = cache::obtain_attach_extensions($topic_info['forum_id']);
+ $extensions = phpbb_cache::obtain_extensions_forum($topic_info['forum_id']);
// Get attachments...
if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_info['forum_id']))
diff --git a/phpBB/modules/ucp/ucp_pm_viewfolder.php b/phpBB/modules/ucp/ucp_pm_viewfolder.php
index 36750d69c4..67db920b2b 100644
--- a/phpBB/modules/ucp/ucp_pm_viewfolder.php
+++ b/phpBB/modules/ucp/ucp_pm_viewfolder.php
@@ -33,7 +33,7 @@ function view_folder($id, $mode, $folder_id, $folder)
$user->add_lang('viewforum');
// Grab icons
- $icons = cache::obtain_icons();
+ $icons = phpbb_cache::obtain_icons();
$color_rows = array('marked', 'replied');
diff --git a/phpBB/modules/ucp/ucp_pm_viewmessage.php b/phpBB/modules/ucp/ucp_pm_viewmessage.php
index 8b249ab66a..e6e34efbfa 100644
--- a/phpBB/modules/ucp/ucp_pm_viewmessage.php
+++ b/phpBB/modules/ucp/ucp_pm_viewmessage.php
@@ -46,7 +46,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
}
// Grab icons
- $icons = cache::obtain_icons();
+ $icons = phpbb_cache::obtain_icons();
$bbcode = false;
diff --git a/phpBB/search.php b/phpBB/search.php
index 8c4dc6547d..ab2e54126c 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -450,7 +450,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
$user->add_lang('viewtopic');
// Grab icons
- $icons = cache::obtain_icons();
+ $icons = phpbb_cache::obtain_icons();
// Output header
if ($search_id && ($total_match_count > 1000))
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index cc4003b939..3dbdae2f12 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -306,7 +306,7 @@ $template->assign_vars(array(
'S_SINGLE_MODERATOR' => (!empty($moderators[$forum_id]) && sizeof($moderators[$forum_id]) > 1) ? false : true,
'S_IS_LOCKED' => ($forum_data['forum_status'] == ITEM_LOCKED) ? true : false,
'S_VIEWFORUM' => true,
-
+
'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid('mcp', "f=$forum_id&amp;i=main&amp;mode=forum_view", true, $user->session_id) : '',
'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid('posting', 'mode=post&amp;f=' . $forum_id) : '',
'U_VIEW_FORUM' => append_sid('viewforum', "f=$forum_id" . ((strlen($u_sort_param)) ? "&amp;$u_sort_param" : '') . "&amp;start=$start"),
@@ -314,7 +314,7 @@ $template->assign_vars(array(
));
// Grab icons
-$icons = cache::obtain_icons();
+$icons = phpbb_cache::obtain_icons();
// Grab all topic data
$rowset = $announcement_list = $topic_list = $global_announce_list = array();
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 46ff8510a8..84f67d5442 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -505,16 +505,16 @@ if ($config['allow_bookmarks'] && $user->data['is_registered'] && request_var('b
}
// Grab ranks
-$ranks = cache::obtain_ranks();
+$ranks = phpbb_cache::obtain_ranks();
// Grab icons
-$icons = cache::obtain_icons();
+$icons = phpbb_cache::obtain_icons();
// Grab extensions
$extensions = array();
if ($topic_data['topic_attachment'])
{
- $extensions = cache::obtain_attach_extensions($forum_id);
+ $extensions = phpbb_cache::obtain_extensions_forum($forum_id);
}
// Forum rules listing