Ejemplo n.º 1
0
 function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0)
 {
     //<stl:***></stl:***>
     $channelObj = bpBase::loadAppClass('channelObj', 'channel', 1);
     //
     $siteID = $avs['site'] == null ? $siteID : $avs['site'];
     //
     $upLevel = $avs['upLevel'] == null ? 0 : intval($avs['upLevel']);
     if ($avs['channelIndex']) {
         $thisChannel = $channelObj->getChannelByIndex($avs['channelIndex'], $siteID);
         $channels = $channelObj->getChannelsByParentID($thisChannel->id);
     } else {
         switch ($upLevel) {
             case 0:
                 break;
             case 1:
                 $currentChannel = $channelObj->getChannelByIndex($avs['channelIndex'], $siteID);
                 $channels = $channelObj->getChannelsByParentID($currentChannel->parentid);
                 break;
         }
     }
     //
     $returnStr = '';
     if ($channels) {
         $middleStr = parent::getMiddleBody($str, 'channels', $this->gTag);
         $i = 0;
         foreach ($channels as $c) {
             $start = intval($avs['startNum']) - 1;
             $count = intval($avs['totalNum']);
             if (!$count) {
                 $count = count($channels);
             }
             if ($i == $start || $i > $start) {
                 if ($i < $count) {
                     $rs = str_replace(array('[stl.channel.id]', '[stl.channel.name]', '[stl.channel.link]', '[stl.channel.num]', '<stl:contents'), array($c->id, $c->name, $c->link, $i + intval($avs['numStart']), '<stl:contents channelIndex="' . $c->cindex . '"'), $middleStr);
                     //current class
                     if ($channelID == $c->id) {
                         $rs = str_replace('[stl.channel.currentItemClass]', $avs['currentItemClass'], $rs);
                     } else {
                         $rs = str_replace('[stl.channel.currentItemClass]', '', $rs);
                     }
                     $returnStr .= $rs;
                 }
             }
             $i++;
         }
     }
     //处理stl:contents
     if (strExists($returnStr, '<stl:contents')) {
         $template = bpBase::loadAppClass('template', 'template');
         $now = SYS_TIME;
         $returnStr = $template->parseStr($returnStr, $now);
         @unlink(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $now . '.parsed.tpl.php');
         @unlink(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $now . '.tags.tpl.php');
     }
     //
     return $returnStr;
 }
Ejemplo n.º 2
0
 public function logs()
 {
     $updateObj = bpBase::loadAppClass('updateObj', 'update', 1);
     $shouldUpdate = $updateObj->shouldUpdate($this->updateArr);
     $page = isset($_GET['page']) ? $_GET['page'] : '1';
     $logs = $this->update_log_db->listinfo('', $order = 'time DESC', $page, $pagesize = '20', '', '?m=update&c=update&a=logs&');
     $pages = $this->update_log_db->pages;
     include $this->showManageTpl('logs');
 }
Ejemplo n.º 3
0
 function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0)
 {
     //<stl:***></stl:***>
     $siteID = $avs['siteID'] == null ? $siteID : $avs['siteID'];
     $site = bpBase::loadAppClass('siteObj', 'site', 1);
     $thisSite = $site->getSiteByID($siteID);
     //
     $type = strtolower($avs['type']);
     return $thisSite->{$type};
 }
Ejemplo n.º 4
0
 function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0, $pagination = array('pageSize' => 20, 'totalCount' => 0, 'currentPage' => 1, 'urlPrefix' => '', 'urlSuffix' => ''))
 {
     //<stl:***></stl:***>
     $articleObj = bpBase::loadAppClass('articleObj', 'article');
     $thisContent = $articleObj->getContentByID($contentID);
     if ($thisContent->pagecount > 1) {
         $currentPage = intval($pagination['currentPage']);
         if (!$thisContent->title) {
             $sep = '';
             for ($i = 0; $i < $thisContent->pagecount; $i++) {
                 $thisContent->titles .= $sep . '';
                 $sep = '|';
             }
         }
         $titles = explode('|', $thisContent->titles);
         $str = '';
         $ah_str_l = '';
         $ah_str_r = '';
         if ($titles) {
             $i = 0;
             foreach ($titles as $t) {
                 $nextI = $i + 1;
                 if ($i == 0) {
                     $link = $pagination['urlPrefix'] . $pagination['urlSuffix'];
                 } else {
                     $link = $pagination['urlPrefix'] . '-' . $nextI . $pagination['urlSuffix'];
                 }
                 if ($pagination['currentPage'] != $nextI) {
                     $style = '';
                 } else {
                     $style = ' style="color:red"';
                 }
                 if (!isah()) {
                     $str .= '<li><a title="' . $t . '" href="' . $link . '"' . $style . '>第' . $nextI . '页:' . $t . '</a></li>';
                 } else {
                     $s = '<a title="' . $t . '" href="' . $link . '"' . $style . '>第' . $nextI . '页:' . $t . '</a><br>';
                     if ($i % 2 == 0) {
                         $ah_str_l .= $s;
                     } else {
                         $ah_str_r .= $s;
                     }
                 }
                 $i++;
             }
         }
     }
     if ($titles) {
         if (!isah()) {
             return '<div class="contentTitleNav"><h2>“' . $thisContent->title . '”导航</h2><div id="titles"><ul>' . $str . '<div class="clear"></div></ul><div class="clear" style="width:100%;height:1px"></div></div></div>';
         } else {
             return '<dl class="article_nav"><dt>文章导航条</dt><dd>' . $ah_str_l . '</dd><dd class="last">' . $ah_str_r . '</dd></dl>';
         }
     }
 }
Ejemplo n.º 5
0
 function currentCityInfo()
 {
     $geoObj = bpBase::loadAppClass('geoObj', 'geo', 1);
     $ipGeo = $geoObj->getGeoByIP(ip());
     if (!$ipGeo) {
         $geo_db = bpBase::loadModel('geo_model');
         $defaultChildLocation = $geo_db->getDefaultChildLocation();
         $ipGeo = $defaultChildLocation;
     }
     echo '{"city":[{"name":"' . $ipGeo->name . '","id":"' . $ipGeo->id . '","geoindex":"' . $ipGeo->geoindex . '"}]}';
 }
Ejemplo n.º 6
0
 function parse($siteid, $str = '')
 {
     //<stl:include></stl:include>
     $siteid = intval($siteid);
     $siteClass = bpBase::loadAppClass('siteObj', 'site', 1);
     $thisSite = $siteClass->getSiteByID($siteid);
     $filePath = ABS_PATH . str_replace('@', '', parent::getAttributeValue($str, $this->attributes[0]));
     $filePath = str_replace('{siteIndex}', $thisSite->siteindex, $filePath);
     if (file_exists($filePath)) {
         return file_get_contents($filePath);
     } else {
         return '';
     }
 }
Ejemplo n.º 7
0
 function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0)
 {
     //<stl:***></stl:***>
     $str = parent::removeProperties($str, $this->attributes);
     $middleStr = parent::getMiddleBody($str, 'a', $this->gTag);
     if (isset($avs['contentID']) && $avs['contentID']) {
         $articleObj = bpBase::loadAppClass('articleObj', 'article', 1);
         $thisContent = $articleObj->getContentByID($avs['contentID']);
         $valueStr = str_replace('[stl.content.title]', $thisContent->title, $middleStr);
         $link = $thisContent->link;
     } elseif (isset($avs['channelIndex']) && $avs['channelIndex']) {
         $channelObj = bpBase::loadAppClass('channelObj', 'channel', 1);
         if ($avs['site']) {
             //指定了站点
             $siteID = intval($avs['site']);
         }
         $thisChannel = $channelObj->getChannelByIndex($avs['channelIndex'], $siteID);
         //
         $valueStr = str_replace('[stl.channel.name]', $thisChannel->name, $middleStr);
         if ($avs['site'] || $siteID > 0) {
             //指定了站点
             $siteObj = bpBase::loadAppClass('siteObj', 'site', 1);
             $thisSite = $siteObj->getSiteByID($avs['site']);
             if (strExists($link, 'http://') || $thisChannel->externallink) {
                 $link = $thisChannel->link;
             } else {
                 $link = $thisSite->url . $thisChannel->link;
             }
         } else {
             if (strExists($link, 'http://') || $thisChannel->externallink) {
                 $link = $thisChannel->link;
             } else {
                 $link = MAIN_URL_ROOT . $thisChannel->link;
             }
         }
     } elseif (isset($avs['siteID']) && $avs['siteID']) {
         $siteObj = bpBase::loadAppClass('siteObj', 'site', 1);
         $thisSite = $siteObj->getSiteByID($avs['siteID']);
         //
         $valueStr = str_replace('[stl.site.name]', $thisSite->name, $middleStr);
         $link = $thisSite->url;
     }
     $str = str_replace('<stl:a', '<a href="' . $link . '"', $str);
     $str = str_replace('</stl:a', '</a', $str);
     $str = str_replace($middleStr, $valueStr, $str);
     return $str;
 }
