function createSitemap($type, $showMessage = 1) { $sitemapConfig = loadConfig('sitemap'); $articleCount = $sitemapConfig['articleCount'] ? $sitemapConfig['articleCount'] : 500; $ucarCount = $sitemapConfig['ucarCount'] ? $sitemapConfig['ucarCount'] : 500; $datas = array(); switch ($type) { default: case 'news': $article_db = bpBase::loadModel('article_model'); $articles = $article_db->select(array('ex' => 0), 'link,time,title,keywords', '0,' . $articleCount, 'time DESC'); if ($articles) { foreach ($articles as $a) { if (!strExists($a['link'], 'http://')) { $a['link'] = MAIN_URL_ROOT . $a['link']; } if ($a['keywords'] == ',') { $a['keywords'] = ''; } array_push($datas, array('url' => $a['link'], 'time' => $a['time'], 'keywords' => $a['keywords'])); } } break; } $this->_createSitemap($type, $datas, $showMessage); }
function __construct() { parent::__construct(); $this->exitWithoutAccess('template','manage'); $this->template_db = bpBase::loadModel('template_model'); $this->templateClass=bpBase::loadAppClass('template','template'); $this->cats=$this->templateClass->cats(); if (isset($_GET['siteid'])&&intval($_GET['siteid'])!=$this->siteid){ exit(); } }
public function __construct() { parent::__construct(); /***********uid*******************/ $uid = isset($_GET['uid']) && intval($_GET['uid']) > 0 ? intval($_GET['uid']) : 0; //设置uid为request的数值 $uid = $uid > 0 ? $uid : $this->uid; $this->assign('uid', $uid); if (!$uid) { header('Location:/'); exit; } $thisUser = $this->user; $this->assign('user', $thisUser); /**********************************************************/ if ($this->uid == $uid) { $sub = '我'; $my = 1; } else { $sub = '他(她)'; $my = 0; } $this->uid = $uid; $this->assign('sub', $sub); $this->assign('my', $my); /*********************判断是不是各种经销商***************************/ $storeUserIndependent = 0; //经销商用户是否单独建表存储 if (intval(loadConfig('store', 'storeUserIndependent'))) { $storeUserIndependent = 1; //经销商用户是否单独建表存储 } if ($uid == $this->uid) { $this->assign('canManage', 1); } if ($uid == $this->uid && !$storeUserIndependent) { $store_db = bpBase::loadModel('store_model'); $is4sStore = 0; if ($store_db->select(array('storetype' => 1, 'uid' => $this->uid))) { $is4sStore = 1; } $this->assign('is4sStore', $is4sStore); //carRental $isRentalStore = 0; if ($store_db->select(array('storetype' => 3, 'uid' => $this->uid))) { $isRentalStore = 1; } $this->assign('isRentalStore', $isRentalStore); //ucar $ucar_store_db = bpBase::loadModel('usedcar_store_model'); $thisUcarStore = $ucar_store_db->select(array('uid' => $this->uid)); $this->assign('isUcarStore', $thisUcarStore ? 1 : 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 . '"}]}'; }
function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0) { //<stl:***></stl:***> //properties $id = $avs['ID']; $sindex = $avs['index']; // $geoid = intval($avs['cityid']); if (!$site) { $site = 1; } // $adset_db = bpBase::loadModel('adset_model'); if ($id) { $thisAdSet = $adset_db->singleADSet($id); } elseif ($sindex) { $thisAdSet = $adset_db->singleADSetByIndex($sindex, $site); $id = $thisAdSet->set_id; } // $str = ''; $ad_db = bpBase::loadModel('ad_model'); $ads = $ad_db->adsOfSet($id, 1, $site, 1, $geoid); switch ($avs['type']) { case 'couplet': $bianju = 26; //距离浏览器边的宽度 $mtop = 50; //上边距 //左侧广告 switch ($ads[0]->type) { case 'flash': $str .= '<div id="couplet_l" style="position:fixed;top:' . $mtop . 'px;_position:absolute;left:' . $bianju . 'px"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' . $ads[0]->width . '" height="' . $ads[0]->height . '"><param name="movie" value="' . $ads[0]->path . '"><param name="quality" value="high"><embed src="' . $ads[0]->path . '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' . $ads[0]->width . '" height="' . $ads[0]->height . '"></embed></object><div style="cursor:pointer;margin:5px 0 0 0;text-align:right;" onclick="$(\'couplet_l\').dispose()">关闭</div></div>'; break; case 'image': $str .= '<div id="couplet_l" style="position:fixed;top:' . $mtop . 'px;_position:absolute;left:' . $bianju . 'px"><a href="' . $ads[0]->link . '" target="_blank"><img src="' . $ads[0]->path . '" width="' . $ads[0]->width . '" height="' . $ads[0]->height . '" border="0" /></a><div style="cursor:pointer;margin:5px 0 0 0;text-align:right;" onclick="$(\'couplet_l\').dispose()">关闭</div></div>'; break; } //右侧广告 switch ($ads[1]->type) { case 'flash': $str .= '<div id="couplet_r" style="position:fixed;top:' . $mtop . 'px;_position:absolute;right:' . $bianju . 'px"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' . $ads[1]->width . '" height="' . $ads[1]->height . '"><param name="movie" value="' . $ads[1]->path . '"><param name="quality" value="high"><embed src="' . $ads[1]->path . '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' . $ads[1]->width . '" height="' . $ads[1]->height . '"></embed></object><div style="cursor:pointer;margin:5px 0 0 0;text-align:right;" onclick="$(\'couplet_r\').dispose()">关闭</div></div>'; break; case 'image': $str .= '<div id="couplet_r" style="position:fixed;top:' . $mtop . 'px;_position:absolute;right:' . $bianju . 'px"><a href="' . $ads[1]->link . '" target="_blank"><img src="' . $ads[1]->path . '" width="' . $ads[1]->width . '" height="' . $ads[1]->height . '" border="0" /></a><div style="cursor:pointer;margin:5px 0 0 0;text-align:right;" onclick="$(\'couplet_r\').dispose()">关闭</div></div>'; break; } $str .= ''; break; } return $str; }
/** * 构造函数 * */ public function __construct($dbObj = null) { if (!$dbObj) { $this->db = bpBase::loadModel('session_model'); } else { //autoDB; $this->db = $dbObj; $this->oldSys = 1; $this->table = TABLE_PREFIX . 'session'; } $this->lifetime = loadConfig('site', 'session_ttl'); $this->lifetime = $this->lifetime == '' ? 3600 : $this->lifetime; session_set_save_handler(array(&$this, 'open'), array(&$this, 'close'), array(&$this, 'read'), array(&$this, 'write'), array(&$this, 'destroy'), array(&$this, 'gc')); session_start(); }
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; }
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; }
function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0) { //<stl:***></stl:***> $articleObj = bpBase::loadAppClass('articleObj', 'article'); $mobileConfig = loadConfig('mobile'); $content_db = bpBase::loadModel('article_model'); $avs['sql'] = str_replace('{sysTime}', SYS_TIME, $avs['sql']); $contents = $content_db->get_resultsBySql($avs['sql']); $returnStr = ''; if ($contents) { $middleStr = parent::getMiddleBody($str, 'groupContents', $this->gTag); $tags = array('[stl.content.author]', '[stl.content.source]', '[stl.content.thumb]', '[stl.content.content]'); foreach ($contents as $c) { $title = $c->title ? $c->title : $c->atitle; $replaces = array($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($title, 0, $avs['titleLen'], DB_CHARSET), $valueStr); if (strlen($c->subtitle)) { //判断是否有副标题 $valueStr = str_replace('[stl.content.subtitle]', mb_substr($title, 0, $avs['titleLen'], DB_CHARSET), $valueStr); } else { $valueStr = str_replace('[stl.content.subtitle]', mb_substr($title, 0, $avs['titleLen'], DB_CHARSET), $valueStr); } } else { if (strlen($c->subtitle)) { //判断是否有副标题 $valueStr = str_replace(array('[stl.content.title]', '[stl.content.subtitle]'), array($title, $title), $valueStr); } else { $valueStr = str_replace(array('[stl.content.title]', '[stl.content.subtitle]'), array($title, $title), $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); // 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); } $valueStr = str_replace('[stl.content.link]', $c->link, $valueStr); $valueStr = str_replace('[stl.content.fullTitle]', $c->atitle, $valueStr); $valueStr = str_replace('[stl.content.oTitle]', $c->atitle, $valueStr); $valueStr = str_replace('[stl.content.oSubTitle]', $c->asubtitle, $valueStr); $valueStr = str_replace('[stl.fullTitle]', $c->atitle, $valueStr); //手机版链接 if ($c->externallink) { $articleInfo = $articleObj->getLinkInfo($c->link); if ($articleInfo) { switch ($articleInfo['type']) { case 'content': $mlink = $mobileConfig['homeUrl'] . '/article/' . $articleInfo['id']; break; case 'storeContent': $mlink = $mobileConfig['homeUrl'] . '/store/' . $articleInfo['storeid'] . '/article/' . $articleInfo['id']; break; } } else { $mlink = $c->link; } } else { $mlink = $mobileConfig['homeUrl'] . '/article/' . $c->id; } $valueStr = str_replace('[stl.content.mlink]', $mlink, $valueStr); //time $valueStr = str_replace('[stl.content.time]', date($avs['dateFormat'], $c->time), $valueStr); //auto info $autoids = explode(',', $c->autoid); $firstAutoid = 0; if ($autoids) { foreach ($autoids as $autoid) { if (intval($autoid)) { $firstAutoid = $autoid; break; } } } $valueStr = str_replace('[stl.content.autoID]', $firstAutoid, $valueStr); if (intval($c->autograde) == 1) { if (URL_REWRITE) { $valueStr = str_replace('[stl.content.autolink]', CAR_URL_ROOT . '/brand-' . $firstAutoid . '.html', $valueStr); } else { $valueStr = str_replace('[stl.content.autolink]', CAR_URL_ROOT . '/brand.php?id=' . $firstAutoid, $valueStr); } } else { if (URL_REWRITE) { $valueStr = str_replace('[stl.content.autolink]', CAR_URL_ROOT . '/' . $firstAutoid, $valueStr); } else { $valueStr = str_replace('[stl.content.autolink]', CAR_URL_ROOT . '/g3auto.php?id=' . $firstAutoid, $valueStr); } } if ($firstAutoid) { $valueStr = str_replace('[stl.content.autodisplay]', '', $valueStr); } else { $valueStr = str_replace('[stl.content.autodisplay]', ' style="display:none"', $valueStr); } //THIS AUTO if ($firstAutoid) { $autoclassification_db = bpBase::loadModel('autoclassification_model'); $firstAuto = $autoclassification_db->getCfByID($firstAutoid); if ($firstAuto) { $valueStr = str_replace('[stl.content.autoName]', $firstAuto->name, $valueStr); if ($firstAuto->grade == 3) { $valueStr = str_replace('[stl.content.autoAdvantage]', $firstAuto->advantage, $valueStr); $valueStr = str_replace('[stl.content.autoDefect]', $firstAuto->defect, $valueStr); } } } else { $valueStr = str_replace('[stl.content.autoName]', '', $valueStr); $valueStr = str_replace('[stl.content.autoAdvantage]', '', $valueStr); $valueStr = str_replace('[stl.content.autoDefect]', '', $valueStr); } // $returnStr .= $valueStr; } } return $returnStr; }
function __construct() { $this->article_db = bpBase::loadModel('article_model'); //$this->user_db = bpBase::loadModel('user_model'); }
/** * 删除缓存 * @param string $name 缓存名称 * @param array $setting 缓存配置 * @param string $type 缓存类型 * @param string $module 所属模型 * @return bool */ public function delete($name, $setting = '', $type = 'data', $module = ROUTE_MODEL) { $this->get_setting($setting); if (empty($type)) { $type = 'data'; } if (empty($module)) { $module = ROUTE_MODEL; } $filepath = CACHE_PATH . 'caches_' . $module . '/caches_' . $type . '/'; $filename = $name . $this->_setting['suf']; if (file_exists($filepath . $filename)) { if ($module == 'commons' && substr($name, 0, 16) != 'category_content') { $db = bpBase::loadModel('cache_model'); $db->delete(array('filename' => $filename, 'path' => 'caches_' . $module . '/caches_' . $type . '/')); } return @unlink($filepath . $filename) ? true : false; } else { return false; } }
function M($tablename) { return bpBase::loadModel($tablename . '_model'); }
public function foreGroundSignin($userName, $unencryptPw, $nextUrl, $rememberMe = 1) { $systemConfig = loadConfig('system'); $oUserName = $userName; //判断域名是不是ip $hostSections = explode('.', $_SERVER['HTTP_HOST']); //ip $isIP = 0; if (count($hostSections) == 4 && intval($hostSections[3])) { $isIP = 1; } // $sync = 0; $echoStr = ''; $signSuccess = 0; // if ($systemConfig['syncWithUc']) { $ucenterUserName = $userName; if (defined('UCENTER_CHARSET') && UCENTER_CHARSET == 'utf-8') { $ucenterUserName = iconv('gbk', 'utf-8', $ucenterUserName); } $sync = 1; include ABS_PATH . 'uc_client' . DIRECTORY_SEPARATOR . 'client.php'; list($uid, $userName, $password, $email) = uc_user_login($ucenterUserName, $unencryptPw); if ($uid > 0) { $ucsynlogin = uc_user_synlogin($uid); $signSuccess = 1; // $echoStr = $ucsynlogin; } } elseif ($systemConfig['syncWithPhpwind']) { $sync = 1; define('AUTOSYSTEM', '1'); include ABS_PATH . 'pw_api.php'; include ABS_PATH . 'uc_client' . DIRECTORY_SEPARATOR . 'uc_client.php'; $logintype = 0; //登陆类型 0,1,2分别为 用户名,uid,邮箱登陆 $pw = md5($unencryptPw); /* 同步登录的返回值 Array { Status:-1 用户名错误,找不到用户;-2 密码错误;-3 邮箱地址重复;1 正常登陆; Uid:用户ID Username:用户名 Synlogin: 同步登陆代码(js) } */ $userArr = uc_user_login($userName, $pw, $checkques = 0, $question = '', $answer = ''); $thisUser = uc_user_get($userName); $email = $thisUser['email']; // $status = $userArr['status']; $uid = $userArr['uid']; $userName = $userArr['username']; if ($status > 0) { //login success $signSuccess = 1; $echoStr = $userArr['synlogin']; } } if (!$sync) { //if not sync with ucenter or phpwind $signSuccess = $this->signin($oUserName, $unencryptPw); $this->uid = $signSuccess; } if ($signSuccess > 0) { //登录成功,设置session和cookies $u = $this->getUserByUsername($oUserName); // if ($u) { $this->uid = $u->uid; $uid = $u->uid; $this->updateIP($u->uid); $_SESSION['autouid'] = $u->uid; session_regenerate_id(); if ($rememberMe) { setcookie('autousername', $oUserName, SYS_TIME + 2592000, '/', DOMAIN_ROOT); if ($isIP) { setcookie('autousername', $oUserName, SYS_TIME + 2592000, '/', $_SERVER['HTTP_HOST']); } } unset($_SESSION['autoAdminUid']); } else { //ucenter或者phpwind上有此用户而系统内没有,注册到系统 $rt = $this->signup($oUserName, $email, $password); $this->uid = $rt; //login setcookie('autousername', $oUserName, SYS_TIME + 2592000, '/', DOMAIN_ROOT); if ($isIP) { setcookie('autousername', $oUserName, SYS_TIME + 2592000, '/', $_SERVER['HTTP_HOST']); } } //next url if (!strlen($nextUrl)) { $nextUrl = '/'; } //检查是不是经销商 $store_db = bpBase::loadModel('store_model'); $storeUserIndependent = 0; //经销商用户是否单独建表存储 if (intval(loadConfig('store', 'storeUserIndependent'))) { $storeUserIndependent = 1; //经销商用户是否单独建表存储 } $isStoreUser = 0; if (!$storeUserIndependent) { $isStoreUser = $store_db->get_one(array('uid' => $uid)); if (!$isStoreUser) { $usedcar_store_db = bpBase::loadModel('usedcar_store_model'); $isStoreUser = $usedcar_store_db->get_one(array('uid' => $uid)); } } if ($isStoreUser) { //如果是经销商 $_SESSION['autostoreuid'] = $u->uid; if (isset($_POST['rememberme'])) { setcookie('autostoreuid', $u->uid, SYS_TIME + 2592000, '/', DOMAIN_ROOT); } } if ($isStoreUser > 0 && AUTO_SKIN == 'ahauto') { //安徽汽车网的经销商用户会自动跳转到经销商控制面板 $nextUrl = '/storeUser.php'; } // if ($sync) { //如果跟其他集成,则输出同步登陆代码 if (defined('UCENTER_CHARSET') && UCENTER_CHARSET == 'utf-8') { $echoStr = iconv('utf-8', 'gbk', $echoStr); } //$successStr='<script>Cookie.write(\'jsusername\',\''.$oUserName.'\',{domain:\''.DOMAIN_ROOT.'\'});</script>'; } else { //$successStr='<script>Cookie.write(\'jsusername\',\''.$oUserName.'\',{domain:\''.DOMAIN_ROOT.'\'});</script>'; //return $signSuccess; } setcookie('jsusername', escape($oUserName), SYS_TIME + 2592000, '/', DOMAIN_ROOT); if ($sync) { echo $echoStr . '<script src="' . JS_URL_ROOT . '/mootools1.3.js"></script> <script src="' . JS_URL_ROOT . '/mootools-more.js"></script>' . $successStr . '<span style="font-size:12px;">' . $oUserName . ',登陆成功,正在跳转</span><script> window.addEvent(\'domready\',function(){ (function(){window.location.href=\'' . $nextUrl . '\';}).delay(2000); }) </script>'; } else { showMessage('登录成功' . $successStr, $nextUrl, 2000, 0, 0); } } else { //登录不成功 if (!isset($_POST['userType'])) { $backUrl = MAIN_URL_ROOT . '/sign.php?oper=signin'; } else { $backUrl = $_SERVER['HTTP_REFERER']; } showMessage('用户名和密码不匹配', $backUrl, 2000, 1, 1); return -1; } }
function __construct() { $this->site_db = bpBase::loadModel('site_model'); }
public function specialChannelsTreeStr() { $specialid = intval($_GET['specialid']); $channel_db = bpBase::loadModel('channel_model'); $channels = $channel_db->select(array('specialid' => $specialid), '*', $limit = '', $order = '`taxis` ASC'); if ($channels) { foreach ($channels as $c) { echo '<div style="padding:0 0 0 48px;"><nobr><img src="image/folder.gif" align="absmiddle" /> <a href="?m=article&c=m_article&a=articles&id=' . $c['id'] . '&site=' . $specialid . '" target="sright">' . $c['name'] . '</a></nobr></div>'; } } else { echo '<div style="padding:0 0 0 48px;">该专题没有栏目</div>'; } }
/** * 根据模板中的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; }
/** * 升级到2013年最新的皮肤 * */ public function update2newskin() { if (!file_exists(ABS_PATH . 'update2new.txt')) { showmessage('请在网站根目录下创建一个文件“update2new.txt”,创建后再刷新该页面'); exit; } $channel_db = bpBase::loadModel('channel_model'); $daodianChannel = $channel_db->get_one(array('cindex' => 'city_newcar')); if (!$daodianChannel) { $channel_db->query("INSERT INTO `moopha_channel` (`name`, `channeltype`, `cindex`, `link`, `externallink`, `des`, `thumb`, `metatitle`, `metakeyword`, `metades`, `thumbwidth`, `thumbheight`, `thumb2width`, `thumb2height`, `thumb3width`, `thumb3height`, `thumb4width`, `thumb4height`, `parentid`, `channeltemplate`, `contenttemplate`, `autotype`, `ex`, `iscity`, `site`, `taxis`, `lastcreate`, `pagesize`, `time`) VALUES('新车到店', 1, 'city_newcar', '', 0, '', '', '', '', '', 132, 72, 0, 0, 0, 0, 0, 0, 1, 4, 38, 'news', 0, 0, 1, 0, 1400000000, 30, 1359275172)"); } // $channel_db->query("UPDATE `moopha_channel` SET `thumbwidth` = '308',`thumbheight` = '237' WHERE `id` =34"); $channel_db->query("UPDATE `moopha_channel` SET `thumbwidth` = '132',`thumbheight` = '72' WHERE `id` =36"); $channel_db->query("UPDATE `moopha_channel` SET `thumb2width` = '368',`thumb2height` = '184' WHERE `parentid` =50"); $channel_db->query("UPDATE `moopha_channel` SET `thumb4width` = '330',`thumb4height` = '180' WHERE `parentid` =1"); $channel_db->query("UPDATE `moopha_channel` SET `thumb2width` = '100',`thumb2height` = '76' WHERE `cindex` ='interview'"); $channel_db->query("UPDATE `moopha_channel` SET `thumb2width` = '220',`thumb2height` = '100' WHERE `cindex` ='changshang'"); $channel_db->query("UPDATE `moopha_channel` SET `thumbwidth` = '120',`thumbheight` = '160' WHERE `cindex` ='photos'"); //ucar $ucarArr = loadConfig('ucar'); $ucarArr['smallThumbWidth'] = 120; $ucarArr['smallThumbHeight'] = 90; $arr = var_export($ucarArr, 1); $str = "<?php\r\n" . "return " . $arr . ";" . "\r\n?>"; file_put_contents(ABS_PATH . 'config' . DIRECTORY_SEPARATOR . 'ucar.config.php', $str); //zuche $zcarArr = loadConfig('carRental'); $zcarArr['smallThumbWidth'] = 120; $zcarArr['smallThumbHeight'] = 90; $arr = var_export($zcarArr, 1); $str = "<?php\r\n" . "return " . $arr . ";" . "\r\n?>"; file_put_contents(ABS_PATH . 'config' . DIRECTORY_SEPARATOR . 'carRental.config.php', $str); // @rename(ABS_PATH . 'cache', ABS_PATH . 'backup' . DIRECTORY_SEPARATOR . 'cache_' . SYS_TIME); @unlink(ABS_PATH . 'update2new.txt'); showmessage('操作完成'); }
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'); } }
function __construct() { parent::__construct(); $this->special_cat_db = bpBase::loadModel('special_cat_model'); $this->special_db = bpBase::loadModel('special_model'); }
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); }
function getValue($str = '', $avs, $csiteID = 0, $thisChannelID = 0, $contentID = 0) { //<stl:***></stl:***> $content = bpBase::loadAppClass('articleObj', 'article', 1); $mobileConfig = loadConfig('mobile'); $articleObj = bpBase::loadAppClass('articleObj', 'article'); $avs['numStart'] = isset($avs['numStart']) ? $avs['numStart'] : 1; if (!$avs['sqlStr']) { $isDynamic = $avs['isDynamic'] == null ? false : $avs['isDynamic']; $site = bpBase::loadAppClass('siteObj', 'site', 1); if ($avs['site']) { $thisSite = $site->getSiteByID($avs['site']); $siteID = intval($avs['site']); } else { $siteID = intval($csiteID); } if ($isDynamic || !isset($avs['sql']) || !strlen($avs['sql']) || $thisChannelID != 0 || $contentID != 0) { $channel = bpBase::loadAppClass('channelObj', 'channel', 1); //properties $num = intval($avs['totalNum']); $start = $avs['startNum'] == null ? 0 : intval($avs['startNum']) - 1; $scope = $avs['scope'] == null ? 'self' : 'children'; $order = $avs['order']; if ($avs['isImage'] == null) { $isImage = 'null'; } else { $isImage = $avs['isImage'] == 'true' ? 1 : 0; } switch ($order) { case null: $order = 'taxis'; break; case 'Hits': $order = 'viewcount'; break; case 'AddDate': $order = 'time'; break; } if ($avs['channelIndex']) { $thisChannel = $channel->getChannelByIndex($avs['channelIndex'], $siteID); $channelID = $thisChannel->id; } elseif ($avs['channelID']) { $channelID = $avs['channelID']; } else { $channelID = $thisChannelID; } } // $returnStr = ''; if (!$isDynamic) { if (isset($avs['sql']) && strlen($avs['sql']) && !$thisChannelID) { $content_db = bpBase::loadModel('article_model'); $avs['sql'] = str_replace('{sysTime}', SYS_TIME, $avs['sql']); $contents = $content_db->get_resultsBySql($avs['sql']); } else { $sql = $this->getSql($avs, $siteID, $thisChannelID); //$content=bpBase::loadAppClass('articleObj','article',1); $content_db = bpBase::loadModel('article_model'); $avs['sql'] = str_replace('{sysTime}', SYS_TIME, $avs['sql']); $contents = $content_db->get_resultsBySql($avs['sql']); //$contents=$content->getContentsByChannelID($channelID,$num,$order,$start,$scope,$isImage); } if ($contents) { $i = 0; $middleStr = parent::getMiddleBody($str, 'contents', $this->gTag); $tags = array('[stl.fullTitle]', '[stl.content.fullTitle]', '[stl.content.author]', '[stl.content.source]', '[stl.content.thumb]', '[stl.content.content]', '[stl.content.autoname]'); foreach ($contents as $c) { $replaces = array($c->title, $c->title, $c->author, $c->source, $c->thumb, $c->content, $c->autoname); $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); if (strlen($c->subtitle)) { //判断是否有副标题 $valueStr = str_replace('[stl.content.subtitle]', mb_substr($c->subtitle, 0, $avs['titleLen'], DB_CHARSET), $valueStr); } else { $valueStr = str_replace('[stl.content.subtitle]', mb_substr($c->title, 0, $avs['titleLen'], DB_CHARSET), $valueStr); } } else { if (strlen($c->subtitle)) { //判断是否有副标题 $valueStr = str_replace(array('[stl.content.title]', '[stl.content.subtitle]'), array($c->title, $c->subtitle), $valueStr); } else { $valueStr = str_replace(array('[stl.content.title]', '[stl.content.subtitle]'), array($c->title, $c->title), $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'] || intval($avs['site']) != $csiteID) { if (!$c->externallink) { if ($i == 0) { $thisSite = $site->getSiteByID($c->site); } if (!$thisSite->url) { $thisSite->url = MAIN_URL_ROOT; } $valueStr = str_replace('[stl.content.link]', $thisSite->url . $c->link, $valueStr); } else { if (substr($c->link, 0, 1) != 'h') { $thisSite = $site->getSiteByID($c->site); $valueStr = str_replace('[stl.content.link]', $thisSite->url . $c->link, $valueStr); } else { $valueStr = str_replace('[stl.content.link]', $c->link, $valueStr); } } } else { $valueStr = str_replace('[stl.content.link]', $c->link, $valueStr); } //手机版链接 if ($c->externallink) { $articleInfo = $articleObj->getLinkInfo($c->link); if ($articleInfo) { switch ($articleInfo['type']) { case 'content': $mlink = $mobileConfig['homeUrl'] . '/article/' . $articleInfo['id']; break; case 'storeContent': $mlink = $mobileConfig['homeUrl'] . '/store/' . $articleInfo['storeid'] . '/article/' . $articleInfo['id']; break; } } else { $mlink = $c->link; } } else { $mlink = $mobileConfig['homeUrl'] . '/article/' . $c->id; } $valueStr = str_replace('[stl.content.mlink]', $mlink, $valueStr); //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); //viewcount $valueStr = str_replace('[stl.content.viewcount]', $c->viewcount, $valueStr); //num $valueStr = str_replace('[stl.content.num]', $i + intval($avs['numStart']), $valueStr); //auto info $autoids = explode(',', $c->autoid); $firstAutoid = 0; if ($autoids) { foreach ($autoids as $autoid) { if (intval($autoid)) { $firstAutoid = $autoid; break; } } } $valueStr = str_replace('[stl.content.autoID]', $firstAutoid, $valueStr); if (intval($c->autograde) == 1) { if (URL_REWRITE) { $valueStr = str_replace('[stl.content.autolink]', CAR_URL_ROOT . '/brand-' . $firstAutoid . '.html', $valueStr); } else { $valueStr = str_replace('[stl.content.autolink]', CAR_URL_ROOT . '/brand.php?id=' . $firstAutoid, $valueStr); } } else { if (URL_REWRITE) { $valueStr = str_replace('[stl.content.autolink]', CAR_URL_ROOT . '/' . $firstAutoid, $valueStr); } else { $valueStr = str_replace('[stl.content.autolink]', CAR_URL_ROOT . '/g3auto.php?id=' . $firstAutoid, $valueStr); } } if ($firstAutoid) { $valueStr = str_replace('[stl.content.autodisplay]', '', $valueStr); } else { $valueStr = str_replace('[stl.content.autodisplay]', ' style="display:none"', $valueStr); } //THIS AUTO if (strExists($valueStr, '[stl.content.auto')) { if ($firstAutoid) { $autoclassification_db = bpBase::loadModel('autoclassification_model'); $firstAuto = $autoclassification_db->getCfByID($firstAutoid); $autoObj = bpBase::loadAppClass('autoObj', 'auto', 1); $smallLogo = $autoObj->getLogo($firstAuto->id, $firstAuto->logo, 's', $firstAuto->grade); $middleLogo = $autoObj->getLogo($firstAuto->id, $firstAuto->logo, 'm', $firstAuto->grade); if ($firstAuto) { $valueStr = str_replace('[stl.content.autoName]', $firstAuto->name, $valueStr); if ($firstAuto->grade == 3) { $valueStr = str_replace('[stl.content.autoAdvantage]', $firstAuto->advantage, $valueStr); $valueStr = str_replace('[stl.content.autoDefect]', $firstAuto->defect, $valueStr); } } else { $valueStr = str_replace('[stl.content.autoName]', '', $valueStr); } if ($c->thumb) { $valueStr = str_replace(array('[stl.content.autoSmallLogo]', '[stl.content.autoMiddleLogo]'), array($c->thumb, $c->thumb), $valueStr); } else { $valueStr = str_replace('[stl.content.autoSmallLogo]', $smallLogo, $valueStr); $valueStr = str_replace('[stl.content.autoMiddleLogo]', $middleLogo, $valueStr); } } else { $valueStr = str_replace('[stl.content.autoName]', '', $valueStr); $valueStr = str_replace('[stl.content.autoAdvantage]', '', $valueStr); $valueStr = str_replace('[stl.content.autoDefect]', '', $valueStr); } } //内容中的经销商信息 if (strExists($valueStr, '[stl.content.store')) { $stag = bpBase::loadAppClass('stag', 'template'); $storeid = $stag->getFirstTagValue($c->content, 'store'); $store_db = bpBase::loadModel('store_model'); $thisStore = $store_db->getStoreByStoreID($storeid); $valueStr = str_replace('[stl.content.storeShortName]', $thisStore->shortname, $valueStr); $valueStr = str_replace('[stl.content.storeName]', $thisStore->name, $valueStr); $valueStr = str_replace('[stl.content.storeLink]', $thisStore->url, $valueStr); } //current class if ($contentID == $c->id) { $valueStr = str_replace('[stl.content.currentItemClass]', $avs['currentItemClass'], $valueStr); } else { $valueStr = str_replace('[stl.content.currentItemClass]', '', $valueStr); } // $returnStr .= $valueStr; $i++; } } return $returnStr; } else { return '<script src="http://' . $_SERVER['HTTP_HOST'] . '/api/moopha_javascript.php?type=contents&channelID=' . $channelID . '&num=' . $num . '&order=' . $order . '&scope=' . $scope . '&isImage=' . $isImage . '&site=' . $siteID . '"></script>'; } } else { //调用论坛帖子等 $returnStr = ''; $content_db = bpBase::loadModel('article_model'); $contents = $content_db->selectBySql($avs['sqlStr']); if ($contents) { $i = 0; $middleStr = parent::getMiddleBody($str, 'contents', $this->gTag); foreach ($contents as $c) { $valueStr = $middleStr; //time $valueStr = str_replace('[stl.content.time]', date($avs['dateFormat'], $c['time']), $valueStr); //num $valueStr = str_replace('[stl.content.num]', $i + intval($avs['numStart']), $valueStr); //替换属性 foreach ($c as $k => $v) { $valueStr = str_replace('[stl.content.' . $k . ']', $v, $valueStr); } // $returnStr .= $valueStr; $i++; } } return $returnStr; } }
function parseFirstLayerTag($templateid, $siteID = 0, $channelID = 0, $contentID = 0, $saveFilePath = '', $tagsArr = array(), $pagination = array('pageSize' => 20, 'totalCount' => 0, 'currentPage' => 1, 'urlPrefix' => '', 'urlSuffix' => ''), $obj = null, $type = '', $onlyTags = array(), $exceptTags = array()) { if ($type == 'channel' && file_exists(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $templateid . '.channel.parsed.tpl.php')) { $templateHtml = file_get_contents(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $templateid . '.channel.parsed.tpl.php'); } else { $templateHtml = file_get_contents(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $templateid . '.parsed.tpl.php'); } // $dir = substr(__FILE__, 0, -7); $i = 0; if (!$tagsArr) { include ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $templateid . '.tags.tpl.php'; } if ($tagsArr) { foreach ($tagsArr as $tag) { $parseThisTag = true; if (count($onlyTags) && !in_array($tag['name'], $onlyTags)) { //如果标签不在限制的解析标签中则不解析 $parseThisTag = false; } if (in_array($tag['name'], $exceptTags)) { $parseThisTag = false; } if ($parseThisTag && bpBase::loadTagClass('tag_' . $tag['name'])) { $thisTagClassName = 'tag_' . $tag['name']; $thisTagClass = bpBase::loadTagClass('tag_' . $tag['name'], 1); $returnStr = $thisTagClass->getValue($tag['string'], $tag['avs'], $siteID, $channelID, $contentID, $pagination, $obj); $templateHtml = str_replace('<tag_' . $tag['name'] . '_' . $i . '/>', $returnStr, $templateHtml); } $i++; } } //保存路径 if (!$saveFilePath) { if ($siteID < 100) { $thisSpecial = ''; $specialIndex = ''; } else { //专题首页 $special_db = bpBase::loadModel('special_model'); $thisSpecial = $special_db->get_one(array('id' => $siteID)); $specialIndex = $thisSpecial['specialindex']; } $tplGPath = $this->createGeneratePath($templateid, $channelID, $contentID, $thisSpecial); $saveFilePath = ABS_PATH . $tplGPath; } //stag if (strExists($templateHtml, '[stl.')) { $stag = bpBase::loadAppClass('stag', 'template'); $templateHtml = $stag->handleStag($templateHtml); } file_put_contents($saveFilePath, $templateHtml); return $templateHtml; }
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); } }
function createSinglePageSelect() { define('STATISTIC_CODE', ''); if (isset($_POST['doSubmit'])) { //选定栏目 $IDStr = ''; if ($_POST['singlePages']) { $comma = ''; foreach ($_POST['singlePages'] as $c) { $IDStr .= $comma . $c; $comma = ','; } } file_put_contents(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . 'singlePages.txt', $IDStr); echo '<script>window.location.href=\'?m=template&c=createHtml&a=createSinglePage&siteid=' . $_GET['siteid'] . '\';</script>'; } else { $template_db = bpBase::loadModel('template_model'); $templates = $template_db->select(array('site' => $_GET['siteid'], 'type' => 4), '*'); $optionStr = ''; if ($templates) { foreach ($templates as $t) { $optionStr .= '<option value="' . $t['id'] . '">' . $t['name'] . '</option>'; } } include $this->showManageTpl('createSinglePageSelect'); } }
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> <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; } }
/** * 根据url判断文章类型,文章id,因为有些文章是外部链接,移动版无法直接读取外部链接 * * @param unknown_type $url */ function getLinkInfo($url) { if (!strExists($url, 'http:') || strExists($url, DOMAIN_ROOT)) { //肯定是站内的 if (strExists($url, 'store/')) { //经销商新闻 $urls = explode('/', $url); $count = count($urls); $id = str_replace('.html', '', $urls[$count - 1]); // $store_content_db = bpBase::loadModel('store_content_model'); $thisContent = $store_content_db->get($id); // return array('type' => 'storeContent', 'id' => $id, 'storeid' => $thisContent->storeid); } else { //普通文章 $urls = explode('/', $url); $count = count($urls); $id = str_replace(array('.html', '.shtml'), '', $urls[$count - 1]); return array('type' => 'content', 'id' => $id); } } else { //站外的地址 return null; } }
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(); } }
function __construct() { $this->update_log_db = bpBase::loadModel('update_log_model'); }