[Customisation Database Commits] r1782 [10/63] - in /branches/stable: language/en/acp/ language/en/mods/ titania/ titania/authors/ titania/contributions/ titania/docs/ titania/download/ titania/download/modx/ titania/files/contrib_temp/ titania/files/modx_files/ titania/images/ titania/includes/ titania/includes/core/ titania/includes/hooks/ titania/includes/library/Zend/ titania/includes/library/Zend/Search/ titania/includes/library/Zend/Search/Lucene/ titania/includes/library/Zend/Search/Lucene/Analysis/ titania/includes/library/Zend/Search/Lucene/Analysis/Analyzer/ titania/includes/library/Zend/Search/Lucene/Analysis/Analyzer/Common/ titania/includes/library/Zend/Search/Lucene/Analysis/Analyzer/Common/Text/ titania/includes/library/Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum/ titania/includes/library/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8/ titania/includes/library/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num/ titania/includes/library/Zend/Search/Lucene/Analysis/TokenFilter/ titania/includes/library/Zend/Search/Lucene/Document/ titania/includes/library/Zend/Search/Lucene/Index/ titania/includes/library/Zend/Search/Lucene/Index/SegmentWriter/ titania/includes/library/Zend/Search/Lucene/Index/TermsStream/ titania/includes/library/Zend/Search/Lucene/Search/ titania/includes/library/Zend/Search/Lucene/Search/Highlighter/ titania/includes/library/Zend/Search/Lucene/Search/Query/ titania/includes/library/Zend/Search/Lucene/Search/Query/Preprocessing/ titania/includes/library/Zend/Search/Lucene/Search/QueryEntry/ titania/includes/library/Zend/Search/Lucene/Search/Similarity/ titania/includes/library/Zend/Search/Lucene/Search/Weight/ titania/includes/library/Zend/Search/Lucene/Storage/ titania/includes/library/Zend/Search/Lucene/Storage/Directory/ titania/includes/library/Zend/Search/Lucene/Storage/File/ titania/includes/library/automod/ titania/includes/library/ezcomponents/ titania/includes/library/ezcomponents/Base/ titania/includes/library/ezcomponents/Base/interfaces/ titania/includes/library/translations/ titania/includes/manage_tools/ titania/includes/objects/ titania/includes/overlords/ titania/includes/tools/ titania/includes/types/ titania/js/ titania/language/ titania/language/en/ titania/language/en/email/ titania/language/en/manage_tools/ titania/language/en/types/ titania/manage/ titania/store/ titania/store/phpbb_packages/ titania/store/phpbb_packages/extracted/ titania/store/search/ titania/styles/default/template/ titania/styles/default/template/authors/ titania/styles/default/template/common/ titania/styles/default/template/contributions/ titania/styles/default/template/manage/ titania/styles/default/template/posting/ titania/styles/default/template/posting/attachments/ titania/styles/default/template/posting/panels/ titania/styles/default/theme/ titania/styles/default/theme/en-gb/ titania/styles/prosilver/template/ titania/styles/prosilver/template/authors/ titania/styles/prosilver/template/common/ titania/styles/prosilver/theme/ titania/styles/prosilver/theme/en-gb/ umil/ umil/error_files/ umil/language/en/ umil/style/

David Colon davidiq at phpbb.com
Fri Nov 19 19:35:15 GMT 2010


Modified: branches/stable/titania/download/modx/index.htm
==============================================================================
*** branches/stable/titania/download/modx/index.htm (original)
--- branches/stable/titania/download/modx/index.htm Fri Nov 19 19:35:14 2010
***************
*** 1,10 ****
! <html>
! <head>
! <title></title>
! <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
! </head>
! 
! <body bgcolor="#FFFFFF" text="#000000">
! 
! </body>
! </html>
--- 1,10 ----
! <html>
! <head>
! <title></title>
! <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
! </head>
! 
! <body bgcolor="#FFFFFF" text="#000000">
! 
! </body>
! </html>

