diff options
Diffstat (limited to 'phpBB/includes/acp')
67 files changed, 1424 insertions, 3226 deletions
| diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index e4650455c4..3cfe5de293 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -36,14 +36,20 @@ class acp_attachments  	/** @var \phpbb\user */  	protected $user; +	/** @var  \phpbb\filesystem\filesystem_interface */ +	protected $filesystem; + +	/** @var \phpbb\attachment\manager */ +	protected $attachment_manager; +  	public $id;  	public $u_action;  	protected $new_config;  	function main($id, $mode)  	{ -		global $db, $user, $auth, $template, $cache, $phpbb_container, $phpbb_dispatcher; -		global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx; +		global $db, $user, $auth, $template, $cache, $phpbb_container, $phpbb_filesystem, $phpbb_dispatcher; +		global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx, $phpbb_log, $request;  		$this->id = $id;  		$this->db = $db; @@ -51,12 +57,14 @@ class acp_attachments  		$this->template = $template;  		$this->user = $user;  		$this->phpbb_container = $phpbb_container; +		$this->filesystem = $phpbb_filesystem; +		$this->attachment_manager = $phpbb_container->get('attachment.manager');  		$user->add_lang(array('posting', 'viewtopic', 'acp/attachments'));  		$error = $notify = array();  		$submit = (isset($_POST['submit'])) ? true : false; -		$action = request_var('action', ''); +		$action = $request->variable('action', '');  		$form_key = 'acp_attach';  		add_form_key($form_key); @@ -175,7 +183,7 @@ class acp_attachments  				extract($phpbb_dispatcher->trigger_event('core.acp_attachments_config_edit_add', compact($vars)));  				$this->new_config = $config; -				$cfg_array = (isset($_REQUEST['config'])) ? request_var('config', array('' => '')) : $this->new_config; +				$cfg_array = (isset($_REQUEST['config'])) ? $request->variable('config', array('' => '')) : $this->new_config;  				$error = array();  				// We validate the complete config if whished @@ -199,13 +207,13 @@ class acp_attachments  					if (in_array($config_name, array('attachment_quota', 'max_filesize', 'max_filesize_pm')))  					{ -						$size_var = request_var($config_name, ''); +						$size_var = $request->variable($config_name, '');  						$this->new_config[$config_name] = $config_value = ($size_var == 'kb') ? round($config_value * 1024) : (($size_var == 'mb') ? round($config_value * 1048576) : $config_value);  					}  					if ($submit)  					{ -						set_config($config_name, $config_value); +						$config->set($config_name, $config_value);  					}  				} @@ -213,7 +221,7 @@ class acp_attachments  				if ($submit)  				{ -					add_log('admin', 'LOG_CONFIG_ATTACH'); +					$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_ATTACH');  					// Check Settings  					$this->test_upload($error, $this->new_config['upload_path'], false); @@ -349,8 +357,8 @@ class acp_attachments  					if ($submit)  					{  						// Change Extensions ? -						$extension_change_list	= request_var('extension_change_list', array(0)); -						$group_select_list		= request_var('group_select', array(0)); +						$extension_change_list	= $request->variable('extension_change_list', array(0)); +						$group_select_list		= $request->variable('group_select', array(0));  						// Generate correct Change List  						$extensions = array(); @@ -374,13 +382,13 @@ class acp_attachments  									WHERE extension_id = ' . $row['extension_id'];  								$db->sql_query($sql); -								add_log('admin', 'LOG_ATTACH_EXT_UPDATE', $row['extension']); +								$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXT_UPDATE', false, array($row['extension']));  							}  						}  						$db->sql_freeresult($result);  						// Delete Extension? -						$extension_id_list = request_var('extension_id_list', array(0)); +						$extension_id_list = $request->variable('extension_id_list', array(0));  						if (sizeof($extension_id_list))  						{ @@ -401,13 +409,13 @@ class acp_attachments  								WHERE ' . $db->sql_in_set('extension_id', $extension_id_list);  							$db->sql_query($sql); -							add_log('admin', 'LOG_ATTACH_EXT_DEL', $extension_list); +							$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXT_DEL', false, array($extension_list));  						}  					}  					// Add Extension? -					$add_extension			= strtolower(request_var('add_extension', '')); -					$add_extension_group	= request_var('add_group_select', 0); +					$add_extension			= strtolower($request->variable('add_extension', '')); +					$add_extension_group	= $request->variable('add_group_select', 0);  					$add					= (isset($_POST['add_extension_check'])) ? true : false;  					if ($add_extension && $add) @@ -433,7 +441,8 @@ class acp_attachments  								);  								$db->sql_query('INSERT INTO ' . EXTENSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); -								add_log('admin', 'LOG_ATTACH_EXT_ADD', $add_extension); + +								$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXT_ADD', false, array($add_extension));  							}  						}  					} @@ -490,8 +499,8 @@ class acp_attachments  				if ($submit)  				{ -					$action = request_var('action', ''); -					$group_id = request_var('g', 0); +					$action = $request->variable('action', ''); +					$group_id = $request->variable('g', 0);  					if ($action != 'add' && $action != 'edit')  					{ @@ -522,7 +531,7 @@ class acp_attachments  						$ext_row = array();  					} -					$group_name = utf8_normalize_nfc(request_var('group_name', '', true)); +					$group_name = $request->variable('group_name', '', true);  					$new_group_name = ($action == 'add') ? $group_name : (($ext_row['group_name'] != $group_name) ? $group_name : '');  					if (!$group_name) @@ -552,12 +561,12 @@ class acp_attachments  					if (!sizeof($error))  					{  						// Ok, build the update/insert array -						$upload_icon	= request_var('upload_icon', 'no_image'); -						$size_select	= request_var('size_select', 'b'); -						$forum_select	= request_var('forum_select', false); -						$allowed_forums	= request_var('allowed_forums', array(0)); +						$upload_icon	= $request->variable('upload_icon', 'no_image'); +						$size_select	= $request->variable('size_select', 'b'); +						$forum_select	= $request->variable('forum_select', false); +						$allowed_forums	= $request->variable('allowed_forums', array(0));  						$allow_in_pm	= (isset($_POST['allow_in_pm'])) ? true : false; -						$max_filesize	= request_var('max_filesize', 0); +						$max_filesize	= $request->variable('max_filesize', 0);  						$max_filesize	= ($size_select == 'kb') ? round($max_filesize * 1024) : (($size_select == 'mb') ? round($max_filesize * 1048576) : $max_filesize);  						$allow_group	= (isset($_POST['allow_group'])) ? true : false; @@ -573,7 +582,7 @@ class acp_attachments  						$group_ary = array(  							'group_name'	=> $group_name, -							'cat_id'		=> request_var('special_category', ATTACHMENT_CATEGORY_NONE), +							'cat_id'		=> $request->variable('special_category', ATTACHMENT_CATEGORY_NONE),  							'allow_group'	=> ($allow_group) ? 1 : 0,  							'upload_icon'	=> ($upload_icon == 'no_image') ? '' : $upload_icon,  							'max_filesize'	=> $max_filesize, @@ -598,10 +607,10 @@ class acp_attachments  						}  						$group_name = (isset($user->lang['EXT_GROUP_' . $group_name])) ? $user->lang['EXT_GROUP_' . $group_name] : $group_name; -						add_log('admin', 'LOG_ATTACH_EXTGROUP_' . strtoupper($action), $group_name); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXTGROUP_' . strtoupper($action), false, array($group_name));  					} -					$extension_list = request_var('extensions', array(0)); +					$extension_list = $request->variable('extensions', array(0));  					if ($action == 'edit' && sizeof($extension_list))  					{ @@ -630,13 +639,10 @@ class acp_attachments  				$cat_lang = array(  					ATTACHMENT_CATEGORY_NONE		=> $user->lang['NO_FILE_CAT'],  					ATTACHMENT_CATEGORY_IMAGE		=> $user->lang['CAT_IMAGES'], -					ATTACHMENT_CATEGORY_WM			=> $user->lang['CAT_WM_FILES'], -					ATTACHMENT_CATEGORY_RM			=> $user->lang['CAT_RM_FILES'],  					ATTACHMENT_CATEGORY_FLASH		=> $user->lang['CAT_FLASH_FILES'], -					ATTACHMENT_CATEGORY_QUICKTIME	=> $user->lang['CAT_QUICKTIME_FILES'],  				); -				$group_id = request_var('g', 0); +				$group_id = $request->variable('g', 0);  				$action = (isset($_POST['add'])) ? 'add' : $action;  				switch ($action) @@ -663,7 +669,7 @@ class acp_attachments  								WHERE group_id = $group_id";  							$db->sql_query($sql); -							add_log('admin', 'LOG_ATTACH_EXTGROUP_DEL', $group_name); +							$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXTGROUP_DEL', false, array($group_name));  							$cache->destroy('_extensions'); @@ -704,7 +710,7 @@ class acp_attachments  						if ($action == 'add')  						{  							$ext_group_row = array( -								'group_name'	=> utf8_normalize_nfc(request_var('group_name', '', true)), +								'group_name'	=> $request->variable('group_name', '', true),  								'cat_id'		=> 0,  								'allow_group'	=> 1,  								'allow_in_pm'	=> 1, @@ -715,8 +721,6 @@ class acp_attachments  							$forum_ids = array();  						} -						$extensions = array(); -  						$sql = 'SELECT *  							FROM ' . EXTENSIONS_TABLE . "  							WHERE group_id = $group_id @@ -920,9 +924,9 @@ class acp_attachments  				if ($submit)  				{ -					$delete_files = (isset($_POST['delete'])) ? array_keys(request_var('delete', array('' => 0))) : array(); -					$add_files = (isset($_POST['add'])) ? array_keys(request_var('add', array('' => 0))) : array(); -					$post_ids = request_var('post_id', array('' => 0)); +					$delete_files = (isset($_POST['delete'])) ? array_keys($request->variable('delete', array('' => 0))) : array(); +					$add_files = (isset($_POST['add'])) ? array_keys($request->variable('add', array('' => 0))) : array(); +					$post_ids = $request->variable('post_id', array('' => 0));  					if (sizeof($delete_files))  					{ @@ -935,11 +939,11 @@ class acp_attachments  						$delete_files = array();  						while ($row = $db->sql_fetchrow($result))  						{ -							phpbb_unlink($row['physical_filename'], 'file'); +							$this->attachment_manager->unlink($row['physical_filename'], 'file');  							if ($row['thumbnail'])  							{ -								phpbb_unlink($row['physical_filename'], 'thumbnail'); +								$this->attachment_manager->unlink($row['physical_filename'], 'thumbnail');  							}  							$delete_files[$row['attach_id']] = $row['real_filename']; @@ -953,7 +957,7 @@ class acp_attachments  							WHERE ' . $db->sql_in_set('attach_id', array_keys($delete_files));  						$db->sql_query($sql); -						add_log('admin', 'LOG_ATTACH_ORPHAN_DEL', implode(', ', $delete_files)); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_ORPHAN_DEL', false, array(implode(', ', $delete_files)));  						$notify[] = sprintf($user->lang['LOG_ATTACH_ORPHAN_DEL'], implode($user->lang['COMMA_SEPARATOR'], $delete_files));  					} @@ -1044,14 +1048,14 @@ class acp_attachments  							$space_taken += $row['filesize'];  							$files_added++; -							add_log('admin', 'LOG_ATTACH_FILEUPLOAD', $post_row['post_id'], $row['real_filename']); +							$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_FILEUPLOAD', false, array($post_row['post_id'], $row['real_filename']));  						}  						$db->sql_freeresult($result);  						if ($files_added)  						{ -							set_config_count('upload_dir_size', $space_taken, true); -							set_config_count('num_files', $files_added, true); +							$config->increment('upload_dir_size', $space_taken, false); +							$config->increment('num_files', $files_added, false);  						}  					}  				} @@ -1088,7 +1092,7 @@ class acp_attachments  				if ($submit)  				{ -					$delete_files = (isset($_POST['delete'])) ? array_keys(request_var('delete', array('' => 0))) : array(); +					$delete_files = (isset($_POST['delete'])) ? array_keys($request->variable('delete', array('' => 0))) : array();  					if (sizeof($delete_files))  					{ @@ -1104,13 +1108,14 @@ class acp_attachments  						}  						$db->sql_freeresult($result); -						if ($num_deleted = delete_attachments('attach', $delete_files)) +						if ($num_deleted = $this->attachment_manager->delete('attach', $delete_files))  						{  							if (sizeof($delete_files) != $num_deleted)  							{  								$error[] = $user->lang['FILES_GONE'];  							} -							add_log('admin', 'LOG_ATTACHMENTS_DELETED', implode(', ', $deleted_filenames)); + +							$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACHMENTS_DELETED', false, array(implode(', ', $deleted_filenames)));  							$notify[] = sprintf($user->lang['LOG_ATTACHMENTS_DELETED'], implode($user->lang['COMMA_SEPARATOR'], $deleted_filenames));  						}  						else @@ -1136,12 +1141,12 @@ class acp_attachments  					'S_MANAGE'		=> true,  				)); -				$start		= request_var('start', 0); +				$start		= $request->variable('start', 0);  				// Sort keys -				$sort_days	= request_var('st', 0); -				$sort_key	= request_var('sk', 't'); -				$sort_dir	= request_var('sd', 'd'); +				$sort_days	= $request->variable('st', 0); +				$sort_key	= $request->variable('sk', 't'); +				$sort_dir	= $request->variable('sd', 'd');  				// Sorting  				$limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); @@ -1162,6 +1167,7 @@ class acp_attachments  				$total_size = $stats['upload_dir_size'];  				// Make sure $start is set to the last page if it exceeds the amount +				/* @var $pagination \phpbb\pagination */  				$pagination = $phpbb_container->get('pagination');  				$start = $pagination->validate_start($start, $attachments_per_page, $num_files); @@ -1361,6 +1367,8 @@ class acp_attachments  		else  		{  			$this->set_attachment_stats($this->get_attachment_stats()); + +			/* @var $log \phpbb\log\log_interface */  			$log = $this->phpbb_container->get('log');  			$log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_RESYNC_FILES_STATS');  		} @@ -1377,10 +1385,7 @@ class acp_attachments  		$types = array(  			ATTACHMENT_CATEGORY_NONE		=> $user->lang['NO_FILE_CAT'],  			ATTACHMENT_CATEGORY_IMAGE		=> $user->lang['CAT_IMAGES'], -			ATTACHMENT_CATEGORY_WM			=> $user->lang['CAT_WM_FILES'], -			ATTACHMENT_CATEGORY_RM			=> $user->lang['CAT_RM_FILES'],  			ATTACHMENT_CATEGORY_FLASH		=> $user->lang['CAT_FLASH_FILES'], -			ATTACHMENT_CATEGORY_QUICKTIME	=> $user->lang['CAT_QUICKTIME_FILES'],  		);  		if ($group_id) @@ -1511,7 +1516,15 @@ class acp_attachments  			if (!file_exists($phpbb_root_path . $upload_dir))  			{  				@mkdir($phpbb_root_path . $upload_dir, 0777); -				phpbb_chmod($phpbb_root_path . $upload_dir, CHMOD_READ | CHMOD_WRITE); + +				try +				{ +					$this->filesystem->phpbb_chmod($phpbb_root_path . $upload_dir, CHMOD_READ | CHMOD_WRITE); +				} +				catch (\phpbb\filesystem\exception\filesystem_exception $e) +				{ +					// Do nothing +				}  			}  		} @@ -1527,7 +1540,7 @@ class acp_attachments  			return;  		} -		if (!phpbb_is_writable($phpbb_root_path . $upload_dir)) +		if (!$this->filesystem->is_writable($phpbb_root_path . $upload_dir))  		{  			$error[] = sprintf($user->lang['NO_WRITE_UPLOAD'], $upload_dir);  			return; @@ -1539,13 +1552,12 @@ class acp_attachments  	*/  	function perform_site_list()  	{ -		global $db, $user; -		global $request; +		global $db, $user, $request, $phpbb_log;  		if (isset($_REQUEST['securesubmit']))  		{  			// Grab the list of entries -			$ips = request_var('ips', ''); +			$ips = $request->variable('ips', '');  			$ip_list = array_unique(explode("\n", $ips));  			$ip_list_log = implode(', ', $ip_list); @@ -1570,7 +1582,6 @@ class acp_attachments  						if ($ip_2_counter == 0 && $ip_2_end == 254)  						{  							$ip_2_counter = 256; -							$ip_2_fragment = 256;  							$iplist[] = "'$ip_1_counter.*'";  						} @@ -1583,7 +1594,6 @@ class acp_attachments  							if ($ip_3_counter == 0 && $ip_3_end == 254)  							{  								$ip_3_counter = 256; -								$ip_3_fragment = 256;  								$iplist[] = "'$ip_1_counter.$ip_2_counter.*'";  							} @@ -1596,7 +1606,6 @@ class acp_attachments  								if ($ip_4_counter == 0 && $ip_4_end == 254)  								{  									$ip_4_counter = 256; -									$ip_4_fragment = 256;  									$iplist[] = "'$ip_1_counter.$ip_2_counter.$ip_3_counter.*'";  								} @@ -1691,14 +1700,14 @@ class acp_attachments  			{  				// Update log  				$log_entry = ($ip_exclude) ? 'LOG_DOWNLOAD_EXCLUDE_IP' : 'LOG_DOWNLOAD_IP'; -				add_log('admin', $log_entry, $ip_list_log); +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log_entry, false, array($ip_list_log));  			}  			trigger_error($user->lang['SECURE_DOWNLOAD_UPDATE_SUCCESS'] . adm_back_link($this->u_action));  		}  		else if (isset($_POST['unsecuresubmit']))  		{ -			$unip_sql = request_var('unip', array(0)); +			$unip_sql = $request->variable('unip', array(0));  			if (sizeof($unip_sql))  			{ @@ -1720,7 +1729,7 @@ class acp_attachments  					WHERE ' . $db->sql_in_set('site_id', $unip_sql);  				$db->sql_query($sql); -				add_log('admin', 'LOG_DOWNLOAD_REMOVE_IP', $l_unip_list); +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DOWNLOAD_REMOVE_IP', false, array($l_unip_list));  			}  			trigger_error($user->lang['SECURE_DOWNLOAD_UPDATE_SUCCESS'] . adm_back_link($this->u_action)); diff --git a/phpBB/includes/acp/acp_ban.php b/phpBB/includes/acp/acp_ban.php index 286bc92813..5aed78be08 100644 --- a/phpBB/includes/acp/acp_ban.php +++ b/phpBB/includes/acp/acp_ban.php @@ -195,7 +195,6 @@ class acp_ban  			case 'user':  				$field = 'username'; -				$l_ban_cell = $user->lang['USERNAME'];  				$sql = 'SELECT b.*, u.user_id, u.username, u.username_clean  					FROM ' . BANLIST_TABLE . ' b, ' . USERS_TABLE . ' u @@ -208,7 +207,6 @@ class acp_ban  			case 'ip':  				$field = 'ban_ip'; -				$l_ban_cell = $user->lang['IP_HOSTNAME'];  				$sql = 'SELECT *  					FROM ' . BANLIST_TABLE . ' @@ -221,7 +219,6 @@ class acp_ban  			case 'email':  				$field = 'ban_email'; -				$l_ban_cell = $user->lang['EMAIL_ADDRESS'];  				$sql = 'SELECT *  					FROM ' . BANLIST_TABLE . ' diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index c98be241e9..f958ae93c7 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -25,14 +25,14 @@ class acp_bbcodes  	function main($id, $mode)  	{ -		global $db, $user, $auth, $template, $cache, $request, $phpbb_dispatcher; -		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; +		global $db, $user, $template, $cache, $request, $phpbb_dispatcher, $phpbb_container; +		global $phpbb_log;  		$user->add_lang('acp/posting');  		// Set up general vars -		$action	= request_var('action', ''); -		$bbcode_id = request_var('bbcode', 0); +		$action	= $request->variable('action', ''); +		$bbcode_id = $request->variable('bbcode', 0);  		$submit = $request->is_set_post('submit');  		$this->tpl_name = 'acp_bbcodes'; @@ -89,11 +89,11 @@ class acp_bbcodes  			// No break here  			case 'create': -				$display_on_posting = request_var('display_on_posting', 0); +				$display_on_posting = $request->variable('display_on_posting', 0); -				$bbcode_match = request_var('bbcode_match', ''); -				$bbcode_tpl = htmlspecialchars_decode(utf8_normalize_nfc(request_var('bbcode_tpl', '', true))); -				$bbcode_helpline = utf8_normalize_nfc(request_var('bbcode_helpline', '', true)); +				$bbcode_match = $request->variable('bbcode_match', ''); +				$bbcode_tpl = htmlspecialchars_decode($request->variable('bbcode_tpl', '', true)); +				$bbcode_helpline = $request->variable('bbcode_helpline', '', true);  			break;  		} @@ -275,6 +275,7 @@ class acp_bbcodes  						$db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary));  						$cache->destroy('sql', BBCODES_TABLE); +						$phpbb_container->get('text_formatter.cache')->invalidate();  						$lang = 'BBCODE_ADDED';  						$log_action = 'LOG_BBCODE_ADD'; @@ -286,12 +287,13 @@ class acp_bbcodes  							WHERE bbcode_id = ' . $bbcode_id;  						$db->sql_query($sql);  						$cache->destroy('sql', BBCODES_TABLE); +						$phpbb_container->get('text_formatter.cache')->invalidate();  						$lang = 'BBCODE_EDITED';  						$log_action = 'LOG_BBCODE_EDIT';  					} -					add_log('admin', $log_action, $data['bbcode_tag']); +					$phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log_action, false, array($data['bbcode_tag']));  					trigger_error($user->lang[$lang] . adm_back_link($this->u_action));  				} @@ -325,7 +327,8 @@ class acp_bbcodes  					{  						$db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id");  						$cache->destroy('sql', BBCODES_TABLE); -						add_log('admin', 'LOG_BBCODE_DELETE', $row['bbcode_tag']); +						$phpbb_container->get('text_formatter.cache')->invalidate(); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_BBCODE_DELETE', false, array($row['bbcode_tag']));  						if ($request->is_ajax())  						{ @@ -419,8 +422,6 @@ class acp_bbcodes  		// Allow unicode characters for URL|LOCAL_URL|RELATIVE_URL|INTTEXT tokens  		$utf8 = preg_match('/(URL|LOCAL_URL|RELATIVE_URL|INTTEXT)/', $bbcode_match); -		$utf8_pcre_properties = phpbb_pcre_utf8_support(); -  		$fp_match = preg_quote($bbcode_match, '!');  		$fp_replace = preg_replace('#^\[(.*?)\]#', '[$1:$uid]', $bbcode_match);  		$fp_replace = preg_replace('#\[/(.*?)\]$#', '[/$1:$uid]', $fp_replace); @@ -451,7 +452,7 @@ class acp_bbcodes  				'!([a-zA-Z0-9-+.,_ ]+)!'	 =>	"$1"  			),  			'INTTEXT' => array( -				($utf8_pcre_properties) ? '!([\p{L}\p{N}\-+,_. ]+)!u' : '!([a-zA-Z0-9\-+,_. ]+)!u'	 =>	"$1" +				'!([\p{L}\p{N}\-+,_. ]+)!u'	 =>	"$1"  			),  			'IDENTIFIER' => array(  				'!([a-zA-Z0-9-_]+)!'	 =>	"$1" @@ -471,7 +472,7 @@ class acp_bbcodes  			'EMAIL' => '(' . get_preg_expression('email') . ')',  			'TEXT' => '(.*?)',  			'SIMPLETEXT' => '([a-zA-Z0-9-+.,_ ]+)', -			'INTTEXT' => ($utf8_pcre_properties) ? '([\p{L}\p{N}\-+,_. ]+)' : '([a-zA-Z0-9\-+,_. ]+)', +			'INTTEXT' => '([\p{L}\p{N}\-+,_. ]+)',  			'IDENTIFIER' => '([a-zA-Z0-9-_]+)',  			'COLOR' => '([a-zA-Z]+|#[0-9abcdefABCDEF]+)',  			'NUMBER' => '([0-9]+)', @@ -479,7 +480,7 @@ class acp_bbcodes  		$pad = 0;  		$modifiers = 'i'; -		$modifiers .= ($utf8 && $utf8_pcre_properties) ? 'u' : ''; +		$modifiers .= ($utf8) ? 'u' : '';  		if (preg_match_all('/\{(' . implode('|', array_keys($tokens)) . ')[0-9]*\}/i', $bbcode_match, $m))  		{ @@ -494,7 +495,9 @@ class acp_bbcodes  				if (preg_match_all('/(?<!\\\\)\$([0-9]+)/', $replace, $repad))  				{  					$repad = $pad + sizeof(array_unique($repad[0])); -					$replace = preg_replace('/(?<!\\\\)\$([0-9]+)/e', "'\${' . (\$1 + \$pad) . '}'", $replace); +					$replace = preg_replace_callback('/(?<!\\\\)\$([0-9]+)/', function ($match) use ($pad) { +						return '${' . ($match[1] + $pad) . '}'; +					}, $replace);  					$pad = $repad;  				} @@ -559,10 +562,18 @@ class acp_bbcodes  			trigger_error($user->lang['BBCODE_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);  		} -		$fp_match = preg_replace('#\[/?' . $bbcode_search . '#ie', "strtolower('\$0')", $fp_match); -		$fp_replace = preg_replace('#\[/?' . $bbcode_search . '#ie', "strtolower('\$0')", $fp_replace); -		$sp_match = preg_replace('#\[/?' . $bbcode_search . '#ie', "strtolower('\$0')", $sp_match); -		$sp_replace = preg_replace('#\[/?' . $bbcode_search . '#ie', "strtolower('\$0')", $sp_replace); +		$fp_match = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) { +			return strtolower($match[0]); +		}, $fp_match); +		$fp_replace = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) { +			return strtolower($match[0]); +		}, $fp_replace); +		$sp_match = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) { +			return strtolower($match[0]); +		}, $sp_match); +		$sp_replace = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) { +			return strtolower($match[0]); +		}, $sp_replace);  		return array(  			'bbcode_tag'				=> $bbcode_tag, diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 5c3c7f30aa..77e6133fe6 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -30,13 +30,12 @@ class acp_board  	function main($id, $mode)  	{ -		global $db, $user, $auth, $template; -		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; -		global $cache, $phpbb_container, $phpbb_dispatcher; +		global $user, $template, $request; +		global $config, $phpbb_root_path, $phpEx; +		global $cache, $phpbb_container, $phpbb_dispatcher, $phpbb_log;  		$user->add_lang('acp/board'); -		$action	= request_var('action', '');  		$submit = (isset($_POST['submit']) || isset($_POST['allow_quick_reply_enable'])) ? true : false;  		$form_key = 'acp_board'; @@ -94,6 +93,7 @@ class acp_board  						'allow_bbcode'			=> array('lang' => 'ALLOW_BBCODE',			'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => false),  						'allow_smilies'			=> array('lang' => 'ALLOW_SMILIES',			'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => false),  						'allow_sig'				=> array('lang' => 'ALLOW_SIG',				'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => false), +						'allow_board_notifications'		=> array('lang' => 'ALLOW_BOARD_NOTIFICATIONS',		'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => false),  						'allow_nocensors'		=> array('lang' => 'ALLOW_NO_CENSORS',		'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true),  						'allow_bookmarks'		=> array('lang' => 'ALLOW_BOOKMARKS',		'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true),  						'allow_birthdays'		=> array('lang' => 'ALLOW_BIRTHDAYS',		'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true), @@ -115,6 +115,7 @@ class acp_board  			break;  			case 'avatar': +				/* @var $phpbb_avatar_manager \phpbb\avatar\manager */  				$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');  				$avatar_drivers = $phpbb_avatar_manager->get_all_drivers(); @@ -195,6 +196,7 @@ class acp_board  						'allow_post_flash'		=> array('lang' => 'ALLOW_POST_FLASH',		'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true),  						'allow_smilies'			=> array('lang' => 'ALLOW_SMILIES',			'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => false),  						'allow_post_links'		=> array('lang' => 'ALLOW_POST_LINKS',		'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true), +						'allowed_schemes_links'	=> array('lang' => 'ALLOWED_SCHEMES_LINKS',	'validate' => 'string',	'type' => 'text:0:255', 'explain' => true),  						'allow_nocensors'		=> array('lang' => 'ALLOW_NO_CENSORS',		'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true),  						'allow_bookmarks'		=> array('lang' => 'ALLOW_BOOKMARKS',		'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true),  						'enable_post_confirm'	=> array('lang' => 'VISUAL_CONFIRM_POST',	'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true), @@ -321,7 +323,8 @@ class acp_board  						'cookie_domain'	=> array('lang' => 'COOKIE_DOMAIN',	'validate' => 'string',	'type' => 'text::255', 'explain' => true),  						'cookie_name'	=> array('lang' => 'COOKIE_NAME',	'validate' => 'string',	'type' => 'text::16', 'explain' => true),  						'cookie_path'	=> array('lang'	=> 'COOKIE_PATH',	'validate' => 'string',	'type' => 'text::255', 'explain' => true), -						'cookie_secure'	=> array('lang' => 'COOKIE_SECURE',	'validate' => 'bool',	'type' => 'radio:disabled_enabled', 'explain' => true), +						'cookie_secure'	=> array('lang' => 'COOKIE_SECURE',	'validate' => 'bool',	'type' => 'radio:enabled_disabled', 'explain' => true), +						'cookie_notice'	=> array('lang' => 'COOKIE_NOTICE',	'validate' => 'bool',	'type' => 'radio:enabled_disabled', 'explain' => true),  					)  				);  			break; @@ -350,6 +353,7 @@ class acp_board  						'load_moderators'		=> array('lang' => 'YES_MODERATORS',		'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => false),  						'load_jumpbox'			=> array('lang' => 'YES_JUMPBOX',			'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => false),  						'load_user_activity'	=> array('lang' => 'LOAD_USER_ACTIVITY',	'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true), +						'load_user_activity_limit'		=> array('lang' => 'LOAD_USER_ACTIVITY_LIMIT',		'validate' => 'int:0:99999999',	'type' => 'number:0:99999999', 'explain' => true),  						'load_tplcompile'		=> array('lang' => 'RECOMPILE_STYLES',		'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true),  						'allow_cdn'				=> array('lang' => 'ALLOW_CDN',				'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true),  						'allow_live_searches'	=> array('lang' => 'ALLOW_LIVE_SEARCHES',	'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true), @@ -414,6 +418,7 @@ class acp_board  						'browser_check'			=> array('lang' => 'BROWSER_VALID',			'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true),  						'forwarded_for_check'	=> array('lang' => 'FORWARDED_FOR_VALID',	'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true),  						'referer_validation'	=> array('lang' => 'REFERRER_VALID',		'validate' => 'int:0:3','type' => 'custom', 'method' => 'select_ref_check', 'explain' => true), +						'remote_upload_verify'	=> array('lang' => 'UPLOAD_CERT_VALID',	'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true),  						'check_dnsbl'			=> array('lang' => 'CHECK_DNSBL',			'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true),  						'email_check_mx'		=> array('lang' => 'EMAIL_CHECK_MX',		'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true),  						'max_pass_chars'		=> array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,), @@ -446,6 +451,7 @@ class acp_board  						'board_email'			=> array('lang' => 'ADMIN_EMAIL',			'validate' => 'email',	'type' => 'email:25:100', 'explain' => true),  						'board_email_sig'		=> array('lang' => 'EMAIL_SIG',				'validate' => 'string',	'type' => 'textarea:5:30', 'explain' => true),  						'board_hide_emails'		=> array('lang' => 'BOARD_HIDE_EMAILS',		'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true), +						'send_test_email'		=> array('lang' => 'SEND_TEST_EMAIL',		'validate' => 'bool',	'type' => 'custom', 'method' => 'send_test_email', 'explain' => true),  						'legend2'				=> 'SMTP_SETTINGS',  						'smtp_delivery'			=> array('lang' => 'USE_SMTP',				'validate' => 'bool',	'type' => 'radio:yes_no', 'explain' => true), @@ -486,7 +492,7 @@ class acp_board  		}  		$this->new_config = clone $config; -		$cfg_array = (isset($_REQUEST['config'])) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config; +		$cfg_array = (isset($_REQUEST['config'])) ? $request->variable('config', array('' => ''), true) : $this->new_config;  		$error = array();  		// We validate the complete config if wished @@ -542,15 +548,21 @@ class acp_board  					// send the password to the output  					continue;  				} -				set_config($config_name, $config_value); +				$config->set($config_name, $config_value);  				if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable']))  				{ -					enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', log(FORUM_FLAG_QUICK_REPLY, 2)); +					enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', round(log(FORUM_FLAG_QUICK_REPLY, 2)));  				}  			}  		} +		// Invalidate the text_formatter cache when posting options are changed +		if ($mode == 'post' && $submit) +		{ +			$phpbb_container->get('text_formatter.cache')->invalidate(); +		} +  		// Store news and exclude ids  		if ($mode == 'feed' && $submit)  		{ @@ -564,6 +576,7 @@ class acp_board  		if ($mode == 'auth')  		{  			// Retrieve a list of auth plugins and check their config values +			/* @var $auth_providers \phpbb\auth\provider_collection */  			$auth_providers = $phpbb_container->get('auth.provider_collection');  			$updated_auth_settings = false; @@ -578,7 +591,7 @@ class acp_board  					{  						if (!isset($config[$field]))  						{ -							set_config($field, ''); +							$config->set($field, '');  						}  						if (!isset($cfg_array[$field]) || strpos($field, 'legend') !== false) @@ -601,7 +614,7 @@ class acp_board  						if ($submit)  						{  							$updated_auth_settings = true; -							set_config($field, $config_value); +							$config->set($field, $config_value);  						}  					}  				} @@ -618,11 +631,11 @@ class acp_board  					{  						foreach ($old_auth_config as $config_name => $config_value)  						{ -							set_config($config_name, $config_value); +							$config->set($config_name, $config_value);  						}  						trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING);  					} -					set_config('auth_method', basename($cfg_array['auth_method'])); +					$config->set('auth_method', basename($cfg_array['auth_method']));  				}  				else  				{ @@ -631,9 +644,33 @@ class acp_board  			}  		} +		if ($mode == 'email' && $request->is_set_post('send_test_email')) +		{ +			if ($config['email_enable']) +			{ +				include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + +				$messenger = new messenger(false); +				$messenger->template('test'); +				$messenger->set_addresses($user->data); +				$messenger->anti_abuse_headers($config, $user); +				$messenger->assign_vars(array( +					'USERNAME'	=> htmlspecialchars_decode($user->data['username']), +				)); +				$messenger->send(NOTIFY_EMAIL); + +				trigger_error($user->lang('TEST_EMAIL_SENT') . adm_back_link($this->u_action)); +			} +			else +			{ +				$user->add_lang('memberlist'); +				trigger_error($user->lang('EMAIL_DISABLED') . adm_back_link($this->u_action), E_USER_WARNING); +			} +		} +  		if ($submit)  		{ -			add_log('admin', 'LOG_CONFIG_' . strtoupper($mode)); +			$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_' . strtoupper($mode));  			$message = $user->lang('CONFIG_UPDATED');  			$message_type = E_USER_NOTICE; @@ -738,10 +775,11 @@ class acp_board  	*/  	function select_auth_method($selected_method, $key = '')  	{ -		global $phpbb_root_path, $phpEx, $phpbb_container; +		global $phpbb_container; -		$auth_plugins = array(); +		/* @var $auth_providers \phpbb\auth\provider_collection */  		$auth_providers = $phpbb_container->get('auth.provider_collection'); +		$auth_plugins = array();  		foreach ($auth_providers as $key => $value)  		{ @@ -917,8 +955,6 @@ class acp_board  	*/  	function board_disable($value, $key)  	{ -		global $user; -  		$radio_ary = array(1 => 'YES', 0 => 'NO');  		return h_radio('config[board_disable]', $radio_ary, $value) . '<br /><input id="' . $key . '" type="text" name="config[board_disable_msg]" maxlength="255" size="40" value="' . $this->new_config['board_disable_msg'] . '" />'; @@ -1028,8 +1064,6 @@ class acp_board  	*/  	function select_news_forums($value, $key)  	{ -		global $user, $config; -  		$forum_list = make_forum_select(false, false, true, true, true, false, true);  		// Build forum options @@ -1047,8 +1081,6 @@ class acp_board  	function select_exclude_forums($value, $key)  	{ -		global $user, $config; -  		$forum_list = make_forum_select(false, false, true, true, true, false, true);  		// Build forum options @@ -1066,10 +1098,10 @@ class acp_board  	function store_feed_forums($option, $key)  	{ -		global $db, $cache; +		global $db, $cache, $request;  		// Get key -		$values = request_var($key, array(0 => 0)); +		$values = $request->variable($key, array(0 => 0));  		// Empty option bit for all forums  		$sql = 'UPDATE ' . FORUMS_TABLE . ' @@ -1104,7 +1136,7 @@ class acp_board  	*/  	function enable_mod_rewrite($value, $key)  	{ -		global $user, $config; +		global $user;  		// Determine whether mod_rewrite is enabled on the server  		// NOTE: This only works on Apache servers on which PHP is NOT @@ -1138,4 +1170,11 @@ class acp_board  		return h_radio($field_name, array(1 => 'YES', 0 => 'NO'), $value) .  			($message !== false ? '<br /><span>' . $user->lang($message) . '</span>' : '');  	} + +	function send_test_email($value, $key) +	{ +		global $user; + +		return '<input class="button2" type="submit" id="' . $key . '" name="' . $key . '" value="' . $user->lang['SEND_TEST_EMAIL'] . '" />'; +	}  } diff --git a/phpBB/includes/acp/acp_bots.php b/phpBB/includes/acp/acp_bots.php index 2188b90729..e89b16663c 100644 --- a/phpBB/includes/acp/acp_bots.php +++ b/phpBB/includes/acp/acp_bots.php @@ -25,13 +25,13 @@ class acp_bots  	function main($id, $mode)  	{ -		global $config, $db, $user, $auth, $template, $cache, $request; -		global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; +		global $config, $db, $user, $template, $cache, $request, $phpbb_log; +		global $phpbb_root_path, $phpEx; -		$action = request_var('action', ''); +		$action = $request->variable('action', '');  		$submit = (isset($_POST['submit'])) ? true : false; -		$mark	= request_var('mark', array(0)); -		$bot_id	= request_var('id', 0); +		$mark	= $request->variable('mark', array(0)); +		$bot_id	= $request->variable('id', 0);  		if (isset($_POST['add']))  		{ @@ -124,7 +124,7 @@ class acp_bots  						$cache->destroy('_bots'); -						add_log('admin', 'LOG_BOT_DELETE', implode(', ', $bot_name_ary)); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_BOT_DELETE', false, array(implode(', ', $bot_name_ary)));  						trigger_error($user->lang['BOT_DELETED'] . adm_back_link($this->u_action));  					}  					else @@ -148,12 +148,12 @@ class acp_bots  				}  				$bot_row = array( -					'bot_name'		=> utf8_normalize_nfc(request_var('bot_name', '', true)), -					'bot_agent'		=> request_var('bot_agent', ''), -					'bot_ip'		=> request_var('bot_ip', ''), -					'bot_active'	=> request_var('bot_active', true), -					'bot_lang'		=> request_var('bot_lang', $config['default_lang']), -					'bot_style'		=> request_var('bot_style' , $config['default_style']), +					'bot_name'		=> $request->variable('bot_name', '', true), +					'bot_agent'		=> $request->variable('bot_agent', ''), +					'bot_ip'		=> $request->variable('bot_ip', ''), +					'bot_active'	=> $request->variable('bot_active', true), +					'bot_lang'		=> $request->variable('bot_lang', $config['default_lang']), +					'bot_style'		=> $request->variable('bot_style' , $config['default_style']),  				);  				if ($submit) @@ -296,7 +296,7 @@ class acp_bots  						$cache->destroy('_bots'); -						add_log('admin', 'LOG_BOT_' . $log, $bot_row['bot_name']); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_BOT_' . $log, false, array($bot_row['bot_name']));  						trigger_error($user->lang['BOT_' . $log] . adm_back_link($this->u_action));  					} diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index 92d5e1dda6..b49c5ca0d3 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -25,17 +25,18 @@ class acp_captcha  	function main($id, $mode)  	{ -		global $request, $user, $auth, $template; -		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container; +		global $user, $template, $phpbb_log, $request; +		global $config, $phpbb_container;  		$user->add_lang('acp/board'); +		/* @var $factory \phpbb\captcha\factory */  		$factory = $phpbb_container->get('captcha.factory');  		$captchas = $factory->get_captcha_types(); -		$selected = request_var('select_captcha', $config['captcha_plugin']); +		$selected = $request->variable('select_captcha', $config['captcha_plugin']);  		$selected = (isset($captchas['available'][$selected]) || isset($captchas['unavailable'][$selected])) ? $selected : $config['captcha_plugin']; -		$configure = request_var('configure', false); +		$configure = $request->variable('configure', false);  		// Oh, they are just here for the view  		if (isset($_GET['captcha_demo'])) @@ -89,7 +90,7 @@ class acp_captcha  			$form_key = 'acp_captcha';  			add_form_key($form_key); -			$submit = request_var('main_submit', false); +			$submit = $request->variable('main_submit', false);  			$error = $cfg_array = array();  			if ($submit) @@ -125,11 +126,11 @@ class acp_captcha  						$old_captcha = $factory->get_instance($config['captcha_plugin']);  						$old_captcha->uninstall(); -						set_config('captcha_plugin', $selected); +						$config->set('captcha_plugin', $selected);  						$new_captcha = $factory->get_instance($config['captcha_plugin']);  						$new_captcha->install(); -						add_log('admin', 'LOG_CONFIG_VISUAL'); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_VISUAL');  					}  					else  					{ @@ -157,7 +158,7 @@ class acp_captcha  				foreach ($config_vars as $config_var => $options)  				{ -					$template->assign_var($options['tpl'], (isset($_POST[$config_var])) ? request_var($config_var, $options['default']) : $config[$config_var]) ; +					$template->assign_var($options['tpl'], (isset($_POST[$config_var])) ? $request->variable($config_var, $options['default']) : $config[$config_var]) ;  				}  				$template->assign_vars(array( @@ -177,7 +178,7 @@ class acp_captcha  	*/  	function deliver_demo($selected)  	{ -		global $db, $user, $config, $phpbb_container; +		global $phpbb_container;  		$captcha = $phpbb_container->get('captcha.factory')->get_instance($selected);  		$captcha->init(CONFIRM_REG); diff --git a/phpBB/includes/acp/acp_contact.php b/phpBB/includes/acp/acp_contact.php index 4e46df21e0..1a4d5b95a3 100644 --- a/phpBB/includes/acp/acp_contact.php +++ b/phpBB/includes/acp/acp_contact.php @@ -48,6 +48,7 @@ class acp_contact  			include($phpbb_root_path . 'includes/message_parser.' . $phpEx);  		} +		/* @var $config_text \phpbb\config\db_text */  		$config_text = $phpbb_container->get('config_text');  		$contact_admin_data			= $config_text->get_array(array( @@ -104,6 +105,9 @@ class acp_contact  		$contact_admin_edit = generate_text_for_edit($contact_admin_info, $contact_admin_info_uid, $contact_admin_info_flags); +		/** @var \phpbb\controller\helper $controller_helper */ +		$controller_helper = $phpbb_container->get('controller.helper'); +  		$template->assign_vars(array(  			'ERRORS'			=> $error,  			'CONTACT_ENABLED'	=> $config['contact_admin_form_enable'], @@ -115,7 +119,7 @@ class acp_contact  			'S_SMILIES_DISABLE_CHECKED'		=> !$contact_admin_edit['allow_smilies'],  			'S_MAGIC_URL_DISABLE_CHECKED'	=> !$contact_admin_edit['allow_urls'], -			'BBCODE_STATUS'			=> $user->lang('BBCODE_IS_ON', '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'), +			'BBCODE_STATUS'			=> $user->lang('BBCODE_IS_ON', '<a href="' . $controller_helper->route('phpbb_help_bbcode_controller') . '">', '</a>'),  			'SMILIES_STATUS'		=> $user->lang['SMILIES_ARE_ON'],  			'IMG_STATUS'			=> $user->lang['IMAGES_ARE_ON'],  			'FLASH_STATUS'			=> $user->lang['FLASH_IS_ON'], diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index dd0599e06a..00c7ef40c0 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -26,18 +26,17 @@ class acp_database  	function main($id, $mode)  	{ -		global $cache, $db, $user, $auth, $template, $table_prefix; -		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; +		global $cache, $db, $user, $template, $table_prefix, $request; +		global $phpbb_root_path, $phpbb_container, $phpbb_log; -		$this->db_tools = new \phpbb\db\tools($db); +		$this->db_tools = $phpbb_container->get('dbal.tools');  		$user->add_lang('acp/database');  		$this->tpl_name = 'acp_database';  		$this->page_title = 'ACP_DATABASE'; -		$action	= request_var('action', ''); -		$submit = (isset($_POST['submit'])) ? true : false; +		$action	= $request->variable('action', '');  		$form_key = 'acp_database';  		add_form_key($form_key); @@ -55,10 +54,10 @@ class acp_database  				switch ($action)  				{  					case 'download': -						$type	= request_var('type', ''); -						$table	= array_intersect($this->db_tools->sql_list_tables(), request_var('table', array(''))); -						$format	= request_var('method', ''); -						$where	= request_var('where', ''); +						$type	= $request->variable('type', ''); +						$table	= array_intersect($this->db_tools->sql_list_tables(), $request->variable('table', array(''))); +						$format	= $request->variable('method', ''); +						$where	= $request->variable('where', '');  						if (!sizeof($table))  						{ @@ -98,36 +97,9 @@ class acp_database  						$time = time();  						$filename = 'backup_' . $time . '_' . unique_id(); -						switch ($db->get_sql_layer()) -						{ -							case 'mysqli': -							case 'mysql4': -							case 'mysql': -								$extractor = new mysql_extractor($format, $filename, $time, $download, $store); -							break; - -							case 'sqlite': -								$extractor = new sqlite_extractor($format, $filename, $time, $download, $store); -							break; -							case 'sqlite3': -								$extractor = new sqlite3_extractor($format, $filename, $time, $download, $store); -							break; - -							case 'postgres': -								$extractor = new postgres_extractor($format, $filename, $time, $download, $store); -							break; - -							case 'oracle': -								$extractor = new oracle_extractor($format, $filename, $time, $download, $store); -							break; - -							case 'mssql': -							case 'mssql_odbc': -							case 'mssqlnative': -								$extractor = new mssql_extractor($format, $filename, $time, $download, $store); -							break; -						} +						$extractor = $phpbb_container->get('dbal.extractor'); +						$extractor->init_extractor($format, $filename, $time, $download, $store);  						$extractor->write_start($table_prefix); @@ -143,12 +115,10 @@ class acp_database  								// We might wanna empty out all that junk :D  								switch ($db->get_sql_layer())  								{ -									case 'sqlite':  									case 'sqlite3':  										$extractor->flush('DELETE FROM ' . $table_name . ";\n");  									break; -									case 'mssql':  									case 'mssql_odbc':  									case 'mssqlnative':  										$extractor->flush('TRUNCATE TABLE ' . $table_name . "GO\n"); @@ -173,7 +143,7 @@ class acp_database  						$extractor->write_end(); -						add_log('admin', 'LOG_DB_BACKUP'); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DB_BACKUP');  						if ($download == true)  						{ @@ -229,9 +199,9 @@ class acp_database  				switch ($action)  				{  					case 'submit': -						$delete = request_var('delete', ''); -						$file = request_var('file', ''); -						$download = request_var('download', ''); +						$delete = $request->variable('delete', ''); +						$file = $request->variable('file', ''); +						$download = $request->variable('download', '');  						if (!preg_match('#^backup_\d{10,}_[a-z\d]{16}\.(sql(?:\.(?:gz|bz2))?)$#', $file, $matches))  						{ @@ -250,7 +220,7 @@ class acp_database  							if (confirm_box(true))  							{  								unlink($file_name); -								add_log('admin', 'LOG_DB_DELETE'); +								$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DB_DELETE');  								trigger_error($user->lang['BACKUP_DELETE'] . adm_back_link($this->u_action));  							}  							else @@ -333,7 +303,6 @@ class acp_database  								case 'mysql':  								case 'mysql4':  								case 'mysqli': -								case 'sqlite':  								case 'sqlite3':  									while (($sql = $fgetd($fp, ";\n", $read, $seek, $eof)) !== false)  									{ @@ -388,7 +357,6 @@ class acp_database  									}  								break; -								case 'mssql':  								case 'mssql_odbc':  								case 'mssqlnative':  									while (($sql = $fgetd($fp, "GO\n", $read, $seek, $eof)) !== false) @@ -403,7 +371,7 @@ class acp_database  							// Purge the cache due to updated data  							$cache->purge(); -							add_log('admin', 'LOG_DB_RESTORE'); +							$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DB_RESTORE');  							trigger_error($user->lang['RESTORE_SUCCESS'] . adm_back_link($this->u_action));  							break;  						} @@ -469,1637 +437,6 @@ class acp_database  	}  } -class base_extractor -{ -	var $fh; -	var $fp; -	var $write; -	var $close; -	var $store; -	var $download; -	var $time; -	var $format; -	var $run_comp = false; - -	function base_extractor($format, $filename, $time, $download = false, $store = false) -	{ -		global $request; - -		$this->download = $download; -		$this->store = $store; -		$this->time = $time; -		$this->format = $format; - -		switch ($format) -		{ -			case 'text': -				$ext = '.sql'; -				$open = 'fopen'; -				$this->write = 'fwrite'; -				$this->close = 'fclose'; -				$mimetype = 'text/x-sql'; -			break; -			case 'bzip2': -				$ext = '.sql.bz2'; -				$open = 'bzopen'; -				$this->write = 'bzwrite'; -				$this->close = 'bzclose'; -				$mimetype = 'application/x-bzip2'; -			break; -			case 'gzip': -				$ext = '.sql.gz'; -				$open = 'gzopen'; -				$this->write = 'gzwrite'; -				$this->close = 'gzclose'; -				$mimetype = 'application/x-gzip'; -			break; -		} - -		if ($download == true) -		{ -			$name = $filename . $ext; -			header('Cache-Control: private, no-cache'); -			header("Content-Type: $mimetype; name=\"$name\""); -			header("Content-disposition: attachment; filename=$name"); - -			switch ($format) -			{ -				case 'bzip2': -					ob_start(); -				break; - -				case 'gzip': -					if (strpos($request->header('Accept-Encoding'), 'gzip') !== false && strpos(strtolower($request->header('User-Agent')), 'msie') === false) -					{ -						ob_start('ob_gzhandler'); -					} -					else -					{ -						$this->run_comp = true; -					} -				break; -			} -		} - -		if ($store == true) -		{ -			global $phpbb_root_path; -			$file = $phpbb_root_path . 'store/' . $filename . $ext; - -			$this->fp = $open($file, 'w'); - -			if (!$this->fp) -			{ -				trigger_error('FILE_WRITE_FAIL', E_USER_ERROR); -			} -		} -	} - -	function write_end() -	{ -		static $close; - -		if ($this->store) -		{ -			if ($close === null) -			{ -				$close = $this->close; -			} -			$close($this->fp); -		} - -		// bzip2 must be written all the way at the end -		if ($this->download && $this->format === 'bzip2') -		{ -			$c = ob_get_clean(); -			echo bzcompress($c); -		} -	} - -	function flush($data) -	{ -		static $write; -		if ($this->store === true) -		{ -			if ($write === null) -			{ -				$write = $this->write; -			} -			$write($this->fp, $data); -		} - -		if ($this->download === true) -		{ -			if ($this->format === 'bzip2' || $this->format === 'text' || ($this->format === 'gzip' && !$this->run_comp)) -			{ -				echo $data; -			} - -			// we can write the gzip data as soon as we get it -			if ($this->format === 'gzip') -			{ -				if ($this->run_comp) -				{ -					echo gzencode($data); -				} -				else -				{ -					ob_flush(); -					flush(); -				} -			} -		} -	} -} - -class mysql_extractor extends base_extractor -{ -	function write_start($table_prefix) -	{ -		$sql_data = "#\n"; -		$sql_data .= "# phpBB Backup Script\n"; -		$sql_data .= "# Dump of tables for $table_prefix\n"; -		$sql_data .= "# DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; -		$sql_data .= "#\n"; -		$this->flush($sql_data); -	} - -	function write_table($table_name) -	{ -		global $db; -		static $new_extract; - -		if ($new_extract === null) -		{ -			if ($db->get_sql_layer() === 'mysqli' || version_compare($db->sql_server_info(true), '3.23.20', '>=')) -			{ -				$new_extract = true; -			} -			else -			{ -				$new_extract = false; -			} -		} - -		if ($new_extract) -		{ -			$this->new_write_table($table_name); -		} -		else -		{ -			$this->old_write_table($table_name); -		} -	} - -	function write_data($table_name) -	{ -		global $db; -		if ($db->get_sql_layer() === 'mysqli') -		{ -			$this->write_data_mysqli($table_name); -		} -		else -		{ -			$this->write_data_mysql($table_name); -		} -	} - -	function write_data_mysqli($table_name) -	{ -		global $db; -		$sql = "SELECT * -			FROM $table_name"; -		$result = mysqli_query($db->get_db_connect_id(), $sql, MYSQLI_USE_RESULT); -		if ($result != false) -		{ -			$fields_cnt = mysqli_num_fields($result); - -			// Get field information -			$field = mysqli_fetch_fields($result); -			$field_set = array(); - -			for ($j = 0; $j < $fields_cnt; $j++) -			{ -				$field_set[] = $field[$j]->name; -			} - -			$search			= array("\\", "'", "\x00", "\x0a", "\x0d", "\x1a", '"'); -			$replace		= array("\\\\", "\\'", '\0', '\n', '\r', '\Z', '\\"'); -			$fields			= implode(', ', $field_set); -			$sql_data		= 'INSERT INTO ' . $table_name . ' (' . $fields . ') VALUES '; -			$first_set		= true; -			$query_len		= 0; -			$max_len		= get_usable_memory(); - -			while ($row = mysqli_fetch_row($result)) -			{ -				$values	= array(); -				if ($first_set) -				{ -					$query = $sql_data . '('; -				} -				else -				{ -					$query  .= ',('; -				} - -				for ($j = 0; $j < $fields_cnt; $j++) -				{ -					if (!isset($row[$j]) || is_null($row[$j])) -					{ -						$values[$j] = 'NULL'; -					} -					else if (($field[$j]->flags & 32768) && !($field[$j]->flags & 1024)) -					{ -						$values[$j] = $row[$j]; -					} -					else -					{ -						$values[$j] = "'" . str_replace($search, $replace, $row[$j]) . "'"; -					} -				} -				$query .= implode(', ', $values) . ')'; - -				$query_len += strlen($query); -				if ($query_len > $max_len) -				{ -					$this->flush($query . ";\n\n"); -					$query = ''; -					$query_len = 0; -					$first_set = true; -				} -				else -				{ -					$first_set = false; -				} -			} -			mysqli_free_result($result); - -			// check to make sure we have nothing left to flush -			if (!$first_set && $query) -			{ -				$this->flush($query . ";\n\n"); -			} -		} -	} - -	function write_data_mysql($table_name) -	{ -		global $db; -		$sql = "SELECT * -			FROM $table_name"; -		$result = mysql_unbuffered_query($sql, $db->get_db_connect_id()); - -		if ($result != false) -		{ -			$fields_cnt = mysql_num_fields($result); - -			// Get field information -			$field = array(); -			for ($i = 0; $i < $fields_cnt; $i++) -			{ -				$field[] = mysql_fetch_field($result, $i); -			} -			$field_set = array(); - -			for ($j = 0; $j < $fields_cnt; $j++) -			{ -				$field_set[] = $field[$j]->name; -			} - -			$search			= array("\\", "'", "\x00", "\x0a", "\x0d", "\x1a", '"'); -			$replace		= array("\\\\", "\\'", '\0', '\n', '\r', '\Z', '\\"'); -			$fields			= implode(', ', $field_set); -			$sql_data		= 'INSERT INTO ' . $table_name . ' (' . $fields . ') VALUES '; -			$first_set		= true; -			$query_len		= 0; -			$max_len		= get_usable_memory(); - -			while ($row = mysql_fetch_row($result)) -			{ -				$values = array(); -				if ($first_set) -				{ -					$query = $sql_data . '('; -				} -				else -				{ -					$query  .= ',('; -				} - -				for ($j = 0; $j < $fields_cnt; $j++) -				{ -					if (!isset($row[$j]) || is_null($row[$j])) -					{ -						$values[$j] = 'NULL'; -					} -					else if ($field[$j]->numeric && ($field[$j]->type !== 'timestamp')) -					{ -						$values[$j] = $row[$j]; -					} -					else -					{ -						$values[$j] = "'" . str_replace($search, $replace, $row[$j]) . "'"; -					} -				} -				$query .= implode(', ', $values) . ')'; - -				$query_len += strlen($query); -				if ($query_len > $max_len) -				{ -					$this->flush($query . ";\n\n"); -					$query = ''; -					$query_len = 0; -					$first_set = true; -				} -				else -				{ -					$first_set = false; -				} -			} -			mysql_free_result($result); - -			// check to make sure we have nothing left to flush -			if (!$first_set && $query) -			{ -				$this->flush($query . ";\n\n"); -			} -		} -	} - -	function new_write_table($table_name) -	{ -		global $db; - -		$sql = 'SHOW CREATE TABLE ' . $table_name; -		$result = $db->sql_query($sql); -		$row = $db->sql_fetchrow($result); - -		$sql_data = '# Table: ' . $table_name . "\n"; -		$sql_data .= "DROP TABLE IF EXISTS $table_name;\n"; -		$this->flush($sql_data . $row['Create Table'] . ";\n\n"); - -		$db->sql_freeresult($result); -	} - -	function old_write_table($table_name) -	{ -		global $db; - -		$sql_data = '# Table: ' . $table_name . "\n"; -		$sql_data .= "DROP TABLE IF EXISTS $table_name;\n"; -		$sql_data .= "CREATE TABLE $table_name(\n"; -		$rows = array(); - -		$sql = "SHOW FIELDS -			FROM $table_name"; -		$result = $db->sql_query($sql); - -		while ($row = $db->sql_fetchrow($result)) -		{ -			$line = '   ' . $row['Field'] . ' ' . $row['Type']; - -			if (!is_null($row['Default'])) -			{ -				$line .= " DEFAULT '{$row['Default']}'"; -			} - -			if ($row['Null'] != 'YES') -			{ -				$line .= ' NOT NULL'; -			} - -			if ($row['Extra'] != '') -			{ -				$line .= ' ' . $row['Extra']; -			} - -			$rows[] = $line; -		} -		$db->sql_freeresult($result); - -		$sql = "SHOW KEYS -			FROM $table_name"; - -		$result = $db->sql_query($sql); - -		$index = array(); -		while ($row = $db->sql_fetchrow($result)) -		{ -			$kname = $row['Key_name']; - -			if ($kname != 'PRIMARY') -			{ -				if ($row['Non_unique'] == 0) -				{ -					$kname = "UNIQUE|$kname"; -				} -			} - -			if ($row['Sub_part']) -			{ -				$row['Column_name'] .= '(' . $row['Sub_part'] . ')'; -			} -			$index[$kname][] = $row['Column_name']; -		} -		$db->sql_freeresult($result); - -		foreach ($index as $key => $columns) -		{ -			$line = '   '; - -			if ($key == 'PRIMARY') -			{ -				$line .= 'PRIMARY KEY (' . implode(', ', $columns) . ')'; -			} -			else if (strpos($key, 'UNIQUE') === 0) -			{ -				$line .= 'UNIQUE ' . substr($key, 7) . ' (' . implode(', ', $columns) . ')'; -			} -			else if (strpos($key, 'FULLTEXT') === 0) -			{ -				$line .= 'FULLTEXT ' . substr($key, 9) . ' (' . implode(', ', $columns) . ')'; -			} -			else -			{ -				$line .= "KEY $key (" . implode(', ', $columns) . ')'; -			} - -			$rows[] = $line; -		} - -		$sql_data .= implode(",\n", $rows); -		$sql_data .= "\n);\n\n"; - -		$this->flush($sql_data); -	} -} - -class sqlite_extractor extends base_extractor -{ -	function write_start($prefix) -	{ -		$sql_data = "--\n"; -		$sql_data .= "-- phpBB Backup Script\n"; -		$sql_data .= "-- Dump of tables for $prefix\n"; -		$sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; -		$sql_data .= "--\n"; -		$sql_data .= "BEGIN TRANSACTION;\n"; -		$this->flush($sql_data); -	} - -	function write_table($table_name) -	{ -		global $db; -		$sql_data = '-- Table: ' . $table_name . "\n"; -		$sql_data .= "DROP TABLE $table_name;\n"; - -		$sql = "SELECT sql -			FROM sqlite_master -			WHERE type = 'table' -				AND name = '" . $db->sql_escape($table_name) . "' -			ORDER BY type DESC, name;"; -		$result = $db->sql_query($sql); -		$row = $db->sql_fetchrow($result); -		$db->sql_freeresult($result); - -		// Create Table -		$sql_data .= $row['sql'] . ";\n"; - -		$result = $db->sql_query("PRAGMA index_list('" . $db->sql_escape($table_name) . "');"); - -		$ar = array(); -		while ($row = $db->sql_fetchrow($result)) -		{ -			$ar[] = $row; -		} -		$db->sql_freeresult($result); - -		foreach ($ar as $value) -		{ -			if (strpos($value['name'], 'autoindex') !== false) -			{ -				continue; -			} - -			$result = $db->sql_query("PRAGMA index_info('" . $db->sql_escape($value['name']) . "');"); - -			$fields = array(); -			while ($row = $db->sql_fetchrow($result)) -			{ -				$fields[] = $row['name']; -			} -			$db->sql_freeresult($result); - -			$sql_data .= 'CREATE ' . ($value['unique'] ? 'UNIQUE ' : '') . 'INDEX ' . $value['name'] . ' on ' . $table_name . ' (' . implode(', ', $fields) . ");\n"; -		} - -		$this->flush($sql_data . "\n"); -	} - -	function write_data($table_name) -	{ -		global $db; - -		$col_types = sqlite_fetch_column_types($db->get_db_connect_id(), $table_name); - -		$sql = "SELECT * -			FROM $table_name"; -		$result = sqlite_unbuffered_query($db->get_db_connect_id(), $sql); -		$rows = sqlite_fetch_all($result, SQLITE_ASSOC); -		$sql_insert = 'INSERT INTO ' . $table_name . ' (' . implode(', ', array_keys($col_types)) . ') VALUES ('; -		foreach ($rows as $row) -		{ -			foreach ($row as $column_name => $column_data) -			{ -				if (is_null($column_data)) -				{ -					$row[$column_name] = 'NULL'; -				} -				else if ($column_data == '') -				{ -					$row[$column_name] = "''"; -				} -				else if (strpos($col_types[$column_name], 'text') !== false || strpos($col_types[$column_name], 'char') !== false || strpos($col_types[$column_name], 'blob') !== false) -				{ -					$row[$column_name] = sanitize_data_generic(str_replace("'", "''", $column_data)); -				} -			} -			$this->flush($sql_insert . implode(', ', $row) . ");\n"); -		} -	} - -	function write_end() -	{ -		$this->flush("COMMIT;\n"); -		parent::write_end(); -	} -} - -class sqlite3_extractor extends base_extractor -{ -	function write_start($prefix) -	{ -		$sql_data = "--\n"; -		$sql_data .= "-- phpBB Backup Script\n"; -		$sql_data .= "-- Dump of tables for $prefix\n"; -		$sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; -		$sql_data .= "--\n"; -		$sql_data .= "BEGIN TRANSACTION;\n"; -		$this->flush($sql_data); -	} - -	function write_table($table_name) -	{ -		global $db; -		$sql_data = '-- Table: ' . $table_name . "\n"; -		$sql_data .= "DROP TABLE $table_name;\n"; - -		$sql = "SELECT sql -			FROM sqlite_master -			WHERE type = 'table' -				AND name = '" . $db->sql_escape($table_name) . "' -			ORDER BY name ASC;"; -		$result = $db->sql_query($sql); -		$row = $db->sql_fetchrow($result); -		$db->sql_freeresult($result); - -		// Create Table -		$sql_data .= $row['sql'] . ";\n"; - -		$result = $db->sql_query("PRAGMA index_list('" . $db->sql_escape($table_name) . "');"); - -		while ($row = $db->sql_fetchrow($result)) -		{ -			if (strpos($row['name'], 'autoindex') !== false) -			{ -				continue; -			} - -			$result2 = $db->sql_query("PRAGMA index_info('" . $db->sql_escape($row['name']) . "');"); - -			$fields = array(); -			while ($row2 = $db->sql_fetchrow($result2)) -			{ -				$fields[] = $row2['name']; -			} -			$db->sql_freeresult($result2); - -			$sql_data .= 'CREATE ' . ($row['unique'] ? 'UNIQUE ' : '') . 'INDEX ' . $row['name'] . ' ON ' . $table_name . ' (' . implode(', ', $fields) . ");\n"; -		} -		$db->sql_freeresult($result); - -		$this->flush($sql_data . "\n"); -	} - -	function write_data($table_name) -	{ -		global $db; - -		$result = $db->sql_query("PRAGMA table_info('" . $db->sql_escape($table_name) . "');"); - -		$col_types = array(); -		while ($row = $db->sql_fetchrow($result)) -		{ -			$col_types[$row['name']] = $row['type']; -		} -		$db->sql_freeresult($result); - -		$sql_insert = 'INSERT INTO ' . $table_name . ' (' . implode(', ', array_keys($col_types)) . ') VALUES ('; - -		$sql = "SELECT * -			FROM $table_name"; -		$result = $db->sql_query($sql); - -		while ($row = $db->sql_fetchrow($result)) -		{ -			foreach ($row as $column_name => $column_data) -			{ -				if (is_null($column_data)) -				{ -					$row[$column_name] = 'NULL'; -				} -				else if ($column_data === '') -				{ -					$row[$column_name] = "''"; -				} -				else if (stripos($col_types[$column_name], 'text') !== false || stripos($col_types[$column_name], 'char') !== false || stripos($col_types[$column_name], 'blob') !== false) -				{ -					$row[$column_name] = sanitize_data_generic(str_replace("'", "''", $column_data)); -				} -			} -			$this->flush($sql_insert . implode(', ', $row) . ");\n"); -		} -	} - -	function write_end() -	{ -		$this->flush("COMMIT;\n"); -		parent::write_end(); -	} -} - -class postgres_extractor extends base_extractor -{ -	function write_start($prefix) -	{ -		$sql_data = "--\n"; -		$sql_data .= "-- phpBB Backup Script\n"; -		$sql_data .= "-- Dump of tables for $prefix\n"; -		$sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; -		$sql_data .= "--\n"; -		$sql_data .= "BEGIN TRANSACTION;\n"; -		$this->flush($sql_data); -	} - -	function write_table($table_name) -	{ -		global $db; -		static $domains_created = array(); - -		$sql = "SELECT a.domain_name, a.data_type, a.character_maximum_length, a.domain_default -			FROM INFORMATION_SCHEMA.domains a, INFORMATION_SCHEMA.column_domain_usage b -			WHERE a.domain_name = b.domain_name -				AND b.table_name = '{$table_name}'"; -		$result = $db->sql_query($sql); -		while ($row = $db->sql_fetchrow($result)) -		{ -			if (empty($domains_created[$row['domain_name']])) -			{ -				$domains_created[$row['domain_name']] = true; -				//$sql_data = "DROP DOMAIN {$row['domain_name']};\n"; -				$sql_data = "CREATE DOMAIN {$row['domain_name']} as {$row['data_type']}"; -				if (!empty($row['character_maximum_length'])) -				{ -					$sql_data .= '(' . $row['character_maximum_length'] . ')'; -				} -				$sql_data .= ' NOT NULL'; -				if (!empty($row['domain_default'])) -				{ -					$sql_data .= ' DEFAULT ' . $row['domain_default']; -				} -				$this->flush($sql_data . ";\n"); -			} -		} -		$db->sql_freeresult($result); - -		$sql_data = '-- Table: ' . $table_name . "\n"; -		$sql_data .= "DROP TABLE $table_name;\n"; -		// PGSQL does not "tightly" bind sequences and tables, we must guess... -		$sql = "SELECT relname -			FROM pg_class -			WHERE relkind = 'S' -				AND relname = '{$table_name}_seq'"; -		$result = $db->sql_query($sql); -		// We don't even care about storing the results. We already know the answer if we get rows back. -		if ($db->sql_fetchrow($result)) -		{ -			$sql_data .= "DROP SEQUENCE {$table_name}_seq;\n"; -			$sql_data .= "CREATE SEQUENCE {$table_name}_seq;\n"; -		} -		$db->sql_freeresult($result); - -		$field_query = "SELECT a.attnum, a.attname as field, t.typname as type, a.attlen as length, a.atttypmod as lengthvar, a.attnotnull as notnull -			FROM pg_class c, pg_attribute a, pg_type t -			WHERE c.relname = '" . $db->sql_escape($table_name) . "' -				AND a.attnum > 0 -				AND a.attrelid = c.oid -				AND a.atttypid = t.oid -			ORDER BY a.attnum"; -		$result = $db->sql_query($field_query); - -		$sql_data .= "CREATE TABLE $table_name(\n"; -		$lines = array(); -		while ($row = $db->sql_fetchrow($result)) -		{ -			// Get the data from the table -			$sql_get_default = "SELECT pg_get_expr(d.adbin, d.adrelid) as rowdefault -				FROM pg_attrdef d, pg_class c -				WHERE (c.relname = '" . $db->sql_escape($table_name) . "') -					AND (c.oid = d.adrelid) -					AND d.adnum = " . $row['attnum']; -			$def_res = $db->sql_query($sql_get_default); -			$def_row = $db->sql_fetchrow($def_res); -			$db->sql_freeresult($def_res); - -			if (empty($def_row)) -			{ -				unset($row['rowdefault']); -			} -			else -			{ -				$row['rowdefault'] = $def_row['rowdefault']; -			} - -			if ($row['type'] == 'bpchar') -			{ -				// Internally stored as bpchar, but isn't accepted in a CREATE TABLE statement. -				$row['type'] = 'char'; -			} - -			$line = '  ' . $row['field'] . ' ' . $row['type']; - -			if (strpos($row['type'], 'char') !== false) -			{ -				if ($row['lengthvar'] > 0) -				{ -					$line .= '(' . ($row['lengthvar'] - 4) . ')'; -				} -			} - -			if (strpos($row['type'], 'numeric') !== false) -			{ -				$line .= '('; -				$line .= sprintf("%s,%s", (($row['lengthvar'] >> 16) & 0xffff), (($row['lengthvar'] - 4) & 0xffff)); -				$line .= ')'; -			} - -			if (isset($row['rowdefault'])) -			{ -				$line .= ' DEFAULT ' . $row['rowdefault']; -			} - -			if ($row['notnull'] == 't') -			{ -				$line .= ' NOT NULL'; -			} - -			$lines[] = $line; -		} -		$db->sql_freeresult($result); - -		// Get the listing of primary keys. -		$sql_pri_keys = "SELECT ic.relname as index_name, bc.relname as tab_name, ta.attname as column_name, i.indisunique as unique_key, i.indisprimary as primary_key -			FROM pg_class bc, pg_class ic, pg_index i, pg_attribute ta, pg_attribute ia -			WHERE (bc.oid = i.indrelid) -				AND (ic.oid = i.indexrelid) -				AND (ia.attrelid = i.indexrelid) -				AND	(ta.attrelid = bc.oid) -				AND (bc.relname = '" . $db->sql_escape($table_name) . "') -				AND (ta.attrelid = i.indrelid) -				AND (ta.attnum = i.indkey[ia.attnum-1]) -			ORDER BY index_name, tab_name, column_name"; - -		$result = $db->sql_query($sql_pri_keys); - -		$index_create = $index_rows = $primary_key = array(); - -		// We do this in two steps. It makes placing the comma easier -		while ($row = $db->sql_fetchrow($result)) -		{ -			if ($row['primary_key'] == 't') -			{ -				$primary_key[] = $row['column_name']; -				$primary_key_name = $row['index_name']; -			} -			else -			{ -				// We have to store this all this info because it is possible to have a multi-column key... -				// we can loop through it again and build the statement -				$index_rows[$row['index_name']]['table'] = $table_name; -				$index_rows[$row['index_name']]['unique'] = ($row['unique_key'] == 't') ? true : false; -				$index_rows[$row['index_name']]['column_names'][] = $row['column_name']; -			} -		} -		$db->sql_freeresult($result); - -		if (!empty($index_rows)) -		{ -			foreach ($index_rows as $idx_name => $props) -			{ -				$index_create[] = 'CREATE ' . ($props['unique'] ? 'UNIQUE ' : '') . "INDEX $idx_name ON $table_name (" . implode(', ', $props['column_names']) . ");"; -			} -		} - -		if (!empty($primary_key)) -		{ -			$lines[] = "  CONSTRAINT $primary_key_name PRIMARY KEY (" . implode(', ', $primary_key) . ")"; -		} - -		// Generate constraint clauses for CHECK constraints -		$sql_checks = "SELECT conname as index_name, consrc -			FROM pg_constraint, pg_class bc -			WHERE conrelid = bc.oid -				AND bc.relname = '" . $db->sql_escape($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 -				)"; -		$result = $db->sql_query($sql_checks); - -		// Add the constraints to the sql file. -		while ($row = $db->sql_fetchrow($result)) -		{ -			if (!is_null($row['consrc'])) -			{ -				$lines[] = '  CONSTRAINT ' . $row['index_name'] . ' CHECK ' . $row['consrc']; -			} -		} -		$db->sql_freeresult($result); - -		$sql_data .= implode(", \n", $lines); -		$sql_data .= "\n);\n"; - -		if (!empty($index_create)) -		{ -			$sql_data .= implode("\n", $index_create) . "\n\n"; -		} -		$this->flush($sql_data); -	} - -	function write_data($table_name) -	{ -		global $db; -		// Grab all of the data from current table. -		$sql = "SELECT * -			FROM $table_name"; -		$result = $db->sql_query($sql); - -		$i_num_fields = pg_num_fields($result); -		$seq = ''; - -		for ($i = 0; $i < $i_num_fields; $i++) -		{ -			$ary_type[] = pg_field_type($result, $i); -			$ary_name[] = pg_field_name($result, $i); - -			$sql = "SELECT pg_get_expr(d.adbin, d.adrelid) as rowdefault -				FROM pg_attrdef d, pg_class c -				WHERE (c.relname = '{$table_name}') -					AND (c.oid = d.adrelid) -					AND d.adnum = " . strval($i + 1); -			$result2 = $db->sql_query($sql); -			if ($row = $db->sql_fetchrow($result2)) -			{ -				// Determine if we must reset the sequences -				if (strpos($row['rowdefault'], "nextval('") === 0) -				{ -					$seq .= "SELECT SETVAL('{$table_name}_seq',(select case when max({$ary_name[$i]})>0 then max({$ary_name[$i]})+1 else 1 end FROM {$table_name}));\n"; -				} -			} -		} - -		$this->flush("COPY $table_name (" . implode(', ', $ary_name) . ') FROM stdin;' . "\n"); -		while ($row = $db->sql_fetchrow($result)) -		{ -			$schema_vals = array(); - -			// Build the SQL statement to recreate the data. -			for ($i = 0; $i < $i_num_fields; $i++) -			{ -				$str_val = $row[$ary_name[$i]]; - -				if (preg_match('#char|text|bool|bytea#i', $ary_type[$i])) -				{ -					$str_val = str_replace(array("\n", "\t", "\r", "\b", "\f", "\v"), array('\n', '\t', '\r', '\b', '\f', '\v'), addslashes($str_val)); -					$str_empty = ''; -				} -				else -				{ -					$str_empty = '\N'; -				} - -				if (empty($str_val) && $str_val !== '0') -				{ -					$str_val = $str_empty; -				} - -				$schema_vals[] = $str_val; -			} - -			// Take the ordered fields and their associated data and build it -			// into a valid sql statement to recreate that field in the data. -			$this->flush(implode("\t", $schema_vals) . "\n"); -		} -		$db->sql_freeresult($result); -		$this->flush("\\.\n"); - -		// Write out the sequence statements -		$this->flush($seq); -	} - -	function write_end() -	{ -		$this->flush("COMMIT;\n"); -		parent::write_end(); -	} -} - -class mssql_extractor extends base_extractor -{ -	function write_end() -	{ -		$this->flush("COMMIT\nGO\n"); -		parent::write_end(); -	} - -	function write_start($prefix) -	{ -		$sql_data = "--\n"; -		$sql_data .= "-- phpBB Backup Script\n"; -		$sql_data .= "-- Dump of tables for $prefix\n"; -		$sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; -		$sql_data .= "--\n"; -		$sql_data .= "BEGIN TRANSACTION\n"; -		$sql_data .= "GO\n"; -		$this->flush($sql_data); -	} - -	function write_table($table_name) -	{ -		global $db; -		$sql_data = '-- Table: ' . $table_name . "\n"; -		$sql_data .= "IF OBJECT_ID(N'$table_name', N'U') IS NOT NULL\n"; -		$sql_data .= "DROP TABLE $table_name;\n"; -		$sql_data .= "GO\n"; -		$sql_data .= "\nCREATE TABLE [$table_name] (\n"; -		$rows = array(); - -		$text_flag = false; - -		$sql = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') as IS_IDENTITY -			FROM INFORMATION_SCHEMA.COLUMNS -			WHERE TABLE_NAME = '$table_name'"; -		$result = $db->sql_query($sql); - -		while ($row = $db->sql_fetchrow($result)) -		{ -			$line = "\t[{$row['COLUMN_NAME']}] [{$row['DATA_TYPE']}]"; - -			if ($row['DATA_TYPE'] == 'text') -			{ -				$text_flag = true; -			} - -			if ($row['IS_IDENTITY']) -			{ -				$line .= ' IDENTITY (1 , 1)'; -			} - -			if ($row['CHARACTER_MAXIMUM_LENGTH'] && $row['DATA_TYPE'] !== 'text') -			{ -				$line .= ' (' . $row['CHARACTER_MAXIMUM_LENGTH'] . ')'; -			} - -			if ($row['IS_NULLABLE'] == 'YES') -			{ -				$line .= ' NULL'; -			} -			else -			{ -				$line .= ' NOT NULL'; -			} - -			if ($row['COLUMN_DEFAULT']) -			{ -				$line .= ' DEFAULT ' . $row['COLUMN_DEFAULT']; -			} - -			$rows[] = $line; -		} -		$db->sql_freeresult($result); - -		$sql_data .= implode(",\n", $rows); -		$sql_data .= "\n) ON [PRIMARY]"; - -		if ($text_flag) -		{ -			$sql_data .= " TEXTIMAGE_ON [PRIMARY]"; -		} - -		$sql_data .= "\nGO\n\n"; -		$rows = array(); - -		$sql = "SELECT CONSTRAINT_NAME, COLUMN_NAME -			FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE -			WHERE TABLE_NAME = '$table_name'"; -		$result = $db->sql_query($sql); -		while ($row = $db->sql_fetchrow($result)) -		{ -			if (!sizeof($rows)) -			{ -				$sql_data .= "ALTER TABLE [$table_name] WITH NOCHECK ADD\n"; -				$sql_data .= "\tCONSTRAINT [{$row['CONSTRAINT_NAME']}] PRIMARY KEY  CLUSTERED \n\t(\n"; -			} -			$rows[] = "\t\t[{$row['COLUMN_NAME']}]"; -		} -		if (sizeof($rows)) -		{ -			$sql_data .= implode(",\n", $rows); -			$sql_data .= "\n\t)  ON [PRIMARY] \nGO\n"; -		} -		$db->sql_freeresult($result); - -		$index = array(); -		$sql = "EXEC sp_statistics '$table_name'"; -		$result = $db->sql_query($sql); -		while ($row = $db->sql_fetchrow($result)) -		{ -			if ($row['TYPE'] == 3) -			{ -				$index[$row['INDEX_NAME']][] = '[' . $row['COLUMN_NAME'] . ']'; -			} -		} -		$db->sql_freeresult($result); - -		foreach ($index as $index_name => $column_name) -		{ -			$index[$index_name] = implode(', ', $column_name); -		} - -		foreach ($index as $index_name => $columns) -		{ -			$sql_data .= "\nCREATE  INDEX [$index_name] ON [$table_name]($columns) ON [PRIMARY]\nGO\n"; -		} -		$this->flush($sql_data); -	} - -	function write_data($table_name) -	{ -		global $db; - -		if ($db->get_sql_layer() === 'mssql') -		{ -			$this->write_data_mssql($table_name); -		} -		else if ($db->get_sql_layer() === 'mssqlnative') -		{ -			$this->write_data_mssqlnative($table_name); -		} -		else -		{ -			$this->write_data_odbc($table_name); -		} -	} - -	function write_data_mssql($table_name) -	{ -		global $db; -		$ary_type = $ary_name = array(); -		$ident_set = false; -		$sql_data = ''; - -		// Grab all of the data from current table. -		$sql = "SELECT * -			FROM $table_name"; -		$result = $db->sql_query($sql); - -		$retrieved_data = mssql_num_rows($result); - -		$i_num_fields = mssql_num_fields($result); - -		for ($i = 0; $i < $i_num_fields; $i++) -		{ -			$ary_type[$i] = mssql_field_type($result, $i); -			$ary_name[$i] = mssql_field_name($result, $i); -		} - -		if ($retrieved_data) -		{ -			$sql = "SELECT 1 as has_identity -				FROM INFORMATION_SCHEMA.COLUMNS -				WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1"; -			$result2 = $db->sql_query($sql); -			$row2 = $db->sql_fetchrow($result2); -			if (!empty($row2['has_identity'])) -			{ -				$sql_data .= "\nSET IDENTITY_INSERT $table_name ON\nGO\n"; -				$ident_set = true; -			} -			$db->sql_freeresult($result2); -		} - -		while ($row = $db->sql_fetchrow($result)) -		{ -			$schema_vals = $schema_fields = array(); - -			// Build the SQL statement to recreate the data. -			for ($i = 0; $i < $i_num_fields; $i++) -			{ -				$str_val = $row[$ary_name[$i]]; - -				if (preg_match('#char|text|bool|varbinary#i', $ary_type[$i])) -				{ -					$str_quote = ''; -					$str_empty = "''"; -					$str_val = sanitize_data_mssql(str_replace("'", "''", $str_val)); -				} -				else if (preg_match('#date|timestamp#i', $ary_type[$i])) -				{ -					if (empty($str_val)) -					{ -						$str_quote = ''; -					} -					else -					{ -						$str_quote = "'"; -					} -				} -				else -				{ -					$str_quote = ''; -					$str_empty = 'NULL'; -				} - -				if (empty($str_val) && $str_val !== '0' && !(is_int($str_val) || is_float($str_val))) -				{ -					$str_val = $str_empty; -				} - -				$schema_vals[$i] = $str_quote . $str_val . $str_quote; -				$schema_fields[$i] = $ary_name[$i]; -			} - -			// Take the ordered fields and their associated data and build it -			// into a valid sql statement to recreate that field in the data. -			$sql_data .= "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\nGO\n"; - -			$this->flush($sql_data); -			$sql_data = ''; -		} -		$db->sql_freeresult($result); - -		if ($retrieved_data && $ident_set) -		{ -			$sql_data .= "\nSET IDENTITY_INSERT $table_name OFF\nGO\n"; -		} -		$this->flush($sql_data); -	} - -	function write_data_mssqlnative($table_name) -	{ -		global $db; -		$ary_type = $ary_name = array(); -		$ident_set = false; -		$sql_data = ''; - -		// Grab all of the data from current table. -		$sql = "SELECT * FROM $table_name"; -		$db->mssqlnative_set_query_options(array('Scrollable' => SQLSRV_CURSOR_STATIC)); -		$result = $db->sql_query($sql); - -		$retrieved_data = $db->mssqlnative_num_rows($result); - -		if (!$retrieved_data) -		{ -			$db->sql_freeresult($result); -			return; -		} - -		$sql = "SELECT COLUMN_NAME, DATA_TYPE -			FROM INFORMATION_SCHEMA.COLUMNS -			WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = '" . $db->sql_escape($table_name) . "'"; -		$result_fields = $db->sql_query($sql); - -		$i_num_fields = 0; -		while ($row = $db->sql_fetchrow($result_fields)) -		{ -			$ary_type[$i_num_fields] = $row['DATA_TYPE']; -			$ary_name[$i_num_fields] = $row['COLUMN_NAME']; -			$i_num_fields++; -		} -		$db->sql_freeresult($result_fields); - -		$sql = "SELECT 1 as has_identity -			FROM INFORMATION_SCHEMA.COLUMNS -			WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1"; -		$result2 = $db->sql_query($sql); -		$row2 = $db->sql_fetchrow($result2); - -		if (!empty($row2['has_identity'])) -		{ -			$sql_data .= "\nSET IDENTITY_INSERT $table_name ON\nGO\n"; -			$ident_set = true; -		} -		$db->sql_freeresult($result2); - -		while ($row = $db->sql_fetchrow($result)) -		{ -			$schema_vals = $schema_fields = array(); - -			// Build the SQL statement to recreate the data. -			for ($i = 0; $i < $i_num_fields; $i++) -			{ -				$str_val = $row[$ary_name[$i]]; - -				// defaults to type number - better quote just to be safe, so check for is_int too -				if (is_int($ary_type[$i]) || preg_match('#char|text|bool|varbinary#i', $ary_type[$i])) -				{ -					$str_quote = ''; -					$str_empty = "''"; -					$str_val = sanitize_data_mssql(str_replace("'", "''", $str_val)); -				} -				else if (preg_match('#date|timestamp#i', $ary_type[$i])) -				{ -					if (empty($str_val)) -					{ -						$str_quote = ''; -					} -					else -					{ -						$str_quote = "'"; -					} -				} -				else -				{ -					$str_quote = ''; -					$str_empty = 'NULL'; -				} - -				if (empty($str_val) && $str_val !== '0' && !(is_int($str_val) || is_float($str_val))) -				{ -					$str_val = $str_empty; -				} - -				$schema_vals[$i] = $str_quote . $str_val . $str_quote; -				$schema_fields[$i] = $ary_name[$i]; -			} - -			// Take the ordered fields and their associated data and build it -			// into a valid sql statement to recreate that field in the data. -			$sql_data .= "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\nGO\n"; - -			$this->flush($sql_data); -			$sql_data = ''; -		} -		$db->sql_freeresult($result); - -		if ($ident_set) -		{ -			$sql_data .= "\nSET IDENTITY_INSERT $table_name OFF\nGO\n"; -		} -		$this->flush($sql_data); -	} - -	function write_data_odbc($table_name) -	{ -		global $db; -		$ary_type = $ary_name = array(); -		$ident_set = false; -		$sql_data = ''; - -		// Grab all of the data from current table. -		$sql = "SELECT * -			FROM $table_name"; -		$result = $db->sql_query($sql); - -		$retrieved_data = odbc_num_rows($result); - -		if ($retrieved_data) -		{ -			$sql = "SELECT 1 as has_identity -				FROM INFORMATION_SCHEMA.COLUMNS -				WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1"; -			$result2 = $db->sql_query($sql); -			$row2 = $db->sql_fetchrow($result2); -			if (!empty($row2['has_identity'])) -			{ -				$sql_data .= "\nSET IDENTITY_INSERT $table_name ON\nGO\n"; -				$ident_set = true; -			} -			$db->sql_freeresult($result2); -		} - -		$i_num_fields = odbc_num_fields($result); - -		for ($i = 0; $i < $i_num_fields; $i++) -		{ -			$ary_type[$i] = odbc_field_type($result, $i + 1); -			$ary_name[$i] = odbc_field_name($result, $i + 1); -		} - -		while ($row = $db->sql_fetchrow($result)) -		{ -			$schema_vals = $schema_fields = array(); - -			// Build the SQL statement to recreate the data. -			for ($i = 0; $i < $i_num_fields; $i++) -			{ -				$str_val = $row[$ary_name[$i]]; - -				if (preg_match('#char|text|bool|varbinary#i', $ary_type[$i])) -				{ -					$str_quote = ''; -					$str_empty = "''"; -					$str_val = sanitize_data_mssql(str_replace("'", "''", $str_val)); -				} -				else if (preg_match('#date|timestamp#i', $ary_type[$i])) -				{ -					if (empty($str_val)) -					{ -						$str_quote = ''; -					} -					else -					{ -						$str_quote = "'"; -					} -				} -				else -				{ -					$str_quote = ''; -					$str_empty = 'NULL'; -				} - -				if (empty($str_val) && $str_val !== '0' && !(is_int($str_val) || is_float($str_val))) -				{ -					$str_val = $str_empty; -				} - -				$schema_vals[$i] = $str_quote . $str_val . $str_quote; -				$schema_fields[$i] = $ary_name[$i]; -			} - -			// Take the ordered fields and their associated data and build it -			// into a valid sql statement to recreate that field in the data. -			$sql_data .= "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\nGO\n"; - -			$this->flush($sql_data); - -			$sql_data = ''; - -		} -		$db->sql_freeresult($result); - -		if ($retrieved_data && $ident_set) -		{ -			$sql_data .= "\nSET IDENTITY_INSERT $table_name OFF\nGO\n"; -		} -		$this->flush($sql_data); -	} - -} - -class oracle_extractor extends base_extractor -{ -	function write_table($table_name) -	{ -		global $db; -		$sql_data = '-- Table: ' . $table_name . "\n"; -		$sql_data .= "DROP TABLE $table_name\n/\n"; -		$sql_data .= "\nCREATE TABLE $table_name (\n"; - -		$sql = "SELECT COLUMN_NAME, DATA_TYPE, DATA_PRECISION, DATA_LENGTH, NULLABLE, DATA_DEFAULT -			FROM ALL_TAB_COLS -			WHERE table_name = '{$table_name}'"; -		$result = $db->sql_query($sql); - -		$rows = array(); -		while ($row = $db->sql_fetchrow($result)) -		{ -			$line = '  "' . $row['column_name'] . '" ' . $row['data_type']; - -			if ($row['data_type'] !== 'CLOB') -			{ -				if ($row['data_type'] !== 'VARCHAR2' && $row['data_type'] !== 'CHAR') -				{ -					$line .= '(' . $row['data_precision'] . ')'; -				} -				else -				{ -					$line .= '(' . $row['data_length'] . ')'; -				} -			} - -			if (!empty($row['data_default'])) -			{ -				$line .= ' DEFAULT ' . $row['data_default']; -			} - -			if ($row['nullable'] == 'N') -			{ -				$line .= ' NOT NULL'; -			} -			$rows[] = $line; -		} -		$db->sql_freeresult($result); - -		$sql = "SELECT A.CONSTRAINT_NAME, A.COLUMN_NAME -			FROM USER_CONS_COLUMNS A, USER_CONSTRAINTS B -			WHERE A.CONSTRAINT_NAME = B.CONSTRAINT_NAME -				AND B.CONSTRAINT_TYPE = 'P' -				AND A.TABLE_NAME = '{$table_name}'"; -		$result = $db->sql_query($sql); - -		$primary_key = array(); -		$contraint_name = ''; -		while ($row = $db->sql_fetchrow($result)) -		{ -			$constraint_name = '"' . $row['constraint_name'] . '"'; -			$primary_key[] = '"' . $row['column_name'] . '"'; -		} -		$db->sql_freeresult($result); - -		if (sizeof($primary_key)) -		{ -			$rows[] = "  CONSTRAINT {$constraint_name} PRIMARY KEY (" . implode(', ', $primary_key) . ')'; -		} - -		$sql = "SELECT A.CONSTRAINT_NAME, A.COLUMN_NAME -			FROM USER_CONS_COLUMNS A, USER_CONSTRAINTS B -			WHERE A.CONSTRAINT_NAME = B.CONSTRAINT_NAME -				AND B.CONSTRAINT_TYPE = 'U' -				AND A.TABLE_NAME = '{$table_name}'"; -		$result = $db->sql_query($sql); - -		$unique = array(); -		$contraint_name = ''; -		while ($row = $db->sql_fetchrow($result)) -		{ -			$constraint_name = '"' . $row['constraint_name'] . '"'; -			$unique[] = '"' . $row['column_name'] . '"'; -		} -		$db->sql_freeresult($result); - -		if (sizeof($unique)) -		{ -			$rows[] = "  CONSTRAINT {$constraint_name} UNIQUE (" . implode(', ', $unique) . ')'; -		} - -		$sql_data .= implode(",\n", $rows); -		$sql_data .= "\n)\n/\n"; - -		$sql = "SELECT A.REFERENCED_NAME, C.* -			FROM USER_DEPENDENCIES A, USER_TRIGGERS B, USER_SEQUENCES C -			WHERE A.REFERENCED_TYPE = 'SEQUENCE' -				AND A.NAME = B.TRIGGER_NAME -				AND B.TABLE_NAME = '{$table_name}' -				AND C.SEQUENCE_NAME = A.REFERENCED_NAME"; -		$result = $db->sql_query($sql); - -		$type = request_var('type', ''); - -		while ($row = $db->sql_fetchrow($result)) -		{ -			$sql_data .= "\nDROP SEQUENCE \"{$row['referenced_name']}\"\n/\n"; -			$sql_data .= "\nCREATE SEQUENCE \"{$row['referenced_name']}\""; - -			if ($type == 'full') -			{ -				$sql_data .= ' START WITH ' . $row['last_number']; -			} - -			$sql_data .= "\n/\n"; -		} -		$db->sql_freeresult($result); - -		$sql = "SELECT DESCRIPTION, WHEN_CLAUSE, TRIGGER_BODY -			FROM USER_TRIGGERS -			WHERE TABLE_NAME = '{$table_name}'"; -		$result = $db->sql_query($sql); -		while ($row = $db->sql_fetchrow($result)) -		{ -			$sql_data .= "\nCREATE OR REPLACE TRIGGER {$row['description']}WHEN ({$row['when_clause']})\n{$row['trigger_body']}\n/\n"; -		} -		$db->sql_freeresult($result); - -		$sql = "SELECT A.INDEX_NAME, B.COLUMN_NAME -			FROM USER_INDEXES A, USER_IND_COLUMNS B -			WHERE A.UNIQUENESS = 'NONUNIQUE' -				AND A.INDEX_NAME = B.INDEX_NAME -				AND B.TABLE_NAME = '{$table_name}'"; -		$result = $db->sql_query($sql); - -		$index = array(); - -		while ($row = $db->sql_fetchrow($result)) -		{ -			$index[$row['index_name']][] = $row['column_name']; -		} - -		foreach ($index as $index_name => $column_names) -		{ -			$sql_data .= "\nCREATE INDEX $index_name ON $table_name(" . implode(', ', $column_names) . ")\n/\n"; -		} -		$db->sql_freeresult($result); -		$this->flush($sql_data); -	} - -	function write_data($table_name) -	{ -		global $db; -		$ary_type = $ary_name = array(); - -		// Grab all of the data from current table. -		$sql = "SELECT * -			FROM $table_name"; -		$result = $db->sql_query($sql); - -		$i_num_fields = ocinumcols($result); - -		for ($i = 0; $i < $i_num_fields; $i++) -		{ -			$ary_type[$i] = ocicolumntype($result, $i + 1); -			$ary_name[$i] = ocicolumnname($result, $i + 1); -		} - -		$sql_data = ''; - -		while ($row = $db->sql_fetchrow($result)) -		{ -			$schema_vals = $schema_fields = array(); - -			// Build the SQL statement to recreate the data. -			for ($i = 0; $i < $i_num_fields; $i++) -			{ -				// Oracle uses uppercase - we use lowercase -				$str_val = $row[strtolower($ary_name[$i])]; - -				if (preg_match('#char|text|bool|raw|clob#i', $ary_type[$i])) -				{ -					$str_quote = ''; -					$str_empty = "''"; -					$str_val = sanitize_data_oracle($str_val); -				} -				else if (preg_match('#date|timestamp#i', $ary_type[$i])) -				{ -					if (empty($str_val)) -					{ -						$str_quote = ''; -					} -					else -					{ -						$str_quote = "'"; -					} -				} -				else -				{ -					$str_quote = ''; -					$str_empty = 'NULL'; -				} - -				if (empty($str_val) && $str_val !== '0') -				{ -					$str_val = $str_empty; -				} - -				$schema_vals[$i] = $str_quote . $str_val . $str_quote; -				$schema_fields[$i] = '"' . $ary_name[$i] . '"'; -			} - -			// Take the ordered fields and their associated data and build it -			// into a valid sql statement to recreate that field in the data. -			$sql_data = "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ")\n/\n"; - -			$this->flush($sql_data); -		} -		$db->sql_freeresult($result); -	} - -	function write_start($prefix) -	{ -		$sql_data = "--\n"; -		$sql_data .= "-- phpBB Backup Script\n"; -		$sql_data .= "-- Dump of tables for $prefix\n"; -		$sql_data .= "-- DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; -		$sql_data .= "--\n"; -		$this->flush($sql_data); -	} -} -  // get how much space we allow for a chunk of data, very similar to phpMyAdmin's way of doing things ;-) (hey, we only do this for MySQL anyway :P)  function get_usable_memory()  { diff --git a/phpBB/includes/acp/acp_disallow.php b/phpBB/includes/acp/acp_disallow.php index 5b12013708..70eb398d07 100644 --- a/phpBB/includes/acp/acp_disallow.php +++ b/phpBB/includes/acp/acp_disallow.php @@ -25,8 +25,7 @@ class acp_disallow  	function main($id, $mode)  	{ -		global $db, $user, $auth, $template, $cache; -		global $config, $phpbb_admin_path; +		global $db, $user, $template, $cache, $phpbb_log, $request;  		$user->add_lang('acp/posting'); @@ -47,7 +46,7 @@ class acp_disallow  		if ($disallow)  		{ -			$disallowed_user = str_replace('*', '%', utf8_normalize_nfc(request_var('disallowed_user', '', true))); +			$disallowed_user = str_replace('*', '%', $request->variable('disallowed_user', '', true));  			if (!$disallowed_user)  			{ @@ -72,13 +71,13 @@ class acp_disallow  			$cache->destroy('_disallowed_usernames');  			$message = $user->lang['DISALLOW_SUCCESSFUL']; -			add_log('admin', 'LOG_DISALLOW_ADD', str_replace('%', '*', $disallowed_user)); +			$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DISALLOW_ADD', false, array(str_replace('%', '*', $disallowed_user)));  			trigger_error($message . adm_back_link($this->u_action));  		}  		else if ($allow)  		{ -			$disallowed_id = request_var('disallowed_id', 0); +			$disallowed_id = $request->variable('disallowed_id', 0);  			if (!$disallowed_id)  			{ @@ -91,7 +90,7 @@ class acp_disallow  			$cache->destroy('_disallowed_usernames'); -			add_log('admin', 'LOG_DISALLOW_DELETE'); +			$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DISALLOW_DELETE');  			trigger_error($user->lang['DISALLOWED_DELETED'] . adm_back_link($this->u_action));  		} diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php index 917d02318e..57eefad02d 100644 --- a/phpBB/includes/acp/acp_email.php +++ b/phpBB/includes/acp/acp_email.php @@ -25,8 +25,8 @@ class acp_email  	function main($id, $mode)  	{ -		global $config, $db, $user, $auth, $template, $cache; -		global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $phpbb_dispatcher; +		global $config, $db, $user, $template, $phpbb_log, $request; +		global $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_dispatcher;  		$user->add_lang('acp/email');  		$this->tpl_name = 'acp_email'; @@ -39,11 +39,11 @@ class acp_email  		$submit = (isset($_POST['submit'])) ? true : false;  		$error = array(); -		$usernames	= request_var('usernames', '', true); +		$usernames	= $request->variable('usernames', '', true);  		$usernames	= (!empty($usernames)) ? explode("\n", $usernames) : array(); -		$group_id	= request_var('g', 0); -		$subject	= utf8_normalize_nfc(request_var('subject', '', true)); -		$message	= utf8_normalize_nfc(request_var('message', '', true)); +		$group_id	= $request->variable('g', 0); +		$subject	= $request->variable('subject', '', true); +		$message	= $request->variable('message', '', true);  		// Do the job ...  		if ($submit) @@ -51,7 +51,7 @@ class acp_email  			// Error checking needs to go here ... if no subject and/or no message then skip  			// over the send and return to the form  			$use_queue		= (isset($_POST['send_immediately'])) ? false : true; -			$priority		= request_var('mail_priority_flag', MAIL_NORMAL_PRIORITY); +			$priority		= $request->variable('mail_priority_flag', MAIL_NORMAL_PRIORITY);  			if (!check_form_key($form_key))  			{ @@ -270,7 +270,7 @@ class acp_email  				{  					if (!empty($usernames))  					{ -						add_log('admin', 'LOG_MASS_EMAIL', implode(', ', utf8_normalize_nfc($usernames))); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MASS_EMAIL', false, array(implode(', ', utf8_normalize_nfc($usernames))));  					}  					else  					{ @@ -284,7 +284,7 @@ class acp_email  							$group_name = $user->lang['ALL_USERS'];  						} -						add_log('admin', 'LOG_MASS_EMAIL', $group_name); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MASS_EMAIL', false, array($group_name));  					}  				} diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index f0348817c8..6f65dc9fa0 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -11,6 +11,9 @@  *  */ +use phpbb\exception\exception_interface; +use phpbb\exception\version_check_exception; +  /**  * @ignore  */ @@ -28,7 +31,6 @@ class acp_extensions  	private $config;  	private $template;  	private $user; -	private $cache;  	private $log;  	private $request;  	private $phpbb_dispatcher; @@ -37,12 +39,11 @@ class acp_extensions  	function main()  	{  		// Start the page -		global $config, $user, $template, $request, $phpbb_extension_manager, $phpbb_root_path, $phpEx, $phpbb_log, $cache, $phpbb_dispatcher; +		global $config, $user, $template, $request, $phpbb_extension_manager, $phpbb_root_path, $phpbb_log, $phpbb_dispatcher;  		$this->config = $config;  		$this->template = $template;  		$this->user = $user; -		$this->cache = $cache;  		$this->request = $request;  		$this->log = $phpbb_log;  		$this->phpbb_dispatcher = $phpbb_dispatcher; @@ -96,15 +97,16 @@ class acp_extensions  		// If they've specified an extension, let's load the metadata manager and validate it.  		if ($ext_name)  		{ -			$md_manager = $this->ext_manager->create_extension_metadata_manager($ext_name, $this->template); +			$md_manager = $this->ext_manager->create_extension_metadata_manager($ext_name);  			try  			{  				$md_manager->get_metadata('all');  			} -			catch (\phpbb\extension\exception $e) +			catch (exception_interface $e)  			{ -				trigger_error($e, E_USER_WARNING); +				$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); +				trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING);  			}  		} @@ -159,9 +161,10 @@ class acp_extensions  				{  					$md_manager->validate_enable();  				} -				catch (\phpbb\extension\exception $e) +				catch (exception_interface $e)  				{ -					trigger_error($e . adm_back_link($this->u_action), E_USER_WARNING); +					$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); +					trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING);  				}  				$extension = $this->ext_manager->get_extension($ext_name); @@ -189,9 +192,10 @@ class acp_extensions  				{  					$md_manager->validate_enable();  				} -				catch (\phpbb\extension\exception $e) +				catch (exception_interface $e)  				{ -					trigger_error($e . adm_back_link($this->u_action), E_USER_WARNING); +					$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); +					trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING);  				}  				$extension = $this->ext_manager->get_extension($ext_name); @@ -323,26 +327,36 @@ class acp_extensions  			case 'details':  				// Output it to the template -				$md_manager->output_template_data(); +				$meta = $md_manager->get_metadata('all'); +				$this->output_metadata_to_template($meta); -				try +				if (isset($meta['extra']['version-check']))  				{ -					$updates_available = $this->version_check($md_manager, $this->request->variable('versioncheck_force', false)); +					try +					{ +						$updates_available = $this->ext_manager->version_check($md_manager, $this->request->variable('versioncheck_force', false), false, $this->config['extension_force_unstable'] ? 'unstable' : null); -					$this->template->assign_vars(array( -						'S_UP_TO_DATE'		=> empty($updates_available), -						'S_VERSIONCHECK'	=> true, -						'UP_TO_DATE_MSG'	=> $this->user->lang(empty($updates_available) ? 'UP_TO_DATE' : 'NOT_UP_TO_DATE', $md_manager->get_metadata('display-name')), -					)); +						$this->template->assign_vars(array( +							'S_UP_TO_DATE' => empty($updates_available), +							'UP_TO_DATE_MSG' => $this->user->lang(empty($updates_available) ? 'UP_TO_DATE' : 'NOT_UP_TO_DATE', $md_manager->get_metadata('display-name')), +						)); + +						$this->template->assign_block_vars('updates_available', $updates_available); +					} +					catch (exception_interface $e) +					{ +						$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); -					$this->template->assign_block_vars('updates_available', $updates_available); +						$this->template->assign_vars(array( +							'S_VERSIONCHECK_FAIL' => true, +							'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== 'VERSIONCHECK_FAIL') ? $message : '', +						)); +					} +					$this->template->assign_var('S_VERSIONCHECK', true);  				} -				catch (\RuntimeException $e) +				else  				{ -					$this->template->assign_vars(array( -						'S_VERSIONCHECK_STATUS'			=> $e->getCode(), -						'VERSIONCHECK_FAIL_REASON'		=> ($e->getMessage() !== $this->user->lang('VERSIONCHECK_FAIL')) ? $e->getMessage() : '', -					)); +					$this->template->assign_var('S_VERSIONCHECK', false);  				}  				$this->template->assign_vars(array( @@ -387,7 +401,7 @@ class acp_extensions  		foreach ($this->ext_manager->all_enabled() as $name => $location)  		{ -			$md_manager = $this->ext_manager->create_extension_metadata_manager($name, $this->template); +			$md_manager = $this->ext_manager->create_extension_metadata_manager($name);  			try  			{ @@ -397,17 +411,32 @@ class acp_extensions  					'META_VERSION' => $meta['version'],  				); -				$force_update = $this->request->variable('versioncheck_force', false); -				$updates = $this->version_check($md_manager, $force_update, !$force_update); +				if (isset($meta['extra']['version-check'])) +				{ +					try +					{ +						$force_update = $this->request->variable('versioncheck_force', false); +						$updates = $this->ext_manager->version_check($md_manager, $force_update, !$force_update); -				$enabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates); -				$enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true; -				$enabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); +						$enabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates); +						$enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true; +						$enabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); +					} +					catch (exception_interface $e) +					{ +						// Ignore exceptions due to the version check +					} +				} +				else +				{ +					$enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false; +				}  			} -			catch (\phpbb\extension\exception $e) +			catch (exception_interface $e)  			{ +				$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));  				$this->template->assign_block_vars('disabled', array( -					'META_DISPLAY_NAME'		=> $this->user->lang('EXTENSION_INVALID_LIST', $name, $e), +					'META_DISPLAY_NAME'		=> $this->user->lang('EXTENSION_INVALID_LIST', $name, $message),  					'S_VERSIONCHECK'		=> false,  				));  			} @@ -443,7 +472,7 @@ class acp_extensions  		foreach ($this->ext_manager->all_disabled() as $name => $location)  		{ -			$md_manager = $this->ext_manager->create_extension_metadata_manager($name, $this->template); +			$md_manager = $this->ext_manager->create_extension_metadata_manager($name);  			try  			{ @@ -453,23 +482,35 @@ class acp_extensions  					'META_VERSION' => $meta['version'],  				); -				$force_update = $this->request->variable('versioncheck_force', false); -				$updates = $this->version_check($md_manager, $force_update, !$force_update); +				if (isset($meta['extra']['version-check'])) +				{ +					$force_update = $this->request->variable('versioncheck_force', false); +					$updates = $this->ext_manager->version_check($md_manager, $force_update, !$force_update); -				$disabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates); -				$disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true; -				$disabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); +					$disabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates); +					$disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true; +					$disabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); +				} +				else +				{ +					$disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false; +				} +			} +			catch (version_check_exception $e) +			{ +				$disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false;  			} -			catch (\phpbb\extension\exception $e) +			catch (exception_interface $e)  			{ +				$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));  				$this->template->assign_block_vars('disabled', array( -					'META_DISPLAY_NAME'		=> $this->user->lang('EXTENSION_INVALID_LIST', $name, $e), +					'META_DISPLAY_NAME'		=> $this->user->lang('EXTENSION_INVALID_LIST', $name, $message),  					'S_VERSIONCHECK'		=> false,  				));  			}  			catch (\RuntimeException $e)  			{ -				$disabeld_extension_meta_data[$name]['S_VERSIONCHECK'] = false; +				$disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false;  			}  		} @@ -502,7 +543,7 @@ class acp_extensions  		foreach ($uninstalled as $name => $location)  		{ -			$md_manager = $this->ext_manager->create_extension_metadata_manager($name, $this->template); +			$md_manager = $this->ext_manager->create_extension_metadata_manager($name);  			try  			{ @@ -512,24 +553,32 @@ class acp_extensions  					'META_VERSION' => $meta['version'],  				); -				$force_update = $this->request->variable('versioncheck_force', false); -				$updates = $this->version_check($md_manager, $force_update, !$force_update); +				if (isset($meta['extra']['version-check'])) +				{ +					$force_update = $this->request->variable('versioncheck_force', false); +					$updates = $this->ext_manager->version_check($md_manager, $force_update, !$force_update); -				$available_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates); -				$available_extension_meta_data[$name]['S_VERSIONCHECK'] = true; -				$available_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); +					$available_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates); +					$available_extension_meta_data[$name]['S_VERSIONCHECK'] = true; +					$available_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); +				} +				else +				{ +					$available_extension_meta_data[$name]['S_VERSIONCHECK'] = false; +				} +			} +			catch (version_check_exception $e) +			{ +				$available_extension_meta_data[$name]['S_VERSIONCHECK'] = false;  			} -			catch (\phpbb\extension\exception $e) +			catch (exception_interface $e)  			{ +				$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));  				$this->template->assign_block_vars('disabled', array( -					'META_DISPLAY_NAME'		=> $this->user->lang('EXTENSION_INVALID_LIST', $name, $e), +					'META_DISPLAY_NAME'		=> $this->user->lang('EXTENSION_INVALID_LIST', $name, $message),  					'S_VERSIONCHECK'		=> false,  				));  			} -			catch (\RuntimeException $e) -			{ -				$available_extension_meta_data[$name]['S_VERSIONCHECK'] = false; -			}  		}  		uasort($available_extension_meta_data, array($this, 'sort_extension_meta_data_table')); @@ -566,38 +615,47 @@ class acp_extensions  	}  	/** -	* Check the version and return the available updates. -	* -	* @param \phpbb\extension\metadata_manager $md_manager The metadata manager for the version to check. -	* @param bool $force_update Ignores cached data. Defaults to false. -	* @param bool $force_cache Force the use of the cache. Override $force_update. -	* @return array -	* @throws RuntimeException +	* Sort helper for the table containing the metadata about the extensions.  	*/ -	protected function version_check(\phpbb\extension\metadata_manager $md_manager, $force_update = false, $force_cache = false) +	protected function sort_extension_meta_data_table($val1, $val2)  	{ -		$meta = $md_manager->get_metadata('all'); - -		if (!isset($meta['extra']['version-check'])) -		{ -			throw new \RuntimeException($this->user->lang('NO_VERSIONCHECK'), 1); -		} - -		$version_check = $meta['extra']['version-check']; - -		$version_helper = new \phpbb\version_helper($this->cache, $this->config, new \phpbb\file_downloader(), $this->user); -		$version_helper->set_current_version($meta['version']); -		$version_helper->set_file_location($version_check['host'], $version_check['directory'], $version_check['filename'], isset($version_check['ssl']) ? $version_check['ssl'] : false); -		$version_helper->force_stability($this->config['extension_force_unstable'] ? 'unstable' : null); - -		return $version_helper->get_ext_update_on_branch($force_update, $force_cache); +		return strnatcasecmp($val1['META_DISPLAY_NAME'], $val2['META_DISPLAY_NAME']);  	}  	/** -	* Sort helper for the table containing the metadata about the extensions. +	* Outputs extension metadata into the template +	* +	* @param array $metadata Array with all metadata for the extension +	* @return null  	*/ -	protected function sort_extension_meta_data_table($val1, $val2) +	public function output_metadata_to_template($metadata)  	{ -		return strnatcasecmp($val1['META_DISPLAY_NAME'], $val2['META_DISPLAY_NAME']); +		$this->template->assign_vars(array( +			'META_NAME'			=> $metadata['name'], +			'META_TYPE'			=> $metadata['type'], +			'META_DESCRIPTION'	=> (isset($metadata['description'])) ? $metadata['description'] : '', +			'META_HOMEPAGE'		=> (isset($metadata['homepage'])) ? $metadata['homepage'] : '', +			'META_VERSION'		=> $metadata['version'], +			'META_TIME'			=> (isset($metadata['time'])) ? $metadata['time'] : '', +			'META_LICENSE'		=> $metadata['license'], + +			'META_REQUIRE_PHP'		=> (isset($metadata['require']['php'])) ? $metadata['require']['php'] : '', +			'META_REQUIRE_PHP_FAIL'	=> (isset($metadata['require']['php'])) ? false : true, + +			'META_REQUIRE_PHPBB'		=> (isset($metadata['extra']['soft-require']['phpbb/phpbb'])) ? $metadata['extra']['soft-require']['phpbb/phpbb'] : '', +			'META_REQUIRE_PHPBB_FAIL'	=> (isset($metadata['extra']['soft-require']['phpbb/phpbb'])) ? false : true, + +			'META_DISPLAY_NAME'	=> (isset($metadata['extra']['display-name'])) ? $metadata['extra']['display-name'] : '', +		)); + +		foreach ($metadata['authors'] as $author) +		{ +			$this->template->assign_block_vars('meta_authors', array( +				'AUTHOR_NAME'		=> $author['name'], +				'AUTHOR_EMAIL'		=> (isset($author['email'])) ? $author['email'] : '', +				'AUTHOR_HOMEPAGE'	=> (isset($author['homepage'])) ? $author['homepage'] : '', +				'AUTHOR_ROLE'		=> (isset($author['role'])) ? $author['role'] : '', +			)); +		}  	}  } diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 1e69a4ad20..66bb630241 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -27,7 +27,7 @@ class acp_forums  	function main($id, $mode)  	{  		global $db, $user, $auth, $template, $cache, $request, $phpbb_dispatcher; -		global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx; +		global $phpbb_admin_path, $phpbb_root_path, $phpEx, $phpbb_log;  		$user->add_lang('acp/forums');  		$this->tpl_name = 'acp_forums'; @@ -36,11 +36,11 @@ class acp_forums  		$form_key = 'acp_forums';  		add_form_key($form_key); -		$action		= request_var('action', ''); +		$action		= $request->variable('action', '');  		$update		= (isset($_POST['update'])) ? true : false; -		$forum_id	= request_var('f', 0); +		$forum_id	= $request->variable('f', 0); -		$this->parent_id	= request_var('parent_id', 0); +		$this->parent_id	= $request->variable('parent_id', 0);  		$forum_data = $errors = array();  		if ($update && !check_form_key($form_key))  		{ @@ -52,8 +52,8 @@ class acp_forums  		switch ($action)  		{  			case 'progress_bar': -				$start = request_var('start', 0); -				$total = request_var('total', 0); +				$start = $request->variable('start', 0); +				$total = $request->variable('total', 0);  				$this->display_progress_bar($start, $total);  			break; @@ -83,10 +83,10 @@ class acp_forums  			switch ($action)  			{  				case 'delete': -					$action_subforums	= request_var('action_subforums', ''); -					$subforums_to_id	= request_var('subforums_to_id', 0); -					$action_posts		= request_var('action_posts', ''); -					$posts_to_id		= request_var('posts_to_id', 0); +					$action_subforums	= $request->variable('action_subforums', ''); +					$subforums_to_id	= $request->variable('subforums_to_id', 0); +					$action_posts		= $request->variable('action_posts', ''); +					$posts_to_id		= $request->variable('posts_to_id', 0);  					$errors = $this->delete_forum($forum_id, $action_posts, $action_subforums, $posts_to_id, $subforums_to_id); @@ -112,45 +112,45 @@ class acp_forums  				case 'add':  					$forum_data += array( -						'parent_id'				=> request_var('forum_parent_id', $this->parent_id), -						'forum_type'			=> request_var('forum_type', FORUM_POST), -						'type_action'			=> request_var('type_action', ''), -						'forum_status'			=> request_var('forum_status', ITEM_UNLOCKED), +						'parent_id'				=> $request->variable('forum_parent_id', $this->parent_id), +						'forum_type'			=> $request->variable('forum_type', FORUM_POST), +						'type_action'			=> $request->variable('type_action', ''), +						'forum_status'			=> $request->variable('forum_status', ITEM_UNLOCKED),  						'forum_parents'			=> '', -						'forum_name'			=> utf8_normalize_nfc(request_var('forum_name', '', true)), -						'forum_link'			=> request_var('forum_link', ''), -						'forum_link_track'		=> request_var('forum_link_track', false), -						'forum_desc'			=> utf8_normalize_nfc(request_var('forum_desc', '', true)), +						'forum_name'			=> $request->variable('forum_name', '', true), +						'forum_link'			=> $request->variable('forum_link', ''), +						'forum_link_track'		=> $request->variable('forum_link_track', false), +						'forum_desc'			=> $request->variable('forum_desc', '', true),  						'forum_desc_uid'		=> '',  						'forum_desc_options'	=> 7,  						'forum_desc_bitfield'	=> '', -						'forum_rules'			=> utf8_normalize_nfc(request_var('forum_rules', '', true)), +						'forum_rules'			=> $request->variable('forum_rules', '', true),  						'forum_rules_uid'		=> '',  						'forum_rules_options'	=> 7,  						'forum_rules_bitfield'	=> '', -						'forum_rules_link'		=> request_var('forum_rules_link', ''), -						'forum_image'			=> request_var('forum_image', ''), -						'forum_style'			=> request_var('forum_style', 0), -						'display_subforum_list'	=> request_var('display_subforum_list', false), -						'display_on_index'		=> request_var('display_on_index', false), -						'forum_topics_per_page'	=> request_var('topics_per_page', 0), -						'enable_indexing'		=> request_var('enable_indexing', true), -						'enable_icons'			=> request_var('enable_icons', false), -						'enable_prune'			=> request_var('enable_prune', false), -						'enable_post_review'	=> request_var('enable_post_review', true), -						'enable_quick_reply'	=> request_var('enable_quick_reply', false), -						'enable_shadow_prune'		=> request_var('enable_shadow_prune', false), -						'prune_days'			=> request_var('prune_days', 7), -						'prune_viewed'			=> request_var('prune_viewed', 7), -						'prune_freq'			=> request_var('prune_freq', 1), -						'prune_old_polls'		=> request_var('prune_old_polls', false), -						'prune_announce'		=> request_var('prune_announce', false), -						'prune_sticky'			=> request_var('prune_sticky', false), -						'prune_shadow_days'		=> request_var('prune_shadow_days', 7), -						'prune_shadow_freq'		=> request_var('prune_shadow_freq', 1), -						'forum_password'		=> request_var('forum_password', '', true), -						'forum_password_confirm'=> request_var('forum_password_confirm', '', true), -						'forum_password_unset'	=> request_var('forum_password_unset', false), +						'forum_rules_link'		=> $request->variable('forum_rules_link', ''), +						'forum_image'			=> $request->variable('forum_image', ''), +						'forum_style'			=> $request->variable('forum_style', 0), +						'display_subforum_list'	=> $request->variable('display_subforum_list', false), +						'display_on_index'		=> $request->variable('display_on_index', false), +						'forum_topics_per_page'	=> $request->variable('topics_per_page', 0), +						'enable_indexing'		=> $request->variable('enable_indexing', true), +						'enable_icons'			=> $request->variable('enable_icons', false), +						'enable_prune'			=> $request->variable('enable_prune', false), +						'enable_post_review'	=> $request->variable('enable_post_review', true), +						'enable_quick_reply'	=> $request->variable('enable_quick_reply', false), +						'enable_shadow_prune'	=> $request->variable('enable_shadow_prune', false), +						'prune_days'			=> $request->variable('prune_days', 7), +						'prune_viewed'			=> $request->variable('prune_viewed', 7), +						'prune_freq'			=> $request->variable('prune_freq', 1), +						'prune_old_polls'		=> $request->variable('prune_old_polls', false), +						'prune_announce'		=> $request->variable('prune_announce', false), +						'prune_sticky'			=> $request->variable('prune_sticky', false), +						'prune_shadow_days'		=> $request->variable('prune_shadow_days', 7), +						'prune_shadow_freq'		=> $request->variable('prune_shadow_freq', 1), +						'forum_password'		=> $request->variable('forum_password', '', true), +						'forum_password_confirm'=> $request->variable('forum_password_confirm', '', true), +						'forum_password_unset'	=> $request->variable('forum_password_unset', false),  					);  					/** @@ -173,7 +173,7 @@ class acp_forums  					// Use link_display_on_index setting if forum type is link  					if ($forum_data['forum_type'] == FORUM_LINK)  					{ -						$forum_data['display_on_index'] = request_var('link_display_on_index', false); +						$forum_data['display_on_index'] = $request->variable('link_display_on_index', false);  					}  					// Linked forums and categories are not able to be locked... @@ -182,25 +182,25 @@ class acp_forums  						$forum_data['forum_status'] = ITEM_UNLOCKED;  					} -					$forum_data['show_active'] = ($forum_data['forum_type'] == FORUM_POST) ? request_var('display_recent', true) : request_var('display_active', false); +					$forum_data['show_active'] = ($forum_data['forum_type'] == FORUM_POST) ? $request->variable('display_recent', true) : $request->variable('display_active', false);  					// Get data for forum rules if specified...  					if ($forum_data['forum_rules'])  					{ -						generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], request_var('rules_parse_bbcode', false), request_var('rules_parse_urls', false), request_var('rules_parse_smilies', false)); +						generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], $request->variable('rules_parse_bbcode', false), $request->variable('rules_parse_urls', false), $request->variable('rules_parse_smilies', false));  					}  					// Get data for forum description if specified  					if ($forum_data['forum_desc'])  					{ -						generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], request_var('desc_parse_bbcode', false), request_var('desc_parse_urls', false), request_var('desc_parse_smilies', false)); +						generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], $request->variable('desc_parse_bbcode', false), $request->variable('desc_parse_urls', false), $request->variable('desc_parse_smilies', false));  					}  					$errors = $this->update_forum_data($forum_data);  					if (!sizeof($errors))  					{ -						$forum_perm_from = request_var('forum_perm_from', 0); +						$forum_perm_from = $request->variable('forum_perm_from', 0);  						$cache->destroy('sql', FORUMS_TABLE);  						$copied_permissions = false; @@ -266,7 +266,7 @@ class acp_forums  				if ($move_forum_name !== false)  				{ -					add_log('admin', 'LOG_FORUM_' . strtoupper($action), $row['forum_name'], $move_forum_name); +					$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_' . strtoupper($action), false, array($row['forum_name'], $move_forum_name));  					$cache->destroy('sql', FORUMS_TABLE);  				} @@ -311,7 +311,7 @@ class acp_forums  					$row2['min_topic_id'] = (int) $row2['min_topic_id'];  					$row2['max_topic_id'] = (int) $row2['max_topic_id']; -					$start = request_var('start', $row2['min_topic_id']); +					$start = $request->variable('start', $row2['min_topic_id']);  					$batch_size = 2000;  					$end = $start + $batch_size; @@ -327,7 +327,7 @@ class acp_forums  							WHERE forum_id = ' . $forum_id . '  								AND topic_id BETWEEN ' . $start . ' AND ' . $end;  						$result = $db->sql_query($sql); -						$topics_done = request_var('topics_done', 0) + (int) $db->sql_fetchfield('num_topics'); +						$topics_done = $request->variable('topics_done', 0) + (int) $db->sql_fetchfield('num_topics');  						$db->sql_freeresult($result);  						$start += $batch_size; @@ -377,7 +377,8 @@ class acp_forums  				sync('forum', 'forum_id', $forum_id, false, true); -				add_log('admin', 'LOG_FORUM_SYNC', $row['forum_name']); +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_SYNC', false, array($row['forum_name'])); +  				$cache->destroy('sql', FORUMS_TABLE);  				$template->assign_var('L_FORUM_RESYNCED', sprintf($user->lang['FORUM_RESYNCED'], $row['forum_name'])); @@ -390,13 +391,13 @@ class acp_forums  				if ($update)  				{  					$forum_data['forum_flags'] = 0; -					$forum_data['forum_flags'] += (request_var('forum_link_track', false)) ? FORUM_FLAG_LINK_TRACK : 0; -					$forum_data['forum_flags'] += (request_var('prune_old_polls', false)) ? FORUM_FLAG_PRUNE_POLL : 0; -					$forum_data['forum_flags'] += (request_var('prune_announce', false)) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0; -					$forum_data['forum_flags'] += (request_var('prune_sticky', false)) ? FORUM_FLAG_PRUNE_STICKY : 0; +					$forum_data['forum_flags'] += ($request->variable('forum_link_track', false)) ? FORUM_FLAG_LINK_TRACK : 0; +					$forum_data['forum_flags'] += ($request->variable('prune_old_polls', false)) ? FORUM_FLAG_PRUNE_POLL : 0; +					$forum_data['forum_flags'] += ($request->variable('prune_announce', false)) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0; +					$forum_data['forum_flags'] += ($request->variable('prune_sticky', false)) ? FORUM_FLAG_PRUNE_STICKY : 0;  					$forum_data['forum_flags'] += ($forum_data['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0; -					$forum_data['forum_flags'] += (request_var('enable_post_review', true)) ? FORUM_FLAG_POST_REVIEW : 0; -					$forum_data['forum_flags'] += (request_var('enable_quick_reply', false)) ? FORUM_FLAG_QUICK_REPLY : 0; +					$forum_data['forum_flags'] += ($request->variable('enable_post_review', true)) ? FORUM_FLAG_POST_REVIEW : 0; +					$forum_data['forum_flags'] += ($request->variable('enable_quick_reply', false)) ? FORUM_FLAG_QUICK_REPLY : 0;  				}  				// Initialise $row, so we always have it in the event @@ -444,7 +445,7 @@ class acp_forums  							'parent_id'				=> $this->parent_id,  							'forum_type'			=> FORUM_POST,  							'forum_status'			=> ITEM_UNLOCKED, -							'forum_name'			=> utf8_normalize_nfc(request_var('forum_name', '', true)), +							'forum_name'			=> $request->variable('forum_name', '', true),  							'forum_link'			=> '',  							'forum_link_track'		=> false,  							'forum_desc'			=> '', @@ -511,12 +512,12 @@ class acp_forums  				{  					if (!isset($forum_data['forum_rules_uid']))  					{ -						// Before we are able to display the preview and plane text, we need to parse our request_var()'d value... +						// Before we are able to display the preview and plane text, we need to parse our $request->variable()'d value...  						$forum_data['forum_rules_uid'] = '';  						$forum_data['forum_rules_bitfield'] = '';  						$forum_data['forum_rules_options'] = 0; -						generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], request_var('rules_allow_bbcode', false), request_var('rules_allow_urls', false), request_var('rules_allow_smilies', false)); +						generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], $request->variable('rules_allow_bbcode', false), $request->variable('rules_allow_urls', false), $request->variable('rules_allow_smilies', false));  					}  					// Generate preview content @@ -531,12 +532,12 @@ class acp_forums  				{  					if (!isset($forum_data['forum_desc_uid']))  					{ -						// Before we are able to display the preview and plane text, we need to parse our request_var()'d value... +						// Before we are able to display the preview and plane text, we need to parse our $request->variable()'d value...  						$forum_data['forum_desc_uid'] = '';  						$forum_data['forum_desc_bitfield'] = '';  						$forum_data['forum_desc_options'] = 0; -						generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], request_var('desc_allow_bbcode', false), request_var('desc_allow_urls', false), request_var('desc_allow_smilies', false)); +						generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], $request->variable('desc_allow_bbcode', false), $request->variable('desc_allow_urls', false), $request->variable('desc_allow_smilies', false));  					}  					// decode... @@ -779,7 +780,7 @@ class acp_forums  			break;  			case 'copy_perm': -				$forum_perm_from = request_var('forum_perm_from', 0); +				$forum_perm_from = $request->variable('forum_perm_from', 0);  				// Copy permissions?  				if (!empty($forum_perm_from) && $forum_perm_from != $forum_id) @@ -959,12 +960,13 @@ class acp_forums  	/**  	* Update forum data  	*/ -	function update_forum_data(&$forum_data) +	function update_forum_data(&$forum_data_ary)  	{ -		global $db, $user, $cache, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher; +		global $db, $user, $cache, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $phpbb_log, $request;  		$errors = array(); +		$forum_data = $forum_data_ary;  		/**  		* Validate the forum data before we create/update the forum  		* @@ -976,42 +978,44 @@ class acp_forums  		*/  		$vars = array('forum_data', 'errors');  		extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_validate_data', compact($vars))); +		$forum_data_ary = $forum_data; +		unset($forum_data); -		if ($forum_data['forum_name'] == '') +		if ($forum_data_ary['forum_name'] == '')  		{  			$errors[] = $user->lang['FORUM_NAME_EMPTY'];  		} -		if (utf8_strlen($forum_data['forum_desc']) > 4000) +		if (utf8_strlen($forum_data_ary['forum_desc']) > 4000)  		{  			$errors[] = $user->lang['FORUM_DESC_TOO_LONG'];  		} -		if (utf8_strlen($forum_data['forum_rules']) > 4000) +		if (utf8_strlen($forum_data_ary['forum_rules']) > 4000)  		{  			$errors[] = $user->lang['FORUM_RULES_TOO_LONG'];  		} -		if ($forum_data['forum_password'] || $forum_data['forum_password_confirm']) +		if ($forum_data_ary['forum_password'] || $forum_data_ary['forum_password_confirm'])  		{ -			if ($forum_data['forum_password'] != $forum_data['forum_password_confirm']) +			if ($forum_data_ary['forum_password'] != $forum_data_ary['forum_password_confirm'])  			{ -				$forum_data['forum_password'] = $forum_data['forum_password_confirm'] = ''; +				$forum_data_ary['forum_password'] = $forum_data_ary['forum_password_confirm'] = '';  				$errors[] = $user->lang['FORUM_PASSWORD_MISMATCH'];  			}  		} -		if ($forum_data['prune_days'] < 0 || $forum_data['prune_viewed'] < 0 || $forum_data['prune_freq'] < 0) +		if ($forum_data_ary['prune_days'] < 0 || $forum_data_ary['prune_viewed'] < 0 || $forum_data_ary['prune_freq'] < 0)  		{ -			$forum_data['prune_days'] = $forum_data['prune_viewed'] = $forum_data['prune_freq'] = 0; +			$forum_data_ary['prune_days'] = $forum_data_ary['prune_viewed'] = $forum_data_ary['prune_freq'] = 0;  			$errors[] = $user->lang['FORUM_DATA_NEGATIVE'];  		}  		$range_test_ary = array( -			array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data['forum_topics_per_page'], 'column_type' => 'TINT:0'), +			array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data_ary['forum_topics_per_page'], 'column_type' => 'TINT:0'),  		); -		if (!empty($forum_data['forum_image']) && !file_exists($phpbb_root_path . $forum_data['forum_image'])) +		if (!empty($forum_data_ary['forum_image']) && !file_exists($phpbb_root_path . $forum_data_ary['forum_image']))  		{  			$errors[] = $user->lang['FORUM_IMAGE_NO_EXIST'];  		} @@ -1025,17 +1029,17 @@ class acp_forums  		// 8 = prune stickies  		// 16 = show active topics  		// 32 = enable post review -		$forum_data['forum_flags'] = 0; -		$forum_data['forum_flags'] += ($forum_data['forum_link_track']) ? FORUM_FLAG_LINK_TRACK : 0; -		$forum_data['forum_flags'] += ($forum_data['prune_old_polls']) ? FORUM_FLAG_PRUNE_POLL : 0; -		$forum_data['forum_flags'] += ($forum_data['prune_announce']) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0; -		$forum_data['forum_flags'] += ($forum_data['prune_sticky']) ? FORUM_FLAG_PRUNE_STICKY : 0; -		$forum_data['forum_flags'] += ($forum_data['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0; -		$forum_data['forum_flags'] += ($forum_data['enable_post_review']) ? FORUM_FLAG_POST_REVIEW : 0; -		$forum_data['forum_flags'] += ($forum_data['enable_quick_reply']) ? FORUM_FLAG_QUICK_REPLY : 0; +		$forum_data_ary['forum_flags'] = 0; +		$forum_data_ary['forum_flags'] += ($forum_data_ary['forum_link_track']) ? FORUM_FLAG_LINK_TRACK : 0; +		$forum_data_ary['forum_flags'] += ($forum_data_ary['prune_old_polls']) ? FORUM_FLAG_PRUNE_POLL : 0; +		$forum_data_ary['forum_flags'] += ($forum_data_ary['prune_announce']) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0; +		$forum_data_ary['forum_flags'] += ($forum_data_ary['prune_sticky']) ? FORUM_FLAG_PRUNE_STICKY : 0; +		$forum_data_ary['forum_flags'] += ($forum_data_ary['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0; +		$forum_data_ary['forum_flags'] += ($forum_data_ary['enable_post_review']) ? FORUM_FLAG_POST_REVIEW : 0; +		$forum_data_ary['forum_flags'] += ($forum_data_ary['enable_quick_reply']) ? FORUM_FLAG_QUICK_REPLY : 0;  		// Unset data that are not database fields -		$forum_data_sql = $forum_data; +		$forum_data_sql = $forum_data_ary;  		unset($forum_data_sql['forum_link_track']);  		unset($forum_data_sql['prune_old_polls']); @@ -1066,12 +1070,14 @@ class acp_forums  		else  		{  			// Instantiate passwords manager +			/* @var $passwords_manager \phpbb\passwords\manager */  			$passwords_manager = $phpbb_container->get('passwords.manager');  			$forum_data_sql['forum_password'] = $passwords_manager->hash($forum_data_sql['forum_password']);  		}  		unset($forum_data_sql['forum_password_unset']); +		$forum_data = $forum_data_ary;  		/**  		* Remove invalid values from forum_data_sql that should not be updated  		* @@ -1084,6 +1090,8 @@ class acp_forums  		*/  		$vars = array('forum_data', 'forum_data_sql');  		extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_update_data_before', compact($vars))); +		$forum_data_ary = $forum_data; +		unset($forum_data);  		$is_new_forum = !isset($forum_data_sql['forum_id']); @@ -1140,9 +1148,9 @@ class acp_forums  			$sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $forum_data_sql);  			$db->sql_query($sql); -			$forum_data['forum_id'] = $db->sql_nextid(); +			$forum_data_ary['forum_id'] = $db->sql_nextid(); -			add_log('admin', 'LOG_FORUM_ADD', $forum_data['forum_name']); +			$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_ADD', false, array($forum_data_ary['forum_name']));  		}  		else  		{ @@ -1160,7 +1168,7 @@ class acp_forums  				// we're turning a postable forum into a non-postable forum  				if ($forum_data_sql['type_action'] == 'move')  				{ -					$to_forum_id = request_var('to_forum_id', 0); +					$to_forum_id = $request->variable('to_forum_id', 0);  					if ($to_forum_id)  					{ @@ -1190,8 +1198,8 @@ class acp_forums  				if ($row['right_id'] - $row['left_id'] > 1)  				{  					// We are turning a category into a link - but need to decide what to do with the subforums. -					$action_subforums = request_var('action_subforums', ''); -					$subforums_to_id = request_var('subforums_to_id', 0); +					$action_subforums = $request->variable('action_subforums', ''); +					$subforums_to_id = $request->variable('subforums_to_id', 0);  					if ($action_subforums == 'delete')  					{ @@ -1272,8 +1280,6 @@ class acp_forums  							return array($user->lang['NO_FORUM']);  						} -						$subforums_to_name = $_row['forum_name']; -  						$sql = 'SELECT forum_id  							FROM ' . FORUMS_TABLE . "  							WHERE parent_id = {$row['forum_id']}"; @@ -1357,11 +1363,12 @@ class acp_forums  			$db->sql_query($sql);  			// Add it back -			$forum_data['forum_id'] = $forum_id; +			$forum_data_ary['forum_id'] = $forum_id; -			add_log('admin', 'LOG_FORUM_EDIT', $forum_data['forum_name']); +			$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_EDIT', false, array($forum_data_ary['forum_name']));  		} +		$forum_data = $forum_data_ary;  		/**  		* Event after a forum was updated or created  		* @@ -1377,6 +1384,8 @@ class acp_forums  		*/  		$vars = array('forum_data', 'forum_data_sql', 'is_new_forum', 'errors');  		extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_update_data_after', compact($vars))); +		$forum_data_ary = $forum_data; +		unset($forum_data);  		return $errors;  	} @@ -1388,7 +1397,7 @@ class acp_forums  	{  		global $db, $user, $phpbb_dispatcher; -		$to_data = $moved_ids = $errors = array(); +		$errors = array();  		// Check if we want to move to a parent with link type  		if ($to_id > 0) @@ -1561,7 +1570,7 @@ class acp_forums  	*/  	function delete_forum($forum_id, $action_posts = 'delete', $action_subforums = 'delete', $posts_to_id = 0, $subforums_to_id = 0)  	{ -		global $db, $user, $cache; +		global $db, $user, $cache, $phpbb_log;  		$forum_data = $this->get_forum_info($forum_id); @@ -1758,39 +1767,39 @@ class acp_forums  		switch ($log_action)  		{  			case 'MOVE_POSTS_MOVE_FORUMS': -				add_log('admin', 'LOG_FORUM_DEL_MOVE_POSTS_MOVE_FORUMS', $posts_to_name, $subforums_to_name, $forum_data['forum_name']); +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_POSTS_MOVE_FORUMS', false, array($posts_to_name, $subforums_to_name, $forum_data['forum_name']));  			break;  			case 'MOVE_POSTS_FORUMS': -				add_log('admin', 'LOG_FORUM_DEL_MOVE_POSTS_FORUMS', $posts_to_name, $forum_data['forum_name']); +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_POSTS_FORUMS', false, array($posts_to_name, $forum_data['forum_name']));  			break;  			case 'POSTS_MOVE_FORUMS': -				add_log('admin', 'LOG_FORUM_DEL_POSTS_MOVE_FORUMS', $subforums_to_name, $forum_data['forum_name']); +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_POSTS_MOVE_FORUMS', false, array($subforums_to_name, $forum_data['forum_name']));  			break;  			case '_MOVE_FORUMS': -				add_log('admin', 'LOG_FORUM_DEL_MOVE_FORUMS', $subforums_to_name, $forum_data['forum_name']); +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_FORUMS', false, array($subforums_to_name, $forum_data['forum_name']));  			break;  			case 'MOVE_POSTS_': -				add_log('admin', 'LOG_FORUM_DEL_MOVE_POSTS', $posts_to_name, $forum_data['forum_name']); +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_POSTS', false, array($posts_to_name, $forum_data['forum_name']));  			break;  			case 'POSTS_FORUMS': -				add_log('admin', 'LOG_FORUM_DEL_POSTS_FORUMS', $forum_data['forum_name']); +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_POSTS_FORUMS', false, array($forum_data['forum_name']));  			break;  			case '_FORUMS': -				add_log('admin', 'LOG_FORUM_DEL_FORUMS', $forum_data['forum_name']); +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_FORUMS', false, array($forum_data['forum_name']));  			break;  			case 'POSTS_': -				add_log('admin', 'LOG_FORUM_DEL_POSTS', $forum_data['forum_name']); +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_POSTS', false, array($forum_data['forum_name']));  			break;  			default: -				add_log('admin', 'LOG_FORUM_DEL_FORUM', $forum_data['forum_name']); +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_FORUM', false, array($forum_data['forum_name']));  			break;  		} @@ -1802,7 +1811,7 @@ class acp_forums  	*/  	function delete_forum_content($forum_id)  	{ -		global $db, $config, $phpbb_root_path, $phpEx, $phpbb_dispatcher; +		global $db, $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher;  		include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); @@ -1823,7 +1832,10 @@ class acp_forums  		}  		$db->sql_freeresult($result); -		delete_attachments('topic', $topic_ids, false); +		/** @var \phpbb\attachment\manager $attachment_manager */ +		$attachment_manager = $phpbb_container->get('attachment.manager'); +		$attachment_manager->delete('topic', $topic_ids, false); +		unset($attachment_manager);  		// Delete shadow topics pointing to topics in this forum  		delete_topic_shadows($forum_id); @@ -1994,7 +2006,7 @@ class acp_forums  		$row = $db->sql_fetchrow($result);  		$db->sql_freeresult($result); -		set_config('num_posts', (int) $row['stat'], true); +		$config->set('num_posts', (int) $row['stat'], false);  		$sql = 'SELECT COUNT(topic_id) AS stat  			FROM ' . TOPICS_TABLE . ' @@ -2003,7 +2015,7 @@ class acp_forums  		$row = $db->sql_fetchrow($result);  		$db->sql_freeresult($result); -		set_config('num_topics', (int) $row['stat'], true); +		$config->set('num_topics', (int) $row['stat'], false);  		$sql = 'SELECT COUNT(attach_id) as stat  			FROM ' . ATTACHMENTS_TABLE; @@ -2011,7 +2023,7 @@ class acp_forums  		$row = $db->sql_fetchrow($result);  		$db->sql_freeresult($result); -		set_config('num_files', (int) $row['stat'], true); +		$config->set('num_files', (int) $row['stat'], false);  		$sql = 'SELECT SUM(filesize) as stat  			FROM ' . ATTACHMENTS_TABLE; @@ -2019,7 +2031,7 @@ class acp_forums  		$row = $db->sql_fetchrow($result);  		$db->sql_freeresult($result); -		set_config('upload_dir_size', (float) $row['stat'], true); +		$config->set('upload_dir_size', (float) $row['stat'], false);  		return array();  	} diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index 0352f6a242..305296d013 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -26,7 +26,7 @@ class acp_groups  	function main($id, $mode)  	{  		global $config, $db, $user, $auth, $template, $cache; -		global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads; +		global $phpbb_root_path, $phpbb_admin_path, $phpEx;  		global $request, $phpbb_container, $phpbb_dispatcher;  		$user->add_lang('acp/groups'); @@ -48,15 +48,18 @@ class acp_groups  		}  		// Check and set some common vars -		$action		= (isset($_POST['add'])) ? 'add' : ((isset($_POST['addusers'])) ? 'addusers' : request_var('action', '')); -		$group_id	= request_var('g', 0); -		$mark_ary	= request_var('mark', array(0)); -		$name_ary	= request_var('usernames', '', true); -		$leader		= request_var('leader', 0); -		$default	= request_var('default', 0); -		$start		= request_var('start', 0); +		$action		= (isset($_POST['add'])) ? 'add' : ((isset($_POST['addusers'])) ? 'addusers' : $request->variable('action', '')); +		$group_id	= $request->variable('g', 0); +		$mark_ary	= $request->variable('mark', array(0)); +		$name_ary	= $request->variable('usernames', '', true); +		$leader		= $request->variable('leader', 0); +		$default	= $request->variable('default', 0); +		$start		= $request->variable('start', 0);  		$update		= (isset($_POST['update'])) ? true : false; +		/** @var \phpbb\group\helper $group_helper */ +		$group_helper = $phpbb_container->get('group_helper'); +  		// Clear some vars  		$group_row = array(); @@ -101,7 +104,7 @@ class acp_groups  				}  				// Approve, demote or promote -				$group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; +				$group_name = $group_helper->get_name($group_row['group_name']);  				$error = group_user_attributes($action, $group_id, $mark_ary, false, $group_name);  				if (!$error) @@ -142,7 +145,7 @@ class acp_groups  				if (confirm_box(true))  				{ -					$group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; +					$group_name = $group_helper->get_name($group_row['group_name']);  					group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row);  					trigger_error($user->lang['GROUP_DEFS_UPDATED'] . adm_back_link($this->u_action . '&action=list&g=' . $group_id));  				} @@ -161,7 +164,7 @@ class acp_groups  			case 'set_default_on_all':  				if (confirm_box(true))  				{ -					$group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; +					$group_name = $group_helper->get_name($group_row['group_name']);  					$start = 0; @@ -220,6 +223,7 @@ class acp_groups  				}  				else if ($action === 'delete' && $group_row['group_type'] == GROUP_SPECIAL)  				{ +					send_status_line(403, 'Forbidden');  					trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);  				} @@ -232,6 +236,7 @@ class acp_groups  						case 'delete':  							if (!$auth->acl_get('a_groupdel'))  							{ +								send_status_line(403, 'Forbidden');  								trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);  							} @@ -239,7 +244,7 @@ class acp_groups  						break;  						case 'deleteusers': -							$group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; +							$group_name = $group_helper->get_name($group_row['group_name']);  							$error = group_user_del($group_id, $mark_ary, false, $group_name);  						break;  					} @@ -283,7 +288,7 @@ class acp_groups  				}  				$name_ary = array_unique(explode("\n", $name_ary)); -				$group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name']; +				$group_name = $group_helper->get_name($group_row['group_name']);  				// Add user/s to group  				if ($error = group_user_add($group_id, false, $name_ary, $group_name, $default, $leader, 0, $group_row)) @@ -303,8 +308,6 @@ class acp_groups  					include($phpbb_root_path . 'includes/functions_display.' . $phpEx);  				} -				$data = $submit_ary = array(); -  				if ($action == 'edit' && !$group_id)  				{  					trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING); @@ -312,6 +315,7 @@ class acp_groups  				if ($action == 'add' && !$auth->acl_get('a_groupadd'))  				{ +					send_status_line(403, 'Forbidden');  					trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);  				} @@ -369,24 +373,24 @@ class acp_groups  						trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);  					} -					$group_name	= utf8_normalize_nfc(request_var('group_name', '', true)); -					$group_desc = utf8_normalize_nfc(request_var('group_desc', '', true)); -					$group_type	= request_var('group_type', GROUP_FREE); +					$group_name	= $request->variable('group_name', '', true); +					$group_desc = $request->variable('group_desc', '', true); +					$group_type	= $request->variable('group_type', GROUP_FREE); -					$allow_desc_bbcode	= request_var('desc_parse_bbcode', false); -					$allow_desc_urls	= request_var('desc_parse_urls', false); -					$allow_desc_smilies	= request_var('desc_parse_smilies', false); +					$allow_desc_bbcode	= $request->variable('desc_parse_bbcode', false); +					$allow_desc_urls	= $request->variable('desc_parse_urls', false); +					$allow_desc_smilies	= $request->variable('desc_parse_smilies', false);  					$submit_ary = array( -						'colour'			=> request_var('group_colour', ''), -						'rank'				=> request_var('group_rank', 0), +						'colour'			=> $request->variable('group_colour', ''), +						'rank'				=> $request->variable('group_rank', 0),  						'receive_pm'		=> isset($_REQUEST['group_receive_pm']) ? 1 : 0,  						'legend'			=> isset($_REQUEST['group_legend']) ? 1 : 0,  						'teampage'			=> isset($_REQUEST['group_teampage']) ? 1 : 0, -						'message_limit'		=> request_var('group_message_limit', 0), -						'max_recipients'	=> request_var('group_max_recipients', 0), +						'message_limit'		=> $request->variable('group_message_limit', 0), +						'max_recipients'	=> $request->variable('group_max_recipients', 0),  						'founder_manage'	=> 0, -						'skip_auth'			=> request_var('group_skip_auth', 0), +						'skip_auth'			=> $request->variable('group_skip_auth', 0),  					);  					if ($user->data['user_type'] == USER_FOUNDER) @@ -555,7 +559,7 @@ class acp_groups  						if (!($error = group_create($group_id, $group_type, $group_name, $group_desc, $group_attributes, $allow_desc_bbcode, $allow_desc_urls, $allow_desc_smilies)))  						{ -							$group_perm_from = request_var('group_perm_from', 0); +							$group_perm_from = $request->variable('group_perm_from', 0);  							// Copy permissions?  							// If the user has the a_authgroups permission and at least one additional permission ability set the permissions are fully transferred. @@ -625,7 +629,7 @@ class acp_groups  				}  				else if (!$group_id)  				{ -					$group_name = utf8_normalize_nfc(request_var('group_name', '', true)); +					$group_name = $request->variable('group_name', '', true);  					$group_desc_data = array(  						'text'			=> '',  						'allow_bbcode'	=> true, @@ -710,12 +714,12 @@ class acp_groups  					$error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error));  				} -				$back_link = request_var('back_link', ''); +				$back_link = $request->variable('back_link', '');  				switch ($back_link)  				{  					case 'acp_users_groups': -						$u_back = append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=groups&u=' . request_var('u', 0)); +						$u_back = append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=groups&u=' . $request->variable('u', 0));  					break;  					default: @@ -734,7 +738,7 @@ class acp_groups  					'S_AVATARS_ENABLED'		=> ($config['allow_avatar'] && $avatars_enabled),  					'ERROR_MSG'				=> (sizeof($error)) ? implode('<br />', $error) : '', -					'GROUP_NAME'			=> ($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name, +					'GROUP_NAME'			=> $group_helper->get_name($group_name),  					'GROUP_INTERNAL_NAME'	=> $group_name,  					'GROUP_DESC'			=> $group_desc_data['text'],  					'GROUP_RECEIVE_PM'		=> (isset($group_row['group_receive_pm']) && $group_row['group_receive_pm']) ? ' checked="checked"' : '', @@ -816,8 +820,9 @@ class acp_groups  					trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);  				} -				$this->page_title = 'GROUP_MEMBERS'; +				/* @var $pagination \phpbb\pagination */  				$pagination = $phpbb_container->get('pagination'); +				$this->page_title = 'GROUP_MEMBERS';  				// Grab the leaders - always, on every page...  				$sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_regdate, u.user_colour, u.user_posts, u.group_id, ug.group_leader, ug.user_pending @@ -868,7 +873,7 @@ class acp_groups  					'S_GROUP_SPECIAL'	=> ($group_row['group_type'] == GROUP_SPECIAL) ? true : false,  					'S_ACTION_OPTIONS'	=> $s_action_options, -					'GROUP_NAME'	=> ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'], +					'GROUP_NAME'	=> $group_helper->get_name($group_row['group_name']),  					'U_ACTION'			=> $this->u_action . "&g=$group_id",  					'U_BACK'			=> $this->u_action, @@ -937,11 +942,12 @@ class acp_groups  			// used for easy access to the data within a group  			$cached_group_data[$type][$row['group_id']] = $row;  			$cached_group_data[$type][$row['group_id']]['total_members'] = 0; +			$cached_group_data[$type][$row['group_id']]['pending_members'] = 0;  		}  		$db->sql_freeresult($result);  		// How many people are in which group? -		$sql = 'SELECT COUNT(ug.user_id) AS total_members, ug.group_id +		$sql = 'SELECT COUNT(ug.user_id) AS total_members, SUM(ug.user_pending) AS pending_members, ug.group_id  			FROM ' . USER_GROUP_TABLE . ' ug  			WHERE ' . $db->sql_in_set('ug.group_id', array_keys($lookup)) . '  			GROUP BY ug.group_id'; @@ -951,6 +957,7 @@ class acp_groups  		{  			$type = $lookup[$row['group_id']];  			$cached_group_data[$type][$row['group_id']]['total_members'] = $row['total_members']; +			$cached_group_data[$type][$row['group_id']]['pending_members'] = $row['pending_members'];  		}  		$db->sql_freeresult($result); @@ -979,6 +986,7 @@ class acp_groups  					'GROUP_NAME'	=> $group_name,  					'TOTAL_MEMBERS'	=> $row['total_members'], +					'PENDING_MEMBERS' => $row['pending_members']  				));  			}  		} @@ -997,6 +1005,9 @@ class acp_groups  		$teampage_id = $request->variable('t', 0);  		$category_id = $request->variable('c', 0); +		/** @var \phpbb\group\helper $group_helper */ +		$group_helper = $phpbb_container->get('group_helper'); +  		if ($field && !in_array($field, array('legend', 'teampage')))  		{  			// Invalid mode @@ -1004,7 +1015,7 @@ class acp_groups  		}  		else if ($field && in_array($field, array('legend', 'teampage')))  		{ - +			/* @var $group_position \phpbb\groupposition\groupposition_interface */  			$group_position = $phpbb_container->get('groupposition.' . $field);  		} @@ -1096,10 +1107,9 @@ class acp_groups  			ORDER BY group_legend ASC, group_type DESC, group_name ASC';  		$result = $db->sql_query($sql); -		$s_group_select_legend = '';  		while ($row = $db->sql_fetchrow($result))  		{ -			$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; +			$group_name = $group_helper->get_name($row['group_name']);  			if ($row['group_legend'])  			{  				$template->assign_block_vars('legend', array( @@ -1134,7 +1144,6 @@ class acp_groups  			ORDER BY t.teampage_position ASC';  		$result = $db->sql_query($sql); -		$category_data = array();  		while ($row = $db->sql_fetchrow($result))  		{  			if ($row['teampage_id'] == $category_id) @@ -1147,7 +1156,7 @@ class acp_groups  			if ($row['group_id'])  			{ -				$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; +				$group_name = $group_helper->get_name($row['group_name']);  				$group_type = $user->lang[\phpbb\groupposition\teampage::group_type_language($row['group_type'])];  			}  			else @@ -1177,10 +1186,9 @@ class acp_groups  			ORDER BY g.group_type DESC, g.group_name ASC';  		$result = $db->sql_query($sql); -		$s_group_select_teampage = '';  		while ($row = $db->sql_fetchrow($result))  		{ -			$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; +			$group_name = $group_helper->get_name($row['group_name']);  			$template->assign_block_vars('add_teampage', array(  				'GROUP_ID'		=> (int) $row['group_id'],  				'GROUP_NAME'	=> $group_name, diff --git a/phpBB/includes/acp/acp_help_phpbb.php b/phpBB/includes/acp/acp_help_phpbb.php new file mode 100644 index 0000000000..7991a0dad6 --- /dev/null +++ b/phpBB/includes/acp/acp_help_phpbb.php @@ -0,0 +1,143 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ +	exit; +} + +class acp_help_phpbb +{ +	var $u_action; + +	function main($id, $mode) +	{ +		global $config, $request, $template, $user, $phpbb_dispatcher, $phpbb_admin_path, $phpbb_root_path, $phpEx; + +		if (!class_exists('phpbb_questionnaire_data_collector')) +		{ +			include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx); +		} + +		$collect_url = "https://www.phpbb.com/stats/receive_stats.php"; + +		$this->tpl_name = 'acp_help_phpbb'; +		$this->page_title = 'ACP_HELP_PHPBB'; + +		$submit = ($request->is_set_post('submit')) ? true : false; + +		$form_key = 'acp_help_phpbb'; +		add_form_key($form_key); +		$error = array(); + +		if ($submit && !check_form_key($form_key)) +		{ +			$error[] = $user->lang['FORM_INVALID']; +		} +		// Do not write values if there is an error +		if (sizeof($error)) +		{ +			$submit = false; +		} + +		// generate a unique id if necessary +		if (!isset($config['questionnaire_unique_id'])) +		{ +			$install_id = unique_id(); +			$config->set('questionnaire_unique_id', $install_id); +		} +		else +		{ +			$install_id = $config['questionnaire_unique_id']; +		} + +		$collector = new phpbb_questionnaire_data_collector($install_id); + +		// Add data provider +		$collector->add_data_provider(new phpbb_questionnaire_php_data_provider()); +		$collector->add_data_provider(new phpbb_questionnaire_system_data_provider()); +		$collector->add_data_provider(new phpbb_questionnaire_phpbb_data_provider($config)); + +		/** +		 * Event to modify ACP help phpBB page and/or listen to submit +		 * +		 * @event core.acp_help_phpbb_submit_before +		 * @var	boolean	submit			Do we display the form or process the submission +		 * @since 3.2.0-RC2 +		 */ +		$vars = array('submit'); +		extract($phpbb_dispatcher->trigger_event('core.acp_help_phpbb_submit_before', compact($vars))); + +		if ($submit) +		{ +			$config->set('help_send_statistics', $request->variable('help_send_statistics', false)); +			$response = $request->variable('send_statistics_response', ''); + +			$config->set('help_send_statistics_time', time()); + +			if (!empty($response)) +			{ +				if ((strpos($response, 'Thank you') !== false || strpos($response, 'Flood protection') !== false)) +				{ +					trigger_error($user->lang('THANKS_SEND_STATISTICS') . adm_back_link($this->u_action)); +				} +				else +				{ +					trigger_error($user->lang('FAIL_SEND_STATISTICS') . adm_back_link($this->u_action)); +				} +			} + +			trigger_error($user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action)); +		} + +		$template->assign_vars(array( +			'U_COLLECT_STATS'		=> $collect_url, +			'S_COLLECT_STATS'		=> (!empty($config['help_send_statistics'])) ? true : false, +			'RAW_DATA'				=> $collector->get_data_for_form(), +			'U_ACP_MAIN'			=> append_sid("{$phpbb_admin_path}index.$phpEx"), +			'U_ACTION'				=> $this->u_action, +			// Pass earliest time we should try to send stats again +			'COLLECT_STATS_TIME'	=> intval($config['help_send_statistics_time']) + 86400, +		)); + +		$raw = $collector->get_data_raw(); + +		foreach ($raw as $provider => $data) +		{ +			if ($provider == 'install_id') +			{ +				$data = array($provider => $data); +			} + +			$template->assign_block_vars('providers', array( +				'NAME'	=> htmlspecialchars($provider), +			)); + +			foreach ($data as $key => $value) +			{ +				if (is_array($value)) +				{ +					$value = utf8_wordwrap(serialize($value), 75, "\n", true); +				} + +				$template->assign_block_vars('providers.values', array( +					'KEY'	=> utf8_htmlspecialchars($key), +					'VALUE'	=> utf8_htmlspecialchars($value), +				)); +			} +		} +	} +} diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index a0ea7dc9b1..6cd5386857 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -28,18 +28,18 @@ class acp_icons  	function main($id, $mode)  	{ -		global $db, $user, $auth, $template, $cache; -		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; +		global $db, $user, $template, $cache; +		global $config, $phpbb_root_path;  		global $request, $phpbb_container;  		$user->add_lang('acp/posting');  		// Set up general vars -		$action = request_var('action', ''); +		$action = $request->variable('action', '');  		$action = (isset($_POST['add'])) ? 'add' : $action;  		$action = (isset($_POST['edit'])) ? 'edit' : $action;  		$action = (isset($_POST['import'])) ? 'import' : $action; -		$icon_id = request_var('id', 0); +		$icon_id = $request->variable('id', 0);  		$submit = $request->is_set_post('submit', false);  		$form_key = 'acp_icons'; @@ -198,7 +198,6 @@ class acp_icons  				$data = array();  				$after = false; -				$display = 0;  				$order_lists = array('', '');  				$add_order_lists = array('', '');  				$display_count = 0; @@ -213,7 +212,6 @@ class acp_icons  					if ($row[$fields . '_id'] == $icon_id)  					{  						$after = true; -						$display = $row['display_on_posting'];  						$data[$row[$fields . '_url']] = $row;  					}  					else @@ -252,7 +250,7 @@ class acp_icons  					$data = $_images;  				} -				$colspan = (($mode == 'smilies') ? 7 : 5); +				$colspan = (($mode == 'smilies') ? 7 : 6);  				$colspan += ($icon_id) ? 1 : 0;  				$colspan += ($action == 'add') ? 2 : 0; @@ -296,6 +294,8 @@ class acp_icons  						'ID'				=> (isset($img_row[$fields . '_id'])) ? $img_row[$fields . '_id'] : 0,  						'WIDTH'				=> (!empty($img_row[$fields .'_width'])) ? $img_row[$fields .'_width'] : $img_row['width'],  						'HEIGHT'			=> (!empty($img_row[$fields .'_height'])) ? $img_row[$fields .'_height'] : $img_row['height'], +						'TEXT_ALT'		    => ($mode == 'icons' && !empty($img_row['icons_alt'])) ? $img_row['icons_alt'] : $img, +						'ALT'			    => ($mode == 'icons' && !empty($img_row['icons_alt'])) ? $img_row['icons_alt'] : '',  						'POSTING_CHECKED'	=> (!empty($img_row['display_on_posting']) || $action == 'add') ? ' checked="checked"' : '',  					));  				} @@ -335,24 +335,25 @@ class acp_icons  				}  				// Get items to create/modify -				$images = (isset($_POST['image'])) ? array_keys(request_var('image', array('' => 0))) : array(); +				$images = (isset($_POST['image'])) ? array_keys($request->variable('image', array('' => 0))) : array();  				// Now really get the items -				$image_id		= (isset($_POST['id'])) ? request_var('id', array('' => 0)) : array(); -				$image_order	= (isset($_POST['order'])) ? request_var('order', array('' => 0)) : array(); -				$image_width	= (isset($_POST['width'])) ? request_var('width', array('' => 0)) : array(); -				$image_height	= (isset($_POST['height'])) ? request_var('height', array('' => 0)) : array(); -				$image_add		= (isset($_POST['add_img'])) ? request_var('add_img', array('' => 0)) : array(); -				$image_emotion	= utf8_normalize_nfc(request_var('emotion', array('' => ''), true)); -				$image_code		= utf8_normalize_nfc(request_var('code', array('' => ''), true)); -				$image_display_on_posting = (isset($_POST['display_on_posting'])) ? request_var('display_on_posting', array('' => 0)) : array(); +				$image_id		= (isset($_POST['id'])) ? $request->variable('id', array('' => 0)) : array(); +				$image_order	= (isset($_POST['order'])) ? $request->variable('order', array('' => 0)) : array(); +				$image_width	= (isset($_POST['width'])) ? $request->variable('width', array('' => 0)) : array(); +				$image_height	= (isset($_POST['height'])) ? $request->variable('height', array('' => 0)) : array(); +				$image_add		= (isset($_POST['add_img'])) ? $request->variable('add_img', array('' => 0)) : array(); +				$image_emotion	= $request->variable('emotion', array('' => ''), true); +				$image_code		= $request->variable('code', array('' => ''), true); +				$image_alt		= ($request->is_set_post('alt')) ? $request->variable('alt', array('' => ''), true) : array(); +				$image_display_on_posting = (isset($_POST['display_on_posting'])) ? $request->variable('display_on_posting', array('' => 0)) : array();  				// Ok, add the relevant bits if we are adding new codes to existing emoticons...  				if ($request->variable('add_additional_code', false, false, \phpbb\request\request_interface::POST))  				{ -					$add_image			= request_var('add_image', ''); -					$add_code			= utf8_normalize_nfc(request_var('add_code', '', true)); -					$add_emotion		= utf8_normalize_nfc(request_var('add_emotion', '', true)); +					$add_image			= $request->variable('add_image', ''); +					$add_code			= $request->variable('add_code', '', true); +					$add_emotion		= $request->variable('add_emotion', '', true);  					if ($add_image && $add_emotion && $add_code)  					{ @@ -361,15 +362,15 @@ class acp_icons  						$image_code[$add_image] = $add_code;  						$image_emotion[$add_image] = $add_emotion; -						$image_width[$add_image] = request_var('add_width', 0); -						$image_height[$add_image] = request_var('add_height', 0); +						$image_width[$add_image] = $request->variable('add_width', 0); +						$image_height[$add_image] = $request->variable('add_height', 0);  						if ($request->variable('add_display_on_posting', false, false, \phpbb\request\request_interface::POST))  						{  							$image_display_on_posting[$add_image] = 1;  						} -						$image_order[$add_image] = request_var('add_order', 0); +						$image_order[$add_image] = $request->variable('add_order', 0);  					}  				} @@ -447,6 +448,13 @@ class acp_icons  							);  						} +						if ($mode == 'icons') +						{ +							$img_sql = array_merge($img_sql, array( +								'icons_alt'	=> $image_alt[$image]) +							); +						} +  						// Image_order holds the 'new' order value  						if (!empty($image_order[$image]))  						{ @@ -495,6 +503,7 @@ class acp_icons  				$cache->destroy('_icons');  				$cache->destroy('sql', $table); +				$phpbb_container->get('text_formatter.cache')->invalidate();  				$level = ($icons_updated) ? E_USER_NOTICE : E_USER_WARNING;  				$errormsgs = ''; @@ -515,8 +524,8 @@ class acp_icons  			case 'import': -				$pak = request_var('pak', ''); -				$current = request_var('current', ''); +				$pak = $request->variable('pak', ''); +				$current = $request->variable('current', '');  				if ($pak != '')  				{ @@ -554,7 +563,6 @@ class acp_icons  					{  						switch ($db->get_sql_layer())  						{ -							case 'sqlite':  							case 'sqlite3':  								$db->sql_query('DELETE FROM ' . $table);  							break; @@ -675,6 +683,7 @@ class acp_icons  					$cache->destroy('_icons');  					$cache->destroy('sql', $table); +					$phpbb_container->get('text_formatter.cache')->invalidate();  					trigger_error($user->lang[$lang . '_IMPORT_SUCCESS'] . adm_back_link($this->u_action));  				} @@ -802,6 +811,7 @@ class acp_icons  					$cache->destroy('_icons');  					$cache->destroy('sql', $table); +					$phpbb_container->get('text_formatter.cache')->invalidate();  					if ($request->is_ajax())  					{ @@ -872,6 +882,7 @@ class acp_icons  				$cache->destroy('_icons');  				$cache->destroy('sql', $table); +				$phpbb_container->get('text_formatter.cache')->invalidate();  				if ($request->is_ajax())  				{ @@ -927,9 +938,10 @@ class acp_icons  			)  		); -		$spacer = false; +		/* @var $pagination \phpbb\pagination */  		$pagination = $phpbb_container->get('pagination'); -		$pagination_start = request_var('start', 0); +		$pagination_start = $request->variable('start', 0); +		$spacer = false;  		$item_count = $this->item_count($table); @@ -940,7 +952,7 @@ class acp_icons  		while ($row = $db->sql_fetchrow($result))  		{ -			$alt_text = ($mode == 'smilies') ? $row['code'] : ''; +			$alt_text = ($mode == 'smilies') ? $row['code'] : (($mode == 'icons' && !empty($row['icons_alt'])) ? $row['icons_alt'] : $row['icons_url']);  			$template->assign_block_vars('items', array(  				'S_SPACER'		=> (!$spacer && !$row['display_on_posting']) ? true : false, diff --git a/phpBB/includes/acp/acp_inactive.php b/phpBB/includes/acp/acp_inactive.php index 76c7a1b277..ec256e93ef 100644 --- a/phpBB/includes/acp/acp_inactive.php +++ b/phpBB/includes/acp/acp_inactive.php @@ -31,8 +31,8 @@ class acp_inactive  	function main($id, $mode)  	{ -		global $config, $db, $user, $auth, $template, $phpbb_container; -		global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; +		global $config, $db, $user, $auth, $template, $phpbb_container, $phpbb_log, $request; +		global $phpbb_root_path, $phpbb_admin_path, $phpEx;  		if (!function_exists('user_active_flip'))  		{ @@ -41,24 +41,26 @@ class acp_inactive  		$user->add_lang('memberlist'); -		$action = request_var('action', ''); -		$mark	= (isset($_REQUEST['mark'])) ? request_var('mark', array(0)) : array(); -		$start	= request_var('start', 0); +		$action = $request->variable('action', ''); +		$mark	= (isset($_REQUEST['mark'])) ? $request->variable('mark', array(0)) : array(); +		$start	= $request->variable('start', 0);  		$submit = isset($_POST['submit']);  		// Sort keys -		$sort_days	= request_var('st', 0); -		$sort_key	= request_var('sk', 'i'); -		$sort_dir	= request_var('sd', 'd'); +		$sort_days	= $request->variable('st', 0); +		$sort_key	= $request->variable('sk', 'i'); +		$sort_dir	= $request->variable('sd', 'd');  		$form_key = 'acp_inactive';  		add_form_key($form_key); + +		/* @var $pagination \phpbb\pagination */  		$pagination = $phpbb_container->get('pagination');  		// We build the sort key and per page settings here, because they may be needed later  		// Number of entries to display -		$per_page = request_var('users_per_page', (int) $config['topics_per_page']); +		$per_page = $request->variable('users_per_page', (int) $config['topics_per_page']);  		// Sorting  		$limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); @@ -141,8 +143,10 @@ class acp_inactive  						{  							foreach ($inactive_users as $row)  							{ -								add_log('admin', 'LOG_USER_ACTIVE', $row['username']); -								add_log('user', $row['user_id'], 'LOG_USER_ACTIVE_USER'); +								$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_ACTIVE', false, array($row['username'])); +								$phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_ACTIVE_USER', false, array( +									'reportee_id' => $row['user_id'] +								));  							}  							trigger_error(sprintf($user->lang['LOG_INACTIVE_ACTIVATE'], implode($user->lang['COMMA_SEPARATOR'], $user_affected) . ' ' . adm_back_link($this->u_action))); @@ -160,12 +164,13 @@ class acp_inactive  						{  							if (!$auth->acl_get('a_userdel'))  							{ +								send_status_line(403, 'Forbidden');  								trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);  							}  							user_delete('retain', $mark, true); -							add_log('admin', 'LOG_INACTIVE_' . strtoupper($action), implode(', ', $user_affected)); +							$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_INACTIVE_' . strtoupper($action), false, array(implode(', ', $user_affected)));  							trigger_error(sprintf($user->lang['LOG_INACTIVE_DELETE'], implode($user->lang['COMMA_SEPARATOR'], $user_affected) . ' ' . adm_back_link($this->u_action)));  						} @@ -240,7 +245,7 @@ class acp_inactive  							WHERE ' . $db->sql_in_set('user_id', $user_ids);  						$db->sql_query($sql); -						add_log('admin', 'LOG_INACTIVE_REMIND', implode(', ', $usernames)); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_INACTIVE_REMIND', false, array(implode(', ', $usernames)));  						trigger_error(sprintf($user->lang['LOG_INACTIVE_REMIND'], implode($user->lang['COMMA_SEPARATOR'], $usernames) . ' ' . adm_back_link($this->u_action)));  					} diff --git a/phpBB/includes/acp/acp_jabber.php b/phpBB/includes/acp/acp_jabber.php index 3b958c0ea1..07f5dadbff 100644 --- a/phpBB/includes/acp/acp_jabber.php +++ b/phpBB/includes/acp/acp_jabber.php @@ -29,8 +29,8 @@ class acp_jabber  	function main($id, $mode)  	{ -		global $db, $user, $auth, $template; -		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; +		global $db, $user, $template, $phpbb_log, $request; +		global $config, $phpbb_root_path, $phpEx;  		$user->add_lang('acp/board'); @@ -39,7 +39,6 @@ class acp_jabber  			include($phpbb_root_path . 'includes/functions_jabber.' . $phpEx);  		} -		$action	= request_var('action', '');  		$submit = (isset($_POST['submit'])) ? true : false;  		if ($mode != 'settings') @@ -50,16 +49,16 @@ class acp_jabber  		$this->tpl_name = 'acp_jabber';  		$this->page_title = 'ACP_JABBER_SETTINGS'; -		$jab_enable				= request_var('jab_enable',				(bool) $config['jab_enable']); -		$jab_host				= request_var('jab_host',				(string) $config['jab_host']); -		$jab_port				= request_var('jab_port',				(int) $config['jab_port']); -		$jab_username			= request_var('jab_username',			(string) $config['jab_username']); -		$jab_password			= request_var('jab_password',			(string) $config['jab_password']); -		$jab_package_size		= request_var('jab_package_size',		(int) $config['jab_package_size']); -		$jab_use_ssl			= request_var('jab_use_ssl',			(bool) $config['jab_use_ssl']); -		$jab_verify_peer		= request_var('jab_verify_peer',		(bool) $config['jab_verify_peer']); -		$jab_verify_peer_name	= request_var('jab_verify_peer_name',	(bool) $config['jab_verify_peer_name']); -		$jab_allow_self_signed	= request_var('jab_allow_self_signed',	(bool) $config['jab_allow_self_signed']); +		$jab_enable				= $request->variable('jab_enable',			(bool) $config['jab_enable']); +		$jab_host				= $request->variable('jab_host',			(string) $config['jab_host']); +		$jab_port				= $request->variable('jab_port',			(int) $config['jab_port']); +		$jab_username			= $request->variable('jab_username',		(string) $config['jab_username']); +		$jab_password			= $request->variable('jab_password',		(string) $config['jab_password']); +		$jab_package_size		= $request->variable('jab_package_size',	(int) $config['jab_package_size']); +		$jab_use_ssl			= $request->variable('jab_use_ssl',		(bool) $config['jab_use_ssl']); +		$jab_verify_peer		= $request->variable('jab_verify_peer',		(bool) $config['jab_verify_peer']); +		$jab_verify_peer_name	= $request->variable('jab_verify_peer_name',	(bool) $config['jab_verify_peer_name']); +		$jab_allow_self_signed	= $request->variable('jab_allow_self_signed',	(bool) $config['jab_allow_self_signed']);  		$form_name = 'acp_jabber';  		add_form_key($form_name); @@ -71,8 +70,6 @@ class acp_jabber  				trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING);  			} -			$error = array(); -  			$message = $user->lang['JAB_SETTINGS_CHANGED'];  			$log = 'JAB_SETTINGS_CHANGED'; @@ -109,21 +106,21 @@ class acp_jabber  				$db->sql_query($sql);  			} -			set_config('jab_enable', $jab_enable); -			set_config('jab_host', $jab_host); -			set_config('jab_port', $jab_port); -			set_config('jab_username', $jab_username); +			$config->set('jab_enable', $jab_enable); +			$config->set('jab_host', $jab_host); +			$config->set('jab_port', $jab_port); +			$config->set('jab_username', $jab_username);  			if ($jab_password !== '********')  			{ -				set_config('jab_password', $jab_password); +				$config->set('jab_password', $jab_password);  			} -			set_config('jab_package_size', $jab_package_size); -			set_config('jab_use_ssl', $jab_use_ssl); -			set_config('jab_verify_peer', $jab_verify_peer); -			set_config('jab_verify_peer_name', $jab_verify_peer_name); -			set_config('jab_allow_self_signed', $jab_allow_self_signed); +			$config->set('jab_package_size', $jab_package_size); +			$config->set('jab_use_ssl', $jab_use_ssl); +			$config->set('jab_verify_peer', $jab_verify_peer); +			$config->set('jab_verify_peer_name', $jab_verify_peer_name); +			$config->set('jab_allow_self_signed', $jab_allow_self_signed); -			add_log('admin', 'LOG_' . $log); +			$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_' . $log);  			trigger_error($message . adm_back_link($this->u_action));  		} diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index bddc2be9cb..4baff921b6 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -31,7 +31,7 @@ class acp_language  	function main($id, $mode)  	{ -		global $config, $db, $user, $template; +		global $config, $db, $user, $template, $phpbb_log, $phpbb_container;  		global $phpbb_root_path, $phpEx, $request;  		if (!function_exists('validate_language_iso_name')) @@ -44,14 +44,14 @@ class acp_language  		$action		= (isset($_POST['remove_store'])) ? 'details' : $action;  		$submit = (empty($action) && !isset($_POST['update']) && !isset($_POST['test_connection'])) ? false : true; -		$action = (empty($action)) ? request_var('action', '') : $action; +		$action = (empty($action)) ? $request->variable('action', '') : $action;  		$form_name = 'acp_lang';  		add_form_key('acp_lang'); -		$lang_id = request_var('id', 0); +		$lang_id = $request->variable('id', 0); -		$selected_lang_file = request_var('language_file', '|common.' . $phpEx); +		$selected_lang_file = $request->variable('language_file', '|common.' . $phpEx);  		list($this->language_directory, $this->language_file) = explode('|', $selected_lang_file); @@ -84,16 +84,16 @@ class acp_language  				$db->sql_freeresult($result);  				$sql_ary	= array( -					'lang_english_name'		=> request_var('lang_english_name', $row['lang_english_name']), -					'lang_local_name'		=> utf8_normalize_nfc(request_var('lang_local_name', $row['lang_local_name'], true)), -					'lang_author'			=> utf8_normalize_nfc(request_var('lang_author', $row['lang_author'], true)), +					'lang_english_name'		=> $request->variable('lang_english_name', $row['lang_english_name']), +					'lang_local_name'		=> $request->variable('lang_local_name', $row['lang_local_name'], true), +					'lang_author'			=> $request->variable('lang_author', $row['lang_author'], true),  				);  				$db->sql_query('UPDATE ' . LANG_TABLE . '  					SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '  					WHERE lang_id = ' . $lang_id); -				add_log('admin', 'LOG_LANGUAGE_PACK_UPDATED', $sql_ary['lang_english_name']); +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_LANGUAGE_PACK_UPDATED', false, array($sql_ary['lang_english_name']));  				trigger_error($user->lang['LANGUAGE_DETAILS_UPDATED'] . adm_back_link($this->u_action));  			break; @@ -227,7 +227,7 @@ class acp_language  					$sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . ' WHERE lang_id = ' . $lang_id;  					$db->sql_query($sql); -					add_log('admin', 'LOG_LANGUAGE_PACK_DELETED', $row['lang_english_name']); +					$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_LANGUAGE_PACK_DELETED', false, array($row['lang_english_name']));  					trigger_error(sprintf($user->lang['LANGUAGE_PACK_DELETED'], $row['lang_english_name']) . adm_back_link($this->u_action));  				} @@ -249,7 +249,7 @@ class acp_language  					trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);  				} -				$lang_iso = request_var('iso', ''); +				$lang_iso = $request->variable('iso', '');  				$lang_iso = basename($lang_iso);  				if (!$lang_iso || !file_exists("{$phpbb_root_path}language/$lang_iso/iso.txt")) @@ -337,7 +337,7 @@ class acp_language  				}  				$db->sql_freeresult($result); -				add_log('admin', 'LOG_LANGUAGE_PACK_INSTALLED', $lang_pack['name']); +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_LANGUAGE_PACK_INSTALLED', false, array($lang_pack['name']));  				$message = sprintf($user->lang['LANGUAGE_PACK_INSTALLED'], $lang_pack['name']);  				$message .= ($notify_cpf_update) ? '<br /><br />' . $user->lang['LANGUAGE_PACK_CPF_UPDATE'] : ''; @@ -385,37 +385,19 @@ class acp_language  		$db->sql_freeresult($result);  		$new_ary = $iso = array(); -		$dp = @opendir("{$phpbb_root_path}language"); -		if ($dp) +		/** @var \phpbb\language\language_file_helper $language_helper */ +		$language_helper = $phpbb_container->get('language.helper.language_file'); +		$iso = $language_helper->get_available_languages(); + +		foreach ($iso as $lang_array)  		{ -			while (($file = readdir($dp)) !== false) -			{ -				if ($file[0] == '.' || !is_dir($phpbb_root_path . 'language/' . $file)) -				{ -					continue; -				} +			$lang_iso = $lang_array['iso']; -				if (file_exists("{$phpbb_root_path}language/$file/iso.txt")) -				{ -					if (!in_array($file, $installed)) -					{ -						if ($iso = file("{$phpbb_root_path}language/$file/iso.txt")) -						{ -							if (sizeof($iso) == 3) -							{ -								$new_ary[$file] = array( -									'iso'		=> $file, -									'name'		=> trim($iso[0]), -									'local_name'=> trim($iso[1]), -									'author'	=> trim($iso[2]) -								); -							} -						} -					} -				} +			if (!in_array($lang_iso, $installed)) +			{ +				$new_ary[$lang_iso] = $lang_array;  			} -			closedir($dp);  		}  		unset($installed); diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php index 80dee1d620..c33ca8c4fc 100644 --- a/phpBB/includes/acp/acp_logs.php +++ b/phpBB/includes/acp/acp_logs.php @@ -25,28 +25,29 @@ class acp_logs  	function main($id, $mode)  	{ -		global $db, $user, $auth, $template, $cache, $phpbb_container; -		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; +		global $user, $auth, $template, $phpbb_container; +		global $config;  		global $request;  		$user->add_lang('mcp');  		// Set up general vars -		$action		= request_var('action', ''); -		$forum_id	= request_var('f', 0); -		$topic_id	= request_var('t', 0); -		$start		= request_var('start', 0); +		$action		= $request->variable('action', ''); +		$forum_id	= $request->variable('f', 0); +		$start		= $request->variable('start', 0);  		$deletemark = $request->variable('delmarked', false, false, \phpbb\request\request_interface::POST);  		$deleteall	= $request->variable('delall', false, false, \phpbb\request\request_interface::POST); -		$marked		= request_var('mark', array(0)); +		$marked		= $request->variable('mark', array(0));  		// Sort keys -		$sort_days	= request_var('st', 0); -		$sort_key	= request_var('sk', 't'); -		$sort_dir	= request_var('sd', 'd'); +		$sort_days	= $request->variable('st', 0); +		$sort_key	= $request->variable('sk', 't'); +		$sort_dir	= $request->variable('sd', 'd');  		$this->tpl_name = 'acp_logs';  		$this->log_type = constant('LOG_' . strtoupper($mode)); + +		/* @var $pagination \phpbb\pagination */  		$pagination = $phpbb_container->get('pagination');  		// Delete entries if requested and able @@ -68,10 +69,11 @@ class acp_logs  						$conditions['log_time'] = array('>=', time() - ($sort_days * 86400));  					} -					$keywords = utf8_normalize_nfc(request_var('keywords', '', true)); +					$keywords = $request->variable('keywords', '', true);  					$conditions['keywords'] = $keywords;  				} +				/* @var $phpbb_log \phpbb\log\log_interface */  				$phpbb_log = $phpbb_container->get('log');  				$phpbb_log->delete($mode, $conditions);  			} @@ -105,7 +107,7 @@ class acp_logs  		$sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0;  		$sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); -		$keywords = utf8_normalize_nfc(request_var('keywords', '', true)); +		$keywords = $request->variable('keywords', '', true);  		$keywords_param = !empty($keywords) ? '&keywords=' . urlencode(htmlspecialchars_decode($keywords)) : '';  		$l_title = $user->lang['ACP_' . strtoupper($mode) . '_LOGS']; diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 6e7bd91a86..9b1a248923 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -25,8 +25,8 @@ class acp_main  	function main($id, $mode)  	{ -		global $config, $db, $cache, $user, $auth, $template, $request; -		global $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container, $phpbb_dispatcher; +		global $config, $db, $cache, $user, $auth, $template, $request, $phpbb_log; +		global $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container, $phpbb_dispatcher, $phpbb_filesystem;  		// Show restore permissions notice  		if ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm')) @@ -53,7 +53,7 @@ class acp_main  			return;  		} -		$action = request_var('action', ''); +		$action = $request->variable('action', '');  		if ($action)  		{ @@ -118,12 +118,13 @@ class acp_main  					case 'online':  						if (!$auth->acl_get('a_board'))  						{ +							send_status_line(403, 'Forbidden');  							trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);  						} -						set_config('record_online_users', 1, true); -						set_config('record_online_date', time(), true); -						add_log('admin', 'LOG_RESET_ONLINE'); +						$config->set('record_online_users', 1, false); +						$config->set('record_online_date', time(), false); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESET_ONLINE');  						if ($request->is_ajax())  						{ @@ -134,6 +135,7 @@ class acp_main  					case 'stats':  						if (!$auth->acl_get('a_board'))  						{ +							send_status_line(403, 'Forbidden');  							trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);  						} @@ -141,35 +143,35 @@ class acp_main  							FROM ' . POSTS_TABLE . '  							WHERE post_visibility = ' . ITEM_APPROVED;  						$result = $db->sql_query($sql); -						set_config('num_posts', (int) $db->sql_fetchfield('stat'), true); +						$config->set('num_posts', (int) $db->sql_fetchfield('stat'), false);  						$db->sql_freeresult($result);  						$sql = 'SELECT COUNT(topic_id) AS stat  							FROM ' . TOPICS_TABLE . '  							WHERE topic_visibility = ' . ITEM_APPROVED;  						$result = $db->sql_query($sql); -						set_config('num_topics', (int) $db->sql_fetchfield('stat'), true); +						$config->set('num_topics', (int) $db->sql_fetchfield('stat'), false);  						$db->sql_freeresult($result);  						$sql = 'SELECT COUNT(user_id) AS stat  							FROM ' . USERS_TABLE . '  							WHERE user_type IN (' . USER_NORMAL . ',' . USER_FOUNDER . ')';  						$result = $db->sql_query($sql); -						set_config('num_users', (int) $db->sql_fetchfield('stat'), true); +						$config->set('num_users', (int) $db->sql_fetchfield('stat'), false);  						$db->sql_freeresult($result);  						$sql = 'SELECT COUNT(attach_id) as stat  							FROM ' . ATTACHMENTS_TABLE . '  							WHERE is_orphan = 0';  						$result = $db->sql_query($sql); -						set_config('num_files', (int) $db->sql_fetchfield('stat'), true); +						$config->set('num_files', (int) $db->sql_fetchfield('stat'), false);  						$db->sql_freeresult($result);  						$sql = 'SELECT SUM(filesize) as stat  							FROM ' . ATTACHMENTS_TABLE . '  							WHERE is_orphan = 0';  						$result = $db->sql_query($sql); -						set_config('upload_dir_size', (float) $db->sql_fetchfield('stat'), true); +						$config->set('upload_dir_size', (float) $db->sql_fetchfield('stat'), false);  						$db->sql_freeresult($result);  						if (!function_exists('update_last_username')) @@ -178,7 +180,7 @@ class acp_main  						}  						update_last_username(); -						add_log('admin', 'LOG_RESYNC_STATS'); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_STATS');  						if ($request->is_ajax())  						{ @@ -189,6 +191,7 @@ class acp_main  					case 'user':  						if (!$auth->acl_get('a_board'))  						{ +							send_status_line(403, 'Forbidden');  							trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);  						} @@ -215,7 +218,7 @@ class acp_main  						// Still no maximum post id? Then we are finished  						if (!$max_post_id)  						{ -							add_log('admin', 'LOG_RESYNC_POSTCOUNTS'); +							$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_POSTCOUNTS');  							break;  						} @@ -245,7 +248,7 @@ class acp_main  							$start += $step;  						} -						add_log('admin', 'LOG_RESYNC_POSTCOUNTS'); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_POSTCOUNTS');  						if ($request->is_ajax())  						{ @@ -256,11 +259,12 @@ class acp_main  					case 'date':  						if (!$auth->acl_get('a_board'))  						{ +							send_status_line(403, 'Forbidden');  							trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);  						} -						set_config('board_startdate', time() - 1); -						add_log('admin', 'LOG_RESET_DATE'); +						$config->set('board_startdate', time() - 1); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESET_DATE');  						if ($request->is_ajax())  						{ @@ -271,7 +275,6 @@ class acp_main  					case 'db_track':  						switch ($db->get_sql_layer())  						{ -							case 'sqlite':  							case 'sqlite3':  								$db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE);  							break; @@ -340,7 +343,7 @@ class acp_main  							}  						} -						add_log('admin', 'LOG_RESYNC_POST_MARKING'); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_POST_MARKING');  						if ($request->is_ajax())  						{ @@ -352,11 +355,16 @@ class acp_main  						$config->increment('assets_version', 1);  						$cache->purge(); +						// Remove old renderers from the text_formatter service. Since this +						// operation is performed after the cache is purged, there is not "current" +						// renderer and in effect all renderers will be purged +						$phpbb_container->get('text_formatter.cache')->tidy(); +  						// Clear permissions  						$auth->acl_clear_prefetch();  						phpbb_cache_moderators($db, $cache, $auth); -						add_log('admin', 'LOG_PURGE_CACHE'); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PURGE_CACHE');  						if ($request->is_ajax())  						{ @@ -367,6 +375,7 @@ class acp_main  					case 'purge_sessions':  						if ((int) $user->data['user_type'] !== USER_FOUNDER)  						{ +							send_status_line(403, 'Forbidden');  							trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);  						} @@ -376,7 +385,6 @@ class acp_main  						{  							switch ($db->get_sql_layer())  							{ -								case 'sqlite':  								case 'sqlite3':  									$db->sql_query("DELETE FROM $table");  								break; @@ -407,7 +415,7 @@ class acp_main  						$sql = 'INSERT INTO ' . SESSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $reinsert_ary);  						$db->sql_query($sql); -						add_log('admin', 'LOG_PURGE_SESSIONS'); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PURGE_SESSIONS');  						if ($request->is_ajax())  						{ @@ -431,7 +439,6 @@ class acp_main  		if ($auth->acl_get('a_board'))  		{ -			/** @var \phpbb\version_helper $version_helper */  			$version_helper = $phpbb_container->get('version_helper');  			try  			{ @@ -451,9 +458,10 @@ class acp_main  			}  			catch (\RuntimeException $e)  			{ +				$message = call_user_func_array(array($user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));  				$template->assign_vars(array(  					'S_VERSIONCHECK_FAIL'		=> true, -					'VERSIONCHECK_FAIL_REASON'	=> ($e->getMessage() !== $user->lang('VERSIONCHECK_FAIL')) ? $e->getMessage() : '', +					'VERSIONCHECK_FAIL_REASON'	=> ($e->getMessage() !== 'VERSIONCHECK_FAIL') ? $message : '',  				));  			}  		} @@ -569,6 +577,7 @@ class acp_main  			'S_TOTAL_ORPHAN'	=> ($total_orphan === false) ? false : true,  			'GZIP_COMPRESSION'	=> ($config['gzip_compress'] && @extension_loaded('zlib')) ? $user->lang['ON'] : $user->lang['OFF'],  			'DATABASE_INFO'		=> $db->sql_server_info(), +			'PHP_VERSION_INFO'	=> PHP_VERSION,  			'BOARD_VERSION'		=> $config['version'],  			'U_ACTION'			=> $this->u_action, @@ -668,7 +677,7 @@ class acp_main  			}  		} -		if (!defined('PHPBB_DISABLE_CONFIG_CHECK') && file_exists($phpbb_root_path . 'config.' . $phpEx) && phpbb_is_writable($phpbb_root_path . 'config.' . $phpEx)) +		if (!defined('PHPBB_DISABLE_CONFIG_CHECK') && file_exists($phpbb_root_path . 'config.' . $phpEx) && $phpbb_filesystem->is_writable($phpbb_root_path . 'config.' . $phpEx))  		{  			// World-Writable? (000x)  			$template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms($phpbb_root_path . 'config.' . $phpEx) & 0x0002)); @@ -688,7 +697,7 @@ class acp_main  		// Fill dbms version if not yet filled  		if (empty($config['dbms_version']))  		{ -			set_config('dbms_version', $db->sql_server_info(true)); +			$config->set('dbms_version', $db->sql_server_info(true));  		}  		$this->tpl_name = 'acp_main'; diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php index 9d14614417..4d90b2da8b 100644 --- a/phpBB/includes/acp/acp_modules.php +++ b/phpBB/includes/acp/acp_modules.php @@ -19,6 +19,8 @@ if (!defined('IN_PHPBB'))  	exit;  } +use phpbb\module\exception\module_exception; +  /**  * - Able to check for new module versions (modes changed/adjusted/added/removed)  * Icons for: @@ -37,8 +39,10 @@ class acp_modules  	function main($id, $mode)  	{ -		global $db, $user, $auth, $template, $module, $request; -		global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx; +		global $db, $user, $template, $module, $request, $phpbb_log, $phpbb_container; + +		/** @var \phpbb\module\module_manager $module_manager */ +		$module_manager = $phpbb_container->get('module.manager');  		// Set a global define for modules we might include (the author is able to prevent execution of code by checking this constant)  		define('MODULE_INCLUDE', true); @@ -68,9 +72,9 @@ class acp_modules  		$this->page_title = strtoupper($this->module_class); -		$this->parent_id = request_var('parent_id', 0); -		$module_id = request_var('m', 0); -		$action = request_var('action', ''); +		$this->parent_id = $request->variable('parent_id', 0); +		$module_id = $request->variable('m', 0); +		$action = $request->variable('action', '');  		$errors = array();  		switch ($action) @@ -94,13 +98,20 @@ class acp_modules  						$db->sql_freeresult($result);  					} -					$errors = $this->delete_module($module_id); - -					if (!sizeof($errors)) +					try  					{ -						$this->remove_cache_file(); -						trigger_error($user->lang['MODULE_DELETED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); +						$row = $module_manager->get_module_row($module_id, $this->module_class); +						$module_manager->delete_module($module_id, $this->module_class); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MODULE_REMOVED', false, array($user->lang($row['module_langname'])));  					} +					catch (module_exception $e) +					{ +						$msg = $user->lang($e->getMessage()); +						trigger_error($msg . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); +					} + +					$module_manager->remove_cache_file($this->module_class); +					trigger_error($user->lang['MODULE_DELETED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id));  				}  				else  				{ @@ -146,8 +157,8 @@ class acp_modules  						AND module_id = $module_id";  				$db->sql_query($sql); -				add_log('admin', 'LOG_MODULE_' . strtoupper($action), $this->lang_name($row['module_langname'])); -				$this->remove_cache_file(); +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MODULE_' . strtoupper($action), false, array($user->lang($row['module_langname']))); +				$module_manager->remove_cache_file($this->module_class);  			break; @@ -176,12 +187,16 @@ class acp_modules  					trigger_error($user->lang['NO_MODULE'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING);  				} -				$move_module_name = $this->move_module_by($row, $action, 1); +				try +				{ +					$move_module_name = $module_manager->move_module_by($row, $this->module_class, $action, 1); -				if ($move_module_name !== false) +					$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MODULE_' . strtoupper($action), false, array($user->lang($row['module_langname']), $move_module_name)); +					$module_manager->remove_cache_file($this->module_class); +				} +				catch (module_exception $e)  				{ -					add_log('admin', 'LOG_MODULE_' . strtoupper($action), $this->lang_name($row['module_langname']), $move_module_name); -					$this->remove_cache_file(); +					// Do nothing  				}  				if ($request->is_ajax()) @@ -195,7 +210,7 @@ class acp_modules  			break;  			case 'quickadd': -				$quick_install = request_var('quick_install', ''); +				$quick_install = $request->variable('quick_install', '');  				if (confirm_box(true))  				{ @@ -207,7 +222,7 @@ class acp_modules  					list($module_basename, $module_mode) = explode('::', $quick_install);  					// Check if module name and mode exist... -					$fileinfo = $this->get_module_infos($module_basename); +					$fileinfo = $module_manager->get_module_infos($this->module_class, $module_basename);  					$fileinfo = $fileinfo[$module_basename];  					if (isset($fileinfo['modes'][$module_mode])) @@ -223,11 +238,20 @@ class acp_modules  							'module_auth'		=> $fileinfo['modes'][$module_mode]['auth'],  						); -						$errors = $this->update_module_data($module_data); +						try +						{ +							$module_manager->update_module_data($module_data); +							$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MODULE_ADD', false, array($user->lang($module_data['module_langname']))); +						} +						catch (\phpbb\module\exception\module_exception $e) +						{ +							$msg = $user->lang($e->getMessage()); +							trigger_error($msg . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); +						}  						if (!sizeof($errors))  						{ -							$this->remove_cache_file(); +							$module_manager->remove_cache_file($this->module_class);  							trigger_error($user->lang['MODULE_ADDED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id));  						} @@ -253,7 +277,15 @@ class acp_modules  					trigger_error($user->lang['NO_MODULE_ID'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING);  				} -				$module_row = $this->get_module_row($module_id); +				try +				{ +					$module_row = $module_manager->get_module_row($module_id, $this->module_class); +				} +				catch (\phpbb\module\exception\module_not_found_exception $e) +				{ +					$msg = $user->lang($e->getMessage()); +					trigger_error($msg . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); +				}  			// no break @@ -266,7 +298,7 @@ class acp_modules  						'module_enabled'	=> 0,  						'module_display'	=> 1,  						'parent_id'			=> 0, -						'module_langname'	=> utf8_normalize_nfc(request_var('module_langname', '', true)), +						'module_langname'	=> $request->variable('module_langname', '', true),  						'module_mode'		=> '',  						'module_auth'		=> '',  					); @@ -274,13 +306,13 @@ class acp_modules  				$module_data = array(); -				$module_data['module_basename'] = request_var('module_basename', (string) $module_row['module_basename']); -				$module_data['module_enabled'] = request_var('module_enabled', (int) $module_row['module_enabled']); -				$module_data['module_display'] = request_var('module_display', (int) $module_row['module_display']); -				$module_data['parent_id'] = request_var('module_parent_id', (int) $module_row['parent_id']); +				$module_data['module_basename'] = $request->variable('module_basename', (string) $module_row['module_basename']); +				$module_data['module_enabled'] = $request->variable('module_enabled', (int) $module_row['module_enabled']); +				$module_data['module_display'] = $request->variable('module_display', (int) $module_row['module_display']); +				$module_data['parent_id'] = $request->variable('module_parent_id', (int) $module_row['parent_id']);  				$module_data['module_class'] = $this->module_class; -				$module_data['module_langname'] = utf8_normalize_nfc(request_var('module_langname', (string) $module_row['module_langname'], true)); -				$module_data['module_mode'] = request_var('module_mode', (string) $module_row['module_mode']); +				$module_data['module_langname'] = $request->variable('module_langname', (string) $module_row['module_langname'], true); +				$module_data['module_mode'] = $request->variable('module_mode', (string) $module_row['module_mode']);  				$submit = (isset($_POST['submit'])) ? true : false; @@ -296,7 +328,7 @@ class acp_modules  						trigger_error($user->lang['NO_MODULE_LANGNAME'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING);  					} -					$module_type = request_var('module_type', 'category'); +					$module_type = $request->variable('module_type', 'category');  					if ($module_type == 'category')  					{ @@ -312,15 +344,29 @@ class acp_modules  					// Adjust auth row  					if ($module_data['module_basename'] && $module_data['module_mode'])  					{ -						$fileinfo = $this->get_module_infos($module_data['module_basename']); +						$fileinfo = $module_manager->get_module_infos($this->module_class, $module_data['module_basename']);  						$module_data['module_auth'] = $fileinfo[$module_data['module_basename']]['modes'][$module_data['module_mode']]['auth'];  					} -					$errors = $this->update_module_data($module_data); +					try +					{ +						$module_manager->update_module_data($module_data); +						$phpbb_log->add('admin', +							$user->data['user_id'], +							$user->ip, +							($action === 'edit') ? 'LOG_MODULE_EDIT' : 'LOG_MODULE_ADD', +							false, +							array($user->lang($module_data['module_langname'])) +						);					} +					catch (\phpbb\module\exception\module_exception $e) +					{ +						$msg = $user->lang($e->getMessage()); +						trigger_error($msg . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); +					}  					if (!sizeof($errors))  					{ -						$this->remove_cache_file(); +						$module_manager->remove_cache_file($this->module_class);  						trigger_error((($action == 'add') ? $user->lang['MODULE_ADDED'] : $user->lang['MODULE_EDITED']) . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id));  					} @@ -330,7 +376,7 @@ class acp_modules  				$is_cat = (!$module_data['module_basename']) ? true : false;  				// Get module information -				$module_infos = $this->get_module_infos(); +				$module_infos = $module_manager->get_module_infos($this->module_class);  				// Build name options  				$s_name_options = $s_mode_options = ''; @@ -342,7 +388,7 @@ class acp_modules  					}  					// Name options -					$s_name_options .= '<option value="' . $option . '"' . (($option == $module_data['module_basename']) ? ' selected="selected"' : '') . '>' . $this->lang_name($values['title']) . ' [' . $option . ']</option>'; +					$s_name_options .= '<option value="' . $option . '"' . (($option == $module_data['module_basename']) ? ' selected="selected"' : '') . '>' . $user->lang($values['title']) . ' [' . $option . ']</option>';  					$template->assign_block_vars('m_names', array('NAME' => $option, 'A_NAME' => addslashes($option))); @@ -351,14 +397,14 @@ class acp_modules  					{  						if ($option == $module_data['module_basename'])  						{ -							$s_mode_options .= '<option value="' . $m_mode . '"' . (($m_mode == $module_data['module_mode']) ? ' selected="selected"' : '') . '>' . $this->lang_name($m_values['title']) . '</option>'; +							$s_mode_options .= '<option value="' . $m_mode . '"' . (($m_mode == $module_data['module_mode']) ? ' selected="selected"' : '') . '>' . $user->lang($m_values['title']) . '</option>';  						}  						$template->assign_block_vars('m_names.modes', array(  							'OPTION'		=> $m_mode, -							'VALUE'			=> $this->lang_name($m_values['title']), +							'VALUE'			=> $user->lang($m_values['title']),  							'A_OPTION'		=> addslashes($m_mode), -							'A_VALUE'		=> addslashes($this->lang_name($m_values['title']))) +							'A_VALUE'		=> addslashes($user->lang($m_values['title'])))  						);  					}  				} @@ -376,7 +422,7 @@ class acp_modules  					'L_TITLE'			=> $user->lang[strtoupper($action) . '_MODULE'], -					'MODULENAME'		=> $this->lang_name($module_data['module_langname']), +					'MODULENAME'		=> $user->lang($module_data['module_langname']),  					'ACTION'			=> $action,  					'MODULE_ID'			=> $module_id, @@ -424,11 +470,11 @@ class acp_modules  		{  			$navigation = '<a href="' . $this->u_action . '">' . strtoupper($this->module_class) . '</a>'; -			$modules_nav = $this->get_module_branch($this->parent_id, 'parents', 'descending'); +			$modules_nav = $module_manager->get_module_branch($this->parent_id, $this->module_class, 'parents');  			foreach ($modules_nav as $row)  			{ -				$langname = $this->lang_name($row['module_langname']); +				$langname = $user->lang($row['module_langname']);  				if ($row['module_id'] == $this->parent_id)  				{ @@ -455,7 +501,7 @@ class acp_modules  		{  			do  			{ -				$langname = $this->lang_name($row['module_langname']); +				$langname = $user->lang($row['module_langname']);  				if (!$row['module_enabled'])  				{ @@ -490,7 +536,15 @@ class acp_modules  		}  		else if ($this->parent_id)  		{ -			$row = $this->get_module_row($this->parent_id); +			try +			{ +				$row = $module_manager->get_module_row($this->parent_id, $this->module_class); +			} +			catch (\phpbb\module\exception\module_not_found_exception $e) +			{ +				$msg = $user->lang($e->getMessage()); +				trigger_error($msg . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); +			}  			$url = $this->u_action . '&parent_id=' . $this->parent_id . '&m=' . $row['module_id']; @@ -509,19 +563,19 @@ class acp_modules  		$db->sql_freeresult($result);  		// Quick adding module -		$module_infos = $this->get_module_infos(); +		$module_infos = $module_manager->get_module_infos($this->module_class);  		// Build quick options  		$s_install_options = '';  		foreach ($module_infos as $option => $values)  		{  			// Name options -			$s_install_options .= '<optgroup label="' . $this->lang_name($values['title']) . ' [' . $option . ']">'; +			$s_install_options .= '<optgroup label="' . $user->lang($values['title']) . ' [' . $option . ']">';  			// Build module modes  			foreach ($values['modes'] as $m_mode => $m_values)  			{ -				$s_install_options .= '<option value="' . $option . '::' . $m_mode . '">   ' . $this->lang_name($m_values['title']) . '</option>'; +				$s_install_options .= '<option value="' . $option . '::' . $m_mode . '">   ' . $user->lang($m_values['title']) . '</option>';  			}  			$s_install_options .= '</optgroup>'; @@ -539,109 +593,11 @@ class acp_modules  	}  	/** -	* Get row for specified module -	*/ -	function get_module_row($module_id) -	{ -		global $db, $user; - -		$sql = 'SELECT * -			FROM ' . MODULES_TABLE . " -			WHERE module_class = '" . $db->sql_escape($this->module_class) . "' -				AND module_id = $module_id"; -		$result = $db->sql_query($sql); -		$row = $db->sql_fetchrow($result); -		$db->sql_freeresult($result); - -		if (!$row) -		{ -			trigger_error($user->lang['NO_MODULE'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); -		} - -		return $row; -	} - -	/** -	* Get available module information from module files -	* -	* @param string $module -	* @param bool|string $module_class -	* @param bool $use_all_available Use all available instead of just all -	* 						enabled extensions -	* @return array -	*/ -	function get_module_infos($module = '', $module_class = false, $use_all_available = false) -	{ -		global $phpbb_extension_manager, $phpbb_root_path, $phpEx; - -		$module_class = ($module_class === false) ? $this->module_class : $module_class; - -		$directory = $phpbb_root_path . 'includes/' . $module_class . '/info/'; -		$fileinfo = array(); - -		$finder = $phpbb_extension_manager->get_finder($use_all_available); - -		$modules = $finder -			->extension_suffix('_module') -			->extension_directory("/$module_class") -			->core_path("includes/$module_class/info/") -			->core_prefix($module_class . '_') -			->get_classes(true); - -		foreach ($modules as $cur_module) -		{ -			// Skip entries we do not need if we know the module we are -			// looking for -			if ($module && strpos(str_replace('\\', '_', $cur_module), $module) === false && $module !== $cur_module) -			{ -				continue; -			} - -			$info_class = preg_replace('/_module$/', '_info', $cur_module); - -			// If the class does not exist it might be following the old -			// format. phpbb_acp_info_acp_foo needs to be turned into -			// acp_foo_info and the respective file has to be included -			// manually because it does not support auto loading -			$old_info_class_file = str_replace("phpbb_{$module_class}_info_", '', $cur_module); -			$old_info_class = $old_info_class_file . '_info'; - -			if (class_exists($old_info_class)) -			{ -				$info_class = $old_info_class; -			} -			else if (!class_exists($info_class)) -			{ -				$info_class = $old_info_class; -				// need to check class exists again because previous checks triggered autoloading -				if (!class_exists($info_class) && file_exists($directory . $old_info_class_file . '.' . $phpEx)) -				{ -					include($directory . $old_info_class_file . '.' . $phpEx); -				} -			} - -			if (class_exists($info_class)) -			{ -				$info = new $info_class(); -				$module_info = $info->module(); - -				$main_class = (isset($module_info['filename'])) ? $module_info['filename'] : $cur_module; - -				$fileinfo[$main_class] = $module_info; -			} -		} - -		ksort($fileinfo); - -		return $fileinfo; -	} - -	/**  	* Simple version of jumpbox, just lists modules  	*/  	function make_module_select($select_id = false, $ignore_id = false, $ignore_acl = false, $ignore_nonpost = false, $ignore_emptycat = true, $ignore_noncat = false)  	{ -		global $db, $user, $auth, $config; +		global $db, $user;  		$sql = 'SELECT module_id, module_enabled, module_basename, parent_id, module_langname, left_id, right_id, module_auth  			FROM ' . MODULES_TABLE . " @@ -696,7 +652,7 @@ class acp_modules  			$selected = (is_array($select_id)) ? ((in_array($row['module_id'], $select_id)) ? ' selected="selected"' : '') : (($row['module_id'] == $select_id) ? ' selected="selected"' : ''); -			$langname = $this->lang_name($row['module_langname']); +			$langname = $user->lang($row['module_langname']);  			$module_list .= '<option value="' . $row['module_id'] . '"' . $selected . ((!$row['module_enabled']) ? ' class="disabled"' : '') . '>' . $padding . $langname . '</option>';  			$iteration++; @@ -707,401 +663,4 @@ class acp_modules  		return $module_list;  	} - -	/** -	* Get module branch -	*/ -	function get_module_branch($module_id, $type = 'all', $order = 'descending', $include_module = true) -	{ -		global $db; - -		switch ($type) -		{ -			case 'parents': -				$condition = 'm1.left_id BETWEEN m2.left_id AND m2.right_id'; -			break; - -			case 'children': -				$condition = 'm2.left_id BETWEEN m1.left_id AND m1.right_id'; -			break; - -			default: -				$condition = 'm2.left_id BETWEEN m1.left_id AND m1.right_id OR m1.left_id BETWEEN m2.left_id AND m2.right_id'; -			break; -		} - -		$rows = array(); - -		$sql = 'SELECT m2.* -			FROM ' . MODULES_TABLE . ' m1 -			LEFT JOIN ' . MODULES_TABLE . " m2 ON ($condition) -			WHERE m1.module_class = '" . $db->sql_escape($this->module_class) . "' -				AND m2.module_class = '" . $db->sql_escape($this->module_class) . "' -				AND m1.module_id = $module_id -			ORDER BY m2.left_id " . (($order == 'descending') ? 'ASC' : 'DESC'); -		$result = $db->sql_query($sql); - -		while ($row = $db->sql_fetchrow($result)) -		{ -			if (!$include_module && $row['module_id'] == $module_id) -			{ -				continue; -			} - -			$rows[] = $row; -		} -		$db->sql_freeresult($result); - -		return $rows; -	} - -	/** -	* Remove modules cache file -	*/ -	function remove_cache_file() -	{ -		global $phpbb_container; - -		// Sanitise for future path use, it's escaped as appropriate for queries -		$p_class = str_replace(array('.', '/', '\\'), '', basename($this->module_class)); - -		$phpbb_container->get('cache.driver')->destroy('_modules_' . $p_class); - -		// Additionally remove sql cache -		$phpbb_container->get('cache.driver')->destroy('sql', MODULES_TABLE); -	} - -	/** -	* Return correct language name -	*/ -	function lang_name($module_langname) -	{ -		global $user; - -		return (!empty($user->lang[$module_langname])) ? $user->lang[$module_langname] : $module_langname; -	} - -	/** -	* Update/Add module -	* -	* @param array	&$module_data	The module data -	* @param bool	$run_inline 	if set to true errors will be returned and no logs being written -	*/ -	function update_module_data(&$module_data, $run_inline = false) -	{ -		global $db, $user; - -		if (!isset($module_data['module_id'])) -		{ -			// no module_id means we're creating a new category/module -			if ($module_data['parent_id']) -			{ -				$sql = 'SELECT left_id, right_id -					FROM ' . MODULES_TABLE . " -					WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "' -						AND module_id = " . (int) $module_data['parent_id']; -				$result = $db->sql_query($sql); -				$row = $db->sql_fetchrow($result); -				$db->sql_freeresult($result); - -				if (!$row) -				{ -					if ($run_inline) -					{ -						return 'PARENT_NO_EXIST'; -					} - -					trigger_error($user->lang['PARENT_NO_EXIST'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); -				} - -				// Workaround -				$row['left_id'] = (int) $row['left_id']; -				$row['right_id'] = (int) $row['right_id']; - -				$sql = 'UPDATE ' . MODULES_TABLE . " -					SET left_id = left_id + 2, right_id = right_id + 2 -					WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "' -						AND left_id > {$row['right_id']}"; -				$db->sql_query($sql); - -				$sql = 'UPDATE ' . MODULES_TABLE . " -					SET right_id = right_id + 2 -					WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "' -						AND {$row['left_id']} BETWEEN left_id AND right_id"; -				$db->sql_query($sql); - -				$module_data['left_id'] = (int) $row['right_id']; -				$module_data['right_id'] = (int) $row['right_id'] + 1; -			} -			else -			{ -				$sql = 'SELECT MAX(right_id) AS right_id -					FROM ' . MODULES_TABLE . " -					WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "'"; -				$result = $db->sql_query($sql); -				$row = $db->sql_fetchrow($result); -				$db->sql_freeresult($result); - -				$module_data['left_id'] = (int) $row['right_id'] + 1; -				$module_data['right_id'] = (int) $row['right_id'] + 2; -			} - -			$sql = 'INSERT INTO ' . MODULES_TABLE . ' ' . $db->sql_build_array('INSERT', $module_data); -			$db->sql_query($sql); - -			$module_data['module_id'] = $db->sql_nextid(); - -			if (!$run_inline) -			{ -				add_log('admin', 'LOG_MODULE_ADD', $this->lang_name($module_data['module_langname'])); -			} -		} -		else -		{ -			$row = $this->get_module_row($module_data['module_id']); - -			if ($module_data['module_basename'] && !$row['module_basename']) -			{ -				// we're turning a category into a module -				$branch = $this->get_module_branch($module_data['module_id'], 'children', 'descending', false); - -				if (sizeof($branch)) -				{ -					return array($user->lang['NO_CATEGORY_TO_MODULE']); -				} -			} - -			if ($row['parent_id'] != $module_data['parent_id']) -			{ -				$this->move_module($module_data['module_id'], $module_data['parent_id']); -			} - -			$update_ary = $module_data; -			unset($update_ary['module_id']); - -			$sql = 'UPDATE ' . MODULES_TABLE . ' -				SET ' . $db->sql_build_array('UPDATE', $update_ary) . " -				WHERE module_class = '" . $db->sql_escape($module_data['module_class']) . "' -					AND module_id = " . (int) $module_data['module_id']; -			$db->sql_query($sql); - -			if (!$run_inline) -			{ -				add_log('admin', 'LOG_MODULE_EDIT', $this->lang_name($module_data['module_langname'])); -			} -		} - -		return array(); -	} - -	/** -	* Move module around the tree -	*/ -	function move_module($from_module_id, $to_parent_id) -	{ -		global $db; - -		$moved_modules = $this->get_module_branch($from_module_id, 'children', 'descending'); -		$from_data = $moved_modules[0]; -		$diff = sizeof($moved_modules) * 2; - -		$moved_ids = array(); -		for ($i = 0, $size = sizeof($moved_modules); $i < $size; ++$i) -		{ -			$moved_ids[] = $moved_modules[$i]['module_id']; -		} - -		// Resync parents -		$sql = 'UPDATE ' . MODULES_TABLE . " -			SET right_id = right_id - $diff -			WHERE module_class = '" . $db->sql_escape($this->module_class) . "' -				AND left_id < " . (int) $from_data['right_id'] . ' -				AND right_id > ' . (int) $from_data['right_id']; -		$db->sql_query($sql); - -		// Resync righthand side of tree -		$sql = 'UPDATE ' . MODULES_TABLE . " -			SET left_id = left_id - $diff, right_id = right_id - $diff -			WHERE module_class = '" . $db->sql_escape($this->module_class) . "' -				AND left_id > " . (int) $from_data['right_id']; -		$db->sql_query($sql); - -		if ($to_parent_id > 0) -		{ -			$to_data = $this->get_module_row($to_parent_id); - -			// Resync new parents -			$sql = 'UPDATE ' . MODULES_TABLE . " -				SET right_id = right_id + $diff -				WHERE module_class = '" . $db->sql_escape($this->module_class) . "' -					AND " . (int) $to_data['right_id'] . ' BETWEEN left_id AND right_id -					AND ' . $db->sql_in_set('module_id', $moved_ids, true); -			$db->sql_query($sql); - -			// Resync the righthand side of the tree -			$sql = 'UPDATE ' . MODULES_TABLE . " -				SET left_id = left_id + $diff, right_id = right_id + $diff -				WHERE module_class = '" . $db->sql_escape($this->module_class) . "' -					AND left_id > " . (int) $to_data['right_id'] . ' -					AND ' . $db->sql_in_set('module_id', $moved_ids, true); -			$db->sql_query($sql); - -			// Resync moved branch -			$to_data['right_id'] += $diff; -			if ($to_data['right_id'] > $from_data['right_id']) -			{ -				$diff = '+ ' . ($to_data['right_id'] - $from_data['right_id'] - 1); -			} -			else -			{ -				$diff = '- ' . abs($to_data['right_id'] - $from_data['right_id'] - 1); -			} -		} -		else -		{ -			$sql = 'SELECT MAX(right_id) AS right_id -				FROM ' . MODULES_TABLE . " -				WHERE module_class = '" . $db->sql_escape($this->module_class) . "' -					AND " . $db->sql_in_set('module_id', $moved_ids, true); -			$result = $db->sql_query($sql); -			$row = $db->sql_fetchrow($result); -			$db->sql_freeresult($result); - -			$diff = '+ ' . (int) ($row['right_id'] - $from_data['left_id'] + 1); -		} - -		$sql = 'UPDATE ' . MODULES_TABLE . " -			SET left_id = left_id $diff, right_id = right_id $diff -			WHERE module_class = '" . $db->sql_escape($this->module_class) . "' -				AND " . $db->sql_in_set('module_id', $moved_ids); -		$db->sql_query($sql); -	} - -	/** -	* Remove module from tree -	*/ -	function delete_module($module_id) -	{ -		global $db, $user; - -		$row = $this->get_module_row($module_id); - -		$branch = $this->get_module_branch($module_id, 'children', 'descending', false); - -		if (sizeof($branch)) -		{ -			return array($user->lang['CANNOT_REMOVE_MODULE']); -		} - -		// If not move -		$diff = 2; -		$sql = 'DELETE FROM ' . MODULES_TABLE . " -			WHERE module_class = '" . $db->sql_escape($this->module_class) . "' -				AND module_id = $module_id"; -		$db->sql_query($sql); - -		$row['right_id'] = (int) $row['right_id']; -		$row['left_id'] = (int) $row['left_id']; - -		// Resync tree -		$sql = 'UPDATE ' . MODULES_TABLE . " -			SET right_id = right_id - $diff -			WHERE module_class = '" . $db->sql_escape($this->module_class) . "' -				AND left_id < {$row['right_id']} AND right_id > {$row['right_id']}"; -		$db->sql_query($sql); - -		$sql = 'UPDATE ' . MODULES_TABLE . " -			SET left_id = left_id - $diff, right_id = right_id - $diff -			WHERE module_class = '" . $db->sql_escape($this->module_class) . "' -				AND left_id > {$row['right_id']}"; -		$db->sql_query($sql); - -		add_log('admin', 'LOG_MODULE_REMOVED', $this->lang_name($row['module_langname'])); - -		return array(); - -	} - -	/** -	* Move module position by $steps up/down -	*/ -	function move_module_by($module_row, $action = 'move_up', $steps = 1) -	{ -		global $db; - -		/** -		* Fetch all the siblings between the module's current spot -		* and where we want to move it to. If there are less than $steps -		* siblings between the current spot and the target then the -		* module will move as far as possible -		*/ -		$sql = 'SELECT module_id, left_id, right_id, module_langname -			FROM ' . MODULES_TABLE . " -			WHERE module_class = '" . $db->sql_escape($this->module_class) . "' -				AND parent_id = " . (int) $module_row['parent_id'] . ' -				AND ' . (($action == 'move_up') ? 'right_id < ' . (int) $module_row['right_id'] . ' ORDER BY right_id DESC' : 'left_id > ' . (int) $module_row['left_id'] . ' ORDER BY left_id ASC'); -		$result = $db->sql_query_limit($sql, $steps); - -		$target = array(); -		while ($row = $db->sql_fetchrow($result)) -		{ -			$target = $row; -		} -		$db->sql_freeresult($result); - -		if (!sizeof($target)) -		{ -			// The module is already on top or bottom -			return false; -		} - -		/** -		* $left_id and $right_id define the scope of the nodes that are affected by the move. -		* $diff_up and $diff_down are the values to substract or add to each node's left_id -		* and right_id in order to move them up or down. -		* $move_up_left and $move_up_right define the scope of the nodes that are moving -		* up. Other nodes in the scope of ($left_id, $right_id) are considered to move down. -		*/ -		if ($action == 'move_up') -		{ -			$left_id = (int) $target['left_id']; -			$right_id = (int) $module_row['right_id']; - -			$diff_up = (int) ($module_row['left_id'] - $target['left_id']); -			$diff_down = (int) ($module_row['right_id'] + 1 - $module_row['left_id']); - -			$move_up_left = (int) $module_row['left_id']; -			$move_up_right = (int) $module_row['right_id']; -		} -		else -		{ -			$left_id = (int) $module_row['left_id']; -			$right_id = (int) $target['right_id']; - -			$diff_up = (int) ($module_row['right_id'] + 1 - $module_row['left_id']); -			$diff_down = (int) ($target['right_id'] - $module_row['right_id']); - -			$move_up_left = (int) ($module_row['right_id'] + 1); -			$move_up_right = (int) $target['right_id']; -		} - -		// Now do the dirty job -		$sql = 'UPDATE ' . MODULES_TABLE . " -			SET left_id = left_id + CASE -				WHEN left_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up} -				ELSE {$diff_down} -			END, -			right_id = right_id + CASE -				WHEN right_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up} -				ELSE {$diff_down} -			END -			WHERE module_class = '" . $db->sql_escape($this->module_class) . "' -				AND left_id BETWEEN {$left_id} AND {$right_id} -				AND right_id BETWEEN {$left_id} AND {$right_id}"; -		$db->sql_query($sql); - -		$this->remove_cache_file(); - -		return $this->lang_name($target['module_langname']); -	}  } diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php index 0796b36fef..0bfe67830f 100644 --- a/phpBB/includes/acp/acp_permission_roles.php +++ b/phpBB/includes/acp/acp_permission_roles.php @@ -26,9 +26,9 @@ class acp_permission_roles  	function main($id, $mode)  	{ -		global $db, $user, $auth, $template, $cache, $phpbb_container; -		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; -		global $request; +		global $db, $user, $template, $phpbb_container; +		global $phpbb_root_path, $phpEx; +		global $request, $phpbb_log;  		if (!function_exists('user_get_id_name'))  		{ @@ -48,8 +48,8 @@ class acp_permission_roles  		$this->tpl_name = 'acp_permission_roles';  		$submit = (isset($_POST['submit'])) ? true : false; -		$role_id = request_var('role_id', 0); -		$action = request_var('action', ''); +		$role_id = $request->variable('role_id', 0); +		$action = $request->variable('action', '');  		$action = (isset($_POST['add'])) ? 'add' : $action;  		$form_name = 'acp_permissions'; @@ -116,7 +116,7 @@ class acp_permission_roles  						$this->remove_role($role_id, $permission_type);  						$role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name']; -						add_log('admin', 'LOG_' . strtoupper($permission_type) . 'ROLE_REMOVED', $role_name); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_' . strtoupper($permission_type) . 'ROLE_REMOVED', false, array($role_name));  						trigger_error($user->lang['ROLE_DELETED'] . adm_back_link($this->u_action));  					}  					else @@ -155,9 +155,9 @@ class acp_permission_roles  						trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING);  					} -					$role_name = utf8_normalize_nfc(request_var('role_name', '', true)); -					$role_description = utf8_normalize_nfc(request_var('role_description', '', true)); -					$auth_settings = request_var('setting', array('' => 0)); +					$role_name = $request->variable('role_name', '', true); +					$role_description = $request->variable('role_description', '', true); +					$auth_settings = $request->variable('setting', array('' => 0));  					if (!$role_name)  					{ @@ -219,7 +219,7 @@ class acp_permission_roles  					$this->auth_admin->acl_set_role($role_id, $auth_settings);  					$role_name = (!empty($user->lang[$role_name])) ? $user->lang[$role_name] : $role_name; -					add_log('admin', 'LOG_' . strtoupper($permission_type) . 'ROLE_' . strtoupper($action), $role_name); +					$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_' . strtoupper($permission_type) . 'ROLE_' . strtoupper($action), false, array($role_name));  					trigger_error($user->lang['ROLE_' . strtoupper($action) . '_SUCCESS'] . adm_back_link($this->u_action)); @@ -232,11 +232,11 @@ class acp_permission_roles  		{  			case 'add': -				$options_from = request_var('options_from', 0); +				$options_from = $request->variable('options_from', 0);  				$role_row = array( -					'role_name'			=> utf8_normalize_nfc(request_var('role_name', '', true)), -					'role_description'	=> utf8_normalize_nfc(request_var('role_description', '', true)), +					'role_name'			=> $request->variable('role_name', '', true), +					'role_description'	=> $request->variable('role_description', '', true),  					'role_type'			=> $permission_type,  				); @@ -306,6 +306,7 @@ class acp_permission_roles  					trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING);  				} +				/* @var $phpbb_permissions \phpbb\permissions */  				$phpbb_permissions = $phpbb_container->get('acl.permissions');  				$template->assign_vars(array( @@ -425,7 +426,7 @@ class acp_permission_roles  		$db->sql_freeresult($result);  		// Display assigned items? -		$display_item = request_var('display_item', 0); +		$display_item = $request->variable('display_item', 0);  		// Select existing roles  		$sql = 'SELECT * @@ -481,8 +482,9 @@ class acp_permission_roles  	*/  	function display_auth_options($auth_options)  	{ -		global $template, $user, $phpbb_container; +		global $template, $phpbb_container; +		/* @var $phpbb_permissions \phpbb\permissions */  		$phpbb_permissions = $phpbb_container->get('acl.permissions');  		$content_array = $categories = array(); diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 62e75a2db7..12c43bf94c 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -23,12 +23,16 @@ class acp_permissions  {  	var $u_action;  	var $permission_dropdown; + +	/** +	 * @var $phpbb_permissions \phpbb\permissions +	 */  	protected $permissions;  	function main($id, $mode)  	{ -		global $db, $user, $auth, $template, $cache, $phpbb_container; -		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; +		global $db, $user, $auth, $template, $phpbb_container, $request; +		global $config, $phpbb_root_path, $phpEx;  		if (!function_exists('user_get_id_name'))  		{ @@ -52,9 +56,9 @@ class acp_permissions  		// Trace has other vars  		if ($mode == 'trace')  		{ -			$user_id = request_var('u', 0); -			$forum_id = request_var('f', 0); -			$permission = request_var('auth', ''); +			$user_id = $request->variable('u', 0); +			$forum_id = $request->variable('f', 0); +			$permission = $request->variable('auth', '');  			$this->tpl_name = 'permission_trace'; @@ -83,20 +87,20 @@ class acp_permissions  		}  		// Set some vars -		$action = request_var('action', array('' => 0)); +		$action = $request->variable('action', array('' => 0));  		$action = key($action);  		$action = (isset($_POST['psubmit'])) ? 'apply_permissions' : $action; -		$all_forums = request_var('all_forums', 0); -		$subforum_id = request_var('subforum_id', 0); -		$forum_id = request_var('forum_id', array(0)); +		$all_forums = $request->variable('all_forums', 0); +		$subforum_id = $request->variable('subforum_id', 0); +		$forum_id = $request->variable('forum_id', array(0)); -		$username = request_var('username', array(''), true); -		$usernames = request_var('usernames', '', true); -		$user_id = request_var('user_id', array(0)); +		$username = $request->variable('username', array(''), true); +		$usernames = $request->variable('usernames', '', true); +		$user_id = $request->variable('user_id', array(0)); -		$group_id = request_var('group_id', array(0)); -		$select_all_groups = request_var('select_all_groups', 0); +		$group_id = $request->variable('group_id', array(0)); +		$select_all_groups = $request->variable('select_all_groups', 0);  		$form_name = 'acp_permissions';  		add_form_key($form_name); @@ -163,8 +167,6 @@ class acp_permissions  		}  		// Define some common variables for every mode -		$error = array(); -  		$permission_scope = (strpos($mode, '_global') !== false) ? 'global' : 'local';  		// Showing introductionary page? @@ -235,7 +237,7 @@ class acp_permissions  		);  		// Get permission type -		$permission_type = request_var('type', $this->permission_dropdown[0]); +		$permission_type = $request->variable('type', $this->permission_dropdown[0]);  		if (!in_array($permission_type, $this->permission_dropdown))  		{ @@ -313,6 +315,7 @@ class acp_permissions  				case 'apply_permissions':  					if (!isset($_POST['setting']))  					{ +						send_status_line(403, 'Forbidden');  						trigger_error($user->lang['NO_AUTH_SETTING_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);  					}  					if (!check_form_key($form_name)) @@ -326,6 +329,7 @@ class acp_permissions  				case 'apply_all_permissions':  					if (!isset($_POST['setting']))  					{ +						send_status_line(403, 'Forbidden');  						trigger_error($user->lang['NO_AUTH_SETTING_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);  					}  					if (!check_form_key($form_name)) @@ -677,7 +681,7 @@ class acp_permissions  		global $db, $cache, $user, $auth;  		global $request; -		$psubmit = request_var('psubmit', array(0 => array(0 => 0))); +		$psubmit = $request->variable('psubmit', array(0 => array(0 => 0)));  		// User or group to be set?  		$ug_type = (sizeof($user_id)) ? 'user' : 'group'; @@ -685,11 +689,10 @@ class acp_permissions  		// Check the permission setting again  		if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's'))  		{ +			send_status_line(403, 'Forbidden');  			trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);  		} -		$ug_id = $forum_id = 0; -  		// We loop through the auth settings defined in our submit  		list($ug_id, ) = each($psubmit);  		list($forum_id, ) = each($psubmit[$ug_id]); @@ -707,7 +710,7 @@ class acp_permissions  		$assigned_role = (isset($roles[$ug_id][$forum_id])) ? (int) $roles[$ug_id][$forum_id] : 0;  		// Do the admin want to set these permissions to other items too? -		$inherit = request_var('inherit', array(0 => array(0))); +		$inherit = $request->variable('inherit', array(0 => array(0)));  		$ug_id = array($ug_id);  		$forum_id = array($forum_id); @@ -773,6 +776,7 @@ class acp_permissions  		// Check the permission setting again  		if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's'))  		{ +			send_status_line(403, 'Forbidden');  			trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);  		} @@ -887,6 +891,7 @@ class acp_permissions  		// Check the permission setting again  		if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's'))  		{ +			send_status_line(403, 'Forbidden');  			trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);  		} @@ -917,7 +922,7 @@ class acp_permissions  	*/  	function log_action($mode, $action, $permission_type, $ug_type, $ug_id, $forum_id)  	{ -		global $db, $user; +		global $db, $user, $phpbb_log, $phpbb_container;  		if (!is_array($ug_id))  		{ @@ -934,10 +939,14 @@ class acp_permissions  		$sql .= $db->sql_in_set(($ug_type == 'group') ? 'group_id' : 'user_id', array_map('intval', $ug_id));  		$result = $db->sql_query($sql); +		/** @var \phpbb\group\helper $group_helper */ +		$group_helper = $phpbb_container->get('group_helper'); +  		$l_ug_list = '';  		while ($row = $db->sql_fetchrow($result))  		{ -			$l_ug_list .= (($l_ug_list != '') ? ', ' : '') . ((isset($row['group_type']) && $row['group_type'] == GROUP_SPECIAL) ? '<span class="sep">' . $user->lang['G_' . $row['name']] . '</span>' : $row['name']); +			$group_name = $group_helper->get_name($row['name']); +			$l_ug_list .= (($l_ug_list != '') ? ', ' : '') . ((isset($row['group_type']) && $row['group_type'] == GROUP_SPECIAL) ? '<span class="sep">' . $group_name . '</span>' : $group_name);  		}  		$db->sql_freeresult($result); @@ -945,7 +954,7 @@ class acp_permissions  		if ($forum_id[0] == 0)  		{ -			add_log('admin', 'LOG_ACL_' . strtoupper($action) . '_' . strtoupper($mode) . '_' . strtoupper($permission_type), $l_ug_list); +			$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ACL_' . strtoupper($action) . '_' . strtoupper($mode) . '_' . strtoupper($permission_type), false, array($l_ug_list));  		}  		else  		{ @@ -962,7 +971,7 @@ class acp_permissions  			}  			$db->sql_freeresult($result); -			add_log('admin', 'LOG_ACL_' . strtoupper($action) . '_' . strtoupper($mode) . '_' . strtoupper($permission_type), $l_forum_list, $l_ug_list); +			$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ACL_' . strtoupper($action) . '_' . strtoupper($mode) . '_' . strtoupper($permission_type), false, array($l_forum_list, $l_ug_list));  		}  	} @@ -971,7 +980,7 @@ class acp_permissions  	*/  	function permission_trace($user_id, $forum_id, $permission)  	{ -		global $db, $template, $user, $auth; +		global $db, $template, $user, $auth, $request, $phpbb_container;  		if ($user_id != $user->data['user_id'])  		{ @@ -987,6 +996,9 @@ class acp_permissions  			trigger_error('NO_USERS', E_USER_ERROR);  		} +		/** @var \phpbb\group\helper $group_helper */ +		$group_helper = $phpbb_container->get('group_helper'); +  		$forum_name = false;  		if ($forum_id) @@ -999,7 +1011,7 @@ class acp_permissions  			$db->sql_freeresult($result);  		} -		$back = request_var('back', 0); +		$back = $request->variable('back', 0);  		$template->assign_vars(array(  			'PERMISSION'			=> $this->permissions->get_permission_lang($permission), @@ -1033,7 +1045,7 @@ class acp_permissions  		{  			$groups[$row['group_id']] = array(  				'auth_setting'		=> ACL_NO, -				'group_name'		=> ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'] +				'group_name'		=> $group_helper->get_name($row['group_name']),  			);  		}  		$db->sql_freeresult($result); @@ -1190,7 +1202,7 @@ class acp_permissions  	*/  	function copy_forum_permissions()  	{ -		global $db, $auth, $cache, $template, $user; +		global $db, $auth, $cache, $template, $user, $request;  		$user->add_lang('acp/forums'); @@ -1198,8 +1210,8 @@ class acp_permissions  		if ($submit)  		{ -			$src = request_var('src_forum_id', 0); -			$dest = request_var('dest_forum_ids', array(0)); +			$src = $request->variable('src_forum_id', 0); +			$dest = $request->variable('dest_forum_ids', array(0));  			if (confirm_box(true))  			{ @@ -1241,7 +1253,10 @@ class acp_permissions  	*/  	function retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type)  	{ -		global $db, $user; +		global $db, $phpbb_container; + +		/** @var \phpbb\group\helper $group_helper */ +		$group_helper = $phpbb_container->get('group_helper');  		$sql_forum_id = ($permission_scope == 'global') ? 'AND a.forum_id = 0' : ((sizeof($forum_id)) ? 'AND ' . $db->sql_in_set('a.forum_id', $forum_id) : 'AND a.forum_id <> 0'); @@ -1316,7 +1331,7 @@ class acp_permissions  		$defined_group_ids = array();  		while ($row = $db->sql_fetchrow($result))  		{ -			$s_defined_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; +			$s_defined_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . $group_helper->get_name($row['group_name']) . '</option>';  			$defined_group_ids[] = $row['group_id'];  		}  		$db->sql_freeresult($result); diff --git a/phpBB/includes/acp/acp_php_info.php b/phpBB/includes/acp/acp_php_info.php index 810a111edb..2a1afe80d4 100644 --- a/phpBB/includes/acp/acp_php_info.php +++ b/phpBB/includes/acp/acp_php_info.php @@ -25,8 +25,7 @@ class acp_php_info  	function main($id, $mode)  	{ -		global $db, $user, $auth, $template; -		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; +		global $template;  		if ($mode != 'info')  		{ diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 9e6cc49522..18dde382ca 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -25,13 +25,17 @@ class acp_profile  	var $edit_lang_id;  	var $lang_defs; + +	/** +	 * @var \phpbb\di\service_collection +	 */  	protected $type_collection;  	function main($id, $mode)  	{ -		global $config, $db, $user, $auth, $template, $cache; -		global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; -		global $request, $phpbb_container, $phpbb_dispatcher; +		global $config, $db, $user, $template; +		global $phpbb_root_path, $phpEx; +		global $request, $phpbb_container, $phpbb_log, $phpbb_dispatcher;  		if (!function_exists('generate_smilies'))  		{ @@ -48,10 +52,9 @@ class acp_profile  		$this->page_title = 'ACP_CUSTOM_PROFILE_FIELDS';  		$field_id = $request->variable('field_id', 0); -		$action = (isset($_POST['create'])) ? 'create' : request_var('action', ''); +		$action = (isset($_POST['create'])) ? 'create' : $request->variable('action', '');  		$error = array(); -		$s_hidden_fields = '';  		$form_key = 'acp_profile';  		add_form_key($form_key); @@ -61,6 +64,7 @@ class acp_profile  			trigger_error($user->lang['NO_FIELD_ID'] . adm_back_link($this->u_action), E_USER_WARNING);  		} +		/* @var $cp \phpbb\profilefields\manager */  		$cp = $phpbb_container->get('profilefields.manager');  		$this->type_collection = $phpbb_container->get('profilefields.type_collection'); @@ -122,6 +126,7 @@ class acp_profile  					$db->sql_query('DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . " WHERE field_id = $field_id");  					$db->sql_query('DELETE FROM ' . PROFILE_LANG_TABLE . " WHERE field_id = $field_id"); +					/* @var $db_tools \phpbb\db\tools\tools_interface */  					$db_tools = $phpbb_container->get('dbal.tools');  					$db_tools->sql_column_remove(PROFILE_FIELDS_DATA_TABLE, 'pf_' . $field_ident); @@ -147,7 +152,7 @@ class acp_profile  					$db->sql_transaction('commit'); -					add_log('admin', 'LOG_PROFILE_FIELD_REMOVED', $field_ident); +					$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PROFILE_FIELD_REMOVED', false, array($field_ident));  					trigger_error($user->lang['REMOVED_PROFILE_FIELD'] . adm_back_link($this->u_action));  				}  				else @@ -193,7 +198,7 @@ class acp_profile  				$field_ident = (string) $db->sql_fetchfield('field_ident');  				$db->sql_freeresult($result); -				add_log('admin', 'LOG_PROFILE_FIELD_ACTIVATE', $field_ident); +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PROFILE_FIELD_ACTIVATE', false, array($field_ident));  				if ($request->is_ajax())  				{ @@ -234,7 +239,7 @@ class acp_profile  					));  				} -				add_log('admin', 'LOG_PROFILE_FIELD_DEACTIVATE', $field_ident); +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PROFILE_FIELD_DEACTIVATE', false, array($field_ident));  				trigger_error($user->lang['PROFILE_FIELD_DEACTIVATED'] . adm_back_link($this->u_action)); @@ -280,7 +285,7 @@ class acp_profile  			case 'create':  			case 'edit': -				$step = request_var('step', 1); +				$step = $request->variable('step', 1);  				$submit = (isset($_REQUEST['next']) || isset($_REQUEST['prev'])) ? true : false;  				$save = (isset($_REQUEST['save'])) ? true : false; @@ -344,7 +349,7 @@ class acp_profile  					// We are adding a new field, define basic params  					$lang_options = $field_row = array(); -					$field_type = request_var('field_type', ''); +					$field_type = $request->variable('field_type', '');  					if (!isset($this->type_collection[$field_type]))  					{ @@ -353,7 +358,7 @@ class acp_profile  					$profile_field = $this->type_collection[$field_type];  					$field_row = array_merge($profile_field->get_default_option_values(), array( -						'field_ident'		=> str_replace(' ', '_', utf8_clean_string(request_var('field_ident', '', true))), +						'field_ident'		=> str_replace(' ', '_', utf8_clean_string($request->variable('field_ident', '', true))),  						'field_required'	=> 0,  						'field_show_novalue'=> 0,  						'field_hide'		=> 0, @@ -366,7 +371,7 @@ class acp_profile  						'field_is_contact'	=> 0,  						'field_contact_desc'=> '',  						'field_contact_url'	=> '', -						'lang_name'			=> utf8_normalize_nfc(request_var('field_ident', '', true)), +						'lang_name'			=> $request->variable('field_ident', '', true),  						'lang_explain'		=> '',  						'lang_default_value'=> '')  					); @@ -422,7 +427,7 @@ class acp_profile  				$options = $profile_field->prepare_options_form($exclude, $visibility_ary); -				$cp->vars['field_ident']		= ($action == 'create' && $step == 1) ? utf8_clean_string(request_var('field_ident', $field_row['field_ident'], true)) : request_var('field_ident', $field_row['field_ident']); +				$cp->vars['field_ident']		= ($action == 'create' && $step == 1) ? utf8_clean_string($request->variable('field_ident', $field_row['field_ident'], true)) : $request->variable('field_ident', $field_row['field_ident']);  				$cp->vars['lang_name']			= $request->variable('lang_name', $field_row['lang_name'], true);  				$cp->vars['lang_explain']		= $request->variable('lang_explain', $field_row['lang_explain'], true);  				$cp->vars['lang_default_value']	= $request->variable('lang_default_value', $field_row['lang_default_value'], true); @@ -461,7 +466,7 @@ class acp_profile  				// step 2  				foreach ($exclude[2] as $key)  				{ -					$var = utf8_normalize_nfc(request_var($key, $field_row[$key], true)); +					$var = $request->variable($key, $field_row[$key], true);  					$field_data = $cp->vars;  					$var = $profile_field->get_excluded_options($key, $action, $var, $field_data, 2); @@ -507,7 +512,7 @@ class acp_profile  				foreach ($exclude[3] as $key)  				{ -					$cp->vars[$key] = utf8_normalize_nfc(request_var($key, array(0 => ''), true)); +					$cp->vars[$key] = $request->variable($key, array(0 => ''), true);  					if (!$cp->vars[$key] && $action == 'edit')  					{ @@ -797,7 +802,7 @@ class acp_profile  	*/  	function build_language_options(&$cp, $field_type, $action = 'create')  	{ -		global $user, $config, $db, $phpbb_container; +		global $user, $config, $db, $request;  		$default_lang_id = (!empty($this->edit_lang_id)) ? $this->edit_lang_id : $this->lang_defs['iso'][$config['default_lang']]; @@ -838,7 +843,7 @@ class acp_profile  			$lang_options[$lang_id]['lang_iso'] = $lang_iso;  			foreach ($options as $field => $field_type)  			{ -				$value = ($action == 'create') ? utf8_normalize_nfc(request_var('l_' . $field, array(0 => ''), true)) : $cp->vars['l_' . $field]; +				$value = ($action == 'create') ? $request->variable('l_' . $field, array(0 => ''), true) : $cp->vars['l_' . $field];  				if ($field == 'lang_options')  				{  					$var = (!isset($cp->vars['l_lang_options'][$lang_id]) || !is_array($cp->vars['l_lang_options'][$lang_id])) ? $cp->vars['lang_options'] : $cp->vars['l_lang_options'][$lang_id]; @@ -894,9 +899,9 @@ class acp_profile  	*/  	function save_profile_field(&$cp, $field_type, $action = 'create')  	{ -		global $db, $config, $user, $phpbb_container, $phpbb_dispatcher; +		global $db, $config, $user, $phpbb_container, $phpbb_log, $request, $phpbb_dispatcher; -		$field_id = request_var('field_id', 0); +		$field_id = $request->variable('field_id', 0);  		// Collect all information, if something is going wrong, abort the operation  		$profile_sql = $profile_lang = $empty_lang = $profile_lang_fields = array(); @@ -983,7 +988,7 @@ class acp_profile  		if ($action == 'create')  		{  			$field_ident = 'pf_' . $field_ident; - +			/* @var $db_tools \phpbb\db\tools\tools_interface */  			$db_tools = $phpbb_container->get('dbal.tools');  			$db_tools->sql_column_add(PROFILE_FIELDS_DATA_TABLE, $field_ident, array($profile_field->get_database_column_type(), null));  		} @@ -1182,12 +1187,12 @@ class acp_profile  		if ($action == 'edit')  		{ -			add_log('admin', 'LOG_PROFILE_FIELD_EDIT', $cp->vars['field_ident'] . ':' . $cp->vars['lang_name']); +			$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PROFILE_FIELD_EDIT', false, array($cp->vars['field_ident'] . ':' . $cp->vars['lang_name']));  			trigger_error($user->lang['CHANGED_PROFILE_FIELD'] . adm_back_link($this->u_action));  		}  		else  		{ -			add_log('admin', 'LOG_PROFILE_FIELD_CREATE', substr($field_ident, 3) . ':' . $cp->vars['lang_name']); +			$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PROFILE_FIELD_CREATE', false, array(substr($field_ident, 3) . ':' . $cp->vars['lang_name']));  			trigger_error($user->lang['ADDED_PROFILE_FIELD'] . adm_back_link($this->u_action));  		}  	} diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php index 98d9caabdd..d37050869a 100644 --- a/phpBB/includes/acp/acp_prune.php +++ b/phpBB/includes/acp/acp_prune.php @@ -25,7 +25,7 @@ class acp_prune  	function main($id, $mode)  	{ -		global $user, $phpEx, $phpbb_admin_path, $phpbb_root_path; +		global $user, $phpEx, $phpbb_root_path;  		$user->add_lang('acp/prune'); @@ -55,11 +55,10 @@ class acp_prune  	*/  	function prune_forums($id, $mode)  	{ -		global $db, $user, $auth, $template, $cache; -		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; +		global $db, $user, $auth, $template, $phpbb_log, $request; -		$all_forums = request_var('all_forums', 0); -		$forum_id = request_var('f', array(0)); +		$all_forums = $request->variable('all_forums', 0); +		$forum_id = $request->variable('f', array(0));  		$submit = (isset($_POST['submit'])) ? true : false;  		if ($all_forums) @@ -81,14 +80,14 @@ class acp_prune  		{  			if (confirm_box(true))  			{ -				$prune_posted = request_var('prune_days', 0); -				$prune_viewed = request_var('prune_vieweddays', 0); +				$prune_posted = $request->variable('prune_days', 0); +				$prune_viewed = $request->variable('prune_vieweddays', 0);  				$prune_all = (!$prune_posted && !$prune_viewed) ? true : false;  				$prune_flags = 0; -				$prune_flags += (request_var('prune_old_polls', 0)) ? 2 : 0; -				$prune_flags += (request_var('prune_announce', 0)) ? 4 : 0; -				$prune_flags += (request_var('prune_sticky', 0)) ? 8 : 0; +				$prune_flags += ($request->variable('prune_old_polls', 0)) ? 2 : 0; +				$prune_flags += ($request->variable('prune_announce', 0)) ? 4 : 0; +				$prune_flags += ($request->variable('prune_sticky', 0)) ? 8 : 0;  				// Convert days to seconds for timestamp functions...  				$prunedate_posted = time() - ($prune_posted * 86400); @@ -157,7 +156,8 @@ class acp_prune  					// Sync all pruned forums at once  					sync('forum', 'forum_id', $prune_ids, true, true); -					add_log('admin', 'LOG_PRUNE', $log_data); + +					$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PRUNE', false, array($log_data));  				}  				$db->sql_freeresult($result); @@ -172,11 +172,11 @@ class acp_prune  					'all_forums'	=> $all_forums,  					'f'				=> $forum_id, -					'prune_days'		=> request_var('prune_days', 0), -					'prune_vieweddays'	=> request_var('prune_vieweddays', 0), -					'prune_old_polls'	=> request_var('prune_old_polls', 0), -					'prune_announce'	=> request_var('prune_announce', 0), -					'prune_sticky'		=> request_var('prune_sticky', 0), +					'prune_days'		=> $request->variable('prune_days', 0), +					'prune_vieweddays'	=> $request->variable('prune_vieweddays', 0), +					'prune_old_polls'	=> $request->variable('prune_old_polls', 0), +					'prune_announce'	=> $request->variable('prune_announce', 0), +					'prune_sticky'		=> $request->variable('prune_sticky', 0),  				)));  			}  		} @@ -232,8 +232,11 @@ class acp_prune  	*/  	function prune_users($id, $mode)  	{ -		global $db, $user, $auth, $template, $cache; -		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; +		global $db, $user, $auth, $template, $phpbb_log, $request; +		global $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container; + +		/** @var \phpbb\group\helper $group_helper */ +		$group_helper = $phpbb_container->get('group_helper');  		$user->add_lang('memberlist'); @@ -241,8 +244,8 @@ class acp_prune  		if ($prune)  		{ -			$action = request_var('action', 'deactivate'); -			$deleteposts = request_var('deleteposts', 0); +			$action = $request->variable('action', 'deactivate'); +			$deleteposts = $request->variable('deleteposts', 0);  			if (confirm_box(true))  			{ @@ -272,7 +275,7 @@ class acp_prune  						}  					} -					add_log('admin', $l_log, implode(', ', $usernames)); +					$phpbb_log->add('admin', $user->data['user_id'], $user->ip, $l_log, false, array(implode(', ', $usernames)));  					$msg = $user->lang['USER_' . strtoupper($action) . '_SUCCESS'];  				}  				else @@ -314,8 +317,8 @@ class acp_prune  					'mode'			=> $mode,  					'prune'			=> 1, -					'deleteposts'	=> request_var('deleteposts', 0), -					'action'		=> request_var('action', ''), +					'deleteposts'	=> $request->variable('deleteposts', 0), +					'action'		=> $request->variable('action', ''),  				)), 'confirm_body_prune.html');  			}  		} @@ -345,7 +348,7 @@ class acp_prune  		$s_group_list = '';  		while ($row = $db->sql_fetchrow($result))  		{ -			$s_group_list .= '<option value="' . $row['group_id'] . '">' . $row['group_name'] . '</option>'; +			$s_group_list .= '<option value="' . $row['group_id'] . '">' . $group_helper->get_name($row['group_name']) . '</option>';  		}  		$db->sql_freeresult($result); @@ -372,9 +375,9 @@ class acp_prune  	{  		global $user, $db, $request; -		$users_by_name = request_var('users', '', true); -		$users_by_id = request_var('user_ids', array(0)); -		$group_id = request_var('group_id', 0); +		$users_by_name = $request->variable('users', '', true); +		$users_by_id = $request->variable('user_ids', array(0)); +		$group_id = $request->variable('group_id', 0);  		$posts_on_queue = (trim($request->variable('posts_on_queue', '')) === '') ? false : $request->variable('posts_on_queue', 0);  		if ($users_by_name) @@ -391,15 +394,15 @@ class acp_prune  		}  		else  		{ -			$username = request_var('username', '', true); -			$email = request_var('email', ''); +			$username = $request->variable('username', '', true); +			$email = $request->variable('email', ''); -			$active_select = request_var('active_select', 'lt'); -			$count_select = request_var('count_select', 'eq'); -			$queue_select = request_var('queue_select', 'gt'); -			$joined_before = request_var('joined_before', ''); -			$joined_after = request_var('joined_after', ''); -			$active = request_var('active', ''); +			$active_select = $request->variable('active_select', 'lt'); +			$count_select = $request->variable('count_select', 'eq'); +			$queue_select = $request->variable('queue_select', 'gt'); +			$joined_before = $request->variable('joined_before', ''); +			$joined_after = $request->variable('joined_after', ''); +			$active = $request->variable('active', '');  			$count = ($request->variable('count', '') === '') ? false : $request->variable('count', 0); @@ -437,7 +440,6 @@ class acp_prune  			}  			$key_match = array('lt' => '<', 'gt' => '>', 'eq' => '='); -			$sort_by_types = array('username', 'user_email', 'user_posts', 'user_regdate', 'user_lastvisit');  			$where_sql = '';  			$where_sql .= ($username) ? ' AND username_clean ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($username))) : ''; diff --git a/phpBB/includes/acp/acp_ranks.php b/phpBB/includes/acp/acp_ranks.php index 5885de57ec..4d2b64d74c 100644 --- a/phpBB/includes/acp/acp_ranks.php +++ b/phpBB/includes/acp/acp_ranks.php @@ -25,16 +25,16 @@ class acp_ranks  	function main($id, $mode)  	{ -		global $db, $user, $auth, $template, $cache, $request, $phpbb_dispatcher; -		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; +		global $db, $user, $template, $cache, $request, $phpbb_dispatcher; +		global $config, $phpbb_root_path, $phpbb_admin_path, $phpbb_log;  		$user->add_lang('acp/posting');  		// Set up general vars -		$action = request_var('action', ''); +		$action = $request->variable('action', '');  		$action = (isset($_POST['add'])) ? 'add' : $action;  		$action = (isset($_POST['save'])) ? 'save' : $action; -		$rank_id = request_var('id', 0); +		$rank_id = $request->variable('id', 0);  		$this->tpl_name = 'acp_ranks';  		$this->page_title = 'ACP_MANAGE_RANKS'; @@ -50,10 +50,10 @@ class acp_ranks  				{  					trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING);  				} -				$rank_title = utf8_normalize_nfc(request_var('title', '', true)); -				$special_rank = request_var('special_rank', 0); -				$min_posts = ($special_rank) ? 0 : max(0, request_var('min_posts', 0)); -				$rank_image = request_var('rank_image', ''); +				$rank_title = $request->variable('title', '', true); +				$special_rank = $request->variable('special_rank', 0); +				$min_posts = ($special_rank) ? 0 : max(0, $request->variable('min_posts', 0)); +				$rank_image = $request->variable('rank_image', '');  				// The rank image has to be a jpg, gif or png  				if ($rank_image != '' && !preg_match('#(\.gif|\.png|\.jpg|\.jpeg)$#i', $rank_image)) @@ -89,14 +89,14 @@ class acp_ranks  					$sql = 'UPDATE ' . RANKS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE rank_id = $rank_id";  					$message = $user->lang['RANK_UPDATED']; -					add_log('admin', 'LOG_RANK_UPDATED', $rank_title); +					$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RANK_UPDATED', false, array($rank_title));  				}  				else  				{  					$sql = 'INSERT INTO ' . RANKS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);  					$message = $user->lang['RANK_ADDED']; -					add_log('admin', 'LOG_RANK_ADDED', $rank_title); +					$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RANK_ADDED', false, array($rank_title));  				}  				$db->sql_query($sql); @@ -133,7 +133,7 @@ class acp_ranks  					$cache->destroy('_ranks'); -					add_log('admin', 'LOG_RANK_REMOVED', $rank_title); +					$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RANK_REMOVED', false, array($rank_title));  					if ($request->is_ajax())  					{ @@ -162,7 +162,7 @@ class acp_ranks  			case 'edit':  			case 'add': -				$data = $ranks = $existing_imgs = array(); +				$ranks = $existing_imgs = array();  				$sql = 'SELECT *  					FROM ' . RANKS_TABLE . ' diff --git a/phpBB/includes/acp/acp_reasons.php b/phpBB/includes/acp/acp_reasons.php index bd40a88138..51c398681d 100644 --- a/phpBB/includes/acp/acp_reasons.php +++ b/phpBB/includes/acp/acp_reasons.php @@ -25,16 +25,15 @@ class acp_reasons  	function main($id, $mode)  	{ -		global $db, $user, $auth, $template, $cache; -		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; -		global $request; +		global $db, $user, $template; +		global $request, $phpbb_log;  		$user->add_lang(array('mcp', 'acp/posting'));  		// Set up general vars -		$action = request_var('action', ''); +		$action = $request->variable('action', '');  		$submit = (isset($_POST['submit'])) ? true : false; -		$reason_id = request_var('id', 0); +		$reason_id = $request->variable('id', 0);  		$this->tpl_name = 'acp_reasons';  		$this->page_title = 'ACP_REASONS'; @@ -50,8 +49,8 @@ class acp_reasons  			case 'edit':  				$reason_row = array( -					'reason_title'			=> utf8_normalize_nfc(request_var('reason_title', '', true)), -					'reason_description'	=> utf8_normalize_nfc(request_var('reason_description', '', true)), +					'reason_title'			=> $request->variable('reason_title', '', true), +					'reason_description'	=> $request->variable('reason_description', '', true),  				);  				if ($submit) @@ -139,7 +138,7 @@ class acp_reasons  							$log = 'UPDATED';  						} -						add_log('admin', 'LOG_REASON_' . $log, $reason_row['reason_title']); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_REASON_' . $log, false, array($reason_row['reason_title']));  						trigger_error($user->lang['REASON_' . $log] . adm_back_link($this->u_action));  					}  				} @@ -232,7 +231,6 @@ class acp_reasons  						break;  						// Standard? What's that? -						case 'mssql':  						case 'mssql_odbc':  						case 'mssqlnative':  							// Change the reports using this reason to 'other' @@ -252,7 +250,6 @@ class acp_reasons  						// Teh standard  						case 'postgres':  						case 'oracle': -						case 'sqlite':  						case 'sqlite3':  							// Change the reports using this reason to 'other'  							$sql = 'UPDATE ' . REPORTS_TABLE . ' @@ -264,7 +261,7 @@ class acp_reasons  					$db->sql_query('DELETE FROM ' . REPORTS_REASONS_TABLE . ' WHERE reason_id = ' . $reason_id); -					add_log('admin', 'LOG_REASON_REMOVED', $reason_row['reason_title']); +					$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_REASON_REMOVED', false, array($reason_row['reason_title']));  					trigger_error($user->lang['REASON_REMOVED'] . adm_back_link($this->u_action));  				}  				else diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index cc1e5df084..a792ee6b79 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -50,8 +50,8 @@ class acp_search  	function settings($id, $mode)  	{ -		global $db, $user, $auth, $template, $cache, $request; -		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; +		global $user, $template, $phpbb_log, $request; +		global $config, $phpbb_admin_path, $phpEx;  		$submit = (isset($_POST['submit'])) ? true : false; @@ -109,8 +109,8 @@ class acp_search  		unset($search);  		unset($error); -		$cfg_array = (isset($_REQUEST['config'])) ? request_var('config', array('' => ''), true) : array(); -		$updated = request_var('updated', false); +		$cfg_array = (isset($_REQUEST['config'])) ? $request->variable('config', array('' => ''), true) : array(); +		$updated = $request->variable('updated', false);  		foreach ($settings as $config_name => $var_type)  		{ @@ -138,7 +138,7 @@ class acp_search  			// only change config if anything was actually changed  			if ($submit && ($config[$config_name] != $config_value))  			{ -				set_config($config_name, $config_value); +				$config->set($config_name, $config_value);  				$updated = true;  			}  		} @@ -148,7 +148,7 @@ class acp_search  			$extra_message = '';  			if ($updated)  			{ -				add_log('admin', 'LOG_CONFIG_SEARCH'); +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_SEARCH');  			}  			if (isset($cfg_array['search_type']) && in_array($cfg_array['search_type'], $search_types, true) && ($cfg_array['search_type'] != $config['search_type'])) @@ -162,11 +162,11 @@ class acp_search  					{  						if (!method_exists($search, 'init') || !($error = $search->init()))  						{ -							set_config('search_type', $cfg_array['search_type']); +							$config->set('search_type', $cfg_array['search_type']);  							if (!$updated)  							{ -								add_log('admin', 'LOG_CONFIG_SEARCH'); +								$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_SEARCH');  							}  							$extra_message = '<br />' . $user->lang['SWITCHED_SEARCH_BACKEND'] . '<br /><a href="' . append_sid("{$phpbb_admin_path}index.$phpEx", 'i=search&mode=index') . '">» ' . $user->lang['GO_TO_SEARCH_INDEX'] . '</a>';  						} @@ -237,10 +237,10 @@ class acp_search  	function index($id, $mode)  	{ -		global $db, $user, $auth, $template, $cache, $request; -		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; +		global $db, $user, $template, $phpbb_log, $request; +		global $config, $phpbb_admin_path, $phpEx; -		$action = request_var('action', ''); +		$action = $request->variable('action', '');  		$this->state = explode(',', $config['search_indexing_state']);  		if (isset($_POST['cancel'])) @@ -261,7 +261,7 @@ class acp_search  			switch ($action)  			{  				case 'progress_bar': -					$type = request_var('type', ''); +					$type = $request->variable('type', '');  					$this->display_progress_bar($type);  				break; @@ -280,7 +280,7 @@ class acp_search  			if (empty($this->state[0]))  			{ -				$this->state[0] = request_var('search_type', ''); +				$this->state[0] = $request->variable('search_type', '');  			}  			$this->search = null; @@ -314,8 +314,7 @@ class acp_search  					}  					else  					{ -						$starttime = explode(' ', microtime()); -						$starttime = $starttime[1] + $starttime[0]; +						$starttime = microtime(true);  						$row_count = 0;  						while (still_on_time() && $post_counter <= $this->max_post_id)  						{ @@ -347,8 +346,7 @@ class acp_search  						if ($post_counter <= $this->max_post_id)  						{ -							$mtime = explode(' ', microtime()); -							$totaltime = $mtime[0] + $mtime[1] - $starttime; +							$totaltime = microtime(true) - $starttime;  							$rows_per_second = $row_count / $totaltime;  							meta_refresh(1, append_sid($this->u_action . '&action=delete&skip_rows=' . $post_counter . '&hash=' . generate_link_hash('acp_search')));  							trigger_error($user->lang('SEARCH_INDEX_DELETE_REDIRECT', (int) $row_count, $post_counter, $rows_per_second)); @@ -360,7 +358,7 @@ class acp_search  					$this->state = array('');  					$this->save_state(); -					add_log('admin', 'LOG_SEARCH_INDEX_REMOVED', $name); +					$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_SEARCH_INDEX_REMOVED', false, array($name));  					trigger_error($user->lang['SEARCH_INDEX_REMOVED'] . adm_back_link($this->u_action) . $this->close_popup_js());  				break; @@ -387,8 +385,7 @@ class acp_search  						}  						$db->sql_freeresult($result); -						$starttime = explode(' ', microtime()); -						$starttime = $starttime[1] + $starttime[0]; +						$starttime = microtime(true);  						$row_count = 0;  						while (still_on_time() && $post_counter <= $this->max_post_id)  						{ @@ -437,8 +434,7 @@ class acp_search  						if ($post_counter <= $this->max_post_id)  						{ -							$mtime = explode(' ', microtime()); -							$totaltime = $mtime[0] + $mtime[1] - $starttime; +							$totaltime = microtime(true) - $starttime;  							$rows_per_second = $row_count / $totaltime;  							meta_refresh(1, append_sid($this->u_action . '&action=create&skip_rows=' . $post_counter . '&hash=' . generate_link_hash('acp_search')));  							trigger_error($user->lang('SEARCH_INDEX_CREATE_REDIRECT', (int) $row_count, $post_counter) . $user->lang('SEARCH_INDEX_CREATE_REDIRECT_RATE', $rows_per_second)); @@ -450,7 +446,7 @@ class acp_search  					$this->state = array('');  					$this->save_state(); -					add_log('admin', 'LOG_SEARCH_INDEX_CREATED', $name); +					$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_SEARCH_INDEX_CREATED', false, array($name));  					trigger_error($user->lang['SEARCH_INDEX_CREATED'] . adm_back_link($this->u_action) . $this->close_popup_js());  				break;  			} @@ -566,7 +562,7 @@ class acp_search  	function get_search_types()  	{ -		global $phpbb_root_path, $phpEx, $phpbb_extension_manager; +		global $phpbb_extension_manager;  		$finder = $phpbb_extension_manager->get_finder(); @@ -592,6 +588,8 @@ class acp_search  	function save_state($state = false)  	{ +		global $config; +  		if ($state)  		{  			$this->state = $state; @@ -599,7 +597,7 @@ class acp_search  		ksort($this->state); -		set_config('search_indexing_state', implode(',', $this->state), true); +		$config->set('search_indexing_state', implode(',', $this->state), true);  	}  	/** diff --git a/phpBB/includes/acp/acp_send_statistics.php b/phpBB/includes/acp/acp_send_statistics.php deleted file mode 100644 index 7c9e9cf78e..0000000000 --- a/phpBB/includes/acp/acp_send_statistics.php +++ /dev/null @@ -1,91 +0,0 @@ -<?php -/** -* -* This file is part of the phpBB Forum Software package. -* -* @copyright (c) phpBB Limited <https://www.phpbb.com> -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ -	exit; -} - -class acp_send_statistics -{ -	var $u_action; - -	function main($id, $mode) -	{ -		global $config, $template, $phpbb_admin_path, $phpbb_root_path, $phpEx; - -		if (!class_exists('phpbb_questionnaire_data_collector')) -		{ -			include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx); -		} - -		$collect_url = "https://www.phpbb.com/stats/receive_stats.php"; - -		$this->tpl_name = 'acp_send_statistics'; -		$this->page_title = 'ACP_SEND_STATISTICS'; - -		// generate a unique id if necessary -		if (!isset($config['questionnaire_unique_id'])) -		{ -			$install_id = unique_id(); -			set_config('questionnaire_unique_id', $install_id); -		} -		else -		{ -			$install_id = $config['questionnaire_unique_id']; -		} - -		$collector = new phpbb_questionnaire_data_collector($install_id); - -		// Add data provider -		$collector->add_data_provider(new phpbb_questionnaire_php_data_provider()); -		$collector->add_data_provider(new phpbb_questionnaire_system_data_provider()); -		$collector->add_data_provider(new phpbb_questionnaire_phpbb_data_provider($config)); - -		$template->assign_vars(array( -			'U_COLLECT_STATS'	=> $collect_url, -			'RAW_DATA'			=> $collector->get_data_for_form(), -			'U_ACP_MAIN'		=> append_sid("{$phpbb_admin_path}index.$phpEx"), -		)); - -		$raw = $collector->get_data_raw(); - -		foreach ($raw as $provider => $data) -		{ -			if ($provider == 'install_id') -			{ -				$data = array($provider => $data); -			} - -			$template->assign_block_vars('providers', array( -				'NAME'	=> htmlspecialchars($provider), -			)); - -			foreach ($data as $key => $value) -			{ -				if (is_array($value)) -				{ -					$value = utf8_wordwrap(serialize($value), 75, "\n", true); -				} - -				$template->assign_block_vars('providers.values', array( -					'KEY'	=> utf8_htmlspecialchars($key), -					'VALUE'	=> utf8_htmlspecialchars($value), -				)); -			} -		} -	} -} diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index c29fb062d8..5b31417b83 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -32,6 +32,9 @@ class acp_styles  	protected $styles_list_cols = 0;  	protected $reserved_style_names = array('adm', 'admin', 'all'); +	/** @var \phpbb\config\config */ +	protected $config; +  	/** @var \phpbb\db\driver\driver_interface */  	protected $db; @@ -50,6 +53,9 @@ class acp_styles  	/** @var \phpbb\auth\auth */  	protected $auth; +	/** @var \phpbb\textformatter\cache_interface */ +	protected $text_formatter_cache; +  	/** @var string */  	protected $phpbb_root_path; @@ -61,7 +67,7 @@ class acp_styles  	public function main($id, $mode)  	{ -		global $db, $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request, $cache, $auth, $config, $phpbb_dispatcher; +		global $db, $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request, $cache, $auth, $config, $phpbb_dispatcher, $phpbb_container;  		$this->db = $db;  		$this->user = $user; @@ -69,6 +75,7 @@ class acp_styles  		$this->request = $request;  		$this->cache = $cache;  		$this->auth = $auth; +		$this->text_formatter_cache = $phpbb_container->get('text_formatter.cache');  		$this->config = $config;  		$this->phpbb_root_path = $phpbb_root_path;  		$this->php_ext = $phpEx; @@ -194,7 +201,6 @@ class acp_styles  		$messages = array();  		$installed_names = array();  		$installed_dirs = array(); -		$last_installed = false;  		foreach ($dirs as $dir)  		{  			if (in_array($dir, $this->reserved_style_names)) @@ -217,7 +223,6 @@ class acp_styles  					$style['style_id'] = $this->install_style($style);  					$style['_installed'] = true;  					$found = true; -					$last_installed = $style['style_id'];  					$installed_names[] = $style['style_name'];  					$installed_dirs[] = $style['style_path'];  					$messages[] = sprintf($this->user->lang['STYLE_INSTALLED'], htmlspecialchars($style['style_name'])); @@ -229,6 +234,12 @@ class acp_styles  			}  		} +		// Invalidate the text formatter's cache for the new styles to take effect +		if (!empty($installed_names)) +		{ +			$this->text_formatter_cache->invalidate(); +		} +  		// Show message  		if (!count($messages))  		{ @@ -276,6 +287,8 @@ class acp_styles  	*/  	protected function action_uninstall_confirmed($ids, $delete_files)  	{ +		global $user, $phpbb_log; +  		$default = $this->default_style;  		$uninstalled = array();  		$messages = array(); @@ -335,7 +348,7 @@ class acp_styles  		// Log action  		if (count($uninstalled))  		{ -			add_log('admin', 'LOG_STYLE_DELETE', implode(', ', $uninstalled)); +			$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_STYLE_DELETE', false, array(implode(', ', $uninstalled)));  		}  		// Clear cache @@ -385,7 +398,7 @@ class acp_styles  		// Reset default style for users who use selected styles  		$sql = 'UPDATE ' . USERS_TABLE . ' -			SET user_style = 0 +			SET user_style = ' . (int) $this->default_style . '  			WHERE user_style IN (' . implode(', ', $ids) . ')';  		$this->db->sql_query($sql); @@ -407,6 +420,8 @@ class acp_styles  	*/  	protected function action_details()  	{ +		global $user, $phpbb_log; +  		$id = $this->request->variable('id', 0);  		if (!$id)  		{ @@ -541,7 +556,8 @@ class acp_styles  						$this->cache->purge();  					}  				} -				add_log('admin', 'LOG_STYLE_EDIT_DETAILS', $style['style_name']); + +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_STYLE_EDIT_DETAILS', false, array($style['style_name']));  			}  			// Update default style @@ -552,7 +568,7 @@ class acp_styles  				{  					trigger_error($this->user->lang['STYLE_DEFAULT_CHANGE_INACTIVE'] . adm_back_link($update_action), E_USER_WARNING);  				} -				set_config('default_style', $id); +				$this->config->set('default_style', $id);  				$this->cache->purge();  			} @@ -1139,6 +1155,8 @@ class acp_styles  	*/  	protected function install_style($style)  	{ +		global $user, $phpbb_log; +  		// Generate row  		$sql_ary = array();  		foreach ($style as $key => $value) @@ -1160,7 +1178,7 @@ class acp_styles  		$this->db->sql_transaction('commit'); -		add_log('admin', 'LOG_STYLE_ADD', $sql_ary['style_name']); +		$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_STYLE_ADD', false, array($sql_ary['style_name']));  		return $id;  	} @@ -1231,7 +1249,7 @@ class acp_styles  		// Change default style for users  		$sql = 'UPDATE ' . USERS_TABLE . ' -			SET user_style = 0 +			SET user_style = ' . (int) $this->default_style . '  			WHERE user_style = ' . $id;  		$this->db->sql_query($sql); diff --git a/phpBB/includes/acp/acp_update.php b/phpBB/includes/acp/acp_update.php index cee2ce222e..9124a59ef2 100644 --- a/phpBB/includes/acp/acp_update.php +++ b/phpBB/includes/acp/acp_update.php @@ -33,6 +33,7 @@ class acp_update  		$this->tpl_name = 'acp_update';  		$this->page_title = 'ACP_VERSION_CHECK'; +		/* @var $version_helper \phpbb\version_helper */  		$version_helper = $phpbb_container->get('version_helper');  		try  		{ @@ -51,9 +52,12 @@ class acp_update  			$updates_available = array();  		} -		$template->assign_block_vars('updates_available', $updates_available); +		if (!empty($updates_available)) +		{ +			$template->assign_block_vars('updates_available', $updates_available); +		} -		$update_link = append_sid($phpbb_root_path . 'install/'); +		$update_link = $phpbb_root_path . 'install/app.' . $phpEx;  		$template->assign_vars(array(  			'S_UP_TO_DATE'			=> empty($updates_available), @@ -70,7 +74,7 @@ class acp_update  		// Incomplete update?  		if (phpbb_version_compare($config['version'], PHPBB_VERSION, '<'))  		{ -			$database_update_link = append_sid($phpbb_root_path . 'install/database_update.' . $phpEx); +			$database_update_link = $phpbb_root_path . 'install/app.php/update';  			$template->assign_vars(array(  				'S_UPDATE_INCOMPLETE'		=> true, diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index cd44800af8..090cb32ebb 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -31,21 +31,21 @@ class acp_users  	function main($id, $mode)  	{ -		global $config, $db, $user, $auth, $template, $cache; -		global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads; +		global $config, $db, $user, $auth, $template; +		global $phpbb_root_path, $phpbb_admin_path, $phpEx;  		global $phpbb_dispatcher, $request; -		global $phpbb_container; +		global $phpbb_container, $phpbb_log;  		$user->add_lang(array('posting', 'ucp', 'acp/users'));  		$this->tpl_name = 'acp_users';  		$error		= array(); -		$username	= utf8_normalize_nfc(request_var('username', '', true)); -		$user_id	= request_var('u', 0); -		$action		= request_var('action', ''); +		$username	= $request->variable('username', '', true); +		$user_id	= $request->variable('u', 0); +		$action		= $request->variable('action', '');  		// Get referer to redirect user to the appropriate page after delete action -		$redirect		= request_var('redirect', ''); +		$redirect		= $request->variable('redirect', '');  		$redirect_tag	= "redirect=$redirect";  		$redirect_url	= append_sid("{$phpbb_admin_path}index.$phpEx", "i=$redirect"); @@ -65,7 +65,7 @@ class acp_users  			$this->page_title = 'WHOIS';  			$this->tpl_name = 'simple_body'; -			$user_ip = phpbb_ip_normalise(request_var('user_ip', '')); +			$user_ip = phpbb_ip_normalise($request->variable('user_ip', ''));  			$domain = gethostbyaddr($user_ip);  			$ipwhois = user_ipwhois($user_ip); @@ -180,9 +180,9 @@ class acp_users  				$user->add_lang('acp/ban'); -				$delete			= request_var('delete', 0); -				$delete_type	= request_var('delete_type', ''); -				$ip				= request_var('ip', 'ip'); +				$delete			= $request->variable('delete', 0); +				$delete_type	= $request->variable('delete_type', ''); +				$ip				= $request->variable('ip', 'ip');  				/**  				 * Run code at beginning of ACP users overview @@ -205,6 +205,7 @@ class acp_users  					{  						if (!$auth->acl_get('a_userdel'))  						{ +							send_status_line(403, 'Forbidden');  							trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);  						} @@ -231,7 +232,7 @@ class acp_users  							{  								user_delete($delete_type, $user_id, $user_row['username']); -								add_log('admin', 'LOG_USER_DELETED', $user_row['username']); +								$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DELETED', false, array($user_row['username']));  								trigger_error($user->lang['USER_DELETED'] . adm_back_link(  										(empty($redirect)) ? $this->u_action : $redirect_url  									) @@ -298,13 +299,11 @@ class acp_users  								case 'banuser':  									$ban[] = $user_row['username'];  									$reason = 'USER_ADMIN_BAN_NAME_REASON'; -									$log = 'LOG_USER_BAN_USER';  								break;  								case 'banemail':  									$ban[] = $user_row['user_email'];  									$reason = 'USER_ADMIN_BAN_EMAIL_REASON'; -									$log = 'LOG_USER_BAN_EMAIL';  								break;  								case 'banip': @@ -322,12 +321,11 @@ class acp_users  									$db->sql_freeresult($result);  									$reason = 'USER_ADMIN_BAN_IP_REASON'; -									$log = 'LOG_USER_BAN_IP';  								break;  							} -							$ban_reason = utf8_normalize_nfc(request_var('ban_reason', $user->lang[$reason], true)); -							$ban_give_reason = utf8_normalize_nfc(request_var('ban_give_reason', '', true)); +							$ban_reason = $request->variable('ban_reason', $user->lang[$reason], true); +							$ban_give_reason = $request->variable('ban_give_reason', '', true);  							// Log not used at the moment, we simply utilize the ban function.  							$result = user_ban(substr($action, 3), $ban, 0, 0, 0, $ban_reason, $ban_give_reason); @@ -411,8 +409,10 @@ class acp_users  								$messenger->send(NOTIFY_EMAIL); -								add_log('admin', 'LOG_USER_REACTIVATE', $user_row['username']); -								add_log('user', $user_id, 'LOG_USER_REACTIVATE_USER'); +								$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_REACTIVATE', false, array($user_row['username'])); +								$phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_REACTIVATE_USER', false, array( +									'reportee_id' => $user_id +								));  								trigger_error($user->lang['FORCE_REACTIVATION_SUCCESS'] . adm_back_link($this->u_action . '&u=' . $user_id));  							} @@ -448,6 +448,7 @@ class acp_users  							{  								if ($config['require_activation'] == USER_ACTIVATION_ADMIN)  								{ +									/* @var $phpbb_notifications \phpbb\notification\manager */  									$phpbb_notifications = $phpbb_container->get('notification_manager');  									$phpbb_notifications->delete_notifications('notification.type.admin_activate_user', $user_row['user_id']); @@ -475,8 +476,10 @@ class acp_users  							$message = ($user_row['user_type'] == USER_INACTIVE) ? 'USER_ADMIN_ACTIVATED' : 'USER_ADMIN_DEACTIVED';  							$log = ($user_row['user_type'] == USER_INACTIVE) ? 'LOG_USER_ACTIVE' : 'LOG_USER_INACTIVE'; -							add_log('admin', $log, $user_row['username']); -							add_log('user', $user_id, $log . '_USER'); +							$phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log, false, array($user_row['username'])); +							$phpbb_log->add('user', $user->data['user_id'], $user->ip, $log . '_USER', false, array( +								'reportee_id' => $user_id +							));  							trigger_error($user->lang[$message] . adm_back_link($this->u_action . '&u=' . $user_id)); @@ -499,8 +502,10 @@ class acp_users  								WHERE user_id = $user_id";  							$db->sql_query($sql); -							add_log('admin', 'LOG_USER_DEL_SIG', $user_row['username']); -							add_log('user', $user_id, 'LOG_USER_DEL_SIG_USER'); +							$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_SIG', false, array($user_row['username'])); +							$phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_SIG_USER', false, array( +								'reportee_id' => $user_id +							));  							trigger_error($user->lang['USER_ADMIN_SIG_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); @@ -514,11 +519,14 @@ class acp_users  							}  							// Delete old avatar if present +							/* @var $phpbb_avatar_manager \phpbb\avatar\manager */  							$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');  							$phpbb_avatar_manager->handle_avatar_delete($db, $user, $phpbb_avatar_manager->clean_row($user_row, 'user'), USERS_TABLE, 'user_'); -							add_log('admin', 'LOG_USER_DEL_AVATAR', $user_row['username']); -							add_log('user', $user_id, 'LOG_USER_DEL_AVATAR_USER'); +							$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_AVATAR', false, array($user_row['username'])); +							$phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_AVATAR_USER', false, array( +								'reportee_id' => $user_id +							));  							trigger_error($user->lang['USER_ADMIN_AVATAR_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id));  						break; @@ -530,7 +538,7 @@ class acp_users  								// Delete posts, attachments, etc.  								delete_posts('poster_id', $user_id); -								add_log('admin', 'LOG_USER_DEL_POSTS', $user_row['username']); +								$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_POSTS', false, array($user_row['username']));  								trigger_error($user->lang['USER_POSTS_DELETED'] . adm_back_link($this->u_action . '&u=' . $user_id));  							}  							else @@ -550,9 +558,12 @@ class acp_users  							if (confirm_box(true))  							{ -								delete_attachments('user', $user_id); +								/** @var \phpbb\attachment\manager $attachment_manager */ +								$attachment_manager = $phpbb_container->get('attachment.manager'); +								$attachment_manager->delete('user', $user_id); +								unset($attachment_manager); -								add_log('admin', 'LOG_USER_DEL_ATTACH', $user_row['username']); +								$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_ATTACH', false, array($user_row['username']));  								trigger_error($user->lang['USER_ATTACHMENTS_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id));  							}  							else @@ -598,7 +609,7 @@ class acp_users  									delete_pm($user_id, $msg_ids, PRIVMSGS_OUTBOX); -									add_log('admin', 'LOG_USER_DEL_OUTBOX', $user_row['username']); +									$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_OUTBOX', false, array($user_row['username']));  									$lang = 'EMPTIED';  								} @@ -627,7 +638,7 @@ class acp_users  							$user->add_lang('acp/forums'); -							$new_forum_id = request_var('new_f', 0); +							$new_forum_id = $request->variable('new_f', 0);  							if (!$new_forum_id)  							{ @@ -769,8 +780,11 @@ class acp_users  								sync('forum', 'forum_id', $forum_id_ary, false, true);  							} -							add_log('admin', 'LOG_USER_MOVE_POSTS', $user_row['username'], $forum_info['forum_name']); -							add_log('user', $user_id, 'LOG_USER_MOVE_POSTS_USER', $forum_info['forum_name']); +							$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_MOVE_POSTS', false, array($user_row['username'], $forum_info['forum_name'])); +							$phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_MOVE_POSTS_USER', false, array( +								'reportee_id' => $user_id, +								$forum_info['forum_name'] +							));  							trigger_error($user->lang['USER_POSTS_MOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); @@ -782,7 +796,7 @@ class acp_users  							{  								remove_newly_registered($user_id, $user_row); -								add_log('admin', 'LOG_USER_REMOVED_NR', $user_row['username']); +								$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_REMOVED_NR', false, array($user_row['username']));  								trigger_error($user->lang['USER_LIFTED_NR'] . adm_back_link($this->u_action . '&u=' . $user_id));  							}  							else @@ -799,24 +813,30 @@ class acp_users  						break;  						default: +							$u_action = $this->u_action; +  							/**  							* Run custom quicktool code  							*  							* @event core.acp_users_overview_run_quicktool -							* @var	array	user_row	Current user data  							* @var	string	action		Quick tool that should be run +							* @var	array	user_row	Current user data +							* @var	string	u_action	The u_action link  							* @since 3.1.0-a1 +							* @changed 3.2.2-RC1 Added u_action  							*/ -							$vars = array('action', 'user_row'); +							$vars = array('action', 'user_row', 'u_action');  							extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_run_quicktool', compact($vars))); + +							unset($u_action);  						break;  					}  					// Handle registration info updates  					$data = array( -						'username'			=> utf8_normalize_nfc(request_var('user', $user_row['username'], true)), -						'user_founder'		=> request_var('user_founder', ($user_row['user_type'] == USER_FOUNDER) ? 1 : 0), -						'email'				=> strtolower(request_var('user_email', $user_row['user_email'])), +						'username'			=> $request->variable('user', $user_row['username'], true), +						'user_founder'		=> $request->variable('user_founder', ($user_row['user_type'] == USER_FOUNDER) ? 1 : 0), +						'email'				=> strtolower($request->variable('user_email', $user_row['user_email'])),  						'new_password'		=> $request->variable('new_password', '', true),  						'password_confirm'	=> $request->variable('password_confirm', '', true),  					); @@ -864,6 +884,7 @@ class acp_users  					}  					// Instantiate passwords manager +					/* @var $passwords_manager \phpbb\passwords\manager */  					$passwords_manager = $phpbb_container->get('passwords.manager');  					// Which updates do we need to do? @@ -936,7 +957,11 @@ class acp_users  							$sql_ary['username'] = $update_username;  							$sql_ary['username_clean'] = utf8_clean_string($update_username); -							add_log('user', $user_id, 'LOG_USER_UPDATE_NAME', $user_row['username'], $update_username); +							$phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_UPDATE_NAME', false, array( +								'reportee_id' => $user_id, +								$user_row['username'], +								$update_username +							));  						}  						if ($update_email !== false) @@ -946,7 +971,12 @@ class acp_users  								'user_email_hash'	=> phpbb_email_hash($update_email),  							); -							add_log('user', $user_id, 'LOG_USER_UPDATE_EMAIL', $user_row['username'], $user_row['user_email'], $update_email); +							$phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_UPDATE_EMAIL', false, array( +								'reportee_id' => $user_id, +								$user_row['username'], +								$user_row['user_email'], +								$update_email +							));  						}  						if ($update_password) @@ -957,7 +987,11 @@ class acp_users  							);  							$user->reset_login_keys($user_id); -							add_log('user', $user_id, 'LOG_USER_NEW_PASSWORD', $user_row['username']); + +							$phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_NEW_PASSWORD', false, array( +								'reportee_id' => $user_id, +								$user_row['username'] +							));  						}  						if (sizeof($sql_ary)) @@ -976,7 +1010,7 @@ class acp_users  						// Let the users permissions being updated  						$auth->acl_clear_prefetch($user_id); -						add_log('admin', 'LOG_USER_USER_UPDATE', $data['username']); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_USER_UPDATE', false, array($data['username']));  						trigger_error($user->lang['USER_OVERVIEW_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id));  					} @@ -1133,17 +1167,19 @@ class acp_users  				$user->add_lang('mcp');  				// Set up general vars -				$start		= request_var('start', 0); +				$start		= $request->variable('start', 0);  				$deletemark = (isset($_POST['delmarked'])) ? true : false;  				$deleteall	= (isset($_POST['delall'])) ? true : false; -				$marked		= request_var('mark', array(0)); -				$message	= utf8_normalize_nfc(request_var('message', '', true)); +				$marked		= $request->variable('mark', array(0)); +				$message	= $request->variable('message', '', true); + +				/* @var $pagination \phpbb\pagination */  				$pagination = $phpbb_container->get('pagination');  				// Sort keys -				$sort_days	= request_var('st', 0); -				$sort_key	= request_var('sk', 't'); -				$sort_dir	= request_var('sd', 'd'); +				$sort_days	= $request->variable('st', 0); +				$sort_key	= $request->variable('sk', 't'); +				$sort_dir	= $request->variable('sd', 'd');  				// Delete entries if requested and able  				if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) @@ -1173,7 +1209,7 @@ class acp_users  							$where_sql";  						$db->sql_query($sql); -						add_log('admin', 'LOG_CLEAR_USER', $user_row['username']); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CLEAR_USER', false, array($user_row['username']));  					}  				} @@ -1184,9 +1220,16 @@ class acp_users  						trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);  					} -					add_log('admin', 'LOG_USER_FEEDBACK', $user_row['username']); -					add_log('mod', 0, 0, 'LOG_USER_FEEDBACK', $user_row['username']); -					add_log('user', $user_id, 'LOG_USER_GENERAL', $message); +					$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_FEEDBACK', false, array($user_row['username'])); +					$phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_USER_FEEDBACK', false, array( +						'forum_id' => 0, +						'topic_id' => 0, +						$user_row['username'] +					)); +					$phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GENERAL', false, array( +						'reportee_id' => $user_id, +						$message +					));  					trigger_error($user->lang['USER_FEEDBACK_ADDED'] . adm_back_link($this->u_action . '&u=' . $user_id));  				} @@ -1237,17 +1280,10 @@ class acp_users  				$user->add_lang('mcp');  				// Set up general vars -				$start		= request_var('start', 0);  				$deletemark	= (isset($_POST['delmarked'])) ? true : false;  				$deleteall	= (isset($_POST['delall'])) ? true : false;  				$confirm	= (isset($_POST['confirm'])) ? true : false; -				$marked		= request_var('mark', array(0)); -				$message	= utf8_normalize_nfc(request_var('message', '', true)); - -				// Sort keys -				$sort_days	= request_var('st', 0); -				$sort_key	= request_var('sk', 't'); -				$sort_dir	= request_var('sd', 'd'); +				$marked		= $request->variable('mark', array(0));  				// Delete entries if requested and able  				if ($deletemark || $deleteall || $confirm) @@ -1255,8 +1291,8 @@ class acp_users  					if (confirm_box(true))  					{  						$where_sql = ''; -						$deletemark = request_var('delmarked', 0); -						$deleteall = request_var('delall', 0); +						$deletemark = $request->variable('delmarked', 0); +						$deleteall = $request->variable('delall', 0);  						if ($deletemark && $marked)  						{  							$where_sql = ' AND ' . $db->sql_in_set('warning_id', array_values($marked)); @@ -1287,11 +1323,11 @@ class acp_users  							if ($log_warnings)  							{ -								add_log('admin', 'LOG_WARNINGS_DELETED', $user_row['username'], $num_warnings); +								$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_WARNINGS_DELETED', false, array($user_row['username'], $num_warnings));  							}  							else  							{ -								add_log('admin', 'LOG_WARNINGS_DELETED_ALL', $user_row['username']); +								$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_WARNINGS_DELETED_ALL', false, array($user_row['username']));  							}  						}  					} @@ -1383,6 +1419,7 @@ class acp_users  					include($phpbb_root_path . 'includes/functions_user.' . $phpEx);  				} +				/* @var $cp \phpbb\profilefields\manager */  				$cp = $phpbb_container->get('profilefields.manager');  				$cp_data = $cp_error = array(); @@ -1397,7 +1434,7 @@ class acp_users  				$user_row['iso_lang_id'] = $row['lang_id'];  				$data = array( -					'jabber'		=> utf8_normalize_nfc(request_var('jabber', $user_row['user_jabber'], true)), +					'jabber'		=> $request->variable('jabber', $user_row['user_jabber'], true),  					'bday_day'		=> 0,  					'bday_month'	=> 0,  					'bday_year'		=> 0, @@ -1408,9 +1445,9 @@ class acp_users  					list($data['bday_day'], $data['bday_month'], $data['bday_year']) = explode('-', $user_row['user_birthday']);  				} -				$data['bday_day']		= request_var('bday_day', $data['bday_day']); -				$data['bday_month']		= request_var('bday_month', $data['bday_month']); -				$data['bday_year']		= request_var('bday_year', $data['bday_year']); +				$data['bday_day']		= $request->variable('bday_day', $data['bday_day']); +				$data['bday_month']		= $request->variable('bday_month', $data['bday_month']); +				$data['bday_year']		= $request->variable('bday_year', $data['bday_year']);  				$data['user_birthday']	= sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']);  				/** @@ -1454,12 +1491,14 @@ class acp_users  					* Validate profile data in ACP before submitting to the database  					*  					* @event core.acp_users_profile_validate -					* @var	bool	submit		Flag indicating if submit button has been pressed  					* @var	array	data		Array with user profile data +					* @var	int		user_id		The user id +					* @var	array	user_row	Array with the full user data  					* @var	array	error		Array with the form errors  					* @since 3.1.4-RC1 +					* @changed 3.1.12-RC1		Removed submit, added user_id, user_row  					*/ -					$vars = array('submit', 'data', 'error'); +					$vars = array('data', 'user_id', 'user_row', 'error');  					extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_validate', compact($vars)));  					if (!sizeof($error)) @@ -1511,7 +1550,6 @@ class acp_users  					$selected = ($i == $data['bday_month']) ? ' selected="selected"' : '';  					$s_birthday_month_options .= "<option value=\"$i\"$selected>$i</option>";  				} -				$s_birthday_year_options = '';  				$now = getdate();  				$s_birthday_year_options = '<option value="0"' . ((!$data['bday_year']) ? ' selected="selected"' : '') . '>--</option>'; @@ -1546,36 +1584,36 @@ class acp_users  				}  				$data = array( -					'dateformat'		=> utf8_normalize_nfc(request_var('dateformat', $user_row['user_dateformat'], true)), -					'lang'				=> basename(request_var('lang', $user_row['user_lang'])), -					'tz'				=> request_var('tz', $user_row['user_timezone']), -					'style'				=> request_var('style', $user_row['user_style']), -					'viewemail'			=> request_var('viewemail', $user_row['user_allow_viewemail']), -					'massemail'			=> request_var('massemail', $user_row['user_allow_massemail']), -					'hideonline'		=> request_var('hideonline', !$user_row['user_allow_viewonline']), -					'notifymethod'		=> request_var('notifymethod', $user_row['user_notify_type']), -					'notifypm'			=> request_var('notifypm', $user_row['user_notify_pm']), -					'allowpm'			=> request_var('allowpm', $user_row['user_allow_pm']), - -					'topic_sk'			=> request_var('topic_sk', ($user_row['user_topic_sortby_type']) ? $user_row['user_topic_sortby_type'] : 't'), -					'topic_sd'			=> request_var('topic_sd', ($user_row['user_topic_sortby_dir']) ? $user_row['user_topic_sortby_dir'] : 'd'), -					'topic_st'			=> request_var('topic_st', ($user_row['user_topic_show_days']) ? $user_row['user_topic_show_days'] : 0), - -					'post_sk'			=> request_var('post_sk', ($user_row['user_post_sortby_type']) ? $user_row['user_post_sortby_type'] : 't'), -					'post_sd'			=> request_var('post_sd', ($user_row['user_post_sortby_dir']) ? $user_row['user_post_sortby_dir'] : 'a'), -					'post_st'			=> request_var('post_st', ($user_row['user_post_show_days']) ? $user_row['user_post_show_days'] : 0), - -					'view_images'		=> request_var('view_images', $this->optionget($user_row, 'viewimg')), -					'view_flash'		=> request_var('view_flash', $this->optionget($user_row, 'viewflash')), -					'view_smilies'		=> request_var('view_smilies', $this->optionget($user_row, 'viewsmilies')), -					'view_sigs'			=> request_var('view_sigs', $this->optionget($user_row, 'viewsigs')), -					'view_avatars'		=> request_var('view_avatars', $this->optionget($user_row, 'viewavatars')), -					'view_wordcensor'	=> request_var('view_wordcensor', $this->optionget($user_row, 'viewcensors')), - -					'bbcode'	=> request_var('bbcode', $this->optionget($user_row, 'bbcode')), -					'smilies'	=> request_var('smilies', $this->optionget($user_row, 'smilies')), -					'sig'		=> request_var('sig', $this->optionget($user_row, 'attachsig')), -					'notify'	=> request_var('notify', $user_row['user_notify']), +					'dateformat'		=> $request->variable('dateformat', $user_row['user_dateformat'], true), +					'lang'				=> basename($request->variable('lang', $user_row['user_lang'])), +					'tz'				=> $request->variable('tz', $user_row['user_timezone']), +					'style'				=> $request->variable('style', $user_row['user_style']), +					'viewemail'			=> $request->variable('viewemail', $user_row['user_allow_viewemail']), +					'massemail'			=> $request->variable('massemail', $user_row['user_allow_massemail']), +					'hideonline'		=> $request->variable('hideonline', !$user_row['user_allow_viewonline']), +					'notifymethod'		=> $request->variable('notifymethod', $user_row['user_notify_type']), +					'notifypm'			=> $request->variable('notifypm', $user_row['user_notify_pm']), +					'allowpm'			=> $request->variable('allowpm', $user_row['user_allow_pm']), + +					'topic_sk'			=> $request->variable('topic_sk', ($user_row['user_topic_sortby_type']) ? $user_row['user_topic_sortby_type'] : 't'), +					'topic_sd'			=> $request->variable('topic_sd', ($user_row['user_topic_sortby_dir']) ? $user_row['user_topic_sortby_dir'] : 'd'), +					'topic_st'			=> $request->variable('topic_st', ($user_row['user_topic_show_days']) ? $user_row['user_topic_show_days'] : 0), + +					'post_sk'			=> $request->variable('post_sk', ($user_row['user_post_sortby_type']) ? $user_row['user_post_sortby_type'] : 't'), +					'post_sd'			=> $request->variable('post_sd', ($user_row['user_post_sortby_dir']) ? $user_row['user_post_sortby_dir'] : 'a'), +					'post_st'			=> $request->variable('post_st', ($user_row['user_post_show_days']) ? $user_row['user_post_show_days'] : 0), + +					'view_images'		=> $request->variable('view_images', $this->optionget($user_row, 'viewimg')), +					'view_flash'		=> $request->variable('view_flash', $this->optionget($user_row, 'viewflash')), +					'view_smilies'		=> $request->variable('view_smilies', $this->optionget($user_row, 'viewsmilies')), +					'view_sigs'			=> $request->variable('view_sigs', $this->optionget($user_row, 'viewsigs')), +					'view_avatars'		=> $request->variable('view_avatars', $this->optionget($user_row, 'viewavatars')), +					'view_wordcensor'	=> $request->variable('view_wordcensor', $this->optionget($user_row, 'viewcensors')), + +					'bbcode'	=> $request->variable('bbcode', $this->optionget($user_row, 'bbcode')), +					'smilies'	=> $request->variable('smilies', $this->optionget($user_row, 'smilies')), +					'sig'		=> $request->variable('sig', $this->optionget($user_row, 'attachsig')), +					'notify'	=> $request->variable('notify', $user_row['user_notify']),  				);  				/** @@ -1945,7 +1983,7 @@ class acp_users  						trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);  					} -					$rank_id = request_var('user_rank', 0); +					$rank_id = $request->variable('user_rank', 0);  					$sql = 'UPDATE ' . USERS_TABLE . "  						SET user_rank = $rank_id @@ -1979,60 +2017,72 @@ class acp_users  			case 'sig': -				if (!function_exists('generate_smilies')) -				{ -					include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); -				} -  				if (!function_exists('display_custom_bbcodes'))  				{  					include($phpbb_root_path . 'includes/functions_display.' . $phpEx);  				} -				$enable_bbcode	= ($config['allow_sig_bbcode']) ? (bool) $this->optionget($user_row, 'sig_bbcode') : false; -				$enable_smilies	= ($config['allow_sig_smilies']) ? (bool) $this->optionget($user_row, 'sig_smilies') : false; -				$enable_urls	= ($config['allow_sig_links']) ? (bool) $this->optionget($user_row, 'sig_links') : false; -				$signature		= utf8_normalize_nfc(request_var('signature', (string) $user_row['user_sig'], true)); - -				$preview		= (isset($_POST['preview'])) ? true : false; - -				if ($submit || $preview) -				{ -					if (!class_exists('messenger')) -					{ -						include($phpbb_root_path . 'includes/message_parser.' . $phpEx); -					} - -					$enable_bbcode	= ($config['allow_sig_bbcode']) ? ((request_var('disable_bbcode', false)) ? false : true) : false; -					$enable_smilies	= ($config['allow_sig_smilies']) ? ((request_var('disable_smilies', false)) ? false : true) : false; -					$enable_urls	= ($config['allow_sig_links']) ? ((request_var('disable_magic_url', false)) ? false : true) : false; +				$enable_bbcode	= ($config['allow_sig_bbcode']) ? $this->optionget($user_row, 'sig_bbcode') : false; +				$enable_smilies	= ($config['allow_sig_smilies']) ? $this->optionget($user_row, 'sig_smilies') : false; +				$enable_urls	= ($config['allow_sig_links']) ? $this->optionget($user_row, 'sig_links') : false; -					$message_parser = new parse_message($signature); +				$bbcode_flags = ($enable_bbcode ? OPTION_FLAG_BBCODE : 0) + ($enable_smilies ? OPTION_FLAG_SMILIES : 0) + ($enable_urls ? OPTION_FLAG_LINKS : 0); -					// Allowing Quote BBCode -					$message_parser->parse($enable_bbcode, $enable_urls, $enable_smilies, $config['allow_sig_img'], $config['allow_sig_flash'], true, $config['allow_sig_links'], true, 'sig'); +				$decoded_message	= generate_text_for_edit($user_row['user_sig'], $user_row['user_sig_bbcode_uid'], $bbcode_flags); +				$signature			= $request->variable('signature', $decoded_message['text'], true); +				$signature_preview	= ''; -					if (sizeof($message_parser->warn_msg)) -					{ -						$error[] = implode('<br />', $message_parser->warn_msg); -					} +				if ($submit || $request->is_set_post('preview')) +				{ +					$enable_bbcode	= ($config['allow_sig_bbcode']) ? !$request->variable('disable_bbcode', false) : false; +					$enable_smilies	= ($config['allow_sig_smilies']) ? !$request->variable('disable_smilies', false) : false; +					$enable_urls	= ($config['allow_sig_links']) ? !$request->variable('disable_magic_url', false) : false;  					if (!check_form_key($form_name))  					{ -						$error = 'FORM_INVALID'; +						$error[] = 'FORM_INVALID';  					} +				} + +				$bbcode_uid = $bbcode_bitfield = $bbcode_flags = ''; +				$warn_msg = generate_text_for_storage( +					$signature, +					$bbcode_uid, +					$bbcode_bitfield, +					$bbcode_flags, +					$enable_bbcode, +					$enable_urls, +					$enable_smilies, +					$config['allow_sig_img'], +					$config['allow_sig_flash'], +					true, +					$config['allow_sig_links'], +					'sig' +				); + +				if (sizeof($warn_msg)) +				{ +					$error += $warn_msg; +				} -					if (!sizeof($error) && $submit) +				if (!$submit) +				{ +					// Parse it for displaying +					$signature_preview = generate_text_for_display($signature, $bbcode_uid, $bbcode_bitfield, $bbcode_flags); +				} +				else +				{ +					if (!sizeof($error))  					{  						$this->optionset($user_row, 'sig_bbcode', $enable_bbcode);  						$this->optionset($user_row, 'sig_smilies', $enable_smilies);  						$this->optionset($user_row, 'sig_links', $enable_urls);  						$sql_ary = array( -							'user_sig'					=> (string) $message_parser->message, +							'user_sig'					=> $signature,  							'user_options'				=> $user_row['user_options'], -							'user_sig_bbcode_uid'		=> (string) $message_parser->bbcode_uid, -							'user_sig_bbcode_bitfield'	=> (string) $message_parser->bbcode_bitfield +							'user_sig_bbcode_uid'		=> $bbcode_uid, +							'user_sig_bbcode_bitfield'	=> $bbcode_bitfield,  						);  						$sql = 'UPDATE ' . USERS_TABLE . ' @@ -2042,33 +2092,30 @@ class acp_users  						trigger_error($user->lang['USER_SIG_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id));  					} - -					// Replace "error" strings with their real, localised form -					$error = array_map(array($user, 'lang'), $error);  				} -				$signature_preview = ''; +				// Replace "error" strings with their real, localised form +				$error = array_map(array($user, 'lang'), $error); -				if ($preview) +				if ($request->is_set_post('preview'))  				{ -					// Now parse it for displaying -					$signature_preview = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false); -					unset($message_parser); +					$decoded_message = generate_text_for_edit($signature, $bbcode_uid, $bbcode_bitfield);  				} -				decode_message($signature, $user_row['user_sig_bbcode_uid']); +				/** @var \phpbb\controller\helper $controller_helper */ +				$controller_helper = $phpbb_container->get('controller.helper');  				$template->assign_vars(array(  					'S_SIGNATURE'		=> true, -					'SIGNATURE'			=> $signature, +					'SIGNATURE'			=> $decoded_message['text'],  					'SIGNATURE_PREVIEW'	=> $signature_preview,  					'S_BBCODE_CHECKED'		=> (!$enable_bbcode) ? ' checked="checked"' : '',  					'S_SMILIES_CHECKED'		=> (!$enable_smilies) ? ' checked="checked"' : '',  					'S_MAGIC_URL_CHECKED'	=> (!$enable_urls) ? ' checked="checked"' : '', -					'BBCODE_STATUS'			=> ($config['allow_sig_bbcode']) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'), +					'BBCODE_STATUS'			=> $user->lang(($config['allow_sig_bbcode'] ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '<a href="' . $controller_helper->route('phpbb_help_bbcode_controller') . '">', '</a>'),  					'SMILIES_STATUS'		=> ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],  					'IMG_STATUS'			=> ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],  					'FLASH_STATUS'			=> ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], @@ -2089,15 +2136,16 @@ class acp_users  			break;  			case 'attach': +				/* @var $pagination \phpbb\pagination */ +				$pagination = $phpbb_container->get('pagination'); -				$start		= request_var('start', 0); +				$start		= $request->variable('start', 0);  				$deletemark = (isset($_POST['delmarked'])) ? true : false; -				$marked		= request_var('mark', array(0)); -				$pagination = $phpbb_container->get('pagination'); +				$marked		= $request->variable('mark', array(0));  				// Sort keys -				$sort_key	= request_var('sk', 'a'); -				$sort_dir	= request_var('sd', 'd'); +				$sort_key	= $request->variable('sk', 'a'); +				$sort_dir	= $request->variable('sd', 'd');  				if ($deletemark && sizeof($marked))  				{ @@ -2132,11 +2180,14 @@ class acp_users  						}  						$db->sql_freeresult($result); -						delete_attachments('attach', $marked); +						/** @var \phpbb\attachment\manager $attachment_manager */ +						$attachment_manager = $phpbb_container->get('attachment.manager'); +						$attachment_manager->delete('attach', $marked); +						unset($attachment_manager);  						$message = (sizeof($log_attachments) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']; -						add_log('admin', 'LOG_ATTACHMENTS_DELETED', implode($user->lang['COMMA_SEPARATOR'], $log_attachments)); +						$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACHMENTS_DELETED', false, array(implode($user->lang['COMMA_SEPARATOR'], $log_attachments)));  						trigger_error($message . adm_back_link($this->u_action . '&u=' . $user_id));  					}  					else @@ -2248,7 +2299,7 @@ class acp_users  				}  				$user->add_lang(array('groups', 'acp/groups')); -				$group_id = request_var('g', 0); +				$group_id = $request->variable('g', 0);  				if ($group_id)  				{ @@ -2265,10 +2316,6 @@ class acp_users  						trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);  					}  				} -				else -				{ -					$founder_manage = 0; -				}  				switch ($action)  				{ @@ -2379,6 +2426,9 @@ class acp_users  					$error = array();  				} +				/** @var \phpbb\group\helper $group_helper */ +				$group_helper = $phpbb_container->get('group_helper'); +  				$sql = 'SELECT ug.*, g.*  					FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug  					WHERE ug.user_id = $user_id @@ -2423,7 +2473,7 @@ class acp_users  						continue;  					} -					$s_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; +					$s_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . $group_helper->get_name($row['group_name']) . '</option>';  				}  				$db->sql_freeresult($result); @@ -2477,7 +2527,7 @@ class acp_users  				$user->add_lang('acp/permissions');  				add_permission_language(); -				$forum_id = request_var('f', 0); +				$forum_id = $request->variable('f', 0);  				// Global Permissions  				if (!$forum_id) @@ -2534,6 +2584,22 @@ class acp_users  			break; +			default: + +				/** +				* Additional modes provided by extensions +				* +				* @event core.acp_users_mode_add +				* @var	string	mode			New mode +				* @var	int		user_id			User id of the user to manage +				* @var	array	user_row		Array with user data +				* @var	array	error			Array with errors data +				* @since 3.2.2-RC1 +				*/ +				$vars = array('mode', 'user_id', 'user_row', 'error'); +				extract($phpbb_dispatcher->trigger_event('core.acp_users_mode_add', compact($vars))); + +			break;  		}  		// Assign general variables diff --git a/phpBB/includes/acp/acp_words.php b/phpBB/includes/acp/acp_words.php index 272d38bcc8..e5eeb7ab07 100644 --- a/phpBB/includes/acp/acp_words.php +++ b/phpBB/includes/acp/acp_words.php @@ -28,13 +28,12 @@ class acp_words  	function main($id, $mode)  	{ -		global $db, $user, $auth, $template, $cache; -		global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; +		global $db, $user, $template, $cache, $phpbb_log, $request, $phpbb_container;  		$user->add_lang('acp/posting');  		// Set up general vars -		$action = request_var('action', ''); +		$action = $request->variable('action', '');  		$action = (isset($_POST['add'])) ? 'add' : ((isset($_POST['save'])) ? 'save' : $action);  		$s_hidden_fields = ''; @@ -50,7 +49,7 @@ class acp_words  		{  			case 'edit': -				$word_id = request_var('id', 0); +				$word_id = $request->variable('id', 0);  				if (!$word_id)  				{ @@ -88,9 +87,9 @@ class acp_words  					trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING);  				} -				$word_id		= request_var('id', 0); -				$word			= utf8_normalize_nfc(request_var('word', '', true)); -				$replacement	= utf8_normalize_nfc(request_var('replacement', '', true)); +				$word_id		= $request->variable('id', 0); +				$word			= $request->variable('word', '', true); +				$replacement	= $request->variable('replacement', '', true);  				if ($word === '' || $replacement === '')  				{ @@ -115,9 +114,11 @@ class acp_words  				}  				$cache->destroy('_word_censors'); +				$phpbb_container->get('text_formatter.cache')->invalidate();  				$log_action = ($word_id) ? 'LOG_WORD_EDIT' : 'LOG_WORD_ADD'; -				add_log('admin', $log_action, $word); + +				$phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log_action, false, array($word));  				$message = ($word_id) ? $user->lang['WORD_UPDATED'] : $user->lang['WORD_ADDED'];  				trigger_error($message . adm_back_link($this->u_action)); @@ -126,7 +127,7 @@ class acp_words  			case 'delete': -				$word_id = request_var('id', 0); +				$word_id = $request->variable('id', 0);  				if (!$word_id)  				{ @@ -147,8 +148,9 @@ class acp_words  					$db->sql_query($sql);  					$cache->destroy('_word_censors'); +					$phpbb_container->get('text_formatter.cache')->invalidate(); -					add_log('admin', 'LOG_WORD_DELETE', $deleted_word); +					$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_WORD_DELETE', false, array($deleted_word));  					trigger_error($user->lang['WORD_REMOVED'] . adm_back_link($this->u_action));  				} diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 52c45499b2..b36b900396 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -266,9 +266,14 @@ class auth_admin extends \phpbb\auth\auth  	*/  	function display_mask($mode, $permission_type, &$hold_ary, $user_mode = 'user', $local = false, $group_display = true)  	{ -		global $template, $user, $db, $phpbb_root_path, $phpEx, $phpbb_container; +		global $template, $user, $db, $phpbb_container; + +		/* @var $phpbb_permissions \phpbb\permissions */  		$phpbb_permissions = $phpbb_container->get('acl.permissions'); +		/** @var \phpbb\group\helper $group_helper */ +		$group_helper = $phpbb_container->get('group_helper'); +  		// Define names for template loops, might be able to be set  		$tpl_pmask = 'p_mask';  		$tpl_fmask = 'f_mask'; @@ -300,7 +305,7 @@ class auth_admin extends \phpbb\auth\auth  		$ug_names_ary = array();  		while ($row = $db->sql_fetchrow($result))  		{ -			$ug_names_ary[$row['ug_id']] = ($user_mode == 'user') ? $row['ug_name'] : (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['ug_name']] : $row['ug_name']); +			$ug_names_ary[$row['ug_id']] = ($user_mode == 'user') ? $row['ug_name'] : $group_helper->get_name($row['ug_name']);  		}  		$db->sql_freeresult($result); @@ -408,14 +413,7 @@ class auth_admin extends \phpbb\auth\auth  			{  				foreach ($memberships as $row)  				{ -					if ($groups[$row['group_id']]['group_type'] == GROUP_SPECIAL) -					{ -						$user_groups_default[$row['user_id']][] = $user->lang['G_' . $groups[$row['group_id']]['group_name']]; -					} -					else -					{ -						$user_groups_custom[$row['user_id']][] = $groups[$row['group_id']]['group_name']; -					} +					$user_groups_default[$row['user_id']][] = $group_helper->get_name($groups[$row['group_id']]['group_name']);  				}  			}  			unset($memberships, $groups); @@ -468,7 +466,10 @@ class auth_admin extends \phpbb\auth\auth  					// Build role dropdown options  					$current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; +					$role_options = array(); +  					$s_role_options = ''; +					$current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0;  					@reset($roles);  					while (list($role_id, $role_row) = each($roles)) @@ -478,6 +479,13 @@ class auth_admin extends \phpbb\auth\auth  						$title = ($role_description) ? ' title="' . $role_description . '"' : '';  						$s_role_options .= '<option value="' . $role_id . '"' . (($role_id == $current_role_id) ? ' selected="selected"' : '') . $title . '>' . $role_name . '</option>'; + +						$role_options[] = array( +							'ID'	=> $role_id, +							'ROLE_NAME'	=> $role_name, +							'TITLE'		=> $role_description, +							'SELECTED'	=> $role_id == $current_role_id, +						);  					}  					if ($s_role_options) @@ -505,11 +513,14 @@ class auth_admin extends \phpbb\auth\auth  					$template->assign_block_vars($tpl_pmask . '.' . $tpl_fmask, array(  						'NAME'				=> $ug_names_ary[$ug_id], -						'S_ROLE_OPTIONS'	=> $s_role_options,  						'UG_ID'				=> $ug_id, +						'S_ROLE_OPTIONS'	=> $s_role_options,  						'S_CUSTOM'			=> $s_custom_permissions, -						'FORUM_ID'			=> $forum_id) -					); +						'FORUM_ID'			=> $forum_id, +						'S_ROLE_ID'			=> $current_role_id, +					)); + +					$template->assign_block_vars_array($tpl_pmask . '.' . $tpl_fmask . '.role_options', $role_options);  					$this->assign_cat_array($ug_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, ($mode == 'view'), $show_trace); @@ -554,6 +565,9 @@ class auth_admin extends \phpbb\auth\auth  					// Build role dropdown options  					$current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; +					$role_options = array(); + +					$current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0;  					$s_role_options = '';  					@reset($roles); @@ -564,6 +578,13 @@ class auth_admin extends \phpbb\auth\auth  						$title = ($role_description) ? ' title="' . $role_description . '"' : '';  						$s_role_options .= '<option value="' . $role_id . '"' . (($role_id == $current_role_id) ? ' selected="selected"' : '') . $title . '>' . $role_name . '</option>'; + +						$role_options[] = array( +							'ID'	=> $role_id, +							'ROLE_NAME'	=> $role_name, +							'TITLE'		=> $role_description, +							'SELECTED'	=> $role_id == $current_role_id, +						);  					}  					if ($s_role_options) @@ -592,12 +613,14 @@ class auth_admin extends \phpbb\auth\auth  					$template->assign_block_vars($tpl_pmask . '.' . $tpl_fmask, array(  						'NAME'				=> ($forum_id == 0) ? $forum_names_ary[0] : $forum_names_ary[$forum_id]['forum_name'],  						'PADDING'			=> ($forum_id == 0) ? '' : $forum_names_ary[$forum_id]['padding'], -						'S_ROLE_OPTIONS'	=> $s_role_options,  						'S_CUSTOM'			=> $s_custom_permissions,  						'UG_ID'				=> $ug_id, +						'S_ROLE_OPTIONS'	=> $s_role_options,  						'FORUM_ID'			=> $forum_id)  					); +					$template->assign_block_vars_array($tpl_pmask . '.' . $tpl_fmask . '.role_options', $role_options); +  					$this->assign_cat_array($forum_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, ($mode == 'view'), $show_trace);  				} @@ -611,13 +634,17 @@ class auth_admin extends \phpbb\auth\auth  	*/  	function display_role_mask(&$hold_ary)  	{ -		global $db, $template, $user, $phpbb_root_path, $phpbb_admin_path, $phpEx; +		global $db, $template, $user, $phpbb_root_path, $phpEx; +		global $phpbb_container;  		if (!sizeof($hold_ary))  		{  			return;  		} +		/** @var \phpbb\group\helper $group_helper */ +		$group_helper = $phpbb_container->get('group_helper'); +  		// Get forum names  		$sql = 'SELECT forum_id, forum_name  			FROM ' . FORUMS_TABLE . ' @@ -673,7 +700,7 @@ class auth_admin extends \phpbb\auth\auth  				{  					$template->assign_block_vars('role_mask.groups', array(  						'GROUP_ID'		=> $row['group_id'], -						'GROUP_NAME'	=> ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'], +						'GROUP_NAME'	=> $group_helper->get_name($row['group_name']),  						'U_PROFILE'		=> append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=group&g={$row['group_id']}"))  					);  				} @@ -1106,8 +1133,9 @@ class auth_admin extends \phpbb\auth\auth  	*/  	function assign_cat_array(&$category_array, $tpl_cat, $tpl_mask, $ug_id, $forum_id, $s_view, $show_trace = false)  	{ -		global $template, $user, $phpbb_admin_path, $phpEx, $phpbb_container; +		global $template, $phpbb_admin_path, $phpEx, $phpbb_container; +		/* @var $phpbb_permissions \phpbb\permissions */  		$phpbb_permissions = $phpbb_container->get('acl.permissions');  		@reset($category_array); @@ -1194,8 +1222,9 @@ class auth_admin extends \phpbb\auth\auth  	*/  	function build_permission_array(&$permission_row, &$content_array, &$categories, $key_sort_array)  	{ -		global $user, $phpbb_container; +		global $phpbb_container; +		/* @var $phpbb_permissions \phpbb\permissions */  		$phpbb_permissions = $phpbb_container->get('acl.permissions');  		foreach ($key_sort_array as $forum_id) diff --git a/phpBB/includes/acp/info/acp_attachments.php b/phpBB/includes/acp/info/acp_attachments.php index ff6e342f77..057f08201e 100644 --- a/phpBB/includes/acp/info/acp_attachments.php +++ b/phpBB/includes/acp/info/acp_attachments.php @@ -18,7 +18,6 @@ class acp_attachments_info  		return array(  			'filename'	=> 'acp_attachments',  			'title'		=> 'ACP_ATTACHMENTS', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'attach'		=> array('title' => 'ACP_ATTACHMENT_SETTINGS', 'auth' => 'acl_a_attach', 'cat' => array('ACP_BOARD_CONFIGURATION', 'ACP_ATTACHMENTS')),  				'extensions'	=> array('title' => 'ACP_MANAGE_EXTENSIONS', 'auth' => 'acl_a_attach', 'cat' => array('ACP_ATTACHMENTS')), diff --git a/phpBB/includes/acp/info/acp_ban.php b/phpBB/includes/acp/info/acp_ban.php index 4959f4da41..c88f4c2ebb 100644 --- a/phpBB/includes/acp/info/acp_ban.php +++ b/phpBB/includes/acp/info/acp_ban.php @@ -18,7 +18,6 @@ class acp_ban_info  		return array(  			'filename'	=> 'acp_ban',  			'title'		=> 'ACP_BAN', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'email'		=> array('title' => 'ACP_BAN_EMAILS', 'auth' => 'acl_a_ban', 'cat' => array('ACP_USER_SECURITY')),  				'ip'		=> array('title' => 'ACP_BAN_IPS', 'auth' => 'acl_a_ban', 'cat' => array('ACP_USER_SECURITY')), diff --git a/phpBB/includes/acp/info/acp_bbcodes.php b/phpBB/includes/acp/info/acp_bbcodes.php index 2bca319cc3..dfcd43a8ac 100644 --- a/phpBB/includes/acp/info/acp_bbcodes.php +++ b/phpBB/includes/acp/info/acp_bbcodes.php @@ -18,7 +18,6 @@ class acp_bbcodes_info  		return array(  			'filename'	=> 'acp_bbcodes',  			'title'		=> 'ACP_BBCODES', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'bbcodes'		=> array('title' => 'ACP_BBCODES', 'auth' => 'acl_a_bbcode', 'cat' => array('ACP_MESSAGES')),  			), diff --git a/phpBB/includes/acp/info/acp_board.php b/phpBB/includes/acp/info/acp_board.php index 6838b4f8ba..1a3ee7b6be 100644 --- a/phpBB/includes/acp/info/acp_board.php +++ b/phpBB/includes/acp/info/acp_board.php @@ -18,7 +18,6 @@ class acp_board_info  		return array(  			'filename'	=> 'acp_board',  			'title'		=> 'ACP_BOARD_MANAGEMENT', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'settings'		=> array('title' => 'ACP_BOARD_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')),  				'features'		=> array('title' => 'ACP_BOARD_FEATURES', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')), diff --git a/phpBB/includes/acp/info/acp_bots.php b/phpBB/includes/acp/info/acp_bots.php index 9aa24927af..26782d8c0b 100644 --- a/phpBB/includes/acp/info/acp_bots.php +++ b/phpBB/includes/acp/info/acp_bots.php @@ -18,7 +18,6 @@ class acp_bots_info  		return array(  			'filename'	=> 'acp_bots',  			'title'		=> 'ACP_BOTS', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'bots'		=> array('title' => 'ACP_BOTS', 'auth' => 'acl_a_bots', 'cat' => array('ACP_GENERAL_TASKS')),  			), diff --git a/phpBB/includes/acp/info/acp_captcha.php b/phpBB/includes/acp/info/acp_captcha.php index 99dc5ce0e5..3f7bf0351d 100644 --- a/phpBB/includes/acp/info/acp_captcha.php +++ b/phpBB/includes/acp/info/acp_captcha.php @@ -18,7 +18,6 @@ class acp_captcha_info  		return array(  			'filename'	=> 'acp_captcha',  			'title'		=> 'ACP_CAPTCHA', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'visual'		=> array('title' => 'ACP_VC_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')),  				'img'			=> array('title' => 'ACP_VC_CAPTCHA_DISPLAY', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION'), 'display' => false) diff --git a/phpBB/includes/acp/info/acp_database.php b/phpBB/includes/acp/info/acp_database.php index 5cf9da24fb..815db53b67 100644 --- a/phpBB/includes/acp/info/acp_database.php +++ b/phpBB/includes/acp/info/acp_database.php @@ -18,7 +18,6 @@ class acp_database_info  		return array(  			'filename'	=> 'acp_database',  			'title'		=> 'ACP_DATABASE', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'backup'	=> array('title' => 'ACP_BACKUP', 'auth' => 'acl_a_backup', 'cat' => array('ACP_CAT_DATABASE')),  				'restore'	=> array('title' => 'ACP_RESTORE', 'auth' => 'acl_a_backup', 'cat' => array('ACP_CAT_DATABASE')), diff --git a/phpBB/includes/acp/info/acp_disallow.php b/phpBB/includes/acp/info/acp_disallow.php index ebd44b515c..df4765b6bb 100644 --- a/phpBB/includes/acp/info/acp_disallow.php +++ b/phpBB/includes/acp/info/acp_disallow.php @@ -18,7 +18,6 @@ class acp_disallow_info  		return array(  			'filename'	=> 'acp_disallow',  			'title'		=> 'ACP_DISALLOW', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'usernames'		=> array('title' => 'ACP_DISALLOW_USERNAMES', 'auth' => 'acl_a_names', 'cat' => array('ACP_USER_SECURITY')),  			), diff --git a/phpBB/includes/acp/info/acp_email.php b/phpBB/includes/acp/info/acp_email.php index 2f77fc617c..e85ef0923a 100644 --- a/phpBB/includes/acp/info/acp_email.php +++ b/phpBB/includes/acp/info/acp_email.php @@ -18,7 +18,6 @@ class acp_email_info  		return array(  			'filename'	=> 'acp_email',  			'title'		=> 'ACP_MASS_EMAIL', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'email'		=> array('title' => 'ACP_MASS_EMAIL', 'auth' => 'acl_a_email && cfg_email_enable', 'cat' => array('ACP_GENERAL_TASKS')),  			), diff --git a/phpBB/includes/acp/info/acp_extensions.php b/phpBB/includes/acp/info/acp_extensions.php index d4cf1b0ed5..9adcd543b9 100644 --- a/phpBB/includes/acp/info/acp_extensions.php +++ b/phpBB/includes/acp/info/acp_extensions.php @@ -18,7 +18,6 @@ class acp_extensions_info  		return array(  			'filename'	=> 'acp_extensions',  			'title'		=> 'ACP_EXTENSION_MANAGEMENT', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'main'		=> array('title' => 'ACP_EXTENSIONS', 'auth' => 'acl_a_extensions', 'cat' => array('ACP_EXTENSION_MANAGEMENT')),  			), diff --git a/phpBB/includes/acp/info/acp_forums.php b/phpBB/includes/acp/info/acp_forums.php index 647090c8c3..8b5ce7edc2 100644 --- a/phpBB/includes/acp/info/acp_forums.php +++ b/phpBB/includes/acp/info/acp_forums.php @@ -18,7 +18,6 @@ class acp_forums_info  		return array(  			'filename'	=> 'acp_forums',  			'title'		=> 'ACP_FORUM_MANAGEMENT', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'manage'	=> array('title' => 'ACP_MANAGE_FORUMS', 'auth' => 'acl_a_forum', 'cat' => array('ACP_MANAGE_FORUMS')),  			), diff --git a/phpBB/includes/acp/info/acp_groups.php b/phpBB/includes/acp/info/acp_groups.php index 6c5ad70d97..e0aafeca0d 100644 --- a/phpBB/includes/acp/info/acp_groups.php +++ b/phpBB/includes/acp/info/acp_groups.php @@ -18,7 +18,6 @@ class acp_groups_info  		return array(  			'filename'	=> 'acp_groups',  			'title'		=> 'ACP_GROUPS_MANAGEMENT', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'manage'		=> array('title' => 'ACP_GROUPS_MANAGE', 'auth' => 'acl_a_group', 'cat' => array('ACP_GROUPS')),  				'position'		=> array('title' => 'ACP_GROUPS_POSITION', 'auth' => 'acl_a_group', 'cat' => array('ACP_GROUPS')), diff --git a/phpBB/includes/acp/info/acp_send_statistics.php b/phpBB/includes/acp/info/acp_help_phpbb.php index a4f2ddc420..dee8ef41d7 100644 --- a/phpBB/includes/acp/info/acp_send_statistics.php +++ b/phpBB/includes/acp/info/acp_help_phpbb.php @@ -11,16 +11,15 @@  *  */ -class acp_send_statistics_info +class acp_help_phpbb_info  {  	function module()  	{  		return array( -			'filename'	=> 'acp_send_statistics', -			'title'		=> 'ACP_SEND_STATISTICS', -			'version'	=> '1.0.0', +			'filename'	=> 'acp_help_phpbb', +			'title'		=> 'ACP_HELP_PHPBB',  			'modes'		=> array( -				'send_statistics'		=> array('title' => 'ACP_SEND_STATISTICS', 'auth' => 'acl_a_server', 'cat' => array('ACP_SERVER_CONFIGURATION')), +				'help_phpbb'	=> array('title' => 'ACP_HELP_PHPBB', 'auth' => 'acl_a_server', 'cat' => array('ACP_SERVER_CONFIGURATION')),  			),  		);  	} diff --git a/phpBB/includes/acp/info/acp_icons.php b/phpBB/includes/acp/info/acp_icons.php index 001d6cb402..87eadddd8d 100644 --- a/phpBB/includes/acp/info/acp_icons.php +++ b/phpBB/includes/acp/info/acp_icons.php @@ -18,7 +18,6 @@ class acp_icons_info  		return array(  			'filename'	=> 'acp_icons',  			'title'		=> 'ACP_ICONS_SMILIES', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'icons'		=> array('title' => 'ACP_ICONS', 'auth' => 'acl_a_icons', 'cat' => array('ACP_MESSAGES')),  				'smilies'	=> array('title' => 'ACP_SMILIES', 'auth' => 'acl_a_icons', 'cat' => array('ACP_MESSAGES')), diff --git a/phpBB/includes/acp/info/acp_inactive.php b/phpBB/includes/acp/info/acp_inactive.php index 442eb13c30..38cb964735 100644 --- a/phpBB/includes/acp/info/acp_inactive.php +++ b/phpBB/includes/acp/info/acp_inactive.php @@ -18,7 +18,6 @@ class acp_inactive_info  		return array(  			'filename'	=> 'acp_inactive',  			'title'		=> 'ACP_INACTIVE_USERS', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'list'		=> array('title' => 'ACP_INACTIVE_USERS', 'auth' => 'acl_a_user', 'cat' => array('ACP_CAT_USERS')),  			), diff --git a/phpBB/includes/acp/info/acp_jabber.php b/phpBB/includes/acp/info/acp_jabber.php index c1dfb2aca7..660299a12d 100644 --- a/phpBB/includes/acp/info/acp_jabber.php +++ b/phpBB/includes/acp/info/acp_jabber.php @@ -18,7 +18,6 @@ class acp_jabber_info  		return array(  			'filename'	=> 'acp_jabber',  			'title'		=> 'ACP_JABBER_SETTINGS', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'settings'		=> array('title' => 'ACP_JABBER_SETTINGS', 'auth' => 'acl_a_jabber', 'cat' => array('ACP_CLIENT_COMMUNICATION')),  			), diff --git a/phpBB/includes/acp/info/acp_language.php b/phpBB/includes/acp/info/acp_language.php index b9efbbbd9a..1a5a2b6ba8 100644 --- a/phpBB/includes/acp/info/acp_language.php +++ b/phpBB/includes/acp/info/acp_language.php @@ -18,7 +18,6 @@ class acp_language_info  		return array(  			'filename'	=> 'acp_language',  			'title'		=> 'ACP_LANGUAGE', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'lang_packs'		=> array('title' => 'ACP_LANGUAGE_PACKS', 'auth' => 'acl_a_language', 'cat' => array('ACP_LANGUAGE')),  			), diff --git a/phpBB/includes/acp/info/acp_logs.php b/phpBB/includes/acp/info/acp_logs.php index 3b2764c4dc..1be7b2883d 100644 --- a/phpBB/includes/acp/info/acp_logs.php +++ b/phpBB/includes/acp/info/acp_logs.php @@ -38,7 +38,6 @@ class acp_logs_info  		return array(  			'filename'	=> 'acp_logs',  			'title'		=> 'ACP_LOGGING', -			'version'	=> '1.0.0',  			'modes'		=> $modes,  		);  	} diff --git a/phpBB/includes/acp/info/acp_main.php b/phpBB/includes/acp/info/acp_main.php index 51259e3bd9..48d35da585 100644 --- a/phpBB/includes/acp/info/acp_main.php +++ b/phpBB/includes/acp/info/acp_main.php @@ -18,7 +18,6 @@ class acp_main_info  		return array(  			'filename'	=> 'acp_main',  			'title'		=> 'ACP_INDEX', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'main'		=> array('title' => 'ACP_INDEX', 'auth' => '', 'cat' => array('ACP_CAT_GENERAL')),  			), diff --git a/phpBB/includes/acp/info/acp_modules.php b/phpBB/includes/acp/info/acp_modules.php index a47cd4ad83..073e69c6a8 100644 --- a/phpBB/includes/acp/info/acp_modules.php +++ b/phpBB/includes/acp/info/acp_modules.php @@ -18,7 +18,6 @@ class acp_modules_info  		return array(  			'filename'	=> 'acp_modules',  			'title'		=> 'ACP_MODULE_MANAGEMENT', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'acp'		=> array('title' => 'ACP', 'auth' => 'acl_a_modules', 'cat' => array('ACP_MODULE_MANAGEMENT')),  				'ucp'		=> array('title' => 'UCP', 'auth' => 'acl_a_modules', 'cat' => array('ACP_MODULE_MANAGEMENT')), diff --git a/phpBB/includes/acp/info/acp_permission_roles.php b/phpBB/includes/acp/info/acp_permission_roles.php index e8aa13375d..34af693b7b 100644 --- a/phpBB/includes/acp/info/acp_permission_roles.php +++ b/phpBB/includes/acp/info/acp_permission_roles.php @@ -18,7 +18,6 @@ class acp_permission_roles_info  		return array(  			'filename'	=> 'acp_permission_roles',  			'title'		=> 'ACP_PERMISSION_ROLES', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'admin_roles'		=> array('title' => 'ACP_ADMIN_ROLES', 'auth' => 'acl_a_roles && acl_a_aauth', 'cat' => array('ACP_PERMISSION_ROLES')),  				'user_roles'		=> array('title' => 'ACP_USER_ROLES', 'auth' => 'acl_a_roles && acl_a_uauth', 'cat' => array('ACP_PERMISSION_ROLES')), diff --git a/phpBB/includes/acp/info/acp_permissions.php b/phpBB/includes/acp/info/acp_permissions.php index 3ec592a300..3d415f2b72 100644 --- a/phpBB/includes/acp/info/acp_permissions.php +++ b/phpBB/includes/acp/info/acp_permissions.php @@ -18,7 +18,6 @@ class acp_permissions_info  		return array(  			'filename'	=> 'acp_permissions',  			'title'		=> 'ACP_PERMISSIONS', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'intro'					=> array('title' => 'ACP_PERMISSIONS', 'auth' => 'acl_a_authusers || acl_a_authgroups || acl_a_viewauth', 'cat' => array('ACP_CAT_PERMISSIONS')),  				'trace'					=> array('title' => 'ACP_PERMISSION_TRACE', 'auth' => 'acl_a_viewauth', 'display' => false, 'cat' => array('ACP_PERMISSION_MASKS')), diff --git a/phpBB/includes/acp/info/acp_php_info.php b/phpBB/includes/acp/info/acp_php_info.php index af978e0daa..c5e60c7e66 100644 --- a/phpBB/includes/acp/info/acp_php_info.php +++ b/phpBB/includes/acp/info/acp_php_info.php @@ -18,7 +18,6 @@ class acp_php_info_info  		return array(  			'filename'	=> 'acp_php_info',  			'title'		=> 'ACP_PHP_INFO', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'info'		=> array('title' => 'ACP_PHP_INFO', 'auth' => 'acl_a_phpinfo', 'cat' => array('ACP_GENERAL_TASKS')),  			), diff --git a/phpBB/includes/acp/info/acp_profile.php b/phpBB/includes/acp/info/acp_profile.php index 307e711eee..ede34204b4 100644 --- a/phpBB/includes/acp/info/acp_profile.php +++ b/phpBB/includes/acp/info/acp_profile.php @@ -18,7 +18,6 @@ class acp_profile_info  		return array(  			'filename'	=> 'acp_profile',  			'title'		=> 'ACP_CUSTOM_PROFILE_FIELDS', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'profile'	=> array('title' => 'ACP_CUSTOM_PROFILE_FIELDS', 'auth' => 'acl_a_profile', 'cat' => array('ACP_CAT_USERS')),  			), diff --git a/phpBB/includes/acp/info/acp_prune.php b/phpBB/includes/acp/info/acp_prune.php index 58cb1ba9ab..74e5248aa9 100644 --- a/phpBB/includes/acp/info/acp_prune.php +++ b/phpBB/includes/acp/info/acp_prune.php @@ -18,7 +18,6 @@ class acp_prune_info  		return array(  			'filename'	=> 'acp_prune',  			'title'		=> 'ACP_PRUNING', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'forums'	=> array('title' => 'ACP_PRUNE_FORUMS', 'auth' => 'acl_a_prune', 'cat' => array('ACP_MANAGE_FORUMS')),  				'users'		=> array('title' => 'ACP_PRUNE_USERS', 'auth' => 'acl_a_userdel', 'cat' => array('ACP_CAT_USERS')), diff --git a/phpBB/includes/acp/info/acp_ranks.php b/phpBB/includes/acp/info/acp_ranks.php index 3cc9b4a428..9bf51eba3c 100644 --- a/phpBB/includes/acp/info/acp_ranks.php +++ b/phpBB/includes/acp/info/acp_ranks.php @@ -18,7 +18,6 @@ class acp_ranks_info  		return array(  			'filename'	=> 'acp_ranks',  			'title'		=> 'ACP_RANKS', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'ranks'		=> array('title' => 'ACP_MANAGE_RANKS', 'auth' => 'acl_a_ranks', 'cat' => array('ACP_CAT_USERS')),  			), diff --git a/phpBB/includes/acp/info/acp_reasons.php b/phpBB/includes/acp/info/acp_reasons.php index c48fd1aacd..55a0495d0f 100644 --- a/phpBB/includes/acp/info/acp_reasons.php +++ b/phpBB/includes/acp/info/acp_reasons.php @@ -18,7 +18,6 @@ class acp_reasons_info  		return array(  			'filename'	=> 'acp_reasons',  			'title'		=> 'ACP_REASONS', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'main'		=> array('title' => 'ACP_MANAGE_REASONS', 'auth' => 'acl_a_reasons', 'cat' => array('ACP_GENERAL_TASKS')),  			), diff --git a/phpBB/includes/acp/info/acp_search.php b/phpBB/includes/acp/info/acp_search.php index 5d681a7174..0635dd9edd 100644 --- a/phpBB/includes/acp/info/acp_search.php +++ b/phpBB/includes/acp/info/acp_search.php @@ -18,7 +18,6 @@ class acp_search_info  		return array(  			'filename'	=> 'acp_search',  			'title'		=> 'ACP_SEARCH', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'settings'	=> array('title' => 'ACP_SEARCH_SETTINGS', 'auth' => 'acl_a_search', 'cat' => array('ACP_SERVER_CONFIGURATION')),  				'index'		=> array('title' => 'ACP_SEARCH_INDEX', 'auth' => 'acl_a_search', 'cat' => array('ACP_CAT_DATABASE')), diff --git a/phpBB/includes/acp/info/acp_styles.php b/phpBB/includes/acp/info/acp_styles.php index c0ab005502..59b0a64899 100644 --- a/phpBB/includes/acp/info/acp_styles.php +++ b/phpBB/includes/acp/info/acp_styles.php @@ -18,7 +18,6 @@ class acp_styles_info  		return array(  			'filename'	=> 'acp_styles',  			'title'		=> 'ACP_CAT_STYLES', -			'version'	=> '2.0.0',  			'modes'		=> array(  				'style'		=> array('title' => 'ACP_STYLES', 'auth' => 'acl_a_styles', 'cat' => array('ACP_STYLE_MANAGEMENT')),  				'install'	=> array('title' => 'ACP_STYLES_INSTALL', 'auth' => 'acl_a_styles', 'cat' => array('ACP_STYLE_MANAGEMENT')), diff --git a/phpBB/includes/acp/info/acp_update.php b/phpBB/includes/acp/info/acp_update.php index ca00f6d305..7806fb4891 100644 --- a/phpBB/includes/acp/info/acp_update.php +++ b/phpBB/includes/acp/info/acp_update.php @@ -18,7 +18,6 @@ class acp_update_info  		return array(  			'filename'	=> 'acp_update',  			'title'		=> 'ACP_UPDATE', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'version_check'		=> array('title' => 'ACP_VERSION_CHECK', 'auth' => 'acl_a_board', 'cat' => array('ACP_AUTOMATION')),  			), diff --git a/phpBB/includes/acp/info/acp_users.php b/phpBB/includes/acp/info/acp_users.php index ab69523cde..cb59d24293 100644 --- a/phpBB/includes/acp/info/acp_users.php +++ b/phpBB/includes/acp/info/acp_users.php @@ -18,7 +18,6 @@ class acp_users_info  		return array(  			'filename'	=> 'acp_users',  			'title'		=> 'ACP_USER_MANAGEMENT', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'overview'		=> array('title' => 'ACP_MANAGE_USERS', 'auth' => 'acl_a_user', 'cat' => array('ACP_CAT_USERS')),  				'feedback'		=> array('title' => 'ACP_USER_FEEDBACK', 'auth' => 'acl_a_user', 'display' => false, 'cat' => array('ACP_CAT_USERS')), diff --git a/phpBB/includes/acp/info/acp_words.php b/phpBB/includes/acp/info/acp_words.php index 3c8c79f25f..8a6d0d7f20 100644 --- a/phpBB/includes/acp/info/acp_words.php +++ b/phpBB/includes/acp/info/acp_words.php @@ -18,7 +18,6 @@ class acp_words_info  		return array(  			'filename'	=> 'acp_words',  			'title'		=> 'ACP_WORDS', -			'version'	=> '1.0.0',  			'modes'		=> array(  				'words'		=> array('title' => 'ACP_WORDS', 'auth' => 'acl_a_words', 'cat' => array('ACP_MESSAGES')),  			), | 
