Ejemplo n.º 1
0
 public function getContentsByChannel($channelid)
 {
     $channelid = intval($channelid);
     $crt = getCache('c_contentsOf' . $channelid);
     if ($crt & $channelid) {
         return unserialize($crt);
     } else {
         $contents = $this->select(array('channel_id' => $channelid), '*', '0,30', 'taxis DESC');
         setZendCache(serialize($contents), 'c_contentsOf' . $channelid);
         return $contents;
     }
 }
Ejemplo n.º 2
0
 function getChannelsByParentID($parentid, $output = 'OBJECT')
 {
     $parentid = intval($parentid);
     $crt = getCache('channelsOf' . $parentid . 'o' . $output);
     if ($crt) {
         return unserialize($crt);
     } else {
         $channels = $this->get_results('*', '', 'parentid=' . $parentid, 'taxis ASC');
         setZendCache(serialize($channels), 'channelsOf' . $parentid . 'o' . $output);
         return $channels;
     }
 }
Ejemplo n.º 3
0
 function getSiteByID($id)
 {
     $id = intval($id);
     $crt = getCache('site' . $id);
     if ($crt && SUB_SKIN != 'zzqcw') {
         return unserialize($crt);
     } else {
         $site = $this->site_db->get_row(array('id' => $id));
         if ($id == 1) {
             $site->name = SITE_NAME;
             $site->url = MAIN_URL_ROOT;
         }
         setZendCache(serialize($site), 'site' . $id);
         return $site;
     }
 }
Ejemplo n.º 4
0
 function crumbArr($id)
 {
     $thisID = intval($id);
     $crt = getCache('channelCrumb' . $thisID);
     if ($crt) {
         return unserialize($crt);
     } else {
         $channelArr = array();
         do {
             //获取父栏目
             $channelA = $this->channel_db->get_row(array('id' => $id));
             $channel = $this->channel_db->get_row(array('id' => $channelA->parentid));
             $id = intval($channel->id);
             $parentID = intval($channel->parentid);
             $channelArr[] = array('id' => $id, 'parentid' => $channel->parentid, 'name' => $channel->name, 'cindex' => $channel->cindex, 'link' => $channel->link);
         } while ($parentID != 0);
         $channelArr = array_reverse($channelArr);
         setZendCache(serialize($channelArr), 'channelCrumb' . $thisID);
         return $channelArr;
     }
 }
Ejemplo n.º 5
0
 public function get($id)
 {
     $id = intval($id);
     $crt = getCache('template' . $id);
     if ($crt) {
         return unserialize($crt);
     } else {
         $template = $this->template_db->get_row(array('id' => $id));
         $file = ABS_PATH . substr($template->path, 1);
         if (!file_exists($file)) {
             $fp = @fopen($file, "w+");
         } else {
             $fp = @fopen($file, 'r');
         }
         $code = @file_get_contents($file);
         @fclose($fp);
         $template->code = $code;
         setZendCache(serialize($template), 'template' . $id);
         return $template;
     }
 }
Ejemplo n.º 6
0
 /**
  * 按照栏目和地区获取内容列表
  *
  * @param unknown_type $channelid
  * @param unknown_type $geoid
  * @param unknown_type $page
  * @return unknown
  */
 function getContentsByChannelIDAndGeo($channelid, $geoid = 0, $page = 1)
 {
     $channelid = intval($channelid);
     $page = intval($page);
     $geoid = intval($geoid);
     $cacheName = 'contentsByChannelID' . $channelid . 'Geo' . $geoid . 'page' . $page;
     $cache = getCache($cacheName);
     if ($cache) {
         return unserialize($cache);
     } else {
         $channel = bpBase::loadAppClass('channelObj', 'channel', 1);
         $thisChannel = $channel->getChannelByID($channelid);
         $thisChannelPageSize = intval($thisChannel->pagesize);
         $start = ($page - 1) * $thisChannelPageSize;
         $articles = $this->article_db->get_results('*', '', array('channel_id' => $channelid, 'geoid' => $geoid), 'taxis DESC', $start . ',' . $thisChannelPageSize);
         if ($articles) {
             $i = 0;
             foreach ($articles as $a) {
                 if (!$a->externallink && !strpos($a->link, 'ttp://')) {
                     //$articles[$i]->link=MAIN_URL_ROOT.$a->link;
                 }
                 if (!strpos($a->thumb, 'ttp://')) {
                     $articles[$i]->thumb = MAIN_URL_ROOT . $a->thumb;
                 }
             }
         }
         setZendCache(serialize($articles), $cacheName);
         return $articles;
     }
 }