diff options
| -rw-r--r-- | phpBB/includes/functions_content.php | 77 | ||||
| -rw-r--r-- | phpBB/includes/functions_install.php | 277 | ||||
| -rw-r--r-- | phpBB/includes/functions_module.php | 19 | ||||
| -rw-r--r-- | phpBB/install/database_update.php | 1517 | ||||
| -rw-r--r-- | phpBB/install/install_convert.php | 2 | ||||
| -rw-r--r-- | phpBB/install/install_install.php | 7 | ||||
| -rw-r--r-- | phpBB/language/en/common.php | 16 | ||||
| -rw-r--r-- | phpBB/modules/acp/acp_forums.php | 4 | ||||
| -rw-r--r-- | phpBB/modules/acp/acp_main.php | 2 | ||||
| -rw-r--r-- | phpBB/modules/acp/acp_search.php | 4 | ||||
| -rw-r--r-- | phpBB/modules/acp/acp_styles.php | 4 | 
11 files changed, 253 insertions, 1676 deletions
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 16a7f08b9b..56f91eff3b 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -43,9 +43,7 @@ if (!defined('IN_PHPBB'))  */  function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key, &$sort_dir, &$s_limit_days, &$s_sort_key, &$s_sort_dir, &$u_sort_param, $def_st = false, $def_sk = false, $def_sd = false)  { -	global $user; - -	$sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); +	$sort_dir_text = array('a' => phpbb::$user->lang['ASCENDING'], 'd' => phpbb::$user->lang['DESCENDING']);  	$sorts = array(  		'st'	=> array( @@ -110,8 +108,6 @@ function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key,  */  function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list = false, $force_display = false)  { -	global $auth, $template, $user, $db; -  	// We only return if the jumpbox is not forced to be displayed (in case it is needed for functionality)  	if (!phpbb::$config['load_jumpbox'] && $force_display === false)  	{ @@ -121,7 +117,7 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list  	$sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id  		FROM ' . FORUMS_TABLE . '  		ORDER BY left_id ASC'; -	$result = $db->sql_query($sql, 600); +	$result = phpbb::$db->sql_query($sql, 600);  	$right = $padding = 0;  	$padding_store = array('0' => 0); @@ -132,7 +128,7 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list  	// This is the result of forums not displayed at index, having list permissions and a parent of a forum with no permissions.  	// If this happens, the padding could be "broken" -	while ($row = $db->sql_fetchrow($result)) +	while ($row = phpbb::$db->sql_fetchrow($result))  	{  		if ($row['left_id'] < $right)  		{ @@ -154,22 +150,22 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list  			continue;  		} -		if (!$auth->acl_get('f_list', $row['forum_id'])) +		if (!phpbb::$acl->acl_get('f_list', $row['forum_id']))  		{  			// if the user does not have permissions to list this forum skip  			continue;  		} -		if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id'])) +		if ($acl_list && !phpbb::$acl->acl_gets($acl_list, $row['forum_id']))  		{  			continue;  		}  		if (!$display_jumpbox)  		{ -			$template->assign_block_vars('jumpbox_forums', array( +			phpbb::$template->assign_block_vars('jumpbox_forums', array(  				'FORUM_ID'		=> ($select_all) ? 0 : -1, -				'FORUM_NAME'	=> ($select_all) ? $user->lang['ALL_FORUMS'] : $user->lang['SELECT_FORUM'], +				'FORUM_NAME'	=> ($select_all) ? phpbb::$user->lang['ALL_FORUMS'] : phpbb::$user->lang['SELECT_FORUM'],  				'S_FORUM_COUNT'	=> $iteration)  			); @@ -177,7 +173,7 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list  			$display_jumpbox = true;  		} -		$template->assign_block_vars('jumpbox_forums', array( +		phpbb::$template->assign_block_vars('jumpbox_forums', array(  			'FORUM_ID'		=> $row['forum_id'],  			'FORUM_NAME'	=> $row['forum_name'],  			'SELECTED'		=> ($row['forum_id'] == $forum_id) ? ' selected="selected"' : '', @@ -189,17 +185,17 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list  		for ($i = 0; $i < $padding; $i++)  		{ -			$template->assign_block_vars('jumpbox_forums.level', array()); +			phpbb::$template->assign_block_vars('jumpbox_forums.level', array());  		}  		$iteration++;  	} -	$db->sql_freeresult($result); +	phpbb::$db->sql_freeresult($result);  	unset($padding_store); -	$template->assign_vars(array( +	phpbb::$template->assign_vars(array(  		'S_DISPLAY_JUMPBOX'	=> $display_jumpbox, -		'S_JUMPBOX_ACTION'	=> $action) -	); +		'S_JUMPBOX_ACTION'	=> phpbb::$url->append_sid($action), +	));  	return;  } @@ -209,10 +205,8 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list  */  function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_poster, $last_topic_poster)  { -	global $auth, $user; -  	// Check permission and make sure the last post was not already bumped -	if (!$auth->acl_get('f_bump', $forum_id) || $topic_bumped) +	if (!phpbb::$acl->acl_get('f_bump', $forum_id) || $topic_bumped)  	{  		return false;  	} @@ -227,7 +221,7 @@ function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_po  	}  	// Check bumper, only topic poster and last poster are allowed to bump -	if ($topic_poster != $user->data['user_id'] && $last_topic_poster != $user->data['user_id']) +	if ($topic_poster != phpbb::$user->data['user_id'] && $last_topic_poster != phpbb::$user->data['user_id'])  	{  		return false;  	} @@ -732,16 +726,15 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,  		return;  	} -	global $template, $user;  	global $extensions;  	//  	$compiled_attachments = array();  	// @todo: do we really need this check? -	if (!isset($template->filename['attachment_tpl'])) +	if (!isset(phpbb::$template->filename['attachment_tpl']))  	{ -		$template->set_filenames(array( +		phpbb::$template->set_filenames(array(  			'attachment_tpl'	=> 'attachment.html')  		);  	} @@ -765,16 +758,14 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,  	// Grab attachments (security precaution)  	if (sizeof($attach_ids))  	{ -		global $db; -  		$new_attachment_data = array();  		$sql = 'SELECT *  			FROM ' . ATTACHMENTS_TABLE . ' -			WHERE ' . $db->sql_in_set('attach_id', array_keys($attach_ids)); -		$result = $db->sql_query($sql); +			WHERE ' . phpbb::$db->sql_in_set('attach_id', array_keys($attach_ids)); +		$result = phpbb::$db->sql_query($sql); -		while ($row = $db->sql_fetchrow($result)) +		while ($row = phpbb::$db->sql_fetchrow($result))  		{  			if (!isset($attach_ids[$row['attach_id']]))  			{ @@ -789,7 +780,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,  			$new_attachment_data[$attach_ids[$row['attach_id']]] = $row;  		} -		$db->sql_freeresult($result); +		phpbb::$db->sql_freeresult($result);  		$attachments = $new_attachment_data;  		unset($new_attachment_data); @@ -815,7 +806,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,  		}  		// We need to reset/empty the _file block var, because this function might be called more than once -		$template->destroy_block_vars('_file'); +		phpbb::$template->destroy_block_vars('_file');  		$block_array = array(); @@ -828,9 +819,9 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,  		if (isset($extensions[$attachment['extension']]))  		{ -			if ($user->img('icon_topic_attach', '') && !$extensions[$attachment['extension']]['upload_icon']) +			if (phpbb::$user->img('icon_topic_attach', '') && !$extensions[$attachment['extension']]['upload_icon'])  			{ -				$upload_icon = $user->img('icon_topic_attach', ''); +				$upload_icon = phpbb::$user->img('icon_topic_attach', '');  			}  			else if ($extensions[$attachment['extension']]['upload_icon'])  			{ @@ -839,7 +830,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,  		}  		$filesize = $attachment['filesize']; -		$size_lang = ($filesize >= 1048576) ? $user->lang['MIB'] : (($filesize >= 1024) ? $user->lang['KIB'] : $user->lang['BYTES']); +		$size_lang = ($filesize >= 1048576) ? phpbb::$user->lang['MIB'] : (($filesize >= 1024) ? phpbb::$user->lang['KIB'] : phpbb::$user->lang['BYTES']);  		$filesize = get_formatted_filesize($filesize, false);  		$comment = bbcode_nl2br(censor_text($attachment['attach_comment'])); @@ -860,7 +851,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,  			$block_array += array(  				'S_DENIED'			=> true, -				'DENIED_MESSAGE'	=> sprintf($user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension']) +				'DENIED_MESSAGE'	=> phpbb::$user->lang('EXTENSION_DISABLED_AFTER_POSTING', $attachment['extension']),  			);  		} @@ -902,12 +893,12 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,  			}  			// Make some descisions based on user options being set. -			if (($display_cat == ATTACHMENT_CATEGORY_IMAGE || $display_cat == ATTACHMENT_CATEGORY_THUMB) && !$user->optionget('viewimg')) +			if (($display_cat == ATTACHMENT_CATEGORY_IMAGE || $display_cat == ATTACHMENT_CATEGORY_THUMB) && !phpbb::$user->optionget('viewimg'))  			{  				$display_cat = ATTACHMENT_CATEGORY_NONE;  			} -			if ($display_cat == ATTACHMENT_CATEGORY_FLASH && !$user->optionget('viewflash')) +			if ($display_cat == ATTACHMENT_CATEGORY_FLASH && !phpbb::$user->optionget('viewflash'))  			{  				$display_cat = ATTACHMENT_CATEGORY_NONE;  			} @@ -1001,17 +992,15 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,  				break;  			} -			$l_download_count = (!isset($attachment['download_count']) || $attachment['download_count'] == 0) ? $user->lang[$l_downloaded_viewed . '_NONE'] : (($attachment['download_count'] == 1) ? sprintf($user->lang[$l_downloaded_viewed], $attachment['download_count']) : sprintf($user->lang[$l_downloaded_viewed . 'S'], $attachment['download_count'])); -  			$block_array += array(  				'U_DOWNLOAD_LINK'		=> $download_link, -				'L_DOWNLOAD_COUNT'		=> $l_download_count +				'L_DOWNLOAD_COUNT'		=> phpbb::$user->lang($l_downloaded_viewed, $attachment['download_count']),  			);  		} -		$template->assign_block_vars('_file', $block_array); +		phpbb::$template->assign_block_vars('_file', $block_array); -		$compiled_attachments[] = $template->assign_display('attachment_tpl'); +		$compiled_attachments[] = phpbb::$template->assign_display('attachment_tpl');  	}  	$attachments = $compiled_attachments; @@ -1030,7 +1019,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,  		$index = (phpbb::$config['display_order']) ? ($tpl_size-($matches[1][$num] + 1)) : $matches[1][$num];  		$replace['from'][] = $matches[0][$num]; -		$replace['to'][] = (isset($attachments[$index])) ? $attachments[$index] : sprintf($user->lang['MISSING_INLINE_ATTACHMENT'], $matches[2][array_search($index, $matches[1])]); +		$replace['to'][] = (isset($attachments[$index])) ? $attachments[$index] : sprintf(phpbb::$user->lang['MISSING_INLINE_ATTACHMENT'], $matches[2][array_search($index, $matches[1])]);  		$unset_tpl[] = $index;  	} @@ -1159,8 +1148,6 @@ function get_username_string($mode, $user_id, $username, $username_colour = '',  		$_profile_cache['tpl_profile_colour'] = '<a href="{PROFILE_URL}" style="color: {USERNAME_COLOUR};" class="username-coloured">{USERNAME}</a>';  	} -	global $user, $auth; -  	// This switch makes sure we only run code required for the mode  	switch ($mode)  	{ diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index 8b91e9617f..16c10312ce 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -37,6 +37,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_30  		'firebird'	=> array(  			'LABEL'			=> 'FireBird',  			'MODULE'		=> 'interbase', +			'DRIVER'		=> 'firebird',  			'AVAILABLE'		=> true,  			'3.0.x'			=> true,  		), @@ -50,48 +51,56 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_30  		'mysql'		=> array(  			'LABEL'			=> 'MySQL',  			'MODULE'		=> 'mysql', +			'DRIVER'		=> 'mysql',  			'AVAILABLE'		=> true,  			'3.0.x'			=> true,  		),  		'mssql'		=> array(  			'LABEL'			=> 'MS SQL Server 2000+',  			'MODULE'		=> 'mssql', +			'DRIVER'		=> 'mssql',  			'AVAILABLE'		=> true,  			'3.0.x'			=> true,  		),  		'mssql_odbc'=>	array(  			'LABEL'			=> 'MS SQL Server [ ODBC ]',  			'MODULE'		=> 'odbc', +			'DRIVER'		=> 'mssql_odbc',  			'AVAILABLE'		=> true,  			'3.0.x'			=> true,  		),  		'mssql_2005'=>	array(  			'LABEL'			=> 'MS SQL Server [ 2005 ]',  			'MODULE'		=> 'sqlsrv', +			'DRIVER'		=> 'mssql_2005',  			'AVAILABLE'		=> true,  			'3.0.x'			=> true,  		),  		'db2'		=> array(  			'LABEL'			=> 'IBM DB2',  			'MODULE'		=> 'ibm_db2', +			'DRIVER'		=> 'db2',  			'AVAILABLE'		=> true,  			'3.0.x'			=> false,  		),  		'oracle'	=>	array(  			'LABEL'			=> 'Oracle',  			'MODULE'		=> 'oci8', +			'DRIVER'		=> 'oracle',  			'AVAILABLE'		=> true,  			'3.0.x'			=> true,  		),  		'postgres' => array(  			'LABEL'			=> 'PostgreSQL 7.x/8.x',  			'MODULE'		=> 'pgsql', +			'DRIVER'		=> 'postgres',  			'AVAILABLE'		=> true,  			'3.0.x'			=> true,  		),  		'sqlite'		=> array(  			'LABEL'			=> 'SQLite',  			'MODULE'		=> 'sqlite', +			'DRIVER'		=> 'sqlite',  			'AVAILABLE'		=> true,  			'3.0.x'			=> true,  		), @@ -222,12 +231,10 @@ function get_tables($db)  	$result = $db->sql_query($sql);  	$tables = array(); -  	while ($row = $db->sql_fetchrow($result))  	{  		$tables[] = current($row);  	} -  	$db->sql_freeresult($result);  	return $tables; @@ -239,7 +246,7 @@ function get_tables($db)  * @param	array	$dbms should be of the format of an element of the array returned by {@link get_available_dbms get_available_dbms()}  *					necessary extensions should be loaded already  */ -function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, $prefix_may_exist = false, $unicode_check = true) +function connect_check_db($dbms_details, $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, &$error, $prefix_may_exist = false)  {  	$dbms = $dbms_details['DRIVER']; @@ -310,179 +317,179 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,  	{  		$db_error = $db->sql_error();  		$error[] = phpbb::$user->lang['INST_ERR_DB_CONNECT'] . '<br />' . (($db_error['message']) ? $db_error['message'] : phpbb::$user->lang['INST_ERR_DB_NO_ERROR']); +		return false;  	} -	else + +	// Likely matches for an existing phpBB installation +	if (!$prefix_may_exist)  	{ -		// Likely matches for an existing phpBB installation -		if (!$prefix_may_exist) +		$temp_prefix = strtolower($table_prefix); +		$table_ary = array($temp_prefix . 'attachments', $temp_prefix . 'config', $temp_prefix . 'sessions', $temp_prefix . 'topics', $temp_prefix . 'users'); + +		$tables = get_tables($db); +		$tables = array_map('strtolower', $tables); +		$table_intersect = array_intersect($tables, $table_ary); + +		if (sizeof($table_intersect))  		{ -			$temp_prefix = strtolower($table_prefix); -			$table_ary = array($temp_prefix . 'attachments', $temp_prefix . 'config', $temp_prefix . 'sessions', $temp_prefix . 'topics', $temp_prefix . 'users'); +			$error[] = phpbb::$user->lang['INST_ERR_PREFIX']; +			return false; +		} +	} -			$tables = get_tables($db); -			$tables = array_map('strtolower', $tables); -			$table_intersect = array_intersect($tables, $table_ary); +	// Make sure that the user has selected a sensible DBAL for the DBMS actually installed +	switch ($dbms_details['DRIVER']) +	{ +		case 'mysql': +			if (version_compare($db->sql_server_info(true), '4.1.3', '<')) +			{ +				$error[] = phpbb::$user->lang['INST_ERR_DB_NO_MYSQL']; +			} +		break; -			if (sizeof($table_intersect)) +		case 'mysqli': +			if (version_compare($db->sql_server_info(true), '4.1.3', '<'))  			{ -				$error[] = phpbb::$user->lang['INST_ERR_PREFIX']; +				$error[] = phpbb::$user->lang['INST_ERR_DB_NO_MYSQLI'];  			} -		} +		break; -		// Make sure that the user has selected a sensible DBAL for the DBMS actually installed -		switch ($dbms_details['DRIVER']) -		{ -			case 'mysql': -				if (version_compare($db->sql_server_info(true), '4.1.3', '<')) -				{ -					$error[] = phpbb::$user->lang['INST_ERR_DB_NO_MYSQL']; -				} -			break; +		case 'sqlite': +			if (version_compare($db->sql_server_info(true), '2.8.2', '<')) +			{ +				$error[] = phpbb::$user->lang['INST_ERR_DB_NO_SQLITE']; +			} +		break; -			case 'mysqli': -				if (version_compare($db->sql_server_info(true), '4.1.3', '<')) +		case 'firebird': +			// check the version of FB, use some hackery if we can't get access to the server info +			if ($db->service_handle !== false && strtolower($dbuser) == 'sysdba') +			{ +				$val = @ibase_server_info($db->service_handle, IBASE_SVC_SERVER_VERSION); +				preg_match('#V([\d.]+)#', $val, $match); +				if ($match[1] < 2)  				{ -					$error[] = phpbb::$user->lang['INST_ERR_DB_NO_MYSQLI']; +					$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD'];  				} -			break; +				$db_info = @ibase_db_info($db->service_handle, $dbname, IBASE_STS_HDR_PAGES); -			case 'sqlite': -				if (version_compare($db->sql_server_info(true), '2.8.2', '<')) +				preg_match('/^\\s*Page size\\s*(\\d+)/m', $db_info, $regs); +				$page_size = intval($regs[1]); +				if ($page_size < 8192)  				{ -					$error[] = phpbb::$user->lang['INST_ERR_DB_NO_SQLITE']; +					$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD_PS'];  				} -			break; - -			case 'firebird': -				// check the version of FB, use some hackery if we can't get access to the server info -				if ($db->service_handle !== false && strtolower($dbuser) == 'sysdba') +			} +			else +			{ +				$sql = "SELECT * +					FROM RDB$FUNCTIONS +					WHERE RDB$SYSTEM_FLAG IS NULL +						AND RDB$FUNCTION_NAME = 'CHAR_LENGTH'"; +				$result = $db->sql_query($sql); +				$row = $db->sql_fetchrow($result); +				$db->sql_freeresult($result); + +				// if its a UDF, its too old +				if ($row)  				{ -					$val = @ibase_server_info($db->service_handle, IBASE_SVC_SERVER_VERSION); -					preg_match('#V([\d.]+)#', $val, $match); -					if ($match[1] < 2) -					{ -						$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD']; -					} -					$db_info = @ibase_db_info($db->service_handle, $dbname, IBASE_STS_HDR_PAGES); - -					preg_match('/^\\s*Page size\\s*(\\d+)/m', $db_info, $regs); -					$page_size = intval($regs[1]); -					if ($page_size < 8192) -					{ -						$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD_PS']; -					} +					$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD'];  				}  				else  				{ -					$sql = "SELECT * -						FROM RDB$FUNCTIONS -						WHERE RDB$SYSTEM_FLAG IS NULL -							AND RDB$FUNCTION_NAME = 'CHAR_LENGTH'"; +					$sql = "SELECT FIRST 0 char_length('') +						FROM RDB\$DATABASE";  					$result = $db->sql_query($sql); -					$row = $db->sql_fetchrow($result); -					$db->sql_freeresult($result); - -					// if its a UDF, its too old -					if ($row) +					if (!$result) // This can only fail if char_length is not defined  					{  						$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD'];  					} -					else -					{ -						$sql = "SELECT FIRST 0 char_length('') -							FROM RDB\$DATABASE"; -						$result = $db->sql_query($sql); -						if (!$result) // This can only fail if char_length is not defined -						{ -							$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD']; -						} -						$db->sql_freeresult($result); -					} +					$db->sql_freeresult($result); +				} -					// Setup the stuff for our random table -					$char_array = array_merge(range('A', 'Z'), range('0', '9')); -					$char_len = mt_rand(7, 9); -					$char_array_len = sizeof($char_array) - 1; +				// Setup the stuff for our random table +				$char_array = array_merge(range('A', 'Z'), range('0', '9')); +				$char_len = mt_rand(7, 9); +				$char_array_len = sizeof($char_array) - 1; -					$final = ''; +				$final = ''; -					for ($i = 0; $i < $char_len; $i++) -					{ -						$final .= $char_array[mt_rand(0, $char_array_len)]; -					} +				for ($i = 0; $i < $char_len; $i++) +				{ +					$final .= $char_array[mt_rand(0, $char_array_len)]; +				} -					// Create some random table -					$sql = 'CREATE TABLE ' . $final . " ( -						FIELD1 VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, -						FIELD2 INTEGER DEFAULT 0 NOT NULL);"; -					$db->sql_query($sql); +				// Create some random table +				$sql = 'CREATE TABLE ' . $final . " ( +					FIELD1 VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, +					FIELD2 INTEGER DEFAULT 0 NOT NULL);"; +				$db->sql_query($sql); -					// Create an index that should fail if the page size is less than 8192 -					$sql = 'CREATE INDEX ' . $final . ' ON ' . $final . '(FIELD1, FIELD2);'; -					$db->sql_query($sql); +				// Create an index that should fail if the page size is less than 8192 +				$sql = 'CREATE INDEX ' . $final . ' ON ' . $final . '(FIELD1, FIELD2);'; +				$db->sql_query($sql); -					if (ibase_errmsg() !== false) -					{ -						$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD_PS']; -					} +				if (ibase_errmsg() !== false) +				{ +					$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD_PS']; +				} -					// Kill the old table -					$db->sql_query('DROP TABLE ' . $final . ';'); +				// Kill the old table +				$db->sql_query('DROP TABLE ' . $final . ';'); -					unset($final); -				} -			break; +				unset($final); +			} +		break; -			case 'oracle': -				if ($unicode_check) -				{ -					$sql = "SELECT * -						FROM NLS_DATABASE_PARAMETERS -						WHERE PARAMETER = 'NLS_RDBMS_VERSION' -							OR PARAMETER = 'NLS_CHARACTERSET'"; -					$result = $db->sql_query($sql); +		case 'oracle': +			$sql = "SELECT * +				FROM NLS_DATABASE_PARAMETERS +				WHERE PARAMETER = 'NLS_RDBMS_VERSION' +					OR PARAMETER = 'NLS_CHARACTERSET'"; +			$result = $db->sql_query($sql); -					while ($row = $db->sql_fetchrow($result)) -					{ -						$stats[$row['parameter']] = $row['value']; -					} -					$db->sql_freeresult($result); +			while ($row = $db->sql_fetchrow($result)) +			{ +				$stats[$row['parameter']] = $row['value']; +			} +			$db->sql_freeresult($result); -					if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<')) -					{ -						$error[] = phpbb::$user->lang['INST_ERR_DB_NO_ORACLE']; -					} +			if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<')) +			{ +				$error[] = phpbb::$user->lang['INST_ERR_DB_NO_ORACLE']; +			} -					if ($stats['NLS_CHARACTERSET'] !== 'AL32UTF8') -					{ -						$error[] = phpbb::$user->lang['INST_ERR_DB_NO_ORACLE_NLS']; -					} -				} -			break; +			if ($stats['NLS_CHARACTERSET'] !== 'AL32UTF8') +			{ +				$error[] = phpbb::$user->lang['INST_ERR_DB_NO_ORACLE_NLS']; +			} +		break; -			case 'postgres': -				if ($unicode_check) -				{ -					$sql = "SHOW server_encoding;"; -					$result = $db->sql_query($sql); -					$row = $db->sql_fetchrow($result); -					$db->sql_freeresult($result); +		case 'postgres': +			$sql = "SHOW server_encoding;"; +			$result = $db->sql_query($sql); +			$row = $db->sql_fetchrow($result); +			$db->sql_freeresult($result); -					if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8') -					{ -						$error[] = phpbb::$user->lang['INST_ERR_DB_NO_POSTGRES']; -					} -				} -			break; -		} +			if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8') +			{ +				$error[] = phpbb::$user->lang['INST_ERR_DB_NO_POSTGRES']; +			} +		break; +		case 'mssql_odbc': +			/** +			* @todo check odbc.defaultlrl (min 128K) and odbc.defaultbinmode (1) +			*/ +		break;  	} -	if ($error_connect && (!isset($error) || !sizeof($error))) +	if (sizeof($error))  	{ -		return true; +		return false;  	} -	return false; + +	return true;  }  ?>
\ No newline at end of file diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index c980840fa5..c6c457aba4 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -792,28 +792,13 @@ class p_master  	*/  	function display($page_title, $display_online_list = true)  	{ -		// Generate the page -		if (defined('IN_ADMIN') && isset(phpbb::$user->data['session_admin']) && phpbb::$user->data['session_admin']) -		{ -			adm_page_header($page_title); -		} -		else -		{ -			page_header($page_title, $display_online_list); -		} +		page_header($page_title, $display_online_list);  		phpbb::$template->set_filenames(array(  			'body' => $this->get_tpl_name())  		); -		if (defined('IN_ADMIN') && isset(phpbb::$user->data['session_admin']) && phpbb::$user->data['session_admin']) -		{ -			adm_page_footer(); -		} -		else -		{ -			page_footer(); -		} +		page_footer();  	}  	/** diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 67794221a6..0b495cf995 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@  *  */ -$updates_to_version = '3.0.3'; +$updates_to_version = '3.1.0';  // Return if we "just include it" to find out for which version the database update is responsuble for  if (defined('IN_PHPBB') && defined('IN_INSTALL')) @@ -23,304 +23,32 @@ define('IN_INSTALL', true);  if (!defined('PHPBB_ROOT_PATH')) define('PHPBB_ROOT_PATH', './../');  if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1)); - -// Report all errors, except notices -//error_reporting(E_ALL ^ E_NOTICE); -error_reporting(E_ALL); +include PHPBB_ROOT_PATH . 'common.' . PHP_EXT;  @set_time_limit(0); -// Include essential scripts -include(PHPBB_ROOT_PATH . 'config.' . PHP_EXT); - -if (!isset($dbms)) -{ -	die("Please read: <a href='../docs/INSTALL.html'>INSTALL.html</a> before attempting to update."); -} - -// Load Extensions -if (!empty($load_extensions)) -{ -	$load_extensions = explode(',', $load_extensions); - -	foreach ($load_extensions as $extension) -	{ -		@dl(trim($extension)); -	} -} - -// Include files -require(PHPBB_ROOT_PATH . 'includes/acm/acm_' . $acm_type . '.' . PHP_EXT); -require(PHPBB_ROOT_PATH . 'includes/cache.' . PHP_EXT); -require(PHPBB_ROOT_PATH . 'includes/template.' . PHP_EXT); -require(PHPBB_ROOT_PATH . 'includes/session.' . PHP_EXT); -require(PHPBB_ROOT_PATH . 'includes/auth.' . PHP_EXT); - -require(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT); - -if (file_exists(PHPBB_ROOT_PATH . 'includes/functions_content.' . PHP_EXT)) -{ -	require(PHPBB_ROOT_PATH . 'includes/functions_content.' . PHP_EXT); -} - -require(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT); -require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT); -require(PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT); -require(PHPBB_ROOT_PATH . 'includes/utf/utf_tools.' . PHP_EXT); +// Start session management +phpbb::$user->session_begin(); +phpbb::$acl->init(phpbb::$user->data); +phpbb::$user->setup('install'); -// If we are on PHP >= 6.0.0 we do not need some code -if (version_compare(PHP_VERSION, '6.0.0-dev', '>=')) -{ -	/** -	* @ignore -	*/ -	define('STRIP', false); -} -else +if (!phpbb::$user->is_registered)  { -	@set_magic_quotes_runtime(0); -	define('STRIP', (get_magic_quotes_gpc()) ? true : false); +	login_box();  } -$user = new user(); -$db = new $sql_db(); - -// Connect to DB -$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false); - -// We do not need this any longer, unset for safety purposes -unset($dbpasswd); - -$user->ip = (!empty($_SERVER['REMOTE_ADDR'])) ? htmlspecialchars($_SERVER['REMOTE_ADDR']) : ''; - -$sql = "SELECT config_value -	FROM " . CONFIG_TABLE . " -	WHERE config_name = 'default_lang'"; -$result = $db->sql_query($sql); -$row = $db->sql_fetchrow($result); -$db->sql_freeresult($result); - -$language = basename(request_var('language', '')); - -if (!$language) +if (!phpbb::$acl->acl_get('a_board'))  { -	$language = $row['config_value']; +	trigger_error('NO_AUTH');  } -if (!file_exists(PHPBB_ROOT_PATH . 'language/' . $language)) -{ -	die('No language found!'); -} +include PHPBB_ROOT_PATH . 'includes/db/db_tools.' . PHP_EXT; -// And finally, load the relevant language files -include(PHPBB_ROOT_PATH . 'language/' . $language . '/common.' . PHP_EXT); -include(PHPBB_ROOT_PATH . 'language/' . $language . '/acp/common.' . PHP_EXT); -include(PHPBB_ROOT_PATH . 'language/' . $language . '/install.' . PHP_EXT); - -// Set PHP error handler to ours -//set_error_handler('msg_handler'); +$db_tools = new phpbb_db_tools(phpbb::$db, true);  // Define some variables for the database update  $inline_update = (request_var('type', 0)) ? true : false; -// Database column types mapping -$dbms_type_map = array( -	'mysql'		=> array( -		'INT:'		=> 'int(%d)', -		'BINT'		=> 'bigint(20)', -		'UINT'		=> 'mediumint(8) UNSIGNED', -		'UINT:'		=> 'int(%d) UNSIGNED', -		'TINT:'		=> 'tinyint(%d)', -		'USINT'		=> 'smallint(4) UNSIGNED', -		'BOOL'		=> 'tinyint(1) UNSIGNED', -		'VCHAR'		=> 'varchar(255)', -		'VCHAR:'	=> 'varchar(%d)', -		'CHAR:'		=> 'char(%d)', -		'XSTEXT'	=> 'text', -		'XSTEXT_UNI'=> 'varchar(100)', -		'STEXT'		=> 'text', -		'STEXT_UNI'	=> 'varchar(255)', -		'TEXT'		=> 'text', -		'TEXT_UNI'	=> 'text', -		'MTEXT'		=> 'mediumtext', -		'MTEXT_UNI'	=> 'mediumtext', -		'TIMESTAMP'	=> 'int(11) UNSIGNED', -		'DECIMAL'	=> 'decimal(5,2)', -		'VCHAR_UNI'	=> 'varchar(255)', -		'VCHAR_UNI:'=> 'varchar(%d)', -		'VCHAR_CI'	=> 'varchar(255)', -		'VARBINARY'	=> 'varbinary(255)', -	), - -	'firebird'	=> array( -		'INT:'		=> 'INTEGER', -		'BINT'		=> 'DOUBLE PRECISION', -		'UINT'		=> 'INTEGER', -		'UINT:'		=> 'INTEGER', -		'TINT:'		=> 'INTEGER', -		'USINT'		=> 'INTEGER', -		'BOOL'		=> 'INTEGER', -		'VCHAR'		=> 'VARCHAR(255) CHARACTER SET NONE', -		'VCHAR:'	=> 'VARCHAR(%d) CHARACTER SET NONE', -		'CHAR:'		=> 'CHAR(%d) CHARACTER SET NONE', -		'XSTEXT'	=> 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', -		'STEXT'		=> 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', -		'TEXT'		=> 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', -		'MTEXT'		=> 'BLOB SUB_TYPE TEXT CHARACTER SET NONE', -		'XSTEXT_UNI'=> 'VARCHAR(100) CHARACTER SET UTF8', -		'STEXT_UNI'	=> 'VARCHAR(255) CHARACTER SET UTF8', -		'TEXT_UNI'	=> 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8', -		'MTEXT_UNI'	=> 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8', -		'TIMESTAMP'	=> 'INTEGER', -		'DECIMAL'	=> 'DOUBLE PRECISION', -		'VCHAR_UNI'	=> 'VARCHAR(255) CHARACTER SET UTF8', -		'VCHAR_UNI:'=> 'VARCHAR(%d) CHARACTER SET UTF8', -		'VCHAR_CI'	=> 'VARCHAR(255) CHARACTER SET UTF8', -		'VARBINARY'	=> 'CHAR(255) CHARACTER SET NONE', -	), - -	'mssql'		=> array( -		'INT:'		=> '[int]', -		'BINT'		=> '[float]', -		'UINT'		=> '[int]', -		'UINT:'		=> '[int]', -		'TINT:'		=> '[int]', -		'USINT'		=> '[int]', -		'BOOL'		=> '[int]', -		'VCHAR'		=> '[varchar] (255)', -		'VCHAR:'	=> '[varchar] (%d)', -		'CHAR:'		=> '[char] (%d)', -		'XSTEXT'	=> '[varchar] (1000)', -		'STEXT'		=> '[varchar] (3000)', -		'TEXT'		=> '[varchar] (8000)', -		'MTEXT'		=> '[text]', -		'XSTEXT_UNI'=> '[varchar] (100)', -		'STEXT_UNI'	=> '[varchar] (255)', -		'TEXT_UNI'	=> '[varchar] (4000)', -		'MTEXT_UNI'	=> '[text]', -		'TIMESTAMP'	=> '[int]', -		'DECIMAL'	=> '[float]', -		'VCHAR_UNI'	=> '[varchar] (255)', -		'VCHAR_UNI:'=> '[varchar] (%d)', -		'VCHAR_CI'	=> '[varchar] (255)', -		'VARBINARY'	=> '[varchar] (255)', -	), - -	'oracle'	=> array( -		'INT:'		=> 'number(%d)', -		'BINT'		=> 'number(20)', -		'UINT'		=> 'number(8)', -		'UINT:'		=> 'number(%d)', -		'TINT:'		=> 'number(%d)', -		'USINT'		=> 'number(4)', -		'BOOL'		=> 'number(1)', -		'VCHAR'		=> 'varchar2(255 char)', -		'VCHAR:'	=> 'varchar2(%d char)', -		'CHAR:'		=> 'char(%d char)', -		'XSTEXT'	=> 'varchar2(1000 char)', -		'STEXT'		=> 'varchar2(3000 char)', -		'TEXT'		=> 'clob', -		'MTEXT'		=> 'clob', -		'XSTEXT_UNI'=> 'varchar2(100 char)', -		'STEXT_UNI'	=> 'varchar2(255 char)', -		'TEXT_UNI'	=> 'clob', -		'MTEXT_UNI'	=> 'clob', -		'TIMESTAMP'	=> 'number(11)', -		'DECIMAL'	=> 'number(5, 2)', -		'DECIMAL:'	=> 'number(%d, 2)', -		'PDECIMAL'	=> 'number(6, 3)', -		'PDECIMAL:'	=> 'number(%d, 3)', -		'VCHAR_UNI'	=> 'varchar2(255 char)', -		'VCHAR_UNI:'=> 'varchar2(%d char)', -		'VCHAR_CI'	=> 'varchar2(255 char)', -		'VARBINARY'	=> 'raw(255)', -	), - -	'db2'		=> array( -		'INT:'		=> 'integer', -		'BINT'		=> 'float', -		'UINT'		=> 'integer', -		'UINT:'		=> 'integer', -		'TINT:'		=> 'smallint', -		'USINT'		=> 'smallint', -		'BOOL'		=> 'smallint', -		'VCHAR'		=> 'varchar(255)', -		'VCHAR:'	=> 'varchar(%d)', -		'CHAR:'		=> 'char(%d)', -		'XSTEXT'	=> 'clob(65K)', -		'STEXT'		=> 'varchar(3000)', -		'TEXT'		=> 'clob(65K)', -		'MTEXT'		=> 'clob(16M)', -		'XSTEXT_UNI'=> 'varchar(100)', -		'STEXT_UNI'	=> 'varchar(255)', -		'TEXT_UNI'	=> 'clob(65K)', -		'MTEXT_UNI'	=> 'clob(16M)', -		'TIMESTAMP'	=> 'integer', -		'DECIMAL'	=> 'float', -		'VCHAR_UNI'	=> 'varchar(255)', -		'VCHAR_UNI:'=> 'varchar(%d)', -		'VCHAR_CI'	=> 'varchar(255)', -		'VARBINARY'	=> 'varchar(255)', -	), - -	'sqlite'	=> array( -		'INT:'		=> 'int(%d)', -		'BINT'		=> 'bigint(20)', -		'UINT'		=> 'INTEGER UNSIGNED', //'mediumint(8) UNSIGNED', -		'UINT:'		=> 'INTEGER UNSIGNED', // 'int(%d) UNSIGNED', -		'TINT:'		=> 'tinyint(%d)', -		'USINT'		=> 'INTEGER UNSIGNED', //'mediumint(4) UNSIGNED', -		'BOOL'		=> 'INTEGER UNSIGNED', //'tinyint(1) UNSIGNED', -		'VCHAR'		=> 'varchar(255)', -		'VCHAR:'	=> 'varchar(%d)', -		'CHAR:'		=> 'char(%d)', -		'XSTEXT'	=> 'text(65535)', -		'STEXT'		=> 'text(65535)', -		'TEXT'		=> 'text(65535)', -		'MTEXT'		=> 'mediumtext(16777215)', -		'XSTEXT_UNI'=> 'text(65535)', -		'STEXT_UNI'	=> 'text(65535)', -		'TEXT_UNI'	=> 'text(65535)', -		'MTEXT_UNI'	=> 'mediumtext(16777215)', -		'TIMESTAMP'	=> 'INTEGER UNSIGNED', //'int(11) UNSIGNED', -		'DECIMAL'	=> 'decimal(5,2)', -		'VCHAR_UNI'	=> 'varchar(255)', -		'VCHAR_UNI:'=> 'varchar(%d)', -		'VCHAR_CI'	=> 'varchar(255)', -		'VARBINARY'	=> 'blob', -	), - -	'postgres'	=> array( -		'INT:'		=> 'INT4', -		'BINT'		=> 'INT8', -		'UINT'		=> 'INT4', // unsigned -		'UINT:'		=> 'INT4', // unsigned -		'USINT'		=> 'INT2', // unsigned -		'BOOL'		=> 'boolean', // unsigned -		'TINT:'		=> 'INT2', -		'VCHAR'		=> 'varchar(255)', -		'VCHAR:'	=> 'varchar(%d)', -		'CHAR:'		=> 'char(%d)', -		'XSTEXT'	=> 'varchar(1000)', -		'STEXT'		=> 'varchar(3000)', -		'TEXT'		=> 'varchar(8000)', -		'MTEXT'		=> 'TEXT', -		'XSTEXT_UNI'=> 'varchar(100)', -		'STEXT_UNI'	=> 'varchar(255)', -		'TEXT_UNI'	=> 'varchar(4000)', -		'MTEXT_UNI'	=> 'TEXT', -		'TIMESTAMP'	=> 'INT4', // unsigned -		'DECIMAL'	=> 'decimal(5,2)', -		'VCHAR_UNI'	=> 'varchar(255)', -		'VCHAR_UNI:'=> 'varchar(%d)', -		'VCHAR_CI'	=> 'varchar(255)', -		'VARBINARY'	=> 'bytea', -	), -); - -// A list of types being unsigned for better reference in some db's -$unsigned_types = array('UINT', 'UINT:', 'USINT', 'BOOL', 'TIMESTAMP'); -  // Only an example, but also commented out  $database_update_info = array( @@ -328,9 +56,6 @@ $database_update_info = array(  	'3.0.3-RC1'		=> array(),  ); -// Determine mapping database type -$map_dbms = $db->dbms_type; -  $error_ary = array();  $errored = false; @@ -338,15 +63,15 @@ header('Content-type: text/html; charset=UTF-8');  ?>  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $lang['DIRECTION']; ?>" lang="<?php echo $lang['USER_LANG']; ?>" xml:lang="<?php echo $lang['USER_LANG']; ?>"> +<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo phpbb::$user->lang['DIRECTION']; ?>" lang="<?php echo phpbb::$user->lang['USER_LANG']; ?>" xml:lang="<?php echo phpbb::$user->lang['USER_LANG']; ?>">  <head>  <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> -<meta http-equiv="content-language" content="<?php echo $lang['USER_LANG']; ?>" /> +<meta http-equiv="content-language" content="<?php echo phpbb::$user->lang['USER_LANG']; ?>" />  <meta http-equiv="content-style-type" content="text/css" />  <meta http-equiv="imagetoolbar" content="no" /> -<title><?php echo $lang['UPDATING_TO_LATEST_STABLE']; ?></title> +<title><?php echo phpbb::$user->lang['UPDATING_TO_LATEST_STABLE']; ?></title>  <link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" /> @@ -363,19 +88,19 @@ header('Content-type: text/html; charset=UTF-8');  				<div id="content">  					<div id="main"> -	<h1><?php echo $lang['UPDATING_TO_LATEST_STABLE']; ?></h1> +	<h1><?php echo phpbb::$user->lang['UPDATING_TO_LATEST_STABLE']; ?></h1>  	<br /> -	<p><?php echo $lang['DATABASE_TYPE']; ?> :: <strong><?php echo $db->sql_layer; ?></strong><br /> +	<p><?php echo phpbb::$user->lang['DATABASE_TYPE']; ?> :: <strong><?php echo phpbb::$db->sql_layer; ?></strong><br />  <?php  // To let set_config() calls succeed, we need to make the config array available globally  phpbb::$acm->destroy('#config');  $config = phpbb_cache::obtain_config(); -echo $lang['PREVIOUS_VERSION'] . ' :: <strong>' . phpbb::$config['version'] . '</strong><br />'; -echo $lang['UPDATED_VERSION'] . ' :: <strong>' . $updates_to_version . '</strong></p>'; +echo phpbb::$user->lang['PREVIOUS_VERSION'] . ' :: <strong>' . phpbb::$config['version'] . '</strong><br />'; +echo phpbb::$user->lang['UPDATED_VERSION'] . ' :: <strong>' . $updates_to_version . '</strong></p>';  $current_version = str_replace('rc', 'RC', strtolower(phpbb::$config['version']));  $latest_version = str_replace('rc', 'RC', strtolower($updates_to_version)); @@ -392,46 +117,17 @@ if ($inline_update)  else  {  	// If not called from the update script, we will actually remove the traces -	$db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'version_update_from'"); -} - -// Checks/Operations that have to be completed prior to starting the update itself -$exit = false; - -if ($exit) -{ -?> - -					</div> -				</div> -			<span class="corners-bottom"><span></span></span> -		</div> -		</div> -	</div> - -	<div id="page-footer"> -		Powered by <a href="http://www.phpbb.com/">phpBB</a> © 2000, 2002, 2005, 2007 phpBB Group -	</div> -</div> - -</body> -</html> - -<?php -	if (function_exists('exit_handler')) -	{ -		exit_handler(); -	} +	phpbb::$db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'version_update_from'");  }  // Schema updates  ?>  	<br /><br /> -	<h1><?php echo $lang['UPDATE_DATABASE_SCHEMA']; ?></h1> +	<h1><?php echo phpbb::$user->lang['UPDATE_DATABASE_SCHEMA']; ?></h1>  	<br /> -	<p><?php echo $lang['PROGRESS']; ?> :: <strong> +	<p><?php echo phpbb::$user->lang['PROGRESS']; ?> :: <strong>  <?php @@ -439,6 +135,8 @@ flush();  // We go through the schema changes from the lowest to the highest version  // We try to also include versions 'in-between'... +// We go through the schema changes from the lowest to the highest version +// We try to also include versions 'in-between'...  $no_updates = true;  $versions = array_keys($database_update_info);  for ($i = 0; $i < sizeof($versions); $i++) @@ -448,101 +146,27 @@ for ($i = 0; $i < sizeof($versions); $i++)  	$next_version = (isset($versions[$i + 1])) ? $versions[$i + 1] : $updates_to_version; -	if (!sizeof($schema_changes)) -	{ -		continue; -	} -  	// If the installed version to be updated to is < than the current version, and if the current version is >= as the version to be updated to next, we will skip the process  	if (version_compare($version, $current_version, '<') && version_compare($current_version, $next_version, '>='))  	{  		continue;  	} -	$no_updates = false; - -	// Change columns? -	if (!empty($schema_changes['change_columns'])) -	{ -		foreach ($schema_changes['change_columns'] as $table => $columns) -		{ -			foreach ($columns as $column_name => $column_data) -			{ -				sql_column_change($map_dbms, $table, $column_name, $column_data); -			} -		} -	} - -	// Add columns? -	if (!empty($schema_changes['add_columns'])) -	{ -		foreach ($schema_changes['add_columns'] as $table => $columns) -		{ -			foreach ($columns as $column_name => $column_data) -			{ -				// Only add the column if it does not exist yet -				if (!column_exists($map_dbms, $table, $column_name)) -				{ -					sql_column_add($map_dbms, $table, $column_name, $column_data); -				} -			} -		} -	} - -	// Remove keys? -	if (!empty($schema_changes['drop_keys'])) -	{ -		foreach ($schema_changes['drop_keys'] as $table => $indexes) -		{ -			foreach ($indexes as $index_name) -			{ -				sql_index_drop($map_dbms, $index_name, $table); -			} -		} -	} - -	// Drop columns? -	if (!empty($schema_changes['drop_columns'])) +	if (!sizeof($schema_changes))  	{ -		foreach ($schema_changes['drop_columns'] as $table => $columns) -		{ -			foreach ($columns as $column) -			{ -				sql_column_remove($map_dbms, $table, $column); -			} -		} +		continue;  	} -	// Add primary keys? -	if (!empty($schema_changes['add_primary_keys'])) -	{ -		foreach ($schema_changes['add_primary_keys'] as $table => $columns) -		{ -			sql_create_primary_key($map_dbms, $table, $columns); -		} -	} +	// Get statements for schema updates +	$statements = $db_tools->sql_schema_changes($schema_changes); -	// Add unqiue indexes? -	if (!empty($schema_changes['add_unique_index'])) +	if (sizeof($statements))  	{ -		foreach ($schema_changes['add_unique_index'] as $table => $index_array) -		{ -			foreach ($index_array as $index_name => $column) -			{ -				sql_create_unique_index($map_dbms, $index_name, $table, $column); -			} -		} -	} +		$no_updates = false; -	// Add indexes? -	if (!empty($schema_changes['add_index'])) -	{ -		foreach ($schema_changes['add_index'] as $table => $index_array) +		foreach ($statements as $sql)  		{ -			foreach ($index_array as $index_name => $column) -			{ -				sql_create_index($map_dbms, $index_name, $table, $column); -			} +			_sql($sql, $errored, $error_ary);  		}  	}  } @@ -556,9 +180,9 @@ $errored = $no_updates = false;  ?>  <br /><br /> -<h1><?php echo $lang['UPDATING_DATA']; ?></h1> +<h1><?php echo phpbb::$user->lang['UPDATING_DATA']; ?></h1>  <br /> -<p><?php echo $lang['PROGRESS']; ?> :: <strong> +<p><?php echo phpbb::$user->lang['PROGRESS']; ?> :: <strong>  <?php @@ -566,8 +190,8 @@ flush();  $no_updates = true; -$versions = array( -); +$no_updates = true; +$versions = array_keys($database_update_info);  // some code magic  for ($i = 0; $i < sizeof($versions); $i++) @@ -581,8 +205,7 @@ for ($i = 0; $i < sizeof($versions); $i++)  		continue;  	} -	$no_updates = false; -	change_database_data($version); +	change_database_data($no_updates, $version);  }  _write_result($no_updates, $errored, $error_ary); @@ -593,9 +216,9 @@ $errored = $no_updates = false;  ?>  <br /><br /> -<h1><?php echo $lang['UPDATE_VERSION_OPTIMIZE']; ?></h1> +<h1><?php echo phpbb::$user->lang['UPDATE_VERSION_OPTIMIZE']; ?></h1>  <br /> -<p><?php echo $lang['PROGRESS']; ?> :: <strong> +<p><?php echo phpbb::$user->lang['PROGRESS']; ?> :: <strong>  <?php @@ -634,7 +257,7 @@ _write_result($no_updates, $errored, $error_ary);  ?>  <br /> -<h1><?php echo $lang['UPDATE_COMPLETED']; ?></h1> +<h1><?php echo phpbb::$user->lang['UPDATE_COMPLETED']; ?></h1>  <br /> @@ -646,9 +269,9 @@ if (!$inline_update)  	phpbb::$acm->purge();  ?> -	<p style="color:red"><?php echo $lang['UPDATE_FILES_NOTICE']; ?></p> +	<p style="color:red"><?php echo phpbb::$user->lang['UPDATE_FILES_NOTICE']; ?></p> -	<p><?php echo $lang['COMPLETE_LOGIN_TO_BOARD']; ?></p> +	<p><?php echo phpbb::$user->lang['COMPLETE_LOGIN_TO_BOARD']; ?></p>  <?php  } @@ -656,9 +279,9 @@ else  {  ?> -	<p><?php echo ((isset($lang['INLINE_UPDATE_SUCCESSFUL'])) ? $lang['INLINE_UPDATE_SUCCESSFUL'] : 'The database update was successful. Now you need to continue the update process.'); ?></p> +	<p><?php echo ((isset(phpbb::$user->lang['INLINE_UPDATE_SUCCESSFUL'])) ? phpbb::$user->lang['INLINE_UPDATE_SUCCESSFUL'] : 'The database update was successful. Now you need to continue the update process.'); ?></p> -	<p><a href="<?php echo append_sid('install/index', "mode=update&sub=file_check&lang=$language"); ?>" class="button1"><?php echo (isset($lang['CONTINUE_UPDATE_NOW'])) ? $lang['CONTINUE_UPDATE_NOW'] : 'Continue the update process now'; ?></a></p> +	<p><a href="<?php echo append_sid('install/index', "mode=update&sub=file_check&lang=$language"); ?>" class="button1"><?php echo (isset(phpbb::$user->lang['CONTINUE_UPDATE_NOW'])) ? phpbb::$user->lang['CONTINUE_UPDATE_NOW'] : 'Continue the update process now'; ?></a></p>  <?php  } @@ -700,7 +323,7 @@ if (function_exists('exit_handler'))  */  function change_database_data($version)  { -	global $db, $map_dbms, $errored, $error_ary; +	global $errored, $error_ary;  	switch ($version)  	{ @@ -714,24 +337,22 @@ function change_database_data($version)  */  function _sql($sql, &$errored, &$error_ary, $echo_dot = true)  { -	global $db; -  	if (defined('DEBUG_EXTRA'))  	{  		echo "<br />\n{$sql}\n<br />";  	} -	$db->sql_return_on_error(true); +	phpbb::$db->sql_return_on_error(true); -	$result = $db->sql_query($sql); -	if ($db->sql_error_triggered) +	$result = phpbb::$db->sql_query($sql); +	if (phpbb::$db->sql_error_triggered)  	{  		$errored = true; -		$error_ary['sql'][] = $db->sql_error_sql; -		$error_ary['error_code'][] = $db->_sql_error(); +		$error_ary['sql'][] = phpbb::$db->sql_error_sql; +		$error_ary['error_code'][] = phpbb::$db->_sql_error();  	} -	$db->sql_return_on_error(false); +	phpbb::$db->sql_return_on_error(false);  	if ($echo_dot)  	{ @@ -744,1052 +365,30 @@ function _sql($sql, &$errored, &$error_ary, $echo_dot = true)  function _write_result($no_updates, $errored, $error_ary)  { -	global $lang; -  	if ($no_updates)  	{ -		echo ' ' . $lang['NO_UPDATES_REQUIRED'] . '</strong></p>'; +		echo ' ' . phpbb::$user->lang['NO_UPDATES_REQUIRED'] . '</strong></p>';  	}  	else  	{ -		echo ' <span class="success">' . $lang['DONE'] . '</span></strong><br />' . $lang['RESULT'] . ' :: '; +		echo ' <span class="success">' . phpbb::$user->lang['DONE'] . '</span></strong><br />' . phpbb::$user->lang['RESULT'] . ' :: ';  		if ($errored)  		{ -			echo ' <strong>' . $lang['SOME_QUERIES_FAILED'] . '</strong> <ul>'; +			echo ' <strong>' . phpbb::$user->lang['SOME_QUERIES_FAILED'] . '</strong> <ul>';  			for ($i = 0; $i < sizeof($error_ary['sql']); $i++)  			{ -				echo '<li>' . $lang['ERROR'] . ' :: <strong>' . htmlspecialchars($error_ary['error_code'][$i]['message']) . '</strong><br />'; -				echo $lang['SQL'] . ' :: <strong>' . htmlspecialchars($error_ary['sql'][$i]) . '</strong><br /><br /></li>'; -			} - -			echo '</ul> <br /><br />' . $lang['SQL_FAILURE_EXPLAIN'] . '</p>'; -		} -		else -		{ -			echo '<strong>' . $lang['NO_ERRORS'] . '</strong></p>'; -		} -	} -} - -/** -* Check if a specified column exist -*/ -function column_exists($dbms, $table, $column_name) -{ -	global $db; - -	switch ($dbms) -	{ -		case 'mysql': -			$sql = "SHOW COLUMNS -				FROM $table"; -			$result = $db->sql_query($sql); -			while ($row = $db->sql_fetchrow($result)) -			{ -				// lower case just in case -				if (strtolower($row['Field']) == $column_name) -				{ -					$db->sql_freeresult($result); -					return true; -				} -			} -			$db->sql_freeresult($result); -			return false; -		break; - -		// PostgreSQL has a way of doing this in a much simpler way but would -		// not allow us to support all versions of PostgreSQL -		case 'postgres': -			$sql = "SELECT a.attname -				FROM pg_class c, pg_attribute a -				WHERE c.relname = '{$table}' -					AND a.attnum > 0 -					AND a.attrelid = c.oid"; -			$result = $db->sql_query($sql); -			while ($row = $db->sql_fetchrow($result)) -			{ -				// lower case just in case -				if (strtolower($row['attname']) == $column_name) -				{ -					$db->sql_freeresult($result); -					return true; -				} -			} -			$db->sql_freeresult($result); -			return false; -		break; - -		// same deal with PostgreSQL, we must perform more complex operations than -		// we technically could -		case 'mssql': -			$sql = "SELECT c.name -				FROM syscolumns c -				LEFT JOIN sysobjects o ON c.id = o.id -				WHERE o.name = '{$table}'"; -			$result = $db->sql_query($sql); -			while ($row = $db->sql_fetchrow($result)) -			{ -				// lower case just in case -				if (strtolower($row['name']) == $column_name) -				{ -					$db->sql_freeresult($result); -					return true; -				} -			} -			$db->sql_freeresult($result); -			return false; -		break; - -		case 'oracle': -			$sql = "SELECT column_name -				FROM user_tab_columns -				WHERE table_name = '{$table}'"; -			$result = $db->sql_query($sql); -			while ($row = $db->sql_fetchrow($result)) -			{ -				// lower case just in case -				if (strtolower($row['column_name']) == $column_name) -				{ -					$db->sql_freeresult($result); -					return true; -				} -			} -			$db->sql_freeresult($result); -			return false; -		break; - -		case 'firebird': -			$sql = "SELECT RDB\$FIELD_NAME as FNAME -				FROM RDB\$RELATION_FIELDS -				WHERE RDB\$RELATION_NAME = '{$table}'"; -			$result = $db->sql_query($sql); -			while ($row = $db->sql_fetchrow($result)) -			{ -				// lower case just in case -				if (strtolower($row['fname']) == $column_name) -				{ -					$db->sql_freeresult($result); -					return true; -				} +				echo '<li>' . phpbb::$user->lang['ERROR'] . ' :: <strong>' . htmlspecialchars($error_ary['error_code'][$i]['message']) . '</strong><br />'; +				echo phpbb::$user->lang['SQL'] . ' :: <strong>' . htmlspecialchars($error_ary['sql'][$i]) . '</strong><br /><br /></li>';  			} -			$db->sql_freeresult($result); -			return false; -		break; - -		// ugh, SQLite -		case 'sqlite': -			$sql = "SELECT sql -				FROM sqlite_master -				WHERE type = 'table' -					AND name = '{$table}'"; -			$result = $db->sql_query($sql); - -			if (!$result) -			{ -				return false; -			} - -			$row = $db->sql_fetchrow($result); -			$db->sql_freeresult($result); - -			preg_match('#\((.*)\)#s', $row['sql'], $matches); - -			$cols = trim($matches[1]); -			$col_array = preg_split('/,(?![\s\w]+\))/m', $cols); -			foreach ($col_array as $declaration) -			{ -				$entities = preg_split('#\s+#', trim($declaration)); -				if ($entities[0] == 'PRIMARY') -				{ -					continue; -				} - -				if (strtolower($entities[0]) == $column_name) -				{ -					return true; -				} -			} -			return false; -		break; -	} -} - -/** -* Function to prepare some column information for better usage -*/ -function prepare_column_data($dbms, $column_data, $table_name, $column_name) -{ -	global $dbms_type_map, $unsigned_types; - -	// Get type -	if (strpos($column_data[0], ':') !== false) -	{ -		list($orig_column_type, $column_length) = explode(':', $column_data[0]); - -		if (!is_array($dbms_type_map[$dbms][$orig_column_type . ':'])) -		{ -			$column_type = sprintf($dbms_type_map[$dbms][$orig_column_type . ':'], $column_length); +			echo '</ul> <br /><br />' . phpbb::$user->lang['SQL_FAILURE_EXPLAIN'] . '</p>';  		}  		else  		{ -			if (isset($dbms_type_map[$dbms][$orig_column_type . ':']['rule'])) -			{ -				switch ($dbms_type_map[$dbms][$orig_column_type . ':']['rule'][0]) -				{ -					case 'div': -						$column_length /= $dbms_type_map[$dbms][$orig_column_type . ':']['rule'][1]; -						$column_length = ceil($column_length); -						$column_type = sprintf($dbms_type_map[$dbms][$orig_column_type . ':'][0], $column_length); -					break; -				} -			} - -			if (isset($dbms_type_map[$dbms][$orig_column_type . ':']['limit'])) -			{ -				switch ($dbms_type_map[$dbms][$orig_column_type . ':']['limit'][0]) -				{ -					case 'mult': -						$column_length *= $dbms_type_map[$dbms][$orig_column_type . ':']['limit'][1]; -						if ($column_length > $dbms_type_map[$dbms][$orig_column_type . ':']['limit'][2]) -						{ -							$column_type = $dbms_type_map[$dbms][$orig_column_type . ':']['limit'][3]; -						} -						else -						{ -							$column_type = sprintf($dbms_type_map[$dbms][$orig_column_type . ':'][0], $column_length); -						} -					break; -				} -			} +			echo '<strong>' . phpbb::$user->lang['NO_ERRORS'] . '</strong></p>';  		} -		$orig_column_type .= ':'; -	} -	else -	{ -		$orig_column_type = $column_data[0]; -		$column_type = $dbms_type_map[$dbms][$column_data[0]]; -	} - -	// Adjust default value if db-dependant specified -	if (is_array($column_data[1])) -	{ -		$column_data[1] = (isset($column_data[1][$dbms])) ? $column_data[1][$dbms] : $column_data[1]['default']; -	} - -	$sql = ''; -	$return_array = array(); - -	switch ($dbms) -	{ -		case 'firebird': -			$sql .= " {$column_type} "; - -			if (!is_null($column_data[1])) -			{ -				$sql .= 'DEFAULT ' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ' '; -			} - -			$sql .= 'NOT NULL'; - -			// This is a UNICODE column and thus should be given it's fair share -			if (preg_match('/^X?STEXT_UNI|VCHAR_(CI|UNI:?)/', $column_data[0])) -			{ -				$sql .= ' COLLATE UNICODE'; -			} - -		break; - -		case 'mssql': -			$sql .= " {$column_type} "; -			$sql_default = " {$column_type} "; - -			// For adding columns we need the default definition -			if (!is_null($column_data[1])) -			{ -				// For hexadecimal values do not use single quotes -				if (strpos($column_data[1], '0x') === 0) -				{ -					$sql_default .= 'DEFAULT (' . $column_data[1] . ') '; -				} -				else -				{ -					$sql_default .= 'DEFAULT (' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ') '; -				} -			} - -			$sql .= 'NOT NULL'; -			$sql_default .= 'NOT NULL'; - -			$return_array['column_type_sql_default'] = $sql_default; -		break; - -		case 'mysql': -			$sql .= " {$column_type} "; - -			// For hexadecimal values do not use single quotes -			if (!is_null($column_data[1]) && substr($column_type, -4) !== 'text' && substr($column_type, -4) !== 'blob') -			{ -				$sql .= (strpos($column_data[1], '0x') === 0) ? "DEFAULT {$column_data[1]} " : "DEFAULT '{$column_data[1]}' "; -			} -			$sql .= 'NOT NULL'; - -			if (isset($column_data[2])) -			{ -				if ($column_data[2] == 'auto_increment') -				{ -					$sql .= ' auto_increment'; -				} -				else if ($column_data[2] == 'true_sort') -				{ -					$sql .= ' COLLATE utf8_unicode_ci'; -				} -			} - -		break; - -		case 'oracle': -			$sql .= " {$column_type} "; -			$sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}' " : ''; - -			// In Oracle empty strings ('') are treated as NULL. -			// Therefore in oracle we allow NULL's for all DEFAULT '' entries -			// Oracle does not like setting NOT NULL on a column that is already NOT NULL (this happens only on number fields) -			if (preg_match('/number/i', $column_type)) -			{ -				$sql .= ($column_data[1] === '') ? '' : 'NOT NULL'; -			} -		break; - -		case 'postgres': -			$return_array['column_type'] = $column_type; - -			$sql .= " {$column_type} "; - -			if (isset($column_data[2]) && $column_data[2] == 'auto_increment') -			{ -				$default_val = "nextval('{$table_name}_seq')"; -			} -			else if (!is_null($column_data[1])) -			{ -				$default_val = "'" . $column_data[1] . "'"; -				$return_array['null'] = 'NOT NULL'; -				$sql .= 'NOT NULL '; -			} - -			$return_array['default'] = $default_val; - -			$sql .= "DEFAULT {$default_val}"; - -			// Unsigned? Then add a CHECK contraint -			if (in_array($orig_column_type, $unsigned_types)) -			{ -				$return_array['constraint'] = "CHECK ({$column_name} >= 0)"; -				$sql .= " CHECK ({$column_name} >= 0)"; -			} -		break; - -		case 'sqlite': -			if (isset($column_data[2]) && $column_data[2] == 'auto_increment') -			{ -				$sql .= ' INTEGER PRIMARY KEY'; -			} -			else -			{ -				$sql .= ' ' . $column_type; -			} - -			$sql .= ' NOT NULL '; -			$sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}'" : ''; -		break; -	} - -	$return_array['column_type_sql'] = $sql; - -	return $return_array; -} - -/** -* Add new column -*/ -function sql_column_add($dbms, $table_name, $column_name, $column_data) -{ -	global $errored, $error_ary; - -	$column_data = prepare_column_data($dbms, $column_data, $table_name, $column_name); - -	switch ($dbms) -	{ -		case 'firebird': -			$sql = 'ALTER TABLE "' . $table_name . '" ADD "' . $column_name . '" ' . $column_data['column_type_sql']; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'mssql': -			$sql = 'ALTER TABLE [' . $table_name . '] ADD [' . $column_name . '] ' . $column_data['column_type_sql_default']; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'mysql': -			$sql = 'ALTER TABLE `' . $table_name . '` ADD COLUMN `' . $column_name . '` ' . $column_data['column_type_sql']; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'oracle': -			$sql = 'ALTER TABLE ' . $table_name . ' ADD ' . $column_name . ' ' . $column_data['column_type_sql']; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'postgres': -			$sql = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type_sql']; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'sqlite': -			if (version_compare(sqlite_libversion(), '3.0') == -1) -			{ -				global $db; -				$sql = "SELECT sql -					FROM sqlite_master -					WHERE type = 'table' -						AND name = '{$table_name}' -					ORDER BY type DESC, name;"; -				$result = $db->sql_query($sql); - -				if (!$result) -				{ -					break; -				} - -				$row = $db->sql_fetchrow($result); -				$db->sql_freeresult($result); - -				$db->sql_transaction('begin'); - -				// Create a backup table and populate it, destroy the existing one -				$db->sql_query(preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql'])); -				$db->sql_query('INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name); -				$db->sql_query('DROP TABLE ' . $table_name); - -				preg_match('#\((.*)\)#s', $row['sql'], $matches); - -				$new_table_cols = trim($matches[1]); -				$old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); -				$column_list = array(); - -				foreach ($old_table_cols as $declaration) -				{ -					$entities = preg_split('#\s+#', trim($declaration)); -					if ($entities[0] == 'PRIMARY') -					{ -						continue; -					} -					$column_list[] = $entities[0]; -				} - -				$columns = implode(',', $column_list); - -				$new_table_cols = $column_name . ' ' . $column_data['column_type_sql'] . ',' . $new_table_cols; - -				// create a new table and fill it up. destroy the temp one -				$db->sql_query('CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');'); -				$db->sql_query('INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'); -				$db->sql_query('DROP TABLE ' . $table_name . '_temp'); - -				$db->sql_transaction('commit'); -			} -			else -			{ -				$sql = 'ALTER TABLE ' . $table_name . ' ADD ' . $column_name . ' [' . $column_data['column_type_sql'] . ']'; -				_sql($sql, $errored, $error_ary); -			} -		break; -	} -} - -/** -* Drop column -*/ -function sql_column_remove($dbms, $table_name, $column_name) -{ -	global $errored, $error_ary; - -	switch ($dbms) -	{ -		case 'firebird': -			$sql = 'ALTER TABLE "' . $table_name . '" DROP "' . $column_name . '"'; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'mssql': -			$sql = 'ALTER TABLE [' . $table_name . '] DROP COLUMN [' . $column_name . ']'; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'mysql': -			$sql = 'ALTER TABLE `' . $table_name . '` DROP COLUMN `' . $column_name . '`'; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'oracle': -			$sql = 'ALTER TABLE ' . $table_name . ' DROP ' . $column_name; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'postgres': -			$sql = 'ALTER TABLE ' . $table_name . ' DROP COLUMN "' . $column_name . '"'; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'sqlite': -			if (version_compare(sqlite_libversion(), '3.0') == -1) -			{ -				global $db; -				$sql = "SELECT sql -					FROM sqlite_master -					WHERE type = 'table' -						AND name = '{$table_name}' -					ORDER BY type DESC, name;"; -				$result = $db->sql_query($sql); - -				if (!$result) -				{ -					break; -				} - -				$row = $db->sql_fetchrow($result); -				$db->sql_freeresult($result); - -				$db->sql_transaction('begin'); - -				// Create a backup table and populate it, destroy the existing one -				$db->sql_query(preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql'])); -				$db->sql_query('INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name); -				$db->sql_query('DROP TABLE ' . $table_name); - -				preg_match('#\((.*)\)#s', $row['sql'], $matches); - -				$new_table_cols = trim($matches[1]); -				$old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); -				$column_list = array(); - -				foreach ($old_table_cols as $declaration) -				{ -					$entities = preg_split('#\s+#', trim($declaration)); -					if ($entities[0] == 'PRIMARY' || $entities[0] === $column_name) -					{ -						continue; -					} -					$column_list[] = $entities[0]; -				} - -				$columns = implode(',', $column_list); - -				$new_table_cols = $new_table_cols = preg_replace('/' . $column_name . '[^,]+(?:,|$)/m', '', $new_table_cols); - -				// create a new table and fill it up. destroy the temp one -				$db->sql_query('CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');'); -				$db->sql_query('INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'); -				$db->sql_query('DROP TABLE ' . $table_name . '_temp'); - -				$db->sql_transaction('commit'); -			} -			else -			{ -				$sql = 'ALTER TABLE ' . $table_name . ' DROP COLUMN ' . $column_name; -				_sql($sql, $errored, $error_ary); -			} -		break; -	} -} - -function sql_index_drop($dbms, $index_name, $table_name) -{ -	global $dbms_type_map, $db; -	global $errored, $error_ary; - -	switch ($dbms) -	{ -		case 'mssql': -			$sql = 'DROP INDEX ' . $table_name . '.' . $index_name; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'mysql': -			$sql = 'DROP INDEX ' . $index_name . ' ON ' . $table_name; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'firebird': -		case 'oracle': -		case 'postgres': -		case 'sqlite': -			$sql = 'DROP INDEX ' . $table_name . '_' . $index_name; -			_sql($sql, $errored, $error_ary); -		break; -	} -} - -function sql_create_primary_key($dbms, $table_name, $column) -{ -	global $dbms_type_map, $db; -	global $errored, $error_ary; - -	switch ($dbms) -	{ -		case 'firebird': -		case 'postgres': -			$sql = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')'; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'mssql': -			$sql = "ALTER TABLE [{$table_name}] WITH NOCHECK ADD "; -			$sql .= "CONSTRAINT [PK_{$table_name}] PRIMARY KEY  CLUSTERED ("; -			$sql .= '[' . implode("],\n\t\t[", $column) . ']'; -			$sql .= ') ON [PRIMARY]'; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'mysql': -			$sql = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')'; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'oracle': -			$sql = 'ALTER TABLE ' . $table_name . 'add CONSTRAINT pk_' . $table_name . ' PRIMARY KEY (' . implode(', ', $column) . ')'; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'sqlite': -			$sql = "SELECT sql -				FROM sqlite_master -				WHERE type = 'table' -					AND name = '{$table_name}' -				ORDER BY type DESC, name;"; -			$result = _sql($sql, $errored, $error_ary); - -			if (!$result) -			{ -				break; -			} - -			$row = $db->sql_fetchrow($result); -			$db->sql_freeresult($result); - -			$db->sql_transaction('begin'); - -			// Create a backup table and populate it, destroy the existing one -			$db->sql_query(preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql'])); -			$db->sql_query('INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name); -			$db->sql_query('DROP TABLE ' . $table_name); - -			preg_match('#\((.*)\)#s', $row['sql'], $matches); - -			$new_table_cols = trim($matches[1]); -			$old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); -			$column_list = array(); - -			foreach ($old_table_cols as $declaration) -			{ -				$entities = preg_split('#\s+#', trim($declaration)); -				if ($entities[0] == 'PRIMARY') -				{ -					continue; -				} -				$column_list[] = $entities[0]; -			} - -			$columns = implode(',', $column_list); - -			// create a new table and fill it up. destroy the temp one -			$db->sql_query('CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ', PRIMARY KEY (' . implode(', ', $column) . '));'); -			$db->sql_query('INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'); -			$db->sql_query('DROP TABLE ' . $table_name . '_temp'); - -			$db->sql_transaction('commit'); -		break; -	} -} - -function sql_create_unique_index($dbms, $index_name, $table_name, $column) -{ -	global $dbms_type_map, $db; -	global $errored, $error_ary; - -	switch ($dbms) -	{ -		case 'firebird': -		case 'postgres': -		case 'oracle': -		case 'sqlite': -			$sql = 'CREATE UNIQUE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'mysql': -			$sql = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'mssql': -			$sql = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; -			_sql($sql, $errored, $error_ary); -		break; -	} -} - -function sql_create_index($dbms, $index_name, $table_name, $column) -{ -	global $dbms_type_map, $db; -	global $errored, $error_ary; - -	switch ($dbms) -	{ -		case 'firebird': -		case 'postgres': -		case 'oracle': -		case 'sqlite': -			$sql = 'CREATE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'mysql': -			$sql = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'mssql': -			$sql = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; -			_sql($sql, $errored, $error_ary); -		break; -	} -} - -// List all of the indices that belong to a table, -// does not count: -// * UNIQUE indices -// * PRIMARY keys -function sql_list_index($dbms, $table_name) -{ -	global $dbms_type_map, $db; -	global $errored, $error_ary; - -	$index_array = array(); - -	if ($dbms == 'mssql') -	{ -		$sql = "EXEC sp_statistics '$table_name'"; -		$result = $db->sql_query($sql); -		while ($row = $db->sql_fetchrow($result)) -		{ -			if ($row['TYPE'] == 3) -			{ -				$index_array[] = $row['INDEX_NAME']; -			} -		} -		$db->sql_freeresult($result); -	} -	else -	{ -		switch ($dbms) -		{ -			case 'firebird': -				$sql = "SELECT LOWER(RDB\$INDEX_NAME) as index_name -					FROM RDB\$INDICES -					WHERE RDB\$RELATION_NAME = " . strtoupper($table_name) . " -						AND RDB\$UNIQUE_FLAG IS NULL -						AND RDB\$FOREIGN_KEY IS NULL"; -				$col = 'index_name'; -			break; - -			case 'postgres': -				$sql = "SELECT ic.relname as index_name -					FROM pg_class bc, pg_class ic, pg_index i -					WHERE (bc.oid = i.indrelid) -						AND (ic.oid = i.indexrelid) -						AND (bc.relname = '" . $table_name . "') -						AND (i.indisunique != 't') -						AND (i.indisprimary != 't')"; -				$col = 'index_name'; -			break; - -			case 'mysql': -				$sql = 'SHOW KEYS -					FROM ' . $table_name; -				$col = 'Key_name'; -			break; - -			case 'oracle': -				$sql = "SELECT index_name -					FROM user_indexes -					WHERE table_name = '" . $table_name . "' -						AND generated = 'N'"; -			break; - -			case 'sqlite': -				$sql = "PRAGMA index_info('" . $table_name . "');"; -				$col = 'name'; -			break; -		} - -		$result = $db->sql_query($sql); -		while ($row = $db->sql_fetchrow($result)) -		{ -			if ($dbms == 'mysql' && !$row['Non_unique']) -			{ -				continue; -			} - -			switch ($dbms) -			{ -				case 'firebird': -				case 'oracle': -				case 'postgres': -				case 'sqlite': -					$row[$col] = substr($row[$col], strlen($table_name) + 1); -				break; -			} - -			$index_array[] = $row[$col]; -		} -		$db->sql_freeresult($result); -	} - -	return array_map('strtolower', $index_array); -} - -// This is totally fake, never use it -// it exists only to mend bad update functions introduced -// * UNIQUE indices -// * PRIMARY keys -function sql_list_fake($dbms, $table_name) -{ -	global $dbms_type_map, $db; -	global $errored, $error_ary; - -	$index_array = array(); - -	if ($dbms == 'mssql') -	{ -		$sql = "EXEC sp_statistics '$table_name'"; -		$result = $db->sql_query($sql); -		while ($row = $db->sql_fetchrow($result)) -		{ -			if ($row['TYPE'] == 3) -			{ -				$index_array[] = $row['INDEX_NAME']; -			} -		} -		$db->sql_freeresult($result); -	} -	else -	{ -		switch ($dbms) -		{ -			case 'firebird': -				$sql = "SELECT LOWER(RDB\$INDEX_NAME) as index_name -					FROM RDB\$INDICES -					WHERE RDB\$RELATION_NAME = " . strtoupper($table_name) . " -						AND RDB\$UNIQUE_FLAG IS NULL -						AND RDB\$FOREIGN_KEY IS NULL"; -				$col = 'index_name'; -			break; - -			case 'postgres': -				$sql = "SELECT ic.relname as index_name -					FROM pg_class bc, pg_class ic, pg_index i -					WHERE (bc.oid = i.indrelid) -						AND (ic.oid = i.indexrelid) -						AND (bc.relname = '" . $table_name . "') -						AND (i.indisunique != 't') -						AND (i.indisprimary != 't')"; -				$col = 'index_name'; -			break; - -			case 'mysql': -				$sql = 'SHOW KEYS -					FROM ' . $table_name; -				$col = 'Key_name'; -			break; - -			case 'oracle': -				$sql = "SELECT index_name -					FROM user_indexes -					WHERE table_name = '" . $table_name . "' -						AND generated = 'N'"; -			break; - -			case 'sqlite': -				$sql = "PRAGMA index_info('" . $table_name . "');"; -				$col = 'name'; -			break; -		} - -		$result = $db->sql_query($sql); -		while ($row = $db->sql_fetchrow($result)) -		{ -			if ($dbms == 'mysql' && !$row['Non_unique']) -			{ -				continue; -			} - -			$index_array[] = $row[$col]; -		} -		$db->sql_freeresult($result); -	} - -	return array_map('strtolower', $index_array); -} - -/** -* Change column type (not name!) -*/ -function sql_column_change($dbms, $table_name, $column_name, $column_data) -{ -	global $dbms_type_map, $db; -	global $errored, $error_ary; - -	$column_data = prepare_column_data($dbms, $column_data, $table_name, $column_name); - -	switch ($dbms) -	{ -		case 'firebird': -			// Change type... -			$sql = 'ALTER TABLE "' . $table_name . '" ALTER COLUMN "' . $column_name . '" TYPE ' . ' ' . $column_data['column_type_sql']; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'mssql': -			$sql = 'ALTER TABLE [' . $table_name . '] ALTER COLUMN [' . $column_name . '] ' . $column_data['column_type_sql']; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'mysql': -			$sql = 'ALTER TABLE `' . $table_name . '` CHANGE `' . $column_name . '` `' . $column_name . '` ' . $column_data['column_type_sql']; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'oracle': -			$sql = 'ALTER TABLE ' . $table_name . ' MODIFY ' . $column_name . ' ' . $column_data['column_type_sql']; -			_sql($sql, $errored, $error_ary); -		break; - -		case 'postgres': -			$sql = 'ALTER TABLE ' . $table_name . ' '; - -			$sql_array = array(); -			$sql_array[] = 'ALTER COLUMN ' . $column_name . ' TYPE ' . $column_data['column_type']; - -			if (isset($column_data['null'])) -			{ -				if ($column_data['null'] == 'NOT NULL') -				{ -					$sql_array[] = 'ALTER COLUMN ' . $column_name . ' SET NOT NULL'; -				} -				else if ($column_data['null'] == 'NULL') -				{ -					$sql_array[] = 'ALTER COLUMN ' . $column_name . ' DROP NOT NULL'; -				} -			} - -			if (isset($column_data['default'])) -			{ -				$sql_array[] = 'ALTER COLUMN ' . $column_name . ' SET DEFAULT ' . $column_data['default']; -			} - -			// we don't want to double up on constraints if we change different number data types -			if (isset($column_data['constraint'])) -			{ -				$constraint_sql = "SELECT consrc as constraint_data -							FROM pg_constraint, pg_class bc -							WHERE conrelid = bc.oid -								AND bc.relname = '{$table_name}' -								AND NOT EXISTS ( -									SELECT * -										FROM pg_constraint as c, pg_inherits as i -										WHERE i.inhrelid = pg_constraint.conrelid -											AND c.conname = pg_constraint.conname -											AND c.consrc = pg_constraint.consrc -											AND c.conrelid = i.inhparent -								)"; - -				$constraint_exists = false; - -				$result = $db->sql_query($constraint_sql); -				while ($row = $db->sql_fetchrow($result)) -				{ -					if (trim($row['constraint_data']) == trim($column_data['constraint'])) -					{ -						$constraint_exists = true; -						break; -					} -				} -				$db->sql_freeresult($result); - -				if (!$constraint_exists) -				{ -					$sql_array[] = 'ADD ' . $column_data['constraint']; -				} -			} - -			$sql .= implode(', ', $sql_array); - -			_sql($sql, $errored, $error_ary); -		break; - -		case 'sqlite': - -			$sql = "SELECT sql -				FROM sqlite_master -				WHERE type = 'table' -					AND name = '{$table_name}' -				ORDER BY type DESC, name;"; -			$result = _sql($sql, $errored, $error_ary); - -			if (!$result) -			{ -				break; -			} - -			$row = $db->sql_fetchrow($result); -			$db->sql_freeresult($result); - -			$db->sql_transaction('begin'); - -			// Create a temp table and populate it, destroy the existing one -			$db->sql_query(preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql'])); -			$db->sql_query('INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name); -			$db->sql_query('DROP TABLE ' . $table_name); - -			preg_match('#\((.*)\)#s', $row['sql'], $matches); - -			$new_table_cols = trim($matches[1]); -			$old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); -			$column_list = array(); - -			foreach ($old_table_cols as $key => $declaration) -			{ -				$entities = preg_split('#\s+#', trim($declaration)); -				$column_list[] = $entities[0]; -				if ($entities[0] == $column_name) -				{ -					$old_table_cols[$key] = $column_name . ' ' . $column_data['column_type_sql']; -				} -			} - -			$columns = implode(',', $column_list); - -			// create a new table and fill it up. destroy the temp one -			$db->sql_query('CREATE TABLE ' . $table_name . ' (' . implode(',', $old_table_cols) . ');'); -			$db->sql_query('INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'); -			$db->sql_query('DROP TABLE ' . $table_name . '_temp'); - -			$db->sql_transaction('commit'); - -		break;  	}  } diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index 0a2d1b5d44..110472a499 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -419,7 +419,7 @@ class install_convert extends module  			}  			else  			{ -				$connect_test = connect_check_db(true, $error, $available_dbms[$src_dbms], $src_table_prefix, $src_dbhost, $src_dbuser, htmlspecialchars_decode($src_dbpasswd), $src_dbname, $src_dbport, true, ($src_dbms == $dbms) ? false : true, false); +				$connect_test = connect_check_db($available_dbms[$src_dbms], $src_table_prefix, $src_dbhost, $src_dbuser, htmlspecialchars_decode($src_dbpasswd), $src_dbname, $src_dbport, $error, ($src_dbms == $dbms) ? false : true);  			}  			// The forum prefix of the old and the new forum can only be the same if two different databases are used. diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 407f1725dc..46618d7eb0 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -601,7 +601,7 @@ class install_install extends module  			}  			else  			{ -				$connect_test = connect_check_db(true, $error, $available_dbms[$data['dbms']], $data['table_prefix'], $data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport']); +				$connect_test = connect_check_db($available_dbms[$data['dbms']], $data['table_prefix'], $data['dbhost'], $data['dbuser'], htmlspecialchars_decode($data['dbpasswd']), $data['dbname'], $data['dbport'], $error);  			}  			if ($connect_test) @@ -965,9 +965,6 @@ class install_install extends module  		// we do not return statements, we simply let them execute  		$db_tools = new phpbb_db_tools(phpbb::$db); -		// Before we can load the schema data we need (for a new installation) create custom data for the beginning of schema creation and the end -		$db_tools->sql_install_begin(); -  		foreach ($schema_data as $table_name => $table_data)  		{  			// Change prefix, we always have phpbb_, therefore we can do a substr() here @@ -977,8 +974,6 @@ class install_install extends module  			$db_tools->sql_create_table($table_name, $table_data);  		} -		$db_tools->sql_install_end(); -  		// Now get the schema data  		include PHPBB_ROOT_PATH . 'install/schemas/schema_data.' . PHP_EXT; diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 36b6c048df..3dbda4a4db 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -151,12 +151,16 @@ $lang = array_merge($lang, array(  	'DISPLAY_TOPICS'		=> 'Display topics from previous',  	'DOWNLOADED'			=> 'Downloaded',  	'DOWNLOADING_FILE'		=> 'Downloading file', -	'DOWNLOAD_COUNT'		=> 'Downloaded %d time', -	'DOWNLOAD_COUNTS'		=> 'Downloaded %d times', -	'DOWNLOAD_COUNT_NONE'	=> 'Not downloaded yet', -	'VIEWED_COUNT'			=> 'Viewed %d time', -	'VIEWED_COUNTS'			=> 'Viewed %d times', -	'VIEWED_COUNT_NONE'		=> 'Not viewed yet', +	'DOWNLOAD_COUNT'		=> array( +		0		=> 'Not downloaded yet', +		1		=> 'Downloaded %d time', +		2		=> 'Downloaded %d times', +	), +	'VIEWED_COUNT'			=> array( +		0		=> 'Not viewed yet', +		1		=> 'Viewed %d time', +		2		=> 'Viewed %d times', +	),  	'EDIT_POST'							=> 'Edit post',  	'EMAIL'								=> 'E-mail', diff --git a/phpBB/modules/acp/acp_forums.php b/phpBB/modules/acp/acp_forums.php index d568fd2caf..ea7e8b5da3 100644 --- a/phpBB/modules/acp/acp_forums.php +++ b/phpBB/modules/acp/acp_forums.php @@ -1913,7 +1913,7 @@ class acp_forums  	{  		global $template, $user; -		adm_page_header($user->lang['SYNC_IN_PROGRESS']); +		page_header($user->lang['SYNC_IN_PROGRESS']);  		$template->set_filenames(array(  			'body'	=> 'progress_bar.html') @@ -1924,7 +1924,7 @@ class acp_forums  			'L_PROGRESS_EXPLAIN'	=> ($start && $total) ? sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], $start, $total) : $user->lang['SYNC_IN_PROGRESS'])  		); -		adm_page_footer(); +		page_footer();  	}  } diff --git a/phpBB/modules/acp/acp_main.php b/phpBB/modules/acp/acp_main.php index 91918166cf..fb66f5dc15 100644 --- a/phpBB/modules/acp/acp_main.php +++ b/phpBB/modules/acp/acp_main.php @@ -62,7 +62,7 @@ class acp_main  			{  				phpbb::$user->unset_admin();  				$redirect_url = phpbb::$url->append_sid(PHPBB_ROOT_PATH . 'index.' . PHP_EXT); -				meta_refresh(3, $redirect_url); +				phpbb::$url->meta_refresh(3, $redirect_url);  				trigger_error(phpbb::$user->lang['ADM_LOGGED_OUT'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_INDEX'], '<a href="' . $redirect_url . '">', '</a>'));  			} diff --git a/phpBB/modules/acp/acp_search.php b/phpBB/modules/acp/acp_search.php index 029d9300ad..46ce052f21 100644 --- a/phpBB/modules/acp/acp_search.php +++ b/phpBB/modules/acp/acp_search.php @@ -519,7 +519,7 @@ class acp_search  		$l_type = ($type == 'create') ? 'INDEXING_IN_PROGRESS' : 'DELETING_INDEX_IN_PROGRESS'; -		adm_page_header($user->lang[$l_type]); +		page_header($user->lang[$l_type]);  		$template->set_filenames(array(  			'body'	=> 'progress_bar.html') @@ -530,7 +530,7 @@ class acp_search  			'L_PROGRESS_EXPLAIN'	=> $user->lang[$l_type . '_EXPLAIN'])  		); -		adm_page_footer(); +		page_footer();  	}  	function close_popup_js() diff --git a/phpBB/modules/acp/acp_styles.php b/phpBB/modules/acp/acp_styles.php index 66e87471f7..eb426b6c6e 100644 --- a/phpBB/modules/acp/acp_styles.php +++ b/phpBB/modules/acp/acp_styles.php @@ -833,7 +833,7 @@ parse_css_file = {PARSE_CSS_FILE}  		// on larger source files ...  		if ($source && file_exists(PHPBB_ROOT_PATH . "cache/{$cache_prefix}_$source.html." . PHP_EXT))  		{ -			adm_page_header($user->lang['TEMPLATE_CACHE']); +			page_header($user->lang['TEMPLATE_CACHE']);  			$template->set_filenames(array(  				'body'	=> 'viewsource.html') @@ -872,7 +872,7 @@ parse_css_file = {PARSE_CSS_FILE}  				unset($code[$key]);  			} -			adm_page_footer(); +			page_footer();  		}  		// Get a list of cached template files and then retrieve additional information about them  | 
