[ticket/10714] Use new core.adm_relative_path to create the object.

PHPBB3-10714
This commit is contained in:
Joas Schilling 2013-01-16 16:23:41 +01:00
parent 19b6ea8cf7
commit 786e2438d5
2 changed files with 13 additions and 7 deletions

View file

@ -164,6 +164,7 @@ services:
- @auth - @auth
- @dispatcher - @dispatcher
- %core.root_path% - %core.root_path%
- %core.adm_relative_path%
- %core.php_ext% - %core.php_ext%
- %tables.log% - %tables.log%

View file

@ -94,35 +94,40 @@ class phpbb_log implements phpbb_log_interface
* @param phpbb_auth $auth Auth object * @param phpbb_auth $auth Auth object
* @param phpbb_dispatcher $phpbb_dispatcher Event dispatcher * @param phpbb_dispatcher $phpbb_dispatcher Event dispatcher
* @param string $phpbb_root_path Root path * @param string $phpbb_root_path Root path
* @param string $relative_admin_path Relative admin root path
* @param string $php_ext PHP Extension * @param string $php_ext PHP Extension
* @param string $log_table Name of the table we use to store our logs * @param string $log_table Name of the table we use to store our logs
* @return null * @return null
*/ */
public function __construct($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, $php_ext, $log_table) public function __construct($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, $relative_admin_path, $php_ext, $log_table)
{ {
$this->db = $db; $this->db = $db;
$this->user = $user; $this->user = $user;
$this->auth = $auth; $this->auth = $auth;
$this->dispatcher = $phpbb_dispatcher; $this->dispatcher = $phpbb_dispatcher;
$this->phpbb_root_path = $phpbb_root_path; $this->phpbb_root_path = $phpbb_root_path;
$this->phpbb_admin_path = $this->phpbb_root_path . $relative_admin_path;
$this->php_ext = $php_ext; $this->php_ext = $php_ext;
$this->log_table = $log_table; $this->log_table = $log_table;
/*
* IN_ADMIN is set after the session was created,
* so we need to take ADMIN_START into account aswell, otherwise
* it will not work for the phpbb_log object we create in common.php
*/
$this->set_is_admin((defined('ADMIN_START') && ADMIN_START) || (defined('IN_ADMIN') && IN_ADMIN));
$this->enable(); $this->enable();
$this->set_admin_path('', false);
} }
/** /**
* Set phpbb_admin_path and is_in_admin in order to return administrative * Set is_in_admin in order to return administrative user profile links
* user profile links in get_logs() * in get_logs()
* *
* @param string $phpbb_admin_path Full path from current file to admin root
* @param bool $is_in_admin Are we called from within the acp? * @param bool $is_in_admin Are we called from within the acp?
* @return null * @return null
*/ */
public function set_admin_path($phpbb_admin_path, $is_in_admin) public function set_is_admin($is_in_admin)
{ {
$this->phpbb_admin_path = $phpbb_admin_path;
$this->is_in_admin = (bool) $is_in_admin; $this->is_in_admin = (bool) $is_in_admin;
} }