public static function getTopicList($pOptionHash = NULL) { global $gBitSystem; $where = ''; $bindVars = array(); if (!empty($pOptionHash['active_topic'])) { $where = " WHERE artt.`active_topic` = 'y' "; } if (!empty($pOptionHash['topic_name'])) { $where = " WHERE artt.`topic_name` = ? "; $bindVars[] = $pOptionHash['topic_name']; } $query = "SELECT artt.*\n\t\t\t\t FROM `" . BIT_DB_PREFIX . "article_topics` artt\n\t\t\t\t {$where} ORDER BY artt.`topic_name`"; $result = $gBitSystem->mDb->query($query, $bindVars); $ret = array(); while ($res = $result->fetchRow()) { $res["num_articles"] = $gBitSystem->mDb->getOne("SELECT COUNT(*) FROM `" . BIT_DB_PREFIX . "articles` WHERE `topic_id`= ?", array($res["topic_id"])); if (empty($res['topic_image_url']) && $res['has_topic_image'] == 'y') { $res['topic_image_url'] = BitArticleTopic::getTopicImageStorageUrl($res['topic_id']); } $ret[] = $res; } return $ret; }
/** * Get the URL for any given article image * @param $pParamHash pass in full set of data returned from article query * @return url to image * @access public **/ public static function getImageThumbnails($pParamHash) { global $gBitSystem, $gThumbSizes; $ret = NULL; $thumbHash['mime_image'] = FALSE; if (!empty($pParamHash['image_attachment_path'])) { $thumbHash['source_file'] = $pParamHash['image_attachment_path']; $ret = liberty_fetch_thumbnails($thumbHash); } elseif (!empty($pParamHash['has_topic_image']) && $pParamHash['has_topic_image'] == 'y') { $thumbHash['source_file'] = preg_replace("#^/+#", "", BitArticleTopic::getTopicImageStorageUrl($pParamHash['topic_id'])); $ret = liberty_fetch_thumbnails($thumbHash); } return $ret; }