Ejemplo n.º 8
0
 function getValue($str = '', $avs, $csiteID = 0, $thisChannelID = 0, $contentID = 0)
 {
     //<stl:***></stl:***>
     $articleObj = bpBase::loadAppClass('articleObj', 'article');
     $site = bpBase::loadAppClass('siteObj', 'site');
     $content_db = bpBase::loadModel('article_model');
     $totalNum = $avs['totalNum'] ? $avs['totalNum'] : 10;
     $cat = $avs['cat'] ? $avs['cat'] : 'news';
     $cats = array('video', 'news', 'guide', 'comment', 'market');
     if (!in_array($cat, $cats)) {
         $cat = 'news';
     }
     $startNum = $avs['startNum'] ? intval($avs['startNum']) : 1;
     $startI = $startNum - 1;
     $totalNum = $startI + $totalNum;
     $orderBy = $avs['orderBy'] ? $avs['orderBy'] : 'viewcount';
     $contents = $articleObj->viewRanksByCat($cat, $totalNum, $orderBy);
     $returnStr = '';
     if ($contents) {
         $i = 0;
         $middleStr = parent::getMiddleBody($str, 'articleRanks', $this->gTag);
         $tags = array('[stl.content.link]', '[stl.content.title]', '[stl.content.thumb]');
         $count = 0;
         foreach ($contents as $c) {
             if ($i > $startI - 1 && $count < $totalNum) {
                 $replaces = array($c->link, $c->title, $c->thumb);
                 $valueStr = str_replace($tags, $replaces, $middleStr);
                 //time
                 $valueStr = str_replace('[stl.content.time]', date($avs['dateFormat'], $c->time), $valueStr);
                 //other thumb
                 $valueStr = str_replace('[stl.content.thumb2]', str_replace('.jpg', '_small.jpg', $c->thumb), $valueStr);
                 $valueStr = str_replace('[stl.content.thumb3]', str_replace('.jpg', '_middle.jpg', $c->thumb), $valueStr);
                 $valueStr = str_replace('[stl.content.thumb4]', str_replace('.jpg', '_big.jpg', $c->thumb), $valueStr);
                 //num
                 $valueStr = str_replace('[stl.content.num]', $count + $startNum, $valueStr);
                 //
                 $returnStr .= $valueStr;
                 $count++;
             }
             $i++;
         }
     }
     return $returnStr;
 }
Ejemplo n.º 9
0
 function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0)
 {
     //<stl:***></stl:***>
     //
     $site = $avs['site'] == null ? $siteID : $avs['site'];
     $site = intval($site);
     //instance
     $channelObj = bpBase::loadAppClass('channelObj', 'channel');
     $upLevel = $avs['upLevel'] == null ? 0 : intval($avs['upLevel']);
     if ($avs['channelIndex'] != null) {
         $thisChannel = $channelObj->getChannelByIndex($avs['channelIndex'], $site);
     } else {
         switch ($upLevel) {
             case 0:
                 $thisChannel = $channelObj->getChannelByID($channelID);
                 break;
             case 1:
                 $currentChannel = $channelObj->getChannelByID($channelID);
                 $thisChannel = $channelObj->getChannelByID($currentChannel->parentid);
                 break;
         }
     }
     //
     $type = strtolower($avs['type']);
     if ($type == 'title') {
         $type = 'name';
     }
     if ($type == 'content') {
         $type = 'des';
     }
     if ($type == 'imageurl') {
         $type = 'thumb';
     }
     if ($type) {
         return $thisChannel->{$type};
     } else {
         return $thisChannel->name;
     }
 }
Ejemplo n.º 10
0
 function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0)
 {
     //<stl:***></stl:***>
     //properties
     $seperator = $avs['separator'];
     $linkClass = $avs['linkClass'];
     $target = $avs['target'] == null ? '_self' : $avs['target'];
     //
     $channel = bpBase::loadAppClass('channelObj', 'channel', 1);
     $crumbArr = $channel->crumbArr($channelID);
     $arrCount = count($crumbArr);
     //
     $site = bpBase::loadAppClass('siteObj', 'site', 1);
     if ($siteID < 100) {
         $thisSite = $site->getSiteByID($siteID);
     } else {
         $special_db = bpBase::loadModel('special_model');
         $thisSpecial = $special_db->get($siteID);
         $thisSite->main = false;
         $thisSite->url = $thisSpecial['url'];
         $crumbArr[0]['name'] = '专题:' . $thisSpecial['name'];
     }
     $currentChannel = $channel->getChannelByID($channelID);
     $returnStr = '';
     if (intval($thisSite->main)) {
         $returnStr .= '<a href="/" class="' . $linkClass . '" target="' . $target . '">' . $crumbArr[0]['name'] . '</a>' . $seperator;
     } else {
         $returnStr .= '<a href="' . $thisSite->url . '" class="' . $linkClass . '" target="' . $target . '">' . $crumbArr[0]['name'] . '</a>' . $seperator;
     }
     for ($i = 1; $i < $arrCount; $i++) {
         if (strlen($crumbArr[$i]['name'])) {
             $returnStr .= '<a href="' . $crumbArr[$i]['link'] . '" class="' . $linkClass . '" target="' . $target . '">' . $crumbArr[$i]['name'] . '</a>' . $seperator;
         }
     }
     $returnStr .= '<a href="' . $currentChannel->link . '" class="' . $linkClass . '" target="' . $target . '">' . $currentChannel->name . '</a>';
     return $returnStr;
 }
Ejemplo n.º 11
0
 /**
  * 根据模板中的pageContents标签获取每页的数量值,仅生成静态页时有效
  *
  * @param unknown_type $channelID
  * @return unknown
  */
 public function getChannelTotalPage($channelID)
 {
     $tpl = bpBase::loadAppClass('template', 'template', 1);
     //channel
     $channelID = intval($channelID);
     $thisChannel = $this->getChannelByID($channelID);
     //分析模板
     $template = $tpl->get($thisChannel->channeltemplate);
     if (!file_exists(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $template->id . '.parsed.tpl.php')) {
         $tpl->createChannelPageR($channelid);
     }
     //只有生成静态页的情况下,下面的代码才有效
     $totalPage = 1;
     if (file_exists(ABS_PATH . '/templatesCache/' . $template->id . '.tags.tpl.php')) {
         @(require ABS_PATH . '/templatesCache/' . $template->id . '.tags.tpl.php');
         $pageSize = 20;
         //判断是否有分页标签
         $isPagination = false;
         if ($tagsArr) {
             foreach ($tagsArr as $t) {
                 if ($t['name'] == 'pageContents') {
                     //
                     $isPagination = true;
                     $pageSize = $t['avs']['pageNum'];
                 }
             }
         }
         if ($isPagination) {
             $childChannels = $this->getChannelsByParentID($channelID);
             $channelidArr = array($channelID);
             if ($childChannels) {
                 foreach ($childChannels as $c) {
                     array_push($channelidArr, $c->id);
                 }
             }
             $article_db = bpBase::loadModel('article_model');
             $where = to_sqls($channelidArr, '', 'channel_id');
             $totalCount = $article_db->get_var($where, 'COUNT(id)', '', '');
             $totalPage = $totalCount % $pageSize > 0 ? intval($totalCount / $pageSize) + 1 : $totalCount / $pageSize;
             $totalPage = $totalPage < 1 ? 1 : $totalPage;
         } else {
             $totalPage = 1;
         }
     }
     return $totalPage;
 }