Modified: branches/stable/titania/download/view_install.php
==============================================================================
*** branches/stable/titania/download/view_install.php (original)
--- branches/stable/titania/download/view_install.php Fri Nov 19 19:35:14 2010
***************
*** 1,289 ****
! <?php
! /**
! *
! * @package titania
! * @version $Id$
! * @copyright (c) 2008 phpBB Customisation Database Team
! * @license http://opensource.org/licenses/gpl-license.php GNU Public License
! *
! */
! 
! /**
! * @ignore
! */
! define('IN_TITANIA', true);
! if (!defined('TITANIA_ROOT')) define('TITANIA_ROOT', './../');
! if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
! require TITANIA_ROOT . 'common.' . PHP_EXT;
! 
! phpbb::$user->add_lang('viewtopic');
! 
! // Thank you sun.
! if (isset($_SERVER['CONTENT_TYPE']))
! {
! 	if ($_SERVER['CONTENT_TYPE'] === 'application/x-java-archive')
! 	{
! 		exit;
! 	}
! }
! else if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Java') !== false)
! {
! 	exit;
! }
! 
! $revision_id = request_var('id', 0);
! 
! send_file_to_browser($revision_id, titania::$config->modx_storage_path);
! file_gc();
! 
! /**
! * Send file to browser
! */
! function send_file_to_browser($attachment, $upload_dir)
! {
! 	$filename = $upload_dir . $attachment;
! 
! 	if (!@file_exists($filename))
! 	{
! 		trigger_error(phpbb::$user->lang['ERROR_NO_ATTACHMENT'] . '<br /><br />' . sprintf(phpbb::$user->lang['FILE_NOT_FOUND_404'], $filename));
! 	}
! 
! 	if (@ob_get_length())
! 	{
! 		@ob_end_clean();
! 	}
! 
! 	// Now send the File Contents to the Browser
! 	$size = @filesize($filename);
! 
! 	// To correctly display further errors we need to make sure we are using the correct headers for both (unsetting content-length may not work)
! 
! 	// Check if headers already sent or not able to get the file contents.
! 	if (headers_sent() || !@file_exists($filename) || !@is_readable($filename))
! 	{
! 		// PHP track_errors setting On?
! 		if (!empty($php_errormsg))
! 		{
! 			trigger_error(phpbb::$user->lang['UNABLE_TO_DELIVER_FILE'] . '<br />' . sprintf(phpbb::$user->lang['TRACKED_PHP_ERROR'], $php_errormsg));
! 		}
! 
! 		trigger_error('UNABLE_TO_DELIVER_FILE');
! 	}
! 
! 	// Now the tricky part... let's dance
! 	header('Pragma: public');
! 
! 	// Send out the Headers. Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer.
! 	$is_ie8 = (strpos(strtolower(phpbb::$user->browser), 'msie 8.0') !== false);
! 	header('Content-Type: text/xml');
! 
! 	if ($is_ie8)
! 	{
! 		header('X-Content-Type-Options: nosniff');
! 	}
! 
! 	if ($size)
! 	{
! 		header("Content-Length: $size");
! 	}
! 
! 	// Close the db connection before sending the file
! 	phpbb::$db->sql_close();
! 
! 	if (!set_modified_headers(@filemtime($attachment), phpbb::$user->browser))
! 	{
! 		// Try to deliver in chunks
! 		@set_time_limit(0);
! 
! 		$fp = @fopen($filename, 'rb');
! 
! 		if ($fp !== false)
! 		{
! 			while (!feof($fp))
! 			{
! 				echo fread($fp, 8192);
! 			}
! 			fclose($fp);
! 		}
! 		else
! 		{
! 			@readfile($filename);
! 		}
! 
! 		flush();
! 	}
! 	file_gc();
! }
! 
! /**
! * Get a browser friendly UTF-8 encoded filename
! */
! function header_filename($file)
! {
! 	$user_agent = (!empty($_SERVER['HTTP_USER_AGENT'])) ? htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT']) : '';
! 
! 	// There be dragons here.
! 	// Not many follows the RFC...
! 	if (strpos($user_agent, 'MSIE') !== false || strpos($user_agent, 'Safari') !== false || strpos($user_agent, 'Konqueror') !== false)
! 	{
! 		return "filename=" . rawurlencode($file);
! 	}
! 
! 	// follow the RFC for extended filename for the rest
! 	return "filename*=UTF-8''" . rawurlencode($file);
! }
! 
! /**
! * Check if downloading item is allowed
! */
! function download_allowed()
! {
! 	if (!phpbb::$config['secure_downloads'])
! 	{
! 		return true;
! 	}
! 
! 	$url = (!empty($_SERVER['HTTP_REFERER'])) ? trim($_SERVER['HTTP_REFERER']) : trim(getenv('HTTP_REFERER'));
! 
! 	if (!$url)
! 	{
! 		return (phpbb::$config['secure_allow_empty_referer']) ? true : false;
! 	}
! 
! 	// Split URL into domain and script part
! 	$url = @parse_url($url);
! 
! 	if ($url === false)
! 	{
! 		return (phpbb::$config['secure_allow_empty_referer']) ? true : false;
! 	}
! 
! 	$hostname = $url['host'];
! 	unset($url);
! 
! 	$allowed = (phpbb::$config['secure_allow_deny']) ? false : true;
! 	$iplist = array();
! 
! 	if (($ip_ary = @gethostbynamel($hostname)) !== false)
! 	{
! 		foreach ($ip_ary as $ip)
! 		{
! 			if ($ip)
! 			{
! 				$iplist[] = $ip;
! 			}
! 		}
! 	}
! 
! 	// Check for own server...
! 	$server_name = phpbb::$user->host;
! 
! 	// Forcing server vars is the only way to specify/override the protocol
! 	if (phpbb::$config['force_server_vars'] || !$server_name)
! 	{
! 		$server_name = phpbb::$config['server_name'];
! 	}
! 
! 	if (preg_match('#^.*?' . preg_quote($server_name, '#') . '.*?$#i', $hostname))
! 	{
! 		$allowed = true;
! 	}
! 
! 	// Get IP's and Hostnames
! 	if (!$allowed)
! 	{
! 		$sql = 'SELECT site_ip, site_hostname, ip_exclude
! 			FROM ' . SITELIST_TABLE;
! 		$result = phpbb::$db->sql_query($sql);
! 
! 		while ($row = phpbb::$db->sql_fetchrow($result))
! 		{
! 			$site_ip = trim($row['site_ip']);
! 			$site_hostname = trim($row['site_hostname']);
! 
! 			if ($site_ip)
! 			{
! 				foreach ($iplist as $ip)
! 				{
! 					if (preg_match('#^' . str_replace('\*', '.*?', preg_quote($site_ip, '#')) . '$#i', $ip))
! 					{
! 						if ($row['ip_exclude'])
! 						{
! 							$allowed = (phpbb::$config['secure_allow_deny']) ? false : true;
! 							break 2;
! 						}
! 						else
! 						{
! 							$allowed = (phpbb::$config['secure_allow_deny']) ? true : false;
! 						}
! 					}
! 				}
! 			}
! 
! 			if ($site_hostname)
! 			{
! 				if (preg_match('#^' . str_replace('\*', '.*?', preg_quote($site_hostname, '#')) . '$#i', $hostname))
! 				{
! 					if ($row['ip_exclude'])
! 					{
! 						$allowed = (phpbb::$config['secure_allow_deny']) ? false : true;
! 						break;
! 					}
! 					else
! 					{
! 						$allowed = (phpbb::$config['secure_allow_deny']) ? true : false;
! 					}
! 				}
! 			}
! 		}
! 		phpbb::$db->sql_freeresult($result);
! 	}
! 
! 	return $allowed;
! }
! 
! /**
! * Check if the browser has the file already and set the appropriate headers-
! * @returns false if a resend is in order.
! */
! function set_modified_headers($stamp, $browser)
! {
! 	// let's see if we have to send the file at all
! 	$last_load 	=  isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime(trim($_SERVER['HTTP_IF_MODIFIED_SINCE'])) : false;
! 	if ((strpos(strtolower($browser), 'msie 6.0') === false) && (strpos(strtolower($browser), 'msie 8.0') === false))
! 	{
! 		if ($last_load !== false && $last_load <= $stamp)
! 		{
! 			if (substr(strtolower(@php_sapi_name()),0,3) === 'cgi')
! 			{
! 				// in theory, we shouldn't need that due to php doing it. Reality offers a differing opinion, though
! 				header('Status: 304 Not Modified', true, 304);
! 			}
! 			else
! 			{
! 				header('HTTP/1.0 304 Not Modified', true, 304);
! 			}
! 			// seems that we need those too ... browsers
! 			header('Pragma: public');
! 			header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 31536000));
! 			return true;
! 		}
! 		else
! 		{
! 			header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $stamp) . ' GMT');
! 		}
! 	}
! 	return false;
! }
! 
! function file_gc()
! {
! 	if (!empty(phpbb::$cache))
! 	{
! 		phpbb::$cache->unload();
! 	}
! 	phpbb::$db->sql_close();
! 	exit;
! }
! 
! ?>
--- 1,289 ----
! <?php
! /**
! *
! * @package titania
! * @version $Id$
! * @copyright (c) 2008 phpBB Customisation Database Team
! * @license http://opensource.org/licenses/gpl-license.php GNU Public License
! *
! */
! 
! /**
! * @ignore
! */
! define('IN_TITANIA', true);
! if (!defined('TITANIA_ROOT')) define('TITANIA_ROOT', './../');
! if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
! require TITANIA_ROOT . 'common.' . PHP_EXT;
! 
! phpbb::$user->add_lang('viewtopic');
! 
! // Thank you sun.
! if (isset($_SERVER['CONTENT_TYPE']))
! {
! 	if ($_SERVER['CONTENT_TYPE'] === 'application/x-java-archive')
! 	{
! 		exit;
! 	}
! }
! else if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Java') !== false)
! {
! 	exit;
! }
! 
! $revision_id = request_var('id', 0);
! 
! send_file_to_browser($revision_id, titania::$config->modx_storage_path);
! file_gc();
! 
! /**
! * Send file to browser
! */
! function send_file_to_browser($attachment, $upload_dir)
! {
! 	$filename = $upload_dir . $attachment;
! 
! 	if (!@file_exists($filename))
! 	{
! 		trigger_error(phpbb::$user->lang['ERROR_NO_ATTACHMENT'] . '<br /><br />' . sprintf(phpbb::$user->lang['FILE_NOT_FOUND_404'], $filename));
! 	}
! 
! 	if (@ob_get_length())
! 	{
! 		@ob_end_clean();
! 	}
! 
! 	// Now send the File Contents to the Browser
! 	$size = @filesize($filename);
! 
! 	// To correctly display further errors we need to make sure we are using the correct headers for both (unsetting content-length may not work)
! 
! 	// Check if headers already sent or not able to get the file contents.
! 	if (headers_sent() || !@file_exists($filename) || !@is_readable($filename))
! 	{
! 		// PHP track_errors setting On?
! 		if (!empty($php_errormsg))
! 		{
! 			trigger_error(phpbb::$user->lang['UNABLE_TO_DELIVER_FILE'] . '<br />' . sprintf(phpbb::$user->lang['TRACKED_PHP_ERROR'], $php_errormsg));
! 		}
! 
! 		trigger_error('UNABLE_TO_DELIVER_FILE');
! 	}
! 
! 	// Now the tricky part... let's dance
! 	header('Pragma: public');
! 
! 	// Send out the Headers. Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer.
! 	$is_ie8 = (strpos(strtolower(phpbb::$user->browser), 'msie 8.0') !== false);
! 	header('Content-Type: text/xml');
! 
! 	if ($is_ie8)
! 	{
! 		header('X-Content-Type-Options: nosniff');
! 	}
! 
! 	if ($size)
! 	{
! 		header("Content-Length: $size");
! 	}
! 
! 	// Close the db connection before sending the file
! 	phpbb::$db->sql_close();
! 
! 	if (!set_modified_headers(@filemtime($attachment), phpbb::$user->browser))
! 	{
! 		// Try to deliver in chunks
! 		@set_time_limit(0);
! 
! 		$fp = @fopen($filename, 'rb');
! 
! 		if ($fp !== false)
! 		{
! 			while (!feof($fp))
! 			{
! 				echo fread($fp, 8192);
! 			}
! 			fclose($fp);
! 		}
! 		else
! 		{
! 			@readfile($filename);
! 		}
! 
! 		flush();
! 	}
! 	file_gc();
! }
! 
! /**
! * Get a browser friendly UTF-8 encoded filename
! */
! function header_filename($file)
! {
! 	$user_agent = (!empty($_SERVER['HTTP_USER_AGENT'])) ? htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT']) : '';
! 
! 	// There be dragons here.
! 	// Not many follows the RFC...
! 	if (strpos($user_agent, 'MSIE') !== false || strpos($user_agent, 'Safari') !== false || strpos($user_agent, 'Konqueror') !== false)
! 	{
! 		return "filename=" . rawurlencode($file);
! 	}
! 
! 	// follow the RFC for extended filename for the rest
! 	return "filename*=UTF-8''" . rawurlencode($file);
! }
! 
! /**
! * Check if downloading item is allowed
! */
! function download_allowed()
! {
! 	if (!phpbb::$config['secure_downloads'])
! 	{
! 		return true;
! 	}
! 
! 	$url = (!empty($_SERVER['HTTP_REFERER'])) ? trim($_SERVER['HTTP_REFERER']) : trim(getenv('HTTP_REFERER'));
! 
! 	if (!$url)
! 	{
! 		return (phpbb::$config['secure_allow_empty_referer']) ? true : false;
! 	}
! 
! 	// Split URL into domain and script part
! 	$url = @parse_url($url);
! 
! 	if ($url === false)
! 	{
! 		return (phpbb::$config['secure_allow_empty_referer']) ? true : false;
! 	}
! 
! 	$hostname = $url['host'];
! 	unset($url);
! 
! 	$allowed = (phpbb::$config['secure_allow_deny']) ? false : true;
! 	$iplist = array();
! 
! 	if (($ip_ary = @gethostbynamel($hostname)) !== false)
! 	{
! 		foreach ($ip_ary as $ip)
! 		{
! 			if ($ip)
! 			{
! 				$iplist[] = $ip;
! 			}
! 		}
! 	}
! 
! 	// Check for own server...
! 	$server_name = phpbb::$user->host;
! 
! 	// Forcing server vars is the only way to specify/override the protocol
! 	if (phpbb::$config['force_server_vars'] || !$server_name)
! 	{
! 		$server_name = phpbb::$config['server_name'];
! 	}
! 
! 	if (preg_match('#^.*?' . preg_quote($server_name, '#') . '.*?$#i', $hostname))
! 	{
! 		$allowed = true;
! 	}
! 
! 	// Get IP's and Hostnames
! 	if (!$allowed)
! 	{
! 		$sql = 'SELECT site_ip, site_hostname, ip_exclude
! 			FROM ' . SITELIST_TABLE;
! 		$result = phpbb::$db->sql_query($sql);
! 
! 		while ($row = phpbb::$db->sql_fetchrow($result))
! 		{
! 			$site_ip = trim($row['site_ip']);
! 			$site_hostname = trim($row['site_hostname']);
! 
! 			if ($site_ip)
! 			{
! 				foreach ($iplist as $ip)
! 				{
! 					if (preg_match('#^' . str_replace('\*', '.*?', preg_quote($site_ip, '#')) . '$#i', $ip))
! 					{
! 						if ($row['ip_exclude'])
! 						{
! 							$allowed = (phpbb::$config['secure_allow_deny']) ? false : true;
! 							break 2;
! 						}
! 						else
! 						{
! 							$allowed = (phpbb::$config['secure_allow_deny']) ? true : false;
! 						}
! 					}
! 				}
! 			}
! 
! 			if ($site_hostname)
! 			{
! 				if (preg_match('#^' . str_replace('\*', '.*?', preg_quote($site_hostname, '#')) . '$#i', $hostname))
! 				{
! 					if ($row['ip_exclude'])
! 					{
! 						$allowed = (phpbb::$config['secure_allow_deny']) ? false : true;
! 						break;
! 					}
! 					else
! 					{
! 						$allowed = (phpbb::$config['secure_allow_deny']) ? true : false;
! 					}
! 				}
! 			}
! 		}
! 		phpbb::$db->sql_freeresult($result);
! 	}
! 
! 	return $allowed;
! }
! 
! /**
! * Check if the browser has the file already and set the appropriate headers-
! * @returns false if a resend is in order.
! */
! function set_modified_headers($stamp, $browser)
! {
! 	// let's see if we have to send the file at all
! 	$last_load 	=  isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime(trim($_SERVER['HTTP_IF_MODIFIED_SINCE'])) : false;
! 	if ((strpos(strtolower($browser), 'msie 6.0') === false) && (strpos(strtolower($browser), 'msie 8.0') === false))
! 	{
! 		if ($last_load !== false && $last_load <= $stamp)
! 		{
! 			if (substr(strtolower(@php_sapi_name()),0,3) === 'cgi')
! 			{
! 				// in theory, we shouldn't need that due to php doing it. Reality offers a differing opinion, though
! 				header('Status: 304 Not Modified', true, 304);
! 			}
! 			else
! 			{
! 				header('HTTP/1.0 304 Not Modified', true, 304);
! 			}
! 			// seems that we need those too ... browsers
! 			header('Pragma: public');
! 			header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 31536000));
! 			return true;
! 		}
! 		else
! 		{
! 			header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $stamp) . ' GMT');
! 		}
! 	}
! 	return false;
! }
! 
! function file_gc()
! {
! 	if (!empty(phpbb::$cache))
! 	{
! 		phpbb::$cache->unload();
! 	}
! 	phpbb::$db->sql_close();
! 	exit;
! }
! 
! ?>

Modified: branches/stable/titania/faq.php
==============================================================================
*** branches/stable/titania/faq.php (original)
--- branches/stable/titania/faq.php Fri Nov 19 19:35:14 2010
***************
*** 1,68 ****
! <?php
! /**
!  *
!  * @package Titania
!  * @version $Id$
!  * @copyright (c) 2008 phpBB Customisation Database Team
!  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
!  *
!  */
! 
! /**
! * @ignore
! */
! define('IN_TITANIA', true);
! if (!defined('TITANIA_ROOT')) define('TITANIA_ROOT', './');
! if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
! require TITANIA_ROOT . 'common.' . PHP_EXT;
! 
! titania::add_lang('faq', false, true);
! 
! /**
! * From phpBB faq.php
! */
! 
! // Pull the array data from the lang pack
! $switch_column = $found_switch = false;
! $help_blocks = array();
! foreach (phpbb::$user->help as $help_ary)
! {
! 	if ($help_ary[0] == '--')
! 	{
! 		if ($help_ary[1] == '--')
! 		{
! 			$switch_column = true;
! 			$found_switch = true;
! 			continue;
! 		}
! 
! 		phpbb::$template->assign_block_vars('faq_block', array(
! 			'BLOCK_TITLE'		=> $help_ary[1],
! 			'SWITCH_COLUMN'		=> $switch_column,
! 		));
! 
! 		if ($switch_column)
! 		{
! 			$switch_column = false;
! 		}
! 		continue;
! 	}
! 
! 	phpbb::$template->assign_block_vars('faq_block.faq_row', array(
! 		'FAQ_QUESTION'		=> $help_ary[0],
! 		'FAQ_ANSWER'		=> $help_ary[1])
! 	);
! }
! 
! // Lets build a page ...
! phpbb::$template->assign_vars(array(
! 	'L_FAQ_TITLE'				=> phpbb::$user->lang['FAQ_EXPLAIN'],
! 	'L_BACK_TO_TOP'				=> phpbb::$user->lang['BACK_TO_TOP'],
! 
! 	'SWITCH_COLUMN_MANUALLY'	=> (!$found_switch) ? true : false,
! ));
! 
! titania::page_header('FAQ_EXPLAIN');
! titania::page_footer(true, 'faq_body.html');
! 
  ?>
