diff options
Diffstat (limited to 'phpBB/phpbb/textreparser')
8 files changed, 11 insertions, 67 deletions
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); |