Ejemplo n.º 12
0
 function hotel()
 {
     $sitePage = bpBase::loadAppClass('sitePage', 'site', 1);
     $sitePage->hotel();
 }
Ejemplo n.º 13
0
 public function autoPriceTables()
 {
     $taskName = 'autoPriceTables';
     //$this->executedCheck($taskName);
     $thisTask = $this->update_log_db->get_one(array('file' => $taskName));
     //
     $autoprice_db = bpBase::loadModel('autoprice_model');
     $autoprices = $autoprice_db->get_all('DISTINCT(autoid)', '', '', 'autoid ASC');
     $count = count($autoprices);
     $i = intval($_GET['i']);
     if ($i < $count) {
         //start
         $autoclassification_db = bpBase::loadModel('autoclassification_model');
         $thisAuto = $autoclassification_db->getCfByID($autoprices[$i]['autoid']);
         $parentAuto = $autoclassification_db->getCfByID($thisAuto->parentid);
         $autoObj = bpBase::loadAppClass('autoObj', 'auto', 1);
         $logo = $autoObj->getLogo($parentAuto->id, $parentAuto->logo);
         $autoprice_db->update(array('serieid' => $parentAuto->id, 'seriename' => $parentAuto->name, 'autoname' => $thisAuto->name, 'companyprice' => $thisAuto->companyprice, 'logo' => $logo), array('autoid' => $thisAuto->id));
         //end
         $i++;
         showMessage($thisTask['des'] . ':' . $i . '/' . $count, '?m=update&c=updateTask&a=' . $taskName . '&i=' . $i, 0);
     } else {
         //删除缓存
         @rename(ABS_PATH . 'cache', ABS_PATH . 'backup' . DIRECTORY_SEPARATOR . 'cache_' . time());
         $this->_finishTask($taskName);
     }
 }
Ejemplo n.º 14
0
 function handleRelateAutoPage()
 {
     $autoids = explode(',', $_GET['autoids']);
     /*因为只查找跟第一级车型、第三级车型相关的文章,所以只处理第一级车型和第三级车型即可*/
     $g1autoids = array();
     //第一级别车型id组成一个数组,用来判断相关车型一共有多少个不同的第一级别车型id
     $g3autoids = array();
     //第3级别车型id组成一个数组,用来判断相关车型一共有多少个不同的第一级别车型id
     //
     if ($autoids) {
         $autodb = bpBase::loadModel('autoclassification_model');
         foreach ($autoids as $autoid) {
             if (intval($autoid)) {
                 $thisAuto = $autodb->getCfByID($autoid);
                 switch (intval($thisAuto->grade)) {
                     default:
                         break;
                     case 1:
                         if (!in_array($autoid, $g1autoids)) {
                             array_push($g1autoids, $autoid);
                         }
                         $autoWhere = array('grade' => 4, 'g1id' => $thisAuto->id);
                         break;
                     case 2:
                         if (!in_array($thisAuto->parentid, $g1autoids)) {
                             array_push($g1autoids, $thisAuto->parentid);
                         }
                         $autoWhere = array('grade' => 4, 'g2id' => $thisAuto->id);
                     case 3:
                         $g1autoid = intval($thisAuto->g1id);
                         if (!in_array($g1autoid, $g1autoids)) {
                             array_push($g1autoids, $g1autoid);
                         }
                         //
                         if (!in_array($autoid, $g3autoids)) {
                             array_push($g3autoids, $autoid);
                         }
                         $autoWhere = array('grade' => 4, 'parentid' => $thisAuto->id);
                     case 4:
                         $g1autoid = intval($thisAuto->g1id);
                         if (!in_array($g1autoid, $g1autoids)) {
                             array_push($g1autoids, $g1autoid);
                         }
                         //
                         if (!in_array($thisAuto->parentid, $g3autoids)) {
                             array_push($g3autoids, $thisAuto->parentid);
                         }
                         $autoWhere = array('id' => $thisAuto->id);
                         break;
                 }
             }
         }
     }
     /*静态页列表*/
     $pages = array();
     $caches = array();
     $toHtml = loadConfig('site', 'tohtml');
     $html_refresh_db = bpBase::loadModel('htmlpage_needrefresh_model');
     if ($g1autoids) {
         foreach ($g1autoids as $g1autoid) {
             if ($toHtml) {
                 $html_refresh_db->insert(array('pagetype' => 'brandIndex', 'parmid' => $g1autoid, 'time' => SYS_TIME));
                 //品牌主页
             }
             //array_push($caches,cache_articlesOfAuto(array('autoid'=>$g1autoid)));
         }
     }
     if ($g3autoids) {
         foreach ($g3autoids as $autoid) {
             if ($toHtml) {
                 $html_refresh_db->insert(array('pagetype' => 'brandIndex', 'parmid' => $g1autoid, 'time' => SYS_TIME));
                 //品牌主页
                 $html_refresh_db->insert(array('pagetype' => 'serieIndex', 'parmid' => $autoid, 'time' => SYS_TIME));
                 //3级主页
             }
             //所有四级主页
             if ($toHtml) {
                 $childrenCfs = $autodb->get_results('*', '', $autoWhere);
                 if ($childrenCfs) {
                     foreach ($childrenCfs as $ccf) {
                         $html_refresh_db->insert(array('pagetype' => 'autoIndex', 'parmid' => $ccf->id, 'time' => SYS_TIME));
                     }
                 }
             }
             //array_push($caches,cache_articlesOfAuto(array('autoid'=>$autoid)));
         }
     }
     //生成
     $tpl = bpBase::loadAppClass('template', 'template');
     $channelObj = bpBase::loadAppClass('channelObj', 'channel');
     $thisChannel = $channelObj->getChannelByID($_GET['channelid']);
     $tpl->createContentPageR($_GET['contentid'], $thisChannel);
     /*下一个页面*/
     $nextUrl = '?m=article&c=m_article&a=articles&id=' . $_GET['channelid'] . '&site=' . $_GET['site'];
     showMessage('处理完成', $nextUrl, 500);
 }
Ejemplo n.º 15
0
 public function getSelectContentsSimpleSql($channelID, $getCount = 0, $orderBy = 'taxis', $start = 0, $scope = 'self', $onlyImg = null, $exceptChannelids = '')
 {
     /*select what?*/
     $start = intval($start);
     $getCount = intval($getCount);
     /*select condition?*/
     $channelID = intval($channelID);
     $selectCondition = '';
     if ($channelID) {
         //scope
         switch ($scope) {
             default:
             case 'self':
                 $selectCondition = 'channel_id=' . $channelID;
                 break;
             case 'children':
                 $channel = bpBase::loadAppClass('channelObj', 'channel', 1);
                 $descents = $channel->getChannelsByParentID($channelID);
                 $cidStr = $channelID;
                 if ($descents) {
                     $comma = ',';
                     foreach ($descents as $item) {
                         if ($item->id) {
                             $cidStr .= $comma . $item->id;
                         }
                     }
                     $selectCondition = 'channel_id IN (' . $cidStr . ')';
                 } else {
                     $selectCondition = 'channel_id=' . $channelID;
                 }
                 break;
         }
     } else {
         $selectCondition = 'channel_id!=0';
     }
     if (!in_array($orderBy, array('taxis', 'time', 'viewcount'))) {
         $orderBy = 'time';
     }
     //is image
     if (is_null($onlyImg)) {
     } else {
         if ($onlyImg == 0) {
             $selectCondition .= ' AND (thumb IS NULL OR thumb=\'\')';
         } else {
             $selectCondition .= ' AND thumb IS NOT NULL AND thumb!=\'\'';
         }
     }
     $exceptChannelSql = '';
     if ($exceptChannelids && is_array($exceptChannelids)) {
         $exceptChannelSql = ' AND channel_id NOT IN (';
         $comma = '';
         foreach ($exceptChannelids as $exid) {
             $exceptChannelSql .= $comma . $exid;
             $comma = ',';
         }
         $exceptChannelSql .= ')';
     }
     if ($getCount) {
         $sql = 'SELECT id,site,link,externallink,thumb,title,subtitle,intro,source,author,time,keywords,pagecount,content,autoname,autograde,autoid,viewcount FROM ' . TABLE_PREFIX . 'article WHERE ' . $selectCondition . $exceptChannelSql . ' AND time<{sysTime} ORDER BY ' . $orderBy . ' DESC LIMIT ' . $start . ',' . $getCount;
     } else {
         $sql = 'SELECT id,site,link,externallink,thumb,title,subtitle,intro,source,author,time,keywords,pagecount,content,autoname,autograde,autoid,viewcount FROM ' . TABLE_PREFIX . 'article WHERE ' . $selectCondition . $exceptChannelSql . ' AND time<{sysTime} ORDER BY ' . $orderBy . ' DESC';
     }
     return $sql;
 }
