aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acm/cache_file.php4
-rw-r--r--phpBB/includes/functions.php12
-rw-r--r--phpBB/includes/functions_admin.php6
-rw-r--r--phpBB/includes/functions_display.php20
-rw-r--r--phpBB/includes/page_tail.php5
-rw-r--r--phpBB/includes/session.php22
6 files changed, 45 insertions, 24 deletions
diff --git a/phpBB/includes/acm/cache_file.php b/phpBB/includes/acm/cache_file.php
index e4fc4e85a6..14cc160d84 100644
--- a/phpBB/includes/acm/cache_file.php
+++ b/phpBB/includes/acm/cache_file.php
@@ -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;
}
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index aa1af28270..496e327e87 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -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;
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index c2136d4671..e6b84cc67c 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -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;
}
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 297c52b95e..0f8e1ef4f4 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -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)
));
}
}
-?>
+?> \ No newline at end of file
diff --git a/phpBB/includes/page_tail.php b/phpBB/includes/page_tail.php
index 9c7f03a330..e0591dfa76 100644
--- a/phpBB/includes/page_tail.php
+++ b/phpBB/includes/page_tail.php
@@ -52,7 +52,10 @@ $template->assign_vars(array(
));
-$cache->save_cache();
+if (!empty($cache))
+{
+ $cache->save_cache();
+}
$template->display('body');
exit;
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index d642b79bd0..b6390e122b 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -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);