\ No newline at end of file
--- 1,68 ----
! <?php
! /**
!  *
!  * @package Titania
!  * @version $Id$
!  * @copyright (c) 2008 phpBB Customisation Database Team
!  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
!  *
!  */
! 
! /**
! * @ignore
! */
! define('IN_TITANIA', true);
! if (!defined('TITANIA_ROOT')) define('TITANIA_ROOT', './');
! if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
! require TITANIA_ROOT . 'common.' . PHP_EXT;
! 
! titania::add_lang('faq', false, true);
! 
! /**
! * From phpBB faq.php
! */
! 
! // Pull the array data from the lang pack
! $switch_column = $found_switch = false;
! $help_blocks = array();
! foreach (phpbb::$user->help as $help_ary)
! {
! 	if ($help_ary[0] == '--')
! 	{
! 		if ($help_ary[1] == '--')
! 		{
! 			$switch_column = true;
! 			$found_switch = true;
! 			continue;
! 		}
! 
! 		phpbb::$template->assign_block_vars('faq_block', array(
! 			'BLOCK_TITLE'		=> $help_ary[1],
! 			'SWITCH_COLUMN'		=> $switch_column,
! 		));
! 
! 		if ($switch_column)
! 		{
! 			$switch_column = false;
! 		}
! 		continue;
! 	}
! 
! 	phpbb::$template->assign_block_vars('faq_block.faq_row', array(
! 		'FAQ_QUESTION'		=> $help_ary[0],
! 		'FAQ_ANSWER'		=> $help_ary[1])
! 	);
! }
! 
! // Lets build a page ...
! phpbb::$template->assign_vars(array(
! 	'L_FAQ_TITLE'				=> phpbb::$user->lang['FAQ_EXPLAIN'],
! 	'L_BACK_TO_TOP'				=> phpbb::$user->lang['BACK_TO_TOP'],
! 
! 	'SWITCH_COLUMN_MANUALLY'	=> (!$found_switch) ? true : false,
! ));
! 
! titania::page_header('FAQ_EXPLAIN');
! titania::page_footer(true, 'faq_body.html');
! 
  ?>
\ No newline at end of file

Modified: branches/stable/titania/files/contrib_temp/index.htm
==============================================================================
*** branches/stable/titania/files/contrib_temp/index.htm (original)
--- branches/stable/titania/files/contrib_temp/index.htm Fri Nov 19 19:35:14 2010
***************
*** 1,10 ****
! <html>
! <head>
! <title></title>
! <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
! </head>
! 
! <body bgcolor="#FFFFFF" text="#000000">
! 
! </body>
! </html>
--- 1,10 ----
! <html>
! <head>
! <title></title>
! <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
! </head>
! 
! <body bgcolor="#FFFFFF" text="#000000">
! 
! </body>
! </html>

Modified: branches/stable/titania/files/modx_files/index.htm
==============================================================================
*** branches/stable/titania/files/modx_files/index.htm (original)
--- branches/stable/titania/files/modx_files/index.htm Fri Nov 19 19:35:14 2010
***************
*** 1,10 ****
! <html>
! <head>
! <title></title>
! <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
! </head>
! 
! <body bgcolor="#FFFFFF" text="#000000">
! 
! </body>
! </html>
--- 1,10 ----
! <html>
! <head>
! <title></title>
! <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
! </head>
! 
! <body bgcolor="#FFFFFF" text="#000000">
! 
! </body>
! </html>

Modified: branches/stable/titania/images/index.htm
==============================================================================
*** branches/stable/titania/images/index.htm (original)
--- branches/stable/titania/images/index.htm Fri Nov 19 19:35:14 2010
***************
*** 1,10 ****
! <html>
! <head>
! <title></title>
! <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
! </head>
! 
! <body bgcolor="#FFFFFF" text="#000000">
! 
! </body>
! </html>
--- 1,10 ----
! <html>
! <head>
! <title></title>
! <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
! </head>
! 
! <body bgcolor="#FFFFFF" text="#000000">
! 
! </body>
! </html>

Modified: branches/stable/titania/includes/core/hook.php
==============================================================================
*** branches/stable/titania/includes/core/hook.php (original)
--- branches/stable/titania/includes/core/hook.php Fri Nov 19 19:35:14 2010
***************
*** 1,159 ****
! <?php
! /**
!  *
!  * @package Titania
!  * @version $Id$
!  * @copyright (c) 2009 phpBB Customisation Database Team
!  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
!  *
!  */
! 
! /**
!  * @ignore
!  */
! if (!defined('IN_TITANIA'))
! {
! 	exit;
! }
! 
! phpbb::_include('hooks/index', false, 'phpbb_hook');
! 
! /**
! * Titania Hook Class
! *
! * Same as phpBB's hook class, but not requiring the hooks to be registered at class construction time
! */
! class titania_hook extends phpbb_hook
! {
! 	/**
! 	* Initialize hook class.
! 	*/
! 	public function titania_hook()
! 	{
! 		if (function_exists('phpbb_hook_register'))
! 		{
! 			phpbb_hook_register($this);
! 		}
! 	}
! 
! 	/**
! 	* Register function/method to be called within hook
! 	* This function is normally called by the modification/application to attach/register the functions.
! 	*
! 	* @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__)
! 	* @param mixed $hook The replacement function/method to be called. Passing function name or array with object/class definition
! 	* @param string $mode Specify the priority/chain mode. 'normal' -> hook gets appended to the chain. 'standalone' -> only the specified hook gets called - later hooks are not able to overwrite this (E_NOTICE is triggered then). 'first' -> hook is called as the first one within the chain. 'last' -> hook is called as the last one within the chain.
! 	*/
! 	public function register($definition, $hook, $mode = 'normal')
! 	{
! 		$class = (!is_array($definition)) ? '__global' : $definition[0];
! 		$function = (!is_array($definition)) ? $definition : $definition[1];
! 
! 		switch ($mode)
! 		{
! 			case 'standalone':
! 				if (!isset($this->hooks[$class][$function]['standalone']))
! 				{
! 					$this->hooks[$class][$function] = array('standalone' => $hook);
! 				}
! 				else
! 				{
! 					trigger_error('Hook not able to be called standalone, previous hook already standalone.', E_NOTICE);
! 				}
! 			break;
! 
! 			case 'first':
! 			case 'last':
! 				$this->hooks[$class][$function][$mode][] = $hook;
! 			break;
! 
! 			case 'normal':
! 			default:
! 				$this->hooks[$class][$function]['normal'][] = $hook;
! 			break;
! 		}
! 	}
! 
! 	public function register_ary($prefix, $definitions, $mode = 'normal')
! 	{
! 		foreach ($definitions as $definition)
! 		{
! 			$this->register($definition, $prefix . ((is_array($definition)) ? implode('_', $definition) : $definition), $mode);
! 		}
! 	}
! 
! 	/**
! 	* Calling all functions/methods attached to a specified hook by reference (only the first argument allows for a reference)
! 	*
! 	* @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__)
! 	* @param mixed $args The arguments to be used as reference
! 	*/
! 	function call_hook_ref($definition, &$reference)
! 	{
! 		$class = (!is_array($definition)) ? '__global' : $definition[0];
! 		$function = (!is_array($definition)) ? $definition : $definition[1];
! 
! 		if (!empty($this->hooks[$class][$function]))
! 		{
! 			// Developer tries to call a hooked function within the hooked function...
! 			if ($this->current_hook !== NULL && $this->current_hook['class'] === $class && $this->current_hook['function'] === $function)
! 			{
! 				return false;
! 			}
! 
! 			// Call the hook with the arguments attached and store result
! 			$arguments = func_get_args();
! 			$this->current_hook = array('class' => $class, 'function' => $function);
! 			$arguments[0] = &$this;
! 			$arguments[1] = &$reference;
! 
! 			// Call the hook chain...
! 			if (isset($this->hooks[$class][$function]['standalone']))
! 			{
! 				$hook = $this->hooks[$class][$function]['standalone'];
! 				if (function_exists($hook))
! 				{
! 					$function_call = '$this->hook_result[$class][$function] = ' . $hook . '(';
! 					for ($i = 0; $i < sizeof($arguments); $i++)
! 					{
! 						$function_call .= '$arguments[' . $i . '], ';
! 					}
! 					$function_call = substr($function_call, 0, -2) . ');';
! 
! 					eval($function_call);
! 				}
! 			}
! 			else
! 			{
! 				foreach (array('first', 'normal', 'last') as $mode)
! 				{
! 					if (!isset($this->hooks[$class][$function][$mode]))
! 					{
! 						continue;
! 					}
! 
! 					foreach ($this->hooks[$class][$function][$mode] as $hook)
! 					{
! 						if (function_exists($hook))
! 						{
! 							$function_call = '$this->hook_result[$class][$function] = ' . $hook . '(';
! 							for ($i = 0; $i < sizeof($arguments); $i++)
! 							{
! 								$function_call .= '$arguments[' . $i . '], ';
! 							}
! 							$function_call = substr($function_call, 0, -2) . ');';
! 
! 							eval($function_call);
! 						}
! 					}
! 				}
! 			}
! 
! 			$this->current_hook = NULL;
! 			return true;
! 		}
! 
! 		$this->current_hook = NULL;
! 		return false;
! 	}
  }