Ejemplo n.º 16
0
 function createContentPageR($contentID, $thisChannel = '')
 {
     $channelObj = bpBase::loadAppClass('channelObj', 'channel', 1);
     $articleObj = bpBase::loadAppClass('articleObj', 'article', 1);
     //channel
     $contentID = intval($contentID);
     $thisContent = $articleObj->getContentByID($contentID);
     if ($thisChannel == '') {
         $thisChannel = $channelObj->getChannelByID($thisContent->channel_id);
     }
     //
     $template = $this->get($thisChannel->contenttemplate);
     if ($thisContent->time > SYS_TIME) {
         return '';
     }
     if (intval($template->createhtml) && intval($thisChannel->channeltype) != 2) {
         //图片栏目内容不生成静态页面
         //分析模板
         if (file_exists(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $template->id . '.parsed.tpl.php')) {
         } else {
             $templateInfo = $this->getTemplateInfoByPath($template->path);
             //parse first layer tags
             $this->addIDtoFirstLayerTagInTemplate($thisChannel->site, $template->id, $templateInfo['absPath'], '', $thisChannel->id);
         }
         if (file_exists(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $template->id . '.tags.tpl.php')) {
             require ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $template->id . '.tags.tpl.php';
             //
             if (intval($thisContent->pagecount) < 2) {
                 $contents = array($thisContent->content);
                 $totalCount = 1;
                 $totalPage = $totalCount;
             } else {
                 $contents = $articleObj->contentPagination($thisContent->content);
                 $totalCount = count($contents);
                 $totalPage = $totalCount;
             }
             //
             for ($i = 1; $i < $totalPage + 1; $i++) {
                 $paths = $this->getContentFileSavePath($template->generate_path, array('channelID' => $thisChannel->id, 'channelIndex' => $thisChannel->cindex, 'contentID' => $contentID, 'page' => $i, 'siteID' => $thisContent->site));
                 $urlParts = explode('.', $paths['urlPath']);
                 $thisContent->content = $contents[$i - 1];
                 $this->parseFirstLayerTag($template->id, $thisContent->site, $thisContent->channel_id, $contentID, ABS_PATH . $paths['savaPath'], $tagsArr, array('pageSize' => 1, 'totalCount' => $totalCount, 'currentPage' => $i, 'urlPrefix' => $urlParts[0], 'urlSuffix' => '.' . $urlParts[1]), $thisContent, 'content');
             }
             //更新栏目链接地址
             $articleObj->updateLink($contentID, $paths['urlPath']);
             $articleObj->updateLastCreateTime($contentID);
         }
     } else {
         $paths = $this->getContentFileSavePath($template->generate_path, array('channelID' => $thisChannel->id, 'channelIndex' => $thisChannel->cindex, 'contentID' => $contentID, 'page' => 1, 'siteID' => $thisContent->site), $template->createhtml);
         $articleObj->updateLink($contentID, $paths['urlPath']);
     }
 }
Ejemplo n.º 17
0
 public function action_picUpload()
 {
     if (!isset($_SESSION['canupload'])) {
         exit;
     }
     $error = 0;
     if (isset($_FILES['thumb'])) {
         $photo = $_FILES['thumb'];
         if (substr($photo['type'], 0, 5) == 'image') {
             switch ($photo['type']) {
                 case 'image/jpeg':
                 case 'image/jpg':
                 case 'image/pjpeg':
                     $ext = '.jpg';
                     break;
                 case 'image/gif':
                     $ext = '.gif';
                     break;
                 case 'image/png':
                 case 'image/x-png':
                     $ext = '.png';
                     break;
                 default:
                     $error = -1;
                     break;
             }
             if ($error == 0) {
                 $time = SYS_TIME;
                 $year = date('Y', $time);
                 $month = date('m', $time);
                 $day = date('d', $time);
                 $pathInfo = upFileFolders($time);
                 $dstFolder = $pathInfo['path'];
                 $dstFile = ABS_PATH . 'upload' . DIRECTORY_SEPARATOR . 'temp' . $ext;
                 //the size of file uploaded must under 1M
                 if ($photo['size'] > 2000000) {
                     $error = -2;
                     return $error;
                 }
             } else {
                 return $error;
             }
             //if no error
             if ($error == 0) {
                 $rand = randStr(4);
                 //delete primary files
                 if (file_exists($dstFolder . $time . $rand . $ext)) {
                     unlink($dstFolder . $time . $rand . $ext);
                 }
                 if ($ext != '.gif') {
                     //save the temporary file
                     move_uploaded_file($photo['tmp_name'], $dstFile);
                     $imgInfo = getimagesize($dstFile);
                     //generate new files
                     $imageWidth = intval($_POST['width']) != 0 ? intval($_POST['width']) : $imgInfo[0];
                     $imageHeight = intval($_POST['height']) != 0 ? intval($_POST['height']) : $imgInfo[1];
                     bpBase::loadSysClass('image');
                     image::zfResize($dstFile, $dstFolder . $time . $rand . '.jpg', $imageWidth, $imageHeight, 1 | 4, 2);
                     $ext = '.jpg';
                     //
                 } else {
                     move_uploaded_file($photo['tmp_name'], $dstFolder . $time . $rand . '.gif');
                 }
                 if (isset($_POST['channelid'])) {
                     //内容缩略图
                     $channelObj = bpBase::loadAppClass('channelObj', 'channel');
                     $thisChannel = $channelObj->getChannelByID($_POST['channelid']);
                     $articleObj = bpBase::loadAppClass('articleObj', 'article');
                     $articleObj->setOtherThumb($thisChannel, $dstFile, $dstFolder, $time . $rand, 'jpg');
                 }
                 if ($ext != '.gif') {
                     @unlink($dstFile);
                 }
                 $location = MAIN_URL_ROOT . '/upload/images/' . $year . '/' . $month . '/' . $day . '/' . $time . $rand . $ext;
                 $error = 0;
             }
         } else {
             $error = -1;
         }
     } else {
         $error = -1;
     }
     if ($error == 0) {
         echo $location;
     } else {
         $errors = array(-1 => '你上传的不是图片', -2 => '文件不能超过2M', -3 => '图片地址不正确');
         echo $errors[intval($error)];
     }
 }
Ejemplo n.º 18
0
<?php

