mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
implement new phpbb::$acm object, replacing $cache global
git-svn-id: file:///svn/phpbb/trunk@9240 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
fbaf2baa8d
commit
889fa87140
57 changed files with 543 additions and 774 deletions
|
@ -166,7 +166,7 @@ function adm_page_header($page_title)
|
||||||
*/
|
*/
|
||||||
function adm_page_footer($copyright_html = true)
|
function adm_page_footer($copyright_html = true)
|
||||||
{
|
{
|
||||||
global $db, $config, $template, $user, $auth, $cache;
|
global $db, $config, $template, $user, $auth;
|
||||||
global $starttime;
|
global $starttime;
|
||||||
|
|
||||||
// Output page creation time
|
// Output page creation time
|
||||||
|
|
|
@ -69,7 +69,7 @@ phpbb_request::disable_super_globals();
|
||||||
if (!empty($dbms))
|
if (!empty($dbms))
|
||||||
{
|
{
|
||||||
// Register DB object.
|
// Register DB object.
|
||||||
phpbb::assign('db', phpbb_db_dbal::connect($dbms, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false));
|
//phpbb::assign('db', phpbb_db_dbal::connect($dbms, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, defined('PHPBB_DB_NEW_LINK') ? PHPBB_DB_NEW_LINK : false));
|
||||||
}
|
}
|
||||||
|
|
||||||
// We do not need the db password any longer, unset for safety purposes
|
// We do not need the db password any longer, unset for safety purposes
|
||||||
|
|
|
@ -101,18 +101,18 @@ switch ($cron_type)
|
||||||
|
|
||||||
case 'tidy_cache':
|
case 'tidy_cache':
|
||||||
|
|
||||||
if (time() - $config['cache_gc'] <= $config['cache_last_gc'] || !method_exists($cache, 'tidy'))
|
if (time() - $config['cache_gc'] <= $config['cache_last_gc'] || !method_exists(phpbb::$acm, 'tidy'))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($use_shutdown_function)
|
if ($use_shutdown_function)
|
||||||
{
|
{
|
||||||
register_shutdown_function(array(&$cache, 'tidy'));
|
register_shutdown_function(array(&phpbb::$acm, 'tidy'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$cache->tidy();
|
phpbb::$acm->tidy();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -656,12 +656,16 @@ function set_modified_headers($stamp, $browser)
|
||||||
|
|
||||||
function file_gc()
|
function file_gc()
|
||||||
{
|
{
|
||||||
global $cache, $db;
|
if (phpbb::registered('acm'))
|
||||||
if (!empty($cache))
|
|
||||||
{
|
{
|
||||||
$cache->unload();
|
phpbb::$acm->unload();
|
||||||
}
|
}
|
||||||
$db->sql_close();
|
|
||||||
|
if (phpbb::registered('db'))
|
||||||
|
{
|
||||||
|
phpbb::$db->sql_close();
|
||||||
|
}
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,35 +17,136 @@ if (!defined('IN_PHPBB'))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ACM File Based Caching
|
* Define file-based cache.
|
||||||
* @package acm
|
* @package acm
|
||||||
*/
|
*/
|
||||||
class acm
|
class phpbb_acm_file extends phpbb_acm_abstract
|
||||||
{
|
{
|
||||||
private $vars = array();
|
/**
|
||||||
private $var_expires = array();
|
* @var string The cache directory to use
|
||||||
private $is_modified = false;
|
*/
|
||||||
|
|
||||||
public $sql_rowset = array();
|
|
||||||
public $cache_dir = '';
|
public $cache_dir = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set cache path
|
* @var array|bool The cache types this class supports. True indicates support for all types.
|
||||||
*/
|
*/
|
||||||
function __construct()
|
public $supported = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set cache directory
|
||||||
|
*
|
||||||
|
* @param string $cache_prefix The cache prefix the instance is responsible for
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public function __construct($cache_prefix)
|
||||||
{
|
{
|
||||||
$this->cache_dir = PHPBB_ROOT_PATH . 'cache/';
|
$this->cache_dir = PHPBB_ROOT_PATH . 'cache/';
|
||||||
|
$this->cache_prefix = $cache_prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load global cache
|
* {@link phpbb_acm_abstract::get() get()}
|
||||||
*/
|
*/
|
||||||
private function load()
|
public function get($var_name)
|
||||||
|
{
|
||||||
|
if ($var_name[0] === '#')
|
||||||
|
{
|
||||||
|
$var_name = substr($var_name, 1);
|
||||||
|
return $this->get_global($var_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->exists($var_name))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include($this->cache_dir . $this->cache_prefix . '_' . $var_name . '.' . PHP_EXT);
|
||||||
|
|
||||||
|
// If no data there, then the file expired...
|
||||||
|
if ($expired)
|
||||||
|
{
|
||||||
|
// Destroy
|
||||||
|
$this->destroy($var_name);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link phpbb_acm_abstract::put() put()}
|
||||||
|
*/
|
||||||
|
public function put($var_name, $data, $ttl = 31536000)
|
||||||
|
{
|
||||||
|
if ($var_name[0] === '#')
|
||||||
|
{
|
||||||
|
$var_name = substr($var_name, 1);
|
||||||
|
return $this->put_global($var_name, $data, $ttl);
|
||||||
|
}
|
||||||
|
|
||||||
|
$filename = $this->cache_dir . $this->cache_prefix . '_' . $var_name . '.' . PHP_EXT;
|
||||||
|
|
||||||
|
if ($fp = @fopen($filename, 'wb'))
|
||||||
|
{
|
||||||
|
@flock($fp, LOCK_EX);
|
||||||
|
fwrite($fp, "<?php\n\$expired = (time() > " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n\$data = " . (sizeof($data) ? "unserialize(" . var_export(serialize($data), true) . ");" : 'array();'));
|
||||||
|
@flock($fp, LOCK_UN);
|
||||||
|
fclose($fp);
|
||||||
|
|
||||||
|
if (!function_exists('phpbb_chmod'))
|
||||||
|
{
|
||||||
|
include(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT);
|
||||||
|
}
|
||||||
|
|
||||||
|
phpbb_chmod($filename, phpbb::CHMOD_WRITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link phpbb_acm_abstract::exists() exists()}
|
||||||
|
*/
|
||||||
|
public function exists($var_name)
|
||||||
|
{
|
||||||
|
if ($var_name[0] === '#')
|
||||||
|
{
|
||||||
|
$var_name = substr($var_name, 1);
|
||||||
|
return $this->exists_global($var_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return file_exists($this->cache_dir . $this->cache_prefix . '_' . $var_name . '.' . PHP_EXT);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link phpbb_acm_abstract::destroy() destroy()}
|
||||||
|
*/
|
||||||
|
public function destroy($var_name)
|
||||||
|
{
|
||||||
|
if ($var_name[0] === '#')
|
||||||
|
{
|
||||||
|
$var_name = substr($var_name, 1);
|
||||||
|
$this->destroy_global($var_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->exists($var_name))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->remove_file($this->cache_dir . $this->cache_prefix . '_' . $var_name . '.' . PHP_EXT, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link phpbb_acm_abstract::load() load()}
|
||||||
|
*/
|
||||||
|
public function load()
|
||||||
{
|
{
|
||||||
// grab the global cache
|
// grab the global cache
|
||||||
if (file_exists($this->cache_dir . 'data_global.' . PHP_EXT))
|
if (file_exists($this->cache_dir . $this->cache_prefix . '_global.' . PHP_EXT))
|
||||||
{
|
{
|
||||||
@include($this->cache_dir . 'data_global.' . PHP_EXT);
|
@include($this->cache_dir . $this->cache_prefix . '_global.' . PHP_EXT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,31 +154,18 @@ class acm
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unload cache object
|
* {@link phpbb_acm_abstract::unload() unload()}
|
||||||
*/
|
*/
|
||||||
public function unload()
|
public function unload()
|
||||||
{
|
|
||||||
$this->save();
|
|
||||||
unset($this->vars);
|
|
||||||
unset($this->var_expires);
|
|
||||||
unset($this->sql_rowset);
|
|
||||||
|
|
||||||
$this->vars = array();
|
|
||||||
$this->var_expires = array();
|
|
||||||
$this->sql_rowset = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Save modified objects
|
|
||||||
*/
|
|
||||||
private function save()
|
|
||||||
{
|
{
|
||||||
if (!$this->is_modified)
|
if (!$this->is_modified)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($fp = @fopen($this->cache_dir . 'data_global.' . PHP_EXT, 'wb'))
|
$filename = $this->cache_dir . $this->cache_prefix . '_global.' . PHP_EXT;
|
||||||
|
|
||||||
|
if ($fp = @fopen($filename, 'wb'))
|
||||||
{
|
{
|
||||||
@flock($fp, LOCK_EX);
|
@flock($fp, LOCK_EX);
|
||||||
fwrite($fp, "<?php\n\$this->vars = unserialize(" . var_export(serialize($this->vars), true) . ");\n\$this->var_expires = unserialize(" . var_export(serialize($this->var_expires), true) . ");");
|
fwrite($fp, "<?php\n\$this->vars = unserialize(" . var_export(serialize($this->vars), true) . ");\n\$this->var_expires = unserialize(" . var_export(serialize($this->var_expires), true) . ");");
|
||||||
|
@ -89,7 +177,7 @@ class acm
|
||||||
include(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT);
|
include(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
phpbb_chmod($this->cache_dir . 'data_global.' . PHP_EXT, phpbb::CHMOD_WRITE);
|
phpbb_chmod($filename, phpbb::CHMOD_WRITE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -99,16 +187,20 @@ class acm
|
||||||
trigger_error($this->cache_dir . ' is NOT writable.', E_USER_ERROR);
|
trigger_error($this->cache_dir . ' is NOT writable.', E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger_error('Not able to open ' . $this->cache_dir . 'data_global.' . PHP_EXT, E_USER_ERROR);
|
trigger_error('Not able to open ' . $filename, E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->is_modified = false;
|
$this->is_modified = false;
|
||||||
|
|
||||||
|
// To reset the global vars
|
||||||
|
$this->vars = $this->var_expires = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tidy cache
|
* Tidy local cache data. Also see {@link phpbb_acm_abstract::tidy() tidy()}
|
||||||
|
* @access protected
|
||||||
*/
|
*/
|
||||||
public function tidy()
|
protected function tidy_local()
|
||||||
{
|
{
|
||||||
$dir = @opendir($this->cache_dir);
|
$dir = @opendir($this->cache_dir);
|
||||||
|
|
||||||
|
@ -119,96 +211,28 @@ class acm
|
||||||
|
|
||||||
while (($entry = readdir($dir)) !== false)
|
while (($entry = readdir($dir)) !== false)
|
||||||
{
|
{
|
||||||
if (!preg_match('/^(sql_|data_(?!global))/', $entry))
|
if (strpos($entry, $this->cache_prefix . '_') !== 0 || strpos($entry, $this->cache_prefix . '_global') === 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$expired = true;
|
$expired = true;
|
||||||
@include($this->cache_dir . $entry);
|
@include($this->cache_dir . $entry);
|
||||||
|
|
||||||
if ($expired)
|
if ($expired)
|
||||||
{
|
{
|
||||||
$this->remove_file($this->cache_dir . $entry);
|
$this->remove_file($this->cache_dir . $entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir($dir);
|
closedir($dir);
|
||||||
|
|
||||||
if (file_exists($this->cache_dir . 'data_global.' . PHP_EXT))
|
|
||||||
{
|
|
||||||
if (!sizeof($this->vars))
|
|
||||||
{
|
|
||||||
$this->load();
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($this->var_expires as $var_name => $expires)
|
|
||||||
{
|
|
||||||
if (time() > $expires)
|
|
||||||
{
|
|
||||||
$this->destroy($var_name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
set_config('cache_last_gc', time(), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get saved cache object
|
* Purge local cache data. Also see {@link phpbb_acm_abstract::purge() purge()}
|
||||||
|
* @access protected
|
||||||
*/
|
*/
|
||||||
public function get($var_name)
|
protected function purge_local()
|
||||||
{
|
{
|
||||||
if ($var_name[0] === '_')
|
|
||||||
{
|
|
||||||
if (!$this->_exists($var_name))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@include($this->cache_dir . "data{$var_name}." . PHP_EXT);
|
|
||||||
return (isset($data)) ? $data : false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return ($this->_exists($var_name)) ? $this->vars[$var_name] : false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Put data into cache
|
|
||||||
*/
|
|
||||||
function put($var_name, $var, $ttl = 31536000)
|
|
||||||
{
|
|
||||||
if ($var_name[0] === '_')
|
|
||||||
{
|
|
||||||
if ($fp = @fopen($this->cache_dir . "data{$var_name}." . PHP_EXT, 'wb'))
|
|
||||||
{
|
|
||||||
@flock($fp, LOCK_EX);
|
|
||||||
fwrite($fp, "<?php\n\$expired = (time() > " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n\$data = " . (sizeof($var) ? "unserialize(" . var_export(serialize($var), true) . ");" : 'array();'));
|
|
||||||
@flock($fp, LOCK_UN);
|
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
if (!function_exists('phpbb_chmod'))
|
|
||||||
{
|
|
||||||
include(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT);
|
|
||||||
}
|
|
||||||
|
|
||||||
phpbb_chmod($this->cache_dir . "data{$var_name}." . PHP_EXT, phpbb::CHMOD_WRITE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->vars[$var_name] = $var;
|
|
||||||
$this->var_expires[$var_name] = time() + $ttl;
|
|
||||||
$this->is_modified = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Purge cache data
|
|
||||||
*/
|
|
||||||
public function purge()
|
|
||||||
{
|
|
||||||
// Purge all phpbb cache files
|
|
||||||
$dir = @opendir($this->cache_dir);
|
$dir = @opendir($this->cache_dir);
|
||||||
|
|
||||||
if (!$dir)
|
if (!$dir)
|
||||||
|
@ -218,7 +242,7 @@ class acm
|
||||||
|
|
||||||
while (($entry = readdir($dir)) !== false)
|
while (($entry = readdir($dir)) !== false)
|
||||||
{
|
{
|
||||||
if (strpos($entry, 'sql_') !== 0 && strpos($entry, 'data_') !== 0 && strpos($entry, 'ctpl_') !== 0 && strpos($entry, 'tpl_') !== 0)
|
if (strpos($entry, $this->cache_prefix . '_') !== 0 || strpos($entry, $this->cache_prefix . '_global') === 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -226,30 +250,56 @@ class acm
|
||||||
$this->remove_file($this->cache_dir . $entry);
|
$this->remove_file($this->cache_dir . $entry);
|
||||||
}
|
}
|
||||||
closedir($dir);
|
closedir($dir);
|
||||||
|
|
||||||
unset($this->vars);
|
|
||||||
unset($this->var_expires);
|
|
||||||
unset($this->sql_rowset);
|
|
||||||
|
|
||||||
$this->vars = array();
|
|
||||||
$this->var_expires = array();
|
|
||||||
$this->sql_rowset = array();
|
|
||||||
|
|
||||||
$this->is_modified = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy cache data
|
* Get modified date for cache entry
|
||||||
|
*
|
||||||
|
* @param string $var_name The cache variable name
|
||||||
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function destroy($var_name, $table = '')
|
public function get_modified_date($var_name)
|
||||||
{
|
{
|
||||||
if ($var_name === 'sql' && !empty($table))
|
return @filemtime($this->cache_dir . $this->cache_prefix . '_' . $var_name . '.' . PHP_EXT);
|
||||||
{
|
|
||||||
if (!is_array($table))
|
|
||||||
{
|
|
||||||
$table = array($table);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes/unlinks file
|
||||||
|
*
|
||||||
|
* @param string $filename The filename to remove
|
||||||
|
* @param bool $check If true the cache directory is checked for correct directory permissions.
|
||||||
|
* @access protected
|
||||||
|
*/
|
||||||
|
protected function remove_file($filename, $check = false)
|
||||||
|
{
|
||||||
|
if ($check && !@is_writable($this->cache_dir))
|
||||||
|
{
|
||||||
|
// E_USER_ERROR - not using language entry - intended.
|
||||||
|
trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
return @unlink($filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Special implementation for cache type 'sql'
|
||||||
|
* @package acm
|
||||||
|
*/
|
||||||
|
class phpbb_acm_file_sql extends phpbb_acm_file
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@link phpbb_acm_abstract::destroy() destroy()}
|
||||||
|
*/
|
||||||
|
public function destroy($var_name)
|
||||||
|
{
|
||||||
|
if ($var_name[0] === '#')
|
||||||
|
{
|
||||||
|
$var_name = substr($var_name, 1);
|
||||||
|
$this->destroy_global($var_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
$table = (!is_array($var_name)) ? array($var_name) : $var_name;
|
||||||
$dir = @opendir($this->cache_dir);
|
$dir = @opendir($this->cache_dir);
|
||||||
|
|
||||||
if (!$dir)
|
if (!$dir)
|
||||||
|
@ -259,27 +309,28 @@ class acm
|
||||||
|
|
||||||
while (($entry = readdir($dir)) !== false)
|
while (($entry = readdir($dir)) !== false)
|
||||||
{
|
{
|
||||||
if (strpos($entry, 'sql_') !== 0)
|
if (strpos($entry, $this->cache_prefix . '_') !== 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The following method is more failproof than simply assuming the query is on line 3 (which it should be)
|
// The following method is more failproof than simply assuming the query is on line 3 (which it should be)
|
||||||
$check_line = @file_get_contents($this->cache_dir . $entry);
|
@include($this->cache_dir . $entry);
|
||||||
|
|
||||||
if (empty($check_line))
|
if (empty($data))
|
||||||
{
|
{
|
||||||
|
$this->remove_file($this->cache_dir . $entry);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now get the contents between /* and */
|
// Get the query
|
||||||
$check_line = substr($check_line, strpos($check_line, '/* ') + 3, strpos($check_line, ' */') - strpos($check_line, '/* ') - 3);
|
$data = $data['query'];
|
||||||
|
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($table as $check_table)
|
foreach ($table as $check_table)
|
||||||
{
|
{
|
||||||
// Better catch partial table names than no table names. ;)
|
// Better catch partial table names than no table names. ;)
|
||||||
if (strpos($check_line, $check_table) !== false)
|
if (strpos($data, $check_table) !== false)
|
||||||
{
|
{
|
||||||
$found = true;
|
$found = true;
|
||||||
break;
|
break;
|
||||||
|
@ -295,172 +346,6 @@ class acm
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->_exists($var_name))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($var_name[0] === '_')
|
|
||||||
{
|
|
||||||
$this->remove_file($this->cache_dir . 'data' . $var_name . '.' . PHP_EXT, true);
|
|
||||||
}
|
|
||||||
else if (isset($this->vars[$var_name]))
|
|
||||||
{
|
|
||||||
$this->is_modified = true;
|
|
||||||
unset($this->vars[$var_name]);
|
|
||||||
unset($this->var_expires[$var_name]);
|
|
||||||
|
|
||||||
// We save here to let the following cache hits succeed
|
|
||||||
$this->save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if a given cache entry exist
|
|
||||||
*/
|
|
||||||
private function _exists($var_name)
|
|
||||||
{
|
|
||||||
if ($var_name[0] === '_')
|
|
||||||
{
|
|
||||||
return file_exists($this->cache_dir . 'data' . $var_name . '.' . PHP_EXT);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!sizeof($this->vars))
|
|
||||||
{
|
|
||||||
$this->load();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($this->var_expires[$var_name]))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (time() > $this->var_expires[$var_name]) ? false : isset($this->vars[$var_name]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load cached sql query
|
|
||||||
*/
|
|
||||||
public function sql_load($query)
|
|
||||||
{
|
|
||||||
// Remove extra spaces and tabs
|
|
||||||
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
|
|
||||||
$query_id = sizeof($this->sql_rowset);
|
|
||||||
|
|
||||||
if (!file_exists($this->cache_dir . 'sql_' . md5($query) . '.' . PHP_EXT))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@include($this->cache_dir . 'sql_' . md5($query) . '.' . PHP_EXT);
|
|
||||||
|
|
||||||
if (!isset($expired))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if ($expired)
|
|
||||||
{
|
|
||||||
$this->remove_file($this->cache_dir . 'sql_' . md5($query) . '.' . PHP_EXT, true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return $query_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Save sql query
|
|
||||||
*/
|
|
||||||
public function sql_save($query, &$query_result, $ttl)
|
|
||||||
{
|
|
||||||
global $db;
|
|
||||||
|
|
||||||
// Remove extra spaces and tabs
|
|
||||||
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
|
|
||||||
$filename = $this->cache_dir . 'sql_' . md5($query) . '.' . PHP_EXT;
|
|
||||||
|
|
||||||
if ($fp = @fopen($filename, 'wb'))
|
|
||||||
{
|
|
||||||
@flock($fp, LOCK_EX);
|
|
||||||
|
|
||||||
$query_id = sizeof($this->sql_rowset);
|
|
||||||
$this->sql_rowset[$query_id] = array();
|
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($query_result))
|
|
||||||
{
|
|
||||||
$this->sql_rowset[$query_id][] = $row;
|
|
||||||
}
|
|
||||||
$db->sql_freeresult($query_result);
|
|
||||||
|
|
||||||
$file = "<?php\n/* " . str_replace('*/', '*\/', $query) . " */";
|
|
||||||
$file .= "\n\$expired = (time() > " . (time() + $ttl) . ") ? true : false;\nif (\$expired) { return; }\n";
|
|
||||||
|
|
||||||
fwrite($fp, $file . "\$this->sql_rowset[\$query_id] = " . (sizeof($this->sql_rowset[$query_id]) ? "unserialize(" . var_export(serialize($this->sql_rowset[$query_id]), true) . ");" : 'array();'));
|
|
||||||
@flock($fp, LOCK_UN);
|
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
if (!function_exists('phpbb_chmod'))
|
|
||||||
{
|
|
||||||
include(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT);
|
|
||||||
}
|
|
||||||
|
|
||||||
phpbb_chmod($filename, phpbb::CHMOD_WRITE);
|
|
||||||
|
|
||||||
$query_result = $query_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetch row from cache (database)
|
|
||||||
*/
|
|
||||||
public function sql_fetchrow($query_id)
|
|
||||||
{
|
|
||||||
list(, $row) = each($this->sql_rowset[$query_id]);
|
|
||||||
|
|
||||||
return ($row !== NULL) ? $row : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetch a field from the current row of a cached database result (database)
|
|
||||||
*/
|
|
||||||
public function sql_fetchfield($query_id, $field)
|
|
||||||
{
|
|
||||||
$row = current($this->sql_rowset[$query_id]);
|
|
||||||
|
|
||||||
return ($row !== false && isset($row[$field])) ? $row[$field] : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free memory used for a cached database result (database)
|
|
||||||
*/
|
|
||||||
public function sql_freeresult($query_id)
|
|
||||||
{
|
|
||||||
if (!isset($this->sql_rowset[$query_id]))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
unset($this->sql_rowset[$query_id]);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes/unlinks file
|
|
||||||
*/
|
|
||||||
private function remove_file($filename, $check = false)
|
|
||||||
{
|
|
||||||
if ($check && !@is_writable($this->cache_dir))
|
|
||||||
{
|
|
||||||
// E_USER_ERROR - not using language entry - intended.
|
|
||||||
trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
return @unlink($filename);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -17,36 +17,38 @@ if (!defined('IN_PHPBB'))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Permission/Auth class
|
* Permission/ACL class
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class auth
|
class phpbb_acl
|
||||||
{
|
{
|
||||||
|
public $phpbb_required = array('acm', 'db');
|
||||||
|
public $phpbb_optional = array();
|
||||||
|
|
||||||
|
public $acl_raw;
|
||||||
|
|
||||||
private $acl = array();
|
private $acl = array();
|
||||||
private $cache = array();
|
private $cache = array();
|
||||||
public $acl_options = array();
|
public $acl_options = array();
|
||||||
private $acl_forum_ids = false;
|
private $acl_element_ids = false;
|
||||||
|
private $recache = false;
|
||||||
|
|
||||||
/**
|
public function __construct()
|
||||||
* Init permissions
|
|
||||||
*/
|
|
||||||
function acl(array &$userdata)
|
|
||||||
{
|
{
|
||||||
global $db, $cache;
|
|
||||||
|
|
||||||
$this->acl = $this->cache = $this->acl_options = array();
|
$this->acl = $this->cache = $this->acl_options = array();
|
||||||
$this->acl_forum_ids = false;
|
$this->acl_element_ids = false;
|
||||||
|
|
||||||
if (($this->acl_options = $cache->get('_acl_options')) === false)
|
if (($this->acl_options = phpbb::$acm->get('acl_options')) === false)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT auth_option_id, auth_option, is_global, is_local
|
$sql = 'SELECT auth_option_id, auth_option, is_global, is_local
|
||||||
FROM ' . ACL_OPTIONS_TABLE . '
|
FROM ' . ACL_OPTIONS_TABLE . '
|
||||||
ORDER BY auth_option_id';
|
ORDER BY auth_option_id';
|
||||||
$result = $db->sql_query($sql);
|
$result = phpbb::$db->sql_query($sql);
|
||||||
|
|
||||||
$global = $local = 0;
|
$global = $local = 0;
|
||||||
$this->acl_options = array();
|
$this->acl_options = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
|
||||||
|
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if ($row['is_global'])
|
if ($row['is_global'])
|
||||||
{
|
{
|
||||||
|
@ -61,12 +63,22 @@ class auth
|
||||||
$this->acl_options['id'][$row['auth_option']] = (int) $row['auth_option_id'];
|
$this->acl_options['id'][$row['auth_option']] = (int) $row['auth_option_id'];
|
||||||
$this->acl_options['option'][(int) $row['auth_option_id']] = $row['auth_option'];
|
$this->acl_options['option'][(int) $row['auth_option_id']] = $row['auth_option'];
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
phpbb::$db->sql_freeresult($result);
|
||||||
|
|
||||||
$cache->put('_acl_options', $this->acl_options);
|
phpbb::$acm->put('acl_options', $this->acl_options);
|
||||||
$this->acl_cache($userdata);
|
$this->recache = true;
|
||||||
}
|
}
|
||||||
else if (!trim($userdata['user_permissions']))
|
|
||||||
|
// Add raw data acl class
|
||||||
|
$this->acl_raw = new phpbb_acl_raw_data();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init permissions
|
||||||
|
*/
|
||||||
|
public function init(array &$userdata)
|
||||||
|
{
|
||||||
|
if (!trim($userdata['user_permissions']) || $this->recache)
|
||||||
{
|
{
|
||||||
$this->acl_cache($userdata);
|
$this->acl_cache($userdata);
|
||||||
}
|
}
|
||||||
|
@ -150,7 +162,6 @@ class auth
|
||||||
$opt = substr($opt, 1);
|
$opt = substr($opt, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo: use the ref technique to reduce opcode generation
|
|
||||||
if (!isset($this->cache[$f][$opt]))
|
if (!isset($this->cache[$f][$opt]))
|
||||||
{
|
{
|
||||||
// We combine the global/local option with an OR because some options are global and local.
|
// We combine the global/local option with an OR because some options are global and local.
|
||||||
|
@ -203,23 +214,21 @@ class auth
|
||||||
{
|
{
|
||||||
if ($this->acl_forum_ids === false)
|
if ($this->acl_forum_ids === false)
|
||||||
{
|
{
|
||||||
global $db;
|
|
||||||
|
|
||||||
$sql = 'SELECT forum_id
|
$sql = 'SELECT forum_id
|
||||||
FROM ' . FORUMS_TABLE;
|
FROM ' . FORUMS_TABLE;
|
||||||
|
|
||||||
if (sizeof($this->acl))
|
if (sizeof($this->acl))
|
||||||
{
|
{
|
||||||
$sql .= ' WHERE ' . $db->sql_in_set('forum_id', array_keys($this->acl), true);
|
$sql .= ' WHERE ' . phpbb::$db->sql_in_set('forum_id', array_keys($this->acl), true);
|
||||||
}
|
}
|
||||||
$result = $db->sql_query($sql);
|
$result = phpbb::$db->sql_query($sql);
|
||||||
|
|
||||||
$this->acl_forum_ids = array();
|
$this->acl_forum_ids = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$this->acl_forum_ids[] = $row['forum_id'];
|
$this->acl_forum_ids[] = $row['forum_id'];
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
phpbb::$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,11 +351,11 @@ class auth
|
||||||
{
|
{
|
||||||
if ($user_id !== false && !is_array($user_id) && $opts === false && $forum_id === false)
|
if ($user_id !== false && !is_array($user_id) && $opts === false && $forum_id === false)
|
||||||
{
|
{
|
||||||
$hold_ary = array($user_id => $this->acl_raw_data_single_user($user_id));
|
$hold_ary = array($user_id => $this->acl_raw->single_user($user_id));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$hold_ary = $this->acl_raw_data($user_id, $opts, $forum_id);
|
$hold_ary = $this->acl_raw->data($user_id, $opts, $forum_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$auth_ary = array();
|
$auth_ary = array();
|
||||||
|
@ -372,17 +381,15 @@ class auth
|
||||||
*/
|
*/
|
||||||
public function acl_cache(array &$userdata)
|
public function acl_cache(array &$userdata)
|
||||||
{
|
{
|
||||||
global $db;
|
|
||||||
|
|
||||||
// Empty user_permissions
|
// Empty user_permissions
|
||||||
$userdata['user_permissions'] = '';
|
$userdata['user_permissions'] = '';
|
||||||
|
|
||||||
$hold_ary = $this->acl_raw_data_single_user($userdata['user_id']);
|
$hold_ary = $this->acl_raw->single_user($userdata['user_id']);
|
||||||
|
|
||||||
// Key 0 in $hold_ary are global options, all others are forum_ids
|
// Key 0 in $hold_ary are global options, all others are forum_ids
|
||||||
|
|
||||||
// If this user is founder we're going to force fill the admin options ...
|
// If this user is founder we're going to force fill the admin options ...
|
||||||
if ($userdata['user_type'] == phpbb::USER_FOUNDER)
|
if ($userdata['user_type'] == USER_FOUNDER)
|
||||||
{
|
{
|
||||||
foreach ($this->acl_options['global'] as $opt => $id)
|
foreach ($this->acl_options['global'] as $opt => $id)
|
||||||
{
|
{
|
||||||
|
@ -400,10 +407,10 @@ class auth
|
||||||
$userdata['user_permissions'] = $hold_str;
|
$userdata['user_permissions'] = $hold_str;
|
||||||
|
|
||||||
$sql = 'UPDATE ' . USERS_TABLE . "
|
$sql = 'UPDATE ' . USERS_TABLE . "
|
||||||
SET user_permissions = '" . $db->sql_escape($userdata['user_permissions']) . "',
|
SET user_permissions = '" . phpbb::$db->sql_escape($userdata['user_permissions']) . "',
|
||||||
user_perm_from = 0
|
user_perm_from = 0
|
||||||
WHERE user_id = " . $userdata['user_id'];
|
WHERE user_id = " . $userdata['user_id'];
|
||||||
$db->sql_query($sql);
|
phpbb::$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -475,29 +482,27 @@ class auth
|
||||||
*/
|
*/
|
||||||
public function acl_clear_prefetch($user_id = false)
|
public function acl_clear_prefetch($user_id = false)
|
||||||
{
|
{
|
||||||
global $db, $cache;
|
|
||||||
|
|
||||||
// Rebuild options cache
|
// Rebuild options cache
|
||||||
$cache->destroy('_role_cache');
|
phpbb::$acm->destroy('role_cache');
|
||||||
|
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT *
|
||||||
FROM ' . ACL_ROLES_DATA_TABLE . '
|
FROM ' . ACL_ROLES_DATA_TABLE . '
|
||||||
ORDER BY role_id ASC';
|
ORDER BY role_id ASC';
|
||||||
$result = $db->sql_query($sql);
|
$result = phpbb::$db->sql_query($sql);
|
||||||
|
|
||||||
$this->role_cache = array();
|
$this->role_cache = array();
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$this->role_cache[$row['role_id']][$row['auth_option_id']] = (int) $row['auth_setting'];
|
$this->role_cache[$row['role_id']][$row['auth_option_id']] = (int) $row['auth_setting'];
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
phpbb::$db->sql_freeresult($result);
|
||||||
|
|
||||||
foreach ($this->role_cache as $role_id => $role_options)
|
foreach ($this->role_cache as $role_id => $role_options)
|
||||||
{
|
{
|
||||||
$this->role_cache[$role_id] = serialize($role_options);
|
$this->role_cache[$role_id] = serialize($role_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->put('_role_cache', $this->role_cache);
|
phpbb::$acm->put('role_cache', $this->role_cache);
|
||||||
|
|
||||||
// Now empty user permissions
|
// Now empty user permissions
|
||||||
$where_sql = '';
|
$where_sql = '';
|
||||||
|
@ -505,62 +510,72 @@ class auth
|
||||||
if ($user_id !== false)
|
if ($user_id !== false)
|
||||||
{
|
{
|
||||||
$user_id = (!is_array($user_id)) ? $user_id = array((int) $user_id) : array_map('intval', $user_id);
|
$user_id = (!is_array($user_id)) ? $user_id = array((int) $user_id) : array_map('intval', $user_id);
|
||||||
$where_sql = ' WHERE ' . $db->sql_in_set('user_id', $user_id);
|
$where_sql = ' WHERE ' . phpbb::$db->sql_in_set('user_id', $user_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'UPDATE ' . USERS_TABLE . "
|
$sql = 'UPDATE ' . USERS_TABLE . "
|
||||||
SET user_permissions = '',
|
SET user_permissions = '',
|
||||||
user_perm_from = 0
|
user_perm_from = 0
|
||||||
$where_sql";
|
$where_sql";
|
||||||
$db->sql_query($sql);
|
phpbb::$db->sql_query($sql);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
}
|
||||||
|
|
||||||
|
* Role-specific methods/definitionis used by phpbb_acl
|
||||||
|
class phpbb_acl_role
|
||||||
|
{
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get assigned roles
|
* Get assigned roles
|
||||||
* @todo: protected or public?
|
* @todo: protected or public?
|
||||||
*/
|
*/
|
||||||
public function acl_role_data($user_type, $role_type, $ug_id = false, $forum_id = false)
|
public function acl_role_data($user_type, $role_type, $ug_id = false, $forum_id = false)
|
||||||
{
|
{
|
||||||
global $db;
|
|
||||||
|
|
||||||
$roles = array();
|
$roles = array();
|
||||||
|
|
||||||
$sql_id = ($user_type == 'user') ? 'user_id' : 'group_id';
|
$sql_id = ($user_type == 'user') ? 'user_id' : 'group_id';
|
||||||
|
|
||||||
$sql_ug = ($ug_id !== false) ? ((!is_array($ug_id)) ? "AND a.$sql_id = $ug_id" : 'AND ' . $db->sql_in_set("a.$sql_id", $ug_id)) : '';
|
$sql_ug = ($ug_id !== false) ? ((!is_array($ug_id)) ? "AND a.$sql_id = $ug_id" : 'AND ' . phpbb::$db->sql_in_set("a.$sql_id", $ug_id)) : '';
|
||||||
$sql_forum = ($forum_id !== false) ? ((!is_array($forum_id)) ? "AND a.forum_id = $forum_id" : 'AND ' . $db->sql_in_set('a.forum_id', $forum_id)) : '';
|
$sql_forum = ($forum_id !== false) ? ((!is_array($forum_id)) ? "AND a.forum_id = $forum_id" : 'AND ' . phpbb::$db->sql_in_set('a.forum_id', $forum_id)) : '';
|
||||||
|
|
||||||
// Grab assigned roles...
|
// Grab assigned roles...
|
||||||
$sql = 'SELECT a.auth_role_id, a.' . $sql_id . ', a.forum_id
|
$sql = 'SELECT a.auth_role_id, a.' . $sql_id . ', a.forum_id
|
||||||
FROM ' . (($user_type == 'user') ? ACL_USERS_TABLE : ACL_GROUPS_TABLE) . ' a, ' . ACL_ROLES_TABLE . " r
|
FROM ' . (($user_type == 'user') ? ACL_USERS_TABLE : ACL_GROUPS_TABLE) . ' a, ' . ACL_ROLES_TABLE . " r
|
||||||
WHERE a.auth_role_id = r.role_id
|
WHERE a.auth_role_id = r.role_id
|
||||||
AND r.role_type = '" . $db->sql_escape($role_type) . "'
|
AND r.role_type = '" . phpbb::$db->sql_escape($role_type) . "'
|
||||||
$sql_ug
|
$sql_ug
|
||||||
$sql_forum
|
$sql_forum
|
||||||
ORDER BY r.role_order ASC";
|
ORDER BY r.role_order ASC";
|
||||||
$result = $db->sql_query($sql);
|
$result = phpbb::$db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$roles[$row[$sql_id]][$row['forum_id']] = $row['auth_role_id'];
|
$roles[$row[$sql_id]][$row['forum_id']] = $row['auth_role_id'];
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
phpbb::$db->sql_freeresult($result);
|
||||||
|
|
||||||
return $roles;
|
return $roles;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* data-specific methods/definitionis used by phpbb_acl
|
||||||
|
*/
|
||||||
|
class phpbb_acl_raw_data
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Get raw acl data based on user/option/forum
|
* Get raw acl data based on user/option/forum
|
||||||
* @todo: protected or public?
|
* @todo: protected or public?
|
||||||
*/
|
*/
|
||||||
public function acl_raw_data($user_id = false, $opts = false, $forum_id = false)
|
public function data($user_id = false, $opts = false, $forum_id = false)
|
||||||
{
|
{
|
||||||
global $db;
|
$sql_user = ($user_id !== false) ? ((!is_array($user_id)) ? 'user_id = ' . (int) $user_id : phpbb::$db->sql_in_set('user_id', array_map('intval', $user_id))) : '';
|
||||||
|
$sql_forum = ($forum_id !== false) ? ((!is_array($forum_id)) ? 'AND a.forum_id = ' . (int) $forum_id : 'AND ' . phpbb::$db->sql_in_set('a.forum_id', array_map('intval', $forum_id))) : '';
|
||||||
$sql_user = ($user_id !== false) ? ((!is_array($user_id)) ? 'user_id = ' . (int) $user_id : $db->sql_in_set('user_id', array_map('intval', $user_id))) : '';
|
|
||||||
$sql_forum = ($forum_id !== false) ? ((!is_array($forum_id)) ? 'AND a.forum_id = ' . (int) $forum_id : 'AND ' . $db->sql_in_set('a.forum_id', array_map('intval', $forum_id))) : '';
|
|
||||||
|
|
||||||
$sql_opts = $sql_opts_select = $sql_opts_from = '';
|
$sql_opts = $sql_opts_select = $sql_opts_from = '';
|
||||||
$hold_ary = array();
|
$hold_ary = array();
|
||||||
|
@ -594,14 +609,14 @@ class auth
|
||||||
|
|
||||||
foreach ($sql_ary as $sql)
|
foreach ($sql_ary as $sql)
|
||||||
{
|
{
|
||||||
$result = $db->sql_query($sql);
|
$result = phpbb::$db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$option = ($sql_opts_select) ? $row['auth_option'] : $this->acl_options['option'][$row['auth_option_id']];
|
$option = ($sql_opts_select) ? $row['auth_option'] : $this->acl_options['option'][$row['auth_option_id']];
|
||||||
$hold_ary[$row['user_id']][$row['forum_id']][$option] = $row['auth_setting'];
|
$hold_ary[$row['user_id']][$row['forum_id']][$option] = $row['auth_setting'];
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
phpbb::$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_ary = array();
|
$sql_ary = array();
|
||||||
|
@ -630,9 +645,9 @@ class auth
|
||||||
|
|
||||||
foreach ($sql_ary as $sql)
|
foreach ($sql_ary as $sql)
|
||||||
{
|
{
|
||||||
$result = $db->sql_query($sql);
|
$result = phpbb::$db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$option = ($sql_opts_select) ? $row['auth_option'] : $this->acl_options['option'][$row['auth_option_id']];
|
$option = ($sql_opts_select) ? $row['auth_option'] : $this->acl_options['option'][$row['auth_option_id']];
|
||||||
|
|
||||||
|
@ -641,7 +656,7 @@ class auth
|
||||||
{
|
{
|
||||||
$hold_ary[$row['user_id']][$row['forum_id']][$option] = $row['auth_setting'];
|
$hold_ary[$row['user_id']][$row['forum_id']][$option] = $row['auth_setting'];
|
||||||
|
|
||||||
// If we detect ACL_NEVER, we will unset the flag option (within building the bitstring it is correctly set again)
|
// If we detect phpbb::ACL_NEVER, we will unset the flag option (within building the bitstring it is correctly set again)
|
||||||
if ($row['auth_setting'] == phpbb::ACL_NEVER)
|
if ($row['auth_setting'] == phpbb::ACL_NEVER)
|
||||||
{
|
{
|
||||||
$flag = substr($option, 0, strpos($option, '_') + 1);
|
$flag = substr($option, 0, strpos($option, '_') + 1);
|
||||||
|
@ -659,7 +674,7 @@ class auth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
phpbb::$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $hold_ary;
|
return $hold_ary;
|
||||||
|
@ -668,12 +683,10 @@ class auth
|
||||||
/**
|
/**
|
||||||
* Get raw user based permission settings
|
* Get raw user based permission settings
|
||||||
*/
|
*/
|
||||||
public function acl_user_raw_data($user_id = false, $opts = false, $forum_id = false)
|
public function user($user_id = false, $opts = false, $forum_id = false)
|
||||||
{
|
{
|
||||||
global $db;
|
$sql_user = ($user_id !== false) ? ((!is_array($user_id)) ? 'user_id = ' . (int) $user_id : phpbb::$db->sql_in_set('user_id', array_map('intval', $user_id))) : '';
|
||||||
|
$sql_forum = ($forum_id !== false) ? ((!is_array($forum_id)) ? 'AND a.forum_id = ' . (int) $forum_id : 'AND ' . phpbb::$db->sql_in_set('a.forum_id', array_map('intval', $forum_id))) : '';
|
||||||
$sql_user = ($user_id !== false) ? ((!is_array($user_id)) ? 'user_id = ' . (int) $user_id : $db->sql_in_set('user_id', array_map('intval', $user_id))) : '';
|
|
||||||
$sql_forum = ($forum_id !== false) ? ((!is_array($forum_id)) ? 'AND a.forum_id = ' . (int) $forum_id : 'AND ' . $db->sql_in_set('a.forum_id', array_map('intval', $forum_id))) : '';
|
|
||||||
|
|
||||||
$sql_opts = '';
|
$sql_opts = '';
|
||||||
$hold_ary = $sql_ary = array();
|
$hold_ary = $sql_ary = array();
|
||||||
|
@ -705,13 +718,13 @@ class auth
|
||||||
|
|
||||||
foreach ($sql_ary as $sql)
|
foreach ($sql_ary as $sql)
|
||||||
{
|
{
|
||||||
$result = $db->sql_query($sql);
|
$result = phpbb::$db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']] = $row['auth_setting'];
|
$hold_ary[$row['user_id']][$row['forum_id']][$row['auth_option']] = $row['auth_setting'];
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
phpbb::$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $hold_ary;
|
return $hold_ary;
|
||||||
|
@ -720,12 +733,10 @@ class auth
|
||||||
/**
|
/**
|
||||||
* Get raw group based permission settings
|
* Get raw group based permission settings
|
||||||
*/
|
*/
|
||||||
public function acl_group_raw_data($group_id = false, $opts = false, $forum_id = false)
|
public function group($group_id = false, $opts = false, $forum_id = false)
|
||||||
{
|
{
|
||||||
global $db;
|
$sql_group = ($group_id !== false) ? ((!is_array($group_id)) ? 'group_id = ' . (int) $group_id : phpbb::$db->sql_in_set('group_id', array_map('intval', $group_id))) : '';
|
||||||
|
$sql_forum = ($forum_id !== false) ? ((!is_array($forum_id)) ? 'AND a.forum_id = ' . (int) $forum_id : 'AND ' . phpbb::$db->sql_in_set('a.forum_id', array_map('intval', $forum_id))) : '';
|
||||||
$sql_group = ($group_id !== false) ? ((!is_array($group_id)) ? 'group_id = ' . (int) $group_id : $db->sql_in_set('group_id', array_map('intval', $group_id))) : '';
|
|
||||||
$sql_forum = ($forum_id !== false) ? ((!is_array($forum_id)) ? 'AND a.forum_id = ' . (int) $forum_id : 'AND ' . $db->sql_in_set('a.forum_id', array_map('intval', $forum_id))) : '';
|
|
||||||
|
|
||||||
$sql_opts = '';
|
$sql_opts = '';
|
||||||
$hold_ary = $sql_ary = array();
|
$hold_ary = $sql_ary = array();
|
||||||
|
@ -757,13 +768,13 @@ class auth
|
||||||
|
|
||||||
foreach ($sql_ary as $sql)
|
foreach ($sql_ary as $sql)
|
||||||
{
|
{
|
||||||
$result = $db->sql_query($sql);
|
$result = phpbb::$db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$hold_ary[$row['group_id']][$row['forum_id']][$row['auth_option']] = $row['auth_setting'];
|
$hold_ary[$row['group_id']][$row['forum_id']][$row['auth_option']] = $row['auth_setting'];
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
phpbb::$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $hold_ary;
|
return $hold_ary;
|
||||||
|
@ -771,14 +782,12 @@ class auth
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get raw acl data based on user for caching user_permissions
|
* Get raw acl data based on user for caching user_permissions
|
||||||
* This function returns the same data as acl_raw_data(), but without the user id as the first key within the array.
|
* This function returns the same data as data(), but without the user id as the first key within the array.
|
||||||
*/
|
*/
|
||||||
public function acl_raw_data_single_user($user_id)
|
public function single_user($user_id)
|
||||||
{
|
{
|
||||||
global $db, $cache;
|
|
||||||
|
|
||||||
// Check if the role-cache is there
|
// Check if the role-cache is there
|
||||||
if (($this->role_cache = $cache->get('_role_cache')) === false)
|
if (($this->role_cache = phpbb::$acm->get('role_cache')) === false)
|
||||||
{
|
{
|
||||||
$this->role_cache = array();
|
$this->role_cache = array();
|
||||||
|
|
||||||
|
@ -786,20 +795,20 @@ class auth
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT *
|
||||||
FROM ' . ACL_ROLES_DATA_TABLE . '
|
FROM ' . ACL_ROLES_DATA_TABLE . '
|
||||||
ORDER BY role_id ASC';
|
ORDER BY role_id ASC';
|
||||||
$result = $db->sql_query($sql);
|
$result = phpbb::$db->sql_query($sql);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = phpbb::$db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$this->role_cache[$row['role_id']][$row['auth_option_id']] = (int) $row['auth_setting'];
|
$this->role_cache[$row['role_id']][$row['auth_option_id']] = (int) $row['auth_setting'];
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
phpbb::$db->sql_freeresult($result);
|
||||||
|
|
||||||
foreach ($this->role_cache as $role_id => $role_options)
|
foreach ($this->role_cache as $role_id => $role_options)
|
||||||
{
|
{
|
||||||
$this->role_cache[$role_id] = serialize($role_options);
|
$this->role_cache[$role_id] = serialize($role_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->put('_role_cache', $this->role_cache);
|
phpbb::$acm->put('role_cache', $this->role_cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
$hold_ary = array();
|
$hold_ary = array();
|
||||||
|
@ -808,9 +817,9 @@ class auth
|
||||||
$sql = 'SELECT forum_id, auth_option_id, auth_role_id, auth_setting
|
$sql = 'SELECT forum_id, auth_option_id, auth_role_id, auth_setting
|
||||||
FROM ' . ACL_USERS_TABLE . '
|
FROM ' . ACL_USERS_TABLE . '
|
||||||
WHERE user_id = ' . $user_id;
|
WHERE user_id = ' . $user_id;
|
||||||
$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 a role is assigned, assign all options included within this role. Else, only set this one option.
|
// If a role is assigned, assign all options included within this role. Else, only set this one option.
|
||||||
if ($row['auth_role_id'])
|
if ($row['auth_role_id'])
|
||||||
|
@ -822,7 +831,7 @@ class auth
|
||||||
$hold_ary[$row['forum_id']][$row['auth_option_id']] = $row['auth_setting'];
|
$hold_ary[$row['forum_id']][$row['auth_option_id']] = $row['auth_setting'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
phpbb::$db->sql_freeresult($result);
|
||||||
|
|
||||||
// Now grab group-specific permission settings
|
// Now grab group-specific permission settings
|
||||||
$sql = 'SELECT a.forum_id, a.auth_option_id, a.auth_role_id, a.auth_setting
|
$sql = 'SELECT a.forum_id, a.auth_option_id, a.auth_role_id, a.auth_setting
|
||||||
|
@ -830,9 +839,9 @@ class auth
|
||||||
WHERE a.group_id = ug.group_id
|
WHERE a.group_id = ug.group_id
|
||||||
AND ug.user_pending = 0
|
AND ug.user_pending = 0
|
||||||
AND ug.user_id = ' . $user_id;
|
AND ug.user_id = ' . $user_id;
|
||||||
$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['auth_role_id'])
|
if (!$row['auth_role_id'])
|
||||||
{
|
{
|
||||||
|
@ -846,7 +855,7 @@ class auth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
phpbb::$db->sql_freeresult($result);
|
||||||
|
|
||||||
return $hold_ary;
|
return $hold_ary;
|
||||||
}
|
}
|
||||||
|
@ -860,7 +869,7 @@ class auth
|
||||||
{
|
{
|
||||||
$hold_ary[$option_id] = $setting;
|
$hold_ary[$option_id] = $setting;
|
||||||
|
|
||||||
// If we detect ACL_NEVER, we will unset the flag option (within building the bitstring it is correctly set again)
|
// If we detect phpbb::ACL_NEVER, we will unset the flag option (within building the bitstring it is correctly set again)
|
||||||
if ($setting == phpbb::ACL_NEVER)
|
if ($setting == phpbb::ACL_NEVER)
|
||||||
{
|
{
|
||||||
$flag = substr($this->acl_options['option'][$option_id], 0, strpos($this->acl_options['option'][$option_id], '_') + 1);
|
$flag = substr($this->acl_options['option'][$option_id], 0, strpos($this->acl_options['option'][$option_id], '_') + 1);
|
||||||
|
@ -880,124 +889,20 @@ class auth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Authentication plug-ins is largely down to Sergey Kanareykin, our thanks to him.
|
|
||||||
*/
|
|
||||||
public function login($username, $password, $autologin = false, $viewonline = 1, $admin = 0)
|
|
||||||
{
|
|
||||||
global $config, $db, $user;
|
|
||||||
|
|
||||||
$method = trim(basename($config['auth_method']));
|
|
||||||
include_once(PHPBB_ROOT_PATH . 'includes/auth/auth_' . $method . '.' . PHP_EXT);
|
|
||||||
|
|
||||||
$method = 'login_' . $method;
|
|
||||||
if (function_exists($method))
|
|
||||||
{
|
|
||||||
$login = $method($username, $password);
|
|
||||||
|
|
||||||
// If the auth module wants us to create an empty profile do so and then treat the status as LOGIN_SUCCESS
|
|
||||||
if ($login['status'] == LOGIN_SUCCESS_CREATE_PROFILE)
|
|
||||||
{
|
|
||||||
// we are going to use the user_add function so include functions_user.php if it wasn't defined yet
|
|
||||||
if (!function_exists('user_add'))
|
|
||||||
{
|
|
||||||
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
|
|
||||||
}
|
|
||||||
|
|
||||||
user_add($login['user_row'], (isset($login['cp_data'])) ? $login['cp_data'] : false);
|
|
||||||
|
|
||||||
$sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type
|
|
||||||
FROM ' . USERS_TABLE . "
|
|
||||||
WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
$row = $db->sql_fetchrow($result);
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
if (!$row)
|
|
||||||
{
|
|
||||||
return array(
|
|
||||||
'status' => LOGIN_ERROR_EXTERNAL_AUTH,
|
|
||||||
'error_msg' => 'AUTH_NO_PROFILE_CREATED',
|
|
||||||
'user_row' => array('user_id' => ANONYMOUS),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$login = array(
|
|
||||||
'status' => LOGIN_SUCCESS,
|
|
||||||
'error_msg' => false,
|
|
||||||
'user_row' => $row,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If login succeeded, we will log the user in... else we pass the login array through...
|
|
||||||
if ($login['status'] == LOGIN_SUCCESS)
|
|
||||||
{
|
|
||||||
$old_session_id = $user->session_id;
|
|
||||||
|
|
||||||
if ($admin)
|
|
||||||
{
|
|
||||||
global $SID, $_SID;
|
|
||||||
|
|
||||||
$cookie_expire = time() - 31536000;
|
|
||||||
$user->set_cookie('u', '', $cookie_expire);
|
|
||||||
$user->set_cookie('sid', '', $cookie_expire);
|
|
||||||
unset($cookie_expire);
|
|
||||||
|
|
||||||
$SID = '?sid=';
|
|
||||||
$user->session_id = $_SID = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = $user->session_create($login['user_row']['user_id'], $admin, $autologin, $viewonline);
|
|
||||||
|
|
||||||
// Successful session creation
|
|
||||||
if ($result === true)
|
|
||||||
{
|
|
||||||
// If admin re-authentication we remove the old session entry because a new one has been created...
|
|
||||||
if ($admin)
|
|
||||||
{
|
|
||||||
// the login array is used because the user ids do not differ for re-authentication
|
|
||||||
$sql = 'DELETE FROM ' . SESSIONS_TABLE . "
|
|
||||||
WHERE session_id = '" . $db->sql_escape($old_session_id) . "'
|
|
||||||
AND session_user_id = {$login['user_row']['user_id']}";
|
|
||||||
$db->sql_query($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'status' => LOGIN_SUCCESS,
|
|
||||||
'error_msg' => false,
|
|
||||||
'user_row' => $login['user_row'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return array(
|
|
||||||
'status' => LOGIN_BREAK,
|
|
||||||
'error_msg' => $result,
|
|
||||||
'user_row' => $login['user_row'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $login;
|
|
||||||
}
|
|
||||||
|
|
||||||
trigger_error('Authentication method not found', E_USER_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill auth_option statement for later querying based on the supplied options
|
* Fill auth_option statement for later querying based on the supplied options
|
||||||
*/
|
*/
|
||||||
private function build_auth_option_statement($key, $auth_options, &$sql_opts)
|
private function build_auth_option_statement($key, $auth_options, &$sql_opts)
|
||||||
{
|
{
|
||||||
global $db;
|
|
||||||
|
|
||||||
if (!is_array($auth_options))
|
if (!is_array($auth_options))
|
||||||
{
|
{
|
||||||
if (strpos($auth_options, '%') !== false)
|
if (strpos($auth_options, '%') !== false)
|
||||||
{
|
{
|
||||||
$sql_opts = "AND $key " . $db->sql_like_expression(str_replace('%', $db->any_char, $auth_options));
|
$sql_opts = "AND $key " . phpbb::$db->sql_like_expression(str_replace('%', phpbb::$db->any_char, $auth_options));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql_opts = "AND $key = '" . $db->sql_escape($auth_options) . "'";
|
$sql_opts = "AND $key = '" . phpbb::$db->sql_escape($auth_options) . "'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1014,7 +919,7 @@ class auth
|
||||||
|
|
||||||
if (!$is_like_expression)
|
if (!$is_like_expression)
|
||||||
{
|
{
|
||||||
$sql_opts = 'AND ' . $db->sql_in_set($key, $auth_options);
|
$sql_opts = 'AND ' . phpbb::$db->sql_in_set($key, $auth_options);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1024,11 +929,11 @@ class auth
|
||||||
{
|
{
|
||||||
if (strpos($option, '%') !== false)
|
if (strpos($option, '%') !== false)
|
||||||
{
|
{
|
||||||
$sql[] = $key . ' ' . $db->sql_like_expression(str_replace('%', $db->any_char, $option));
|
$sql[] = $key . ' ' . phpbb::$db->sql_like_expression(str_replace('%', phpbb::$db->any_char, $option));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql[] = $key . " = '" . $db->sql_escape($option) . "'";
|
$sql[] = $key . " = '" . phpbb::$db->sql_escape($option) . "'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,11 @@ if (!defined('IN_PHPBB'))
|
||||||
* Base Template class.
|
* Base Template class.
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class template
|
class phpbb_template
|
||||||
{
|
{
|
||||||
|
public $phpbb_required = array('user', 'config');
|
||||||
|
public $phpbb_optional = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* variable that holds all the data we'll be substituting into
|
* variable that holds all the data we'll be substituting into
|
||||||
* the compiled templates. Takes form:
|
* the compiled templates. Takes form:
|
||||||
|
@ -63,16 +66,14 @@ class template
|
||||||
*/
|
*/
|
||||||
public function set_template()
|
public function set_template()
|
||||||
{
|
{
|
||||||
global $user;
|
if (file_exists(PHPBB_ROOT_PATH . 'styles/' . phpbb::$user->theme['template_path'] . '/template'))
|
||||||
|
|
||||||
if (file_exists(PHPBB_ROOT_PATH . 'styles/' . $user->theme['template_path'] . '/template'))
|
|
||||||
{
|
{
|
||||||
$this->root = PHPBB_ROOT_PATH . 'styles/' . $user->theme['template_path'] . '/template';
|
$this->root = PHPBB_ROOT_PATH . 'styles/' . phpbb::$user->theme['template_path'] . '/template';
|
||||||
$this->cachepath = PHPBB_ROOT_PATH . 'cache/tpl_' . $user->theme['template_path'] . '_';
|
$this->cachepath = PHPBB_ROOT_PATH . 'cache/tpl_' . phpbb::$user->theme['template_path'] . '_';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR);
|
trigger_error('Template path could not be found: styles/' . phpbb::$user->theme['template_path'] . '/template', E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_rootref = &$this->_tpldata['.'][0];
|
$this->_rootref = &$this->_tpldata['.'][0];
|
||||||
|
@ -158,8 +159,7 @@ class template
|
||||||
*/
|
*/
|
||||||
public function display($handle, $include_once = true)
|
public function display($handle, $include_once = true)
|
||||||
{
|
{
|
||||||
global $user, $phpbb_hook;
|
/*
|
||||||
|
|
||||||
if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $include_once))
|
if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $include_once))
|
||||||
{
|
{
|
||||||
if ($phpbb_hook->hook_return(array(__CLASS__, __FUNCTION__)))
|
if ($phpbb_hook->hook_return(array(__CLASS__, __FUNCTION__)))
|
||||||
|
@ -167,7 +167,7 @@ class template
|
||||||
return $phpbb_hook->hook_return_result(array(__CLASS__, __FUNCTION__));
|
return $phpbb_hook->hook_return_result(array(__CLASS__, __FUNCTION__));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/* if (defined('IN_ERROR_HANDLER'))
|
/* if (defined('IN_ERROR_HANDLER'))
|
||||||
{
|
{
|
||||||
if ((E_NOTICE & error_reporting()) == E_NOTICE)
|
if ((E_NOTICE & error_reporting()) == E_NOTICE)
|
||||||
|
@ -178,7 +178,7 @@ class template
|
||||||
|
|
||||||
$_tpldata = &$this->_tpldata;
|
$_tpldata = &$this->_tpldata;
|
||||||
$_rootref = &$this->_rootref;
|
$_rootref = &$this->_rootref;
|
||||||
$_lang = &$user->lang;
|
$_lang = &phpbb::$user->lang;
|
||||||
|
|
||||||
// These _are_ used the included files.
|
// These _are_ used the included files.
|
||||||
$_tpldata; $_rootref; $_lang;
|
$_tpldata; $_rootref; $_lang;
|
||||||
|
@ -235,21 +235,19 @@ class template
|
||||||
*/
|
*/
|
||||||
private function _tpl_load($handle)
|
private function _tpl_load($handle)
|
||||||
{
|
{
|
||||||
global $config;
|
|
||||||
|
|
||||||
$filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . '.' . PHP_EXT;
|
$filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . '.' . PHP_EXT;
|
||||||
|
|
||||||
$recompile = (!file_exists($filename) || @filesize($filename) === 0 || ($config['load_tplcompile'] && @filemtime($filename) < filemtime($this->files[$handle]))) ? true : false;
|
$recompile = (!file_exists($filename) || @filesize($filename) === 0 || (phpbb::$config['load_tplcompile'] && @filemtime($filename) < filemtime($this->files[$handle]))) ? true : false;
|
||||||
|
|
||||||
|
if (defined('DEBUG_EXTRA'))
|
||||||
|
{
|
||||||
|
$recompile = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Recompile page if the original template is newer, otherwise load the compiled version
|
// Recompile page if the original template is newer, otherwise load the compiled version
|
||||||
if ($recompile)
|
if ($recompile)
|
||||||
{
|
{
|
||||||
if (!class_exists('template_compile'))
|
$compile = new phpbb_template_compile($this);
|
||||||
{
|
|
||||||
include(PHPBB_ROOT_PATH . 'includes/functions_template.' . PHP_EXT);
|
|
||||||
}
|
|
||||||
|
|
||||||
$compile = new template_compile($this);
|
|
||||||
|
|
||||||
// If we don't have a file assigned to this handle, die.
|
// If we don't have a file assigned to this handle, die.
|
||||||
if (!isset($this->files[$handle]))
|
if (!isset($this->files[$handle]))
|
||||||
|
@ -275,12 +273,7 @@ class template
|
||||||
*/
|
*/
|
||||||
private function _tpl_eval($handle)
|
private function _tpl_eval($handle)
|
||||||
{
|
{
|
||||||
if (!class_exists('template_compile'))
|
$compile = new phpbb_template_compile($this);
|
||||||
{
|
|
||||||
include(PHPBB_ROOT_PATH . 'includes/functions_template.' . PHP_EXT);
|
|
||||||
}
|
|
||||||
|
|
||||||
$compile = new template_compile($this);
|
|
||||||
|
|
||||||
// If we don't have a file assigned to this handle, die.
|
// If we don't have a file assigned to this handle, die.
|
||||||
if (!isset($this->files[$handle]))
|
if (!isset($this->files[$handle]))
|
||||||
|
@ -500,11 +493,9 @@ class template
|
||||||
|
|
||||||
if ($include)
|
if ($include)
|
||||||
{
|
{
|
||||||
global $user;
|
|
||||||
|
|
||||||
$_tpldata = &$this->_tpldata;
|
$_tpldata = &$this->_tpldata;
|
||||||
$_rootref = &$this->_rootref;
|
$_rootref = &$this->_rootref;
|
||||||
$_lang = &$user->lang;
|
$_lang = &phpbb::$user->lang;
|
||||||
|
|
||||||
// These _are_ used the included files.
|
// These _are_ used the included files.
|
||||||
$_tpldata; $_rootref; $_lang;
|
$_tpldata; $_rootref; $_lang;
|
||||||
|
@ -516,12 +507,7 @@ class template
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!class_exists('template_compile'))
|
$compile = new phpbb_template_compile($this);
|
||||||
{
|
|
||||||
include(PHPBB_ROOT_PATH . 'includes/functions_template.' . PHP_EXT);
|
|
||||||
}
|
|
||||||
|
|
||||||
$compile = new template_compile($this);
|
|
||||||
|
|
||||||
if (($code = $compile->_tpl_gen_src($handle)) !== false)
|
if (($code = $compile->_tpl_gen_src($handle)) !== false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class template_filter extends php_user_filter
|
class phpbb_template_filter extends php_user_filter
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var string Replaceable tokens regex
|
* @var string Replaceable tokens regex
|
||||||
|
@ -93,8 +93,6 @@ class template_filter extends php_user_filter
|
||||||
|
|
||||||
private function replace($matches)
|
private function replace($matches)
|
||||||
{
|
{
|
||||||
global $config;
|
|
||||||
|
|
||||||
if (isset($matches[3]))
|
if (isset($matches[3]))
|
||||||
{
|
{
|
||||||
return $this->compile_var_tags($matches[0]);
|
return $this->compile_var_tags($matches[0]);
|
||||||
|
@ -146,15 +144,15 @@ class template_filter extends php_user_filter
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'INCLUDEPHP':
|
case 'INCLUDEPHP':
|
||||||
return ($config['tpl_allow_php']) ? '<?php ' . $this->compile_tag_include_php($matches[2]) . ' ?>' : '';
|
return (phpbb::$config['tpl_allow_php']) ? '<?php ' . $this->compile_tag_include_php($matches[2]) . ' ?>' : '';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'PHP':
|
case 'PHP':
|
||||||
return ($config['tpl_allow_php']) ? '<?php ' : '<!-- ';
|
return (phpbb::$config['tpl_allow_php']) ? '<?php ' : '<!-- ';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'ENDPHP':
|
case 'ENDPHP':
|
||||||
return ($config['tpl_allow_php']) ? ' ?>' : ' -->';
|
return (phpbb::$config['tpl_allow_php']) ? ' ?>' : ' -->';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -437,7 +435,7 @@ class template_filter extends php_user_filter
|
||||||
$namespace = substr($varrefs[1], 0, -1);
|
$namespace = substr($varrefs[1], 0, -1);
|
||||||
$namespace = (strpos($namespace, '.') === false) ? $namespace : strrchr($namespace, '.');
|
$namespace = (strpos($namespace, '.') === false) ? $namespace : strrchr($namespace, '.');
|
||||||
|
|
||||||
// S_ROW_COUNT is deceptive, it returns the current row number not the number of rows
|
// S_ROW_COUNT is deceptive, it returns the current row number now the number of rows
|
||||||
// hence S_ROW_COUNT is deprecated in favour of S_ROW_NUM
|
// hence S_ROW_COUNT is deprecated in favour of S_ROW_NUM
|
||||||
switch ($varrefs[3])
|
switch ($varrefs[3])
|
||||||
{
|
{
|
||||||
|
@ -643,7 +641,7 @@ class template_filter extends php_user_filter
|
||||||
|
|
||||||
$expr = true;
|
$expr = true;
|
||||||
|
|
||||||
// S_ROW_COUNT is deceptive, it returns the current row number not the number of rows
|
// S_ROW_COUNT is deceptive, it returns the current row number now the number of rows
|
||||||
// hence S_ROW_COUNT is deprecated in favour of S_ROW_NUM
|
// hence S_ROW_COUNT is deprecated in favour of S_ROW_NUM
|
||||||
switch ($varname)
|
switch ($varname)
|
||||||
{
|
{
|
||||||
|
@ -731,7 +729,7 @@ class template_filter extends php_user_filter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stream_filter_register('template', 'template_filter');
|
stream_filter_register('phpbb_template', 'phpbb_template_filter');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension of template class - Functions needed for compiling templates only.
|
* Extension of template class - Functions needed for compiling templates only.
|
||||||
|
@ -753,7 +751,7 @@ stream_filter_register('template', 'template_filter');
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
* @uses template_filter As a PHP stream filter to perform compilation of templates
|
* @uses template_filter As a PHP stream filter to perform compilation of templates
|
||||||
*/
|
*/
|
||||||
class template_compile
|
class phpbb_template_compile
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var template Reference to the {@link template template} object performing compilation
|
* @var template Reference to the {@link template template} object performing compilation
|
||||||
|
@ -764,7 +762,7 @@ class template_compile
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param template $template {@link template Template} object performing compilation
|
* @param template $template {@link template Template} object performing compilation
|
||||||
*/
|
*/
|
||||||
function __construct(template $template)
|
function __construct(phpbb_template $template)
|
||||||
{
|
{
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
}
|
}
|
||||||
|
@ -826,7 +824,7 @@ class template_compile
|
||||||
|
|
||||||
@flock($destination_handle, LOCK_EX);
|
@flock($destination_handle, LOCK_EX);
|
||||||
|
|
||||||
stream_filter_append($source_handle, 'template');
|
stream_filter_append($source_handle, 'phpbb_template');
|
||||||
stream_copy_to_stream($source_handle, $destination_handle);
|
stream_copy_to_stream($source_handle, $destination_handle);
|
||||||
|
|
||||||
@fclose($source_handle);
|
@fclose($source_handle);
|
||||||
|
@ -856,7 +854,7 @@ class template_compile
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream_filter_append($source_handle, 'template');
|
stream_filter_append($source_handle, 'phpbb_template');
|
||||||
stream_copy_to_stream($source_handle, $destination_handle);
|
stream_copy_to_stream($source_handle, $destination_handle);
|
||||||
|
|
||||||
@fclose($source_handle);
|
@fclose($source_handle);
|
||||||
|
|
|
@ -412,7 +412,7 @@ class phpbb_user extends phpbb_session
|
||||||
{
|
{
|
||||||
phpbb::$db->sql_multi_insert(STYLES_IMAGESET_DATA_TABLE, $sql_ary);
|
phpbb::$db->sql_multi_insert(STYLES_IMAGESET_DATA_TABLE, $sql_ary);
|
||||||
phpbb::$db->sql_transaction('commit');
|
phpbb::$db->sql_transaction('commit');
|
||||||
phpbb::$acm->destroy('sql', STYLES_IMAGESET_DATA_TABLE);
|
phpbb::$acm->destroy_sql(STYLES_IMAGESET_DATA_TABLE);
|
||||||
|
|
||||||
add_log('admin', 'LOG_IMAGESET_LANG_REFRESHED', $this->theme['imageset_name'], $this->img_lang);
|
add_log('admin', 'LOG_IMAGESET_LANG_REFRESHED', $this->theme['imageset_name'], $this->img_lang);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2118,10 +2118,10 @@ function remove_comments(&$output)
|
||||||
*/
|
*/
|
||||||
function cache_moderators()
|
function cache_moderators()
|
||||||
{
|
{
|
||||||
global $db, $cache, $auth;
|
global $db, $auth;
|
||||||
|
|
||||||
// Remove cached sql results
|
// Remove cached sql results
|
||||||
$cache->destroy('sql', MODERATOR_CACHE_TABLE);
|
phpbb::$acm->destroy_sql(MODERATOR_CACHE_TABLE);
|
||||||
|
|
||||||
// Clear table
|
// Clear table
|
||||||
if ($db->truncate)
|
if ($db->truncate)
|
||||||
|
|
|
@ -673,7 +673,7 @@ function censor_text($text)
|
||||||
// We moved the word censor checks in here because we call this function quite often - and then only need to do the check once
|
// We moved the word censor checks in here because we call this function quite often - and then only need to do the check once
|
||||||
if (!isset($censors) || !is_array($censors))
|
if (!isset($censors) || !is_array($censors))
|
||||||
{
|
{
|
||||||
global $config, $user, $auth, $cache;
|
global $config, $user, $auth;
|
||||||
|
|
||||||
// We check here if the user is having viewing censors disabled (and also allowed to do so).
|
// We check here if the user is having viewing censors disabled (and also allowed to do so).
|
||||||
if (!$user->optionget('viewcensors') && $config['allow_nocensors'] && $auth->acl_get('u_chgcensors'))
|
if (!$user->optionget('viewcensors') && $config['allow_nocensors'] && $auth->acl_get('u_chgcensors'))
|
||||||
|
@ -738,7 +738,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
global $template, $cache, $user;
|
global $template, $user;
|
||||||
global $extensions, $config;
|
global $extensions, $config;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1068,7 +1068,6 @@ function extension_allowed($forum_id, $extension, &$extensions)
|
||||||
{
|
{
|
||||||
if (empty($extensions))
|
if (empty($extensions))
|
||||||
{
|
{
|
||||||
global $cache;
|
|
||||||
$extensions = phpbb_cache::obtain_extensions_forum($forum_id);
|
$extensions = phpbb_cache::obtain_extensions_forum($forum_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1155,7 +1155,6 @@ function get_user_rank($user_id, $user_rank, $user_posts, &$rank_title, &$rank_i
|
||||||
|
|
||||||
if (empty($ranks))
|
if (empty($ranks))
|
||||||
{
|
{
|
||||||
global $cache;
|
|
||||||
$ranks = phpbb_cache::obtain_ranks();
|
$ranks = phpbb_cache::obtain_ranks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,13 +78,13 @@ class p_master
|
||||||
*/
|
*/
|
||||||
function list_modules($p_class)
|
function list_modules($p_class)
|
||||||
{
|
{
|
||||||
global $auth, $db, $user, $cache, $config;
|
global $auth, $db, $user, $config;
|
||||||
|
|
||||||
// Sanitise for future path use, it's escaped as appropriate for queries
|
// Sanitise for future path use, it's escaped as appropriate for queries
|
||||||
$this->p_class = str_replace(array('.', '/', '\\'), '', basename($p_class));
|
$this->p_class = str_replace(array('.', '/', '\\'), '', basename($p_class));
|
||||||
|
|
||||||
// Get cached modules
|
// Get cached modules
|
||||||
if (($this->module_cache = $cache->get('_modules_' . $this->p_class)) === false)
|
if (($this->module_cache = phpbb::$acm->get('modules_' . $this->p_class)) === false)
|
||||||
{
|
{
|
||||||
// Get modules
|
// Get modules
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT *
|
||||||
|
@ -108,7 +108,7 @@ class p_master
|
||||||
}
|
}
|
||||||
unset($rows);
|
unset($rows);
|
||||||
|
|
||||||
$cache->put('_modules_' . $this->p_class, $this->module_cache);
|
phpbb::$acm->put('modules_' . $this->p_class, $this->module_cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->module_cache))
|
if (empty($this->module_cache))
|
||||||
|
|
|
@ -245,7 +245,7 @@ function update_post_information($type, $ids, $return_update_sql = false)
|
||||||
*/
|
*/
|
||||||
function posting_gen_topic_icons($mode, $icon_id)
|
function posting_gen_topic_icons($mode, $icon_id)
|
||||||
{
|
{
|
||||||
global $config, $template, $cache;
|
global $config, $template;
|
||||||
|
|
||||||
// Grab icons
|
// Grab icons
|
||||||
$icons = phpbb_cache::obtain_icons();
|
$icons = phpbb_cache::obtain_icons();
|
||||||
|
@ -347,7 +347,7 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL)
|
||||||
*/
|
*/
|
||||||
function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false)
|
function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false)
|
||||||
{
|
{
|
||||||
global $auth, $user, $config, $db, $cache;
|
global $auth, $user, $config, $db;
|
||||||
|
|
||||||
$filedata = array(
|
$filedata = array(
|
||||||
'error' => array()
|
'error' => array()
|
||||||
|
@ -932,7 +932,7 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0)
|
||||||
*/
|
*/
|
||||||
function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id = 0, $show_quote_button = true)
|
function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id = 0, $show_quote_button = true)
|
||||||
{
|
{
|
||||||
global $user, $auth, $db, $template, $bbcode, $cache, $config;
|
global $user, $auth, $db, $template, $bbcode, $config;
|
||||||
|
|
||||||
// Go ahead and pull all data for this topic
|
// Go ahead and pull all data for this topic
|
||||||
$sql = 'SELECT p.post_id
|
$sql = 'SELECT p.post_id
|
||||||
|
|
|
@ -113,7 +113,7 @@ function update_last_username()
|
||||||
*/
|
*/
|
||||||
function user_update_name($old_name, $new_name)
|
function user_update_name($old_name, $new_name)
|
||||||
{
|
{
|
||||||
global $config, $db, $cache;
|
global $config, $db;
|
||||||
|
|
||||||
$update_ary = array(
|
$update_ary = array(
|
||||||
FORUMS_TABLE => array('forum_last_poster_name'),
|
FORUMS_TABLE => array('forum_last_poster_name'),
|
||||||
|
@ -139,7 +139,7 @@ function user_update_name($old_name, $new_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Because some tables/caches use username-specific data we need to purge this here.
|
// Because some tables/caches use username-specific data we need to purge this here.
|
||||||
$cache->destroy('sql', MODERATOR_CACHE_TABLE);
|
phpbb::$acm->destroy_sql(MODERATOR_CACHE_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -300,7 +300,7 @@ function user_add($user_row, $cp_data = false)
|
||||||
*/
|
*/
|
||||||
function user_delete($mode, $user_id, $post_username = false)
|
function user_delete($mode, $user_id, $post_username = false)
|
||||||
{
|
{
|
||||||
global $cache, $config, $db, $user, $auth;
|
global $config, $db, $user, $auth;
|
||||||
|
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT *
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
|
@ -498,7 +498,7 @@ function user_delete($mode, $user_id, $post_username = false)
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->destroy('sql', MODERATOR_CACHE_TABLE);
|
phpbb::$acm->destroy_sql(MODERATOR_CACHE_TABLE);
|
||||||
|
|
||||||
// Remove any undelivered mails...
|
// Remove any undelivered mails...
|
||||||
$sql = 'SELECT msg_id, user_id
|
$sql = 'SELECT msg_id, user_id
|
||||||
|
@ -674,7 +674,7 @@ function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL)
|
||||||
*/
|
*/
|
||||||
function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason = '')
|
function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason = '')
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $cache;
|
global $db, $user, $auth;
|
||||||
|
|
||||||
// Delete stale bans
|
// Delete stale bans
|
||||||
$sql = 'DELETE FROM ' . BANLIST_TABLE . '
|
$sql = 'DELETE FROM ' . BANLIST_TABLE . '
|
||||||
|
@ -1053,13 +1053,13 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
|
||||||
add_log('admin', $log_entry . strtoupper($mode), $ban_reason, $ban_list_log);
|
add_log('admin', $log_entry . strtoupper($mode), $ban_reason, $ban_list_log);
|
||||||
add_log('mod', 0, 0, $log_entry . strtoupper($mode), $ban_reason, $ban_list_log);
|
add_log('mod', 0, 0, $log_entry . strtoupper($mode), $ban_reason, $ban_list_log);
|
||||||
|
|
||||||
$cache->destroy('sql', BANLIST_TABLE);
|
phpbb::$acm->destroy_sql(BANLIST_TABLE);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// There was nothing to ban/exclude. But destroying the cache because of the removal of stale bans.
|
// There was nothing to ban/exclude. But destroying the cache because of the removal of stale bans.
|
||||||
$cache->destroy('sql', BANLIST_TABLE);
|
phpbb::$acm->destroy_sql(BANLIST_TABLE);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1069,7 +1069,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
|
||||||
*/
|
*/
|
||||||
function user_unban($mode, $ban)
|
function user_unban($mode, $ban)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $cache;
|
global $db, $user, $auth;
|
||||||
|
|
||||||
// Delete stale bans
|
// Delete stale bans
|
||||||
$sql = 'DELETE FROM ' . BANLIST_TABLE . '
|
$sql = 'DELETE FROM ' . BANLIST_TABLE . '
|
||||||
|
@ -1126,7 +1126,7 @@ function user_unban($mode, $ban)
|
||||||
add_log('mod', 0, 0, 'LOG_UNBAN_' . strtoupper($mode), $l_unban_list);
|
add_log('mod', 0, 0, 'LOG_UNBAN_' . strtoupper($mode), $l_unban_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->destroy('sql', BANLIST_TABLE);
|
phpbb::$acm->destroy_sql(BANLIST_TABLE);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1344,7 +1344,7 @@ function validate_match($string, $optional = false, $match = '')
|
||||||
*/
|
*/
|
||||||
function validate_username($username, $allowed_username = false)
|
function validate_username($username, $allowed_username = false)
|
||||||
{
|
{
|
||||||
global $config, $db, $user, $cache;
|
global $config, $db, $user;
|
||||||
|
|
||||||
$clean_username = utf8_clean_string($username);
|
$clean_username = utf8_clean_string($username);
|
||||||
$allowed_username = ($allowed_username === false) ? $user->data['username_clean'] : utf8_clean_string($allowed_username);
|
$allowed_username = ($allowed_username === false) ? $user->data['username_clean'] : utf8_clean_string($allowed_username);
|
||||||
|
@ -1947,7 +1947,7 @@ function get_avatar_filename($avatar_entry)
|
||||||
*/
|
*/
|
||||||
function avatar_gallery($category, $avatar_select, $items_per_column, $block_var = 'avatar_row')
|
function avatar_gallery($category, $avatar_select, $items_per_column, $block_var = 'avatar_row')
|
||||||
{
|
{
|
||||||
global $user, $cache, $template, $config;
|
global $user, $template, $config;
|
||||||
|
|
||||||
$avatar_list = array();
|
$avatar_list = array();
|
||||||
|
|
||||||
|
|
|
@ -94,9 +94,7 @@ class search_backend
|
||||||
*/
|
*/
|
||||||
protected function obtain_ids($search_key, &$result_count, &$id_ary, $start, $per_page, $sort_dir)
|
protected function obtain_ids($search_key, &$result_count, &$id_ary, $start, $per_page, $sort_dir)
|
||||||
{
|
{
|
||||||
global $cache;
|
if (!($stored_ids = phpbb::$acm->get('search_results_' . $search_key)))
|
||||||
|
|
||||||
if (!($stored_ids = $cache->get('_search_results_' . $search_key)))
|
|
||||||
{
|
{
|
||||||
// no search results cached for this search_key
|
// no search results cached for this search_key
|
||||||
return self::SEARCH_RESULT_NOT_IN_CACHE;
|
return self::SEARCH_RESULT_NOT_IN_CACHE;
|
||||||
|
@ -154,7 +152,7 @@ class search_backend
|
||||||
*/
|
*/
|
||||||
protected function save_ids($search_key, $keywords, $author_ary, $result_count, &$id_ary, $start, $sort_dir)
|
protected function save_ids($search_key, $keywords, $author_ary, $result_count, &$id_ary, $start, $sort_dir)
|
||||||
{
|
{
|
||||||
global $cache, $config, $db, $user;
|
global $config, $db, $user;
|
||||||
|
|
||||||
$length = min(sizeof($id_ary), $config['search_block_size']);
|
$length = min(sizeof($id_ary), $config['search_block_size']);
|
||||||
|
|
||||||
|
@ -168,7 +166,7 @@ class search_backend
|
||||||
|
|
||||||
// create a new resultset if there is none for this search_key yet
|
// create a new resultset if there is none for this search_key yet
|
||||||
// or add the ids to the existing resultset
|
// or add the ids to the existing resultset
|
||||||
if (!($store = $cache->get('_search_results_' . $search_key)))
|
if (!($store = phpbb::$acm->get('search_results_' . $search_key)))
|
||||||
{
|
{
|
||||||
// add the current keywords to the recent searches in the cache which are listed on the search page
|
// add the current keywords to the recent searches in the cache which are listed on the search page
|
||||||
if (!empty($keywords) || sizeof($author_ary))
|
if (!empty($keywords) || sizeof($author_ary))
|
||||||
|
@ -245,7 +243,7 @@ class search_backend
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$cache->put('_search_results_' . $search_key, $store, $config['search_store_results']);
|
phpbb::$acm->put('search_results_' . $search_key, $store, $config['search_store_results']);
|
||||||
|
|
||||||
$sql = 'UPDATE ' . SEARCH_RESULTS_TABLE . '
|
$sql = 'UPDATE ' . SEARCH_RESULTS_TABLE . '
|
||||||
SET search_time = ' . time() . '
|
SET search_time = ' . time() . '
|
||||||
|
@ -263,7 +261,7 @@ class search_backend
|
||||||
*/
|
*/
|
||||||
public function destroy_cache($words, $authors = false)
|
public function destroy_cache($words, $authors = false)
|
||||||
{
|
{
|
||||||
global $db, $cache, $config;
|
global $db, $config;
|
||||||
|
|
||||||
// clear all searches that searched for the specified words
|
// clear all searches that searched for the specified words
|
||||||
if (sizeof($words))
|
if (sizeof($words))
|
||||||
|
@ -281,7 +279,7 @@ class search_backend
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$cache->destroy('_search_results_' . $row['search_key']);
|
phpbb::$acm->destroy('search_results_' . $row['search_key']);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
@ -302,7 +300,7 @@ class search_backend
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$cache->destroy('_search_results_' . $row['search_key']);
|
phpbb::$acm->destroy('search_results_' . $row['search_key']);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -543,7 +543,7 @@ function phpbb_copy_table_fields()
|
||||||
*/
|
*/
|
||||||
function phpbb_convert_authentication($mode)
|
function phpbb_convert_authentication($mode)
|
||||||
{
|
{
|
||||||
global $db, $src_db, $same_db, $convert, $user, $config, $cache;
|
global $db, $src_db, $same_db, $convert, $user, $config;
|
||||||
|
|
||||||
if ($mode == 'start')
|
if ($mode == 'start')
|
||||||
{
|
{
|
||||||
|
@ -1223,7 +1223,7 @@ function phpbb_replace_size($matches)
|
||||||
*/
|
*/
|
||||||
function phpbb_prepare_message($message)
|
function phpbb_prepare_message($message)
|
||||||
{
|
{
|
||||||
global $db, $convert, $user, $config, $cache, $convert_row, $message_parser;
|
global $db, $convert, $user, $config, $convert_row, $message_parser;
|
||||||
|
|
||||||
if (!$message)
|
if (!$message)
|
||||||
{
|
{
|
||||||
|
@ -1328,7 +1328,7 @@ function phpbb_get_files_dir()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
global $src_db, $same_db, $convert, $user, $config, $cache;
|
global $src_db, $same_db, $convert, $user, $config;
|
||||||
|
|
||||||
if ($convert->mysql_convert && $same_db)
|
if ($convert->mysql_convert && $same_db)
|
||||||
{
|
{
|
||||||
|
@ -1367,7 +1367,7 @@ function phpbb_get_files_dir()
|
||||||
*/
|
*/
|
||||||
function phpbb_copy_thumbnails()
|
function phpbb_copy_thumbnails()
|
||||||
{
|
{
|
||||||
global $db, $convert, $user, $config, $cache;
|
global $db, $convert, $user, $config;
|
||||||
|
|
||||||
$src_path = $convert->options['forum_path'] . '/' . phpbb_get_files_dir() . '/thumbs/';
|
$src_path = $convert->options['forum_path'] . '/' . phpbb_get_files_dir() . '/thumbs/';
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,6 @@ else
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = new user();
|
$user = new user();
|
||||||
$cache = new acm();
|
|
||||||
$db = new $sql_db();
|
$db = new $sql_db();
|
||||||
|
|
||||||
// Connect to DB
|
// Connect to DB
|
||||||
|
@ -652,7 +651,7 @@ _write_result($no_updates, $errored, $error_ary);
|
||||||
if (!$inline_update)
|
if (!$inline_update)
|
||||||
{
|
{
|
||||||
// Purge the cache...
|
// Purge the cache...
|
||||||
$cache->purge();
|
phpbb::$acm->purge();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<p style="color:red"><?php echo $lang['UPDATE_FILES_NOTICE']; ?></p>
|
<p style="color:red"><?php echo $lang['UPDATE_FILES_NOTICE']; ?></p>
|
||||||
|
@ -676,7 +675,7 @@ else
|
||||||
add_log('admin', 'LOG_UPDATE_DATABASE', $orig_version, $updates_to_version);
|
add_log('admin', 'LOG_UPDATE_DATABASE', $orig_version, $updates_to_version);
|
||||||
|
|
||||||
// Now we purge the session table as well as all cache files
|
// Now we purge the session table as well as all cache files
|
||||||
$cache->purge();
|
phpbb::$acm->purge();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
|
@ -240,7 +240,6 @@ set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handle
|
||||||
|
|
||||||
$user = new user();
|
$user = new user();
|
||||||
$auth = new auth();
|
$auth = new auth();
|
||||||
$cache = new acm();
|
|
||||||
$template = new template();
|
$template = new template();
|
||||||
|
|
||||||
// Set some standard variables we want to force
|
// Set some standard variables we want to force
|
||||||
|
|
|
@ -90,7 +90,7 @@ class install_convert extends module
|
||||||
|
|
||||||
function main($mode, $sub)
|
function main($mode, $sub)
|
||||||
{
|
{
|
||||||
global $lang, $template, $cache, $config, $language, $table_prefix;
|
global $lang, $template, $config, $language, $table_prefix;
|
||||||
global $convert;
|
global $convert;
|
||||||
|
|
||||||
$this->tpl_name = 'install_convert';
|
$this->tpl_name = 'install_convert';
|
||||||
|
@ -213,7 +213,7 @@ class install_convert extends module
|
||||||
|
|
||||||
// If we reached this step (conversion completed) we want to purge the cache and log the user out.
|
// If we reached this step (conversion completed) we want to purge the cache and log the user out.
|
||||||
// This is for making sure the session get not screwed due to the 3.0.x users table being completely new.
|
// This is for making sure the session get not screwed due to the 3.0.x users table being completely new.
|
||||||
$cache->purge();
|
phpbb::$acm->purge();
|
||||||
|
|
||||||
require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
|
require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
|
||||||
require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT);
|
require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT);
|
||||||
|
@ -333,7 +333,7 @@ class install_convert extends module
|
||||||
*/
|
*/
|
||||||
function get_convert_settings($sub)
|
function get_convert_settings($sub)
|
||||||
{
|
{
|
||||||
global $lang, $language, $template, $db, $config, $cache;
|
global $lang, $language, $template, $db, $config;
|
||||||
|
|
||||||
require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
|
require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
|
||||||
require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT);
|
require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT);
|
||||||
|
@ -581,7 +581,7 @@ class install_convert extends module
|
||||||
*/
|
*/
|
||||||
function convert_data($sub)
|
function convert_data($sub)
|
||||||
{
|
{
|
||||||
global $template, $user, $db, $lang, $config, $cache;
|
global $template, $user, $db, $lang, $config;
|
||||||
global $convert, $convert_row, $message_parser, $skip_rows, $language;
|
global $convert, $convert_row, $message_parser, $skip_rows, $language;
|
||||||
|
|
||||||
require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
|
require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
|
||||||
|
@ -1438,7 +1438,7 @@ class install_convert extends module
|
||||||
*/
|
*/
|
||||||
function sync_forums($sync_batch)
|
function sync_forums($sync_batch)
|
||||||
{
|
{
|
||||||
global $template, $user, $db, $config, $cache;
|
global $template, $user, $db, $config;
|
||||||
global $convert;
|
global $convert;
|
||||||
|
|
||||||
$template->assign_block_vars('checks', array(
|
$template->assign_block_vars('checks', array(
|
||||||
|
@ -1578,7 +1578,7 @@ class install_convert extends module
|
||||||
*/
|
*/
|
||||||
function final_jump($final_jump)
|
function final_jump($final_jump)
|
||||||
{
|
{
|
||||||
global $template, $user, $src_db, $same_db, $db, $config, $cache;
|
global $template, $user, $src_db, $same_db, $db, $config;
|
||||||
global $convert;
|
global $convert;
|
||||||
|
|
||||||
$template->assign_block_vars('checks', array(
|
$template->assign_block_vars('checks', array(
|
||||||
|
@ -1617,7 +1617,7 @@ class install_convert extends module
|
||||||
*/
|
*/
|
||||||
function jump($jump, $last_statement)
|
function jump($jump, $last_statement)
|
||||||
{
|
{
|
||||||
global $template, $user, $src_db, $same_db, $db, $config, $cache;
|
global $template, $user, $src_db, $same_db, $db, $config;
|
||||||
global $convert;
|
global $convert;
|
||||||
|
|
||||||
$template->assign_block_vars('checks', array(
|
$template->assign_block_vars('checks', array(
|
||||||
|
@ -1743,7 +1743,7 @@ class install_convert extends module
|
||||||
// TODO: sync() is likely going to bomb out on forums with a considerable amount of topics.
|
// TODO: sync() is likely going to bomb out on forums with a considerable amount of topics.
|
||||||
// TODO: the sync function is able to handle FROM-TO values, we should use them here (batch processing)
|
// TODO: the sync function is able to handle FROM-TO values, we should use them here (batch processing)
|
||||||
sync('forum', '', '', false, true);
|
sync('forum', '', '', false, true);
|
||||||
$cache->destroy('sql', FORUMS_TABLE);
|
phpbb::$acm->destroy_sql(FORUMS_TABLE);
|
||||||
|
|
||||||
$template->assign_block_vars('checks', array(
|
$template->assign_block_vars('checks', array(
|
||||||
'TITLE' => $user->lang['SYNC_FORUMS'],
|
'TITLE' => $user->lang['SYNC_FORUMS'],
|
||||||
|
@ -1920,7 +1920,7 @@ class install_convert extends module
|
||||||
*/
|
*/
|
||||||
function process_row(&$schema, &$sql_data, &$insert_values)
|
function process_row(&$schema, &$sql_data, &$insert_values)
|
||||||
{
|
{
|
||||||
global $template, $user, $db, $lang, $config, $cache;
|
global $template, $user, $db, $lang, $config;
|
||||||
global $convert, $convert_row;
|
global $convert, $convert_row;
|
||||||
|
|
||||||
$sql_flag = false;
|
$sql_flag = false;
|
||||||
|
|
|
@ -70,7 +70,7 @@ class install_update extends module
|
||||||
|
|
||||||
function main($mode, $sub)
|
function main($mode, $sub)
|
||||||
{
|
{
|
||||||
global $template, $user, $db, $config, $cache, $auth;
|
global $template, $user, $db, $config, $auth;
|
||||||
|
|
||||||
$this->tpl_name = 'install_update';
|
$this->tpl_name = 'install_update';
|
||||||
$this->page_title = 'UPDATE_INSTALLATION';
|
$this->page_title = 'UPDATE_INSTALLATION';
|
||||||
|
@ -122,17 +122,17 @@ class install_update extends module
|
||||||
// If we are within the intro page we need to make sure we get up-to-date version info
|
// If we are within the intro page we need to make sure we get up-to-date version info
|
||||||
if ($sub == 'intro')
|
if ($sub == 'intro')
|
||||||
{
|
{
|
||||||
$cache->destroy('_version_info');
|
phpbb::$acm->destroy('version_info');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set custom template again. ;)
|
// Set custom template again. ;)
|
||||||
$template->set_custom_template('../adm/style', 'admin');
|
$template->set_custom_template('../adm/style', 'admin');
|
||||||
|
|
||||||
// Get current and latest version
|
// Get current and latest version
|
||||||
if (($latest_version = $cache->get('_version_info')) === false)
|
if (($latest_version = phpbb::$acm->get('version_info')) === false)
|
||||||
{
|
{
|
||||||
$this->latest_version = $this->get_file('version_info');
|
$this->latest_version = $this->get_file('version_info');
|
||||||
$cache->put('_version_info', $this->latest_version);
|
phpbb::$acm->put('version_info', $this->latest_version);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -224,8 +224,8 @@ class install_update extends module
|
||||||
));
|
));
|
||||||
|
|
||||||
// Make sure the update list is destroyed.
|
// Make sure the update list is destroyed.
|
||||||
$cache->destroy('_update_list');
|
phpbb::$acm->destroy('update_list');
|
||||||
$cache->destroy('_diff_files');
|
phpbb::$acm->destroy('diff_files');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'version_check':
|
case 'version_check':
|
||||||
|
@ -273,7 +273,7 @@ class install_update extends module
|
||||||
}
|
}
|
||||||
|
|
||||||
// Just a precaution
|
// Just a precaution
|
||||||
$cache->purge();
|
phpbb::$acm->purge();
|
||||||
|
|
||||||
// Redirect the user to the database update script with some explanations...
|
// Redirect the user to the database update script with some explanations...
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
|
@ -289,7 +289,7 @@ class install_update extends module
|
||||||
case 'file_check':
|
case 'file_check':
|
||||||
|
|
||||||
// Make sure the previous file collection is no longer valid...
|
// Make sure the previous file collection is no longer valid...
|
||||||
$cache->destroy('_diff_files');
|
phpbb::$acm->destroy('diff_files');
|
||||||
|
|
||||||
$this->page_title = 'STAGE_FILE_CHECK';
|
$this->page_title = 'STAGE_FILE_CHECK';
|
||||||
|
|
||||||
|
@ -297,8 +297,8 @@ class install_update extends module
|
||||||
$action = request_var('action', '');
|
$action = request_var('action', '');
|
||||||
|
|
||||||
// We are directly within an update. To make sure our update list is correct we check its status.
|
// We are directly within an update. To make sure our update list is correct we check its status.
|
||||||
$update_list = (phpbb_request::variable('check_again', false, false, phpbb_request::POST)) ? false : $cache->get('_update_list');
|
$update_list = (phpbb_request::variable('check_again', false, false, phpbb_request::POST)) ? false : phpbb::$acm->get('update_list');
|
||||||
$modified = ($update_list !== false) ? @filemtime($cache->cache_dir . 'data_update_list.' . PHP_EXT) : 0;
|
$modified = ($update_list !== false) ? phpbb::$acm->get_modified_date('data', 'update_list') : 0;
|
||||||
|
|
||||||
// Make sure the list is up-to-date
|
// Make sure the list is up-to-date
|
||||||
if ($update_list !== false)
|
if ($update_list !== false)
|
||||||
|
@ -326,7 +326,7 @@ class install_update extends module
|
||||||
if ($get_new_list)
|
if ($get_new_list)
|
||||||
{
|
{
|
||||||
$this->get_update_structure($update_list);
|
$this->get_update_structure($update_list);
|
||||||
$cache->put('_update_list', $update_list);
|
phpbb::$acm->put('update_list', $update_list);
|
||||||
|
|
||||||
// Refresh the page if we are still not finished...
|
// Refresh the page if we are still not finished...
|
||||||
if ($update_list['status'] != -1)
|
if ($update_list['status'] != -1)
|
||||||
|
@ -497,7 +497,7 @@ class install_update extends module
|
||||||
WHERE theme_id = ' . $theme['theme_id'];
|
WHERE theme_id = ' . $theme['theme_id'];
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$cache->destroy('sql', STYLES_THEME_TABLE);
|
phpbb::$acm->destroy_sql(STYLES_THEME_TABLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -505,7 +505,7 @@ class install_update extends module
|
||||||
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'version_update_from'");
|
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'version_update_from'");
|
||||||
$db->sql_return_on_error(false);
|
$db->sql_return_on_error(false);
|
||||||
|
|
||||||
$cache->purge();
|
phpbb::$acm->purge();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -544,7 +544,7 @@ class install_update extends module
|
||||||
}
|
}
|
||||||
|
|
||||||
// Before the user is choosing his preferred method, let's create the content list...
|
// Before the user is choosing his preferred method, let's create the content list...
|
||||||
$update_list = $cache->get('_update_list');
|
$update_list = phpbb::$acm->get('update_list');
|
||||||
|
|
||||||
if ($update_list === false)
|
if ($update_list === false)
|
||||||
{
|
{
|
||||||
|
@ -601,7 +601,7 @@ class install_update extends module
|
||||||
|
|
||||||
// Before we do anything, let us diff the files and store the raw file information "somewhere"
|
// Before we do anything, let us diff the files and store the raw file information "somewhere"
|
||||||
$get_files = false;
|
$get_files = false;
|
||||||
$file_list = $cache->get('_diff_files');
|
$file_list = phpbb::$acm->get('diff_files');
|
||||||
|
|
||||||
if ($file_list === false || $file_list['status'] != -1)
|
if ($file_list === false || $file_list['status'] != -1)
|
||||||
{
|
{
|
||||||
|
@ -642,7 +642,7 @@ class install_update extends module
|
||||||
// Refresh if we reach 5 diffs...
|
// Refresh if we reach 5 diffs...
|
||||||
if ($processed >= 5)
|
if ($processed >= 5)
|
||||||
{
|
{
|
||||||
$cache->put('_diff_files', $file_list);
|
phpbb::$acm->put('diff_files', $file_list);
|
||||||
|
|
||||||
if (request_var('download', false))
|
if (request_var('download', false))
|
||||||
{
|
{
|
||||||
|
@ -687,8 +687,8 @@ class install_update extends module
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$file_list[$file_struct['filename']] = '_file_' . md5($file_struct['filename']);
|
$file_list[$file_struct['filename']] = 'file_' . md5($file_struct['filename']);
|
||||||
$cache->put($file_list[$file_struct['filename']], base64_encode($contents));
|
phpbb::$acm->put($file_list[$file_struct['filename']], base64_encode($contents));
|
||||||
|
|
||||||
$file_list['status']++;
|
$file_list['status']++;
|
||||||
$processed++;
|
$processed++;
|
||||||
|
@ -732,8 +732,8 @@ class install_update extends module
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$file_list[$file_struct['filename']] = '_file_' . md5($file_struct['filename']);
|
$file_list[$file_struct['filename']] = 'file_' . md5($file_struct['filename']);
|
||||||
$cache->put($file_list[$file_struct['filename']], base64_encode($contents));
|
phpbb::$acm->put($file_list[$file_struct['filename']], base64_encode($contents));
|
||||||
|
|
||||||
$file_list['status']++;
|
$file_list['status']++;
|
||||||
$processed++;
|
$processed++;
|
||||||
|
@ -745,7 +745,7 @@ class install_update extends module
|
||||||
}
|
}
|
||||||
|
|
||||||
$file_list['status'] = -1;
|
$file_list['status'] = -1;
|
||||||
$cache->put('_diff_files', $file_list);
|
phpbb::$acm->put('diff_files', $file_list);
|
||||||
|
|
||||||
if (request_var('download', false))
|
if (request_var('download', false))
|
||||||
{
|
{
|
||||||
|
@ -784,7 +784,7 @@ class install_update extends module
|
||||||
);
|
);
|
||||||
|
|
||||||
// To ease the update process create a file location map
|
// To ease the update process create a file location map
|
||||||
$update_list = $cache->get('_update_list');
|
$update_list = phpbb::$acm->get('update_list');
|
||||||
$script_path = ($config['force_server_vars']) ? (($config['script_path'] == '/') ? '/' : $config['script_path'] . '/') : $user->page['root_script_path'];
|
$script_path = ($config['force_server_vars']) ? (($config['script_path'] == '/') ? '/' : $config['script_path'] . '/') : $user->page['root_script_path'];
|
||||||
|
|
||||||
foreach ($update_list as $status => $files)
|
foreach ($update_list as $status => $files)
|
||||||
|
@ -974,7 +974,7 @@ class install_update extends module
|
||||||
|
|
||||||
case 'modified':
|
case 'modified':
|
||||||
|
|
||||||
$contents = base64_decode($cache->get($file_list[$file_struct['filename']]));
|
$contents = base64_decode(phpbb::$acm->get($file_list[$file_struct['filename']]));
|
||||||
|
|
||||||
if ($update_mode == 'download')
|
if ($update_mode == 'download')
|
||||||
{
|
{
|
||||||
|
@ -990,7 +990,7 @@ class install_update extends module
|
||||||
|
|
||||||
case 'conflict':
|
case 'conflict':
|
||||||
|
|
||||||
$contents = base64_decode($cache->get($file_list[$file_struct['filename']]));
|
$contents = base64_decode(phpbb::$acm->get($file_list[$file_struct['filename']]));
|
||||||
|
|
||||||
if ($update_mode == 'download')
|
if ($update_mode == 'download')
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,7 +26,7 @@ class acp_attachments
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache, $config;
|
global $db, $user, $auth, $template, $config;
|
||||||
|
|
||||||
$user->add_lang(array('posting', 'viewtopic', 'acp/attachments'));
|
$user->add_lang(array('posting', 'viewtopic', 'acp/attachments'));
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ class acp_attachments
|
||||||
$notify[] = $user->lang['EXTENSIONS_UPDATED'];
|
$notify[] = $user->lang['EXTENSIONS_UPDATED'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->destroy('_extensions');
|
phpbb::$acm->destroy('extensions');
|
||||||
}
|
}
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
|
@ -575,7 +575,7 @@ class acp_attachments
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->destroy('_extensions');
|
phpbb::$acm->destroy('extensions');
|
||||||
|
|
||||||
if (!sizeof($error))
|
if (!sizeof($error))
|
||||||
{
|
{
|
||||||
|
@ -621,7 +621,7 @@ class acp_attachments
|
||||||
|
|
||||||
add_log('admin', 'LOG_ATTACH_EXTGROUP_DEL', $group_name);
|
add_log('admin', 'LOG_ATTACH_EXTGROUP_DEL', $group_name);
|
||||||
|
|
||||||
$cache->destroy('_extensions');
|
phpbb::$acm->destroy('extensions');
|
||||||
|
|
||||||
trigger_error($user->lang['EXTENSION_GROUP_DELETED'] . adm_back_link($this->u_action));
|
trigger_error($user->lang['EXTENSION_GROUP_DELETED'] . adm_back_link($this->u_action));
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ class acp_ban
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $config, $db, $user, $auth, $template, $cache;
|
global $config, $db, $user, $auth, $template;
|
||||||
|
|
||||||
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
|
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ class acp_bbcodes
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache, $config;
|
global $db, $user, $auth, $template, $config;
|
||||||
|
|
||||||
$user->add_lang('acp/posting');
|
$user->add_lang('acp/posting');
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ class acp_bbcodes
|
||||||
$sql_ary['bbcode_id'] = (int) $bbcode_id;
|
$sql_ary['bbcode_id'] = (int) $bbcode_id;
|
||||||
|
|
||||||
$db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary));
|
$db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary));
|
||||||
$cache->destroy('sql', BBCODES_TABLE);
|
phpbb::$acm->destroy_sql(BBCODES_TABLE);
|
||||||
|
|
||||||
$lang = 'BBCODE_ADDED';
|
$lang = 'BBCODE_ADDED';
|
||||||
$log_action = 'LOG_BBCODE_ADD';
|
$log_action = 'LOG_BBCODE_ADD';
|
||||||
|
@ -228,7 +228,7 @@ class acp_bbcodes
|
||||||
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
|
||||||
WHERE bbcode_id = ' . $bbcode_id;
|
WHERE bbcode_id = ' . $bbcode_id;
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
$cache->destroy('sql', BBCODES_TABLE);
|
phpbb::$acm->destroy_sql(BBCODES_TABLE);
|
||||||
|
|
||||||
$lang = 'BBCODE_EDITED';
|
$lang = 'BBCODE_EDITED';
|
||||||
$log_action = 'LOG_BBCODE_EDIT';
|
$log_action = 'LOG_BBCODE_EDIT';
|
||||||
|
@ -254,7 +254,7 @@ class acp_bbcodes
|
||||||
if (confirm_box(true))
|
if (confirm_box(true))
|
||||||
{
|
{
|
||||||
$db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id");
|
$db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id");
|
||||||
$cache->destroy('sql', BBCODES_TABLE);
|
phpbb::$acm->destroy_sql(BBCODES_TABLE);
|
||||||
add_log('admin', 'LOG_BBCODE_DELETE', $row['bbcode_tag']);
|
add_log('admin', 'LOG_BBCODE_DELETE', $row['bbcode_tag']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -25,7 +25,7 @@ class acp_bots
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $config, $db, $user, $auth, $template, $cache;
|
global $config, $db, $user, $auth, $template;
|
||||||
|
|
||||||
$action = request_var('action', '');
|
$action = request_var('action', '');
|
||||||
$submit = phpbb_request::is_set_post('submit');
|
$submit = phpbb_request::is_set_post('submit');
|
||||||
|
@ -64,7 +64,7 @@ class acp_bots
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->destroy('_bots');
|
phpbb::$acm->destroy('bots');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'deactivate':
|
case 'deactivate':
|
||||||
|
@ -78,7 +78,7 @@ class acp_bots
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->destroy('_bots');
|
phpbb::$acm->destroy('bots');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
|
@ -121,7 +121,7 @@ class acp_bots
|
||||||
|
|
||||||
$db->sql_transaction('commit');
|
$db->sql_transaction('commit');
|
||||||
|
|
||||||
$cache->destroy('_bots');
|
phpbb::$acm->destroy('bots');
|
||||||
|
|
||||||
add_log('admin', 'LOG_BOT_DELETE', implode(', ', $bot_name_ary));
|
add_log('admin', 'LOG_BOT_DELETE', implode(', ', $bot_name_ary));
|
||||||
trigger_error($user->lang['BOT_DELETED'] . adm_back_link($this->u_action));
|
trigger_error($user->lang['BOT_DELETED'] . adm_back_link($this->u_action));
|
||||||
|
@ -290,7 +290,7 @@ class acp_bots
|
||||||
$log = 'UPDATED';
|
$log = 'UPDATED';
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->destroy('_bots');
|
phpbb::$acm->destroy('bots');
|
||||||
|
|
||||||
add_log('admin', 'LOG_BOT_' . $log, $bot_row['bot_name']);
|
add_log('admin', 'LOG_BOT_' . $log, $bot_row['bot_name']);
|
||||||
trigger_error($user->lang['BOT_' . $log] . adm_back_link($this->u_action));
|
trigger_error($user->lang['BOT_' . $log] . adm_back_link($this->u_action));
|
||||||
|
|
|
@ -25,7 +25,7 @@ class acp_database
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $cache, $db, $user, $auth, $template, $table_prefix, $config;
|
global $db, $user, $auth, $template, $table_prefix, $config;
|
||||||
|
|
||||||
$user->add_lang('acp/database');
|
$user->add_lang('acp/database');
|
||||||
|
|
||||||
|
@ -399,7 +399,7 @@ class acp_database
|
||||||
$close($fp);
|
$close($fp);
|
||||||
|
|
||||||
// Purge the cache due to updated data
|
// Purge the cache due to updated data
|
||||||
$cache->purge();
|
phpbb::$acm->purge();
|
||||||
|
|
||||||
add_log('admin', 'LOG_DB_RESTORE');
|
add_log('admin', 'LOG_DB_RESTORE');
|
||||||
trigger_error($user->lang['RESTORE_SUCCESS'] . adm_back_link($this->u_action));
|
trigger_error($user->lang['RESTORE_SUCCESS'] . adm_back_link($this->u_action));
|
||||||
|
|
|
@ -25,7 +25,7 @@ class acp_disallow
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache, $config;
|
global $db, $user, $auth, $template, $config;
|
||||||
|
|
||||||
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
|
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class acp_disallow
|
||||||
$sql = 'INSERT INTO ' . DISALLOW_TABLE . ' ' . $db->sql_build_array('INSERT', array('disallow_username' => $disallowed_user));
|
$sql = 'INSERT INTO ' . DISALLOW_TABLE . ' ' . $db->sql_build_array('INSERT', array('disallow_username' => $disallowed_user));
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$cache->destroy('_disallowed_usernames');
|
phpbb::$acm->destroy('disallowed_usernames');
|
||||||
|
|
||||||
$message = $user->lang['DISALLOW_SUCCESSFUL'];
|
$message = $user->lang['DISALLOW_SUCCESSFUL'];
|
||||||
add_log('admin', 'LOG_DISALLOW_ADD', str_replace('%', '*', $disallowed_user));
|
add_log('admin', 'LOG_DISALLOW_ADD', str_replace('%', '*', $disallowed_user));
|
||||||
|
@ -78,7 +78,7 @@ class acp_disallow
|
||||||
WHERE disallow_id = ' . $disallowed_id;
|
WHERE disallow_id = ' . $disallowed_id;
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$cache->destroy('_disallowed_usernames');
|
phpbb::$acm->destroy('disallowed_usernames');
|
||||||
|
|
||||||
add_log('admin', 'LOG_DISALLOW_DELETE');
|
add_log('admin', 'LOG_DISALLOW_DELETE');
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ class acp_email
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $config, $db, $user, $auth, $template, $cache;
|
global $config, $db, $user, $auth, $template;
|
||||||
|
|
||||||
$user->add_lang('acp/email');
|
$user->add_lang('acp/email');
|
||||||
$this->tpl_name = 'acp_email';
|
$this->tpl_name = 'acp_email';
|
||||||
|
|
|
@ -26,7 +26,7 @@ class acp_forums
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache, $config;
|
global $db, $user, $auth, $template, $config;
|
||||||
|
|
||||||
$user->add_lang('acp/forums');
|
$user->add_lang('acp/forums');
|
||||||
$this->tpl_name = 'acp_forums';
|
$this->tpl_name = 'acp_forums';
|
||||||
|
@ -96,7 +96,7 @@ class acp_forums
|
||||||
}
|
}
|
||||||
|
|
||||||
$auth->acl_clear_prefetch();
|
$auth->acl_clear_prefetch();
|
||||||
$cache->destroy('sql', FORUMS_TABLE);
|
phpbb::$acm->destroy_sql(FORUMS_TABLE);
|
||||||
|
|
||||||
trigger_error($user->lang['FORUM_DELETED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id));
|
trigger_error($user->lang['FORUM_DELETED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id));
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ class acp_forums
|
||||||
}
|
}
|
||||||
|
|
||||||
$auth->acl_clear_prefetch();
|
$auth->acl_clear_prefetch();
|
||||||
$cache->destroy('sql', FORUMS_TABLE);
|
phpbb::$acm->destroy_sql(FORUMS_TABLE);
|
||||||
|
|
||||||
$acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id'];
|
$acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id'];
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ class acp_forums
|
||||||
if ($move_forum_name !== false)
|
if ($move_forum_name !== false)
|
||||||
{
|
{
|
||||||
add_log('admin', 'LOG_FORUM_' . strtoupper($action), $row['forum_name'], $move_forum_name);
|
add_log('admin', 'LOG_FORUM_' . strtoupper($action), $row['forum_name'], $move_forum_name);
|
||||||
$cache->destroy('sql', FORUMS_TABLE);
|
phpbb::$acm->destroy_sql(FORUMS_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -404,7 +404,7 @@ class acp_forums
|
||||||
sync('forum', 'forum_id', $forum_id, false, true);
|
sync('forum', 'forum_id', $forum_id, false, true);
|
||||||
|
|
||||||
add_log('admin', 'LOG_FORUM_SYNC', $row['forum_name']);
|
add_log('admin', 'LOG_FORUM_SYNC', $row['forum_name']);
|
||||||
$cache->destroy('sql', FORUMS_TABLE);
|
phpbb::$acm->destroy_sql(FORUMS_TABLE);
|
||||||
|
|
||||||
$template->assign_var('L_FORUM_RESYNCED', sprintf($user->lang['FORUM_RESYNCED'], $row['forum_name']));
|
$template->assign_var('L_FORUM_RESYNCED', sprintf($user->lang['FORUM_RESYNCED'], $row['forum_name']));
|
||||||
|
|
||||||
|
@ -887,7 +887,7 @@ class acp_forums
|
||||||
*/
|
*/
|
||||||
function update_forum_data(&$forum_data)
|
function update_forum_data(&$forum_data)
|
||||||
{
|
{
|
||||||
global $db, $user, $cache;
|
global $db, $user;
|
||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
|
|
||||||
|
@ -1138,7 +1138,7 @@ class acp_forums
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$cache->destroy('_extensions');
|
phpbb::$acm->destroy('extensions');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($action_subforums == 'move')
|
else if ($action_subforums == 'move')
|
||||||
|
@ -1387,7 +1387,7 @@ class acp_forums
|
||||||
*/
|
*/
|
||||||
function delete_forum($forum_id, $action_posts = 'delete', $action_subforums = 'delete', $posts_to_id = 0, $subforums_to_id = 0)
|
function delete_forum($forum_id, $action_posts = 'delete', $action_subforums = 'delete', $posts_to_id = 0, $subforums_to_id = 0)
|
||||||
{
|
{
|
||||||
global $db, $user, $cache;
|
global $db, $user;
|
||||||
|
|
||||||
$forum_data = $this->get_forum_info($forum_id);
|
$forum_data = $this->get_forum_info($forum_id);
|
||||||
|
|
||||||
|
@ -1577,7 +1577,7 @@ class acp_forums
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$cache->destroy('_extensions');
|
phpbb::$acm->destroy('extensions');
|
||||||
|
|
||||||
$log_action = implode('_', array($log_action_posts, $log_action_forums));
|
$log_action = implode('_', array($log_action_posts, $log_action_forums));
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ class acp_groups
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $config, $db, $user, $auth, $template, $cache, $file_uploads;
|
global $config, $db, $user, $auth, $template, $file_uploads;
|
||||||
|
|
||||||
$user->add_lang('acp/groups');
|
$user->add_lang('acp/groups');
|
||||||
$this->tpl_name = 'acp_groups';
|
$this->tpl_name = 'acp_groups';
|
||||||
|
@ -458,7 +458,7 @@ class acp_groups
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->destroy('sql', GROUPS_TABLE);
|
phpbb::$acm->destroy_sql(GROUPS_TABLE);
|
||||||
|
|
||||||
$message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED';
|
$message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED';
|
||||||
trigger_error($user->lang[$message] . adm_back_link($this->u_action));
|
trigger_error($user->lang[$message] . adm_back_link($this->u_action));
|
||||||
|
|
|
@ -26,7 +26,7 @@ class acp_icons
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache, $config;
|
global $db, $user, $auth, $template, $config;
|
||||||
|
|
||||||
$user->add_lang('acp/posting');
|
$user->add_lang('acp/posting');
|
||||||
|
|
||||||
|
@ -429,8 +429,8 @@ class acp_icons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->destroy('_icons');
|
phpbb::$acm->destroy('icons');
|
||||||
$cache->destroy('sql', $table);
|
phpbb::$acm->destroy_sql($table);
|
||||||
|
|
||||||
$level = E_USER_NOTICE;
|
$level = E_USER_NOTICE;
|
||||||
switch ($icons_updated)
|
switch ($icons_updated)
|
||||||
|
@ -607,8 +607,8 @@ class acp_icons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->destroy('_icons');
|
phpbb::$acm->destroy('icons');
|
||||||
$cache->destroy('sql', $table);
|
phpbb::$acm->destroy_sql($table);
|
||||||
|
|
||||||
trigger_error($user->lang[$lang . '_IMPORT_SUCCESS'] . adm_back_link($this->u_action));
|
trigger_error($user->lang[$lang . '_IMPORT_SUCCESS'] . adm_back_link($this->u_action));
|
||||||
}
|
}
|
||||||
|
@ -729,8 +729,8 @@ class acp_icons
|
||||||
|
|
||||||
$notice = $user->lang[$lang . '_DELETED'];
|
$notice = $user->lang[$lang . '_DELETED'];
|
||||||
|
|
||||||
$cache->destroy('_icons');
|
phpbb::$acm->destroy('icons');
|
||||||
$cache->destroy('sql', $table);
|
phpbb::$acm->destroy_sql($table);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -781,8 +781,8 @@ class acp_icons
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->destroy('_icons');
|
phpbb::$acm->destroy('icons');
|
||||||
$cache->destroy('sql', $table);
|
phpbb::$acm->destroy_sql($table);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ class acp_language
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $config, $db, $user, $auth, $template, $cache;
|
global $config, $db, $user, $auth, $template;
|
||||||
global $safe_mode, $file_uploads;
|
global $safe_mode, $file_uploads;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -796,7 +796,7 @@ class acp_language
|
||||||
$sql = 'DELETE FROM ' . STYLES_IMAGESET_DATA_TABLE . " WHERE image_lang = '" . $db->sql_escape($row['lang_iso']) . "'";
|
$sql = 'DELETE FROM ' . STYLES_IMAGESET_DATA_TABLE . " WHERE image_lang = '" . $db->sql_escape($row['lang_iso']) . "'";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE);
|
phpbb::$acm->destroy_sql(STYLES_IMAGESET_DATA_TABLE);
|
||||||
|
|
||||||
add_log('admin', 'LOG_LANGUAGE_PACK_DELETED', $row['lang_english_name']);
|
add_log('admin', 'LOG_LANGUAGE_PACK_DELETED', $row['lang_english_name']);
|
||||||
|
|
||||||
|
@ -908,7 +908,7 @@ class acp_language
|
||||||
if (sizeof($sql_ary))
|
if (sizeof($sql_ary))
|
||||||
{
|
{
|
||||||
$db->sql_multi_insert(STYLES_IMAGESET_DATA_TABLE, $sql_ary);
|
$db->sql_multi_insert(STYLES_IMAGESET_DATA_TABLE, $sql_ary);
|
||||||
$cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE);
|
phpbb::$acm->destroy_sql(STYLES_IMAGESET_DATA_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now let's copy the default language entries for custom profile fields for this new language - makes admin's life easier.
|
// Now let's copy the default language entries for custom profile fields for this new language - makes admin's life easier.
|
||||||
|
|
|
@ -25,7 +25,7 @@ class acp_logs
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache, $config;
|
global $db, $user, $auth, $template, $config;
|
||||||
|
|
||||||
$user->add_lang('mcp');
|
$user->add_lang('mcp');
|
||||||
|
|
||||||
|
|
|
@ -328,8 +328,7 @@ class acp_main
|
||||||
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
|
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
global $cache;
|
phpbb::$acm->purge();
|
||||||
$cache->purge();
|
|
||||||
|
|
||||||
// Clear permissions
|
// Clear permissions
|
||||||
$auth->acl_clear_prefetch();
|
$auth->acl_clear_prefetch();
|
||||||
|
|
|
@ -720,15 +720,13 @@ class acp_modules
|
||||||
*/
|
*/
|
||||||
function remove_cache_file()
|
function remove_cache_file()
|
||||||
{
|
{
|
||||||
global $cache;
|
|
||||||
|
|
||||||
// Sanitise for future path use, it's escaped as appropriate for queries
|
// Sanitise for future path use, it's escaped as appropriate for queries
|
||||||
$p_class = str_replace(array('.', '/', '\\'), '', basename($this->module_class));
|
$p_class = str_replace(array('.', '/', '\\'), '', basename($this->module_class));
|
||||||
|
|
||||||
$cache->destroy('_modules_' . $p_class);
|
phpbb::$acm->destroy('modules_' . $p_class);
|
||||||
|
|
||||||
// Additionally remove sql cache
|
// Additionally remove sql cache
|
||||||
$cache->destroy('sql', MODULES_TABLE);
|
phpbb::$acm->destroy_sql(MODULES_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -25,7 +25,7 @@ class acp_permission_roles
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache, $config;
|
global $db, $user, $auth, $template, $config;
|
||||||
|
|
||||||
include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
|
include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
|
||||||
include_once(PHPBB_ROOT_PATH . 'includes/acp/auth.' . PHP_EXT);
|
include_once(PHPBB_ROOT_PATH . 'includes/acp/auth.' . PHP_EXT);
|
||||||
|
|
|
@ -26,7 +26,7 @@ class acp_permissions
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache, $config;
|
global $db, $user, $auth, $template, $config;
|
||||||
|
|
||||||
include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
|
include_once(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
|
||||||
include_once(PHPBB_ROOT_PATH . 'includes/acp/auth.' . PHP_EXT);
|
include_once(PHPBB_ROOT_PATH . 'includes/acp/auth.' . PHP_EXT);
|
||||||
|
|
|
@ -28,7 +28,7 @@ class acp_profile
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $config, $db, $user, $auth, $template, $cache;
|
global $config, $db, $user, $auth, $template;
|
||||||
|
|
||||||
include(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT);
|
include(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT);
|
||||||
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
|
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
|
||||||
|
|
|
@ -51,7 +51,7 @@ class acp_prune
|
||||||
*/
|
*/
|
||||||
function prune_forums($id, $mode)
|
function prune_forums($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache, $config;
|
global $db, $user, $auth, $template, $config;
|
||||||
|
|
||||||
$all_forums = request_var('all_forums', 0);
|
$all_forums = request_var('all_forums', 0);
|
||||||
$forum_id = request_var('f', array(0));
|
$forum_id = request_var('f', array(0));
|
||||||
|
@ -227,7 +227,7 @@ class acp_prune
|
||||||
*/
|
*/
|
||||||
function prune_users($id, $mode)
|
function prune_users($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache, $config;
|
global $db, $user, $auth, $template, $config;
|
||||||
|
|
||||||
$user->add_lang('memberlist');
|
$user->add_lang('memberlist');
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ class acp_ranks
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache, $config;
|
global $db, $user, $auth, $template, $config;
|
||||||
|
|
||||||
$user->add_lang('acp/posting');
|
$user->add_lang('acp/posting');
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ class acp_ranks
|
||||||
}
|
}
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$cache->destroy('_ranks');
|
phpbb::$acm->destroy('ranks');
|
||||||
|
|
||||||
trigger_error($message . adm_back_link($this->u_action));
|
trigger_error($message . adm_back_link($this->u_action));
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ class acp_ranks
|
||||||
WHERE user_rank = $rank_id";
|
WHERE user_rank = $rank_id";
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$cache->destroy('_ranks');
|
phpbb::$acm->destroy('ranks');
|
||||||
|
|
||||||
add_log('admin', 'LOG_RANK_REMOVED', $rank_title);
|
add_log('admin', 'LOG_RANK_REMOVED', $rank_title);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ class acp_reasons
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache, $config;
|
global $db, $user, $auth, $template, $config;
|
||||||
|
|
||||||
$user->add_lang(array('mcp', 'acp/posting'));
|
$user->add_lang(array('mcp', 'acp/posting'));
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ class acp_search
|
||||||
|
|
||||||
function settings($id, $mode)
|
function settings($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache, $config;
|
global $db, $user, $auth, $template, $config;
|
||||||
|
|
||||||
$submit = phpbb_request::is_set_post('submit');
|
$submit = phpbb_request::is_set_post('submit');
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ class acp_search
|
||||||
|
|
||||||
function index($id, $mode)
|
function index($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache, $config;
|
global $db, $user, $auth, $template, $config;
|
||||||
|
|
||||||
$action = request_var('action', array('' => false));
|
$action = request_var('action', array('' => false));
|
||||||
if (sizeof($action))
|
if (sizeof($action))
|
||||||
|
|
|
@ -31,7 +31,7 @@ class acp_styles
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache, $config;
|
global $db, $user, $auth, $template, $config;
|
||||||
|
|
||||||
// Hardcoded template bitfield to add for new templates
|
// Hardcoded template bitfield to add for new templates
|
||||||
$bitfield = new bitfield();
|
$bitfield = new bitfield();
|
||||||
|
@ -300,7 +300,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
WHERE theme_id = $style_id";
|
WHERE theme_id = $style_id";
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$cache->destroy('sql', STYLES_THEME_TABLE);
|
phpbb::$acm->destroy_sql(STYLES_THEME_TABLE);
|
||||||
|
|
||||||
add_log('admin', 'LOG_THEME_REFRESHED', $theme_row['theme_name']);
|
add_log('admin', 'LOG_THEME_REFRESHED', $theme_row['theme_name']);
|
||||||
trigger_error($user->lang['THEME_REFRESHED'] . adm_back_link($this->u_action));
|
trigger_error($user->lang['THEME_REFRESHED'] . adm_back_link($this->u_action));
|
||||||
|
@ -447,7 +447,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
|
|
||||||
$db->sql_transaction('commit');
|
$db->sql_transaction('commit');
|
||||||
|
|
||||||
$cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE);
|
phpbb::$acm->destroy_sql(STYLES_IMAGESET_DATA_TABLE);
|
||||||
|
|
||||||
add_log('admin', 'LOG_IMAGESET_REFRESHED', $imageset_row['imageset_name']);
|
add_log('admin', 'LOG_IMAGESET_REFRESHED', $imageset_row['imageset_name']);
|
||||||
trigger_error($user->lang['IMAGESET_REFRESHED'] . adm_back_link($this->u_action));
|
trigger_error($user->lang['IMAGESET_REFRESHED'] . adm_back_link($this->u_action));
|
||||||
|
@ -631,7 +631,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
*/
|
*/
|
||||||
function edit_template($template_id)
|
function edit_template($template_id)
|
||||||
{
|
{
|
||||||
global $config, $db, $cache, $user, $template, $safe_mode;
|
global $config, $db, $user, $template, $safe_mode;
|
||||||
|
|
||||||
if (defined('PHPBB_DISABLE_ACP_EDITOR'))
|
if (defined('PHPBB_DISABLE_ACP_EDITOR'))
|
||||||
{
|
{
|
||||||
|
@ -692,7 +692,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
// destroy the cached version of the template (filename without extension)
|
// destroy the cached version of the template (filename without extension)
|
||||||
$this->clear_template_cache($template_info, array(substr($template_file, 0, -5)));
|
$this->clear_template_cache($template_info, array(substr($template_file, 0, -5)));
|
||||||
|
|
||||||
$cache->destroy('sql', STYLES_TABLE);
|
phpbb::$acm->destroy_sql(STYLES_TABLE);
|
||||||
|
|
||||||
add_log('admin', 'LOG_TEMPLATE_EDIT', $template_info['template_name'], $template_file);
|
add_log('admin', 'LOG_TEMPLATE_EDIT', $template_info['template_name'], $template_file);
|
||||||
trigger_error($user->lang['TEMPLATE_FILE_UPDATED'] . $additional . adm_back_link($this->u_action . "&action=edit&id=$template_id&text_rows=$text_rows&template_file=$template_file"));
|
trigger_error($user->lang['TEMPLATE_FILE_UPDATED'] . $additional . adm_back_link($this->u_action . "&action=edit&id=$template_id&text_rows=$text_rows&template_file=$template_file"));
|
||||||
|
@ -801,7 +801,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
*/
|
*/
|
||||||
function template_cache($template_id)
|
function template_cache($template_id)
|
||||||
{
|
{
|
||||||
global $config, $db, $cache, $user, $template;
|
global $config, $db, $user, $template;
|
||||||
|
|
||||||
$source = str_replace('/', '.', request_var('source', ''));
|
$source = str_replace('/', '.', request_var('source', ''));
|
||||||
$file_ary = array_diff(request_var('delete', array('')), array(''));
|
$file_ary = array_diff(request_var('delete', array('')), array(''));
|
||||||
|
@ -920,7 +920,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
*/
|
*/
|
||||||
function edit_theme($theme_id)
|
function edit_theme($theme_id)
|
||||||
{
|
{
|
||||||
global $config, $db, $cache, $user, $template, $safe_mode;
|
global $config, $db, $user, $template, $safe_mode;
|
||||||
|
|
||||||
$this->page_title = 'EDIT_THEME';
|
$this->page_title = 'EDIT_THEME';
|
||||||
|
|
||||||
|
@ -981,7 +981,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
WHERE theme_id = ' . $theme_id;
|
WHERE theme_id = ' . $theme_id;
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$cache->destroy('sql', STYLES_THEME_TABLE);
|
phpbb::$acm->destroy_sql(STYLES_THEME_TABLE);
|
||||||
|
|
||||||
// notify the user if the theme was not stored in the db before his modification
|
// notify the user if the theme was not stored in the db before his modification
|
||||||
if (!$theme_info['theme_storedb'])
|
if (!$theme_info['theme_storedb'])
|
||||||
|
@ -990,7 +990,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
$message .= '<br />' . $user->lang['EDIT_THEME_STORED_DB'];
|
$message .= '<br />' . $user->lang['EDIT_THEME_STORED_DB'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$cache->destroy('sql', STYLES_THEME_TABLE);
|
phpbb::$acm->destroy_sql(STYLES_THEME_TABLE);
|
||||||
add_log('admin', (!$theme_info['theme_storedb']) ? 'LOG_THEME_EDIT_FILE' : 'LOG_THEME_EDIT', $theme_info['theme_name'], (!$theme_info['theme_storedb']) ? $theme_file : '');
|
add_log('admin', (!$theme_info['theme_storedb']) ? 'LOG_THEME_EDIT_FILE' : 'LOG_THEME_EDIT', $theme_info['theme_name'], (!$theme_info['theme_storedb']) ? $theme_file : '');
|
||||||
|
|
||||||
trigger_error($message . adm_back_link($this->u_action . "&action=edit&id=$theme_id&template_file=$theme_file&text_rows=$text_rows"));
|
trigger_error($message . adm_back_link($this->u_action . "&action=edit&id=$theme_id&template_file=$theme_file&text_rows=$text_rows"));
|
||||||
|
@ -1107,7 +1107,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
*/
|
*/
|
||||||
function edit_imageset($imageset_id)
|
function edit_imageset($imageset_id)
|
||||||
{
|
{
|
||||||
global $db, $user, $cache, $template;
|
global $db, $user, $template;
|
||||||
|
|
||||||
$this->page_title = 'EDIT_IMAGESET';
|
$this->page_title = 'EDIT_IMAGESET';
|
||||||
|
|
||||||
|
@ -1232,7 +1232,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
$db->sql_query('INSERT INTO ' . STYLES_IMAGESET_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
|
$db->sql_query('INSERT INTO ' . STYLES_IMAGESET_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->destroy('sql', STYLES_IMAGESET_DATA_TABLE);
|
phpbb::$acm->destroy_sql(STYLES_IMAGESET_DATA_TABLE);
|
||||||
|
|
||||||
add_log('admin', 'LOG_IMAGESET_EDIT', $imageset_name);
|
add_log('admin', 'LOG_IMAGESET_EDIT', $imageset_name);
|
||||||
|
|
||||||
|
@ -1376,7 +1376,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
*/
|
*/
|
||||||
function remove($mode, $style_id)
|
function remove($mode, $style_id)
|
||||||
{
|
{
|
||||||
global $db, $template, $user, $cache, $config;
|
global $db, $template, $user, $config;
|
||||||
|
|
||||||
$new_id = request_var('new_id', 0);
|
$new_id = request_var('new_id', 0);
|
||||||
$update = phpbb_request::is_set_post('update');
|
$update = phpbb_request::is_set_post('update');
|
||||||
|
@ -1480,7 +1480,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->destroy('sql', STYLES_TABLE);
|
phpbb::$acm->destroy_sql(STYLES_TABLE);
|
||||||
|
|
||||||
add_log('admin', 'LOG_' . $l_prefix . '_DELETE', $style_row[$mode . '_name']);
|
add_log('admin', 'LOG_' . $l_prefix . '_DELETE', $style_row[$mode . '_name']);
|
||||||
$message = ($mode != 'style') ? $l_prefix . '_DELETED_FS' : $l_prefix . '_DELETED';
|
$message = ($mode != 'style') ? $l_prefix . '_DELETED_FS' : $l_prefix . '_DELETED';
|
||||||
|
@ -1512,7 +1512,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
*/
|
*/
|
||||||
function export($mode, $style_id)
|
function export($mode, $style_id)
|
||||||
{
|
{
|
||||||
global $db, $template, $user, $cache, $config;
|
global $db, $template, $user, $config;
|
||||||
|
|
||||||
$update = phpbb_request::is_set_post('update');
|
$update = phpbb_request::is_set_post('update');
|
||||||
|
|
||||||
|
@ -1909,7 +1909,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
*/
|
*/
|
||||||
function details($mode, $style_id)
|
function details($mode, $style_id)
|
||||||
{
|
{
|
||||||
global $template, $db, $config, $user, $safe_mode, $cache;
|
global $template, $db, $config, $user, $safe_mode;
|
||||||
|
|
||||||
$update = phpbb_request::is_set_post('update');
|
$update = phpbb_request::is_set_post('update');
|
||||||
$l_type = strtoupper($mode);
|
$l_type = strtoupper($mode);
|
||||||
|
@ -2056,7 +2056,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->destroy('sql', STYLES_TABLE);
|
phpbb::$acm->destroy_sql(STYLES_TABLE);
|
||||||
|
|
||||||
add_log('admin', 'LOG_' . $l_type . '_EDIT_DETAILS', $name);
|
add_log('admin', 'LOG_' . $l_type . '_EDIT_DETAILS', $name);
|
||||||
if (sizeof($error))
|
if (sizeof($error))
|
||||||
|
@ -2260,7 +2260,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
*/
|
*/
|
||||||
function install($mode)
|
function install($mode)
|
||||||
{
|
{
|
||||||
global $config, $db, $cache, $user, $template;
|
global $config, $db, $user, $template;
|
||||||
|
|
||||||
$l_type = strtoupper($mode);
|
$l_type = strtoupper($mode);
|
||||||
|
|
||||||
|
@ -2373,7 +2373,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
|
|
||||||
if (!sizeof($error))
|
if (!sizeof($error))
|
||||||
{
|
{
|
||||||
$cache->destroy('sql', STYLES_TABLE);
|
phpbb::$acm->destroy_sql(STYLES_TABLE);
|
||||||
|
|
||||||
trigger_error($user->lang[$l_type . '_ADDED'] . adm_back_link($this->u_action));
|
trigger_error($user->lang[$l_type . '_ADDED'] . adm_back_link($this->u_action));
|
||||||
}
|
}
|
||||||
|
@ -2415,7 +2415,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
*/
|
*/
|
||||||
function add($mode)
|
function add($mode)
|
||||||
{
|
{
|
||||||
global $config, $db, $cache, $user, $template;
|
global $config, $db, $user, $template;
|
||||||
|
|
||||||
$l_type = strtoupper($mode);
|
$l_type = strtoupper($mode);
|
||||||
$element_ary = array('template' => STYLES_TEMPLATE_TABLE, 'theme' => STYLES_THEME_TABLE, 'imageset' => STYLES_IMAGESET_TABLE);
|
$element_ary = array('template' => STYLES_TEMPLATE_TABLE, 'theme' => STYLES_THEME_TABLE, 'imageset' => STYLES_IMAGESET_TABLE);
|
||||||
|
@ -2503,7 +2503,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
|
|
||||||
if (!sizeof($error))
|
if (!sizeof($error))
|
||||||
{
|
{
|
||||||
$cache->destroy('sql', STYLES_TABLE);
|
phpbb::$acm->destroy_sql(STYLES_TABLE);
|
||||||
|
|
||||||
trigger_error($user->lang[$l_type . '_ADDED'] . adm_back_link($this->u_action));
|
trigger_error($user->lang[$l_type . '_ADDED'] . adm_back_link($this->u_action));
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ class acp_update
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $config, $db, $user, $auth, $template, $cache;
|
global $config, $db, $user, $auth, $template;
|
||||||
|
|
||||||
$user->add_lang('install');
|
$user->add_lang('install');
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ class acp_users
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $config, $db, $user, $auth, $template, $cache, $file_uploads;
|
global $config, $db, $user, $auth, $template, $file_uploads;
|
||||||
|
|
||||||
$user->add_lang(array('posting', 'ucp', 'acp/users'));
|
$user->add_lang(array('posting', 'ucp', 'acp/users'));
|
||||||
$this->tpl_name = 'acp_users';
|
$this->tpl_name = 'acp_users';
|
||||||
|
|
|
@ -26,7 +26,7 @@ class acp_words
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $template, $cache, $config;
|
global $db, $user, $auth, $template, $config;
|
||||||
|
|
||||||
$user->add_lang('acp/posting');
|
$user->add_lang('acp/posting');
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ class acp_words
|
||||||
$db->sql_query('INSERT INTO ' . WORDS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
|
$db->sql_query('INSERT INTO ' . WORDS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache->destroy('_word_censors');
|
phpbb::$acm->destroy('word_censors');
|
||||||
|
|
||||||
$log_action = ($word_id) ? 'LOG_WORD_EDIT' : 'LOG_WORD_ADD';
|
$log_action = ($word_id) ? 'LOG_WORD_EDIT' : 'LOG_WORD_ADD';
|
||||||
add_log('admin', $log_action, $word);
|
add_log('admin', $log_action, $word);
|
||||||
|
@ -138,7 +138,7 @@ class acp_words
|
||||||
WHERE word_id = $word_id";
|
WHERE word_id = $word_id";
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$cache->destroy('_word_censors');
|
phpbb::$acm->destroy('word_censors');
|
||||||
|
|
||||||
add_log('admin', 'LOG_WORD_DELETE', $deleted_word);
|
add_log('admin', 'LOG_WORD_DELETE', $deleted_word);
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,9 @@ class auth_admin extends auth
|
||||||
*/
|
*/
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
global $db, $cache;
|
global $db;
|
||||||
|
|
||||||
if (($this->acl_options = $cache->get('_acl_options')) === false)
|
if (($this->acl_options = phpbb::$acm->get('acl_options')) === false)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT auth_option_id, auth_option, is_global, is_local
|
$sql = 'SELECT auth_option_id, auth_option, is_global, is_local
|
||||||
FROM ' . ACL_OPTIONS_TABLE . '
|
FROM ' . ACL_OPTIONS_TABLE . '
|
||||||
|
@ -55,7 +55,7 @@ class auth_admin extends auth
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$cache->put('_acl_options', $this->acl_options);
|
phpbb::$acm->put('acl_options', $this->acl_options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -687,7 +687,7 @@ class auth_admin extends auth
|
||||||
*/
|
*/
|
||||||
public function acl_add_option(array $options)
|
public function acl_add_option(array $options)
|
||||||
{
|
{
|
||||||
global $db, $cache;
|
global $db;
|
||||||
|
|
||||||
$cur_options = array();
|
$cur_options = array();
|
||||||
|
|
||||||
|
@ -757,7 +757,7 @@ class auth_admin extends auth
|
||||||
|
|
||||||
$db->sql_multi_insert(ACL_OPTIONS_TABLE, $sql_ary);
|
$db->sql_multi_insert(ACL_OPTIONS_TABLE, $sql_ary);
|
||||||
|
|
||||||
$cache->destroy('_acl_options');
|
phpbb::$acm->destroy('acl_options');
|
||||||
$this->acl_clear_prefetch();
|
$this->acl_clear_prefetch();
|
||||||
|
|
||||||
// Because we just changed the options and also purged the options cache, we instantly update/regenerate it for later calls to succeed.
|
// Because we just changed the options and also purged the options cache, we instantly update/regenerate it for later calls to succeed.
|
||||||
|
|
|
@ -25,7 +25,7 @@ class mcp_ban
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $config, $db, $user, $auth, $template, $cache;
|
global $config, $db, $user, $auth, $template;
|
||||||
|
|
||||||
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
|
include(PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
*/
|
*/
|
||||||
function mcp_forum_view($id, $mode, $action, $forum_info)
|
function mcp_forum_view($id, $mode, $action, $forum_info)
|
||||||
{
|
{
|
||||||
global $template, $db, $user, $auth, $cache, $module, $config;
|
global $template, $db, $user, $auth, $module, $config;
|
||||||
|
|
||||||
$user->add_lang(array('viewtopic', 'viewforum'));
|
$user->add_lang(array('viewtopic', 'viewforum'));
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
*/
|
*/
|
||||||
function mcp_post_details($id, $mode, $action)
|
function mcp_post_details($id, $mode, $action)
|
||||||
{
|
{
|
||||||
global $template, $db, $user, $auth, $cache, $config;
|
global $template, $db, $user, $auth, $config;
|
||||||
|
|
||||||
$user->add_lang('posting');
|
$user->add_lang('posting');
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ class mcp_queue
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $auth, $db, $user, $template, $cache;
|
global $auth, $db, $user, $template;
|
||||||
global $config, $action;
|
global $config, $action;
|
||||||
|
|
||||||
include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT);
|
include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT);
|
||||||
|
|
|
@ -33,7 +33,7 @@ class mcp_reports
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $auth, $db, $user, $template, $cache;
|
global $auth, $db, $user, $template;
|
||||||
global $config, $action;
|
global $config, $action;
|
||||||
|
|
||||||
include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT);
|
include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT);
|
||||||
|
|
|
@ -21,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
*/
|
*/
|
||||||
function mcp_topic_view($id, $mode, $action)
|
function mcp_topic_view($id, $mode, $action)
|
||||||
{
|
{
|
||||||
global $template, $db, $user, $auth, $cache, $config;
|
global $template, $db, $user, $auth, $config;
|
||||||
|
|
||||||
$url = append_sid(PHPBB_ROOT_PATH. 'mcp.' . PHP_EXT . '?' . extra_url());
|
$url = append_sid(PHPBB_ROOT_PATH. 'mcp.' . PHP_EXT . '?' . extra_url());
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ class ucp_groups
|
||||||
|
|
||||||
function main($id, $mode)
|
function main($id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $user, $auth, $cache, $template, $config;
|
global $db, $user, $auth, $template, $config;
|
||||||
|
|
||||||
$user->add_lang('groups');
|
$user->add_lang('groups');
|
||||||
|
|
||||||
|
@ -612,7 +612,7 @@ class ucp_groups
|
||||||
|
|
||||||
if (!($error = group_create($group_id, $group_type, $group_name, $group_desc, $group_attributes, $allow_desc_bbcode, $allow_desc_urls, $allow_desc_smilies)))
|
if (!($error = group_create($group_id, $group_type, $group_name, $group_desc, $group_attributes, $allow_desc_bbcode, $allow_desc_urls, $allow_desc_smilies)))
|
||||||
{
|
{
|
||||||
$cache->destroy('sql', GROUPS_TABLE);
|
phpbb::$acm->destroy_sql(GROUPS_TABLE);
|
||||||
|
|
||||||
$message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED';
|
$message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED';
|
||||||
trigger_error($user->lang[$message] . $return_page);
|
trigger_error($user->lang[$message] . $return_page);
|
||||||
|
|
|
@ -22,7 +22,7 @@ if (!defined('IN_PHPBB'))
|
||||||
*/
|
*/
|
||||||
function view_folder($id, $mode, $folder_id, $folder)
|
function view_folder($id, $mode, $folder_id, $folder)
|
||||||
{
|
{
|
||||||
global $user, $template, $auth, $db, $cache, $config;
|
global $user, $template, $auth, $db, $config;
|
||||||
|
|
||||||
$submit_export = phpbb_request::is_set_post('submit_export');
|
$submit_export = phpbb_request::is_set_post('submit_export');
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
*/
|
*/
|
||||||
function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
|
function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
|
||||||
{
|
{
|
||||||
global $user, $template, $auth, $db, $cache, $config;
|
global $user, $template, $auth, $db, $config;
|
||||||
|
|
||||||
$user->add_lang(array('viewtopic', 'memberlist'));
|
$user->add_lang(array('viewtopic', 'memberlist'));
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
|
||||||
*/
|
*/
|
||||||
function get_user_information($user_id, $user_row)
|
function get_user_information($user_id, $user_row)
|
||||||
{
|
{
|
||||||
global $db, $auth, $user, $cache, $config;
|
global $db, $auth, $user, $config;
|
||||||
|
|
||||||
if (!$user_id)
|
if (!$user_id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -162,7 +162,7 @@ if ($recache)
|
||||||
WHERE theme_id = {$theme['theme_id']}";
|
WHERE theme_id = {$theme['theme_id']}";
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$cache->destroy('sql', STYLES_THEME_TABLE);
|
phpbb::$acm->destroy_sql(STYLES_THEME_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only set the expire time if the theme changed data is older than 30 minutes - to cope with changes from the ACP
|
// Only set the expire time if the theme changed data is older than 30 minutes - to cope with changes from the ACP
|
||||||
|
|
Loading…
Add table
Reference in a new issue