\ No newline at end of file
--- 1,159 ----
! <?php
! /**
!  *
!  * @package Titania
!  * @version $Id$
!  * @copyright (c) 2009 phpBB Customisation Database Team
!  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
!  *
!  */
! 
! /**
!  * @ignore
!  */
! if (!defined('IN_TITANIA'))
! {
! 	exit;
! }
! 
! phpbb::_include('hooks/index', false, 'phpbb_hook');
! 
! /**
! * Titania Hook Class
! *
! * Same as phpBB's hook class, but not requiring the hooks to be registered at class construction time
! */
! class titania_hook extends phpbb_hook
! {
! 	/**
! 	* Initialize hook class.
! 	*/
! 	public function titania_hook()
! 	{
! 		if (function_exists('phpbb_hook_register'))
! 		{
! 			phpbb_hook_register($this);
! 		}
! 	}
! 
! 	/**
! 	* Register function/method to be called within hook
! 	* This function is normally called by the modification/application to attach/register the functions.
! 	*
! 	* @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__)
! 	* @param mixed $hook The replacement function/method to be called. Passing function name or array with object/class definition
! 	* @param string $mode Specify the priority/chain mode. 'normal' -> hook gets appended to the chain. 'standalone' -> only the specified hook gets called - later hooks are not able to overwrite this (E_NOTICE is triggered then). 'first' -> hook is called as the first one within the chain. 'last' -> hook is called as the last one within the chain.
! 	*/
! 	public function register($definition, $hook, $mode = 'normal')
! 	{
! 		$class = (!is_array($definition)) ? '__global' : $definition[0];
! 		$function = (!is_array($definition)) ? $definition : $definition[1];
! 
! 		switch ($mode)
! 		{
! 			case 'standalone':
! 				if (!isset($this->hooks[$class][$function]['standalone']))
! 				{
! 					$this->hooks[$class][$function] = array('standalone' => $hook);
! 				}
! 				else
! 				{
! 					trigger_error('Hook not able to be called standalone, previous hook already standalone.', E_NOTICE);
! 				}
! 			break;
! 
! 			case 'first':
! 			case 'last':
! 				$this->hooks[$class][$function][$mode][] = $hook;
! 			break;
! 
! 			case 'normal':
! 			default:
! 				$this->hooks[$class][$function]['normal'][] = $hook;
! 			break;
! 		}
! 	}
! 
! 	public function register_ary($prefix, $definitions, $mode = 'normal')
! 	{
! 		foreach ($definitions as $definition)
! 		{
! 			$this->register($definition, $prefix . ((is_array($definition)) ? implode('_', $definition) : $definition), $mode);
! 		}
! 	}
! 
! 	/**
! 	* Calling all functions/methods attached to a specified hook by reference (only the first argument allows for a reference)
! 	*
! 	* @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__)
! 	* @param mixed $args The arguments to be used as reference
! 	*/
! 	function call_hook_ref($definition, &$reference)
! 	{
! 		$class = (!is_array($definition)) ? '__global' : $definition[0];
! 		$function = (!is_array($definition)) ? $definition : $definition[1];
! 
! 		if (!empty($this->hooks[$class][$function]))
! 		{
! 			// Developer tries to call a hooked function within the hooked function...
! 			if ($this->current_hook !== NULL && $this->current_hook['class'] === $class && $this->current_hook['function'] === $function)
! 			{
! 				return false;
! 			}
! 
! 			// Call the hook with the arguments attached and store result
! 			$arguments = func_get_args();
! 			$this->current_hook = array('class' => $class, 'function' => $function);
! 			$arguments[0] = &$this;
! 			$arguments[1] = &$reference;
! 
! 			// Call the hook chain...
! 			if (isset($this->hooks[$class][$function]['standalone']))
! 			{
! 				$hook = $this->hooks[$class][$function]['standalone'];
! 				if (function_exists($hook))
! 				{
! 					$function_call = '$this->hook_result[$class][$function] = ' . $hook . '(';
! 					for ($i = 0; $i < sizeof($arguments); $i++)
! 					{
! 						$function_call .= '$arguments[' . $i . '], ';
! 					}
! 					$function_call = substr($function_call, 0, -2) . ');';
! 
! 					eval($function_call);
! 				}
! 			}
! 			else
! 			{
! 				foreach (array('first', 'normal', 'last') as $mode)
! 				{
! 					if (!isset($this->hooks[$class][$function][$mode]))
! 					{
! 						continue;
! 					}
! 
! 					foreach ($this->hooks[$class][$function][$mode] as $hook)
! 					{
! 						if (function_exists($hook))
! 						{
! 							$function_call = '$this->hook_result[$class][$function] = ' . $hook . '(';
! 							for ($i = 0; $i < sizeof($arguments); $i++)
! 							{
! 								$function_call .= '$arguments[' . $i . '], ';
! 							}
! 							$function_call = substr($function_call, 0, -2) . ');';
! 
! 							eval($function_call);
! 						}
! 					}
! 				}
! 			}
! 
! 			$this->current_hook = NULL;
! 			return true;
! 		}
! 
! 		$this->current_hook = NULL;
! 		return false;
! 	}
  }
\ No newline at end of file

Modified: branches/stable/titania/includes/core/index.htm
==============================================================================
*** branches/stable/titania/includes/core/index.htm (original)
--- branches/stable/titania/includes/core/index.htm Fri Nov 19 19:35:14 2010
***************
*** 1,10 ****
! <html>
! <head>
! <title></title>
! <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
! </head>
! 
! <body bgcolor="#FFFFFF" text="#000000">
! 
! </body>
! </html>
--- 1,10 ----
! <html>
! <head>
! <title></title>
! <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
! </head>
! 
! <body bgcolor="#FFFFFF" text="#000000">
! 
! </body>
! </html>

Modified: branches/stable/titania/includes/core/object_message.php
==============================================================================
*** branches/stable/titania/includes/core/object_message.php (original)
--- branches/stable/titania/includes/core/object_message.php Fri Nov 19 19:35:14 2010
***************
*** 1,190 ****
! <?php
! /**
! *
! * @package Titania
! * @version $Id$
! * @copyright (c) 2008 phpBB Customisation Database Team
! * @license http://opensource.org/licenses/gpl-license.php GNU Public License
! *
! */
! 
! /**
! * @ignore
! */
! if (!defined('IN_TITANIA'))
! {
! 	exit;
! }
! 
! if (!class_exists('titania_database_object'))
! {
! 	require TITANIA_ROOT . 'includes/core/object_database.' . PHP_EXT;
! }
! 
! /**
!  * Class providing basic interaction with the message tool
!  * This extension expects you use at least message, message_uid, message_bitfield, and message_options fields.  If you do not use at least all of those do not use this extension
!  *
!  * @package Titania
!  */
! abstract class titania_message_object extends titania_database_object
! {
! 	/**
! 	* This allows us to have multiple message items for a single object
! 	*
! 	* @var string
! 	*/
! 	public $message_fields_prefix = 'message';
! 
! 	/**
! 	 * Submit data in the post_data format (from includes/tools/message.php)
! 	 *
! 	 * @param object $message The message object
! 	 */
! 	public function post_data($message)
! 	{
! 		$post_data = $message->request_data();
! 
! 		// Handle different field usage
! 		if ($this->message_fields_prefix != 'message')
! 		{
! 			$post_data[$this->message_fields_prefix] = $post_data['message'];
! 			unset($post_data['message']);
! 		}
! 
! 		foreach ($this->object_config as $field => $options)
! 		{
! 			if (isset($options['message_field']) && isset($post_data[$options['message_field']]))
! 			{
! 				$this->$field = $post_data[$options['message_field']];
! 			}
! 		}
! 
! 		$this->generate_text_for_storage($post_data['bbcode_enabled'], $post_data['magic_url_enabled'], $post_data['smilies_enabled']);
! 	}
! 
! 	/**
! 	 * Generate text for storing in the database
! 	 *
! 	 * @param bool $allow_bbcode
! 	 * @param bool $allow_urls
! 	 * @param bool $allow_smilies
! 	 */
! 	public function generate_text_for_storage($allow_bbcode = false, $allow_urls = false, $allow_smilies = false)
! 	{
! 		$message = $message_uid = $message_bitfield = $message_options = false;
! 		$this->get_message_fields($message, $message_uid, $message_bitfield, $message_options);
! 
! 		generate_text_for_storage($message, $message_uid, $message_bitfield, $message_options, $allow_bbcode, $allow_urls, $allow_smilies);
! 
! 		$this->set_message_fields($message, $message_uid, $message_bitfield, $message_options);
! 	}
! 
! 	/**
! 	 * Parse text for display
! 	 *
! 	 * @return string Parsed message for output
! 	 */
! 	public function generate_text_for_display()
! 	{
! 		$message = $message_uid = $message_bitfield = $message_options = false;
! 		$this->get_message_fields($message, $message_uid, $message_bitfield, $message_options);
! 
! 		return titania_generate_text_for_display($message, $message_uid, $message_bitfield, $message_options);
! 	}
! 
! 	/**
! 	 * Parse text for edit
! 	 *
! 	 * @return array of the items to be used in the message parser class
! 	 */
! 	public function generate_text_for_edit()
! 	{
! 		// Add the object type and object id
! 		$for_edit = array(
! 			// Object types can be setup to grab the value of another field (such as $this->post_type) by setting $this->object_type to the field name (post_type)
! 			'object_type'	=> (is_string($this->object_type) && isset($this->{$this->object_type})) ? $this->{$this->object_type} : $this->object_type,
! 			'object_id'		=> $this->{$this->sql_id_field},
! 		);
! 
! 		$message = $message_uid = $message_bitfield = $message_options = false;
! 		$this->get_message_fields($message, $message_uid, $message_bitfield, $message_options);
! 
! 		titania_decode_message($message, $message_uid);
! 
! 		$for_edit = array_merge($for_edit, array(
! 			'allow_bbcode'	=> ($message_options & OPTION_FLAG_BBCODE) ? 1 : 0,
! 			'allow_smilies'	=> ($message_options & OPTION_FLAG_SMILIES) ? 1 : 0,
! 			'allow_urls'	=> ($message_options & OPTION_FLAG_LINKS) ? 1 : 0,
! 			'text'			=> $message, // text is expected by some (it's the default for generate_text_for_edit)
! 			'message'		=> $message,
! 		));
! 
! 		// Add any of the marked fields to the array
! 		foreach ($this->object_config as $field => $options)
! 		{
! 			if (isset($options['message_field']))
! 			{
! 				$for_edit[$options['message_field']] = $this->$field;
! 			}
! 		}
! 
! 		return $for_edit;
! 	}
! 
! 	private function get_message_fields(&$message, &$message_uid, &$message_bitfield, &$message_options)
! 	{
! 		foreach ($this->object_config as $field => $options)
! 		{
! 			if (isset($options['message_field']))
! 			{
! 				switch ($options['message_field'])
! 				{
! 					case $this->message_fields_prefix :
! 						$message = $this->$field;
! 					break;
! 
! 					case $this->message_fields_prefix . '_uid' :
! 						$message_uid = $this->$field;
! 					break;
! 
! 					case $this->message_fields_prefix . '_bitfield' :
! 						$message_bitfield = $this->$field;
! 					break;
! 
! 					case $this->message_fields_prefix . '_options' :
! 						$message_options = $this->$field;
! 					break;
! 				}
! 			}
! 		}
! 	}
! 
! 	private function set_message_fields($message, $message_uid, $message_bitfield, $message_options)
! 	{
! 		foreach ($this->object_config as $field => $options)
! 		{
! 			if (isset($options['message_field']))
! 			{
! 				switch ($options['message_field'])
! 				{
! 					case $this->message_fields_prefix :
! 						$this->$field = $message;
! 					break;
! 
! 					case $this->message_fields_prefix . '_uid' :
! 						$this->$field = $message_uid;
! 					break;
! 
! 					case $this->message_fields_prefix . '_bitfield' :
! 						$this->$field = $message_bitfield;
! 					break;
! 
! 					case $this->message_fields_prefix . '_options' :
! 						$this->$field = $message_options;
! 					break;
! 				}
! 			}
! 		}
! 	}
  }
