mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-11 19:24:01 +02:00
[ticket/14264] Don't use constants as return values
This will prevent BC breaking in the future if we decide to get rid of constants. PHPBB3-14264
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -39,12 +39,4 @@ class poll_title extends \phpbb\textreparser\row_based_plugin
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_table_name()
|
||||
{
|
||||
return TOPICS_TABLE;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -54,14 +54,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
|
||||
*/
|
||||
|
@@ -20,14 +20,21 @@ 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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,13 +44,6 @@ 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}
|
||||
*/
|
||||
@@ -51,7 +51,7 @@ abstract class row_based_plugin extends base
|
||||
{
|
||||
$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);
|
||||
|
Reference in New Issue
Block a user