diff options
Diffstat (limited to 'phpBB/phpbb')
14 files changed, 22 insertions, 78 deletions
diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php index 69ac71abb7..a5ed62fd65 100644 --- a/phpBB/phpbb/db/migration/tool/module.php +++ b/phpBB/phpbb/db/migration/tool/module.php @@ -262,7 +262,7 @@ class module implements \phpbb\db\migration\tool\tool_interface // Success $module_log_name = ((isset($this->user->lang[$data['module_langname']])) ? $this->user->lang[$data['module_langname']] : $data['module_langname']); - $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_MODULE_ADD', false, array($module_log_name)); + $phpbb_log->add('admin', (isset($user->data['user_id'])) ? $user->data['user_id'] : ANONYMOUS, $user->ip, 'LOG_MODULE_ADD', false, array($module_log_name)); // Move the module if requested above/below an existing one if (isset($data['before']) && $data['before']) diff --git a/phpBB/phpbb/files/upload.php b/phpBB/phpbb/files/upload.php index e011e714e5..a9bf74094d 100644 --- a/phpBB/phpbb/files/upload.php +++ b/phpBB/phpbb/files/upload.php @@ -65,9 +65,6 @@ class upload /** @var request_interface Request class */ protected $request; - /** @var string phpBB root path */ - protected $phpbb_root_path; - /** * Init file upload class. * @@ -76,16 +73,14 @@ class upload * @param language $language Language class * @param \bantu\IniGetWrapper\IniGetWrapper $php_ini ini_get() wrapper * @param request_interface $request Request class - * @param string $phpbb_root_path phpBB root path */ - public function __construct(filesystem_interface $filesystem, factory $factory, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, request_interface $request, $phpbb_root_path) + public function __construct(filesystem_interface $filesystem, factory $factory, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, request_interface $request) { $this->filesystem = $filesystem; $this->factory = $factory; $this->language = $language; $this->php_ini = $php_ini; $this->request = $request; - $this->phpbb_root_path = $phpbb_root_path; } /** diff --git a/phpBB/phpbb/install/console/command/install/config/show.php b/phpBB/phpbb/install/console/command/install/config/show.php index 4155440fc3..5d82d8d1ef 100644 --- a/phpBB/phpbb/install/console/command/install/config/show.php +++ b/phpBB/phpbb/install/console/command/install/config/show.php @@ -96,7 +96,7 @@ class show extends \phpbb\console\command\command if (!is_file($config_file)) { - $iohandler->add_error_message(array('MISSING_FILE', array($config_file))); + $iohandler->add_error_message(array('MISSING_FILE', $config_file)); return; } diff --git a/phpBB/phpbb/install/console/command/install/install.php b/phpBB/phpbb/install/console/command/install/install.php index 81ad1039f6..d76182af92 100644 --- a/phpBB/phpbb/install/console/command/install/install.php +++ b/phpBB/phpbb/install/console/command/install/install.php @@ -116,7 +116,7 @@ class install extends \phpbb\console\command\command if (!is_file($config_file)) { - $iohandler->add_error_message(array('MISSING_FILE', array($config_file))); + $iohandler->add_error_message(array('MISSING_FILE', $config_file)); return 1; } @@ -127,7 +127,7 @@ class install extends \phpbb\console\command\command } catch (ParseException $e) { - $iohandler->add_error_message('INVALID_YAML_FILE'); + $iohandler->add_error_message(array('INVALID_YAML_FILE', $config_file)); return 1; } diff --git a/phpBB/phpbb/install/module/install_data/task/add_bots.php b/phpBB/phpbb/install/module/install_data/task/add_bots.php index b45d3808db..2ee641ff63 100644 --- a/phpBB/phpbb/install/module/install_data/task/add_bots.php +++ b/phpBB/phpbb/install/module/install_data/task/add_bots.php @@ -197,6 +197,11 @@ class add_bots extends \phpbb\install\task_base 'user_allow_pm' => 0, ); + if (!function_exists('user_add')) + { + include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); + } + $user_id = user_add($user_row); if (!$user_id) diff --git a/phpBB/phpbb/install/module/update_database/task/update.php b/phpBB/phpbb/install/module/update_database/task/update.php index 2d640134a3..84ec6f73f5 100644 --- a/phpBB/phpbb/install/module/update_database/task/update.php +++ b/phpBB/phpbb/install/module/update_database/task/update.php @@ -172,7 +172,7 @@ class update extends task_base { $this->log->add( 'admin', - $this->user->data['user_id'], + (isset($this->user->data['user_id'])) ? $this->user->data['user_id'] : ANONYMOUS, $this->user->ip, 'LOG_UPDATE_DATABASE', false, diff --git a/phpBB/phpbb/textreparser/plugins/forum_description.php b/phpBB/phpbb/textreparser/plugins/forum_description.php index 0302dc3082..b0f5a42452 100644 --- a/phpBB/phpbb/textreparser/plugins/forum_description.php +++ b/phpBB/phpbb/textreparser/plugins/forum_description.php @@ -27,12 +27,4 @@ class forum_description extends \phpbb\textreparser\row_based_plugin 'options' => 'forum_desc_options', ); } - - /** - * {@inheritdoc} - */ - public function get_table_name() - { - return FORUMS_TABLE; - } } diff --git a/phpBB/phpbb/textreparser/plugins/forum_rules.php b/phpBB/phpbb/textreparser/plugins/forum_rules.php index ce550225f2..d131d00707 100644 --- a/phpBB/phpbb/textreparser/plugins/forum_rules.php +++ b/phpBB/phpbb/textreparser/plugins/forum_rules.php @@ -27,12 +27,4 @@ class forum_rules extends \phpbb\textreparser\row_based_plugin 'options' => 'forum_rules_options', ); } - - /** - * {@inheritdoc} - */ - public function get_table_name() - { - return FORUMS_TABLE; - } } diff --git a/phpBB/phpbb/textreparser/plugins/group_description.php b/phpBB/phpbb/textreparser/plugins/group_description.php index 3346ccf25e..2c45c00474 100644 --- a/phpBB/phpbb/textreparser/plugins/group_description.php +++ b/phpBB/phpbb/textreparser/plugins/group_description.php @@ -27,12 +27,4 @@ class group_description extends \phpbb\textreparser\row_based_plugin 'options' => 'group_desc_options', ); } - - /** - * {@inheritdoc} - */ - public function get_table_name() - { - return GROUPS_TABLE; - } } diff --git a/phpBB/phpbb/textreparser/plugins/pm_text.php b/phpBB/phpbb/textreparser/plugins/pm_text.php index 4d06a2878b..867da624ee 100644 --- a/phpBB/phpbb/textreparser/plugins/pm_text.php +++ b/phpBB/phpbb/textreparser/plugins/pm_text.php @@ -29,12 +29,4 @@ class pm_text extends \phpbb\textreparser\row_based_plugin 'bbcode_uid' => 'bbcode_uid', ); } - - /** - * {@inheritdoc} - */ - public function get_table_name() - { - return PRIVMSGS_TABLE; - } } diff --git a/phpBB/phpbb/textreparser/plugins/poll_title.php b/phpBB/phpbb/textreparser/plugins/poll_title.php index 038ae0c366..76d30655c9 100644 --- a/phpBB/phpbb/textreparser/plugins/poll_title.php +++ b/phpBB/phpbb/textreparser/plugins/poll_title.php @@ -39,12 +39,4 @@ class poll_title extends \phpbb\textreparser\row_based_plugin return $sql; } - - /** - * {@inheritdoc} - */ - public function get_table_name() - { - return TOPICS_TABLE; - } } diff --git a/phpBB/phpbb/textreparser/plugins/post_text.php b/phpBB/phpbb/textreparser/plugins/post_text.php index 4a07c98cea..1c98e86067 100644 --- a/phpBB/phpbb/textreparser/plugins/post_text.php +++ b/phpBB/phpbb/textreparser/plugins/post_text.php @@ -29,12 +29,4 @@ class post_text extends \phpbb\textreparser\row_based_plugin 'bbcode_uid' => 'bbcode_uid', ); } - - /** - * {@inheritdoc} - */ - public function get_table_name() - { - return POSTS_TABLE; - } } diff --git a/phpBB/phpbb/textreparser/plugins/user_signature.php b/phpBB/phpbb/textreparser/plugins/user_signature.php index f657a45d38..647d3a7b14 100644 --- a/phpBB/phpbb/textreparser/plugins/user_signature.php +++ b/phpBB/phpbb/textreparser/plugins/user_signature.php @@ -55,14 +55,6 @@ class user_signature extends \phpbb\textreparser\row_based_plugin } /** - * {@inheritdoc} - */ - public function get_table_name() - { - return USERS_TABLE; - } - - /** * Save the keyoptions var from \phpbb\user */ protected function save_keyoptions() diff --git a/phpBB/phpbb/textreparser/row_based_plugin.php b/phpBB/phpbb/textreparser/row_based_plugin.php index d3ca334591..2d32104493 100644 --- a/phpBB/phpbb/textreparser/row_based_plugin.php +++ b/phpBB/phpbb/textreparser/row_based_plugin.php @@ -21,13 +21,20 @@ abstract class row_based_plugin extends base protected $db; /** + * @var string + */ + protected $table; + + /** * Constructor * * @param \phpbb\db\driver\driver_interface $db Database connection + * @param string $table */ - public function __construct(\phpbb\db\driver\driver_interface $db) + public function __construct(\phpbb\db\driver\driver_interface $db, $table) { $this->db = $db; + $this->table = $table; } /** @@ -38,20 +45,13 @@ abstract class row_based_plugin extends base abstract public function get_columns(); /** - * Return the name of the table used by this plugin - * - * @return string - */ - abstract public function get_table_name(); - - /** * {@inheritdoc} */ public function get_max_id() { $columns = $this->get_columns(); - $sql = 'SELECT MAX(' . $columns['id'] . ') AS max_id FROM ' . $this->get_table_name(); + $sql = 'SELECT MAX(' . $columns['id'] . ') AS max_id FROM ' . $this->table; $result = $this->db->sql_query($sql); $max_id = (int) $this->db->sql_fetchfield('max_id'); $this->db->sql_freeresult($result); @@ -96,7 +96,7 @@ abstract class row_based_plugin extends base } $sql = 'SELECT ' . implode(', ', $fields) . ' - FROM ' . $this->get_table_name() . ' + FROM ' . $this->table . ' WHERE ' . $columns['id'] . ' BETWEEN ' . $min_id . ' AND ' . $max_id; return $sql; @@ -109,7 +109,7 @@ abstract class row_based_plugin extends base { $columns = $this->get_columns(); - $sql = 'UPDATE ' . $this->get_table_name() . ' + $sql = 'UPDATE ' . $this->table . ' SET ' . $columns['text'] . " = '" . $this->db->sql_escape($record['text']) . "' WHERE " . $columns['id'] . ' = ' . $record['id']; $this->db->sql_query($sql); |