\ No newline at end of file
--- 1,190 ----
! <?php
! /**
! *
! * @package Titania
! * @version $Id$
! * @copyright (c) 2008 phpBB Customisation Database Team
! * @license http://opensource.org/licenses/gpl-license.php GNU Public License
! *
! */
! 
! /**
! * @ignore
! */
! if (!defined('IN_TITANIA'))
! {
! 	exit;
! }
! 
! if (!class_exists('titania_database_object'))
! {
! 	require TITANIA_ROOT . 'includes/core/object_database.' . PHP_EXT;
! }
! 
! /**
!  * Class providing basic interaction with the message tool
!  * This extension expects you use at least message, message_uid, message_bitfield, and message_options fields.  If you do not use at least all of those do not use this extension
!  *
!  * @package Titania
!  */
! abstract class titania_message_object extends titania_database_object
! {
! 	/**
! 	* This allows us to have multiple message items for a single object
! 	*
! 	* @var string
! 	*/
! 	public $message_fields_prefix = 'message';
! 
! 	/**
! 	 * Submit data in the post_data format (from includes/tools/message.php)
! 	 *
! 	 * @param object $message The message object
! 	 */
! 	public function post_data($message)
! 	{
! 		$post_data = $message->request_data();
! 
! 		// Handle different field usage
! 		if ($this->message_fields_prefix != 'message')
! 		{
! 			$post_data[$this->message_fields_prefix] = $post_data['message'];
! 			unset($post_data['message']);
! 		}
! 
! 		foreach ($this->object_config as $field => $options)
! 		{
! 			if (isset($options['message_field']) && isset($post_data[$options['message_field']]))
! 			{
! 				$this->$field = $post_data[$options['message_field']];
! 			}
! 		}
! 
! 		$this->generate_text_for_storage($post_data['bbcode_enabled'], $post_data['magic_url_enabled'], $post_data['smilies_enabled']);
! 	}
! 
! 	/**
! 	 * Generate text for storing in the database
! 	 *
! 	 * @param bool $allow_bbcode
! 	 * @param bool $allow_urls
! 	 * @param bool $allow_smilies
! 	 */
! 	public function generate_text_for_storage($allow_bbcode = false, $allow_urls = false, $allow_smilies = false)
! 	{
! 		$message = $message_uid = $message_bitfield = $message_options = false;
! 		$this->get_message_fields($message, $message_uid, $message_bitfield, $message_options);
! 
! 		generate_text_for_storage($message, $message_uid, $message_bitfield, $message_options, $allow_bbcode, $allow_urls, $allow_smilies);
! 
! 		$this->set_message_fields($message, $message_uid, $message_bitfield, $message_options);
! 	}
! 
! 	/**
! 	 * Parse text for display
! 	 *
! 	 * @return string Parsed message for output
! 	 */
! 	public function generate_text_for_display()
! 	{
! 		$message = $message_uid = $message_bitfield = $message_options = false;
! 		$this->get_message_fields($message, $message_uid, $message_bitfield, $message_options);
! 
! 		return titania_generate_text_for_display($message, $message_uid, $message_bitfield, $message_options);
! 	}
! 
! 	/**
! 	 * Parse text for edit
! 	 *
! 	 * @return array of the items to be used in the message parser class
! 	 */
! 	public function generate_text_for_edit()
! 	{
! 		// Add the object type and object id
! 		$for_edit = array(
! 			// Object types can be setup to grab the value of another field (such as $this->post_type) by setting $this->object_type to the field name (post_type)
! 			'object_type'	=> (is_string($this->object_type) && isset($this->{$this->object_type})) ? $this->{$this->object_type} : $this->object_type,
! 			'object_id'		=> $this->{$this->sql_id_field},
! 		);
! 
! 		$message = $message_uid = $message_bitfield = $message_options = false;
! 		$this->get_message_fields($message, $message_uid, $message_bitfield, $message_options);
! 
! 		titania_decode_message($message, $message_uid);
! 
! 		$for_edit = array_merge($for_edit, array(
! 			'allow_bbcode'	=> ($message_options & OPTION_FLAG_BBCODE) ? 1 : 0,
! 			'allow_smilies'	=> ($message_options & OPTION_FLAG_SMILIES) ? 1 : 0,
! 			'allow_urls'	=> ($message_options & OPTION_FLAG_LINKS) ? 1 : 0,
! 			'text'			=> $message, // text is expected by some (it's the default for generate_text_for_edit)
! 			'message'		=> $message,
! 		));
! 
! 		// Add any of the marked fields to the array
! 		foreach ($this->object_config as $field => $options)
! 		{
! 			if (isset($options['message_field']))
! 			{
! 				$for_edit[$options['message_field']] = $this->$field;
! 			}
! 		}
! 
! 		return $for_edit;
! 	}
! 
! 	private function get_message_fields(&$message, &$message_uid, &$message_bitfield, &$message_options)
! 	{
! 		foreach ($this->object_config as $field => $options)
! 		{
! 			if (isset($options['message_field']))
! 			{
! 				switch ($options['message_field'])
! 				{
! 					case $this->message_fields_prefix :
! 						$message = $this->$field;
! 					break;
! 
! 					case $this->message_fields_prefix . '_uid' :
! 						$message_uid = $this->$field;
! 					break;
! 
! 					case $this->message_fields_prefix . '_bitfield' :
! 						$message_bitfield = $this->$field;
! 					break;
! 
! 					case $this->message_fields_prefix . '_options' :
! 						$message_options = $this->$field;
! 					break;
! 				}
! 			}
! 		}
! 	}
! 
! 	private function set_message_fields($message, $message_uid, $message_bitfield, $message_options)
! 	{
! 		foreach ($this->object_config as $field => $options)
! 		{
! 			if (isset($options['message_field']))
! 			{
! 				switch ($options['message_field'])
! 				{
! 					case $this->message_fields_prefix :
! 						$this->$field = $message;
! 					break;
! 
! 					case $this->message_fields_prefix . '_uid' :
! 						$this->$field = $message_uid;
! 					break;
! 
! 					case $this->message_fields_prefix . '_bitfield' :
! 						$this->$field = $message_bitfield;
! 					break;
! 
! 					case $this->message_fields_prefix . '_options' :
! 						$this->$field = $message_options;
! 					break;
! 				}
! 			}
! 		}
! 	}
  }
\ No newline at end of file

