diff options
Diffstat (limited to 'phpBB/develop')
33 files changed, 627 insertions, 225 deletions
| diff --git a/phpBB/develop/add_permissions.php b/phpBB/develop/add_permissions.php index 035c23f49c..5d9af3cad5 100644 --- a/phpBB/develop/add_permissions.php +++ b/phpBB/develop/add_permissions.php @@ -413,5 +413,3 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting)  	unset($sql_ary);  } - -?>
\ No newline at end of file diff --git a/phpBB/develop/adjust_avatars.php b/phpBB/develop/adjust_avatars.php index 81599e694b..dc4ae88f37 100644 --- a/phpBB/develop/adjust_avatars.php +++ b/phpBB/develop/adjust_avatars.php @@ -143,5 +143,3 @@ function adjust_avatar($old_name, $midfix)  	}  	return false;  } - -?>
\ No newline at end of file diff --git a/phpBB/develop/adjust_bbcodes.php b/phpBB/develop/adjust_bbcodes.php index f06f0112ab..5a7f065d7f 100644 --- a/phpBB/develop/adjust_bbcodes.php +++ b/phpBB/develop/adjust_bbcodes.php @@ -170,5 +170,3 @@ $db->sql_freeresult($result);  // Done  $db->sql_close(); - -?>
\ No newline at end of file diff --git a/phpBB/develop/adjust_magic_urls.php b/phpBB/develop/adjust_magic_urls.php index 1430a47a12..c417c755cf 100644 --- a/phpBB/develop/adjust_magic_urls.php +++ b/phpBB/develop/adjust_magic_urls.php @@ -122,5 +122,3 @@ $db->sql_freeresult($result);  // Done  $db->sql_close(); - -?>
\ No newline at end of file diff --git a/phpBB/develop/adjust_sizes.php b/phpBB/develop/adjust_sizes.php index 7d72813056..9b58389163 100644 --- a/phpBB/develop/adjust_sizes.php +++ b/phpBB/develop/adjust_sizes.php @@ -128,5 +128,3 @@ $db->sql_freeresult($result);  // Done  $db->sql_close(); - -?>
\ No newline at end of file diff --git a/phpBB/develop/adjust_smilies.php b/phpBB/develop/adjust_smilies.php index 774c8834f6..ecc3461670 100644 --- a/phpBB/develop/adjust_smilies.php +++ b/phpBB/develop/adjust_smilies.php @@ -126,5 +126,3 @@ $db->sql_freeresult($result);  // Done  $db->sql_close(); - -?>
\ No newline at end of file diff --git a/phpBB/develop/adjust_uids.php b/phpBB/develop/adjust_uids.php index d301f3cadb..3468475b8f 100644 --- a/phpBB/develop/adjust_uids.php +++ b/phpBB/develop/adjust_uids.php @@ -126,4 +126,3 @@ $db->sql_freeresult($result);  // Done  $db->sql_close();  echo 'done'; -?>
\ No newline at end of file diff --git a/phpBB/develop/adjust_usernames.php b/phpBB/develop/adjust_usernames.php index 1afa77af16..111a9a30d7 100644 --- a/phpBB/develop/adjust_usernames.php +++ b/phpBB/develop/adjust_usernames.php @@ -48,5 +48,3 @@ echo 'FINISHED';  // Done  $db->sql_close(); - -?>
\ No newline at end of file diff --git a/phpBB/develop/benchmark.php b/phpBB/develop/benchmark.php index 5bbe6f53be..c867b9262e 100644 --- a/phpBB/develop/benchmark.php +++ b/phpBB/develop/benchmark.php @@ -458,5 +458,3 @@ function make_user($username)  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/develop/calc_email_hash.php b/phpBB/develop/calc_email_hash.php index a67b0f52a3..0f7540ee7d 100644 --- a/phpBB/develop/calc_email_hash.php +++ b/phpBB/develop/calc_email_hash.php @@ -72,5 +72,3 @@ do  while ($start);  echo "<p><b>Done</b></p>\n"; -  -?>
\ No newline at end of file diff --git a/phpBB/develop/change_smiley_ref.php b/phpBB/develop/change_smiley_ref.php index 3d6dd45d6f..75028d86f0 100644 --- a/phpBB/develop/change_smiley_ref.php +++ b/phpBB/develop/change_smiley_ref.php @@ -56,5 +56,3 @@ while ($row = $db->sql_fetchrow($result))  $db->sql_freeresult($result);  echo "<p><b>Done</b></p>\n"; -  -?>
\ No newline at end of file diff --git a/phpBB/develop/compile_template.php b/phpBB/develop/compile_template.php new file mode 100644 index 0000000000..32d1d321f1 --- /dev/null +++ b/phpBB/develop/compile_template.php @@ -0,0 +1,24 @@ +<?php +// ------------------------------------------------------------- +// +// $Id$ +// +// FILENAME  : compile_template.php +// STARTED   : Sun Apr 24, 2011 +// COPYRIGHT : © 2011 phpBB Group +// WWW       : http://www.phpbb.com/ +// LICENCE   : GPL vs2.0 [ see /docs/COPYING ]  +//  +// ------------------------------------------------------------- + +define('IN_PHPBB', 1); +define('ANONYMOUS', 1); +$phpEx = substr(strrchr(__FILE__, '.'), 1); +$phpbb_root_path = './../'; + +include($phpbb_root_path . 'includes/template_compile.'.$phpEx); + +$file = $argv[1]; + +$compile = new phpbb_template_compile(false); +echo $compile->compile_file($file); diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index d44efb8870..4088657743 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1037,6 +1037,17 @@ function get_schema_struct()  		),  	); +	$schema_data['phpbb_ext'] = array( +		'COLUMNS'		=> array( +			'ext_name'				=> array('VCHAR', ''), +			'ext_active'			=> array('BOOL', 0), +			'ext_state'				=> array('TEXT', ''), +		), +		'KEYS'			=> array( +			'ext_name'				=> array('UNIQUE', 'ext_name'), +		), +	); +  	$schema_data['phpbb_extensions'] = array(  		'COLUMNS'		=> array(  			'extension_id'		=> array('UINT', NULL, 'auto_increment'), @@ -1166,7 +1177,8 @@ function get_schema_struct()  			'group_receive_pm'		=> array('BOOL', 0),  			'group_message_limit'	=> array('UINT', 0),  			'group_max_recipients'	=> array('UINT', 0), -			'group_legend'			=> array('BOOL', 1), +			'group_legend'			=> array('UINT', 0), +			'group_teampage'		=> array('UINT', 0),  		),  		'PRIMARY_KEY'	=> 'group_id',  		'KEYS'			=> array( @@ -1220,6 +1232,7 @@ function get_schema_struct()  		'PRIMARY_KEY'	=> 'log_id',  		'KEYS'			=> array(  			'log_type'				=> array('INDEX', 'log_type'), +			'log_time'				=> array('INDEX', 'log_time'),  			'forum_id'				=> array('INDEX', 'forum_id'),  			'topic_id'				=> array('INDEX', 'topic_id'),  			'reportee_id'			=> array('INDEX', 'reportee_id'), @@ -1449,6 +1462,7 @@ function get_schema_struct()  			'field_validation'		=> array('VCHAR_UNI:20', ''),  			'field_required'		=> array('BOOL', 0),  			'field_show_on_reg'		=> array('BOOL', 0), +			'field_show_on_pm'		=> array('BOOL', 0),  			'field_show_on_vt'		=> array('BOOL', 0),  			'field_show_profile'	=> array('BOOL', 0),  			'field_hide'			=> array('BOOL', 0), @@ -1514,6 +1528,7 @@ function get_schema_struct()  			'report_closed'			=> array('BOOL', 0),  			'report_time'			=> array('TIMESTAMP', 0),  			'report_text'			=> array('MTEXT_UNI', ''), +			'reported_post_text'	=> array('MTEXT_UNI', ''),  		),  		'PRIMARY_KEY'	=> 'report_id',  		'KEYS'			=> array( @@ -1640,92 +1655,14 @@ function get_schema_struct()  			'style_name'			=> array('VCHAR_UNI:255', ''),  			'style_copyright'		=> array('VCHAR_UNI', ''),  			'style_active'			=> array('BOOL', 1), -			'template_id'			=> array('UINT', 0), -			'theme_id'				=> array('UINT', 0), -			'imageset_id'			=> array('UINT', 0), +			'style_path'			=> array('VCHAR:100', ''), +			'bbcode_bitfield'		=> array('VCHAR:255', 'kNg='), +			'style_parent_id'		=> array('UINT:4', 0), +			'style_parent_tree'		=> array('TEXT', ''),  		),  		'PRIMARY_KEY'	=> 'style_id',  		'KEYS'			=> array(  			'style_name'		=> array('UNIQUE', 'style_name'), -			'template_id'		=> array('INDEX', 'template_id'), -			'theme_id'			=> array('INDEX', 'theme_id'), -			'imageset_id'		=> array('INDEX', 'imageset_id'), -		), -	); - -	$schema_data['phpbb_styles_template'] = array( -		'COLUMNS'		=> array( -			'template_id'			=> array('UINT', NULL, 'auto_increment'), -			'template_name'			=> array('VCHAR_UNI:255', ''), -			'template_copyright'	=> array('VCHAR_UNI', ''), -			'template_path'			=> array('VCHAR:100', ''), -			'bbcode_bitfield'		=> array('VCHAR:255', 'kNg='), -			'template_storedb'		=> array('BOOL', 0), -			'template_inherits_id'		=> array('UINT:4', 0), -			'template_inherit_path'		=> array('VCHAR', ''), -		), -		'PRIMARY_KEY'	=> 'template_id', -		'KEYS'			=> array( -			'tmplte_nm'				=> array('UNIQUE', 'template_name'), -		), -	); - -	$schema_data['phpbb_styles_template_data'] = array( -		'COLUMNS'		=> array( -			'template_id'			=> array('UINT', 0), -			'template_filename'		=> array('VCHAR:100', ''), -			'template_included'		=> array('TEXT', ''), -			'template_mtime'		=> array('TIMESTAMP', 0), -			'template_data'			=> array('MTEXT_UNI', ''), -		), -		'KEYS'			=> array( -			'tid'					=> array('INDEX', 'template_id'), -			'tfn'					=> array('INDEX', 'template_filename'), -		), -	); - -	$schema_data['phpbb_styles_theme'] = array( -		'COLUMNS'		=> array( -			'theme_id'				=> array('UINT', NULL, 'auto_increment'), -			'theme_name'			=> array('VCHAR_UNI:255', ''), -			'theme_copyright'		=> array('VCHAR_UNI', ''), -			'theme_path'			=> array('VCHAR:100', ''), -			'theme_storedb'			=> array('BOOL', 0), -			'theme_mtime'			=> array('TIMESTAMP', 0), -			'theme_data'			=> array('MTEXT_UNI', ''), -		), -		'PRIMARY_KEY'	=> 'theme_id', -		'KEYS'			=> array( -			'theme_name'		=> array('UNIQUE', 'theme_name'), -		), -	); - -	$schema_data['phpbb_styles_imageset'] = array( -		'COLUMNS'		=> array( -			'imageset_id'				=> array('UINT', NULL, 'auto_increment'), -			'imageset_name'				=> array('VCHAR_UNI:255', ''), -			'imageset_copyright'		=> array('VCHAR_UNI', ''), -			'imageset_path'				=> array('VCHAR:100', ''), -		), -		'PRIMARY_KEY'		=> 'imageset_id', -		'KEYS'				=> array( -			'imgset_nm'			=> array('UNIQUE', 'imageset_name'), -		), -	); - -	$schema_data['phpbb_styles_imageset_data'] = array( -		'COLUMNS'		=> array( -			'image_id'				=> array('UINT', NULL, 'auto_increment'), -			'image_name'			=> array('VCHAR:200', ''), -			'image_filename'		=> array('VCHAR:200', ''), -			'image_lang'			=> array('VCHAR:30', ''), -			'image_height'			=> array('USINT', 0), -			'image_width'			=> array('USINT', 0), -			'imageset_id'			=> array('UINT', 0), -		), -		'PRIMARY_KEY'		=> 'image_id', -		'KEYS'				=> array( -			'i_d'			=> array('INDEX', 'imageset_id'),  		),  	); @@ -2084,4 +2021,3 @@ EOF;  }  echo 'done'; - diff --git a/phpBB/develop/create_search_index.php b/phpBB/develop/create_search_index.php index c1a7125d61..f329b805a0 100644 --- a/phpBB/develop/create_search_index.php +++ b/phpBB/develop/create_search_index.php @@ -25,7 +25,6 @@ $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';  $phpEx = substr(strrchr(__FILE__, '.'), 1);  require($phpbb_root_path . 'common.' . $phpEx);  require($phpbb_root_path . 'includes/acp/acp_search.' . $phpEx); -require($phpbb_root_path . 'includes/search/' . $class_name . '.' . $phpEx);  $user->session_begin();  $auth->acl($user->data); diff --git a/phpBB/develop/create_variable_overview.php b/phpBB/develop/create_variable_overview.php index a786fc6866..632930bfff 100644 --- a/phpBB/develop/create_variable_overview.php +++ b/phpBB/develop/create_variable_overview.php @@ -42,7 +42,7 @@ fwrite($fp, $contents);  fclose($fp);  $html_skeleton = ' -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<!DOCTYPE html>  <html>  <head>  <link rel="stylesheet" href="subSilver.css" type="text/css"> @@ -360,7 +360,7 @@ echo '<br>Store Files';  $fp = fopen($store_dir . 'index.html', 'w');  $html_data = ' -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<!DOCTYPE html>  <html>  <head>  <link rel="stylesheet" href="subSilver.css" type="text/css"> @@ -425,7 +425,7 @@ fwrite($common_fp, "<?php\n\n \$lang = array(\n");  $fp = fopen($store_dir . 'lang_index.html', 'w');  $html_data = ' -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<!DOCTYPE html>  <html>  <head>  <link rel="stylesheet" href="subSilver.css" type="text/css"> @@ -541,5 +541,3 @@ fclose($fp);  echo '<br>Finished!';  flush(); - -?>
\ No newline at end of file diff --git a/phpBB/develop/extensions.php b/phpBB/develop/extensions.php new file mode 100644 index 0000000000..43621f3080 --- /dev/null +++ b/phpBB/develop/extensions.php @@ -0,0 +1,129 @@ +<?php +/** +* +* @copyright (c) 2012 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +define('IN_PHPBB', 1); +define('ANONYMOUS', 1); +$phpEx = substr(strrchr(__FILE__, '.'), 1); +$phpbb_root_path = __DIR__.'/../'; + +include($phpbb_root_path . 'common.'.$phpEx); + +function usage() +{ +	echo "Usage: extensions.php COMMAND [OPTION]...\n"; +	echo "Console extension manager.\n"; +	echo "\n"; +	echo "list:\n"; +	echo "    Lists all extensions in the database and the filesystem.\n"; +	echo "\n"; +	echo "enable NAME:\n"; +	echo "    Enables the specified extension.\n"; +	echo "\n"; +	echo "disable NAME:\n"; +	echo "    Disables the specified extension.\n"; +	echo "\n"; +	echo "purge NAME:\n"; +	echo "    Purges the specified extension.\n"; +	exit(2); +} + +function list_extensions() +{ +	global $phpbb_extension_manager; + +	$phpbb_extension_manager->load_extensions(); +	$all = array_keys($phpbb_extension_manager->all_available()); + +	if (empty($all)) +	{ +		echo "There were no extensions found.\n"; +		exit(3); +	} + +	echo "Enabled:\n"; +	$enabled = array_keys($phpbb_extension_manager->all_enabled()); +	print_extensions($enabled); +	echo "\n"; + +	echo "Disabled:\n"; +	$disabled = array_keys($phpbb_extension_manager->all_disabled()); +	print_extensions($disabled); +	echo "\n"; + +	echo "Available:\n"; +	$purged = array_diff($all, $enabled, $disabled); +	print_extensions($purged); +} + +function print_extensions($exts) +{ +	foreach ($exts as $ext) +	{ +		echo "- $ext\n"; +	} +} + +function enable_extension($name) +{ +	global $phpbb_extension_manager; + +	$phpbb_extension_manager->enable($name); +} + +function disable_extension($name) +{ +	global $phpbb_extension_manager; + +	$phpbb_extension_manager->disable($name); +} + +function purge_extension($name) +{ +	global $phpbb_extension_manager; + +	$phpbb_extension_manager->purge($name); +} + +function validate_argument_count($count) +{ +	global $argv; + +	if (count($argv) <= $count) +	{ +		usage(); +	} +} + +validate_argument_count(1); + +$action = $argv[1]; + +switch ($action) +{ +	case 'list': +		list_extensions(); +		break; + +	case 'enable': +		validate_argument_count(2); +		enable_extension($argv[2]); +		break; + +	case 'disable': +		validate_argument_count(2); +		disable_extension($argv[2]); +		break; + +	case 'purge': +		validate_argument_count(2); +		purge_extension($argv[2]); +		break; + +	default: +		usage(); +} diff --git a/phpBB/develop/fill.php b/phpBB/develop/fill.php index c1e39fa4f3..5c3552265d 100644 --- a/phpBB/develop/fill.php +++ b/phpBB/develop/fill.php @@ -39,8 +39,8 @@ $posts_per_topic = 500;  // general vars -$mode = (isset($_REQUEST['mode'])) ? $_REQUEST['mode'] : 'generate'; -$start = (isset($_REQUEST['start'])) ? intval($_REQUEST['start']) : 0; +$mode = request_var('mode', 'generate'); +$start = request_var('start', 0);  switch ($mode)  { @@ -184,5 +184,3 @@ function rndm_username()  	return $usernames[array_rand($usernames)];  } - -?>
\ No newline at end of file diff --git a/phpBB/develop/generate_utf_casefold.php b/phpBB/develop/generate_utf_casefold.php index 73951cb4dc..5b99f3e55e 100644 --- a/phpBB/develop/generate_utf_casefold.php +++ b/phpBB/develop/generate_utf_casefold.php @@ -151,5 +151,3 @@ function download($url)  	echo "\n";  } - -?>
\ No newline at end of file diff --git a/phpBB/develop/generate_utf_confusables.php b/phpBB/develop/generate_utf_confusables.php index d2ffbcfc65..027d75b661 100644 --- a/phpBB/develop/generate_utf_confusables.php +++ b/phpBB/develop/generate_utf_confusables.php @@ -239,5 +239,3 @@ function download($url)  	echo "\n";  } - -?>
\ No newline at end of file diff --git a/phpBB/develop/generate_utf_tables.php b/phpBB/develop/generate_utf_tables.php index 6fe5d68ffd..71a5bea851 100644 --- a/phpBB/develop/generate_utf_tables.php +++ b/phpBB/develop/generate_utf_tables.php @@ -568,4 +568,4 @@ function cp_to_utf($cp)  	{  		return chr($cp);  	} -}
\ No newline at end of file +} diff --git a/phpBB/develop/imageset_to_css.php b/phpBB/develop/imageset_to_css.php new file mode 100644 index 0000000000..d49fe9c741 --- /dev/null +++ b/phpBB/develop/imageset_to_css.php @@ -0,0 +1,374 @@ +<?php + +/* +	Converts imageset to CSS code +	 +	Change style name and path below, open in browser. +*/ + +$phpbb_root_path = '../'; +$style = 'subsilver2'; + +$imageset_path = $phpbb_root_path . 'styles/' . $style . '/imageset'; +$theme_path = $phpbb_root_path . 'styles/' . $style . '/theme'; + +// Start output buffering +ob_start(); + +// Get global and English images +$images_global = get_imageset($imageset_path); +if ($images_global === false) +{ +	echo 'imageset.cfg was not found.'; +	echo ob_get_clean(); +	return; +} +$images_en = get_imageset($imageset_path, 'en'); +if ($images_en === false) +{ +	echo 'English imageset.cfg was not found.'; +	echo ob_get_clean(); +	return; +} + +// Remove duplicate images +foreach ($images_en as $key => $row) +{ +	unset($images_global[$key]); +} + +// CSS replacements +$not_compatible = array( +	'{T_TEMPLATE_PATH}', +	'{T_IMAGESET_PATH}', +	'{T_IMAGESET_LANG_PATH}', +	'{T_STYLESHEET_NAME}', +	'{S_USER_LANG}' +); +$replace = array( +	'{T_THEME_PATH}'	=> '.', +); +// Enable/disable one of lines below to enable/disable replacement of English buttons +// $replace = array_merge($replace, get_replacements($images_global)); +$replace = array_merge($replace, get_replacements($images_global), get_replacements($images_en)); + +// BIDI code +$bidi_code = css($images_global, './images/', true); + +// Get all CSS files, parse them +$files = list_files($theme_path, 'css'); +if ($files === false || !count($files)) +{ +	echo 'No CSS files found in theme directory.<br />'; +} +else for ($i=0; $i<count($files); $i++) +{ +	$file = $theme_path . '/' . $files[$i]; +	$data = file_get_contents($file); +	$hash = md5($data); +	$data = strtr($data, $replace); +	$errors = false; +	for($j=0; $j<count($not_compatible); $j++) +	{ +		if (strpos($data, $not_compatible[$j]) !== false) +		{ +			echo 'Error: ', $file, ' contains ', $not_compatible[$j], '. That variable cannot be converted.<br />'; +			continue; +		} +	} +	if (basename($file) == 'bidi.css' && strpos($data, '/* Former imageset */') === false && strlen($bidi_code)) +	{ +		// Add bidi data +		$data .= "\n/* Former imageset */\n" . $bidi_code; +		$bidi_code = ''; +		echo 'Note: RTL imageset entries were added at the end of file below:<br />'; +	} +	if (md5($data) == $hash) +	{ +		echo 'Nothing to replace in ', $file, '<br />'; +	} +	else +	{ +		echo 'Updated ', $file, ':', dump_code($data, $files[$i]); +	} +} + +// Check if there are invalid images in imageset +$list = array_merge($images_global, $images_en); +foreach ($list as $key => $row) +{ +	if ($row['skip']) +	{ +		echo 'Unable to generate code to add to CSS files because some images are missing or invalid. See errors above.'; +		echo ob_get_clean(); +		return; +	} +} + +// Code to add to CSS files +$code = ' +/* Former imageset */ +span.imageset { +	display: inline-block; +	background: transparent none 0 0 no-repeat; +	margin: 0; +	padding: 0; +	width: 0; +	height: 0; +	overflow: hidden; +} + +/* Global imageset items */ +' . css($images_global, './images/') . ' + +/* English images for fallback */ +' . css($images_en, './en/'); +if (strlen($bidi_code)) +{ +	$code .= "\n/* RTL imageset entries */\n" . $bidi_code; +} +echo 'Code to add to CSS file:', dump_code($code, 'imageset.css'); + + +$list = list_languages($imageset_path); +for ($i=0; $i<count($list); $i++) +{ +	$lang = $list[$i]; +	$images = get_imageset($imageset_path . '/' . $lang); +	if (!count($images)) +	{ +		continue; +	} +	$code = '/* ' . strtoupper($lang) . ' Language Pack */ +' . css($images, './'); +	echo 'New CSS file: ', $theme_path, '/', $lang, '/stylesheet.css', dump_code($code, 'stylesheet_' . $lang . '.css'); +} + +echo ob_get_clean(); +return; + + +/* +	Functions +*/ +function get_imageset($path, $lang = '') +{ +	$cfg = $path . ($lang ? '/' . $lang : '') . '/imageset.cfg'; +	if (!@file_exists($cfg)) +	{	 +		return false; +	} +	$data = file($cfg); +	$result = array(); +	for ($i=0; $i<count($data); $i++) +	{ +		$str = trim($data[$i]); +		if (substr($str, 0, 4) != 'img_')  +		{ +			continue; +		} +		$list = explode('=', $data[$i]); +		if (count($list) != 2)  +		{ +			continue; +		} +		$key = trim($list[0]); +		$row = explode('*', trim($list[1])); +		$file = trim($row[0]); +		$height = isset($row[1]) && intval($row[1]) ? intval($row[1]) : false; +		$width = isset($row[2]) && intval($row[2]) ? intval($row[2]) : false; +		$skip = false; +		if (strlen($file) && (!$width || !$height)) +		{ +			// Try to detect width/height +			$filename = $path . ($lang ? '/' . $lang : '') . '/' . $file; +			if (!@file_exists($filename)) +			{ +				echo 'Error: file ', $filename, ' does not exist and its dimensions are not available in imageset.cfg<br />'; +				$skip = true; +			} +			else +			{ +				$size = @getimagesize($filename); +				if ($size === false) +				{ +					echo 'Error: file ', $filename, ' is not a valid image<br />'; +					$skip = true; +				} +				else +				{ +					if(!$width) $width = intval($size[0]); +					if(!$height) $height = intval($size[1]); +				} +			} +		} +		$result[$key] = array( +			'lang'  => $lang, +			'file'  => $file, +			'height'	=> $height, +			'width' => $width, +			'skip'  => $skip +		); +	} +	return $result; +} + +function get_replacements($list) +{ +	$result = array(); +	foreach ($list as $key => $row) +	{ +		$key = '{' . strtoupper($key); +		$result[$key . '_SRC}'] = strlen($row['file']) ? ($row['lang'] ? './' . $row['lang'] : './images') . '/' . $row['file'] : ''; +		$result[$key . '_WIDTH}'] = intval($row['width']); +		$result[$key . '_HEIGHT}'] = intval($row['height']); +	} +	return $result; +} + +function list_files($dir, $ext) +{ +	$res = @opendir($dir); +	if ($res === false) +	{ +		return false; +	} +	$files = array(); +	while (($file = readdir($res)) !== false) +	{ +		$list = explode('.', $file); +		if(count($list) > 1 && strtolower($list[count($list) - 1]) == $ext) +		{ +			$files[] = $file; +		} +	} +	closedir($res); +	return $files; +} + +function list_languages($dir) +{ +	$res = @opendir($dir); +	if ($res === false) +	{ +		return array(); +	} +	$files = array(); +	while (($file = readdir($res)) !== false) +	{ +		if (substr($file, 0, 1) == '.') +		{ +			continue; +		} +		$filename = $dir . '/' . $file; +		if (is_dir($filename) && file_exists($filename . '/imageset.cfg')) +		{ +			$files[] = $file; +		} +	} +	closedir($res); +	return $files; +} + +function dump_code($code, $filename = 'file.txt') +{ +	$hash = md5($code); +	if (isset($_GET['download']) && $_GET['download'] === $hash) +	{ +		// Download file +		ob_end_clean(); +		header('Pragma: public'); +		header('Expires: 0'); +		header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); +		header('Content-Type: application/force-download'); +		header('Content-Disposition: attachment; filename="' . $filename . '";'); +		header('Content-Transfer-Encoding: binary'); +		header('Content-Length: ' . strlen($code)); +		echo $code; +		exit; +	} +	$list = explode("\n", $code); +	$height = 15 * count($list); +	echo ' [ <a href="?download=', $hash, '">download</a> <a href="javascript:void(0);" onclick="document.getElementById(\'code-', $hash, '\').style.height = \'', $height, 'px\'; this.style.display = \'none\'; return false;">expand</a> ]<br />'; +	echo '<textarea id="code-', $hash, '" onfocus="this.select();" style="width: 98%; height: 200px;">', htmlspecialchars($code), '</textarea><br />'; +} + +function css($list, $path = './', $bidi = false) +{ +	$code = ''; +	// Change value to true if you want images to be grouped up by size +	$group = $bidi; +	if ($group) +	{ +		// group up images by size +		$groups = array(); +		foreach ($list as $key => $row) +		{ +			if (!strlen($row['file'])) +			{ +				continue; +			} +			$groups[$row['width'] . '*' . $row['height']][] = $key; +		} +		foreach ($groups as $size => $keys) +		{ +			$extra = ''; +			for ($i=0; $i<count($keys); $i++) +			{ +				$code .= ($i == 0 ? '' : ', ') . ($bidi ? '.rtl ' : '') . '.imageset.' . substr($keys[$i], 4); +				if (!$bidi) +				{ +					$extra .= '.imageset.' . substr($keys[$i], 4) . ' { background-image: url("' . $path . $list[$keys[$i]]['file'] . "\"); }\n"; +				} +			} +			$row = $list[$keys[0]]; +			$code .= ' {'; +			if ($bidi) +			{ +				$code .= ' +	padding-right: ' . $row['width'] . 'px; +	padding-left: 0; +} +'; +			} +			else +			{ +				$code .= ' +	padding-left: ' . $row['width'] . 'px; +	padding-top: ' . $row['height'] . 'px; +} +' . $extra; +			} +		} +	} +	else +	{ +		foreach ($list as $key => $row) +		{ +			if (!strlen($row['file'])) +			{ +				continue; +			} +			$code .= ($bidi ? '.rtl ' : '') . '.imageset.' . substr($key, 4) . ' {'; +			if ($bidi) +			{ +				$code .= ' +	padding-right: ' . $row['width'] . 'px; +	padding-left: 0; +} +'; +			} +			else +			{ +				$code .= ' +	background-image: url("' . $path . $row['file'] . '"); +	padding-left: ' . $row['width'] . 'px; +	padding-top: ' . $row['height'] . 'px; +} +'; +			} +		} +	} +	return $code; +} + diff --git a/phpBB/develop/lang_duplicates.php b/phpBB/develop/lang_duplicates.php index 5be48f69f0..02852798b6 100644 --- a/phpBB/develop/lang_duplicates.php +++ b/phpBB/develop/lang_duplicates.php @@ -15,10 +15,8 @@ die("Please read the first lines of this script for instructions on how to enabl  // -------------------------------------------------------------  // -// $Id$ -//  // @copyright (c) 2005 phpBB Group  -// @license http://opensource.org/licenses/gpl-license.php GNU Public License  +// @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  //   // -------------------------------------------------------------  // Thanks to arod-1 @@ -137,4 +135,4 @@ function find_modules($dirname)  ?>  	</body> -</html>
\ No newline at end of file +</html> diff --git a/phpBB/develop/merge_attachment_tables.php b/phpBB/develop/merge_attachment_tables.php index ae7fe57be4..aa6be0a26e 100644 --- a/phpBB/develop/merge_attachment_tables.php +++ b/phpBB/develop/merge_attachment_tables.php @@ -76,5 +76,3 @@ $db->sql_query($sql);  //$db->sql_query("DROP TABLE {$table_prefix}attach_temp");  echo "<p><b>Done</b></p>\n"; -  -?>
\ No newline at end of file diff --git a/phpBB/develop/merge_post_tables.php b/phpBB/develop/merge_post_tables.php index 5ccfef84c3..d13ae287b5 100644 --- a/phpBB/develop/merge_post_tables.php +++ b/phpBB/develop/merge_post_tables.php @@ -204,5 +204,3 @@ foreach ($sql_ary as $sql)  }  echo "<p><b>Done</b></p>\n"; -  -?>
\ No newline at end of file diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php index 49daab0962..88596e9461 100644 --- a/phpBB/develop/mysql_upgrader.php +++ b/phpBB/develop/mysql_upgrader.php @@ -688,6 +688,7 @@ function get_schema_struct()  		'PRIMARY_KEY'	=> 'log_id',  		'KEYS'			=> array(  			'log_type'				=> array('INDEX', 'log_type'), +			'log_time'				=> array('INDEX', 'log_time'),  			'forum_id'				=> array('INDEX', 'forum_id'),  			'topic_id'				=> array('INDEX', 'topic_id'),  			'reportee_id'			=> array('INDEX', 'reportee_id'), @@ -1090,92 +1091,14 @@ function get_schema_struct()  			'style_name'			=> array('VCHAR_UNI:255', ''),  			'style_copyright'		=> array('VCHAR_UNI', ''),  			'style_active'			=> array('BOOL', 1), -			'template_id'			=> array('UINT', 0), -			'theme_id'				=> array('UINT', 0), -			'imageset_id'			=> array('UINT', 0), +			'style_path'			=> array('VCHAR:100', ''), +			'bbcode_bitfield'		=> array('VCHAR:255', 'kNg='), +			'style_parent_id'		=> array('UINT:4', 0), +			'style_parent_tree'		=> array('TEXT', ''),  		),  		'PRIMARY_KEY'	=> 'style_id',  		'KEYS'			=> array(  			'style_name'		=> array('UNIQUE', 'style_name'), -			'template_id'		=> array('INDEX', 'template_id'), -			'theme_id'			=> array('INDEX', 'theme_id'), -			'imageset_id'		=> array('INDEX', 'imageset_id'), -		), -	); - -	$schema_data['phpbb_styles_template'] = array( -		'COLUMNS'		=> array( -			'template_id'			=> array('UINT', NULL, 'auto_increment'), -			'template_name'			=> array('VCHAR_UNI:255', ''), -			'template_copyright'	=> array('VCHAR_UNI', ''), -			'template_path'			=> array('VCHAR:100', ''), -			'bbcode_bitfield'		=> array('VCHAR:255', 'kNg='), -			'template_storedb'		=> array('BOOL', 0), -			'template_inherits_id'		=> array('UINT:4', 0), -			'template_inherit_path'		=> array('VCHAR', ''), -		), -		'PRIMARY_KEY'	=> 'template_id', -		'KEYS'			=> array( -			'tmplte_nm'				=> array('UNIQUE', 'template_name'), -		), -	); - -	$schema_data['phpbb_styles_template_data'] = array( -		'COLUMNS'		=> array( -			'template_id'			=> array('UINT', 0), -			'template_filename'		=> array('VCHAR:100', ''), -			'template_included'		=> array('TEXT', ''), -			'template_mtime'		=> array('TIMESTAMP', 0), -			'template_data'			=> array('MTEXT_UNI', ''), -		), -		'KEYS'			=> array( -			'tid'					=> array('INDEX', 'template_id'), -			'tfn'					=> array('INDEX', 'template_filename'), -		), -	); - -	$schema_data['phpbb_styles_theme'] = array( -		'COLUMNS'		=> array( -			'theme_id'				=> array('UINT', NULL, 'auto_increment'), -			'theme_name'			=> array('VCHAR_UNI:255', ''), -			'theme_copyright'		=> array('VCHAR_UNI', ''), -			'theme_path'			=> array('VCHAR:100', ''), -			'theme_storedb'			=> array('BOOL', 0), -			'theme_mtime'			=> array('TIMESTAMP', 0), -			'theme_data'			=> array('MTEXT_UNI', ''), -		), -		'PRIMARY_KEY'	=> 'theme_id', -		'KEYS'			=> array( -			'theme_name'		=> array('UNIQUE', 'theme_name'), -		), -	); - -	$schema_data['phpbb_styles_imageset'] = array( -		'COLUMNS'		=> array( -			'imageset_id'				=> array('UINT', NULL, 'auto_increment'), -			'imageset_name'				=> array('VCHAR_UNI:255', ''), -			'imageset_copyright'		=> array('VCHAR_UNI', ''), -			'imageset_path'				=> array('VCHAR:100', ''), -		), -		'PRIMARY_KEY'		=> 'imageset_id', -		'KEYS'				=> array( -			'imgset_nm'			=> array('UNIQUE', 'imageset_name'), -		), -	); - -	$schema_data['phpbb_styles_imageset_data'] = array( -		'COLUMNS'		=> array( -			'image_id'				=> array('UINT', NULL, 'auto_increment'), -			'image_name'			=> array('VCHAR:200', ''), -			'image_filename'		=> array('VCHAR:200', ''), -			'image_lang'			=> array('VCHAR:30', ''), -			'image_height'			=> array('USINT', 0), -			'image_width'			=> array('USINT', 0), -			'imageset_id'			=> array('UINT', 0), -		), -		'PRIMARY_KEY'		=> 'image_id', -		'KEYS'				=> array( -			'i_d'			=> array('INDEX', 'imageset_id'),  		),  	); @@ -1397,5 +1320,3 @@ function get_schema_struct()  	return $schema_data;  } - -?>
\ No newline at end of file diff --git a/phpBB/develop/nuke-db.php b/phpBB/develop/nuke-db.php index d7329c3f56..e1f64a6177 100644 --- a/phpBB/develop/nuke-db.php +++ b/phpBB/develop/nuke-db.php @@ -54,5 +54,3 @@ else  		flush();  	}  } -?> - diff --git a/phpBB/develop/regex.php b/phpBB/develop/regex.php index 8165ba1f21..46b6fff701 100644 --- a/phpBB/develop/regex.php +++ b/phpBB/develop/regex.php @@ -80,5 +80,3 @@ echo 'www.URL: ' . $www_url . "<br />\n";  // no schema and no authority  $relative_url = "$segment$path_abempty(?:\?$query)?(?:\#$fragment)?";  echo 'relative URL: ' . $relative_url . "<br />\n"; - -?>
\ No newline at end of file diff --git a/phpBB/develop/remove-php-end-tags.py b/phpBB/develop/remove-php-end-tags.py new file mode 100755 index 0000000000..89b9ee5032 --- /dev/null +++ b/phpBB/develop/remove-php-end-tags.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python +# Remove ending PHP tags '?>' +# @author Oleg Pudeyev +# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 + +import sys, os, os.path, optparse + +def error(message, code): +    print >>sys.stderr, message +    exit(code) + + +parser = optparse.OptionParser() +parser.add_option('-a', '--aggressive', help='Remove ending tags when they are followed by whitespace', action='store_true') +options, args = parser.parse_args() + +if len(args) != 1: +    parser.usage() +    error("Usage: remove-php-end-tags path", 2) + +path = args[0] + +if not os.path.exists(path): +    error("Path does not exist: %s" % path, 3) + +if options.aggressive: +    import re +     +    fix_re = re.compile(r'\s*\?>\s*$') +    def fix_content(content): +        content = fix_re.sub(r'\n', content) +        return content +else: +    def fix_content(content): +        if content.endswith('?>'): +            content = content[:-2].strip() + "\n" +        return content + +def process_file(path): +    f = open(path) +    try: +        content = f.read() +    finally: +        f.close() +    fixed_content = fix_content(content) +    if content != fixed_content: +        f = open(path, 'w') +        try: +            f.write(fixed_content) +        finally: +            f.close() + +def process_dir(path): +    for root, dirs, files in os.walk(path): +        if '.svn' in dirs: +            dirs.remove('.svn') +        for file in files: +            if file.endswith('.php'): +                path = os.path.join(root, file) +                process_file(path) + +if os.path.isdir(path): +    process_dir(path) +else: +    process_file(path) diff --git a/phpBB/develop/repair_bots.php b/phpBB/develop/repair_bots.php index c5aaa75d9b..790d3d9f2f 100644 --- a/phpBB/develop/repair_bots.php +++ b/phpBB/develop/repair_bots.php @@ -147,5 +147,3 @@ function add_bots($bots)  		}  	}  } - -?>
\ No newline at end of file diff --git a/phpBB/develop/search_fill.php b/phpBB/develop/search_fill.php index 371c8c74cc..4c0b607778 100644 --- a/phpBB/develop/search_fill.php +++ b/phpBB/develop/search_fill.php @@ -34,13 +34,11 @@ $user->setup();  $search_type = $config['search_type']; -if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) +if (!class_exists($search_type))  {  	trigger_error('NO_SUCH_SEARCH_MODULE');  } -require($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx); -  $error = false;  $search = new $search_type($error); diff --git a/phpBB/develop/unicode_testing.php b/phpBB/develop/unicode_testing.php index 25a13d1325..ec3c71d078 100644 --- a/phpBB/develop/unicode_testing.php +++ b/phpBB/develop/unicode_testing.php @@ -116,5 +116,3 @@ function utf8_normalize_nfkc($strings)  	return $strings;  } - -?>
\ No newline at end of file diff --git a/phpBB/develop/update_email_hash.php b/phpBB/develop/update_email_hash.php index 80fd4bbc17..57aebe3ca0 100644 --- a/phpBB/develop/update_email_hash.php +++ b/phpBB/develop/update_email_hash.php @@ -54,4 +54,3 @@ echo 'FINISHED';  // Done  $db->sql_close(); -?>
\ No newline at end of file diff --git a/phpBB/develop/utf_normalizer_test.php b/phpBB/develop/utf_normalizer_test.php index 71f24a716b..186e10fea2 100644 --- a/phpBB/develop/utf_normalizer_test.php +++ b/phpBB/develop/utf_normalizer_test.php @@ -387,4 +387,4 @@ function cp_to_utf($cp)  	{  		return chr($cp);  	} -}
\ No newline at end of file +} | 