bpBase::loadAppClass('manage', 'manage', 0);
class m_user extends manage
{
    function __construct()
    {
        parent::__construct();
    }
    public function users()
    {
        include $this->showManageTpl('users');
    }
}
Ejemplo n.º 19
0
 function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0, $pagination = array(), $thisContent = null)
 {
     //<stl:***></stl:***>
     //type
     $type = $avs['type'] == null ? 'title' : strtolower($avs['type']);
     if ($type == 'imageurl') {
         $type = 'thumb';
     } elseif ($type == 'adddate') {
         $type = 'time';
     } elseif ($type == 'summary') {
         $type = 'intro';
     }
     $contentID = $avs['ID'] ? $avs['ID'] : $contentID;
     $articleObj = bpBase::loadAppClass('articleObj', 'article');
     //instance
     if (intval($avs['ID']) || intval($avs['id'])) {
         if (!intval($avs['ID'])) {
             $contentID = intval($avs['id']);
         }
         $thisContent = $articleObj->getContentByID($contentID);
     }
     if (!$thisContent) {
         $thisContent = $articleObj->getContentByID($contentID);
     }
     //
     $autoids = explode(',', $thisContent->autoid);
     $firstAutoid = 0;
     if ($autoids) {
         foreach ($autoids as $autoid) {
             if (intval($autoid)) {
                 $firstAutoid = $autoid;
                 break;
             }
         }
     }
     $autoclassification_db = bpBase::loadModel('autoclassification_model');
     $autoObj = bpBase::loadAppClass('autoObj', 'auto');
     $firstAuto = $autoclassification_db->getCfByID($firstAutoid);
     //
     switch ($type) {
         default:
             return $thisContent->{$type};
             break;
         case 'keywords':
             return substr($thisContent->keywords, 1);
             break;
         case 'content':
             $thisContent->{$type} = stripslashes($thisContent->{$type});
             $stag = bpBase::loadAppClass('stag', 'template');
             $thisContent->{$type} = $stag->handleStag($thisContent->{$type});
             return $thisContent->{$type};
             break;
         case 'sourcetypeValue':
             if ($thisContent->sourcetype) {
                 $articleConstant = bpBase::loadAppClass('articleConstant', 'article');
                 $sourceTypes = $articleConstant->sourceTypes();
                 return $sourceTypes[$thisContent->sourcetype];
             } else {
                 return '-';
             }
             break;
         case 'time':
             return date($avs['formatString'], $thisContent->time);
             break;
         case 'autotabs':
             if ($thisContent->autograde) {
                 //文章类别
                 $cat = $articleObj->getArticleCat($thisContent->id);
                 if ($cat == 'other' || $cat == '') {
                     $cat = 'none';
                 }
                 $smallLogo = $autoObj->getLogo($firstAuto->id, $firstAuto->logo, 's', $firstAuto->grade);
                 if ($thisContent->autograde == 3) {
                     $parentAuto = $autoclassification_db->getCfByID($firstAuto->parentid);
                     if (!function_exists('autoTabs')) {
                         include_once ABS_PATH . CAR_DIR . DIRECTORY_SEPARATOR . 'include.php';
                     }
                     $autoTabs = autoTabs($cat, $firstAutoid, $firstAutoid, 3, $firstAuto);
                     if (AUTO_SKIN != 'ahauto') {
                         return '<div class="g3nautonav"><div class="bnav_t"><a href="' . CAR_URL_ROOT . '/library_brand.html" class="twpp_morea">车型大全>></a><div class="tit"><h1><a href="' . CAR_URL_ROOT . '/' . $firstAutoid . '" class="twpp_tia">' . $parentAuto->name . ' ' . $firstAuto->name . '</a></h1>&nbsp; <a href="' . STORE_URL_ROOT . '/stores.php?autoid=' . $firstAutoid . '" target="_blank">' . $firstAuto->name . '经销商</a></div></div></div><div class="childChannelNav" style="margin-bottom:8px">' . $autoTabs . '</div>';
                     } else {
                         return '<div id="newcar_title_01" style="margin-bottom:10px"><span><ul>{$autoTabs}</ul></span><b>' . $parentAuto->name . ' ' . $firstAuto->name . '</b></div>';
                     }
                 } elseif ($thisContent->autograde == 1) {
                     if (!function_exists('brandTabs')) {
                         include_once ABS_PATH . CAR_DIR . DIRECTORY_SEPARATOR . 'include.php';
                     }
                     if (AUTO_SKIN != 'ahauto') {
                         $autoTabs = brandTabs($cat, $firstAuto->id, $firstAuto);
                         return '<div class="twpp_bnav" style="margin-bottom:8px"><div class="bnav_t"><a href="' . CAR_URL_ROOT . '/library_brand.html" class="twpp_morea">品牌大全>></a><div class="tit"><img src="' . $smallLogo . '" width="40" height="30" /><h1><a href="' . CAR_URL_ROOT . '/brand-' . $firstAutoid . '.html" class="twpp_tia">' . $firstAuto->name . '</a></h1>    <a href="' . CAR_URL_ROOT . '/price/' . $firstAutoid . '.html" title="' . $firstAuto->name . '车系" target="_blank">车系</a>    <a href="' . CAR_URL_ROOT . '/picture/' . $firstAutoid . '.html" title="' . $firstAuto->name . '图片">图片</a>    <a href="' . STORE_URL_ROOT . '/stores.php?autoid=' . $firstAutoid . '"  title="' . $firstAuto->name . '4S店" target="_blank">经销商</a></div></div><div class="bnav_b">' . $autoTabs . '</div></div>';
                     } else {
                         return '<div class="btop contentt" style="margin-bottom:10px"><img src="' . $smallLogo . '" width="40" height="30" /><h1>' . $firstAuto->name . '</h1></div>';
                     }
                 }
             }
             break;
         case 'relateautoinfo':
             $articlePage = bpBase::loadAppClass('articlePage', 'article');
             $str = $articlePage->relateAutosInContentPage($thisContent->id, $thisContent);
             $strs = explode('<span style="display:none" id="relateAutoStores">,', $str);
             return $strs[0];
             break;
         case 'autoid':
             return $firstAutoid;
             break;
         case 'serieid':
             if ($thisContent->autograde) {
                 if ($thisContent->autograde == 3) {
                     return $firstAutoid;
                 } elseif ($thisContent->autograde == 1) {
                     return 0;
                 }
             }
             break;
         case 'brandid':
             if ($thisContent->autograde) {
                 if ($thisContent->autograde == 3) {
                     return $firstAuto->g1id;
                 } elseif ($thisContent->autograde == 1) {
                     return $firstAutoid;
                 }
             }
             break;
         case 'autoname':
             return $thisContent->autoname;
             break;
     }
 }
Ejemplo n.º 20
0
 public function site()
 {
     $this->exitWithoutAccess('system', 'manage');
     //判断是否有相关站点
     $thisSite = $this->site;
     $site_db = M('site');
     //读取softphs首页回复配置
     $home_db = M('home');
     $homeConfig = $home_db->get_one(array('token' => $this->token));
     //
     if (IS_POST) {
         $row = $_POST['info'];
         $row['statisticcode'] = base64_encode($row['statisticcode']);
         if (!$thisSite) {
             $siteid = $site_db->insert($row, 1);
             //添加默认分类
             if ($siteid) {
                 $channel_db = M('channel');
                 $homeChannelRow = array('name' => '首页', 'shortname' => '首页', 'channeltype' => 1, 'cindex' => 'homepage', 'thumbwidth' => 0, 'thumbheight' => 0, 'parentid' => 0, 'site' => $siteid, 'time' => SYS_TIME, 'token' => $this->token, 'isnav' => 0);
                 $homeChannelID = $channel_db->insert($homeChannelRow, 1);
                 $channelArrs = array(array('name' => '关于我们', 'shortname' => '简介', 'cindex' => 'aboutus', 'channeltype' => 1, 'isnav' => 1), array('name' => '最新动态', 'shortname' => '动态', 'cindex' => 'news', 'channeltype' => 1, 'isnav' => 1), array('name' => '产品展示', 'shortname' => '产品', 'cindex' => 'products', 'channeltype' => 1, 'isnav' => 1), array('name' => '精彩案例', 'shortname' => '案例', 'cindex' => 'case', 'channeltype' => 1, 'isnav' => 1), array('name' => '联系我们', 'shortname' => '联系', 'cindex' => 'contact', 'channeltype' => 1, 'isnav' => 1), array('name' => '幻灯片', 'shortname' => '幻灯片', 'cindex' => 'focus', 'channeltype' => 1, 'isnav' => 0));
                 $baseChannelArr = array('thumbwidth' => 0, 'thumbheight' => 0, 'parentid' => $homeChannelID, 'site' => $siteid, 'time' => SYS_TIME, 'token' => $this->token);
                 $focusChannelID = 0;
                 if ($homeChannelID) {
                     $tpl = bpBase::loadAppClass('template', 'template');
                     foreach ($channelArrs as $c) {
                         $crow = $baseChannelArr;
                         $crow['name'] = $c['name'];
                         $crow['cindex'] = $c['cindex'];
                         $crow['channeltype'] = $c['channeltype'];
                         $crow['isnav'] = $c['isnav'];
                         $crow['shortname'] = $c['shortname'];
                         $channelid = $channel_db->insert($crow, 1);
                         if ($c['cindex'] == 'focus') {
                             $focusChannelID = $channelid;
                         }
                         $tpl->createChannelPageR($channelid);
                     }
                 }
             }
             //导入pigcms幻灯片
             $flash_db = M('flash');
             $article_db = M('article');
             $flashPics = $flash_db->select(array('token' => $this->token));
             if ($flashPics) {
                 foreach ($flashPics as $fp) {
                     $article_db->insert(array('channel_id' => $focusChannelID, 'token' => $this->token, 'site' => $siteid, 'title' => $fp['info'], 'link' => $fp['url'], 'thumb' => $fp['img'], 'time' => SYS_TIME, 'content' => $fp['info']));
                 }
             }
             //
         } else {
             $site_db->update($row, array('token' => $this->token));
         }
         delCache('siteByToken' . $row['token']);
         if ($this->site['template']) {
             showMessage('设置成功', '?m=' . ROUTE_MODEL . '&c=' . ROUTE_CONTROL . '&a=' . ROUTE_ACTION);
         } else {
             showMessage('设置成功,请选择网站模板', '?m=template&c=m_template&a=selectTemplate');
         }
     } else {
         include $this->showManageTpl('site');
     }
 }