Modified: branches/stable/titania/includes/core/phpbb.php
==============================================================================
*** branches/stable/titania/includes/core/phpbb.php (original)
--- branches/stable/titania/includes/core/phpbb.php Fri Nov 19 19:35:14 2010
***************
*** 1,498 ****
! <?php
! /**
!  *
!  * @package Titania
!  * @version $Id$
!  * @copyright (c) 2009 phpBB Customisation Database Team
!  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
!  *
!  */
! 
! /**
!  * @ignore
!  */
! if (!defined('IN_TITANIA'))
! {
! 	exit;
! }
! 
! /**
!  * phpBB class that will be used in place of globalising these variables.
!  */
! class phpbb
! {
! 	/** @var auth phpBB Auth class */
! 	public static $auth;
! 
! 	/** @var cache phpBB Cache class */
! 	public static $cache;
! 	
! 	/** @var config phpBB Config class */
! 	public static $config;
! 	
! 	/** @var db phpBB DBAL class */
! 	public static $db;
! 	
! 	/** @var template phpBB Template class */
! 	public static $template;
! 	
! 	/** @var user phpBB User class */
! 	public static $user;
! 	
! 	/** @var array $user->theme */
! 	public static $theme_data;
! 
! 	/**
! 	 * Static Constructor.
! 	 */
! 	public static function initialise()
! 	{
! 		global $auth, $config, $db, $template, $user, $cache;
! 
! 		self::$auth		= &$auth;
! 		self::$config	= &$config;
! 		self::$db		= &$db;
! 		self::$template	= &$template;
! 		self::$user		= &$user;
! 		self::$cache	= &$cache;
! 
! 		// Start session management
! 		if (!defined('PHPBB_INCLUDED'))
! 		{
! 			self::$user->session_begin();
! 			self::$auth->acl(self::$user->data);
! 			self::$user->setup();
! 		}
! 
! 		self::$theme_data = self::$user->theme;
! 	}
! 
! 	/**
! 	* Shortcut for phpbb's append_sid function (do not send the root path/phpext in the url part)
! 	*
! 	* @param mixed $url
! 	* @param mixed $params
! 	* @param mixed $is_amp
! 	* @param mixed $session_id
! 	* @return string
! 	*/
! 	public static function append_sid($url, $params = false, $is_amp = true, $session_id = false)
! 	{
! 		if (!strpos($url, '.' . PHP_EXT))
! 		{
! 			$url = titania::$absolute_board . $url . '.' . PHP_EXT;
! 		}
! 
! 		return append_sid($url, $params, $is_amp, $session_id);
! 	}
! 
! 	/**
! 	* Include a phpBB includes file
! 	*
! 	* @param string $file The name of the file
! 	* @param string|bool $function_check Bool false to ignore; string function name to check if the function exists (and not load the file if it does)
! 	* @param string|bool $class_check Bool false to ignore; string class name to check if the class exists (and not load the file if it does)
! 	*/
! 	public static function _include($file, $function_check = false, $class_check = false)
! 	{
! 		if ($function_check !== false)
! 		{
! 			if (function_exists($function_check))
! 			{
! 				return;
! 			}
! 		}
! 
! 		if ($class_check !== false)
! 		{
! 			if (class_exists($class_check))
! 			{
! 				return;
! 			}
! 		}
! 
! 		include(PHPBB_ROOT_PATH . 'includes/' . $file . '.' . PHP_EXT);
! 	}
! 
! 	/**
! 	* Reset the template/theme data to the phpBB information
! 	*/
! 	public static function reset_template()
! 	{
! 		self::$user->theme = self::$theme_data;
! 		self::$template->set_template();
! 	}
! 
! 	/**
! 	 * Page header function for phpBB stuff
! 	 *
! 	 * @param <string> $page_title
! 	 */
! 	public static function page_header($page_title = '')
! 	{
! 		// gzip_compression
! 		if (self::$config['gzip_compress'])
! 		{
! 			if (@extension_loaded('zlib') && !headers_sent())
! 			{
! 				ob_start('ob_gzhandler');
! 			}
! 		}
! 
! 		// Send a proper content-language to the output
! 		$user_lang = self::$user->lang['USER_LANG'];
! 		if (strpos($user_lang, '-x-') !== false)
! 		{
! 			$user_lang = substr($user_lang, 0, strpos($user_lang, '-x-'));
! 		}
! 
! 		// Check if page_title is a language string
! 		if (isset(self::$user->lang[$page_title]))
! 		{
! 			$page_title = self::$user->lang[$page_title];
! 		}
! 
! 		// Generate logged in/logged out status
! 		if (self::$user->data['user_id'] != ANONYMOUS)
! 		{
! 			$u_login_logout = titania_url::build_url('logout');
! 			$l_login_logout = sprintf(self::$user->lang['LOGOUT_USER'], self::$user->data['username']);
! 		}
! 		else
! 		{
! 			$u_login_logout = titania_url::build_url('login');
! 			$l_login_logout = self::$user->lang['LOGIN'];
! 		}
! 
! 		$l_privmsgs_text = $l_privmsgs_text_unread = '';
! 		$s_privmsg_new = false;
! 
! 		// Obtain number of new private messages if user is logged in
! 		if (!empty(self::$user->data['is_registered']))
! 		{
! 			if (self::$user->data['user_new_privmsg'])
! 			{
! 				$l_message_new = (self::$user->data['user_new_privmsg'] == 1) ? self::$user->lang['NEW_PM'] : self::$user->lang['NEW_PMS'];
! 				$l_privmsgs_text = sprintf($l_message_new, self::$user->data['user_new_privmsg']);
! 
! 				if (!self::$user->data['user_last_privmsg'] || self::$user->data['user_last_privmsg'] > self::$user->data['session_last_visit'])
! 				{
! 					$sql = 'UPDATE ' . USERS_TABLE . '
! 						SET user_last_privmsg = ' . self::$user->data['session_last_visit'] . '
! 						WHERE user_id = ' . self::$user->data['user_id'];
! 					self::$db->sql_query($sql);
! 
! 					$s_privmsg_new = true;
! 				}
! 				else
! 				{
! 					$s_privmsg_new = false;
! 				}
! 			}
! 			else
! 			{
! 				$l_privmsgs_text = self::$user->lang['NO_NEW_PM'];
! 				$s_privmsg_new = false;
! 			}
! 
! 			$l_privmsgs_text_unread = '';
! 
! 			if (self::$user->data['user_unread_privmsg'] && self::$user->data['user_unread_privmsg'] != self::$user->data['user_new_privmsg'])
! 			{
! 				$l_message_unread = (self::$user->data['user_unread_privmsg'] == 1) ? self::$user->lang['UNREAD_PM'] : self::$user->lang['UNREAD_PMS'];
! 				$l_privmsgs_text_unread = sprintf($l_message_unread, self::$user->data['user_unread_privmsg']);
! 			}
! 		}
! 
! 		self::$template->assign_vars(array(
! 			'SITENAME'				=> self::$config['sitename'],
! 			'SITE_DESCRIPTION'		=> self::$config['site_desc'],
! 			'PAGE_TITLE'			=> $page_title,
! 			'SCRIPT_NAME'			=> str_replace('.' . PHP_EXT, '', self::$user->page['page_name']),
! 			'CURRENT_TIME'			=> sprintf(self::$user->lang['CURRENT_TIME'], self::$user->format_date(time(), false, true)),
! 			'LAST_VISIT_DATE'		=> sprintf(self::$user->lang['YOU_LAST_VISIT'], ((self::$user->data['user_id'] != ANONYMOUS) ? self::$user->format_date(self::$user->data['session_last_visit']) : '')),
! 			'SITE_LOGO_IMG'			=> self::$user->img('site_logo'),
! 			'PRIVATE_MESSAGE_INFO'			=> $l_privmsgs_text,
! 			'PRIVATE_MESSAGE_INFO_UNREAD'	=> $l_privmsgs_text_unread,
! 
! 			'U_REGISTER'			=> self::append_sid('ucp', 'mode=register'),
! 			'S_LOGIN_ACTION'		=> titania_url::$current_page_url,
! 			'U_LOGIN_LOGOUT'		=> $u_login_logout,
! 			'L_LOGIN_LOGOUT'		=> $l_login_logout,
! 			'LOGIN_REDIRECT'		=> titania_url::$current_page_url,
! 
! 			'SESSION_ID'			=> self::$user->session_id,
! 
! 			'U_PRIVATEMSGS'			=> self::append_sid('ucp', 'i=pm&amp;folder=inbox'),
! 			'UA_POPUP_PM'			=> addslashes(self::append_sid('ucp', 'i=pm&amp;mode=popup')),
! 			'U_PROFILE'				=> self::append_sid('ucp'),
! 			'U_RESTORE_PERMISSIONS'	=> (self::$user->data['user_perm_from'] && self::$auth->acl_get('a_switchperm')) ? self::append_sid('ucp', 'mode=restore_perm') : '',
! 			'U_DELETE_COOKIES'		=> self::append_sid('ucp', 'mode=delete_cookies'),
! 
! 			'S_DISPLAY_PM'			=> (self::$config['allow_privmsg'] && !empty(self::$user->data['is_registered']) && (self::$auth->acl_get('u_readpm') || self::$auth->acl_get('u_sendpm'))) ? true : false,
! 			'S_USER_PM_POPUP'		=> self::$user->optionget('popuppm'),
! 			'S_NEW_PM'				=> ($s_privmsg_new) ? 1 : 0,
! 			'S_USER_LOGGED_IN'		=> (self::$user->data['user_id'] != ANONYMOUS) ? true : false,
! 			'S_AUTOLOGIN_ENABLED'	=> (self::$config['allow_autologin']) ? true : false,
! 			'S_BOARD_DISABLED'		=> (self::$config['board_disable']) ? true : false,
! 			'S_REGISTERED_USER'		=> (!empty(self::$user->data['is_registered'])) ? true : false,
! 			'S_IS_BOT'				=> (!empty(self::$user->data['is_bot'])) ? true : false,
! 			'S_USER_LANG'			=> $user_lang,
! 			'S_USER_BROWSER'		=> (isset(self::$user->data['session_browser'])) ? self::$user->data['session_browser'] : self::$user->lang['UNKNOWN_BROWSER'],
! 			'S_USERNAME'			=> self::$user->data['username'],
! 			'S_CONTENT_DIRECTION'	=> self::$user->lang['DIRECTION'],
! 			'S_CONTENT_FLOW_BEGIN'	=> (self::$user->lang['DIRECTION'] == 'ltr') ? 'left' : 'right',
! 			'S_CONTENT_FLOW_END'	=> (self::$user->lang['DIRECTION'] == 'ltr') ? 'right' : 'left',
! 			'S_CONTENT_ENCODING'	=> 'UTF-8',
! 			'S_REGISTER_ENABLED'	=> (self::$config['require_activation'] != USER_ACTIVATION_DISABLE) ? true : false,
! 		));
! 
! 		// application/xhtml+xml not used because of IE
! 		header('Content-type: text/html; charset=UTF-8');
! 
! 		header('Cache-Control: private, no-cache="set-cookie"');
! 		header('Expires: 0');
! 		header('Pragma: no-cache');
! 	}
! 
! 	/**
! 	 * Page footer function handling the phpBB tasks
! 	 */
! 	public static function page_footer($run_cron = true)
! 	{
! 		self::$template->assign_vars(array(
! 			'RUN_CRON_TASK'			=> (!defined('IN_CRON') && $run_cron && !self::$config['board_disable']) ? '<img src="' . titania_url::build_url('cron') . '" width="1" height="1" alt="cron" />' : '',
! 
! 			'TRANSLATION_INFO'		=> (!empty(self::$user->lang['TRANSLATION_INFO'])) ? self::$user->lang['TRANSLATION_INFO'] : '',
! 
! 			'U_ACP'					=> (self::$auth->acl_get('a_') && !empty(self::$user->data['is_registered'])) ? self::append_sid('adm/index', false, true, self::$user->session_id) : '',
! 		));
! 
! 		self::$template->display('body');
! 
! 		garbage_collection();
! 		exit_handler();
! 	}
! 
! 
! 	/**
! 	* Generate login box or verify password
! 	*/
! 	function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = false, $s_display = true)
! 	{
! 		self::_include('captcha/captcha_factory', 'phpbb_captcha_factory');
! 		self::$user->add_lang('ucp');
! 
! 		$err = '';
! 
! 		// Make sure user->setup() has been called
! 		if (empty(self::$user->lang))
! 		{
! 			self::$user->setup();
! 		}
! 
! 		// Print out error if user tries to authenticate as an administrator without having the privileges...
! 		if ($admin && !self::$auth->acl_get('a_'))
! 		{
! 			// Not authd
! 			// anonymous/inactive users are never able to go to the ACP even if they have the relevant permissions
! 			if (self::$user->data['is_registered'])
! 			{
! 				add_log('admin', 'LOG_ADMIN_AUTH_FAIL');
! 			}
! 			trigger_error('NO_AUTH_ADMIN');
! 		}
! 
! 		if (isset($_POST['login']))
! 		{
! 			// Get credential
! 			if ($admin)
! 			{
! 				$credential = request_var('credential', '');
! 
! 				if (strspn($credential, 'abcdef0123456789') !== strlen($credential) || strlen($credential) != 32)
! 				{
! 					if (self::$user->data['is_registered'])
! 					{
! 						add_log('admin', 'LOG_ADMIN_AUTH_FAIL');
! 					}
! 					trigger_error('NO_AUTH_ADMIN');
! 				}
! 
! 				$password	= request_var('password_' . $credential, '', true);
! 			}
! 			else
! 			{
! 				$password	= request_var('password', '', true);
! 			}
! 
! 			$username	= request_var('username', '', true);
! 			$autologin	= (!empty($_POST['autologin'])) ? true : false;
! 			$viewonline = (!empty($_POST['viewonline'])) ? 0 : 1;
! 			$admin 		= ($admin) ? 1 : 0;
! 			$viewonline = ($admin) ? self::$user->data['session_viewonline'] : $viewonline;
! 
! 			// Check if the supplied username is equal to the one stored within the database if re-authenticating
! 			if ($admin && utf8_clean_string(self::$username) != utf8_clean_string(self::$user->data['username']))
! 			{
! 				// We log the attempt to use a different username...
! 				add_log('admin', 'LOG_ADMIN_AUTH_FAIL');
! 				trigger_error('NO_AUTH_ADMIN_USER_DIFFER');
! 			}
! 
! 			// If authentication is successful we redirect user to previous page
! 			$result = self::$auth->login($username, $password, $autologin, $viewonline, $admin);
! 
! 			// If admin authentication and login, we will log if it was a success or not...
! 			// We also break the operation on the first non-success login - it could be argued that the user already knows
! 			if ($admin)
! 			{
! 				if ($result['status'] == LOGIN_SUCCESS)
! 				{
! 					add_log('admin', 'LOG_ADMIN_AUTH_SUCCESS');
! 				}
! 				else
! 				{
! 					// Only log the failed attempt if a real user tried to.
! 					// anonymous/inactive users are never able to go to the ACP even if they have the relevant permissions
! 					if (self::$user->data['is_registered'])
! 					{
! 						add_log('admin', 'LOG_ADMIN_AUTH_FAIL');
! 					}
! 				}
! 			}
! 
! 			// The result parameter is always an array, holding the relevant information...
! 			if ($result['status'] == LOGIN_SUCCESS)
! 			{
! 				$redirect = request_var('redirect', '');
! 
! 				if ($redirect)
! 				{
! 					$redirect = titania_url::unbuild_url($redirect);
! 
! 					$base = $append = false;
! 					titania_url::split_base_params($base, $append, $redirect);
! 
! 					redirect(titania_url::build_url($base, $append));
! 				}
! 				else
! 				{
! 					redirect(titania_url::build_url(titania_url::$current_page, titania_url::$params));
! 				}
! 			}
! 
! 			// Something failed, determine what...
! 			if ($result['status'] == LOGIN_BREAK)
! 			{
! 				trigger_error($result['error_msg']);
! 			}
! 
! 			// Special cases... determine
! 			switch ($result['status'])
! 			{
! 				case LOGIN_ERROR_ATTEMPTS:
! 
! 					$captcha = phpbb_captcha_factory::get_instance(self::$config['captcha_plugin']);
! 					$captcha->init(CONFIRM_LOGIN);
! 					// $captcha->reset();
! 
! 					// Parse the captcha template
! 					self::reset_template();
! 					self::$template->set_filenames(array(
! 						'captcha'	=> $captcha->get_template(),
! 					));
! 
! 					// Correct confirm image link
! 					self::$template->assign_var('CONFIRM_IMAGE_LINK', self::append_sid('ucp', 'mode=confirm&amp;confirm_id=' . $captcha->confirm_id . '&amp;type=' . $captcha->type));
! 
! 					self::$template->assign_display('captcha', 'CAPTCHA', false);
! 
! 					titania::set_custom_template();
! 
! 					$err = self::$user->lang[$result['error_msg']];
! 				break;
! 
! 				case LOGIN_ERROR_PASSWORD_CONVERT:
! 					$err = sprintf(
! 						self::$user->lang[$result['error_msg']],
! 						(self::$config['email_enable']) ? '<a href="' . self::append_sid('ucp', 'mode=sendpassword') . '">' : '',
! 						(self::$config['email_enable']) ? '</a>' : '',
! 						(self::$config['board_contact']) ? '<a href="mailto:' . htmlspecialchars(self::$config['board_contact']) . '">' : '',
! 						(self::$config['board_contact']) ? '</a>' : ''
! 					);
! 				break;
! 
! 				// Username, password, etc...
! 				default:
! 					$err = self::$user->lang[$result['error_msg']];
! 
! 					// Assign admin contact to some error messages
! 					if ($result['error_msg'] == 'LOGIN_ERROR_USERNAME' || $result['error_msg'] == 'LOGIN_ERROR_PASSWORD')
! 					{
! 						$err = (!self::$config['board_contact']) ? sprintf(self::$user->lang[$result['error_msg']], '', '') : sprintf(self::$user->lang[$result['error_msg']], '<a href="mailto:' . htmlspecialchars(self::$config['board_contact']) . '">', '</a>');
! 					}
! 
! 				break;
! 			}
! 		}
! 
! 		// Assign credential for username/password pair
! 		$credential = ($admin) ? md5(unique_id()) : false;
! 
! 		$s_hidden_fields = array(
! 			'sid'		=> self::$user->session_id,
! 		);
! 
! 		if ($redirect)
! 		{
! 			$s_hidden_fields['redirect'] = $redirect;
! 		}
! 
! 		if ($admin)
! 		{
! 			$s_hidden_fields['credential'] = $credential;
! 		}
! 
! 		$s_hidden_fields = build_hidden_fields($s_hidden_fields);
! 
! 		titania::page_header('LOGIN');
! 
! 		self::$template->assign_vars(array(
! 			'LOGIN_ERROR'		=> $err,
! 			'LOGIN_EXPLAIN'		=> $l_explain,
! 
! 			'U_SEND_PASSWORD' 		=> (self::$config['email_enable']) ? self::append_sid('ucp', 'mode=sendpassword') : '',
! 			'U_RESEND_ACTIVATION'	=> (self::$config['require_activation'] == USER_ACTIVATION_SELF && self::$config['email_enable']) ? self::append_sid('ucp', 'mode=resend_act') : '',
! 			'U_TERMS_USE'			=> self::append_sid('ucp', 'mode=terms'),
! 			'U_PRIVACY'				=> self::append_sid('ucp', 'mode=privacy'),
! 
! 			'S_DISPLAY_FULL_LOGIN'	=> ($s_display) ? true : false,
! 			'S_HIDDEN_FIELDS' 		=> $s_hidden_fields,
! 
! 			'S_ADMIN_AUTH'			=> $admin,
! 			'USERNAME'				=> ($admin) ? self::$user->data['username'] : '',
! 
! 			'USERNAME_CREDENTIAL'	=> 'username',
! 			'PASSWORD_CREDENTIAL'	=> ($admin) ? 'password_' . $credential : 'password',
! 		));
! 
! 		titania::page_footer(true, 'login_body.html');
! 	}
! 
! 	/**
! 	* Update a user's postcount
! 	*
! 	* @param int $user_id The user_id
! 	* @param string $direction (+, -)
! 	* @param int $amount The amount to add or subtract
! 	*/
! 	public static function update_user_postcount($user_id, $direction = '+', $amount = 1)
! 	{
! 		$sql = 'UPDATE ' . USERS_TABLE . '
! 			SET user_posts = user_posts ' . (($direction == '+') ? '+' : '-') . ' ' . (int) $amount .
! 				(($direction == '+') ? ', user_lastpost_time = ' . time() : '') . '
! 			WHERE user_id = ' . (int) $user_id;
! 		self::$db->sql_query($sql);
! 	}
! }
--- 1,498 ----
! <?php
! /**
!  *
!  * @package Titania
!  * @version $Id$
!  * @copyright (c) 2009 phpBB Customisation Database Team
!  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
!  *
!  */
! 
! /**
!  * @ignore
!  */
! if (!defined('IN_TITANIA'))
! {
! 	exit;
! }
! 
! /**
!  * phpBB class that will be used in place of globalising these variables.
!  */
! class phpbb
! {
! 	/** @var auth phpBB Auth class */
! 	public static $auth;
! 
! 	/** @var cache phpBB Cache class */
! 	public static $cache;
! 	
! 	/** @var config phpBB Config class */
! 	public static $config;
! 	
! 	/** @var db phpBB DBAL class */
! 	public static $db;
! 	
! 	/** @var template phpBB Template class */
! 	public static $template;
! 	
! 	/** @var user phpBB User class */
! 	public static $user;
! 	
! 	/** @var array $user->theme */
! 	public static $theme_data;
! 
! 	/**
! 	 * Static Constructor.
! 	 */
! 	public static function initialise()
! 	{
! 		global $auth, $config, $db, $template, $user, $cache;
! 
! 		self::$auth		= &$auth;
! 		self::$config	= &$config;
! 		self::$db		= &$db;
! 		self::$template	= &$template;
! 		self::$user		= &$user;
! 		self::$cache	= &$cache;
! 
! 		// Start session management
! 		if (!defined('PHPBB_INCLUDED'))
! 		{
! 			self::$user->session_begin();
! 			self::$auth->acl(self::$user->data);
! 			self::$user->setup();
! 		}
! 
! 		self::$theme_data = self::$user->theme;
! 	}
! 
! 	/**
! 	* Shortcut for phpbb's append_sid function (do not send the root path/phpext in the url part)
! 	*
! 	* @param mixed $url
! 	* @param mixed $params
! 	* @param mixed $is_amp
! 	* @param mixed $session_id
! 	* @return string
! 	*/
! 	public static function append_sid($url, $params = false, $is_amp = true, $session_id = false)
! 	{
! 		if (!strpos($url, '.' . PHP_EXT))
! 		{
! 			$url = titania::$absolute_board . $url . '.' . PHP_EXT;
! 		}
! 
! 		return append_sid($url, $params, $is_amp, $session_id);
! 	}
! 
! 	/**
! 	* Include a phpBB includes file
! 	*
! 	* @param string $file The name of the file
! 	* @param string|bool $function_check Bool false to ignore; string function name to check if the function exists (and not load the file if it does)
! 	* @param string|bool $class_check Bool false to ignore; string class name to check if the class exists (and not load the file if it does)
! 	*/
! 	public static function _include($file, $function_check = false, $class_check = false)
! 	{
! 		if ($function_check !== false)
! 		{
! 			if (function_exists($function_check))
! 			{
! 				return;
! 			}
! 		}
! 
! 		if ($class_check !== false)
! 		{
! 			if (class_exists($class_check))
! 			{
! 				return;
! 			}
! 		}
! 
! 		include(PHPBB_ROOT_PATH . 'includes/' . $file . '.' . PHP_EXT);
! 	}
! 
! 	/**
! 	* Reset the template/theme data to the phpBB information
! 	*/
! 	public static function reset_template()
! 	{
! 		self::$user->theme = self::$theme_data;
! 		self::$template->set_template();
! 	}
! 
! 	/**
! 	 * Page header function for phpBB stuff
! 	 *
! 	 * @param <string> $page_title
! 	 */
! 	public static function page_header($page_title = '')
! 	{
! 		// gzip_compression
! 		if (self::$config['gzip_compress'])
! 		{
! 			if (@extension_loaded('zlib') && !headers_sent())
! 			{
! 				ob_start('ob_gzhandler');
! 			}
! 		}
! 
! 		// Send a proper content-language to the output
! 		$user_lang = self::$user->lang['USER_LANG'];
! 		if (strpos($user_lang, '-x-') !== false)
! 		{
! 			$user_lang = substr($user_lang, 0, strpos($user_lang, '-x-'));
! 		}
! 
! 		// Check if page_title is a language string
! 		if (isset(self::$user->lang[$page_title]))
! 		{
! 			$page_title = self::$user->lang[$page_title];
! 		}
! 
! 		// Generate logged in/logged out status
! 		if (self::$user->data['user_id'] != ANONYMOUS)
! 		{
! 			$u_login_logout = titania_url::build_url('logout');
! 			$l_login_logout = sprintf(self::$user->lang['LOGOUT_USER'], self::$user->data['username']);
! 		}
! 		else
! 		{
! 			$u_login_logout = titania_url::build_url('login');
! 			$l_login_logout = self::$user->lang['LOGIN'];
! 		}
! 
! 		$l_privmsgs_text = $l_privmsgs_text_unread = '';
! 		$s_privmsg_new = false;
! 
! 		// Obtain number of new private messages if user is logged in
! 		if (!empty(self::$user->data['is_registered']))
! 		{
! 			if (self::$user->data['user_new_privmsg'])
! 			{
! 				$l_message_new = (self::$user->data['user_new_privmsg'] == 1) ? self::$user->lang['NEW_PM'] : self::$user->lang['NEW_PMS'];
! 				$l_privmsgs_text = sprintf($l_message_new, self::$user->data['user_new_privmsg']);
! 
! 				if (!self::$user->data['user_last_privmsg'] || self::$user->data['user_last_privmsg'] > self::$user->data['session_last_visit'])
! 				{
! 					$sql = 'UPDATE ' . USERS_TABLE . '
! 						SET user_last_privmsg = ' . self::$user->data['session_last_visit'] . '
! 						WHERE user_id = ' . self::$user->data['user_id'];
! 					self::$db->sql_query($sql);
! 
! 					$s_privmsg_new = true;
! 				}
! 				else
! 				{
! 					$s_privmsg_new = false;
! 				}
! 			}
! 			else
! 			{
! 				$l_privmsgs_text = self::$user->lang['NO_NEW_PM'];
! 				$s_privmsg_new = false;
! 			}
! 
! 			$l_privmsgs_text_unread = '';
! 
! 			if (self::$user->data['user_unread_privmsg'] && self::$user->data['user_unread_privmsg'] != self::$user->data['user_new_privmsg'])
! 			{
! 				$l_message_unread = (self::$user->data['user_unread_privmsg'] == 1) ? self::$user->lang['UNREAD_PM'] : self::$user->lang['UNREAD_PMS'];
! 				$l_privmsgs_text_unread = sprintf($l_message_unread, self::$user->data['user_unread_privmsg']);
! 			}
! 		}
! 
! 		self::$template->assign_vars(array(
! 			'SITENAME'				=> self::$config['sitename'],
! 			'SITE_DESCRIPTION'		=> self::$config['site_desc'],
! 			'PAGE_TITLE'			=> $page_title,
! 			'SCRIPT_NAME'			=> str_replace('.' . PHP_EXT, '', self::$user->page['page_name']),
! 			'CURRENT_TIME'			=> sprintf(self::$user->lang['CURRENT_TIME'], self::$user->format_date(time(), false, true)),
! 			'LAST_VISIT_DATE'		=> sprintf(self::$user->lang['YOU_LAST_VISIT'], ((self::$user->data['user_id'] != ANONYMOUS) ? self::$user->format_date(self::$user->data['session_last_visit']) : '')),
! 			'SITE_LOGO_IMG'			=> self::$user->img('site_logo'),
! 			'PRIVATE_MESSAGE_INFO'			=> $l_privmsgs_text,
! 			'PRIVATE_MESSAGE_INFO_UNREAD'	=> $l_privmsgs_text_unread,
! 
! 			'U_REGISTER'			=> self::append_sid('ucp', 'mode=register'),
! 			'S_LOGIN_ACTION'		=> titania_url::$current_page_url,
! 			'U_LOGIN_LOGOUT'		=> $u_login_logout,
! 			'L_LOGIN_LOGOUT'		=> $l_login_logout,
! 			'LOGIN_REDIRECT'		=> titania_url::$current_page_url,
! 
! 			'SESSION_ID'			=> self::$user->session_id,
! 
! 			'U_PRIVATEMSGS'			=> self::append_sid('ucp', 'i=pm&amp;folder=inbox'),
! 			'UA_POPUP_PM'			=> addslashes(self::append_sid('ucp', 'i=pm&amp;mode=popup')),
! 			'U_PROFILE'				=> self::append_sid('ucp'),
! 			'U_RESTORE_PERMISSIONS'	=> (self::$user->data['user_perm_from'] && self::$auth->acl_get('a_switchperm')) ? self::append_sid('ucp', 'mode=restore_perm') : '',
! 			'U_DELETE_COOKIES'		=> self::append_sid('ucp', 'mode=delete_cookies'),
! 
! 			'S_DISPLAY_PM'			=> (self::$config['allow_privmsg'] && !empty(self::$user->data['is_registered']) && (self::$auth->acl_get('u_readpm') || self::$auth->acl_get('u_sendpm'))) ? true : false,
! 			'S_USER_PM_POPUP'		=> self::$user->optionget('popuppm'),
! 			'S_NEW_PM'				=> ($s_privmsg_new) ? 1 : 0,
! 			'S_USER_LOGGED_IN'		=> (self::$user->data['user_id'] != ANONYMOUS) ? true : false,
! 			'S_AUTOLOGIN_ENABLED'	=> (self::$config['allow_autologin']) ? true : false,
! 			'S_BOARD_DISABLED'		=> (self::$config['board_disable']) ? true : false,
! 			'S_REGISTERED_USER'		=> (!empty(self::$user->data['is_registered'])) ? true : false,
! 			'S_IS_BOT'				=> (!empty(self::$user->data['is_bot'])) ? true : false,
! 			'S_USER_LANG'			=> $user_lang,
! 			'S_USER_BROWSER'		=> (isset(self::$user->data['session_browser'])) ? self::$user->data['session_browser'] : self::$user->lang['UNKNOWN_BROWSER'],
! 			'S_USERNAME'			=> self::$user->data['username'],
! 			'S_CONTENT_DIRECTION'	=> self::$user->lang['DIRECTION'],
! 			'S_CONTENT_FLOW_BEGIN'	=> (self::$user->lang['DIRECTION'] == 'ltr') ? 'left' : 'right',
! 			'S_CONTENT_FLOW_END'	=> (self::$user->lang['DIRECTION'] == 'ltr') ? 'right' : 'left',
! 			'S_CONTENT_ENCODING'	=> 'UTF-8',
! 			'S_REGISTER_ENABLED'	=> (self::$config['require_activation'] != USER_ACTIVATION_DISABLE) ? true : false,
! 		));
! 
! 		// application/xhtml+xml not used because of IE
! 		header('Content-type: text/html; charset=UTF-8');
! 
! 		header('Cache-Control: private, no-cache="set-cookie"');
! 		header('Expires: 0');
! 		header('Pragma: no-cache');
! 	}
! 
! 	/**
! 	 * Page footer function handling the phpBB tasks
! 	 */
! 	public static function page_footer($run_cron = true)
! 	{
! 		self::$template->assign_vars(array(
! 			'RUN_CRON_TASK'			=> (!defined('IN_CRON') && $run_cron && !self::$config['board_disable']) ? '<img src="' . titania_url::build_url('cron') . '" width="1" height="1" alt="cron" />' : '',
! 
! 			'TRANSLATION_INFO'		=> (!empty(self::$user->lang['TRANSLATION_INFO'])) ? self::$user->lang['TRANSLATION_INFO'] : '',
! 
! 			'U_ACP'					=> (self::$auth->acl_get('a_') && !empty(self::$user->data['is_registered'])) ? self::append_sid('adm/index', false, true, self::$user->session_id) : '',
! 		));
! 
! 		self::$template->display('body');
! 
! 		garbage_collection();
! 		exit_handler();
! 	}
! 
! 
! 	/**
! 	* Generate login box or verify password
! 	*/
! 	function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = false, $s_display = true)
! 	{
! 		self::_include('captcha/captcha_factory', 'phpbb_captcha_factory');
! 		self::$user->add_lang('ucp');
! 
! 		$err = '';
! 
! 		// Make sure user->setup() has been called
! 		if (empty(self::$user->lang))
! 		{
! 			self::$user->setup();
! 		}
! 
! 		// Print out error if user tries to authenticate as an administrator without having the privileges...
! 		if ($admin && !self::$auth->acl_get('a_'))
! 		{
! 			// Not authd
! 			// anonymous/inactive users are never able to go to the ACP even if they have the relevant permissions
! 			if (self::$user->data['is_registered'])
! 			{
! 				add_log('admin', 'LOG_ADMIN_AUTH_FAIL');
! 			}
! 			trigger_error('NO_AUTH_ADMIN');
! 		}
! 
! 		if (isset($_POST['login']))
! 		{
! 			// Get credential
! 			if ($admin)
! 			{
! 				$credential = request_var('credential', '');
! 
! 				if (strspn($credential, 'abcdef0123456789') !== strlen($credential) || strlen($credential) != 32)
! 				{
! 					if (self::$user->data['is_registered'])
! 					{
! 						add_log('admin', 'LOG_ADMIN_AUTH_FAIL');
! 					}
! 					trigger_error('NO_AUTH_ADMIN');
! 				}
! 
! 				$password	= request_var('password_' . $credential, '', true);
! 			}
! 			else
! 			{
! 				$password	= request_var('password', '', true);
! 			}
! 
! 			$username	= request_var('username', '', true);
! 			$autologin	= (!empty($_POST['autologin'])) ? true : false;
! 			$viewonline = (!empty($_POST['viewonline'])) ? 0 : 1;
! 			$admin 		= ($admin) ? 1 : 0;
! 			$viewonline = ($admin) ? self::$user->data['session_viewonline'] : $viewonline;
! 
! 			// Check if the supplied username is equal to the one stored within the database if re-authenticating
! 			if ($admin && utf8_clean_string(self::$username) != utf8_clean_string(self::$user->data['username']))
! 			{
! 				// We log the attempt to use a different username...
! 				add_log('admin', 'LOG_ADMIN_AUTH_FAIL');
! 				trigger_error('NO_AUTH_ADMIN_USER_DIFFER');
! 			}
! 
! 			// If authentication is successful we redirect user to previous page
! 			$result = self::$auth->login($username, $password, $autologin, $viewonline, $admin);
! 
! 			// If admin authentication and login, we will log if it was a success or not...
! 			// We also break the operation on the first non-success login - it could be argued that the user already knows
! 			if ($admin)
! 			{
! 				if ($result['status'] == LOGIN_SUCCESS)
! 				{
! 					add_log('admin', 'LOG_ADMIN_AUTH_SUCCESS');
! 				}
! 				else
! 				{
! 					// Only log the failed attempt if a real user tried to.
! 					// anonymous/inactive users are never able to go to the ACP even if they have the relevant permissions
! 					if (self::$user->data['is_registered'])
! 					{
! 						add_log('admin', 'LOG_ADMIN_AUTH_FAIL');
! 					}
! 				}
! 			}
! 
! 			// The result parameter is always an array, holding the relevant information...
! 			if ($result['status'] == LOGIN_SUCCESS)
! 			{
! 				$redirect = request_var('redirect', '');
! 
! 				if ($redirect)
! 				{
! 					$redirect = titania_url::unbuild_url($redirect);
! 
! 					$base = $append = false;
! 					titania_url::split_base_params($base, $append, $redirect);
! 
! 					redirect(titania_url::build_url($base, $append));
! 				}
! 				else
! 				{
! 					redirect(titania_url::build_url(titania_url::$current_page, titania_url::$params));
! 				}
! 			}
! 
! 			// Something failed, determine what...
! 			if ($result['status'] == LOGIN_BREAK)
! 			{
! 				trigger_error($result['error_msg']);
! 			}
! 
! 			// Special cases... determine
! 			switch ($result['status'])
! 			{
! 				case LOGIN_ERROR_ATTEMPTS:
! 
! 					$captcha = phpbb_captcha_factory::get_instance(self::$config['captcha_plugin']);
! 					$captcha->init(CONFIRM_LOGIN);
! 					// $captcha->reset();
! 
! 					// Parse the captcha template
! 					self::reset_template();
! 					self::$template->set_filenames(array(
! 						'captcha'	=> $captcha->get_template(),
! 					));
! 
! 					// Correct confirm image link
! 					self::$template->assign_var('CONFIRM_IMAGE_LINK', self::append_sid('ucp', 'mode=confirm&amp;confirm_id=' . $captcha->confirm_id . '&amp;type=' . $captcha->type));
! 
! 					self::$template->assign_display('captcha', 'CAPTCHA', false);
! 
! 					titania::set_custom_template();
! 
! 					$err = self::$user->lang[$result['error_msg']];
! 				break;
! 
! 				case LOGIN_ERROR_PASSWORD_CONVERT:
! 					$err = sprintf(
! 						self::$user->lang[$result['error_msg']],
! 						(self::$config['email_enable']) ? '<a href="' . self::append_sid('ucp', 'mode=sendpassword') . '">' : '',
! 						(self::$config['email_enable']) ? '</a>' : '',
! 						(self::$config['board_contact']) ? '<a href="mailto:' . htmlspecialchars(self::$config['board_contact']) . '">' : '',
! 						(self::$config['board_contact']) ? '</a>' : ''
! 					);
! 				break;
! 
! 				// Username, password, etc...
! 				default:
! 					$err = self::$user->lang[$result['error_msg']];
! 
! 					// Assign admin contact to some error messages
! 					if ($result['error_msg'] == 'LOGIN_ERROR_USERNAME' || $result['error_msg'] == 'LOGIN_ERROR_PASSWORD')
! 					{
! 						$err = (!self::$config['board_contact']) ? sprintf(self::$user->lang[$result['error_msg']], '', '') : sprintf(self::$user->lang[$result['error_msg']], '<a href="mailto:' . htmlspecialchars(self::$config['board_contact']) . '">', '</a>');
! 					}
! 
! 				break;
! 			}
! 		}
! 
! 		// Assign credential for username/password pair
! 		$credential = ($admin) ? md5(unique_id()) : false;
! 
! 		$s_hidden_fields = array(
! 			'sid'		=> self::$user->session_id,
! 		);
! 
! 		if ($redirect)
! 		{
! 			$s_hidden_fields['redirect'] = $redirect;
! 		}
! 
! 		if ($admin)
! 		{
! 			$s_hidden_fields['credential'] = $credential;
! 		}
! 
! 		$s_hidden_fields = build_hidden_fields($s_hidden_fields);
! 
! 		titania::page_header('LOGIN');
! 
! 		self::$template->assign_vars(array(
! 			'LOGIN_ERROR'		=> $err,
! 			'LOGIN_EXPLAIN'		=> $l_explain,
! 
! 			'U_SEND_PASSWORD' 		=> (self::$config['email_enable']) ? self::append_sid('ucp', 'mode=sendpassword') : '',
! 			'U_RESEND_ACTIVATION'	=> (self::$config['require_activation'] == USER_ACTIVATION_SELF && self::$config['email_enable']) ? self::append_sid('ucp', 'mode=resend_act') : '',
! 			'U_TERMS_USE'			=> self::append_sid('ucp', 'mode=terms'),
! 			'U_PRIVACY'				=> self::append_sid('ucp', 'mode=privacy'),
! 
! 			'S_DISPLAY_FULL_LOGIN'	=> ($s_display) ? true : false,
! 			'S_HIDDEN_FIELDS' 		=> $s_hidden_fields,
! 
! 			'S_ADMIN_AUTH'			=> $admin,
! 			'USERNAME'				=> ($admin) ? self::$user->data['username'] : '',
! 
! 			'USERNAME_CREDENTIAL'	=> 'username',
! 			'PASSWORD_CREDENTIAL'	=> ($admin) ? 'password_' . $credential : 'password',
! 		));
! 
! 		titania::page_footer(true, 'login_body.html');
! 	}
! 
! 	/**
! 	* Update a user's postcount
! 	*
! 	* @param int $user_id The user_id
! 	* @param string $direction (+, -)
! 	* @param int $amount The amount to add or subtract
! 	*/
! 	public static function update_user_postcount($user_id, $direction = '+', $amount = 1)
! 	{
! 		$sql = 'UPDATE ' . USERS_TABLE . '
! 			SET user_posts = user_posts ' . (($direction == '+') ? '+' : '-') . ' ' . (int) $amount .
! 				(($direction == '+') ? ', user_lastpost_time = ' . time() : '') . '
! 			WHERE user_id = ' . (int) $user_id;
! 		self::$db->sql_query($sql);
! 	}
! }




More information about the customisationdb-commits mailing list