/** * 文章属性调用标签 * * @version $Id: getarcattr.lib.php netman * @package Stourweb.Taglib * @copyright Copyright (c) 2007 - 2011, Stourweb, Inc. * @link http://www.stourweb.com */ function lib_getarcattr(&$ctag, &$refObj) { global $dsql; $attlist = "row|8,limit|0,flag|"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnertext()); $revalue = ''; $kindid = $refObj->Fields['kindid']; $sql = "select * from #@__article_attr where isopen=1 and pid!=0 order by displayorder asc limit {$limit},{$row}"; if ($flag == 'mdd') { $sql = "select a.*,count(b.id) as num from #@__article_attr as a inner join #@__article as b on find_in_set(a.id,b.attrid) where find_in_set({$kindid},b.kindlist) group by a.id limit {$limit},{$row}"; } $dsql->SetQuery($sql); $dsql->Execute(); $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $GLOBALS['autoindex'] = 0; while ($row = $dsql->GetArray()) { if (checkExist($row['id'])) { $destid = isset($GLOBALS['destid']) ? $GLOBALS['destid'] : 0; $py = Helper_Archive::getDestPinyin($destid); $py = !empty($py) ? $py : 'all'; //$row['url'] = $GLOBALS['cfg_cmsurl']."/raiders/search.php?attrid={$row['id']}&destid={$destid}"; $row['url'] = $GLOBALS['cfg_cmsurl'] . "/raiders/" . $py . '-' . $row['id']; $row['title'] = $row['attrname']; $row['number'] = getCount($row['id']); if ($flag == 'mdd') { $row['number'] = $row['num']; } foreach ($ctp->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $ctp->Assign($tagid, $row); } else { if (!empty($row[$ctag->GetName()])) { $ctp->Assign($tagid, $row[$ctag->GetName()]); } } } $revalue .= $ctp->GetResult(); $GLOBALS['autoindex']++; } else { continue; } } return $revalue; }
function getJiaGe($destid) { global $dsql; $sql = "select id,aid,lowerprice as min,highprice as max from #@__line_pricelist where webid=0 order by min"; $arr = $dsql->getAll($sql); foreach ($arr as $row) { $pinyin = Helper_Archive::getDestPinyin($destid); $pinyin = !empty($pinyin) ? $pinyin : $destid; //$url = $GLOBALS['cfg_basehost'].'/lines/'.$pinyin.'/'; $url = $GLOBALS['cfg_cmsurl'] . '/lines/' . $pinyin . '-0-' . $row['aid'] . '-0-0-0'; //$url = $GLOBALS['cfg_cmsurl'].'/lines/search.php?dest_id='.$destid.'&priceid='.$row['aid']; if ($row['min'] != '' && $row['max'] != '' && $row['min'] != 0) { $row['title'] = $row['min'] . '~' . $row['max'] . ''; } else { if ($row['min'] == '' || $row['min'] == 0) { $row['title'] = $row['max'] . '以下'; } else { if ($row['max'] == '') { $row['title'] = $row['min'] . '以上'; } } } $out .= '<a href="' . $url . '" target="_blank">' . $row['title'] . '</a>'; } return $out; }
} if (is_array($row)) { JieBan::updateVisit($row['id']); $memberinfo = Helper_Archive::getMemberInfo($row['memberid']); $row['title'] = JieBan::getJiebanTitle($row); $row['kindnamelist'] = JieBan::getKindnameList($row, '-'); $row['membername'] = $memberinfo['nickname']; $row['memberlitpic'] = $memberinfo['litpic'] ? $memberinfo['litpic'] : $GLOBALS['cfg_templets_skin'] . '/images/member_default.gif'; $row['url'] = $GLOBALS['cfg_cmsurl'] . '/jieban/show_' . $row['id'] . '.html'; $row['attrlist'] = JieBan::getAttrList($row['attrid']); $row['joinnum'] = JieBan::getJoinNumber($row['id']); $row['memo'] = $row['memo'] == 'null' ? '' : $row['memo']; $row['vartime'] = empty($row['vartime']) ? 0 : $row['vartime']; $row['pkname'] = get_par_value($row['kindlist'], $typeid); $row['destid'] = array_remove_value($row['kindlist']); $row['pinyin'] = Helper_Archive::getDestPinyin($row['destid']); $row['kindid'] = $row['destid']; if (!empty($row['lineid'])) { $row['lineinfo'] = JieBan::getLineInfo($row['lineid']); $GLOBALS['condition']['_hasline'] = 1; } //短信状态判断 $msgInfo = Helper_Archive::getDefineMsgInfo2('reg_msgcode'); if ($msgInfo['isopen'] == 1) { $GLOBALS['condition']['_msgcode'] = 1; $row['msgtype'] = 'msg'; } else { $GLOBALS['condition']['_txtcode'] = 1; $row['msgtype'] = 'txt'; } @session_start();
/** * 获得线路条数和访问次数 * * @access private * @return arr */ function getPhotoPage($count, $pageno, $pagesize, $params, $disnum = 5) { if ($count == 0) { return '<div class="nht_box" style="height:200px;width:100%; text-align:center"><img style="margin-top:40px" src="/templets/smore/images/nodata.jpg"></div>'; } $page = ceil($count / $pagesize); $url = "/photos/"; //参数 //foreach($params as $k=>$v) //{ // if(!empty($v)) // $p_str.='&'.$k.'='.$v; //} $pinyin = Helper_Archive::getDestPinyin($params['dest_id']); $pinyin = empty($pinyin) ? 'all' : $pinyin; $url .= $pinyin; $attrid = empty($params['attrid']) ? 0 : $params['attrid']; $url .= '-' . $attrid; $str .= '<div id="page" class="page"> <div class="page_num"> '; //前一页按钮 if ($pageno <= 1) { $str .= '<span class="unprev"></span>'; } else { $pre_pageno = $pageno - 1; $str .= "<a class='prev' href='{$url}-{$pre_pageno}'></a>"; } //计算页起始页和结束页 if ($page >= $disnum) { $pre_num = ceil(($disnum - 1) / 2); $next_num = floor(($disnum - 1) / 2); if ($pre_num >= $pageno) { $start_index = 1; $end_index = $disnum; } else { $start_index = $pageno - $pre_num; $end_index = $pageno + $next_num; } if ($end_index >= $page) { $start_index = $page - $disnum; $end_index = $page; } } else { $start_index = 1; $end_index = $page; } //前置省略页面 if ($start_index > 1) { $str .= '<span class="etc"></span>'; } $start_index = $start_index < 1 ? 1 : $start_index; //实现 for ($i = $start_index; $i <= $end_index; $i++) { if ($pageno == $i) { $str .= "<span class='current'>{$i}</span>"; } else { $burl = $i == 1 ? $url : $url . '-' . $i; $str .= "<a href='{$burl}'> {$i} </a>"; } } //后置省略页面 if ($end_index < $page) { $str .= '<span class="etc"></span>'; } //下一页按钮 if ($pageno == $page) { $str .= '<span class="unnext"></span>'; } else { $next_pageno = $pageno + 1 <= $page ? $pageno + 1 : $page; $str .= "<a href=\"{$url}-{$next_pageno}\" class=\"next\"></a>"; } $str .= "</div></div>"; return $str; }
$destlist = Helper_Archive::getChildDest($dest_id, $typeid); //针对名称搜索 if (isset($dopost) && $dopost == 'searchname') { $where = "where a.title like '%{$searchkey}%'"; $wherecount = "where a.title like '%{$searchkey}%'"; $sql = "select a.* from #@__spot a {$where} order by a.isding desc,a.displayorder asc"; $seoarr['searchkey'] = $searchkey; } //其他栏目URL if (empty($dest_id)) { $dest_url = $GLOBALS['cfg_basehost'] . '/destination/'; $hotel_url = $GLOBALS['cfg_basehost'] . '/hotels/'; $raider_url = $GLOBALS['cfg_basehost'] . '/raiders/'; $photo_url = $GLOBALS['cfg_basehost'] . '/photos/'; } else { $pinyin = Helper_Archive::getDestPinyin($dest_id); $pinyin = !empty($pinyin) ? $pinyin : $dest_id; $dest_url = $GLOBALS['cfg_basehost'] . '/' . $pinyin . '/'; $hotel_url = $GLOBALS['cfg_basehost'] . '/hotels/' . $pinyin . '/'; $raider_url = $GLOBALS['cfg_basehost'] . '/raiders/' . $pinyin . '/'; $photo_url = $GLOBALS['cfg_basehost'] . '/photos/' . $pinyin . '/'; } //当前页数->title里面使用 $seoarr['pageno'] = !empty($pageno) ? '第' . $pageno . '页-' : ""; $pv = new ListView($typeid); $pv->pagesize = 40; //分页条数. $pv->Fields['tagword'] = $tagwords; $pv->SetSql($sql); //seo变量赋值 foreach ($destinfo as $k => $v) {
/** * 获取动态的分页列表(静态) * * @access public * @param string $list_len 列表宽度 * @param string $list_len 列表样式 * @return string */ function GetPageList3($list_len, $listitem = "index,end,pre,next,pageno") { $prepage = $nextpage = ''; $geturl = $hidenform = ''; $prepagenum = $this->pageno - 1; $nextpagenum = $this->pageno + 1; if ($list_len == '' || preg_match("/[^0-9]/", $list_len)) { $list_len = 3; } $totalpage = ceil($this->totalresult / $this->pagesize); if ($this->totalresult == 0) { //return "<li><span class=\"pageinfo\">共 <strong>0</strong>页<strong>".$this->totalresult."</strong>条记录</span></li>\r\n"; $out = '<div class="nht_box" style="height:200px;width:100%; text-align:center"><img style="margin-top:40px" src="' . $GLOBALS['cfg_templets_skin'] . '/images/nodata.jpg"/></div>'; return $out; } $purl = $this->GetCurUrl2(); //当前地址 if (count($this->getValues) > 0) { foreach ($this->getValues as $key => $value) { $value = urlencode($value); $value = !empty($value) ? $value : 0; //为空则赋值默认值0 //特殊判断(目的地) if ($key == 'dest_id') { if ($value != 0) { $py = Helper_Archive::getDestPinyin($value); $py = !empty($py) ? $py : $value; } else { $py = 'all'; } $geturl .= "/" . $py . "-"; } else { $geturl .= "{$value}" . "-"; //静态地址 } $hidenform .= "<input type='hidden' name='{$key}' value='{$value}' />\n"; } //if(array_key_exists('dest_id',$this->getValues)) //{ // $geturl='/'.$geturl'; //} } // $geturl .= "totalresult=".$this->totalresult; //动态地址 if (strpos($geturl, '/') === false) { $geturl = '/' . $geturl; } $purl = $purl . $geturl; $out = ' <p class="page_right"> '; //上一页 if ($this->pageno > 1) { $out .= ' <a class="prev" title="上一页" href="' . $purl . $prepagenum . '">上一页</a>'; } //第一页 if ($totalpage > 1) { if ($this->pageno == 1) { $out .= '<span class="mod_pagenav_count"> <a title="1" href="javascript:void(0);" class="current">1</a> '; } else { $out .= '<span class="mod_pagenav_count"> <a title="1" href="' . $purl . '1" >1</a> '; } } $out .= $totalpage >= 1 ? '' : ''; //是否显示省略号 $out .= $this->pageno - 2 > 2 ? '<span class="point">...</span> ' : ''; //中间数字部分 $list_len = 2; $total_list = $list_len * 2 + 1; if ($this->pageno >= $total_list) { $j = $this->pageno - $list_len; $total_list = $this->pageno + $list_len; if ($total_list > $totalpage) { $total_list = $totalpage - 1; } } else { $j = 2; if ($total_list > $totalpage) { $total_list = $totalpage - 1; } } for ($j; $j <= $total_list; $j++) { if ($j == $this->pageno) { $out .= '<a onclick="return false;" href="javascript:void(0);" class="current">' . $this->pageno . '</a> '; } else { $out .= '<a title="' . $j . '" href="' . $purl . $j . '">' . $j . '</a> '; } } //结尾省略号 if ($totalpage - $currentpage > 2) { $out .= '<span class="point">...</span> '; } //最后一页 if ($totalpage > 1) { if ($this->pageno == $totalpage) { $out .= '<a title="' . $totalpage . '" href="javascript:void" class="current">' . $totalpage . '</a></span> '; } else { $out .= '<a title="' . $totalpage . '" href="' . $purl . $totalpage . '">' . $totalpage . '</a></span> '; } } //下一页 if ($this->pageno < $totalpage) { $out .= '<a class="next" title="下一页" href="' . $purl . $nextpagenum . '">下一页</a>'; } $out .= '</p>'; return $out; }
/** * 调用文章显示数据标签 * * @version $Id: getarclist.lib.php netman * @package Stourweb.Taglib * @copyright Copyright (c) 2007 - 2011, Stourweb, Inc. * @link http://www.stourweb.com */ function lib_getarclist(&$ctag, &$refObj) { global $dsql; include SLINEDATA . "/webinfo.php"; $attlist = "row|8,flag|,type|top,limit|0,haspic|,attrid|0,attrname|"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $webid = empty($sys_webid) ? 0 : $sys_webid; $innertext = trim($ctag->GetInnertext()); $revalue = ''; $basefield = 'a.id,a.aid,a.webid,a.title,a.seotitle,a.shownum,a.content,a.addtime,a.webid,a.attrid,a.litpic as litpic,a.kindlist,a.author'; //是否有图片 $picwhere = !empty($haspic) ? " and (a.litpic is not null and a.litpic!='') and a.ishidden=0 " : ''; $picwhere2 = !empty($haspic) ? " where (a.litpic is not null and a.litpic!='') and a.ishidden=0 " : ''; if ($type == 'mdd') { if ($flag == 'recommend') { $orderby = 'order by case when c.displayorder is null then 9999 end,c.displayorder asc'; } else { if ($flag == 'hot') { $orderby = 'order by case when c.displayorder is null then 9999 end,c.displayorder asc'; } else { if ($flag == 'new') { $orderby = 'order by a.addtime desc'; } else { if ($flag == 'imagehot') { $orderby = " and a.litpic!='' order by case when c.displayorder is null then 9999 end,c.displayorder asc"; } else { $orderby = 'order by case when c.displayorder is null then 9999 end,c.displayorder asc'; } } } } $orderby .= ",a.modtime desc,a.addtime desc"; $sonid = isset($definekind) ? $definekind : $refObj->Fields['kindid']; //这里增加子站的判断 if ($GLOBALS['sys_child_webid'] != 0) { $dest_id = $GLOBALS['sys_child_webid']; } $sonid = $sonid ? $sonid : $dest_id; if (isset($sonid)) { $number = isset($refObj->Fields['shownumber']) ? $refObj->Fields['shownumber'] : $row; //如果模块设置了显示数量则使用. $where = " FIND_IN_SET({$sonid},a.kindlist) and a.ishidden=0 "; $where .= !empty($haspic) ? " and a.litpic is not null" : ''; $sql = "select {$basefield} from #@__article as a left join #@__kindorderlist as c on (c.classid={$sonid} and a.id=c.aid and c.typeid=4) where {$where} {$orderby} limit {$limit},{$number}"; } else { return ''; } } else { if ($type == 'theme') { $themeid = $refObj->Fields['themeid']; if (empty($themeid)) { return ''; } $sql = "select a.* from #@__article a where FIND_IN_SET({$themeid},a.themelist) {$picwhere} order by a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { if ($type == 'pinlun') { $sql = "select a.*,b.id as plid,b.memberid,b.content as plcontent,b.addtime as pltime from #@__article a inner join #@__comment b on (a.id = b.articleid) order by b.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'specical') { $sql = "select {$basefield} from #@__article a where ishidden=0 and isindex =1 {$picwhere} order by modtime desc,addtime desc limit {$limit},{$row}"; } else { if ($flag == 'recommend') { $sql = "select {$basefield},b.isjian,b.isding as isding,b.displayorder from #@__article a left join #@__allorderlist b on (a.id=b.aid and b.typeid=4) {$picwhere2} order by case when b.displayorder is null then 9999 end,b.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'kindrecommend') { $kid = $refObj->Fields['kid']; $sql = "select {$basefield} from #@__article a where a.ishidden=0 and FIND_IN_SET({$kid},a.kindlist) {$picwhere} order by a.displayorder asc, a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'isindex') { $sql = "select {$basefield} from #@__article a where a.isindex=1 {$picwhere} order by a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'new') { $sql = "select {$basefield} from #@__article a {$picwhere2} order by a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'hot') { $sql = "select {$basefield} from #@__article a where a.webid IS NOT NULL {$picwhere} order by a.shownum desc,a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'photo') { $sql = "select {$basefield} from #@__article a where webid IS NOT NULL and a.litpic !='' {$picwhere} order by a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'jieban') { $getsql = "select id from #@__article_attr where aid=0 and webid=0"; $arr = $dsql->GetOne($getsql); $jiebanid = $arr['id']; //获取id $sql = "select {$basefield},b.isding,b.displayorder,b.isjian from #@__article a left join #@__attrorderlist b on a.aid=b.aid and a.webid=b.webid where FIND_IN_SET({$jiebanid},a.attrid) {$picwhere} order by b.displayorder asc, a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'relative') { $kindlist = $refObj->Fields['kindlist']; $maxkindid = array_remove_value($kindlist); //最后一级. $destid = $GLOBALS['dest_id']; if (empty($destid)) { $maxkindid = array_remove_value($kindlist); //最后一级. $maxkindid = empty($maxkindid) ? 0 : $maxkindid; } else { $maxkindid = $destid; } $where = " FIND_IN_SET({$maxkindid},a.kindlist) "; //排序顺序:置顶+tag关联》排序+ tag关联》最新更新+tag关联 $sql = "select a.* from #@__article a left join #@__kindorderlist b on (a.id=b.aid and b.typeid=4 and b.classid='{$maxkindid}') where {$where} order by ifnull(b.displayorder,9999) asc,a.modtime desc,a.addtime desc limit {$limit},{$row} "; } else { if ($flag == 'attr') { $attrid = $refObj->Fields['attrid']; $sql = "select a.* from #@__article a where FIND_IN_SET({$attrid},a.attrid) and a.ishidden=0 order by a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'byattr') { if (!empty($attrid)) { $where = " (find_in_set({$attrid},a.attrid)" . loc_getsubattrid($attrid) . ')'; $sql = "select a.* from #@__article a left join #@__attrorderlist b on a.aid=b.aid and a.webid=b.webid where {$where} {$picwhere} order by b.displayorder asc, a.modtime desc,a.modtime desc limit {$limit},{$row}"; } else { if (!empty($attrname)) { $temp_one = $dsql->GetOne("select id from #@__article_attr where attrname='{$attrname}'"); if (empty($temp_one)) { return; } else { $sql = "select a.* from #@__article a where FIND_IN_SET({$temp_one['id']},a.attrid) and a.ishidden=0 order by a.modtime desc,a.modtime desc limit {$limit},{$row}"; } } } } else { return ''; } } } } } } } } } } } } } } $dsql->SetQuery($sql); $dsql->Execute(); $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $GLOBALS['autoindex'] = 0; while ($row = $dsql->GetArray()) { $GLOBALS['autoindex']++; $webroot = GetWebURLByWebid($row['webid']); $sonid = $refObj->Fields['sonid']; $row['url'] = $webroot . "/raiders/show_{$row['aid']}.html"; $row['haspic'] = empty($row['litpic']) ? 0 : 1; $litpic = getUploadFileUrl($row['litpic']); $row['lit240'] = getUploadFileUrl(str_replace('litimg', 'lit240', $row['litpic'])); $row['lit160'] = getUploadFileUrl(str_replace('litimg', 'lit160', $row['litpic'])); $row['litpic'] = $litpic; if ($row['allow'] == "usecontentpic" && !empty($row['litpic'])) { $row['imgtitle'] = $row['title'] . '<img src="' . $GLOBALS['cfg_templets_skin'] . '/images/gl_yt.gif" />'; } else { $row['imgtitle'] = $row['title']; } $row['title'] = $row['title']; $row['attrname'] = getAttrname($row['attrid']); $row['attrnamearr'] = getAttrname($row['attrid'], true); $row['destname'] = Helper_Archive::getBelongDestName($row['kindlist']); //所属目的地 $row['destid'] = array_remove_value($row['kindlist']); $row['pinyin'] = Helper_Archive::getDestPinyin($row['destid']); //最新评论及评论数量 $row['commentnum'] = Helper_Archive::getCommentNum($row['id'], 4); if ($type == 'pinlun') { $userinfo = $GLOBALS['User']->getInfoByMid($row['memberid']); $row['commentlitpic'] = getUploadFileUrl($userinfo['litpic']); $row['commentnickname'] = empty($userinfo['nickname']) ? '匿名' : $userinfo['nickname']; $row['commentid'] = $row['plid']; $row['commentcontent'] = $row['plcontent']; $row['commentaddtime'] = $row['pltime']; } //攻略首页读取评论 if ($type == 'pinlun') { $row['pinlun'] = getArticlePinLun($row['id']); } foreach ($ctp->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $ctp->Assign($tagid, $row); } else { if (isset($row[$ctag->GetName()])) { $ctp->Assign($tagid, $row[$ctag->GetName()]); } } } $revalue .= $ctp->GetResult(); } return $revalue; }
$url = $cfg_basehost . "/{$type}/{$py}/"; head301($url); } if ($type != 'raiders') { $url = $cfg_basehost . "/{$type}/{$destid}/"; head301($url); } $destpy = $destid; //拼音赋值 $kindid = $destid = getDestIdByPy($destpy); //获取目的地ID if (empty($type)) { exit('Error!'); } $arr = array('lines' => '1', 'hotels' => '2', 'cars' => '3', 'raiders' => '4', 'spots' => '5', 'photos' => '6'); $destyp = Helper_Archive::getDestPinyin($destid); $typedd = array("1" => "line", "2" => "hotel", "3" => "car", "4" => "article", 5 => "spot", 6 => "photo"); $typeid = $arr[$type]; $pv = new View($typeid); getTopNavDest($destid); //目的地导航信息 $row = getKindSeo($destid, $type); //获取seo信息. $g_arr = importAutoTitle($type, $row); //导入智能标题. if (empty($row['seotitle'])) { $row['seotitle'] = !empty($g_arr[0]) ? $g_arr[0] : $row['kindname']; } if (empty($row['description'])) { $row['seodescription'] = !empty($g_arr[1]) ? "<meta name=\"description\" content=\"" . $g_arr[1] . "\"/>" : ''; } else {