Ejemplo n.º 21
0
 function keywordSet()
 {
     $keywords_db = bpBase::loadModel('keywords_model');
     if (isset($_POST['doSubmit'])) {
         $info = $_POST['info'];
         $info['keyword'] = htmlspecialchars($info['keyword'], ENT_COMPAT, 'GB2312');
         $info['title'] = htmlspecialchars($info['title'], ENT_COMPAT, 'GB2312');
         $info['link'] = htmlspecialchars($info['link'], ENT_COMPAT, 'GB2312');
         $info['target'] = htmlspecialchars($info['target'], ENT_COMPAT, 'GB2312');
         if (!isset($_POST['id']) || !intval($_POST['id'])) {
             //add
             $info['time'] = SYS_TIME;
             $keywords_db->insert($info);
         } else {
             $keywords_db->update($info, array('id' => intval($_POST['id'])));
         }
         delCache('c_keywords');
         showMessage(L('setSuccess'), '?m=seo&a=keywords&c=seo');
     } else {
         $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
         $adus = bpBase::loadAppClass('adus', 'manage');
         $adus->title = '设置关键词';
         $adus->opers = array(array('text' => '返回', 'href' => $_SERVER['HTTP_REFERER'], 'class' => 'back'));
         $adus->formAction = '?m=seo&c=seo&a=keywordSet';
         $adus->jss = array('');
         $adus->headerHtml = '';
         /********************输入项*************************/
         $inputs = array();
         if (!$id) {
             $linkValue = 'http://';
             $targetValue = '_blank';
         } else {
             $thisKeyWord = $keywords_db->get_one(array('id' => $id));
             $linkValue = $thisKeyWord['link'];
             $titleValue = $thisKeyWord['title'];
             $targetValue = $thisKeyWord['target'];
             $keywordValue = $thisKeyWord['keyword'];
         }
         array_push($inputs, array('name' => '关键词', 'type' => 'text', 'validate' => "'required'", 'style' => 'width:180px;', 'field' => 'info[keyword]', 'value' => $keywordValue));
         array_push($inputs, array('name' => '链接地址', 'type' => 'text', 'validate' => "'required'", 'style' => 'width:180px;', 'field' => 'info[link]', 'value' => $linkValue));
         array_push($inputs, array('name' => '链接title', 'type' => 'hidden', 'validate' => "'required'", 'style' => 'width:180px;', 'field' => 'info[title]', 'value' => $titleValue));
         array_push($inputs, array('name' => '链接target', 'type' => 'text', 'validate' => "'required'", 'style' => 'width:180px;', 'field' => 'info[target]', 'value' => $targetValue));
         array_push($inputs, array('name' => '', 'type' => 'hidden', 'validate' => "", 'field' => 'id', 'value' => $id));
         $adus->inputs = $inputs;
         $adus->outputPage();
     }
 }
Ejemplo n.º 22
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;
     }
 }
Ejemplo n.º 23
0
 function createChannelPage()
 {
     $i = isset($_GET['i']) ? intval($_GET['i']) : 0;
     $progressBarTotalWidth = 400;
     if ($_GET['type'] == 'channel') {
         $channelIDStr = file_get_contents(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . 'channels.txt');
         $idsArr = explode(',', $channelIDStr);
         $nextI = $i + 1;
         $count = count($idsArr);
         $idsArr2 = explode('.', $idsArr[$i]);
         $createRt = $this->tpl->createChannelPageR($idsArr2[0], $idsArr2[1]);
         if ($nextI != $count) {
             $progressBarWidth = $nextI * $progressBarTotalWidth / $count;
             showMessage('正在生成栏目页,进度:' . $nextI . '/' . $count . '', '?m=template&c=createHtml&a=createChannelPage&siteid=' . $_GET['siteid'] . '&type=channel&i=' . $nextI, 1);
             //$tip='正在生成'.$nextI.'/'.$count.',请勿关闭';
         } else {
             //$progressBarWidth=$progressBarTotalWidth;
             $tip = '生成完成,共生成' . $count . '个栏目页面';
             unlink(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . 'channels.txt');
             showMessage($tip);
         }
     }
     if ($_GET['type'] == 'content') {
         $content = bpBase::loadAppClass('articleObj', 'article', 1);
         $contentIDStr = file_get_contents(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . 'contents.txt');
         $idsArr = explode(',', $contentIDStr);
         $pageCount = 2;
         //每次生成多少个
         $nextI = $i + $pageCount;
         $count = count($idsArr);
         for ($t = $i; $t < $nextI; $t++) {
             if ($t < $count) {
                 $this->tpl->createContentPageR($idsArr[$t]);
             }
         }
         if ($nextI < $count) {
             showMessage('正在生成内容页,进度:' . $nextI . '/' . $count . '', '?m=template&c=createHtml&a=createChannelPage&siteid=' . $_GET['siteid'] . '&type=content&i=' . $nextI, 1);
             //$progressBarWidth=$nextI*$progressBarTotalWidth/$count;
             //$tip='正在生成'.$nextI.'/'.$count.',请勿关闭';
         } else {
             $progressBarWidth = $progressBarTotalWidth;
             $tip = '生成内容页完成,共生成' . $count . '个页面';
             unlink(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . 'contents.txt');
             showMessage($tip);
         }
     }
     //include $this->showManageTpl('createChannelPage');
 }
Ejemplo n.º 24
0
 function share()
 {
     $sitePage = bpBase::loadAppClass('sitePage', 'site', 1);
     $sitePage->share();
 }
