aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/textreparser/groupdescription.php
diff options
context:
space:
mode:
authorJoshyPHP <s9e.dev@gmail.com>2015-05-01 05:15:56 +0200
committerJoshyPHP <s9e.dev@gmail.com>2015-05-30 17:26:00 +0200
commitde52580a78bcab47a2311f3993fd9952f963d563 (patch)
tree1d06c842d581994789109b090f54ce5f59ee2dd3 /phpBB/phpbb/textreparser/groupdescription.php
parent073f3e6fdc5af190db85b6cdefd418af4312af9f (diff)
downloadforums-de52580a78bcab47a2311f3993fd9952f963d563.tar
forums-de52580a78bcab47a2311f3993fd9952f963d563.tar.gz
forums-de52580a78bcab47a2311f3993fd9952f963d563.tar.bz2
forums-de52580a78bcab47a2311f3993fd9952f963d563.tar.xz
forums-de52580a78bcab47a2311f3993fd9952f963d563.zip
[ticket/13803] WIP implementation
PHPBB3-13803
Diffstat (limited to 'phpBB/phpbb/textreparser/groupdescription.php')
-rw-r--r--phpBB/phpbb/textreparser/groupdescription.php63
1 files changed, 63 insertions, 0 deletions
diff --git a/phpBB/phpbb/textreparser/groupdescription.php b/phpBB/phpbb/textreparser/groupdescription.php
new file mode 100644
index 0000000000..608cc806b6
--- /dev/null
+++ b/phpBB/phpbb/textreparser/groupdescription.php
@@ -0,0 +1,63 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\textreparser;
+
+class groupdescription extends base
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function get_max_id()
+ {
+ $sql = 'SELECT MAX(group_id) AS max_id FROM ' . GROUPS_TABLE;
+ $result = $this->db->sql_query($sql);
+ $max_id = (int) $this->db->sql_fetchfield('max_id');
+ $this->db->sql_freeresult($result);
+
+ return $max_id;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function get_records($min_id, $max_id)
+ {
+ $sql = 'SELECT group_id AS id, group_desc AS text, group_desc_uid AS bbcode_uid
+ FROM ' . GROUPS_TABLE . '
+ WHERE group_id BETWEEN ' . $min_id . ' AND ' . $max_id;
+ $result = $this->db->sql_query($sql);
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ // Those fields are not saved to the database, we need to guess their original value
+ $row['enable_bbcode'] = !empty($row['bbcode_uid']);
+ $row['enable_smilies'] = (strpos($row['text'], '<!-- s') !== false);
+ $row['enable_magic_url'] = (strpos($row['text'], '<!-- m -->') !== false);
+ }
+ $records = $this->db->sql_fetchrowset($result);
+ $this->db->sql_freeresult($result);
+
+ return $records;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function save_record(array $record)
+ {
+ $sql = 'UPDATE ' . GROUPS_TABLE . "
+ SET group_desc = '" . $this->db->sql_escape($record['text']) . "'
+ WHERE group_id = " . $record['id'];
+ $this->db->sql_query($sql);
+ }
+}