mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 14:00:31 +02:00
Un-b0rked ACL options caching, small general fixes
git-svn-id: file:///svn/phpbb/trunk@3338 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -67,7 +67,7 @@ class acm
|
||||
}
|
||||
}
|
||||
|
||||
function save($varname, $var)
|
||||
function put($varname, $var)
|
||||
{
|
||||
$this->vars[$varname] = $var;
|
||||
$this->vars_ts[$varname] = time();
|
||||
@@ -84,7 +84,7 @@ class acm
|
||||
}
|
||||
}
|
||||
|
||||
function load($varname, $expire_time = 0)
|
||||
function get($varname, $expire_time = 0)
|
||||
{
|
||||
return ($this->exists($varname, $expire_time)) ? $this->vars[$varname] : null;
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ function set_config($config_name, $config_value)
|
||||
}
|
||||
|
||||
$config[$config_name] = $config_value;
|
||||
$cache->save('config', $config);
|
||||
$cache->put('config', $config);
|
||||
|
||||
}
|
||||
|
||||
@@ -214,9 +214,7 @@ function make_jumpbox($action, $forum_id = false)
|
||||
$sql = 'SELECT forum_id, forum_name, forum_postable, left_id, right_id
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
ORDER BY left_id ASC';
|
||||
|
||||
// Cache the forums list for 60 seconds
|
||||
$result = $db->sql_query($sql, 60);
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$right = $cat_right = 0;
|
||||
$padding = $forum_list = $holding = '';
|
||||
@@ -265,7 +263,7 @@ function make_jumpbox($action, $forum_id = false)
|
||||
}
|
||||
|
||||
$nav_links['chapter forum'][$row['forum_id']] = array (
|
||||
'url' => ($row['forum_status'] == ITEM_CATEGORY) ? "index.$phpEx$SIDc=" : "viewforum.$phpEx$SID&f=" . $row['forum_id'],
|
||||
'url' => "viewforum.$phpEx$SID&f=" . $row['forum_id'],
|
||||
'title' => $row['forum_name']
|
||||
);
|
||||
}
|
||||
@@ -676,7 +674,7 @@ function obtain_word_list(&$orig_word, &$replacement_word)
|
||||
global $db, $cache;
|
||||
if ($cache->exists('word_censors'))
|
||||
{
|
||||
$words = $cache->load('word_censors');
|
||||
$words = $cache->get('word_censors');
|
||||
$orig_word = $words['orig'];
|
||||
$replacement_word = $words['replacement'];
|
||||
}
|
||||
@@ -693,7 +691,7 @@ function obtain_word_list(&$orig_word, &$replacement_word)
|
||||
}
|
||||
|
||||
$words = array('orig' => $orig_word, 'replacement' => $replacement_word);
|
||||
$cache->save('word_censors', $words);
|
||||
$cache->put('word_censors', $words);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@@ -807,7 +807,7 @@ class auth_admin extends auth
|
||||
|
||||
function acl_cache_options($options = false)
|
||||
{
|
||||
global $db;
|
||||
global $db, $cache;
|
||||
|
||||
$options = array();
|
||||
|
||||
@@ -833,6 +833,7 @@ class auth_admin extends auth
|
||||
$db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
/*
|
||||
// Re-cache options
|
||||
$cache_str = "\$acl_options = array(\n";
|
||||
foreach ($options as $type => $options_ary)
|
||||
@@ -848,6 +849,9 @@ class auth_admin extends auth
|
||||
|
||||
config_cache_write('\$acl_options = array\(.*?\);', $cache_str);
|
||||
$this->acl_clear_prefetch();
|
||||
*/
|
||||
$cache->put('acl_options', $options);
|
||||
$this->acl_clear_prefetch();
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
@@ -19,13 +19,21 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
function display_forums($root_data=array(), $display_moderators=TRUE)
|
||||
function display_forums($root_data = '', $display_moderators = TRUE)
|
||||
{
|
||||
global $db, $template, $auth, $user, $phpEx, $SID, $forum_moderators;
|
||||
|
||||
$where_sql = ($root_data['forum_id']) ? ' WHERE left_id > ' . $root_data['left_id'] . ' AND left_id < ' . $root_data['right_id'] : '';
|
||||
if (!$root_data)
|
||||
{
|
||||
$root_data = array('forum_id' => 0);
|
||||
$where_sql = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
$where_sql = ' WHERE left_id > ' . $root_data['left_id'] . ' AND left_id < ' . $root_data['right_id'];
|
||||
}
|
||||
|
||||
if($user->data['user_id'] != ANONYMOUS)
|
||||
if ($user->data['user_id'] != ANONYMOUS)
|
||||
{
|
||||
$lastread_select = ", lr.lastread_time";
|
||||
$lastread_sql = "
|
||||
@@ -34,8 +42,8 @@ function display_forums($root_data=array(), $display_moderators=TRUE)
|
||||
AND (f.forum_id = lr.forum_id OR f.forum_id = -lr.forum_id)
|
||||
AND lr.lastread_time >= f.forum_last_post_time)";
|
||||
|
||||
// Temp fix
|
||||
$where_sql .= ' GROUP BY f.forum_id';
|
||||
// Temp fix for index
|
||||
//$where_sql .= ' GROUP BY f.forum_id';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -230,4 +238,4 @@ function display_forums($root_data=array(), $display_moderators=TRUE)
|
||||
));
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
@@ -52,7 +52,10 @@ $template->assign_vars(array(
|
||||
));
|
||||
|
||||
|
||||
$cache->save_cache();
|
||||
if (!empty($cache))
|
||||
{
|
||||
$cache->save_cache();
|
||||
}
|
||||
$template->display('body');
|
||||
|
||||
exit;
|
||||
|
@@ -42,8 +42,7 @@ class session
|
||||
{
|
||||
$sessiondata = ( isset($_COOKIE[$config['cookie_name'] . '_data']) ) ? unserialize(stripslashes($_COOKIE[$config['cookie_name'] . '_data'])) : '';
|
||||
$this->session_id = ( isset($_COOKIE[$config['cookie_name'] . '_sid']) ) ? $_COOKIE[$config['cookie_name'] . '_sid'] : '';
|
||||
$SID = (defined('IN_ADMIN')) ? '?sid=' . $this->session_id : '?sid=';
|
||||
// $SID = (defined('ADD_SID')) ? '?sid=' . $this->session_id : '?sid=';
|
||||
$SID = (defined('NEED_SID')) ? '?sid=' . $this->session_id : '?sid=';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -79,7 +78,8 @@ class session
|
||||
}
|
||||
|
||||
// session_id exists so go ahead and attempt to grab all data in preparation
|
||||
if (!empty($this->session_id))
|
||||
// Added session check
|
||||
if (!empty($this->session_id) && (!defined('NEED_SID') || $this->session_id == $_GET['sid']))
|
||||
{
|
||||
$sql = "SELECT u.*, s.*
|
||||
FROM " . SESSIONS_TABLE . " s, " . USERS_TABLE . " u
|
||||
@@ -113,6 +113,14 @@ class session
|
||||
}
|
||||
}
|
||||
|
||||
// Session check failed, redirect the user to the index page
|
||||
// TODO: we could delay it until we grab user's data and display a localised error message
|
||||
if (defined('NEED_SID'))
|
||||
{
|
||||
// NOTE: disabled until we decide how to deal with this
|
||||
//redirect("index.$phpEx$SID");
|
||||
}
|
||||
|
||||
// If we reach here then no (valid) session exists. So we'll create a new one,
|
||||
// using the cookie user_id if available to pull basic user prefs.
|
||||
$autologin = (isset($sessiondata['autologinid'])) ? $sessiondata['autologinid'] : '';
|
||||
@@ -309,7 +317,7 @@ class session
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
|
||||
$del_user_id .= (($del_user_id != '') ? ', ' : '') . ' \'' . $row['session_user_id'] . '\'';
|
||||
$del_user_id .= (($del_user_id != '') ? ', ' : '') . " '" . $row['session_user_id'] . "'";
|
||||
$del_sessions++;
|
||||
}
|
||||
|
||||
@@ -440,12 +448,11 @@ class user extends session
|
||||
AND c.theme_id = s.style_id
|
||||
AND i.imageset_id = s.imageset_id";
|
||||
|
||||
// Cache this query for 60 seconds
|
||||
$result = $db->sql_query($sql, 60);
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if (!($this->theme = $db->sql_fetchrow($result)))
|
||||
{
|
||||
message_die(ERROR, 'Could not get style data');
|
||||
trigger_error('Could not get style data');
|
||||
}
|
||||
|
||||
$template->set_template($this->theme['template_path']);
|
||||
@@ -701,6 +708,7 @@ class auth
|
||||
|
||||
$method = trim($config['auth_method']);
|
||||
|
||||
// NOTE: don't we need $phpbb_root_path here?
|
||||
if (file_exists('includes/auth/auth_' . $method . '.' . $phpEx))
|
||||
{
|
||||
include_once('includes/auth/auth_' . $method . '.' . $phpEx);
|
||||
|
Reference in New Issue
Block a user