Ejemplo n.º 25
0
 function setTemplate()
 {
     $templateIndex = $_GET['templateindex'];
     if (!$templateIndex || !file_exists(ABS_PATH . 'smarty' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'tpls' . DIRECTORY_SEPARATOR . $templateIndex) || !is_dir(ABS_PATH . 'smarty' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'tpls' . DIRECTORY_SEPARATOR . $templateIndex)) {
         exit('不是合法的模板');
     }
     //
     $ys = intval($this->siteid % 10);
     //1.创建smarty文件夹
     if (!is_dir(ABS_PATH . 'smarty' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $ys)) {
         mkdir(ABS_PATH . 'smarty' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $ys, 0777);
     }
     if (!is_dir(ABS_PATH . 'smarty' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $ys . DIRECTORY_SEPARATOR . $this->site['token'])) {
         mkdir(ABS_PATH . 'smarty' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $ys . DIRECTORY_SEPARATOR . $this->site['token'], 0777);
     }
     //2.拷贝模板文件到smarty目录中
     $sourceDir = ABS_PATH . 'smarty' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'tpls' . DIRECTORY_SEPARATOR . $templateIndex . DIRECTORY_SEPARATOR;
     $dstDir = ABS_PATH . 'smarty' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $ys . DIRECTORY_SEPARATOR . $this->site['token'] . DIRECTORY_SEPARATOR;
     @copy($sourceDir . 'index.html', $dstDir . 'index.html');
     @copy($sourceDir . 'channel_picture.html', $dstDir . 'channel_picture.html');
     @copy($sourceDir . 'channel_text.html', $dstDir . 'channel_text.html');
     @copy($sourceDir . 'content.html', $dstDir . 'content.html');
     @copy($sourceDir . 'style.css', $dstDir . 'style.css');
     @copy($sourceDir . 'footer.html', $dstDir . 'footer.html');
     @copy($sourceDir . 'header.html', $dstDir . 'header.html');
     //3.插入模板数据
     $template_db = M('template');
     $template_db->delete(array('site' => $this->siteid));
     //删除原有模板
     $templateRows = array(array('name' => '首页', 'path' => '@/smarty/templates/' . $ys . '/' . $this->site['token'] . '/index.html', 'generate_path' => '', 'type' => '1', 'isdefault' => '1', 'createhtml' => '0', 'site' => $this->siteid, 'time' => SYS_TIME), array('name' => '文字列表', 'path' => '@/smarty/templates/' . $ys . '/' . $this->site['token'] . '/channel_text.html', 'generate_path' => '?m=site&c=home&a=channel&channelid={channelID}', 'type' => '2', 'isdefault' => '1', 'createhtml' => '0', 'site' => $this->siteid, 'time' => SYS_TIME), array('name' => '图片列表', 'path' => '@/smarty/templates/' . $ys . '/' . $this->site['token'] . '/channel_picture.html', 'generate_path' => '?m=site&c=home&a=channel&channelid={channelID}', 'type' => '2', 'isdefault' => '0', 'createhtml' => '0', 'site' => $this->siteid, 'time' => SYS_TIME), array('name' => '内容', 'path' => '@/smarty/templates/' . $ys . '/' . $this->site['token'] . '/content.html', 'generate_path' => '?m=site&c=home&a=content&contentid={contentID}', 'type' => '3', 'isdefault' => '1', 'createhtml' => '0', 'site' => $this->siteid, 'time' => SYS_TIME), array('name' => '样式css', 'path' => '@/smarty/templates/' . $ys . '/' . $this->site['token'] . '/style.css', 'generate_path' => '', 'type' => '4', 'isdefault' => '0', 'createhtml' => '0', 'site' => $this->siteid, 'time' => SYS_TIME), array('name' => '顶部', 'path' => '@/smarty/templates/' . $ys . '/' . $this->site['token'] . '/header.html', 'generate_path' => '', 'type' => '4', 'isdefault' => '0', 'createhtml' => '0', 'site' => $this->siteid, 'time' => SYS_TIME), array('name' => '底部', 'path' => '@/smarty/templates/' . $ys . '/' . $this->site['token'] . '/footer.html', 'generate_path' => '', 'type' => '4', 'isdefault' => '0', 'createhtml' => '0', 'site' => $this->siteid, 'time' => SYS_TIME));
     $defaultChannelTemplateID = 0;
     $defaultContentTemplateID = 0;
     $pictureChanenlTemplateID = 0;
     foreach ($templateRows as $trow) {
         $templateid = $template_db->insert($trow, 1);
         if ($trow['type'] == '2' && $trow['isdefault'] == '1') {
             $defaultChannelTemplateID = $templateid;
         }
         if ($trow['type'] == '3' && $trow['isdefault'] == '1') {
             $defaultContentTemplateID = $templateid;
         }
         if ($trow['type'] == '2' && $trow['isdefault'] == '0') {
             $pictureChanenlTemplateID = $templateid;
         }
     }
     //5.栏目匹配模板
     $channel_db = M('channel');
     $channel_db->update(array('channeltemplate' => $defaultChannelTemplateID, 'contenttemplate' => $defaultContentTemplateID), array('site' => $this->siteid));
     $channel_db->update(array('channeltemplate' => $pictureChanenlTemplateID), array('site' => $this->siteid, 'cindex' => 'products'));
     //6.设置home数据
     $home_db = M('home');
     $home_db->update(array('advancetpl' => 1), array('token' => $this->token));
     //
     $site_db = M('site');
     $site_db->update(array('template' => $templateIndex), array('token' => $this->token));
     delCache('siteByToken' . $this->token);
     //7.生成页面
     $allChannels = $channel_db->select(array('site' => $this->siteid));
     if ($allChannels) {
         $tpl = bpBase::loadAppClass('template', 'template');
         foreach ($allChannels as $c) {
             @$tpl->createChannelPageR($c['id']);
         }
     }
     //
     unset($_SESSION['previewSkin']);
     showMessage(L('setSuccess') . ',请在网站内容管理里设置栏目和内容,<a href="../index.php?token=' . $this->token . '" target="_blank">点击这里预览首页</a>', $_POST['referer']);
 }
Ejemplo n.º 26
0
<?php

