phpBB

Code Changes

File: includes/acp/acp_styles.php

  Unmodified   Added   Modified   Removed
Line 29Line 29
	protected $styles_path;
protected $styles_path_absolute = 'styles';
protected $default_style = 0;

	protected $styles_path;
protected $styles_path_absolute = 'styles';
protected $default_style = 0;

 
	protected $styles_list_cols = 0;
protected $reserved_style_names = array('adm', 'admin', 'all');





 
	/** @var \phpbb\db\driver\driver_interface */

	protected $db;

	protected $db;

 

/** @var \phpbb\user */

	protected $user;

	protected $user;

 

/** @var \phpbb\template\template */

	protected $template;

	protected $template;

 

/** @var \phpbb\request\request_interface */

	protected $request;

	protected $request;

 

/** @var \phpbb\cache\driver\driver_interface */

	protected $cache;

	protected $cache;

 

/** @var \phpbb\auth\auth */

	protected $auth;

	protected $auth;

 

/** @var string */

	protected $phpbb_root_path;

	protected $phpbb_root_path;

 

/** @var string */

	protected $php_ext;

	protected $php_ext;

 

/** @var \phpbb\event\dispatcher_interface */
protected $dispatcher;


public function main($id, $mode)
{


public function main($id, $mode)
{

		global $db, $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request, $cache, $auth, $config;

		global $db, $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request, $cache, $auth, $config, $phpbb_dispatcher;


$this->db = $db;
$this->user = $user;


$this->db = $db;
$this->user = $user;

Line 52Line 72
		$this->config = $config;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $phpEx;

		$this->config = $config;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $phpEx;

 
		$this->dispatcher = $phpbb_dispatcher;


$this->default_style = $config['default_style'];
$this->styles_path = $this->phpbb_root_path . $this->styles_path_absolute . '/';


$this->default_style = $config['default_style'];
$this->styles_path = $this->phpbb_root_path . $this->styles_path_absolute . '/';

Line 100Line 121
			'S_HIDDEN_FIELDS'	=> build_hidden_fields($this->s_hidden_fields)
)
);

			'S_HIDDEN_FIELDS'	=> build_hidden_fields($this->s_hidden_fields)
)
);

 

/**
* Run code before ACP styles action execution
*
* @event core.acp_styles_action_before
* @var int id Module ID
* @var string mode Active module
* @var string action Module that should be run
* @since 3.1.7-RC1
*/
$vars = array('id', 'mode', 'action');
extract($this->dispatcher->trigger_event('core.acp_styles_action_before', compact($vars)));


// Execute actions
switch ($action)


// Execute actions
switch ($action)

Line 164Line 197
		$last_installed = false;
foreach ($dirs as $dir)
{

		$last_installed = false;
foreach ($dirs as $dir)
{

 
			if (in_array($dir, $this->reserved_style_names))
{
$messages[] = $this->user->lang('STYLE_NAME_RESERVED', htmlspecialchars($dir));
continue;
}


			$found = false;
foreach ($styles as &$style)
{

			$found = false;
foreach ($styles as &$style)
{

Line 393Line 432
		{
trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);
}

		{
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);


// Find all available parent styles
$list = $this->find_possible_parents($styles, $id);

Line 540Line 582
			'STYLE_ID'			=> $style['style_id'],
'STYLE_NAME' => htmlspecialchars($style['style_name']),
'STYLE_PATH' => htmlspecialchars($style['style_path']),

			'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'],

			'STYLE_COPYRIGHT'	=> strip_tags($style['style_copyright']),
'STYLE_PARENT' => $style['style_parent_id'],
'S_STYLE_ACTIVE' => $style['style_active'],

Line 809Line 852
	* Update styles tree
*
* @param array $styles Styles list, passed as reference

	* Update styles tree
*
* @param array $styles Styles list, passed as reference

	* @param array $style Current style, false if root

	* @param array|false $style Current style, false if root

	* @return bool True if something was updated, false if not
*/
protected function update_styles_tree(&$styles, $style = false)

	* @return bool True if something was updated, false if not
*/
protected function update_styles_tree(&$styles, $style = false)

Line 972Line 1015

// Assign template variables
$this->template->assign_block_vars('styles_list', $row);


// Assign template variables
$this->template->assign_block_vars('styles_list', $row);

		foreach($actions as $action)

		foreach ($actions as $action)

		{
$this->template->assign_block_vars('styles_list.actions', $action);
}

		{
$this->template->assign_block_vars('styles_list.actions', $action);
}

Line 1091Line 1134
	/**
* Install style
*

	/**
* Install style
*

	* @param $style style data

	* @param array $style style data

	* @return int Style id
*/
protected function install_style($style)

	* @return int Style id
*/
protected function install_style($style)