function getAllTopics($checkRight = true, $permission = "news_view") { $topics_arr = array(); $db =& Database::getInstance(); $table = $db->prefix('topics'); $sql = "SELECT * FROM " . $table; if ($checkRight) { $topics = news_MygetItemIds($permission); if (count($topics) == 0) { return array(); } $topics = implode(',', $topics); $sql .= " WHERE topic_id IN (" . $topics . ")"; } $sql .= " ORDER BY topic_title"; $result = $db->query($sql); while ($array = $db->fetchArray($result)) { $topic = new NewsTopic(); $topic->makeTopic($array); $topics_arr[$array['topic_id']] = $topic; unset($topic); } return $topics_arr; }