r28512 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r28511‎ | r28512 | r28513 >
Date:14:13, 15 December 2007
Author:tlaqua
Status:old
Tags:
Comment:
Changed announcements command from accepting forum_name to forum_id - forum_name isn't unique.
Modified paths:
  • /trunk/extensions/phpbbData/phpbbData.php (modified) (history)

Diff [purge]

Index: trunk/extensions/phpbbData/phpbbData.php
@@ -93,7 +93,7 @@
9494
9595 }
9696
97 -function efPhpbbData_RenderList( &$parser, $action = 'announcements', $name = '',
 97+function efPhpbbData_RenderList( &$parser, $action = 'announcements', $forum_id = 0,
9898 $template = "* '''TOPIC_TIME:''' TOPIC_TITLE",$options = 'none') {
9999 $dateFields = array('topic_time','topic_last_post_time');
100100 $opts = explode(',', $options);
@@ -107,7 +107,7 @@
108108 if (!isset($wgPhpbbData))
109109 $wgPhpbbData = new phpbbDataProvider($_SERVER['DOCUMENT_ROOT'] . '/' . $wgPhpbbDataRootPath);
110110
111 - if ($announcements = $wgPhpbbData->getAnnouncements($name)) {
 111+ if ($announcements = $wgPhpbbData->getAnnouncements($forum_id)) {
112112 foreach ($announcements as $announcement) {
113113 $rowString = $template;
114114 foreach($announcement as $key => $value) {
@@ -168,7 +168,7 @@
169169 return true;
170170 }
171171
172 - public function getAnnouncements($name) {
 172+ public function getAnnouncements($forum_id) {
173173 $phpEx = $this->mPhpEx;
174174 $phpbb_root_path = $this->mRootPath;
175175
@@ -177,13 +177,7 @@
178178 $iconstable = $this->tableName('icons');
179179 $poststable = $this->tableName('posts');
180180
181 - if ($name != '') {
182 - //sanitize input
183 - $forumclause = "$forumstable.forum_name = '" .
184 - $this->mDB->sql_escape($name) . "'";
185 - } else {
186 - $forumclause = "$topicstable.forum_id=0";
187 - }
 181+ $forumclause = "$topicstable.forum_id=" . intval($forum_id);
188182
189183 $sql =
190184 "SELECT DISTINCT $topicstable.topic_id as tid, $topicstable.forum_id as fid, topic_time, topic_title, topic_first_poster_name, topic_replies, topic_last_post_time, post_text " .
@@ -191,7 +185,6 @@
192186 "WHERE $forumclause " .
193187 "AND topic_type IN (2,3) " .
194188 "ORDER BY topic_time DESC";
195 -
196189 $result = $this->mDB->sql_query( $sql );
197190 if ($result) {
198191 while ($row = $this->mDB->sql_fetchrow($result)) {

Status & tagging log