bpBase::loadAppClass('front', 'front', 0);
class sitePage extends front
{
    public $token;
    public $siteid;
    public $site_db;
    public $site;
    public $channel_db;
    public $article_db;
    public $navChannels;
    public $ys;
    public $smartyDir;
    public $company;
    public $wechat_id;
    function __construct()
    {
        parent::__construct();
        $this->site_db = M('site');
        $this->channel_db = M('channel');
        $this->article_db = M('article');
        //wechat_id
        $this->wechat_id = $_GET['wecha_id'];
        //
        if (isset($_GET['token'])) {
            $this->token = $_GET['token'];
            $this->site = $this->site_db->getSiteByToken($this->token);
            $this->siteid = $this->site['id'];
        }
        if (isset($_GET['channelid'])) {
Ejemplo n.º 27
0
 function getSql($avs, $siteID)
 {
     //properties
     $num = intval($avs['totalNum']);
     $start = $avs['startNum'] == null ? 0 : intval($avs['startNum']) - 1;
     $channelSql = '';
     if ($avs['channelIndex']) {
         $channelObj = bpBase::loadAppClass('channelObj', 'channel', 1);
         $thisChannel = $channelObj->getChannelByIndex($avs['channelIndex'], 1);
         $channelids = array();
         if (intval($thisChannel->id)) {
             $channelSql = ' AND A.channel_id=' . $thisChannel->id;
             array_push($channelids, $thisChannel->id);
             if ($avs['scope'] && $avs['scope'] == 'children') {
                 $channels = $channelObj->getChannelsByParentID($thisChannel->id);
                 if ($channels) {
                     foreach ($channels as $c) {
                         array_push($channelids, $c->id);
                     }
                 }
             }
             $channelSql = ' AND ' . to_sqls($channelids, '', 'A.channel_id');
         }
         //
     }
     if (!intval($avs['city'])) {
         return 'SELECT A.autoid,A.id,A.site,A.link,A.externallink,A.thumb,CC.title,CC.title AS subtitle,A.title AS atitle,A.subtitle AS asubtitle,A.intro,A.source,A.author,A.time,A.keywords,A.pagecount FROM ' . TABLE_PREFIX . 'contentgroup_content CC,' . TABLE_PREFIX . 'article A WHERE groupid=' . $avs['id'] . ' AND A.id=CC.contentid' . $channelSql . ' AND A.time<{sysTime} ORDER BY CC.taxis DESC LIMIT ' . $start . ',' . $num;
     } else {
         return 'SELECT A.autoid,A.id,A.site,A.link,A.externallink,A.thumb,CC.title,CC.title AS subtitle,A.title AS atitle,A.subtitle AS asubtitle,A.intro,A.source,A.author,A.time,A.keywords,A.pagecount FROM ' . TABLE_PREFIX . 'contentgroup_content CC,' . TABLE_PREFIX . 'article A WHERE groupid=' . $avs['id'] . ' AND CC.geoid=' . intval($avs['city']) . ' AND A.id=CC.contentid' . $channelSql . ' AND A.time<{sysTime} ORDER BY CC.taxis DESC LIMIT ' . $start . ',' . $num;
     }
 }
Ejemplo n.º 28
0
 public function channelSet()
 {
     if (IS_POST) {
         $tpl = bpBase::loadAppClass('template', 'template');
         $info = $_POST['info'];
         if (!isset($_POST['id'])) {
             //add
             $info['time'] = SYS_TIME;
             if (!$info['shortname']) {
                 $info['shortname'] = $info['name'];
             }
             $info['token'] = $this->token;
             $channelid = $this->channel_db->insert($info, 1);
             $this->channel_db->update(array('taxis' => $channelid), array('id' => $channelid));
             $tpl->createChannelPageR($channelid);
             delCache('navChannels' . $this->siteid);
             //设置其他栏目为非首页显示
             if ($info['homepicturechannel']) {
                 $this->channel_db->update(array('homepicturechannel' => 0), 'id!=' . $channelid);
             }
             if ($info['hometextchannel']) {
                 $this->channel_db->update(array('hometextchannel' => 0), 'id!=' . $channelid);
             }
             delCache('navChannels' . $this->siteid);
             //
             showMessage(L('addSuccess'), $_POST['referer']);
         } else {
             //update
             $thisChannel = $this->channel_db->get_one(array('id' => $_POST['id']));
             if (!isset($info['externallink'])) {
                 $info['externallink'] = 0;
             }
             $this->channel_db->update($info, array('id' => $_POST['id']));
             $tpl->createChannelPageR($thisChannel['id']);
             //设置其他栏目为非首页显示
             if ($info['homepicturechannel']) {
                 $this->channel_db->update(array('homepicturechannel' => 0), 'id!=' . $_POST['id']);
             }
             if ($info['hometextchannel']) {
                 $this->channel_db->update(array('hometextchannel' => 0), 'id!=' . $_POST['id']);
             }
             delCache('channelOfIndex' . $thisChannel['cindex'] . 'Site' . $thisChannel['site']);
             delCache('navChannels' . $this->siteid);
             showMessage(L('updateSuccess'), $_POST['referer']);
         }
     } else {
         //
         $template_db = bpBase::loadModel('template_model');
         $channelTemplates = $template_db->select(array('site' => $this->siteid, 'type' => 2), '*', '', 'id ASC');
         $contentTemplates = $template_db->select(array('site' => $this->siteid, 'type' => 3), '*', '', 'id ASC');
         if ($_GET['id']) {
             $thisChannel = $this->channel_db->get_one(array('id' => $_GET['id']));
             //
             $parentChannelID = intval($thisChannel['parentid']);
             $parentChannel = $this->channel_db->get_one(array('id' => $parentChannelID));
             $siteid = $parentChannel['site'];
         } else {
             $parentChannelID = intval($_GET['parentid']);
             $parentChannel = $this->channel_db->get_one(array('id' => $parentChannelID));
             $siteid = $parentChannel['site'];
             //
             $thisChannel = array();
             $thisChannel['pagesize'] = 20;
             $thisChannel['thumbwidth'] = 0;
             $thisChannel['thumb2width'] = 0;
             $thisChannel['thumb3width'] = 0;
             $thisChannel['thumb4width'] = 0;
             $thisChannel['thumbheight'] = 0;
             $thisChannel['thumb2height'] = 0;
             $thisChannel['thumb3height'] = 0;
             $thisChannel['thumb4height'] = 0;
         }
         include $this->showManageTpl('channelSet');
     }
 }
Ejemplo n.º 29
0
" style="width:360px;"></input></td></tr>
       <tr><th>Meta描述</th><td><textarea name="info[metades]" id="metades" class="colorblur" style="width:400px;height:100px;overflow:auto;"><?php 
echo $thisChannel['metades'];
?>
</textarea></td></tr>
       <tr><th>特殊栏目</th><td><input type="checkbox" value="1" name="info[ex]"<?php 
if (intval($thisChannel['ex'])) {
    ?>
 checked<?php 
}
?>
></input> 设为特殊栏目后,该栏目内容将不会出现在搜索结果中</td></tr>
        <tr><th>类型</th><td>
        <?php 
$at = $thisChannel['autotype'];
$channelAutoCats = bpBase::loadAppClass('channelAutoCats', 'channel');
$atOptions = $channelAutoCats->autoCats();
$atOptionStr = '';
foreach ($atOptions as $ato) {
    if ($ato['value'] != $at) {
        $atOptionStr .= '<option value="' . $ato['value'] . '">' . $ato['text'] . '</option>';
    } else {
        $atOptionStr .= '<option value="' . $ato['value'] . '" selected>' . $ato['text'] . '</option>';
    }
}
?>
        <select name="info[autotype]"><?php 
echo $atOptionStr;
?>
</select></td></tr>
        
Ejemplo n.º 30
0
 function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0, $pagination = array())
 {
     //<stl:***></stl:***>
     $scope = $avs['scope'] == null ? 'self' : 'children';
     if ($avs['isImage'] == null) {
         $avs['isImage'] = 'null';
     } else {
         $avs['isImage'] = $avs['isImage'] == 'true' ? 1 : 0;
     }
     switch ($avs['order']) {
         default:
             $order = 'taxis';
             break;
         case null:
             $order = 'taxis';
             break;
         case 'Hits':
             $order = 'viewcount';
             break;
         case 'AddDate':
             $order = 'time';
             break;
     }
     $num = $avs['pageNum'];
     if (!intval($num)) {
         $num = 20;
     }
     //
     $content = bpBase::loadAppClass('articleObj', 'article', 1);
     $sepratorCount = intval($avs['seperatorCount']);
     $totalCount = $pagination['totalCount'];
     $pageSize = intval($num);
     $currentPage = $pagination['currentPage'];
     $start = ($currentPage - 1) * $pageSize;
     $contents = $content->getContentsByChannelID($channelID, $pageSize, $order, $start, $scope, $isImage);
     $returnStr = '';
     if ($contents) {
         $middleStr = parent::getMiddleBody($str, 'pageContents', $this->gTag);
         $tags = array('[stl.fullTitle]', '[stl.content.author]', '[stl.content.source]', '[stl.content.thumb]', '[stl.content.content]');
         $i = 0;
         foreach ($contents as $c) {
             $replaces = array($c->title, $c->author, $c->source, $c->thumb, $c->content);
             $valueStr = str_replace($tags, $replaces, $middleStr);
             if ($avs['titleLen']) {
                 $valueStr = str_replace('[stl.content.title]', mb_substr($c->title, 0, $avs['titleLen'], DB_CHARSET), $valueStr);
                 $valueStr = str_replace('[stl.content.subtitle]', mb_substr($c->subtitle, 0, $avs['titleLen'], DB_CHARSET), $valueStr);
             } else {
                 $valueStr = str_replace(array('[stl.content.title]', '[stl.content.subtitle]'), array($c->title, $c->subtitle), $valueStr);
             }
             if ($avs['introLen']) {
                 $valueStr = str_replace('[stl.content.intro]', mb_substr($c->intro, 0, $avs['introLen'], DB_CHARSET), $valueStr);
             } else {
                 $valueStr = str_replace('[stl.content.intro]', $c->intro, $valueStr);
             }
             if ($avs['absPath']) {
                 $site = bpBase::loadAppClass('siteObj', 'site', 1);
                 $thisSite = $site->getSiteByID($siteID);
                 $valueStr = str_replace('[stl.content.link]', $thisSite->url . $c->link, $valueStr);
             } else {
                 $valueStr = str_replace('[stl.content.link]', $c->link, $valueStr);
             }
             //time
             $valueStr = str_replace('[stl.content.time]', date($avs['dateFormat'], $c->time), $valueStr);
             $returnStr .= $valueStr;
             //seperator
             $i++;
             if ($sepratorCount && $i % $sepratorCount == 0 && $i != $pageSize) {
                 $returnStr .= '<div class="pageContentsSeperator"></div>';
             }
         }
     }
     return $returnStr;
 }