diff options
Diffstat (limited to 'phpBB')
| -rw-r--r-- | phpBB/adm/style/acp_ext_list.html | 4 | ||||
| -rw-r--r-- | phpBB/adm/style/acp_styles.html | 4 | ||||
| -rw-r--r-- | phpBB/docs/events.md | 12 | ||||
| -rw-r--r-- | phpBB/includes/acp/acp_styles.php | 4 | ||||
| -rw-r--r-- | phpBB/includes/acp/info/acp_logs.php | 27 | ||||
| -rw-r--r-- | phpBB/includes/functions_user.php | 10 | ||||
| -rw-r--r-- | phpBB/language/en/acp/styles.php | 1 | ||||
| -rw-r--r-- | phpBB/phpbb/template/base.php | 8 | ||||
| -rw-r--r-- | phpBB/phpbb/template/context.php | 152 | ||||
| -rw-r--r-- | phpBB/phpbb/template/template.php | 17 | 
10 files changed, 198 insertions, 41 deletions
diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index ccc39ea76d..af9e00a614 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -48,7 +48,7 @@  		</tr>  		<!-- BEGIN enabled -->  		<tr class="ext_enabled row-highlight"> -			<td><strong title="{enabled.NAME}">{enabled.META_DISPLAY_NAME}</strong></td> +			<td><strong title="{enabled.NAME}">{enabled.META_DISPLAY_NAME}</strong><!-- EVENT acp_ext_list_enabled_name_after --></td>  			<td style="text-align: center;">  				<!-- IF enabled.S_VERSIONCHECK -->  				<strong <!-- IF enabled.S_UP_TO_DATE -->style="color: #228822;"<!-- ELSE -->style="color: #BC2A4D;"<!-- ENDIF -->>{enabled.META_VERSION}</strong> @@ -73,7 +73,7 @@  		</tr>  		<!-- BEGIN disabled -->  		<tr class="ext_disabled row-highlight"> -			<td><strong title="{disabled.NAME}">{disabled.META_DISPLAY_NAME}</strong></td> +			<td><strong title="{disabled.NAME}">{disabled.META_DISPLAY_NAME}</strong><!-- EVENT acp_ext_list_disabled_name_after --></td>  			<td style="text-align: center;">  				<!-- IF disabled.S_VERSIONCHECK -->  				<strong <!-- IF disabled.S_UP_TO_DATE -->style="color: #228822;"<!-- ELSE -->style="color: #BC2A4D;"<!-- ENDIF -->>{disabled.META_VERSION}</strong> diff --git a/phpBB/adm/style/acp_styles.html b/phpBB/adm/style/acp_styles.html index a36d15fe73..43c2f96a65 100644 --- a/phpBB/adm/style/acp_styles.html +++ b/phpBB/adm/style/acp_styles.html @@ -52,6 +52,10 @@  		<dd><strong>{STYLE_PATH}</strong></dd>  	</dl>  	<dl> +		<dt><label>{L_STYLE_VERSION}{L_COLON}</label></dt> +		<dd><strong>{STYLE_VERSION}</strong></dd> +	</dl> +	<dl>  		<dt><label for="name">{L_COPYRIGHT}{L_COLON}</label></dt>  		<dd><strong>{STYLE_COPYRIGHT}</strong></dd>  	</dl> diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index b1a962cfb0..2f28307c24 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -64,12 +64,24 @@ acp_ext_details_end  * Since: 3.1.11-RC1  * Purpose: Add more detailed information on extension after the available information. +acp_ext_list_disabled_name_after +=== +* Location: adm/style/acp_ext_list.html +* Since: 3.1.11-RC1 +* Purpose: Add content after the name of disabled extensions in the list +  acp_ext_list_disabled_title_after  ===  * Location: adm/style/acp_ext_list.html  * Since: 3.1.11-RC1  * Purpose: Add text after disabled extensions section title. +acp_ext_list_enabled_name_after +=== +* Location: adm/style/acp_ext_list.html +* Since: 3.1.11-RC1 +* Purpose: Add content after the name of enabled extensions in the list +  acp_ext_list_enabled_title_after  ===  * Location: adm/style/acp_ext_list.html diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 5181b87ecb..c29fb062d8 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -433,6 +433,9 @@ class acp_styles  			trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);  		} +		// Read style configuration file +		$style_cfg = $this->read_style_cfg($style['style_path']); +  		// Find all available parent styles  		$list = $this->find_possible_parents($styles, $id); @@ -579,6 +582,7 @@ class acp_styles  			'STYLE_ID'			=> $style['style_id'],  			'STYLE_NAME'		=> htmlspecialchars($style['style_name']),  			'STYLE_PATH'		=> htmlspecialchars($style['style_path']), +			'STYLE_VERSION'		=> htmlspecialchars($style_cfg['style_version']),  			'STYLE_COPYRIGHT'	=> strip_tags($style['style_copyright']),  			'STYLE_PARENT'		=> $style['style_parent_id'],  			'S_STYLE_ACTIVE'	=> $style['style_active'], diff --git a/phpBB/includes/acp/info/acp_logs.php b/phpBB/includes/acp/info/acp_logs.php index e9e6034cd4..3b2764c4dc 100644 --- a/phpBB/includes/acp/info/acp_logs.php +++ b/phpBB/includes/acp/info/acp_logs.php @@ -15,16 +15,31 @@ class acp_logs_info  {  	function module()  	{ +		global $phpbb_dispatcher; + +		$modes = array( +			'admin'		=> array('title' => 'ACP_ADMIN_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), +			'mod'		=> array('title' => 'ACP_MOD_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), +			'users'		=> array('title' => 'ACP_USERS_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), +			'critical'	=> array('title' => 'ACP_CRITICAL_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), +		); + +		/** +		* Event to add or modify ACP log modulemodes +		* +		* @event core.acp_logs_info_modify_modes +		* @var	array	modes	Array with modes info +		* @since 3.1.11-RC1 +		* @since 3.2.1-RC1 +		*/ +		$vars = array('modes'); +		extract($phpbb_dispatcher->trigger_event('core.acp_logs_info_modify_modes', compact($vars))); +  		return array(  			'filename'	=> 'acp_logs',  			'title'		=> 'ACP_LOGGING',  			'version'	=> '1.0.0', -			'modes'		=> array( -				'admin'		=> array('title' => 'ACP_ADMIN_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), -				'mod'		=> array('title' => 'ACP_MOD_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), -				'users'		=> array('title' => 'ACP_USERS_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), -				'critical'	=> array('title' => 'ACP_CRITICAL_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), -			), +			'modes'		=> $modes,  		);  	} diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 2a421f532f..4aecbff6ba 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -272,13 +272,15 @@ function user_add($user_row, $cp_data = false, $notifications_data = null)  	* Use this event to modify the values to be inserted when a user is added  	*  	* @event core.user_add_modify_data -	* @var array	user_row		Array of user details submited to user_add -	* @var array	cp_data			Array of Custom profile fields submited to user_add -	* @var array	sql_ary		Array of data to be inserted when a user is added +	* @var array	user_row			Array of user details submited to user_add +	* @var array	cp_data				Array of Custom profile fields submited to user_add +	* @var array	sql_ary				Array of data to be inserted when a user is added +	* @var array	notifications_data	Array of notification data to be inserted when a user is added  	* @since 3.1.0-a1  	* @changed 3.1.0-b5 Added user_row and cp_data +	* @changed 3.1.11-RC1 Added notifications_data  	*/ -	$vars = array('user_row', 'cp_data', 'sql_ary'); +	$vars = array('user_row', 'cp_data', 'sql_ary', 'notifications_data');  	extract($phpbb_dispatcher->trigger_event('core.user_add_modify_data', compact($vars)));  	$sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php index 0d91eb3704..9293d67ecc 100644 --- a/phpBB/language/en/acp/styles.php +++ b/phpBB/language/en/acp/styles.php @@ -81,6 +81,7 @@ $lang = array_merge($lang, array(  	'STYLE_UNINSTALL_DEPENDENT'	=> 'Style "%s" cannot be uninstalled because it has one or more child styles.',  	'STYLE_UNINSTALLED'			=> 'Style "%s" uninstalled successfully.',  	'STYLE_USED_BY'				=> 'Used by (including robots)', +	'STYLE_VERSION'				=> 'Style version',  	'UNINSTALL_DEFAULT'		=> 'You cannot uninstall the default style.', diff --git a/phpBB/phpbb/template/base.php b/phpBB/phpbb/template/base.php index 9a40702ba8..41c0a01ba8 100644 --- a/phpBB/phpbb/template/base.php +++ b/phpBB/phpbb/template/base.php @@ -133,6 +133,14 @@ abstract class base implements template  	}  	/** +	* {@inheritdoc} +	*/ +	public function find_key_index($blockname, $key) +	{ +		return $this->context->find_key_index($blockname, $key); +	} + +	/**  	* Calls hook if any is defined.  	*  	* @param string $handle Template handle being displayed. diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index 8bf6c10e2d..5d04a09865 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -264,6 +264,89 @@ class context  	}  	/** +	* Find the index for a specified key in the innermost specified block +	* +	* @param	string	$blockname	the blockname, for example 'loop' +	* @param	mixed	$key		Key to search for +	* +	* array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] +	* +	* int: Position [the position to search for] +	* +	* If key is false the position is set to 0 +	* If key is true the position is set to the last entry +	* +	* @return mixed false if not found, index position otherwise; be sure to test with === +	*/ +	public function find_key_index($blockname, $key) +	{ +		// For nested block, $blockcount > 0, for top-level block, $blockcount == 0 +		$blocks = explode('.', $blockname); +		$blockcount = sizeof($blocks) - 1; + +		$block = $this->tpldata; +		for ($i = 0; $i < $blockcount; $i++) +		{ +			if (($pos = strpos($blocks[$i], '[')) !== false) +			{ +				$name = substr($blocks[$i], 0, $pos); + +				if (strpos($blocks[$i], '[]') === $pos) +				{ +					$index = sizeof($block[$name]) - 1; +				} +				else +				{ +					$index = min((int) substr($blocks[$i], $pos + 1, -1), sizeof($block[$name]) - 1); +				} +			} +			else +			{ +				$name = $blocks[$i]; +				$index = sizeof($block[$name]) - 1; +			} +			if (!isset($block[$name])) +			{ +				return false; +			} +			$block = $block[$name]; +			if (!isset($block[$index])) +			{ +				return false; +			} +			$block = $block[$index]; +		} + +		if (!isset($block[$blocks[$i]])) +		{ +			return false; +		} +		$block = $block[$blocks[$i]]; // Traverse the last block + +		// Change key to zero (change first position) if false and to last position if true +		if ($key === false || $key === true) +		{ +			return ($key === false) ? 0 : sizeof($block) - 1; +		} + +		// Get correct position if array given +		if (is_array($key)) +		{ +			// Search array to get correct position +			list($search_key, $search_value) = @each($key); +			foreach ($block as $i => $val_ary) +			{ +				if ($val_ary[$search_key] === $search_value) +				{ +					return $i; +				} +			} +		} + +		return (is_int($key) && ((0 <= $key) && ($key < sizeof($block)))) ? $key : false; +	} + +	/**  	* Change already assigned key variable pair (one-dimensional - single loop entry)  	*  	* An example of how to use this function: @@ -293,45 +376,49 @@ class context  	public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert')  	{  		$this->num_rows_is_set = false; -		if (strpos($blockname, '.') !== false) -		{ -			// Nested block. -			$blocks = explode('.', $blockname); -			$blockcount = sizeof($blocks) - 1; -			$block = &$this->tpldata; -			for ($i = 0; $i < $blockcount; $i++) +		// For nested block, $blockcount > 0, for top-level block, $blockcount == 0 +		$blocks = explode('.', $blockname); +		$blockcount = sizeof($blocks) - 1; + +		$block = &$this->tpldata; +		for ($i = 0; $i < $blockcount; $i++) +		{ +			if (($pos = strpos($blocks[$i], '[')) !== false)  			{ -				if (($pos = strpos($blocks[$i], '[')) !== false) +				$name = substr($blocks[$i], 0, $pos); + +				if (strpos($blocks[$i], '[]') === $pos)  				{ -					$name = substr($blocks[$i], 0, $pos); - -					if (strpos($blocks[$i], '[]') === $pos) -					{ -						$index = sizeof($block[$name]) - 1; -					} -					else -					{ -						$index = min((int) substr($blocks[$i], $pos + 1, -1), sizeof($block[$name]) - 1); -					} +					$index = sizeof($block[$name]) - 1;  				}  				else  				{ -					$name = $blocks[$i]; -					$index = sizeof($block[$name]) - 1; +					$index = min((int) substr($blocks[$i], $pos + 1, -1), sizeof($block[$name]) - 1);  				} -				$block = &$block[$name]; -				$block = &$block[$index];  			} - -			$block = &$block[$blocks[$i]]; // Traverse the last block +			else +			{ +				$name = $blocks[$i]; +				$index = sizeof($block[$name]) - 1; +			} +			$block = &$block[$name]; +			$block = &$block[$index];  		} -		else +		$name = $blocks[$i]; + +		// If last block does not exist and we are inserting, and not searching for key, we create it empty; otherwise, nothing to do +		if (!isset($block[$name]))  		{ -			// Top-level block. -			$block = &$this->tpldata[$blockname]; +			if ($mode != 'insert' || is_array($key)) +			{ +				return false; +			} +			$block[$name] = array();  		} +		$block = &$block[$name]; // Now we can traverse the last block +  		// Change key to zero (change first position) if false and to last position if true  		if ($key === false || $key === true)  		{ @@ -371,14 +458,15 @@ class context  				unset($block[($key - 1)]['S_LAST_ROW']);  				$vararray['S_LAST_ROW'] = true;  			} -			else if ($key === 0) +			if ($key <= 0)  			{ +				$key = 0;  				unset($block[0]['S_FIRST_ROW']);  				$vararray['S_FIRST_ROW'] = true;  			}  			// Assign S_BLOCK_NAME -			$vararray['S_BLOCK_NAME'] = $blockname; +			$vararray['S_BLOCK_NAME'] = $name;  			// Re-position template blocks  			for ($i = sizeof($block); $i > $key; $i--) @@ -398,6 +486,12 @@ class context  		// Which block to change?  		if ($mode == 'change')  		{ +			// If key is out of bounds, do not change anything +			if ($key > sizeof($block) || $key < 0) +			{ +				return false; +			} +  			if ($key == sizeof($block))  			{  				$key--; diff --git a/phpBB/phpbb/template/template.php b/phpBB/phpbb/template/template.php index 041ecb12e4..9e3d658ca8 100644 --- a/phpBB/phpbb/template/template.php +++ b/phpBB/phpbb/template/template.php @@ -173,6 +173,23 @@ interface template  	public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert');  	/** +	* Find the index for a specified key in the innermost specified block +	* +	* @param	string	$blockname	the blockname, for example 'loop' +	* @param	mixed	$key		Key to search for +	* +	* array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] +	* +	* int: Position [the position to search for] +	* +	* If key is false the position is set to 0 +	* If key is true the position is set to the last entry +	* +	* @return mixed false if not found, index position otherwise; be sure to test with === +	*/ +	public function find_key_index($blockname, $key); + +	/**  	* Get path to template for handle (required for BBCode parser)  	*  	* @param string $handle Handle to retrieve the source file  | 
