Index: trunk/extensions/phpbbData/phpbbData.php |
— | — | @@ -93,7 +93,7 @@ |
94 | 94 | |
95 | 95 | } |
96 | 96 | |
97 | | -function efPhpbbData_RenderList( &$parser, $action = 'announcements', $name = '', |
| 97 | +function efPhpbbData_RenderList( &$parser, $action = 'announcements', $forum_id = 0, |
98 | 98 | $template = "* '''TOPIC_TIME:''' TOPIC_TITLE",$options = 'none') { |
99 | 99 | $dateFields = array('topic_time','topic_last_post_time'); |
100 | 100 | $opts = explode(',', $options); |
— | — | @@ -107,7 +107,7 @@ |
108 | 108 | if (!isset($wgPhpbbData)) |
109 | 109 | $wgPhpbbData = new phpbbDataProvider($_SERVER['DOCUMENT_ROOT'] . '/' . $wgPhpbbDataRootPath); |
110 | 110 | |
111 | | - if ($announcements = $wgPhpbbData->getAnnouncements($name)) { |
| 111 | + if ($announcements = $wgPhpbbData->getAnnouncements($forum_id)) { |
112 | 112 | foreach ($announcements as $announcement) { |
113 | 113 | $rowString = $template; |
114 | 114 | foreach($announcement as $key => $value) { |
— | — | @@ -168,7 +168,7 @@ |
169 | 169 | return true; |
170 | 170 | } |
171 | 171 | |
172 | | - public function getAnnouncements($name) { |
| 172 | + public function getAnnouncements($forum_id) { |
173 | 173 | $phpEx = $this->mPhpEx; |
174 | 174 | $phpbb_root_path = $this->mRootPath; |
175 | 175 | |
— | — | @@ -177,13 +177,7 @@ |
178 | 178 | $iconstable = $this->tableName('icons'); |
179 | 179 | $poststable = $this->tableName('posts'); |
180 | 180 | |
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); |
188 | 182 | |
189 | 183 | $sql = |
190 | 184 | "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 @@ |
192 | 186 | "WHERE $forumclause " . |
193 | 187 | "AND topic_type IN (2,3) " . |
194 | 188 | "ORDER BY topic_time DESC"; |
195 | | - |
196 | 189 | $result = $this->mDB->sql_query( $sql ); |
197 | 190 | if ($result) { |
198 | 191 | while ($row = $this->mDB->sql_fetchrow($result)) { |