Author: acydburn
Date: Thu Dec 11 17:40:32 2008
New Revision: 9186
Log:
with these commits at least the index page should fully load without errors (only mysqli supported)
Modified:
branches/acydburn/phpBB/common.php
branches/acydburn/phpBB/download/file.php
branches/acydburn/phpBB/includes/acm/acm_file.php
branches/acydburn/phpBB/includes/acm/acm_xcache.php
branches/acydburn/phpBB/includes/acp/acp_styles.php
branches/acydburn/phpBB/includes/auth/auth_apache.php
branches/acydburn/phpBB/includes/classes/cache.php
branches/acydburn/phpBB/includes/classes/template.php
branches/acydburn/phpBB/includes/classes/template_compile.php
branches/acydburn/phpBB/includes/core/core_request.php
branches/acydburn/phpBB/includes/core/index.php
branches/acydburn/phpBB/includes/core/init.php
branches/acydburn/phpBB/includes/db/mysqli.php
branches/acydburn/phpBB/includes/functions.php
branches/acydburn/phpBB/includes/functions_content.php
branches/acydburn/phpBB/includes/functions_display.php
branches/acydburn/phpBB/includes/functions_posting.php
branches/acydburn/phpBB/includes/functions_user.php
branches/acydburn/phpBB/includes/mcp/mcp_forum.php
branches/acydburn/phpBB/includes/mcp/mcp_post.php
branches/acydburn/phpBB/includes/mcp/mcp_queue.php
branches/acydburn/phpBB/includes/mcp/mcp_reports.php
branches/acydburn/phpBB/includes/mcp/mcp_topic.php
branches/acydburn/phpBB/index.php
branches/acydburn/phpBB/install/install_update.php
branches/acydburn/phpBB/language/en/common.php
branches/acydburn/phpBB/memberlist.php
branches/acydburn/phpBB/plugins/ucp/ucp_pm_viewfolder.php
branches/acydburn/phpBB/plugins/ucp/ucp_pm_viewmessage.php
branches/acydburn/phpBB/search.php
branches/acydburn/phpBB/style.php
branches/acydburn/phpBB/viewforum.php
branches/acydburn/phpBB/viewtopic.php
Modified: branches/acydburn/phpBB/common.php
==============================================================================
*** branches/acydburn/phpBB/common.php (original)
--- branches/acydburn/phpBB/common.php Thu Dec 11 17:40:32 2008
***************
*** 86,94 ****
// Register Cache Manager (SPL autoload test) - we define no classes
phpbb::register('acm');
// For example, data handling with xcache and sql handling within the cache-directory
phpbb::$acm->register('sql');
! phpbb::$acm->register('data', false, 'xcache');
// Grab global variables
phpbb_cache::obtain_config();
--- 86,98 ----
// Register Cache Manager (SPL autoload test) - we define no classes
phpbb::register('acm');
+ // Grab global variables
+ phpbb_cache::obtain_config();
+
+ /*
// For example, data handling with xcache and sql handling within the cache-directory
phpbb::$acm->register('sql');
! //phpbb::$acm->register('data', false, 'xcache');
// Grab global variables
phpbb_cache::obtain_config();
***************
*** 118,138 ****
echo ";".phpbb::call('target_db')->sql_layer.";";
exit;
// Register Template
phpbb::register('template');
! /*
// Register permission class
phpbb::register('acl');
// Register user object
phpbb::register('user');
// Instantiate bare-bone user object
! // Start session management
! phpbb::$user->init();
// Within the user-facing files we call:
//phpbb::$user->start();
! */
?>
\ No newline at end of file
--- 122,155 ----
echo ";".phpbb::call('target_db')->sql_layer.";";
exit;
+ */
// Register Template
phpbb::register('template');
!
// Register permission class
phpbb::register('acl');
// Register user object
phpbb::register('user');
+ /* Add own hook handler, if present. :o
+ phpbb::register('hooks');
+
+ foreach (phpbb_cache::obtain_hooks() as $hook)
+ {
+ @include(PHPBB_ROOT_PATH . 'includes/hooks/' . $hook . '.' . PHP_EXT);
+ }*/
+
// Instantiate bare-bone user object
! // Start session management, inits ACL class too
! // User->init is a collection of phpbb::$user->session_begin() and phpbb::$auth->acl()
! if (PHPBB_FRAMEWORK_FULL)
! {
! phpbb::$user->init();
! }
// Within the user-facing files we call:
//phpbb::$user->start();
!
?>
\ No newline at end of file
Modified: branches/acydburn/phpBB/download/file.php
==============================================================================
*** branches/acydburn/phpBB/download/file.php (original)
--- branches/acydburn/phpBB/download/file.php Thu Dec 11 17:40:32 2008
***************
*** 17,23 ****
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
! // Thank you sun.
if (isset($_SERVER['CONTENT_TYPE']))
{
if ($_SERVER['CONTENT_TYPE'] === 'application/x-java-archive')
--- 17,23 ----
include(PHPBB_ROOT_PATH . 'common.' . PHP_EXT);
! // Thank you sun.
if (isset($_SERVER['CONTENT_TYPE']))
{
if ($_SERVER['CONTENT_TYPE'] === 'application/x-java-archive')
***************
*** 35,45 ****
// worst-case default
$browser = (!empty($_SERVER['HTTP_USER_AGENT'])) ? htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT']) : 'msie 6.0';
! $config = cache::obtain_config();
$filename = request::variable('avatar', '', false, request::GET);
$avatar_group = false;
$exit = false;
!
if ($filename[0] === 'g')
{
$avatar_group = true;
--- 35,45 ----
// worst-case default
$browser = (!empty($_SERVER['HTTP_USER_AGENT'])) ? htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT']) : 'msie 6.0';
! $config = phpbb_cache::obtain_config();
$filename = request::variable('avatar', '', false, request::GET);
$avatar_group = false;
$exit = false;
!
if ($filename[0] === 'g')
{
$avatar_group = true;
***************
*** 66,73 ****
header("HTTP/1.0 403 Forbidden");
$exit = true;
}
!
!
if (!$exit)
{
if (!$filename)
--- 66,73 ----
header("HTTP/1.0 403 Forbidden");
$exit = true;
}
!
!
if (!$exit)
{
if (!$filename)
***************
*** 133,139 ****
}
// Obtain all extensions...
! $extensions = cache::obtain_attach_extensions(true);
}
else
{
--- 133,139 ----
}
// Obtain all extensions...
! $extensions = phpbb_cache::obtain_attach_extensions(true);
}
else
{
Modified: branches/acydburn/phpBB/includes/acm/acm_file.php
==============================================================================
*** branches/acydburn/phpBB/includes/acm/acm_file.php (original)
--- branches/acydburn/phpBB/includes/acm/acm_file.php Thu Dec 11 17:40:32 2008
***************
*** 248,270 ****
}
closedir($dir);
}
- }
-
- /**
- * ACM File Based Caching
- * @package acm
- */
- class acm
- {
-
- public $sql_rowset = array();
/**
! * Purge cache data
*/
! public function purge()
{
- // Purge all phpbb cache files
$dir = @opendir($this->cache_dir);
if (!$dir)
--- 248,259 ----
}
closedir($dir);
}
/**
! * Purge cache
*/
! protected function _purge()
{
$dir = @opendir($this->cache_dir);
if (!$dir)
***************
*** 274,280 ****
while (($entry = readdir($dir)) !== false)
{
! if (strpos($entry, 'sql_') !== 0 && strpos($entry, 'data_') !== 0 && strpos($entry, 'ctpl_') !== 0 && strpos($entry, 'tpl_') !== 0)
{
continue;
}
--- 263,269 ----
while (($entry = readdir($dir)) !== false)
{
! if (strpos($entry, $this->cache_prefix . '_') !== 0 || strpos($entry, $this->cache_prefix . '_global') === 0)
{
continue;
}
***************
*** 282,300 ****
$this->remove_file($this->cache_dir . $entry);
}
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;
}
-
-
}
?>
\ No newline at end of file
--- 271,277 ----
Modified: branches/acydburn/phpBB/includes/acm/acm_xcache.php
==============================================================================
*** branches/acydburn/phpBB/includes/acm/acm_xcache.php (original)
--- branches/acydburn/phpBB/includes/acm/acm_xcache.php Thu Dec 11 17:40:32 2008
***************
*** 182,392 ****
xcache_unset($this->cache_prefix . '_' . $var_name);
}
- }
-
- class acm_xcache {
-
/**
! /**
! * Purge cache data
*/
! public function purge()
{
! // Purge all phpbb cache files
! $dir = @opendir($this->cache_dir);
! if (!$dir)
{
return;
}
! while (($entry = readdir($dir)) !== false)
! {
! if (strpos($entry, 'sql_') !== 0 && strpos($entry, 'data_') !== 0 && strpos($entry, 'ctpl_') !== 0 && strpos($entry, 'tpl_') !== 0)
! {
! continue;
! }
!
! @unlink($this->cache_dir . $entry);
! }
! closedir($dir);
!
! $n = xcache_count(XC_TYPE_VAR);
! for ($i = 0; $i < $n; $i++)
{
! xcache_clear_cache(XC_TYPE_VAR, $i);
! }
!
! unset($this->vars);
! unset($this->sql_rowset);
!
! $this->vars = array();
! $this->var_expires = array();
! $this->sql_rowset = array();
!
! $this->is_modified = false;
! }
! /**
! * Destroy cache data
! */
! public function destroy($var_name, $table = '')
! {
! if ($var_name === 'sql' && !empty($table))
! {
! if (!is_array($table))
{
! $table = array($table);
}
! foreach ($table as $table_name)
{
! // gives us the md5s that we want
! if (!xcache_isset('sql_' . $table_name))
{
continue;
}
- $temp = xcache_get('sql_' . $table_name);
! // delete each query ref
! foreach ($temp as $md5_id => $void)
! {
! xcache_unset('sql_' . $md5_id);
! }
!
! // delete the table ref
! xcache_unset('sql_' . $table_name);
! }
!
! return;
! }
!
! if ($var_name[0] === '_')
! {
! xcache_unset($var_name);
! }
! else if (isset($this->vars[$var_name]))
! {
! $this->is_modified = true;
! unset($this->vars[$var_name]);
!
! // We save here to let the following cache hits succeed
! $this->save();
! }
! }
!
! /**
! * 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);
!
! $query_hash = md5($query);
!
! if (!xcache_isset('sql_' . $query_hash))
! {
! return false;
! }
!
! $this->sql_rowset[$query_id] = xcache_get('sql_' . $query_hash);
!
!
! 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);
!
! // determine which tables this query belongs to:
!
! // grab all the FROM tables, avoid getting a LEFT JOIN
! preg_match('/FROM \(?(\w+(?: (?!LEFT JOIN)\w+)?(?:, ?\w+(?: (?!LEFT JOIN)\w+)?)*)\)?/', $query, $regs);
! $tables = array_map('trim', explode(',', $regs[1]));
!
! // now get the LEFT JOIN
! preg_match_all('/LEFT JOIN\s+(\w+)(?: \w+)?/', $query, $result, PREG_PATTERN_ORDER);
! $tables = array_merge($tables, $result[1]);
!
! $query_hash = md5($query);
!
! foreach ($tables as $table_name)
! {
! if (($pos = strpos($table_name, ' ')) !== false)
! {
! $table_name = substr($table_name, 0, $pos);
}
! if (xcache_isset('sql_' . $table_name))
! {
! $temp = xcache_get('sql_' . $table_name);
! }
! else
{
! $temp = array();
}
- $temp[$query_hash] = true;
- xcache_set('sql_' . $table_name, $temp, $ttl);
}
! // store them in the right place
! $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);
!
! xcache_set('sql_' . $query_hash, $this->sql_rowset[$query_id], $ttl);
!
! $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;
}
}
--- 182,227 ----
xcache_unset($this->cache_prefix . '_' . $var_name);
}
/**
! * Purge cache
*/
! protected function _purge()
{
! $num_entries = xcache_count(XC_TYPE_VAR);
! if (!$num_entries)
{
return;
}
! for ($i = 0; $i < $num_entries; $i++)
{
! $data = xcache_list(XC_TYPE_VAR, $i);
! if (empty($data['cache_list']))
{
! continue;
}
! $found = false;
! foreach ($data['cache_list'] as $list)
{
! if (strpos($list['name'], $this->cache_prefix . '_') === 0)
{
continue;
}
! $found = true;
}
! if ($found)
{
! xcache_clear_cache(XC_TYPE_VAR, $i);
}
}
! return;
}
}
Modified: branches/acydburn/phpBB/includes/acp/acp_styles.php
==============================================================================
*** branches/acydburn/phpBB/includes/acp/acp_styles.php (original)
--- branches/acydburn/phpBB/includes/acp/acp_styles.php Thu Dec 11 17:40:32 2008
***************
*** 1660,1666 ****
$theme_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}'), array($mode, $style_row['theme_name'], $style_row['theme_copyright'], $config['version']), $this->theme_cfg);
// Read old cfg file
! $items = cache::obtain_cfg_item($style_row, 'theme');
if (!isset($items['parse_css_file']))
{
--- 1660,1666 ----
$theme_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}'), array($mode, $style_row['theme_name'], $style_row['theme_copyright'], $config['version']), $this->theme_cfg);
// Read old cfg file
! $items = phpbb_cache::obtain_cfg_item($style_row, 'theme');
if (!isset($items['parse_css_file']))
{
Modified: branches/acydburn/phpBB/includes/auth/auth_apache.php
==============================================================================
*** branches/acydburn/phpBB/includes/auth/auth_apache.php (original)
--- branches/acydburn/phpBB/includes/auth/auth_apache.php Thu Dec 11 17:40:32 2008
***************
*** 104,110 ****
'user_row' => $row,
);
}
!
// Successful login...
return array(
'status' => LOGIN_SUCCESS,
--- 104,110 ----
'user_row' => $row,
);
}
!
// Successful login...
return array(
'status' => LOGIN_SUCCESS,
***************
*** 148,155 ****
if (!empty($php_auth_user) && !empty($php_auth_pw))
{
! set_var($php_auth_user, $php_auth_user, 'string', true);
! set_var($php_auth_pw, $php_auth_pw, 'string', true);
$sql = 'SELECT *
FROM ' . USERS_TABLE . "
--- 148,155 ----
if (!empty($php_auth_user) && !empty($php_auth_pw))
{
! request::set_var($php_auth_user, $php_auth_user, 'string', true);
! request::set_var($php_auth_pw, $php_auth_pw, 'string', true);
$sql = 'SELECT *
FROM ' . USERS_TABLE . "
***************
*** 231,237 ****
}
$php_auth_user = '';
! set_var($php_auth_user, $_SERVER['PHP_AUTH_USER'], 'string', true);
return ($php_auth_user === $user['username']) ? true : false;
}
--- 231,237 ----
}
$php_auth_user = '';
! request::set_var($php_auth_user, $_SERVER['PHP_AUTH_USER'], 'string', true);
return ($php_auth_user === $user['username']) ? true : false;
}
Modified: branches/acydburn/phpBB/includes/classes/cache.php
==============================================================================
*** branches/acydburn/phpBB/includes/classes/cache.php (original)
--- branches/acydburn/phpBB/includes/classes/cache.php Thu Dec 11 17:40:32 2008
***************
*** 280,289 ****
{
if (($bots = phpbb::$acm->get('bots')) === false)
{
$sql = 'SELECT user_id, bot_agent, bot_ip
FROM ' . BOTS_TABLE . '
WHERE bot_active = 1
! ORDER BY ' . phpbb::$db->sql_function('length_varchar', 'bot_agent') . 'DESC';
$result = phpbb::$db->sql_query($sql);
$bots = array();
--- 280,290 ----
{
if (($bots = phpbb::$acm->get('bots')) === false)
{
+ // @todo We order by last visit date. This way we are able to safe some cycles by checking the most active ones first.
$sql = 'SELECT user_id, bot_agent, bot_ip
FROM ' . BOTS_TABLE . '
WHERE bot_active = 1
! ORDER BY ' . phpbb::$db->sql_function('length_varchar', 'bot_agent') . 'DESC';
$result = phpbb::$db->sql_query($sql);
$bots = array();
Modified: branches/acydburn/phpBB/includes/classes/template.php
==============================================================================
*** branches/acydburn/phpBB/includes/classes/template.php (original)
--- branches/acydburn/phpBB/includes/classes/template.php Thu Dec 11 17:40:32 2008
***************
*** 22,40 ****
*/
class phpbb_template
{
! /** variable that holds all the data we'll be substituting into
* the compiled templates. Takes form:
* --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value
* if it's a root-level variable, it'll be like this:
* --> $this->_tpldata[.][0][varname] == value
*/
private $_tpldata = array('.' => array(0 => array()));
private $_rootref;
! // Root dir and hash of filenames for each template handle.
private $root = '';
public $cachepath = '';
public $files = array();
public $filename = array();
/**
--- 22,60 ----
*/
class phpbb_template
{
! /**
! * variable that holds all the data we'll be substituting into
* the compiled templates. Takes form:
* --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value
* if it's a root-level variable, it'll be like this:
* --> $this->_tpldata[.][0][varname] == value
+ * @var array
*/
private $_tpldata = array('.' => array(0 => array()));
+
+ /**
+ * @var array Reference to template->_tpldata['.'][0]
+ */
private $_rootref;
! /**
! * @var string Root dir for template.
! */
private $root = '';
+
+ /**
+ * @var string Path of the cache directory for the template
+ */
public $cachepath = '';
+
+ /**
+ * @var array Hash of handle => file path pairs
+ */
public $files = array();
+
+ /**
+ * @var array Hash of handle => filename pairs
+ */
public $filename = array();
/**
***************
*** 43,81 ****
*/
public function set_template()
{
! global $user;
!
! if (file_exists(PHPBB_ROOT_PATH . 'styles/' . $user->theme['template_path'] . '/template'))
{
! $this->root = PHPBB_ROOT_PATH . 'styles/' . $user->theme['template_path'] . '/template';
! $this->cachepath = PHPBB_ROOT_PATH . 'cache/tpl_' . $user->theme['template_path'] . '_';
}
else
{
! trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR);
}
$this->_rootref = &$this->_tpldata['.'][0];
-
- return true;
}
/**
* Set custom template location (able to use directory outside of phpBB)
* @access public
*/
public function set_custom_template($template_path, $template_name)
{
$this->root = $template_path;
$this->cachepath = PHPBB_ROOT_PATH . 'cache/ctpl_' . str_replace('_', '-', $template_name) . '_';
-
- return true;
}
/**
* Sets the template filenames for handles. $filename_array
- * should be a hash of handle => filename pairs.
* @access public
*/
public function set_filenames(array $filename_array)
{
--- 63,97 ----
*/
public function set_template()
{
! if (file_exists(PHPBB_ROOT_PATH . 'styles/' . phpbb::$user->theme['template_path'] . '/template'))
{
! $this->root = PHPBB_ROOT_PATH . 'styles/' . phpbb::$user->theme['template_path'] . '/template';
! $this->cachepath = PHPBB_ROOT_PATH . 'cache/tpl_' . phpbb::$user->theme['template_path'] . '_';
}
else
{
! trigger_error('Template path could not be found: styles/' . phpbb::$user->theme['template_path'] . '/template', E_USER_ERROR);
}
$this->_rootref = &$this->_tpldata['.'][0];
}
/**
* Set custom template location (able to use directory outside of phpBB)
* @access public
+ * @param string $template_path Path to template directory
+ * @param string $template_name Name of template
*/
public function set_custom_template($template_path, $template_name)
{
$this->root = $template_path;
$this->cachepath = PHPBB_ROOT_PATH . 'cache/ctpl_' . str_replace('_', '-', $template_name) . '_';
}
/**
* Sets the template filenames for handles. $filename_array
* @access public
+ * @param array $filname_array Should be a hash of handle => filename pairs.
*/
public function set_filenames(array $filename_array)
{
***************
*** 97,103 ****
* Destroy template data set
* @access public
*/
! function __destruct()
{
$this->_tpldata = array('.' => array(0 => array()));
}
--- 113,119 ----
* Destroy template data set
* @access public
*/
! public function __destruct()
{
$this->_tpldata = array('.' => array(0 => array()));
}
***************
*** 105,110 ****
--- 121,127 ----
/**
* Reset/empty complete block
* @access public
+ * @param string $blockname Name of block to destroy
*/
public function destroy_block_vars($blockname)
{
***************
*** 128,145 ****
// Top-level block.
unset($this->_tpldata[$blockname]);
}
-
- return true;
}
/**
* Display handle
* @access public
*/
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 ($phpbb_hook->hook_return(array(__CLASS__, __FUNCTION__)))
--- 145,162 ----
// Top-level block.
unset($this->_tpldata[$blockname]);
}
}
/**
* Display handle
* @access public
+ * @param string $handle Handle to display
+ * @param bool $include_once Allow multiple inclusions
+ * @return bool True on success, false on failure
*/
public function display($handle, $include_once = true)
{
! /*
if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $include_once))
{
if ($phpbb_hook->hook_return(array(__CLASS__, __FUNCTION__)))
***************
*** 147,153 ****
return $phpbb_hook->hook_return_result(array(__CLASS__, __FUNCTION__));
}
}
!
/* if (defined('IN_ERROR_HANDLER'))
{
if ((E_NOTICE & error_reporting()) == E_NOTICE)
--- 164,170 ----
return $phpbb_hook->hook_return_result(array(__CLASS__, __FUNCTION__));
}
}
! */
/* if (defined('IN_ERROR_HANDLER'))
{
if ((E_NOTICE & error_reporting()) == E_NOTICE)
***************
*** 158,164 ****
$_tpldata = &$this->_tpldata;
$_rootref = &$this->_rootref;
! $_lang = &$user->lang;
// These _are_ used the included files.
$_tpldata; $_rootref; $_lang;
--- 175,181 ----
$_tpldata = &$this->_tpldata;
$_rootref = &$this->_rootref;
! $_lang = &phpbb::$user->lang;
// These _are_ used the included files.
$_tpldata; $_rootref; $_lang;
***************
*** 184,189 ****
--- 201,211 ----
/**
* Display the handle and assign the output to a template variable or return the compiled result.
* @access public
+ * @param string $handle Handle to operate on
+ * @param string $template_var Template variable to assign compiled handle to
+ * @param bool $return_content If true return compiled handle, otherwise assign to $template_var
+ * @param bool $include_once Allow multiple inclusions of the file
+ * @return bool|string If $return_content is true return string of the compiled handle, otherwise return true
*/
public function assign_display($handle, $template_var = '', $return_content = true, $include_once = false)
{
***************
*** 204,217 ****
/**
* Load a compiled template if possible, if not, recompile it
* @access private
*/
! private function _tpl_load(&$handle)
{
- global $config;
-
$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 page if the original template is newer, otherwise load the compiled version
if ($recompile)
--- 226,245 ----
/**
* Load a compiled template if possible, if not, recompile it
* @access private
+ * @param string $handle Handle of the template to load
+ * @return string|bool Return filename on success otherwise false
+ * @uses template_compile is used to compile uncached templates
*/
! private function _tpl_load($handle)
{
$filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . '.' . PHP_EXT;
! $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
if ($recompile)
***************
*** 236,246 ****
/**
* This code should only run when some high level error prevents us from writing to the cache.
* @access private
*/
! private function _tpl_eval(&$handle)
{
- // global $user, $config;
-
$compile = new phpbb_template_compile($this);
// If we don't have a file assigned to this handle, die.
--- 264,275 ----
/**
* This code should only run when some high level error prevents us from writing to the cache.
* @access private
+ * @param string $handle Template handle to compile
+ * @return string|bool Return compiled code on success otherwise false
+ * @uses template_compile is used to compile template
*/
! private function _tpl_eval($handle)
{
$compile = new phpbb_template_compile($this);
// If we don't have a file assigned to this handle, die.
***************
*** 260,265 ****
--- 289,295 ----
/**
* Assign key variable pairs from an array
* @access public
+ * @param array $vararray A hash of variable name => value pairs
*/
public function assign_vars(array $vararray)
{
***************
*** 267,290 ****
{
$this->_rootref[$key] = $val;
}
-
- return true;
}
/**
* Assign a single variable to a single key
* @access public
*/
public function assign_var($varname, $varval)
{
$this->_rootref[$varname] = $varval;
-
- return true;
}
/**
* Assign key variable pairs from an array to a specified block
* @access public
*/
public function assign_block_vars($blockname, array $vararray)
{
--- 297,320 ----
{
$this->_rootref[$key] = $val;
}
}
/**
* Assign a single variable to a single key
* @access public
+ * @param string $varname Variable name
+ * @param string $varval Value to assign to variable
*/
public function assign_var($varname, $varval)
{
$this->_rootref[$varname] = $varval;
}
/**
* Assign key variable pairs from an array to a specified block
* @access public
+ * @param string $blockname Name of block to assign $vararray to
+ * @param array $vararray A hash of variable name => value pairs
*/
public function assign_block_vars($blockname, array $vararray)
{
***************
*** 313,327 ****
// Add a new iteration to this block with the variable assignments we were given.
$this->_tpldata[$blockname][] = $vararray;
}
-
- return true;
}
/**
* Change already assigned key variable pair (one-dimensional - single loop entry)
*
* An example of how to use this function:
- * {@example alter_block_array.php}
*
* @param string $blockname the blockname, for example 'loop'
* @param array $vararray the var array to insert/add or merge
--- 343,354 ----
***************
*** 349,362 ****
{
if (strpos($blockname, '.') !== false)
{
! // Nested blocks are not supported
! return false;
}
// Change key to zero (change first position) if false and to last position if true
if ($key === false || $key === true)
{
! $key = ($key === false) ? 0 : sizeof($this->_tpldata[$blockname]);
}
// Get correct position if array given
--- 376,422 ----
{
if (strpos($blockname, '.') !== false)
{
! // Nested block.
! $blocks = explode('.', $blockname);
! $blockcount = sizeof($blocks) - 1;
!
! $block = &$this->_tpldata;
! for ($i = 0; $i < $blockcount; $i++)
! {
! if (($pos = strpos($blocks[$i], '[')) !== false)
! {
! $name = substr($blocks[$i], 0, $pos);
!
! if (strpos($blocks[$i], '[]') === $pos)
! {
! $index = sizeof($block[$name]) - 1;
! }
! else
! {
! $index = min((int) substr($blocks[$i], $pos + 1, -1), sizeof($block[$name]) - 1);
! }
! }
! else
! {
! $name = $blocks[$i];
! $index = sizeof($block[$name]) - 1;
! }
! $block = &$block[$name];
! $block = &$block[$index];
! }
!
! $block = &$block[$blocks[$i]]; // Traverse the last block
! }
! else
! {
! // Top-level block.
! $block = &$this->_tpldata[$blockname];
}
// Change key to zero (change first position) if false and to last position if true
if ($key === false || $key === true)
...
[truncated message content] |
Modified: branches/acydburn/phpBB/includes/functions.php
==============================================================================
*** branches/acydburn/phpBB/includes/functions.php (original)
--- branches/acydburn/phpBB/includes/functions.php Thu Dec 11 17:40:32 2008
***************
*** 33,135 ****
}
/**
- * set_var
- *
- * Set variable, used by {@link request_var the request_var function}
- *
- * @access private
- */
- function set_var(&$result, $var, $type, $multibyte = false)
- {
- settype($var, $type);
- $result = $var;
-
- if ($type == 'string')
- {
- $result = trim(utf8_htmlspecialchars(str_replace(array("\r\n", "\r", "\0"), array("\n", "\n", ''), $result)));
-
- if (!empty($result))
- {
- // Make sure multibyte characters are wellformed
- if ($multibyte)
- {
- if (!preg_match('/^./u', $result))
- {
- $result = '';
- }
- }
- else
- {
- // no multibyte, allow only ASCII (0-127)
- $result = preg_replace('/[\x80-\xFF]/', '?', $result);
- }
- }
-
- $result = (STRIP) ? stripslashes($result) : $result;
- }
- }
-
- /**
* Set config value. Creates missing config entry.
*/
function set_config($config_name, $config_value, $is_dynamic = false)
{
- global $db, $cache, $config;
-
$sql = 'UPDATE ' . CONFIG_TABLE . "
! SET config_value = '" . $db->sql_escape($config_value) . "'
! WHERE config_name = '" . $db->sql_escape($config_name) . "'";
! $db->sql_query($sql);
! if (!$db->sql_affectedrows() && !isset($config[$config_name]))
{
! $sql = 'INSERT INTO ' . CONFIG_TABLE . ' ' . $db->sql_build_array('INSERT', array(
'config_name' => $config_name,
'config_value' => $config_value,
'is_dynamic' => ($is_dynamic) ? 1 : 0));
! $db->sql_query($sql);
}
$config[$config_name] = $config_value;
if (!$is_dynamic)
{
! $cache->destroy('config');
! }
! }
!
! /**
! * Generates an alphanumeric random string of given length
! */
! function gen_rand_string($num_chars = 8)
! {
! $rand_str = unique_id();
! $rand_str = str_replace('0', 'Z', strtoupper(base_convert($rand_str, 16, 35)));
!
! return substr($rand_str, 0, $num_chars);
! }
!
! /**
! * Return unique id
! * @param string $extra additional entropy
! */
! function unique_id($extra = 'c')
! {
! static $dss_seeded = false;
! global $config;
!
! $val = $config['rand_seed'] . microtime();
! $val = md5($val);
! $config['rand_seed'] = md5($config['rand_seed'] . $val . $extra);
!
! if ($dss_seeded !== true && ($config['rand_seed_last_update'] < time() - rand(1,10)))
! {
! set_config('rand_seed', $config['rand_seed'], true);
! set_config('rand_seed_last_update', time(), true);
! $dss_seeded = true;
}
-
- return substr($val, 4, 16);
}
/**
--- 33,62 ----
}
/**
* Set config value. Creates missing config entry.
*/
function set_config($config_name, $config_value, $is_dynamic = false)
{
$sql = 'UPDATE ' . CONFIG_TABLE . "
! SET config_value = '" . phpbb::$db->sql_escape($config_value) . "'
! WHERE config_name = '" . phpbb::$db->sql_escape($config_name) . "'";
! phpbb::$db->sql_query($sql);
! if (!phpbb::$db->sql_affectedrows() && !isset(phpbb::$config[$config_name]))
{
! $sql = 'INSERT INTO ' . CONFIG_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', array(
'config_name' => $config_name,
'config_value' => $config_value,
'is_dynamic' => ($is_dynamic) ? 1 : 0));
! phpbb::$db->sql_query($sql);
}
$config[$config_name] = $config_value;
if (!$is_dynamic)
{
! phpbb::$acm->destroy('#config');
}
}
/**
***************
*** 188,387 ****
}
/**
- *
- * @version Version 0.1 / $Id$
- *
- * Portable PHP password hashing framework.
- *
- * Written by Solar Designer <solar at openwall.com> in 2004-2006 and placed in
- * the public domain.
- *
- * There's absolutely no warranty.
- *
- * The homepage URL for this framework is:
- *
- * http://www.openwall.com/phpass/
- *
- * Please be sure to update the Version line if you edit this file in any way.
- * It is suggested that you leave the main version number intact, but indicate
- * your project name (after the slash) and add your own revision information.
- *
- * Please do not change the "private" password hashing method implemented in
- * here, thereby making your hashes incompatible. However, if you must, please
- * change the hash type identifier (the "$P$") to something different.
- *
- * Obviously, since this code is in the public domain, the above are not
- * requirements (there can be none), but merely suggestions.
- *
- *
- * Hash the password
- */
- function phpbb_hash($password)
- {
- $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
-
- $random_state = unique_id();
- $random = '';
- $count = 6;
-
- if (($fh = @fopen('/dev/urandom', 'rb')))
- {
- $random = fread($fh, $count);
- fclose($fh);
- }
-
- if (strlen($random) < $count)
- {
- $random = '';
-
- for ($i = 0; $i < $count; $i += 16)
- {
- $random_state = md5(unique_id() . $random_state);
- $random .= pack('H*', md5($random_state));
- }
- $random = substr($random, 0, $count);
- }
-
- $hash = _hash_crypt_private($password, _hash_gensalt_private($random, $itoa64), $itoa64);
-
- if (strlen($hash) == 34)
- {
- return $hash;
- }
-
- return md5($password);
- }
-
- /**
- * Check for correct password
- *
- * @param string $password The password in plain text
- * @param string $hash The stored password hash
- *
- * @return bool Returns true if the password is correct, false if not.
- */
- function phpbb_check_hash($password, $hash)
- {
- $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
- if (strlen($hash) == 34)
- {
- return (_hash_crypt_private($password, $hash, $itoa64) === $hash) ? true : false;
- }
-
- return (md5($password) === $hash) ? true : false;
- }
-
- /**
- * Generate salt for hash generation
- */
- function _hash_gensalt_private($input, &$itoa64, $iteration_count_log2 = 6)
- {
- if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31)
- {
- $iteration_count_log2 = 8;
- }
-
- $output = '$H$';
- $output .= $itoa64[min($iteration_count_log2 + 5, 30)];
- $output .= _hash_encode64($input, 6, $itoa64);
-
- return $output;
- }
-
- /**
- * Encode hash
- */
- function _hash_encode64($input, $count, &$itoa64)
- {
- $output = '';
- $i = 0;
-
- do
- {
- $value = ord($input[$i++]);
- $output .= $itoa64[$value & 0x3f];
-
- if ($i < $count)
- {
- $value |= ord($input[$i]) << 8;
- }
-
- $output .= $itoa64[($value >> 6) & 0x3f];
-
- if ($i++ >= $count)
- {
- break;
- }
-
- if ($i < $count)
- {
- $value |= ord($input[$i]) << 16;
- }
-
- $output .= $itoa64[($value >> 12) & 0x3f];
-
- if ($i++ >= $count)
- {
- break;
- }
-
- $output .= $itoa64[($value >> 18) & 0x3f];
- }
- while ($i < $count);
-
- return $output;
- }
-
- /**
- * The crypt function/replacement
- */
- function _hash_crypt_private($password, $setting, &$itoa64)
- {
- $output = '*';
-
- // Check for correct hash
- if (substr($setting, 0, 3) != '$H$')
- {
- return $output;
- }
-
- $count_log2 = strpos($itoa64, $setting[3]);
-
- if ($count_log2 < 7 || $count_log2 > 30)
- {
- return $output;
- }
-
- $count = 1 << $count_log2;
- $salt = substr($setting, 4, 8);
-
- if (strlen($salt) != 8)
- {
- return $output;
- }
-
- /**
- * We're kind of forced to use MD5 here since it's the only
- * cryptographic primitive available in all versions of PHP
- * currently in use. To implement our own low-level crypto
- * in PHP would result in much worse performance and
- * consequently in lower iteration counts and hashes that are
- * quicker to crack (by non-PHP code).
- */
- $hash = md5($salt . $password, true);
- do
- {
- $hash = md5($hash . $password, true);
- }
- while (--$count);
-
- $output = substr($setting, 0, 12);
- $output .= _hash_encode64($hash, 16, $itoa64);
-
- return $output;
- }
-
- /**
* Global function for chmodding directories and files for internal use
* This function determines owner and group whom the file belongs to and user and group of PHP and then set safest possible file permissions.
* The function determines owner and group from common.php file and sets the same to the provided file.
--- 115,120 ----
***************
*** 515,725 ****
return $result;
}
- /*
- * Checks if a path ($path) is absolute or relative
- *
- * @param string $path Path to check absoluteness of
- * @return boolean
- */
- function is_absolute($path)
- {
- return ($path[0] == '/' || (DIRECTORY_SEPARATOR == '\\' && preg_match('#^[a-z]:/#i', $path))) ? true : false;
- }
-
- /**
- * @author Chris Smith <ch...@pr...>
- * @copyright 2006 Project Minerva Team
- * @param string $path The path which we should attempt to resolve.
- * @return mixed
- */
- function phpbb_own_realpath($path)
- {
- // Now to perform funky shizzle
-
- // Switch to use UNIX slashes
- $path = str_replace(DIRECTORY_SEPARATOR, '/', $path);
- $path_prefix = '';
-
- // Determine what sort of path we have
- if (is_absolute($path))
- {
- $absolute = true;
-
- if ($path[0] == '/')
- {
- // Absolute path, *NIX style
- $path_prefix = '';
- }
- else
- {
- // Absolute path, Windows style
- // Remove the drive letter and colon
- $path_prefix = $path[0] . ':';
- $path = substr($path, 2);
- }
- }
- else
- {
- // Relative Path
- // Prepend the current working directory
- if (function_exists('getcwd'))
- {
- // This is the best method, hopefully it is enabled!
- $path = str_replace(DIRECTORY_SEPARATOR, '/', getcwd()) . '/' . $path;
- $absolute = true;
- if (preg_match('#^[a-z]:#i', $path))
- {
- $path_prefix = $path[0] . ':';
- $path = substr($path, 2);
- }
- else
- {
- $path_prefix = '';
- }
- }
- else if (isset($_SERVER['SCRIPT_FILENAME']) && !empty($_SERVER['SCRIPT_FILENAME']))
- {
- // Warning: If chdir() has been used this will lie!
- // Warning: This has some problems sometime (CLI can create them easily)
- $path = str_replace(DIRECTORY_SEPARATOR, '/', dirname($_SERVER['SCRIPT_FILENAME'])) . '/' . $path;
- $absolute = true;
- $path_prefix = '';
- }
- else
- {
- // We have no way of getting the absolute path, just run on using relative ones.
- $absolute = false;
- $path_prefix = '.';
- }
- }
-
- // Remove any repeated slashes
- $path = preg_replace('#/{2,}#', '/', $path);
-
- // Remove the slashes from the start and end of the path
- $path = trim($path, '/');
-
- // Break the string into little bits for us to nibble on
- $bits = explode('/', $path);
-
- // Remove any . in the path, renumber array for the loop below
- $bits = array_values(array_diff($bits, array('.')));
-
- // Lets get looping, run over and resolve any .. (up directory)
- for ($i = 0, $max = sizeof($bits); $i < $max; $i++)
- {
- // @todo Optimise
- if ($bits[$i] == '..' )
- {
- if (isset($bits[$i - 1]))
- {
- if ($bits[$i - 1] != '..')
- {
- // We found a .. and we are able to traverse upwards, lets do it!
- unset($bits[$i]);
- unset($bits[$i - 1]);
- $i -= 2;
- $max -= 2;
- $bits = array_values($bits);
- }
- }
- else if ($absolute) // ie. !isset($bits[$i - 1]) && $absolute
- {
- // We have an absolute path trying to descend above the root of the filesystem
- // ... Error!
- return false;
- }
- }
- }
-
- // Prepend the path prefix
- array_unshift($bits, $path_prefix);
-
- $resolved = '';
-
- $max = sizeof($bits) - 1;
-
- // Check if we are able to resolve symlinks, Windows cannot.
- $symlink_resolve = (function_exists('readlink')) ? true : false;
-
- foreach ($bits as $i => $bit)
- {
- if (@is_dir("$resolved/$bit") || ($i == $max && @is_file("$resolved/$bit")))
- {
- // Path Exists
- if ($symlink_resolve && is_link("$resolved/$bit") && ($link = readlink("$resolved/$bit")))
- {
- // Resolved a symlink.
- $resolved = $link . (($i == $max) ? '' : '/');
- continue;
- }
- }
- else
- {
- // Something doesn't exist here!
- // This is correct realpath() behaviour but sadly open_basedir and safe_mode make this problematic
- // return false;
- }
- $resolved .= $bit . (($i == $max) ? '' : '/');
- }
-
- // @todo If the file exists fine and open_basedir only has one path we should be able to prepend it
- // because we must be inside that basedir, the question is where...
- // @internal The slash in is_dir() gets around an open_basedir restriction
- if (!@file_exists($resolved) || (!is_dir($resolved . '/') && !is_file($resolved)))
- {
- return false;
- }
-
- // Put the slashes back to the native operating systems slashes
- $resolved = str_replace('/', DIRECTORY_SEPARATOR, $resolved);
-
- // Check for DIRECTORY_SEPARATOR at the end (and remove it!)
- if (substr($resolved, -1) == DIRECTORY_SEPARATOR)
- {
- return substr($resolved, 0, -1);
- }
-
- return $resolved; // We got here, in the end!
- }
-
- if (!function_exists('realpath'))
- {
- /**
- * A wrapper for realpath
- * @ignore
- */
- function phpbb_realpath($path)
- {
- return phpbb_own_realpath($path);
- }
- }
- else
- {
- /**
- * A wrapper for realpath
- */
- function phpbb_realpath($path)
- {
- $realpath = realpath($path);
-
- // Strangely there are provider not disabling realpath but returning strange values. :o
- // We at least try to cope with them.
- if ($realpath === $path || $realpath === false)
- {
- return phpbb_own_realpath($path);
- }
-
- // Check for DIRECTORY_SEPARATOR at the end (and remove it!)
- if (substr($realpath, -1) == DIRECTORY_SEPARATOR)
- {
- $realpath = substr($realpath, 0, -1);
- }
-
- return $realpath;
- }
- }
-
// functions used for building option fields
/**
--- 248,253 ----
***************
*** 1605,2148 ****
return sprintf($user->lang['PAGE_OF'], $on_page, max(ceil($num_items / $per_page), 1));
}
- // Server functions (building urls, redirecting...)
-
- /**
- * Append session id to url.
- * This function supports hooks.
- *
- * @param string $url The url the session id needs to be appended to (can have params)
- * @param mixed $params String or array of additional url parameters
- * @param bool $is_amp Is url using & (true) or & (false)
- * @param string $session_id Possibility to use a custom session id instead of the global one
- *
- * Examples:
- * <code>
- * append_sid(PHPBB_ROOT_PATH . 'viewtopic.' . PHP_EXT . '?t=1&f=2');
- * append_sid(PHPBB_ROOT_PATH . 'viewtopic.' . PHP_EXT, 't=1&f=2');
- * append_sid('viewtopic', 't=1&f=2'); // short notation of the above example
- * append_sid('viewtopic', 't=1&f=2', false);
- * append_sid('viewtopic', array('t' => 1, 'f' => 2));
- * </code>
- *
- */
- function append_sid($url, $params = false, $is_amp = true, $session_id = false)
- {
- global $_SID, $_EXTRA_URL, $phpbb_hook;
- static $parsed_urls = array();
-
- // Adjust internal url before calling the hook - we are able to just leave out any path and extension.
- // In this case the root path and extension are added before going through this function.
- if (isset($parsed_urls[$url]))
- {
- $url = $parsed_urls[$url];
- }
- else
- {
- if (strpos($url, '.' . PHP_EXT) === false && $url[0] != '.' && $url[0] != '/')
- {
- $parsed_urls[$url] = $url = PHPBB_ROOT_PATH . $url . '.' . PHP_EXT;
- }
- }
-
- if (empty($params))
- {
- $params = false;
- }
-
- // Developers using the hook function need to globalise the $_SID and $_EXTRA_URL on their own and also handle it appropiatly.
- // They could mimick most of what is within this function
- if (!empty($phpbb_hook) && $phpbb_hook->call_hook(__FUNCTION__, $url, $params, $is_amp, $session_id))
- {
- if ($phpbb_hook->hook_return(__FUNCTION__))
- {
- return $phpbb_hook->hook_return_result(__FUNCTION__);
- }
- }
-
- // Assign sid if session id is not specified
- if ($session_id === false)
- {
- $session_id = $_SID;
- }
-
- $amp_delim = ($is_amp) ? '&' : '&';
- $url_delim = (strpos($url, '?') === false) ? '?' : $amp_delim;
-
- // Appending custom url parameter?
- $append_url = (!empty($_EXTRA_URL)) ? implode($amp_delim, $_EXTRA_URL) : '';
-
- $anchor = '';
- if (strpos($url, '#') !== false)
- {
- list($url, $anchor) = explode('#', $url, 2);
- $anchor = '#' . $anchor;
- }
- else if (!is_array($params) && strpos($params, '#') !== false)
- {
- list($params, $anchor) = explode('#', $params, 2);
- $anchor = '#' . $anchor;
- }
-
- // Use the short variant if possible ;)
- if ($params === false)
- {
- // Append session id
- if (!$session_id)
- {
- return $url . (($append_url) ? $url_delim . $append_url : '') . $anchor;
- }
- else
- {
- return $url . (($append_url) ? $url_delim . $append_url . $amp_delim : $url_delim) . 'sid=' . $session_id . $anchor;
- }
- }
-
- // Build string if parameters are specified as array
- if (is_array($params))
- {
- $output = array();
-
- foreach ($params as $key => $item)
- {
- if ($item === NULL)
- {
- continue;
- }
-
- if ($key == '#')
- {
- $anchor = '#' . $item;
- continue;
- }
-
- $output[] = $key . '=' . $item;
- }
-
- $params = implode($amp_delim, $output);
- }
-
- // Append session id and parameters (even if they are empty)
- // If parameters are empty, the developer can still append his/her parameters without caring about the delimiter
- return $url . (($append_url) ? $url_delim . $append_url . $amp_delim : $url_delim) . $params . ((!$session_id) ? '' : $amp_delim . 'sid=' . $session_id) . $anchor;
- }
-
- /**
- * Generate board url (example: http://www.example.com/phpBB)
- * @param bool $without_script_path if set to true the script path gets not appended (example: http://www.example.com)
- */
- function generate_board_url($without_script_path = false)
- {
- global $config, $user;
-
- $server_name = $user->host;
- $server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT');
-
- // Forcing server vars is the only way to specify/override the protocol
- if ($config['force_server_vars'] || !$server_name)
- {
- $server_protocol = ($config['server_protocol']) ? $config['server_protocol'] : (($config['cookie_secure']) ? 'https://' : 'http://');
- $server_name = $config['server_name'];
- $server_port = (int) $config['server_port'];
- $script_path = $config['script_path'];
-
- $url = $server_protocol . $server_name;
- $cookie_secure = $config['cookie_secure'];
- }
- else
- {
- // Do not rely on cookie_secure, users seem to think that it means a secured cookie instead of an encrypted connection
- $cookie_secure = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 1 : 0;
- $url = (($cookie_secure) ? 'https://' : 'http://') . $server_name;
-
- $script_path = $user->page['root_script_path'];
- }
-
- if ($server_port && (($cookie_secure && $server_port <> 443) || (!$cookie_secure && $server_port <> 80)))
- {
- // HTTP HOST can carry a port number (we fetch $user->host, but for old versions this may be true)
- if (strpos($server_name, ':') === false)
- {
- $url .= ':' . $server_port;
- }
- }
-
- if (!$without_script_path)
- {
- $url .= $script_path;
- }
-
- // Strip / from the end
- if (substr($url, -1, 1) == '/')
- {
- $url = substr($url, 0, -1);
- }
-
- return $url;
- }
-
- /**
- * Redirects the user to another page then exits the script nicely
- * This function is intended for urls within the board. It's not meant to redirect to cross-domains.
- *
- * @param string $url The url to redirect to
- * @param bool $return If true, do not redirect but return the sanitized URL. Default is no return.
- * @param bool $disable_cd_check If true, redirect() will redirect to an external domain. If false, the redirect point to the boards url if it does not match the current domain. Default is false.
- */
- function redirect($url, $return = false, $disable_cd_check = false)
- {
- global $db, $cache, $config, $user;
-
- if (empty($user->lang))
- {
- $user->add_lang('common');
- }
-
- if (!$return)
- {
- garbage_collection();
- }
-
- // Make sure no &'s are in, this will break the redirect
- $url = str_replace('&', '&', $url);
-
- // Determine which type of redirect we need to handle...
- $url_parts = parse_url($url);
-
- if ($url_parts === false)
- {
- // Malformed url, redirect to current page...
- $url = generate_board_url() . '/' . $user->page['page'];
- }
- else if (!empty($url_parts['scheme']) && !empty($url_parts['host']))
- {
- // Attention: only able to redirect within the same domain if $disable_cd_check is false (yourdomain.com -> www.yourdomain.com will not work)
- if (!$disable_cd_check && $url_parts['host'] !== $user->host)
- {
- $url = generate_board_url();
- }
- }
- else if ($url[0] == '/')
- {
- // Absolute uri, prepend direct url...
- $url = generate_board_url(true) . $url;
- }
- else
- {
- // Relative uri
- $pathinfo = pathinfo($url);
-
- // Is the uri pointing to the current directory?
- if ($pathinfo['dirname'] == '.')
- {
- $url = str_replace('./', '', $url);
-
- // Strip / from the beginning
- if ($url && substr($url, 0, 1) == '/')
- {
- $url = substr($url, 1);
- }
-
- if ($user->page['page_dir'])
- {
- $url = generate_board_url() . '/' . $user->page['page_dir'] . '/' . $url;
- }
- else
- {
- $url = generate_board_url() . '/' . $url;
- }
- }
- else
- {
- // Used ./ before, but PHPBB_ROOT_PATH is working better with urls within another root path
- $root_dirs = explode('/', str_replace('\\', '/', phpbb_realpath(PHPBB_ROOT_PATH)));
- $page_dirs = explode('/', str_replace('\\', '/', phpbb_realpath($pathinfo['dirname'])));
- $intersection = array_intersect_assoc($root_dirs, $page_dirs);
-
- $root_dirs = array_diff_assoc($root_dirs, $intersection);
- $page_dirs = array_diff_assoc($page_dirs, $intersection);
-
- $dir = str_repeat('../', sizeof($root_dirs)) . implode('/', $page_dirs);
-
- // Strip / from the end
- if ($dir && substr($dir, -1, 1) == '/')
- {
- $dir = substr($dir, 0, -1);
- }
-
- // Strip / from the beginning
- if ($dir && substr($dir, 0, 1) == '/')
- {
- $dir = substr($dir, 1);
- }
-
- $url = str_replace($pathinfo['dirname'] . '/', '', $url);
-
- // Strip / from the beginning
- if (substr($url, 0, 1) == '/')
- {
- $url = substr($url, 1);
- }
-
- $url = (!empty($dir) ? $dir . '/' : '') . $url;
- $url = generate_board_url() . '/' . $url;
- }
- }
-
- // Make sure no linebreaks are there... to prevent http response splitting for PHP < 4.4.2
- if (strpos(urldecode($url), "\n") !== false || strpos(urldecode($url), "\r") !== false || strpos($url, ';') !== false)
- {
- trigger_error('Tried to redirect to potentially insecure url.', E_USER_ERROR);
- }
-
- // Now, also check the protocol and for a valid url the last time...
- $allowed_protocols = array('http', 'https', 'ftp', 'ftps');
- $url_parts = parse_url($url);
-
- if ($url_parts === false || empty($url_parts['scheme']) || !in_array($url_parts['scheme'], $allowed_protocols))
- {
- trigger_error('Tried to redirect to potentially insecure url.', E_USER_ERROR);
- }
-
- if ($return)
- {
- return $url;
- }
-
- // Redirect via an HTML form for PITA webservers
- if (@preg_match('#Microsoft|WebSTAR|Xitami#', getenv('SERVER_SOFTWARE')))
- {
- header('Refresh: 0; URL=' . $url);
-
- echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
- echo '<html xmlns="http://www.w3.org/1999/xhtml" dir="' . $user->lang['DIRECTION'] . '" lang="' . $user->lang['USER_LANG'] . '" xml:lang="' . $user->lang['USER_LANG'] . '">';
- echo '<head>';
- echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
- echo '<meta http-equiv="refresh" content="0; url=' . str_replace('&', '&', $url) . '" />';
- echo '<title>' . $user->lang['REDIRECT'] . '</title>';
- echo '</head>';
- echo '<body>';
- echo '<div style="text-align: center;">' . sprintf($user->lang['URL_REDIRECT'], '<a href="' . str_replace('&', '&', $url) . '">', '</a>') . '</div>';
- echo '</body>';
- echo '</html>';
-
- exit;
- }
-
- // Behave as per HTTP/1.1 spec for others
- header('Location: ' . $url);
- exit;
- }
-
- /**
- * Re-Apply session id after page reloads
- */
- function reapply_sid($url)
- {
- if ($url === 'index.' . PHP_EXT)
- {
- return append_sid('index.' . PHP_EXT);
- }
- else if ($url === PHPBB_ROOT_PATH . 'index.' . PHP_EXT)
- {
- return append_sid('index');
- }
-
- // Remove previously added sid
- if (strpos($url, '?sid=') !== false)
- {
- $url = preg_replace('/(\?)sid=[a-z0-9]+(&|&)?/', '\1', $url);
- }
- else if (strpos($url, '&sid=') !== false)
- {
- $url = preg_replace('/&sid=[a-z0-9]+(&)?/', '\1', $url);
- }
- else if (strpos($url, '&sid=') !== false)
- {
- $url = preg_replace('/&sid=[a-z0-9]+(&)?/', '\1', $url);
- }
-
- return append_sid($url);
- }
-
- /**
- * Returns url from the session/current page with an re-appended SID with optionally stripping vars from the url
- */
- function build_url($strip_vars = false)
- {
- global $user;
-
- // Append SID
- $redirect = append_sid($user->page['page'], false, false);
-
- // Add delimiter if not there...
- if (strpos($redirect, '?') === false)
- {
- $redirect .= '?';
- }
-
- // Strip vars...
- if ($strip_vars !== false && strpos($redirect, '?') !== false)
- {
- if (!is_array($strip_vars))
- {
- $strip_vars = array($strip_vars);
- }
-
- $query = $_query = array();
-
- $args = substr($redirect, strpos($redirect, '?') + 1);
- $args = ($args) ? explode('&', $args) : array();
- $redirect = substr($redirect, 0, strpos($redirect, '?'));
-
- foreach ($args as $argument)
- {
- $arguments = explode('=', $argument);
- $key = $arguments[0];
- unset($arguments[0]);
-
- $query[$key] = implode('=', $arguments);
- }
-
- // Strip the vars off
- foreach ($strip_vars as $strip)
- {
- if (isset($query[$strip]))
- {
- unset($query[$strip]);
- }
- }
-
- // Glue the remaining parts together... already urlencoded
- foreach ($query as $key => $value)
- {
- $_query[] = $key . '=' . $value;
- }
- $query = implode('&', $_query);
-
- $redirect .= ($query) ? '?' . $query : '';
- }
-
- return PHPBB_ROOT_PATH . str_replace('&', '&', $redirect);
- }
-
- /**
- * Meta refresh assignment
- */
- function meta_refresh($time, $url)
- {
- global $template;
-
- $url = redirect($url, true);
- $url = str_replace('&', '&', $url);
-
- // For XHTML compatibility we change back & to &
- $template->assign_vars(array(
- 'META' => '<meta http-equiv="refresh" content="' . $time . ';url=' . $url . '" />')
- );
-
- return $url;
- }
-
//Form validation
- /**
- * Add a secret hash for use in links/GET requests
- * @param string $link_name The name of the link; has to match the name used in check_link_hash, otherwise no restrictions apply
- * @return string the hash
-
- */
- function generate_link_hash($link_name)
- {
- global $user;
-
- if (!isset($user->data["hash_$link_name"]))
- {
- $user->data["hash_$link_name"] = substr(sha1($user->data['user_form_salt'] . $link_name), 0, 8);
- }
-
- return $user->data["hash_$link_name"];
- }
-
-
- /**
- * checks a link hash - for GET requests
- * @param string $token the submitted token
- * @param string $link_name The name of the link
- * @return boolean true if all is fine
- */
- function check_link_hash($token, $link_name)
- {
- return $token === generate_link_hash($link_name);
- }
-
- /**
- * Add a secret token to the form (requires the S_FORM_TOKEN template variable)
- * @param string $form_name The name of the form; has to match the name used in check_form_key, otherwise no restrictions apply
- */
- function add_form_key($form_name)
- {
- global $config, $template, $user;
-
- $now = time();
- $token_sid = ($user->data['user_id'] == ANONYMOUS && !empty($config['form_token_sid_guests'])) ? $user->session_id : '';
- $token = sha1($now . $user->data['user_form_salt'] . $form_name . $token_sid);
-
- $s_fields = build_hidden_fields(array(
- 'creation_time' => $now,
- 'form_token' => $token,
- ));
-
- $template->assign_vars(array(
- 'S_FORM_TOKEN' => $s_fields,
- ));
- }
-
- /**
- * Check the form key. Required for all altering actions not secured by confirm_box
- * @param string $form_name The name of the form; has to match the name used in add_form_key, otherwise no restrictions apply
- * @param int $timespan The maximum acceptable age for a submitted form in seconds. Defaults to the config setting.
- * @param string $return_page The address for the return link
- * @param bool $trigger If true, the function will triger an error when encountering an invalid form
- */
- function check_form_key($form_name, $timespan = false, $return_page = '', $trigger = false)
- {
- global $config, $user;
-
- if ($timespan === false)
- {
- // we enforce a minimum value of half a minute here.
- $timespan = ($config['form_token_lifetime'] == -1) ? -1 : max(30, $config['form_token_lifetime']);
- }
-
- if (request::is_set_post('creation_time') && request::is_set_post('form_token'))
- {
- $creation_time = abs(request_var('creation_time', 0));
- $token = request_var('form_token', '');
-
- $diff = time() - $creation_time;
-
- // If creation_time and the time() now is zero we can assume it was not a human doing this (the check for if ($diff)...
- if ($diff && ($diff <= $timespan || $timespan === -1))
- {
- $token_sid = ($user->data['user_id'] == ANONYMOUS && !empty($config['form_token_sid_guests'])) ? $user->session_id : '';
- $key = sha1($creation_time . $user->data['user_form_salt'] . $form_name . $token_sid);
-
- ...
[truncated message content] |
Modified: branches/acydburn/phpBB/includes/functions_posting.php
==============================================================================
*** branches/acydburn/phpBB/includes/functions_posting.php (original)
--- branches/acydburn/phpBB/includes/functions_posting.php Thu Dec 11 17:40:32 2008
***************
*** 248,254 ****
global $config, $template, $cache;
// Grab icons
! $icons = cache::obtain_icons();
if (!$icon_id)
{
--- 248,254 ----
global $config, $template, $cache;
// Grab icons
! $icons = phpbb_cache::obtain_icons();
if (!$icon_id)
{
***************
*** 376,382 ****
return $filedata;
}
! $extensions = cache::obtain_attach_extensions((($is_message) ? false : (int) $forum_id));
$upload->set_allowed_extensions(array_keys($extensions['_allowed_']));
$file = ($local) ? $upload->local_upload($local_storage, $local_filedata) : $upload->form_upload($form_name);
--- 376,382 ----
return $filedata;
}
! $extensions = phpbb_cache::obtain_attach_extensions((($is_message) ? false : (int) $forum_id));
$upload->set_allowed_extensions(array_keys($extensions['_allowed_']));
$file = ($local) ? $upload->local_upload($local_storage, $local_filedata) : $upload->form_upload($form_name);
***************
*** 998,1004 ****
$extensions = $attachments = array();
if ($has_attachments && $auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id))
{
! $extensions = cache::obtain_attach_extensions($forum_id);
// Get attachments...
$sql = 'SELECT *
--- 998,1004 ----
$extensions = $attachments = array();
if ($has_attachments && $auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id))
{
! $extensions = phpbb_cache::obtain_attach_extensions($forum_id);
// Get attachments...
$sql = 'SELECT *
Modified: branches/acydburn/phpBB/includes/functions_user.php
==============================================================================
*** branches/acydburn/phpBB/includes/functions_user.php (original)
--- branches/acydburn/phpBB/includes/functions_user.php Thu Dec 11 17:40:32 2008
***************
*** 1420,1426 ****
return 'USERNAME_TAKEN';
}
! $bad_usernames = cache::obtain_disallowed_usernames();
foreach ($bad_usernames as $bad_username)
{
--- 1420,1426 ----
return 'USERNAME_TAKEN';
}
! $bad_usernames = phpbb_cache::obtain_disallowed_usernames();
foreach ($bad_usernames as $bad_username)
{
Modified: branches/acydburn/phpBB/includes/mcp/mcp_forum.php
==============================================================================
*** branches/acydburn/phpBB/includes/mcp/mcp_forum.php (original)
--- branches/acydburn/phpBB/includes/mcp/mcp_forum.php Thu Dec 11 17:40:32 2008
***************
*** 134,140 ****
));
// Grab icons
! $icons = cache::obtain_icons();
$topic_rows = array();
--- 134,140 ----
));
// Grab icons
! $icons = phpbb_cache::obtain_icons();
$topic_rows = array();
Modified: branches/acydburn/phpBB/includes/mcp/mcp_post.php
==============================================================================
*** branches/acydburn/phpBB/includes/mcp/mcp_post.php (original)
--- branches/acydburn/phpBB/includes/mcp/mcp_post.php Thu Dec 11 17:40:32 2008
***************
*** 140,146 ****
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
{
! $extensions = cache::obtain_attach_extensions($post_info['forum_id']);
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
--- 140,146 ----
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
{
! $extensions = phpbb_cache::obtain_attach_extensions($post_info['forum_id']);
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
Modified: branches/acydburn/phpBB/includes/mcp/mcp_queue.php
==============================================================================
*** branches/acydburn/phpBB/includes/mcp/mcp_queue.php (original)
--- branches/acydburn/phpBB/includes/mcp/mcp_queue.php Thu Dec 11 17:40:32 2008
***************
*** 140,146 ****
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
{
! $extensions = cache::obtain_attach_extensions($post_info['forum_id']);
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
--- 140,146 ----
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
{
! $extensions = phpbb_cache::obtain_attach_extensions($post_info['forum_id']);
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
Modified: branches/acydburn/phpBB/includes/mcp/mcp_reports.php
==============================================================================
*** branches/acydburn/phpBB/includes/mcp/mcp_reports.php (original)
--- branches/acydburn/phpBB/includes/mcp/mcp_reports.php Thu Dec 11 17:40:32 2008
***************
*** 149,155 ****
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
{
! $extensions = cache::obtain_attach_extensions($post_info['forum_id']);
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
--- 149,155 ----
if ($post_info['post_attachment'] && $auth->acl_get('u_download') && $auth->acl_get('f_download', $post_info['forum_id']))
{
! $extensions = phpbb_cache::obtain_attach_extensions($post_info['forum_id']);
$sql = 'SELECT *
FROM ' . ATTACHMENTS_TABLE . '
***************
*** 425,431 ****
'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start),
'TOPIC_ID' => $topic_id,
'TOTAL' => $total,
! 'TOTAL_REPORTS' => ($total == 1) ? $user->lang['LIST_REPORT'] : sprintf($user->lang['LIST_REPORTS'], $total),
)
);
--- 425,431 ----
'PAGE_NUMBER' => on_page($total, $config['topics_per_page'], $start),
'TOPIC_ID' => $topic_id,
'TOTAL' => $total,
! 'TOTAL_REPORTS' => ($total == 1) ? $user->lang['LIST_REPORT'] : sprintf($user->lang['LIST_REPORTS'], $total),
)
);
***************
*** 610,622 ****
$messenger->send($reporter['user_notify_type']);
}
}
!
foreach ($post_info as $post)
{
$forum_ids[$post['forum_id']] = $post['forum_id'];
$topic_ids[$post['topic_id']] = $post['topic_id'];
}
!
unset($notify_reporters, $post_info, $reports);
$messenger->save_queue();
--- 610,622 ----
$messenger->send($reporter['user_notify_type']);
}
}
!
foreach ($post_info as $post)
{
$forum_ids[$post['forum_id']] = $post['forum_id'];
$topic_ids[$post['topic_id']] = $post['topic_id'];
}
!
unset($notify_reporters, $post_info, $reports);
$messenger->save_queue();
***************
*** 648,654 ****
{
$return_topic = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 't=' . current($topic_ids) . '&f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />';
}
!
trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_forum . $return_topic . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>'));
}
}
--- 648,654 ----
{
$return_topic = sprintf($user->lang['RETURN_TOPIC'], '<a href="' . append_sid('viewtopic', 't=' . current($topic_ids) . '&f=' . current($forum_ids)) . '">', '</a>') . '<br /><br />';
}
!
trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_forum . $return_topic . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>'));
}
}
Modified: branches/acydburn/phpBB/includes/mcp/mcp_topic.php
==============================================================================
*** branches/acydburn/phpBB/includes/mcp/mcp_topic.php (original)
--- branches/acydburn/phpBB/includes/mcp/mcp_topic.php Thu Dec 11 17:40:32 2008
***************
*** 171,177 ****
$extensions = $attachments = array();
if ($topic_info['topic_attachment'] && sizeof($post_id_list))
{
! $extensions = cache::obtain_attach_extensions($topic_info['forum_id']);
// Get attachments...
if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_info['forum_id']))
--- 171,177 ----
$extensions = $attachments = array();
if ($topic_info['topic_attachment'] && sizeof($post_id_list))
{
! $extensions = phpbb_cache::obtain_attach_extensions($topic_info['forum_id']);
// Get attachments...
if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_info['forum_id']))
Modified: branches/acydburn/phpBB/index.php
==============================================================================
*** branches/acydburn/phpBB/index.php (original)
--- branches/acydburn/phpBB/index.php Thu Dec 11 17:40:32 2008
***************
*** 21,43 ****
include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT);
// Start session management
! $user->session_begin();
! $auth->acl($user->data);
! $user->setup('viewforum');
! display_forums('', $config['load_moderators']);
// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
! $total_posts = $config['num_posts'];
! $total_topics = $config['num_topics'];
! $total_users = $config['num_users'];
!
! $l_total_user_s = ($total_users == 0) ? 'TOTAL_USERS_ZERO' : 'TOTAL_USERS_OTHER';
! $l_total_post_s = ($total_posts == 0) ? 'TOTAL_POSTS_ZERO' : 'TOTAL_POSTS_OTHER';
! $l_total_topic_s = ($total_topics == 0) ? 'TOTAL_TOPICS_ZERO' : 'TOTAL_TOPICS_OTHER';
// Grab group details for legend display
! if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
{
$sql = 'SELECT group_id, group_name, group_colour, group_type
FROM ' . GROUPS_TABLE . '
--- 21,37 ----
include(PHPBB_ROOT_PATH . 'includes/functions_display.' . PHP_EXT);
// Start session management
! phpbb::$user->setup('viewforum');
! display_forums('', phpbb::$config['load_moderators']);
// Set some stats, get posts count from forums data if we... hum... retrieve all forums data
! $total_posts = phpbb::$config['num_posts'];
! $total_topics = phpbb::$config['num_topics'];
! $total_users = phpbb::$config['num_users'];
// Grab group details for legend display
! if (phpbb::$acl->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
{
$sql = 'SELECT group_id, group_name, group_colour, group_type
FROM ' . GROUPS_TABLE . '
***************
*** 51,96 ****
LEFT JOIN ' . USER_GROUP_TABLE . ' ug
ON (
g.group_id = ug.group_id
! AND ug.user_id = ' . $user->data['user_id'] . '
AND ug.user_pending = 0
)
WHERE g.group_legend = 1
! AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
ORDER BY g.group_name ASC';
}
! $result = $db->sql_query($sql);
$legend = array();
! while ($row = $db->sql_fetchrow($result))
{
$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
! $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
! if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
{
$legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
}
else
{
! $legend[] = '<a' . $colour_text . ' href="' . append_sid('memberlist', 'mode=group&g=' . $row['group_id']) . '">' . $group_name . '</a>';
}
}
! $db->sql_freeresult($result);
$legend = implode(', ', $legend);
// Generate birthday list if required ...
$birthday_list = '';
! if ($config['load_birthdays'] && $config['allow_birthdays'])
{
! $now = getdate(time() + $user->timezone + $user->dst - date('Z'));
$sql = 'SELECT user_id, username, user_colour, user_birthday
FROM ' . USERS_TABLE . "
! WHERE user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
! $result = $db->sql_query($sql);
! while ($row = $db->sql_fetchrow($result))
{
$birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
--- 45,90 ----
LEFT JOIN ' . USER_GROUP_TABLE . ' ug
ON (
g.group_id = ug.group_id
! AND ug.user_id = ' . phpbb::$user->data['user_id'] . '
AND ug.user_pending = 0
)
WHERE g.group_legend = 1
! AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . phpbb::$user->data['user_id'] . ')
ORDER BY g.group_name ASC';
}
! $result = phpbb::$db->sql_query($sql);
$legend = array();
! while ($row = phpbb::$db->sql_fetchrow($result))
{
$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
! $group_name = ($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name'];
! if ($row['group_name'] == 'BOTS' || (phpbb::$user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
{
$legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
}
else
{
! $legend[] = '<a' . $colour_text . ' href="' . phpbb::$url->append_sid('memberlist', 'mode=group&g=' . $row['group_id']) . '">' . $group_name . '</a>';
}
}
! phpbb::$db->sql_freeresult($result);
$legend = implode(', ', $legend);
// Generate birthday list if required ...
$birthday_list = '';
! if (phpbb::$config['load_birthdays'] && phpbb::$config['allow_birthdays'])
{
! $now = getdate(time() + phpbb::$user->timezone + phpbb::$user->dst - date('Z'));
$sql = 'SELECT user_id, username, user_colour, user_birthday
FROM ' . USERS_TABLE . "
! WHERE user_birthday LIKE '" . phpbb::$db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%'
AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
! $result = phpbb::$db->sql_query($sql);
! while ($row = phpbb::$db->sql_fetchrow($result))
{
$birthday_list .= (($birthday_list != '') ? ', ' : '') . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
***************
*** 99,133 ****
$birthday_list .= ' (' . ($now['year'] - $age) . ')';
}
}
! $db->sql_freeresult($result);
}
// Assign index specific vars
! $template->assign_vars(array(
! 'TOTAL_POSTS' => sprintf($user->lang[$l_total_post_s], $total_posts),
! 'TOTAL_TOPICS' => sprintf($user->lang[$l_total_topic_s], $total_topics),
! 'TOTAL_USERS' => sprintf($user->lang[$l_total_user_s], $total_users),
! 'NEWEST_USER' => sprintf($user->lang['NEWEST_USER'], get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])),
'LEGEND' => $legend,
'BIRTHDAY_LIST' => $birthday_list,
! 'FORUM_IMG' => $user->img('forum_read', 'NO_NEW_POSTS'),
! 'FORUM_NEW_IMG' => $user->img('forum_unread', 'NEW_POSTS'),
! 'FORUM_LOCKED_IMG' => $user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'),
! 'FORUM_NEW_LOCKED_IMG' => $user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'),
! 'S_LOGIN_ACTION' => append_sid('ucp', 'mode=login'),
! 'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false,
! 'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid('index', 'hash=' . generate_link_hash('global') . '&mark=forums') : '',
! 'U_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid('mcp', 'i=main&mode=front', true, $user->session_id) : '')
);
// Output page
! page_header($user->lang['INDEX']);
! $template->set_filenames(array(
'body' => 'index_body.html')
);
--- 93,127 ----
$birthday_list .= ' (' . ($now['year'] - $age) . ')';
}
}
! phpbb::$db->sql_freeresult($result);
}
// Assign index specific vars
! phpbb::$template->assign_vars(array(
! 'TOTAL_POSTS' => phpbb::$user->lang('TOTAL_POSTS_COUNT', $total_posts),
! 'TOTAL_TOPICS' => phpbb::$user->lang('TOTAL_TOPICS_COUNT', $total_topics),
! 'TOTAL_USERS' => phpbb::$user->lang('TOTAL_USERS_COUNT', $total_users),
! 'NEWEST_USER' => phpbb::$user->lang('NEWEST_USER', get_username_string('full', phpbb::$config['newest_user_id'], phpbb::$config['newest_username'], phpbb::$config['newest_user_colour'])),
'LEGEND' => $legend,
'BIRTHDAY_LIST' => $birthday_list,
! 'FORUM_IMG' => phpbb::$user->img('forum_read', 'NO_NEW_POSTS'),
! 'FORUM_NEW_IMG' => phpbb::$user->img('forum_unread', 'NEW_POSTS'),
! 'FORUM_LOCKED_IMG' => phpbb::$user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'),
! 'FORUM_NEW_LOCKED_IMG' => phpbb::$user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'),
! 'S_LOGIN_ACTION' => phpbb::$url->append_sid('ucp', 'mode=login'),
! 'S_DISPLAY_BIRTHDAY_LIST' => (phpbb::$config['load_birthdays']) ? true : false,
! 'U_MARK_FORUMS' => (phpbb::$user->is_registered || phpbb::$config['load_anon_lastread']) ? append_sid('index', 'hash=' . generate_link_hash('global') . '&mark=forums') : '',
! 'U_MCP' => (phpbb::$acl->acl_get('m_') || phpbb::$acl->acl_getf_global('m_')) ? phpbb::$url->append_sid('mcp', 'i=main&mode=front', true, phpbb::$user->session_id) : '')
);
// Output page
! page_header(phpbb::$user->lang['INDEX']);
! phpbb::$template->set_filenames(array(
'body' => 'index_body.html')
);
Modified: branches/acydburn/phpBB/install/install_update.php
==============================================================================
*** branches/acydburn/phpBB/install/install_update.php (original)
--- branches/acydburn/phpBB/install/install_update.php Thu Dec 11 17:40:32 2008
***************
*** 905,911 ****
// Now update the installation or download the archive...
$download_filename = 'update_' . $this->update_info['version']['from'] . '_to_' . $this->update_info['version']['to'];
! $archive_filename = $download_filename . '_' . time() . '_' . unique_id();
// Now init the connection
if ($update_mode == 'download')
--- 905,911 ----
// Now update the installation or download the archive...
$download_filename = 'update_' . $this->update_info['version']['from'] . '_to_' . $this->update_info['version']['to'];
! $archive_filename = $download_filename . '_' . time() . '_' . phpbb::$security->unique_id();
// Now init the connection
if ($update_mode == 'download')
Modified: branches/acydburn/phpBB/language/en/common.php
==============================================================================
*** branches/acydburn/phpBB/language/en/common.php (original)
--- branches/acydburn/phpBB/language/en/common.php Thu Dec 11 17:40:32 2008
***************
*** 107,114 ****
'BOARD_DISABLE' => 'Sorry but this board is currently unavailable.',
'BOARD_DISABLED' => 'This board is currently disabled.',
'BOARD_UNAVAILABLE' => 'Sorry but the board is temporarily unavailable, please try again in a few minutes.',
! 'BROWSING_FORUM_GUEST' => 'Users browsing this forum: %1$s and %2$d guest',
! 'BROWSING_FORUM_GUESTS' => 'Users browsing this forum: %1$s and %2$d guests',
'BYTES' => 'Bytes',
'CANCEL' => 'Cancel',
--- 107,116 ----
'BOARD_DISABLE' => 'Sorry but this board is currently unavailable.',
'BOARD_DISABLED' => 'This board is currently disabled.',
'BOARD_UNAVAILABLE' => 'Sorry but the board is temporarily unavailable, please try again in a few minutes.',
! 'BROWSING_FORUM_GUESTS' => array(
! 0 => 'Users browsing this forum: %1$s and %2$d guest',
! 2 => 'Users browsing this forum: %1$s and %2$d guests',
! ),
'BYTES' => 'Bytes',
'CANCEL' => 'Cancel',
***************
*** 236,246 ****
'GROUP_ERR_USER_LONG' => 'Group names cannot exceed 60 characters. The specified group name is too long.',
'GUEST' => 'Guest',
'GUEST_USERS_ONLINE' => 'There are %d guest users online',
- 'GUEST_USERS_TOTAL' => '%d guests',
'GUEST_USERS_ZERO_ONLINE' => 'There are 0 guest users online',
- 'GUEST_USERS_ZERO_TOTAL' => '0 guests',
'GUEST_USER_ONLINE' => 'There is %d guest user online',
! 'GUEST_USER_TOTAL' => '%d guest',
'G_ADMINISTRATORS' => 'Administrators',
'G_BOTS' => 'Bots',
'G_GUESTS' => 'Guests',
--- 238,252 ----
'GROUP_ERR_USER_LONG' => 'Group names cannot exceed 60 characters. The specified group name is too long.',
'GUEST' => 'Guest',
'GUEST_USERS_ONLINE' => 'There are %d guest users online',
'GUEST_USERS_ZERO_ONLINE' => 'There are 0 guest users online',
'GUEST_USER_ONLINE' => 'There is %d guest user online',
!
! 'GUEST_USER_COUNT' => array(
! 0 => '%d guests',
! 1 => '%d guest',
! 2 => '%d guests',
! ),
!
'G_ADMINISTRATORS' => 'Administrators',
'G_BOTS' => 'Bots',
'G_GUESTS' => 'Guests',
***************
*** 249,259 ****
'G_GLOBAL_MODERATORS' => 'Global moderators',
'HIDDEN_USERS_ONLINE' => '%d hidden users online',
- 'HIDDEN_USERS_TOTAL' => '%d hidden and ',
'HIDDEN_USERS_ZERO_ONLINE' => '0 hidden users online',
- 'HIDDEN_USERS_ZERO_TOTAL' => '0 hidden and ',
'HIDDEN_USER_ONLINE' => '%d hidden user online',
! 'HIDDEN_USER_TOTAL' => '%d hidden and ',
'HIDE_GUESTS' => 'Hide guests',
'HIDE_ME' => 'Hide my online status this session',
'HOURS' => 'Hours',
--- 255,267 ----
'G_GLOBAL_MODERATORS' => 'Global moderators',
'HIDDEN_USERS_ONLINE' => '%d hidden users online',
'HIDDEN_USERS_ZERO_ONLINE' => '0 hidden users online',
'HIDDEN_USER_ONLINE' => '%d hidden user online',
!
! 'HIDDEN_USER_COUNT' => array(
! 0 => '%d hidden and ',
! ),
!
'HIDE_GUESTS' => 'Hide guests',
'HIDE_ME' => 'Hide my online status this session',
'HOURS' => 'Hours',
***************
*** 327,334 ****
'MESSAGE_BODY' => 'Message body',
'MINUTES' => 'Minutes',
'MODERATE' => 'Moderate',
! 'MODERATOR' => 'Moderator',
! 'MODERATORS' => 'Moderators',
'MONTH' => 'Month',
'MOVE' => 'Move',
'MSNM' => 'MSNM/WLM',
--- 335,344 ----
'MESSAGE_BODY' => 'Message body',
'MINUTES' => 'Minutes',
'MODERATE' => 'Moderate',
! 'MODERATORS' => array(
! 0 => 'Moderator',
! 2 => 'Moderators',
! ),
'MONTH' => 'Month',
'MOVE' => 'Move',
'MSNM' => 'MSNM/WLM',
***************
*** 337,344 ****
'NEWEST_USER' => 'Our newest member <strong>%s</strong>',
'NEW_MESSAGE' => 'New message',
'NEW_MESSAGES' => 'New messages',
! 'NEW_PM' => '<strong>%d</strong> new message',
! 'NEW_PMS' => '<strong>%d</strong> new messages',
'NEW_POST' => 'New post',
'NEW_POSTS' => 'New posts',
'NEXT' => 'Next', // Used in pagination
--- 347,357 ----
'NEWEST_USER' => 'Our newest member <strong>%s</strong>',
'NEW_MESSAGE' => 'New message',
'NEW_MESSAGES' => 'New messages',
! 'NEW_PM' => array(
! 0 => '<strong>%d</strong> new messages',
! 1 => '<strong>%d</strong> new message',
! 2 => '<strong>%d</strong> new messages',
! ),
'NEW_POST' => 'New post',
'NEW_POSTS' => 'New posts',
'NEXT' => 'Next', // Used in pagination
***************
*** 401,409 ****
'OFFLINE' => 'Offline',
'ONLINE' => 'Online',
'ONLINE_BUDDIES' => 'Online friends',
! 'ONLINE_USERS_TOTAL' => 'In total there are <strong>%d</strong> users online :: ',
! 'ONLINE_USERS_ZERO_TOTAL' => 'In total there are <strong>0</strong> users online :: ',
! 'ONLINE_USER_TOTAL' => 'In total there is <strong>%d</strong> user online :: ',
'OPTIONS' => 'Options',
'PAGE_OF' => 'Page <strong>%1$d</strong> of <strong>%2$d</strong>',
--- 414,425 ----
'OFFLINE' => 'Offline',
'ONLINE' => 'Online',
'ONLINE_BUDDIES' => 'Online friends',
!
! 'ONLINE_USER_COUNT' => array(
! 0 => 'In total there are <strong>0</strong> users online :: ',
! 1 => 'In total there is <strong>%d</strong> user online :: ',
! 2 => 'In total there are <strong>%d</strong> users online :: ',
! ),
'OPTIONS' => 'Options',
'PAGE_OF' => 'Page <strong>%1$d</strong> of <strong>%2$d</strong>',
***************
*** 455,465 ****
'REGISTER' => 'Register',
'REGISTERED_USERS' => 'Registered users:',
'REG_USERS_ONLINE' => 'There are %d registered users and ',
- 'REG_USERS_TOTAL' => '%d registered, ',
'REG_USERS_ZERO_ONLINE' => 'There are 0 registered users and ',
! 'REG_USERS_ZERO_TOTAL' => '0 registered, ',
'REG_USER_ONLINE' => 'There is %d registered user and ',
- 'REG_USER_TOTAL' => '%d registered, ',
'REMOVE' => 'Remove',
'REMOVE_INSTALL' => 'Please delete, move or rename the install directory before you use your board. If this directory is still present, only the Administration Control Panel (ACP) will be accessible.',
'REPLIES' => 'Replies',
--- 471,483 ----
'REGISTER' => 'Register',
'REGISTERED_USERS' => 'Registered users:',
'REG_USERS_ONLINE' => 'There are %d registered users and ',
'REG_USERS_ZERO_ONLINE' => 'There are 0 registered users and ',
!
! 'REG_USER_COUNT' => array(
! 0 => '%d registered, ',
! ),
!
'REG_USER_ONLINE' => 'There is %d registered user and ',
'REMOVE' => 'Remove',
'REMOVE_INSTALL' => 'Please delete, move or rename the install directory before you use your board. If this directory is still present, only the Administration Control Panel (ACP) will be accessible.',
'REPLIES' => 'Replies',
***************
*** 535,542 ****
'START_WATCHING_TOPIC' => 'Subscribe topic',
'STOP_WATCHING_FORUM' => 'Unsubscribe forum',
'STOP_WATCHING_TOPIC' => 'Unsubscribe topic',
! 'SUBFORUM' => 'Subforum',
! 'SUBFORUMS' => 'Subforums',
'SUBJECT' => 'Subject',
'SUBMIT' => 'Submit',
--- 553,562 ----
'START_WATCHING_TOPIC' => 'Subscribe topic',
'STOP_WATCHING_FORUM' => 'Unsubscribe forum',
'STOP_WATCHING_TOPIC' => 'Unsubscribe topic',
! 'SUBFORUMS' => array(
! 0 => 'Subforum',
! 2 => 'Subforums',
! ),
'SUBJECT' => 'Subject',
'SUBMIT' => 'Submit',
***************
*** 602,615 ****
'TOTAL_NO_PM' => '0 private messages in total',
'TOTAL_PM' => '1 private message in total',
'TOTAL_PMS' => '%d private messages in total',
- 'TOTAL_POSTS' => 'Total posts',
- 'TOTAL_POSTS_OTHER' => 'Total posts <strong>%d</strong>',
- 'TOTAL_POSTS_ZERO' => 'Total posts <strong>0</strong>',
'TOPIC_REPORTED' => 'This topic has been reported',
! 'TOTAL_TOPICS_OTHER'=> 'Total topics <strong>%d</strong>',
! 'TOTAL_TOPICS_ZERO' => 'Total topics <strong>0</strong>',
! 'TOTAL_USERS_OTHER' => 'Total members <strong>%d</strong>',
! 'TOTAL_USERS_ZERO' => 'Total members <strong>0</strong>',
'TRACKED_PHP_ERROR' => 'Tracked PHP errors: %s',
'UNABLE_GET_IMAGE_SIZE' => 'It was not possible to determine the dimensions of the image.',
--- 622,639 ----
'TOTAL_NO_PM' => '0 private messages in total',
'TOTAL_PM' => '1 private message in total',
'TOTAL_PMS' => '%d private messages in total',
'TOPIC_REPORTED' => 'This topic has been reported',
! 'TOTAL_POSTS' => 'Total posts',
!
! 'TOTAL_POSTS_COUNT' => array(
! 0 => 'Total posts <strong>%d</strong>',
! ),
! 'TOTAL_TOPICS_COUNT'=> array(
! 0 => 'Total topics <strong>%d</strong>',
! ),
! 'TOTAL_USERS_COUNT' => array(
! 0 => 'Total members <strong>%d</strong>',
! ),
'TRACKED_PHP_ERROR' => 'Tracked PHP errors: %s',
'UNABLE_GET_IMAGE_SIZE' => 'It was not possible to determine the dimensions of the image.',
***************
*** 617,624 ****
'UNKNOWN_BROWSER' => 'Unknown browser',
'UNMARK_ALL' => 'Unmark all',
'UNREAD_MESSAGES' => 'Unread messages',
! 'UNREAD_PM' => '<strong>%d</strong> unread message',
! 'UNREAD_PMS' => '<strong>%d</strong> unread messages',
'UNWATCHED_FORUMS' => 'You are no longer subscribed to the selected forums.',
'UNWATCHED_TOPICS' => 'You are no longer subscribed to the selected topics.',
'UNWATCHED_FORUMS_TOPICS' => 'You are no longer subscribed to the selected entries.',
--- 641,651 ----
'UNKNOWN_BROWSER' => 'Unknown browser',
'UNMARK_ALL' => 'Unmark all',
'UNREAD_MESSAGES' => 'Unread messages',
! 'UNREAD_PM' => array(
! 0 => '<strong>%d</strong> unread messages',
! 1 => '<strong>%d</strong> unread message',
! 2 => '<strong>%d</strong> unread messages',
! ),
'UNWATCHED_FORUMS' => 'You are no longer subscribed to the selected forums.',
'UNWATCHED_TOPICS' => 'You are no longer subscribed to the selected topics.',
'UNWATCHED_FORUMS_TOPICS' => 'You are no longer subscribed to the selected entries.',
***************
*** 651,658 ****
'VIEW_LATEST_POST' => 'View the latest post',
'VIEW_NEWEST_POST' => 'View first unread post',
'VIEW_NOTES' => 'View user notes',
! 'VIEW_ONLINE_TIME' => 'based on users active over the past %d minute',
! 'VIEW_ONLINE_TIMES' => 'based on users active over the past %d minutes',
'VIEW_TOPIC' => 'View topic',
'VIEW_TOPIC_ANNOUNCEMENT' => 'Announcement: ',
'VIEW_TOPIC_GLOBAL' => 'Global Announcement: ',
--- 678,687 ----
'VIEW_LATEST_POST' => 'View the latest post',
'VIEW_NEWEST_POST' => 'View first unread post',
'VIEW_NOTES' => 'View user notes',
! 'VIEW_ONLINE_TIME' => array(
! 0 => 'based on users active over the past %d minute',
! 2 => 'based on users active over the past %d minutes',
! ),
'VIEW_TOPIC' => 'View topic',
'VIEW_TOPIC_ANNOUNCEMENT' => 'Announcement: ',
'VIEW_TOPIC_GLOBAL' => 'Global Announcement: ',
Modified: branches/acydburn/phpBB/memberlist.php
==============================================================================
*** branches/acydburn/phpBB/memberlist.php (original)
--- branches/acydburn/phpBB/memberlist.php Thu Dec 11 17:40:32 2008
***************
*** 64,70 ****
// Grab rank information for later
! $ranks = cache::obtain_ranks();
// What do you want to d...
[truncated message content] |