function lib_getcarbygroup(&$ctag, &$refObj) { global $dsql, $sys_webid; $attlist = "row|8,flag|0,limit|0"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = $ctag->GetInnerText(); $dtp2 = new STTagParse(); $dtp2->SetNameSpace('field', '[', ']'); $dtp2->LoadSource($innertext); //加目的地页面显示条件 if ($flag == 'bystyle') { $styleid = $refObj->Fields['styleid']; $sqlstr = "select * from sline_car where carkindid='{$styleid}' limit {$limit},{$row}"; } if (empty($sqlstr)) { return ''; } $dsql->SetQuery($sqlstr); $dsql->Execute(); $totalRow = $dsql->GetTotalRow(); $likeType = ''; $GLOBALS['autoindex'] = 0; //?? for ($i = 0; $i < $totalRow; $i++) { $GLOBALS['autoindex']++; if ($tablerow = $dsql->GetArray()) { $url = GetWebURLByWebid($tablerow['webid']); $tablerow['url'] = $url . "/cars/show_{$tablerow['aid']}.html"; $tablerow['title'] = $tablerow['title']; $tablerow['lit240'] = getUploadFileUrl(str_replace('litimg', 'lit240', $tablerow['litpic'])); $tablerow['lit160'] = getUploadFileUrl(str_replace('litimg', 'lit160', $tablerow['litpic'])); $tablerow['litpic'] = getUploadFileUrl($tablerow['litpic']); $real = getCarNewRealPrice($tablerow['aid'], $tablerow['webid']); $tablerow['minprice'] = $real ? $real : $tablerow['minprice']; $tablerow['sellprice'] = $real ? $real : 0; $tablerow['price'] = empty($tablerow['minprice']) ? '电询' : $tablerow['minprice']; $tablerow['price2'] = empty($tablerow['minprice']) ? '电询' : '<span>¥</span><strong>' . $tablerow['minprice'] . '</strong><i>起</i>'; //目的地页面用 if (is_array($dtp2->CTags)) { foreach ($dtp2->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $dtp2->Assign($tagid, $tablerow); } else { $value = empty($tablerow[$ctag->GetName()]) ? '' : $tablerow[$ctag->GetName()]; $dtp2->Assign($tagid, $value); } } } $likeType .= $dtp2->GetResult(); } } //Loop for $i $dsql->FreeResult(); //print_r($likeType); return $likeType; }
function getLitPicHtml($row) { $litpic = $row['litpic']; $url = getSearchUrl($row); if (!empty($litpic)) { $litpic = getUploadFileUrl(str_replace('litpic', 'lit240', $litpic)); $out = '<li class="li_img"><a href="' . $url . '" target="_blank"><img src="' . $litpic . '" width="118" height="90" /></a></li>'; } return $out; }
function getLineList($arr) { global $dsql; $out = array(); $arr = array_reverse($arr); foreach ($arr as $v) { $sql = "select *,litpic,price as price from #@__line where id = {$v['id']}"; $row = $dsql->GetOne($sql); $out[] = array('title' => $row['title'], 'url' => $GLOBALS['cfg_cmsurl'] . '/lines/show_' . $row['aid'] . ".html", 'price' => $row['price'], 'litpic' => empty($row['litpic']) ? getUploadFileUrl($row['litpic']) : $GLOBALS['cfg_cmsurl'] . $row['litpic'], 'time' => formatViewTime($v['time'])); } return $out; }
function getChildHtml($kindid) { global $dsql; $orderby = ' order by c.isjian desc,case when c.displayorder is null then 9999 end,c.displayorder asc'; $where = "where FIND_IN_SET({$kindid},a.kindlist) {$orderby} limit 0,4"; $sql = "select a.* from #@__spot as a left join #@__kindorderlist as c on (c.classid={$kindid} and a.id=c.aid and c.typeid=5) {$where}"; $result = $dsql->getAll($sql); foreach ($result as $re) { $webroot = GetWebURLByWebid($re['webid']); $litpic = getUploadFileUrl($re['litpic']); $str .= '<a href="' . $webroot . '/spots/show_' . $re['aid'] . '.html"><img src="' . $litpic . '" alt="' . $re['title'] . '" width="140" height="90" /></a>'; } return $str; }
function lib_getvisalist(&$ctag, &$refObj) { global $dsql; include SLINEDATA . "/webinfo.php"; //导入网站id $attlist = "row|5,type|area,limit|0"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); if ($type == 'area') { $areaid = isset($refObj->Fields['kindid']) ? $refObj->Fields['kindid'] : 0; if ($areaid != 0) { $where = "where a.areaid='{$areaid}'"; } } else { if ($type == 'nation') { $nationid = isset($refObj->Fields['kindid']) ? $refObj->Fields['kindid'] : 0; $where = "where a.nationid='{$nationid}'"; } } $sql = "select a.* from #@__visa a left join #@__allorderlist b on (a.id=b.aid and b.typeid=8) {$where} order by case when b.displayorder is null then 9999 end,b.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row}"; $innertext = trim($ctag->GetInnertext()); $dsql->SetQuery($sql); $dsql->Execute(); $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $GLOBALS['autoindex'] = 0; $revalue = ''; while ($row = $dsql->GetArray()) { $GLOBALS['autoindex']++; $row['url'] = "{$GLOBALS['cfg_cmsurl']}/visa/show_{$row['aid']}.html"; $row['letter'] = $row['needletter'] == 1 ? '需要' : '不需要'; $row['interview'] = $row['needinterview'] == 1 ? '需要' : '不需要'; $row['visatype'] = getVisaTypeName($row['visatype']); $row['litpic'] = getUploadFileUrl($row['litpic']); 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(); } return $revalue; }
function lib_getchildcomment(&$ctag, &$refObj) { global $dsql; $attlist = "row|8,typeid|,groupname|"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnertext()); $revalue = ''; $commentid = $refObj->Fields['commentid']; $articleid = $refObj->Fields['articleid']; if (empty($commentid)) { return ''; } $sql = "select * from #@__comment where dockid='{$commentid}' and isshow=1 order by addtime asc"; $dsql->SetQuery($sql); $dsql->Execute(); $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $GLOBALS['autoindex'] = 0; while ($row = $dsql->GetArray()) { $userinfo = $GLOBALS['User']->getInfoByMid($row['memberid']); $row['litpic'] = $userinfo['litpic'] ? $userinfo['litpic'] : '/templets/smore/images/member_default.gif'; $row['nickname'] = empty($userinfo['nick']) ? '匿名' : $userinfo['nickname']; $replymember = loc_getCommentMemberInfo($row['pid']); $row['replylitpic'] = getUploadFileUrl($replymember['litpic']); $row['replynickname'] = empty($replymember['nickname']) ? '匿名' : $replymember['nickname']; $row['replymemberid'] = $replymember['id']; $row['articleid'] = $articleid; 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']++; } return $revalue; }
function getPiclistArr($piclist) { $picarr = explode(',', $piclist); $biglist = $thumblist = array(); foreach ($picarr as $value) { if (empty($value)) { continue; } $temparr = explode('||', $value); $biglist[] = array('url' => getUploadFileUrl(str_replace('litimg', 'allimg', $temparr[0])), 'title' => $temparr[1]); //大图 $thumbpic = array('url' => getUploadFileUrl(str_replace('litimg', 'lit160', $temparr[0])), 'title' => $temparr[1]); //$biglist[] =array('big'=>getUploadFileUrl(str_replace('litimg','allimg',$temparr[0])));//大图 //$thumbpic= array('thumb'=>getUploadFileUrl(str_replace('litimg','lit160',$temparr[0]))); $thumblist[] = $thumbpic; //小图 } //return array($biglist,$thumblist); return array('big' => $biglist, 'thumb' => $thumblist); }
} if ($dopost == 'uploadfacepage') { $pv->SetTemplet(MEMBERTEMPLET . "uploadface.htm"); $pv->Display(); exit; } /*----------------------------- //用户资料设置 ------------------------------*/ if ($dopost == 'userinfo') { $userinfo = $User->getInfoByMid($uid); $pagename = $dopost; //当前页面,用于左侧导航选中 $pv->Fields['pagename'] = $pagename; $userinfo['face'] = getUploadFileUrl($userinfo['litpic']); $GLOBALS['condition']['_regphone'] = $userinfo['regtype'] == 0 ? 1 : 0; $GLOBALS['condition']['_regemail'] = $userinfo['regtype'] == 1 ? 1 : 0; foreach ($userinfo as $key => $value) { $pv->Fields[$key] = $value; } $pv->SetTemplet(MEMBERTEMPLET . "userinfo.htm"); $pv->Display(); exit; } /*----------------------------- //保存用户资料设置 ------------------------------*/ if ($dopost == 'saveuserinfo') { helper_archive::loadmodule('common');
function getCarPicList($piclist, $carname = null, $litpic = '') { $_arr = array(); if (!empty($piclist)) { $_arr = explode(',', $piclist); //$litpics=$_arr; $i = 0; foreach ($_arr as $k => $v) { $pic = explode('||', $v); $picture = $pic[0]; $desc = $pic[1] ? $pic[1] : $carname; if ($i < 2) { $p160 = getUploadFileUrl(str_replace('litimg', 'lit160', $picture)); $str160 .= '<dd rel="' . $picture . '" class="thumbpic"><img src="' . $p160 . '" width="105" height="80" alt="' . $desc . '" title="' . $desc . '"></dd>'; } $bigpic = getUploadFileUrl(str_replace('litimg', 'allimg', $picture)); $strbig .= '<a class="bigpics" rel="group" href="' . $bigpic . '">更多</a>'; $i++; } } else { $str160 = $strbig = getUploadFileUrl($litpic); } //$result['litpic']=!empty($_arr[0]) ? getUploadFileUrl($_arr[0]) : getUploadFileUrl($litpic); $result['thumbpic'] = $str160; $result['bigpic'] = $strbig; return $result; }
/** * 获得一个单列的文档列表 * * @access public * @param int $limitstart 限制开始 * @param int $row 行数 * @param string $typname 列表类型 * @param string $innertext 底层模板 * @return string */ function GetArcList($limitstart = 0, $row = 10, $typename = 'lines', $innertext = "") { if ($row == '') { $row = 10; } if ($limitstart == '') { $limitstart = 0; } $innertext = trim($innertext); if ($innertext == '') { return ''; } $this->sql .= " limit {$limitstart},{$row}"; $this->dsql->SetQuery($this->sql); $this->dsql->Execute('al'); $artlist = ''; $this->dtp2->LoadSource($innertext); $GLOBALS['autoindex'] = 0; for ($i = 0; $i < $row; $i++) { if ($row = $this->dsql->GetArray("al")) { $GLOBALS['autoindex']++; //处理一些特殊字段 /* if($row['linepic'] == '') { $row['linepic'] = $GLOBALS['cfg_templets_skin'].'/images/defaultpic.gif'; }*/ $webroot = GetWebURLByWebid($row['webid']); if ($row['webid'] == '0') { $row['url'] = $webroot . "/{$typename}/show_{$row['aid']}.html"; } else { if ($this->TypeID == 4) { $typename = 'raiders'; } $row['url'] = $webroot . "/{$typename}/show_{$row['aid']}.html"; } $row['lit240'] = getUploadFileUrl(str_replace('litimg', 'lit240', $row['litpic'])); $row['lit160'] = getUploadFileUrl(str_replace('litimg', 'lit160', $row['litpic'])); if (is_array($this->dtp2->CTags)) { foreach ($this->dtp2->CTags as $k => $ctag) { if ($ctag->GetName() == 'array') { //传递整个数组,在runphp模式中有特殊作用 $this->dtp2->Assign($k, $row); } else { if (isset($row[$ctag->GetName()])) { $this->dtp2->Assign($k, $row[$ctag->GetName()]); } else { $this->dtp2->Assign($k, ''); } } } } $artlist .= $this->dtp2->GetResult(); } //if hasRow } //Loop Line //echo ($t3-$t2); $this->dsql->FreeResult('al'); return $artlist; }
function lib_getcarlist(&$ctag, &$refObj) { global $dsql, $sys_webid; include SLINEDATA . "/webinfo.php"; $attlist = "row|8,limit|0"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = $ctag->GetInnerText(); $dtp2 = new STTagParse(); $dtp2->SetNameSpace('field', '[', ']'); $dtp2->LoadSource($innertext); //加目的地页面显示条件 $destwhere = isset($refObj->Fields['kindid']) ? "and FIND_IN_SET({$refObj->Fields['kindid']},a.kindlist) " : ''; if ($type == 'mdd') { $pid = $refObj->Fields['kindid']; //这里增加子站的判断 if ($GLOBALS['sys_child_webid'] != 0) { $dest_id = $GLOBALS['sys_child_webid']; } $pid = $pid ? $pid : $dest_id; $sqlstr = "select a.* from sline_car a left join sline_kindorderlist b on (a.id=b.aid and b.typeid=3) where find_in_set({$pid},a.kindlist) order by case when a.displayorder is null then 9999 end asc limit {$limit},{$row}"; } else { if ($type == 'kind') { $kindid = $refObj->Fields['kindid']; $sqlstr = "select distinct a.id, a.*,b.minprice from #@__car a left join(select min(price) as minprice,carid from #@__car_suit group by carid) as b on a.id=b.carid left join #@__kindorderlist as c on (a.id=c.aid and c.typeid=3) where a.carkindid = {$kindid} and a.webid=0 group by a.title order by case when c.displayorder is null then 9999 end,c.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { if ($type == 'theme') { $themeid = $refObj->Fields['themeid']; if (empty($themeid)) { return ''; } $sqlstr = "select a.*,b.minprice,c.kindname as brand,d.kindname as kind from #@__car a left join (select min(price) as minprice,carid from #@__car_suit group by carid) as b on a.id=b.carid left join #@__car_brand c on c.aid=a.carbrandid and a.webid=c.webid left join #@__car_kind d on d.aid=a.carkindid and a.webid=d.webid where a.ishidden=0 and a.webid=0 and FIND_IN_SET({$themeid},a.themelist) order by a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { switch ($flag) { case 'hot': //热门?暂时以istop排序? 查询a结果可以优化 //热门?暂时以istop排序? 查询a结果可以优化 case 'recommend': $sqlstr = "select a.* from #@__car a left join sline_allorderlist b on (a.id=b.aid and b.typeid=3) where a.ishidden=0 and a.webid='{$GLOBALS['sys_child_webid']}' order by ifnull(b.displayorder,9999) asc, a.addtime desc,a.modtime desc limit {$limit},{$row}"; break; case 'listofkind': $pid = $refObj->Fields['sonid']; $getmonth = GetMonthHandle(); $sqlstr = "select a.*,b.minprice from #@__car a left join (select min(price) as minprice,carid from #@__car_suit group by carid) as b on a.id=b.carid where FIND_IN_SET({$pid},kindlist) and a.webid=0 order by a.modtime desc,a.addtime desc limit {$limit},{$row}"; break; case 'relative': $tagword = isset($refObj->Fields['tagword']) ? $refObj->Fields['tagword'] : ''; //获取指定tagword if ($tagword == '') { return ''; } $tagword = explode(",", $tagword); $i = 1; $where = ''; foreach ($tagword as $key => $value) { if ($i == 1) { $where .= "a.tagword like '%{$value}%'"; } else { $where .= "or a.tagword like '%{$value}%'"; } $i++; } $getmonth = GetMonthHandle(); //排序顺序:置顶+tag关联》排序+ tag关联》最新更新+tag关联 $sqlstr = "select a.*,b.minprice,c.kindname as brand,d.kindname as kind from #@__car a left join (select min(price) as minprice,carid from #@__car_suit group by carid) as b on a.id=b.carid left join #@__car_brand c on c.aid=a.carbrandid and c.webid=a.webid left join #@__car_kind d on d.aid=a.carkindid and d.webid=a.webid where {$where} and a.ishidden=0 and a.webid=0 order by a.modtime desc,a.addtime desc limit {$limit},{$row}"; break; } } } } if (empty($sqlstr)) { return ''; } $dsql->SetQuery($sqlstr); $dsql->Execute(); $totalRow = $dsql->GetTotalRow(); $likeType = ''; $GLOBALS['autoindex'] = 0; //?? for ($i = 0; $i < $totalRow; $i++) { $GLOBALS['autoindex']++; if ($tablerow = $dsql->GetArray()) { $url = GetWebURLByWebid($tablerow['webid']); $tablerow['url'] = $url . "/cars/show_{$tablerow['aid']}.html"; $tablerow['title'] = $tablerow['title']; $tablerow['lit240'] = getUploadFileUrl(str_replace('litimg', 'lit240', $tablerow['litpic'])); $tablerow['lit160'] = getUploadFileUrl(str_replace('litimg', 'lit160', $tablerow['litpic'])); $tablerow['litpic'] = getUploadFileUrl($tablerow['litpic']); $real = getCarNewRealPrice($tablerow['aid'], $tablerow['webid']); $tablerow['minprice'] = $real ? $real : $tablerow['minprice']; $tablerow['sellprice'] = $real ? $real : 0; $tablerow['price'] = empty($tablerow['minprice']) ? '电询' : $tablerow['minprice']; $tablerow['price2'] = empty($tablerow['minprice']) ? '电询' : '<span>¥</span><strong>' . $tablerow['minprice'] . '</strong><i>起</i>'; //目的地页面用 if (is_array($dtp2->CTags)) { foreach ($dtp2->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $dtp2->Assign($tagid, $tablerow); } else { $value = empty($tablerow[$ctag->GetName()]) ? '' : $tablerow[$ctag->GetName()]; $dtp2->Assign($tagid, $value); } } } $likeType .= $dtp2->GetResult(); } } //Loop for $i $dsql->FreeResult(); //print_r($likeType); return $likeType; }
$text .= empty($row['roombalance']) ? '' : '(单房差:' . $row['roombalance'] . '元)'; $monthli .= '<option value="' . $day . '" data-price="' . $adultprice . '" data-childprice="' . $childprice . '" data-oldprice="' . $oldprice . '" data-number="' . $row['number'] . '">' . $text . '</option>'; } $out['monthli'] = $monthli; $out['jifen'] = $jifenarr; echo json_encode($out); exit; } //获取行程景点信息,暂用于百度地图信息 if ($dopost == 'getdayspots') { $sql = "select * from #@__line_dayspot where lineid='{$lineid}'"; $arr = $dsql->getAll($sql); $out = array(); foreach ($arr as $key => $row) { $spotinfo = getInfo('#@__spot', "where id='{$row['spotid']}' ", 'id,aid,content,litpic,title,lng,lat'); $spotpic = getUploadFileUrl($spotinfo['litpic']); $linkurl = "/spots/show_" . $spotinfo['aid'] . ".html"; $description = cutstr_html(strip_tags($spotinfo['content']), 100); //景点描述 $outstr = "<div style='width:300px;'>"; $outstr .= "<h4 style='margin:0 0 5px 0;padding:0.2em 0'><a href='" . $linkurl . "' target='_blank'>" . $spotinfo['title'] . "</a></h4>"; $outstr .= "<img style='float:right;margin:4px' id='imgDemo' src='" . $spotpic . "' width='139' height='104' title='" . $spotinfo['title'] . "'/>"; $outstr .= "<p style='margin:0;line-height:1.5;font-size:13px;text-indent:2em'>" . $description . "<a href='" . $linkurl . "' target='_blank'>[<font color='#01aec8'>查看详情</font>]</a></p>"; $outstr .= "</div>"; $out[$key][] = $spotinfo['lng']; $out[$key][] = $spotinfo['lat']; $out[$key][] = $outstr; } echo json_encode($out); exit; }
if (!isset($aid)) { exit('Wrong Id'); } $aid = RemoveXSS($aid); //防止跨站攻击 updateVisit($aid, $typeid); $row = getSpotInfo($aid); if (empty($row['id'])) { head404(); } $webroot = GetWebURLByWebid($row['webid']); //查询所属景点分类 $row['seotitle'] = !empty($row['seotitle']) ? $row['seotitle'] : $row['title']; $row['seodescription'] = !empty($row['description']) ? "<meta name=\"description\" content=\"" . $row['description'] . "\"/>" : ""; $row['seokeyword'] = !empty($row['keyword']) ? "<meta name=\"keywords\" content=\"" . $row['keyword'] . "\"/>" : ""; $row['litpic'] = getUploadFileUrl($row['litpic']); $row['level'] = getSpotAttr($row['attrid'], '等级'); $row['theme'] = getSpotAttr($row['attrid']); $row['price'] = !empty($row['price']) ? "¥{$row['price']}" : '电询'; $row['commenthomeid'] = $row['id']; $row['pkname'] = get_par_value($row['kindlist'], $typeid); $row['typename'] = GetTypeName($typeid); foreach ($row as $k => $v) { $pv->Fields[$k] = $v; } //支付方式 $paytypeArr = explode(',', $GLOBALS['cfg_pay_type']); if (in_array(1, $paytypeArr)) { $GLOBALS['condition']['_haszhifubao'] = 1; } if (in_array(2, $paytypeArr)) {
public static function getLineInfo($lineid) { global $dsql; $out = ''; if (!empty($lineid) && $lineid != 'null') { $sql = "select * from sline_line where id='{$lineid}'"; $row = $dsql->GetOne($sql); $webroot = GetWebURLByWebid($row['webid']); $url = $webroot . '/lines/show_' . $row['aid'] . '.html'; $litpic = getUploadFileUrl($row['litpic']); $price = getLineRealPrice($row['aid'], $row['webid']); $out = ''; $out .= '<dl>'; $out .= '<dt><a class="fl" href="' . $url . '"><img class="fl" src="' . $litpic . '" width="174" height="129" /></a></dt>'; $out .= '<dd>'; $out .= '<span class="tit"><a href="' . $url . '" target="_blank">' . $row['title'] . '</a></span>'; $out .= '<span class="txt">' . $row['sellpoint'] . '</span>'; $out .= '<span class="price">参考价:<em>¥' . $price . '</em>/人</span>'; $out .= '<span class="more-btn"><a href="' . $url . '" target="_blank">查看详情</a></span>'; $out .= '</dd>'; $out .= '</dl>'; } return $out; }
function getRoomPicList($piclist) { $out = ''; $picarr = explode(',', $piclist); $k = 0; foreach ($picarr as $value) { $temparr = explode('||', $value); if (!empty($temparr[0])) { $thumbpic = getUploadFileUrl(str_replace('litimg', 'lit160', $temparr[0])); $out .= '<a rel="group" href="' . $temparr[0] . '"><img src="' . $thumbpic . '" width="90" height="60" alt="' . $temparr[1] . '" title="' . $temparr[1] . '" /></a>'; } } return $out; }
function lib_middlenavlist(&$ctag, &$refObj) { global $dsql; $attlist = "row|5,kindid|,flag|,type|,row|6,readad|1,limit|0,destid|,pid|,leftad|indexleftad,isnav|1,ishot|0"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $typeid = isset($refObj->Fields['typeid']) ? $refObj->Fields['typeid'] : 1; //首页的显示与线路一致. $adflag = ''; if (!empty($flag)) { $tablename = array("1" => "#@__line_kindlist", "2" => "#@__hotel_kindlist", "3" => "#@__car_kindlist", "4" => "#@__article_kindlist", "5" => "#@__spot_kindlist", "6" => "#@__photo_kindlist", "13" => "#@__tuan_kindlist"); if ($flag == 'raider') { $typeid = 4; if ($readad) { $adflag = "IndexRaiderMiddleNavAd"; } } else { if ($flag == 'line') { $typeid = 1; if ($readad) { $adflag = "IndexLineMiddleNav"; } } else { if ($flag == 'hotel') { $typeid = 2; if ($readad) { $adflag = "IndexHotelMiddleNav"; } } else { if ($flag == 'car') { $typeid = 3; } else { if ($flag == 'spot') { $typeid = 5; } else { if ($flag == 'photo') { $typeid = 6; } else { if ($flag == 'tuan') { $typeid = 13; } } } } } } } if (!empty($pid)) { $w = " and a.pid={$pid}"; } $tablename = isset($tablename[$typeid]) ? $tablename[$typeid] : '#@__' . $flag . '_kindlist'; if ($isnav == 1) { $sql = "select a.kindname,b.kindid,b.shownum,a.jieshao,a.pinyin,a.litpic,a.pinyin from #@__destinations as a inner join {$tablename} as b on a.id=b.kindid where b.isnav=1 and a.isopen=1 {$w} order by b.displayorder asc limit {$limit},{$row}"; } else { if ($ishot == 1) { $sql = "select a.kindname,b.kindid,b.shownum,a.jieshao,a.pinyin,a.litpic,a.pinyin from #@__destinations as a inner join {$tablename} as b on a.id=b.kindid where b.ishot=1 and a.isopen=1 {$w} order by b.displayorder asc limit {$limit},{$row}"; } else { $sql = "select a.kindname,b.kindid,b.shownum,a.jieshao,a.pinyin,a.litpic,a.pinyin from #@__destinations as a inner join {$tablename} as b on a.id=b.kindid where a.isopen=1 {$w} order by b.displayorder asc limit {$limit},{$row}"; } } } if ($type == 'gather') { $kindid = isset($refObj->Fields['kindid']) ? $refObj->Fields['kindid'] : 36; if ($destid) { $kindid = $destid; } if (isHasChild($kindid)) { $sql = "select id as kindid,kindname,pinyin,litpic from #@__destinations where pid={$kindid} and isopen=1 order by displayorder asc limit 0,{$row}"; } else { $sql = "select id as kindid,kindname,pinyin,litpic from #@__destinations where id={$kindid} and isopen=1 order by displayorder asc limit 0,{$row}"; } } //首页目的地显示 if ($type == 'index') { $sql = "select a.id as kindid,a.* from #@__destinations a where a.isnav = '1' and a.isopen = 1 order by a.displayorder asc limit {$limit},{$row}"; $adflag = "IndexMiddleAd"; } //$adflag="IndexMiddleAd"; $innertext = trim($ctag->GetInnerText()); $artlist = ''; if ($innertext == '') { return ''; } //获得类别ID总数的信息 $ids = array(); $kindnames = array(); $dsql->SetQuery($sql); $dsql->Execute(); while ($row = $dsql->GetArray()) { //if(Exist($row['kindid'],$typeid)) //{ $ids[] = $row['kindid']; $kindnames[] = $row['kindname']; //获取导航分类名称 $shownumber[] = !empty($row['shownum']) ? $row['shownum'] : 8; $pinyins[] = $row['pinyin']; $litpic[] = getUploadFileUrl($row['litpic']); $jieshao[] = $row['jieshao']; //} //$numbers[]=$row['row'];//显示数量 } //如里子分类不存在则取当前级(聚合页面用) /* if(!isset($ids[0])) { $kindid=$refObj->Fields['kindid']; $kindnames[]=$refObj->Fields['kindname']; $ids[]=$kindid; } */ $GLOBALS['itemindex'] = 0; for ($i = 0; isset($ids[$i]); $i++) { $GLOBALS['itemindex']++; $newinnertext = $innertext; $pv = new View($typeid); $pv->Fields['leftad'] = getMiddleAd($leftad, $i); $pv->Fields['middlead'] = getMiddleAd($adflag, $i); $pv->Fields['kindname'] = $kindnames[$i]; //$pv->Fields['sonid']=$ids[$i]; //$pv->Fields['shownumber']=$numbers[$i]; $pv->Fields['pinyin'] = !empty($pinyins[$i]) ? $pinyins[$i] : $ids[$i]; $pv->Fields['shownum'] = $shownumber[$i]; $pv->Fields['kindid'] = $ids[$i]; $pv->Fields['destid'] = $ids[$i]; $pv->Fields['kindpy'] = $pinyins[$i]; $pv->Fields['jieshao'] = $jieshao[$i]; //$pv->Fields['kindchild']=GetChild($ids[$i],$typeid); $pv->Fields['litpic'] = $litpic[$i]; $pv->SetTemplet($newinnertext, 'string'); $artlist .= $pv->GetResult(); } return $artlist; }
function lib_getlinelist(&$ctag, &$refObj) { global $startcity; global $dsql; include SLINEDATA . "/webinfo.php"; $attlist = "row|8,flag|,type|top,sonid|,limit|0,"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $webid = 0; $innertext = trim($ctag->GetInnertext()); $revalue = ''; $basefield = "a.aid,a.id,a.webid,a.title,a.seotitle,a.sellpoint,a.litpic,a.storeprice,a.price,a.linedate,a.features,a.transport,a.lineday,a.startcity,a.overcity,a.shownum,a.satisfyscore,a.bookcount,a.attrid,a.kindlist,a.color,a.iconlist"; if ($type == 'top' && empty($flag)) { return ''; } //如果调用二级栏目则必须在显示类里指定sonid $limit = !empty($limit) ? $limit : 0; if ($type == 'startcity') { $sql = "select {$basefield} from #@__line as a left join #@__kindorderlist as c on (a.id=c.aid) where a.ishidden=0 and c.typeid=1 and startcity='{$startcity}' and c.classid={$sonid} and FIND_IN_SET({$sonid},a.kindlist) {$orderby} limit {$limit},{$row}"; } if ($type == 'mdd') { if ($flag == 'hot') { $orderby = 'order by case when c.displayorder is null then 9999 end,c.displayorder asc,a.modtime desc,a.addtime desc'; } else { if ($flag == 'recommend') { $orderby = 'order by case when c.displayorder is null then 9999 end,c.displayorder asc,a.modtime desc,a.addtime desc'; } else { if ($flag == 'specical') { $orderby = 'order by case when c.displayorder is null then 9999 end,c.displayorder asc,a.modtime desc,a.addtime desc '; } else { $orderby = 'order by case when c.displayorder is null then 9999 end,c.displayorder asc,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; $shownum = isset($row) ? $row : $refObj->Fields['shownum']; $shownum = empty($shownum) ? 6 : $shownum; if (isset($sonid)) { $number = isset($refObj->Fields['shownumber']) ? $refObj->Fields['shownumber'] : $row; //如果模块设置了显示数量则使用. $sql = "select {$basefield},c.isjian,c.istejia,c.isding from #@__line as a left join #@__kindorderlist as c on (c.classid={$sonid} and a.id=c.aid and c.typeid=1) where a.ishidden=0 and FIND_IN_SET({$sonid},a.kindlist) {$orderby} limit {$limit},{$shownum}"; } else { return ''; } } else { if ($type == 'searchrec') { if ($GLOBALS['childid'] != 0) { $kchild = $GLOBALS['childid']; $sql = "select distinct {$basefield} from #@__line as a left join #@__kindorderlist as c on (c.classid={$kchild} and a.id=c.aid and c.typeid=1) where a.ishidden=0 and c.isjian=1 and FIND_IN_SET({$kchild},a.kindlist) order by case when c.displayorder is null then 9999 end,c.displayorder asc,a.modtime desc,a.addtime desc limit 0,4"; } else { $sql = "select {$basefield} a from #@__line where a.ishidden=0 and a.isjian=1 order by a.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row}"; } } else { if ($type == 'destsearchrec') { if ($GLOBALS['destid'] != 0) { $kchild = $GLOBALS['destid']; $sql = "select {$basefield} from #@__line as a left join #@__kindorderlist as c on (c.classid={$kchild} and a.id=c.aid and c.typeid=1) where a.ishidden=0 and FIND_IN_SET({$kchild},a.kindlist) {$orderby} limit 0,4"; } else { $sql = "select {$basefield} from #@__line a where a.ishidden=0 and a.isjian=1 order by a.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row}"; } } else { if ($type == 'top') { if ($flag == 'recommend') { $sql = "select {$basefield},b.isding,b.istejia,b.displayorder from #@__line as a left join #@__allorderlist b on (a.id=b.aid and b.typeid=1) where a.ishidden=0 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 == 'specical') { $sql = "select {$basefield},b.isding,b.istejia,b.displayorder from #@__line as a left join #@__allorderlist b on (a.id=b.aid and b.typeid=1) where a.ishidden=0 order by b.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'hot') { $sql = "select {$basefield} from #@__line a where a.ishidden=0 order by a.shownum desc,a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'attribute') { if (empty($attrid)) { $attrid = $refObj->Fields['attrid']; } $sql = "select {$basefield} from #@__line a where FIND_IN_SET('{$attrid}',a.attrid) and a.ishidden=0 order by a.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'relative') { $kindlist = $refObj->Fields['kindlist']; $maxkindid = array_remove_value($kindlist); //最后一级. $maxkindid = empty($maxkindid) ? $GLOBALS['dest_id'] : $maxkindid; $maxkindid = empty($maxkindid) ? 0 : $maxkindid; $where = " FIND_IN_SET({$maxkindid},a.kindlist) "; $sql = "select {$basefield} from #@__line a where {$where} and a.ishidden=0 order by a.shownum desc,a.modtime desc,a.addtime desc limit 0,{$row}"; } else { if ($flag == 'listexcept') { $sql = "select aid from #@__line where isjian=1 and a.ishidden=0 order by isjian desc,displayorder asc limit 0,5"; $dsql->Execute("list", $sql); $a = ""; while ($str = $dsql->GetArray("list")) { $a .= $str["aid"] . ","; } $a = substr($a, 0, -1); if (!$a == "") { $a = "and aid not in ({$a})"; } $sql = "select {$basefield} from #@__line a where {$a} order by a.shownum desc limit {$limit},{$row}"; } } } } } } } else { if ($type == 'theme') { $themeid = $refObj->Fields['themeid']; if (empty($themeid)) { return ''; } $sql = "select {$basefield} from #@__line a where a.ishidden=0 and FIND_IN_SET({$themeid},a.themelist) order by a.modtime desc,a.addtime desc limit 0,{$row}"; } else { if ($type = "day") { $dayid = $refObj->Fields['groupid']; if (empty($dayid)) { return ''; } $sql = "select {$basefield} from #@__line a where a.ishidden=0 and a.lineday={$dayid} order by a.modtime desc,a.addtime desc limit 0,{$row}"; } } } } } } $dsql->SetQuery($sql); $dsql->Execute(); $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $GLOBALS['autoindex'] = 0; $num = 0; while ($row = $dsql->GetArray()) { $GLOBALS['autoindex']++; $webroot = GetWebURLByWebid($row['webid']); $url = $webroot . "/lines/show_{$row['aid']}.html"; $row['url'] = $url; $row['bookurl'] = "{$webroot}/lines/booking_{$row['aid']}.html"; $startcity = getStartCityName($row['startcity']); $startcity = !empty($startcity) ? "[{$startcity}出发]" : ''; if (!empty($GLOBALS['cfg_startcity_open'])) { $row['title'] = "{$startcity}{$row['title']}"; } else { $row['title'] = "{$row['title']}"; } $row['startcity'] = $startcity; $row['color'] = !empty($row['color']) ? "color:{$row['color']}" : ''; $real = getLineRealPrice($row['aid'], $row['webid']); $row['lineprice'] = $real ? $real : $row['price']; $row['commentnum'] = Helper_Archive::getCommentNum($row['id'], 1); //评论次数 $row['sellnum'] = Helper_Archive::getSellNum($row['id'], 1); //销售数量 //$row['satisfyscore']=Helper_Archive::getSatisfyScore($row['id'],1); //满意度 //获取后台满意度拼接% $row['satisfyscore'] = !empty($row['satisfyscore']) ? $row['satisfyscore'] . "%" : ""; if (!empty($row['lineprice']) && !empty($row['storeprice'])) { $row['discount'] = abs((int) $row['storeprice'] - (int) $row['price']); } else { $row['discount'] = 0; } $row['price'] = empty($row['lineprice']) ? '<span class="rmb_1">电询</span>' : "<span class='rmb_1'>¥</span><span class='rmb_2'>" . $row['lineprice'] . '</span>'; $row['price2'] = empty($row['lineprice']) ? '<span>电询</span>' : '<span>¥</span><strong>' . $row['lineprice'] . '</strong><i>起</i>'; $row['agentprice'] = intval($row['storeprice']); $row['sellprice'] = empty($row['lineprice']) ? '0' : $row['lineprice']; //没有HTML标识的价格 $row['storeprice'] = !empty($row['storeprice']) ? "<span class=\"rmb_2\">¥</span>" . $row['storeprice'] : "<span class=\"rmb_1\">电询</span>"; $row['lineseries'] = getSeries($row['id'], '01'); //$row['lit240']=getPicByName($row['linepic'],'lit240'); //$row['lit160']=getPicByName($row['linepic'],'lit160'); $row['litpic'] = getUploadFileUrl($row['litpic']); $row['lit240'] = getUploadFileUrl(str_replace('litimg', 'lit240', $row['litpic'])); $row['lit160'] = getUploadFileUrl(str_replace('litimg', 'lit160', $row['litpic'])); $row['jifentprice'] = !empty($row['jifentprice']) ? '¥' . $row['jifentprice'] : '无'; $row['startdate'] = getLine_StartDate($row); //团期 $row['jifentprice'] = MLine::getMinTprice($row['id']); $row['list'] = $num; foreach ($ctp->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $ctp->Assign($tagid, $row); } else { $ctp->Assign($tagid, $row[$ctag->GetName()]); } } $revalue .= $ctp->GetResult(); } return $revalue; }
/** * 调用团购显示数据标签 * * @version $Id: gettuanlist.lib.php netman * @package Stourweb.Taglib * @copyright Copyright (c) 2007 - 2011, Stourweb, Inc. * @link http://www.stourweb.com */ function lib_gettuanlist(&$ctag, &$refObj) { global $dsql; include SLINEDATA . "/webinfo.php"; $attlist = "row|8,flag|,type|top,limit|0,haspic|1,day|"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnertext()); $revalue = ''; $basefield = 'a.*'; $time = time(); if ($type == 'mdd') { if ($flag == 'recommend') { $orderby = 'order by case when c.displayorder is null then 9999 end,c.displayorder asc,a.addtime desc'; } else { if ($flag == 'hot') { $orderby = 'order by case when c.displayorder is null then 9999 end,c.displayorder asc,a.addtime desc'; } else { if ($flag == 'new') { $orderby = 'order by a.addtime desc'; } else { $orderby = 'order by case when c.displayorder is null then 9999 end,c.displayorder asc,a.addtime desc'; } } } if (isset($refObj->Fields['kindid'])) { $sonid = $refObj->Fields['kindid']; $number = isset($refObj->Fields['shownumber']) ? $refObj->Fields['shownumber'] : $row; //如果模块设置了显示数量则使用. $where = "a.ishidden=0 and FIND_IN_SET({$sonid},a.kindlist) and a.endtime>{$time} and a.starttime<={$time}"; $where .= !empty($haspic) ? " and a.litpic is not null" : ''; $sql = "select {$basefield} from #@__tuan 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 == 'daytime') { if (!empty($day)) { $day = date('Y-m-d', strtotime($day)); $day = strtotime($day); $sql = "select {$basefield} from #@__tuan a where a.ishidden=0 and starttime={$day} and endtime!='' order by a.addtime asc,a.endtime asc limit {$limit},{$row}"; } else { $sql = "select {$basefield} from #@__tuan a where a.ishidden=0 and endtime>{$time} and endtime!='' and a.starttime>{$time} order by a.starttime asc,a.addtime desc limit {$limit},{$row}"; } } else { if ($flag == 'recommend') { $sql = "select {$basefield},b.isjian,b.isding as isding,b.displayorder from #@__tuan a left join #@__allorderlist b on (a.id=b.aid and b.typeid=13) where a.ishidden=0 and a.endtime>{$time} order by case when b.displayorder is null then 9999 end,b.displayorder asc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'new') { $sql = "select {$basefield} from #@__tuan a where a.ishidden=0 and endtime>{$time} and endtime!='' and a.starttime<={$time} order by a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'hot') { $sql = "select {$basefield} from #@__tuan a where a.ishidden=0 and endtime>{$time} and endtime!='' and a.starttime<={$time} order by a.shownum desc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'byendtime') { $sql = "select {$basefield} from #@__tuan a where a.ishidden=0 and endtime>{$time} and endtime!='' and a.starttime<={$time} order by a.endtime asc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'photo') { $sql = "select {$basefield} from #@__tuan a where a.ishidden=0 and a.litpic !='' and endtime>{$time} and endtime!='' and a.starttime<={$time} order by a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'nostart') { $sql = "select {$basefield} from #@__tuan a where a.ishidden=0 and endtime>{$time} and endtime!='' and a.starttime>{$time} order by a.starttime asc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'relative') { $kindlist = $refObj->Fields['kindlist']; $maxkindid = get_exist_kind($kindlist); //最后一级. $maxkindid = empty($maxkindid) ? 0 : $maxkindid; $where = " FIND_IN_SET({$maxkindid},a.kindlist) "; //排序顺序:置顶+tag关联》排序+ tag关联》最新更新+tag关联 $sql = "select a.* from #@__tuan a where find_in_set('{$attrid}',a.attrid) where a.ishidden=0 and endtime>{$time} and endtime!='' and a.starttime<={$time} order by a.displayorder asc,a.modtime desc,a.addtime desc limit {$limit},{$row} "; } else { if ($type == 'theme') { $themeid = $refObj->Fields['themeid']; if (empty($themeid)) { return ''; } $sql = "select a.* from #@__tuan a where a.ishidden=0 and FIND_IN_SET({$themeid},a.themelist) and endtime>{$time} and endtime!='' and a.starttime<={$time} order by a.displayorder asc,a.modtime desc,a.addtime 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 . "/tuan/show_{$row['aid']}.html"; $row['litpic'] = getUploadFileUrl($row['litpic']); $row['lit240'] = str_replace('litimg', 'lit240', $row['litpic']); $row['lit160'] = str_replace('litimg', 'lit160', $row['litpic']); $row['attrname'] = getTuanAttrname($row['attrid']); $row['attrnamearr'] = getTuanAttrname($row['attrid'], true); $row['destname'] = Helper_Archive::getBelongDestName($row['kindlist']); //所属目的地 $row['destid'] = array_remove_value($row['kindlist']); $row['discount'] = floor($row['price'] / $row['sellprice'] * 100) / 10; //折扣 $row['booknum'] = Helper_Archive::getSellNum($row['id'], 13) + $row['virtualnum']; $row['satisfyscore'] = Helper_Archive::getSatisfyScore($row['id'], 13); //满意度 $row['price'] = $row['price']; 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; }
/** * 调用酒店数据标签 * * @version $Id: gethotellist.lib.php netman * @package Stourweb.Taglib * @copyright Copyright (c) 2007 - 2011, Stourweb, Inc. * @link http://www.stourweb.com */ function lib_gethotellist(&$ctag, &$refObj) { global $dsql; $attlist = "row|8,flag|,type|top,sonid|,limit|0"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnertext()); $revalue = ''; $basefield = 'a.id,a.sellpoint,a.aid,a.kindlist,a.title,a.address,a.litpic,a.ishidden,a.hotelrankid,a.webid,a.hotelrankid as hotelrankids,a.shownum,a.iconlist'; if ($type == 'top' && empty($flag)) { return ''; } //如果调用二级栏目则必须在显示类里指定sonid $limit = !empty($limit) ? $limit : 0; //加目的地页面显示条件 $destwhere = isset($refObj->Fields['kindid']) ? "and FIND_IN_SET({$refObj->Fields['kindid']},a.kindlist) " : ''; //用于聚合页面 if ($type == 'mdd') { $sonid = $refObj->Fields['kindid']; if ($GLOBALS['sys_child_webid'] != 0) { $dest_id = $GLOBALS['sys_child_webid']; //当前级目的地id. } $sonid = $sonid ? $sonid : $dest_id; if (!isset($sonid)) { return ''; } if ($flag == 'hot') { $orderby = 'order by case when b.displayorder is null then 9999 end,b.displayorder asc'; } else { if ($flag == 'recommend') { $orderby = 'order by case when b.displayorder is null then 9999 end,b.displayorder asc'; } else { if ($flag == 'specical') { $orderby = 'case when b.displayorder is null then 9999 end,b.displayorder asc'; } else { $orderby = 'order by case when b.displayorder is null then 9999 end,b.displayorder asc'; } } } $orderby .= ",a.modtime desc,a.addtime desc"; $where = "FIND_IN_SET({$sonid},a.kindlist)"; $sql = "select {$basefield},b.isding,b.isjian,b.istejia from #@__hotel a left join #@__kindorderlist as b on (a.id=b.aid and b.classid='{$sonid}' and b.typeid='2') where " . $where . " and (a.ishidden='0' or a.ishidden is null){$orderby} limit {$limit},{$row}"; } else { if ($type == 'rank') { if (isset($refObj->Fields['sonid'])) { $sonid = $refObj->Fields['sonid']; $sql = "select a.*,b.hotelrank from #@__hotel a left join #@__hotel_rank b on a.hotelrankid=b.aid where a.webid=0 and a.hotelrankid={$sonid} and a.ishidden='0' order by a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { return ''; } } else { if ($type == 'rankhot') { $sql = "select a.*,b.hotelrank from #@__hotel a left join #@__hotel_rank b on a.hotelrankid=b.aid where a.ishidden='0' order by a.shownum desc limit {$limit},{$row}"; } else { if ($type == 'theme') { $themeid = $refObj->Fields['themeid']; if (empty($themeid)) { return ''; } $sql = "select a.*,b.hotelrank,a.price as price from #@__hotel a left join #@__hotel_rank b on (a.hotelrankid=b.aid and a.webid=b.webid) where a.ishidden='0' and FIND_IN_SET({$themeid},a.themelist) order by a.modtime desc,a.addtime desc,a.shownum desc limit {$limit},{$row}"; } else { if ($type == 'top') { if ($flag == 'recommend') { $sql = "select {$basefield},b.displayorder,b.isding,b.isjian,b.istejia,a.ishidden,a.price from #@__hotel a left join #@__allorderlist b on(a.id=b.aid and b.typeid=2) where a.ishidden='0' 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 == 'special') { $sql = "select {$basefield},b.displayorder,b.isding,b.isjian,b.istejia as istehui,a.ishidden from #@__hotel a left join #@__allorderlist b on(a.id=b.aid and b.typeid=2) 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 == 'hot') { $sql = "select a.*,b.hotelrank,a.price as price from #@__hotel a left join #@__hotel_rank b on (a.hotelrankid=b.aid and a.webid=b.webid) where a.ishidden='0' group by a.title order by a.shownum desc,a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'relative') { $kindlist = $refObj->Fields['kindlist']; $maxkindid = array_remove_value($kindlist); //最后一级. $maxkindid = empty($maxkindid) ? $GLOBALS['dest_id'] : $maxkindid; $maxkindid = empty($maxkindid) ? 0 : $maxkindid; $where = " FIND_IN_SET({$maxkindid},a.kindlist) "; //排序顺序:置顶+tag关联》排序+ tag关联》最新更新+tag关联 $sql = "select a.*,b.hotelrank from #@__hotel a left join #@__hotel_rank b on (a.hotelrankid=b.aid and a.webid=b.webid) where a.ishidden='0' and {$where} order by a.modtime desc,a.addtime 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']++; $urlname = GetPinyin($row['kindname']); $flag != "channel" ? $webroot = GetWebURLByWebid($row['webid']) : ""; $row['url'] = GetWebURLByWebid($row['webid']) . "/hotels/show_{$row['aid']}.html"; $row['title'] = $row['title']; //$row['price']=empty($row['price'])?GetHotelMinPrice($row['webid'],$row['aid']):$row['price']; $row['kindname'] = getHotelKindCity2($row['kindlist']); $row['commentnum'] = Helper_Archive::getCommentNum($row['id'], 2); //评论次数 $row['sellnum'] = Helper_Archive::getSellNum($row['id'], 2) + $row['bookcount']; //销售数量 $row['satisfyscore'] = Helper_Archive::getSatisfyScore($row['id'], 2); //满意度 $row['listingprice'] = getHotelSellPrice2($row['id']); //挂牌价 $row['price'] = Helper_Archive::getHotelMinPrice($row['id']); $row['sellprice'] = empty($row['price']) ? '0' : $row['price']; $row['price2'] = empty($row['price']) ? '电询' : '¥' . $row['price'] . '起'; //样式2 $row['price3'] = empty($row['price']) ? '电询' : '<strong>¥' . $row['price'] . '</strong><span>起</span>'; $row['price4'] = empty($row['price']) ? '电询' : '<span>¥</span><strong>' . $row['price'] . '</strong><i>起</i>'; //目的地页面用 $row['price'] = empty($row['price']) ? '<span class="rmb_1">电询</span>' : "<span class='rmb_1'>¥</span>" . $row['price'] . "<span>起</span>"; $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; $row['typeurl'] = $GLOBALS['cfg_cmsurl'] . "/hotels/{$urlname}_{$row['id']}.html"; 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()]); } else { $ctp->Assign($tagid, ''); } } } $revalue .= $ctp->GetResult(); } return $revalue; }
function getPhotoPictures($id, $thumb = '') { global $dsql; //$id_arr=$dsql->GetOne("select id from #@__photo where $aid=aid and webid=$webid"); $result = $dsql->getAll("select * from #@__photo_picture where pid='{$id}' order by id"); foreach ($result as $k => $v) { $pic = !empty($thumb) ? str_replace('litimg', $thumb, $v['litpic']) : $v['litpic']; $result[$k]['pic'] = getUploadFileUrl($pic); } return $result; }
$destlist = getPhotoChildDest($dest_id); //获取目的地面包屑 $mianbao = getPhotoMianbao($dest_id); //获取结果集 $pagesize = 12; //每页数量 $pageno = empty($pageno) ? 1 : $pageno; //第几页 $offset = ($pageno - 1) * $pagesize; $count = $_photoModule->getCount($where); $photolist = $_photoModule->getAll($where, $tableorder, "{$offset},{$pagesize}", "a.*", $join); $page = getPhotoPage($count, $pageno, $pagesize, array('dest_id' => $dest_id, 'attrid' => $attrid)); //获取分页结果 foreach ($photolist as $k => $v) { $weburl = GetWebURLByWebid($v['webid']); $photolist[$k]['pic'] = getUploadFileUrl(str_replace('litimg', 'allimg', $v['litpic'])); $photolist[$k]['url'] = $weburl . '/photos/show_' . $v['aid'] . '.html'; } $destname = !empty($dest_id) ? Helper_Archive::getDestName($dest_id) : '全部'; foreach ($attrid_arr as $k => $v) { $attrname .= !empty($v) ? getPhotoAttrName($v) . '-' : ''; } $attrname = trim($attrname, '-'); $seotitle = $pageno > 1 ? "第{$pageno}页" : ''; if ((!empty($destname) || !empty($attrname)) && $destname != '全部') { $seotitle .= $attrname; $pv->Fields['seotitle'] .= '-' . $seotitle; } //模板选择 $templet = Helper_Archive::getUseTemplet('photo_index'); //获取使用模板
public static function handlePicture($piclist) { $out = array(); $arr = explode(',', $piclist); foreach ($arr as $row) { $p = explode('||', $row); $out[] = array('desc' => $p[1], 'litpic' => getUploadFileUrl($p[0])); } 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; }
/** * 获取目的地标签 * * @version $Id: getcategory.lib.php netman * @package Stourweb.Taglib * @copyright Copyright (c) 2007 - 2014, Stourweb, Inc. * @link http://www.stourweb.com */ function lib_getdest(&$ctag, &$refObj) { global $dsql, $outlist; include SLINEDATA . "/webinfo.php"; $attlist = "row|8,flag|0,limit|0,item|0,destid|"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); //$destid = empty($destid) ? $GLOBALS['sys_destid'] : $destid;//如果未指定当前目的地id,则获取全局目的地id //if(empty($destid)) return ''; $table_array = array("line" => "#@__line_kindlist", "hotel" => "#@__hotel_kindlist", "car" => "#@__car_kindlist", "article" => "#@__article_kindlist", "spot" => "#@__spot_kindlist", "photo" => "#@__photo_kindlist", "tuan" => "#@__tuan_kindlist"); $innertext = trim($ctag->GetInnertext()); $revalue = ''; $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $table = '#@__destinations'; //获取目的地下级分类(未指定item时); if ($item == '0') { if ($flag == 'top') { $sql = "select a.* from {$table} a where a.pid = '0' and a.isopen=1 order by a.displayorder asc limit {$limit},{$row}"; } if ($flag == 'next') { $parentid = !empty($refObj->Fields['parentid']) ? $refObj->Fields['parentid'] : 0; $parentid = empty($parentid) ? $refObj->Fields['kindid'] : $parentid; $sql = "select a.* from {$table} a where a.pid = '{$parentid}' and a.isopen=1 order by a.displayorder asc limit {$limit},{$row}"; } if ($flag == 'hot') { $sql = "select a.* from {$table} a where a.ishot = 1 and a.isopen = 1 order by a.displayorder asc limit {$limit},{$row}"; } if ($flag == 'mdd_hot') { $parentid = !empty($refObj->Fields['parentid']) ? $refObj->Fields['parentid'] : 0; $parentid = empty($parentid) ? $refObj->Fields['kindid'] : $parentid; $child_list = array(); getChildNode($parentid, $child_list); //获取子级 $child_list_str = implode(',', $child_list); $where = " and id in ({$child_list_str}) "; $sql = "select a.* from {$table} a where a.ishot = 1 and a.isopen = 1 {$where} order by a.displayorder asc limit {$limit},{$row}"; } } else { //普通排序 if ($flag == 0) { $sql = "select a.kindname,a.id,a.pinyin from {$table} a left join {$table_array[$item]} b on a.id=b.kindid where a.isopen=1 order by b.displayorder,a.pinyin asc limit {$limit},{$row}"; } //热门排序 if ($flag == 'hot') { $sql = "select a.kindname,a.id,a.pinyin from {$table} a left join {$table_array[$item]} b on a.id=b.kindid where b.ishot = 1 and a.isopen=1 order by b.ishot desc,b.displayorder,a.pinyin asc limit {$limit},{$row}"; } if ($flag == 'nav') { $sql = "select a.kindname,a.id,a.pinyin,b.* from {$table} a left join {$table_array[$item]} b on a.id=b.kindid where b.isnav = 1 and a.isopen=1 order by b.isnav desc,b.displayorder,a.pinyin asc limit {$limit},{$row}"; } if ($flag == 'next') { $parentid = !empty($refObj->Fields['parentid']) ? $refObj->Fields['parentid'] : 0; $parentid = empty($parentid) ? $refObj->Fields['kindid'] : $parentid; $sql = "select a.kindname,a.id,a.pinyin from {$table} a left join {$table_array[$item]} b on a.id=b.kindid where a.isopen=1 and a.pid={$parentid} order by b.isnav desc,b.displayorder,a.pinyin asc limit {$limit},{$row}"; } if ($flag == 'mdd_hot') { $table = $table_array[$item]; $parentid = !empty($refObj->Fields['parentid']) ? $refObj->Fields['parentid'] : 0; $parentid = empty($parentid) ? $refObj->Fields['kindid'] : $parentid; $child_list = array(); getChildNode($parentid, $child_list); //获取子级 $child_list_str = implode(',', $child_list); $where = " and b.kindid in ({$child_list_str}) "; $sql = "select a.* from #@__destinations a left join {$table} b on(a.id=b.kindid) where b.ishot = 1 {$where} order by b.displayorder asc limit {$limit},{$row}"; } } $rows = null; $rows = $dsql->getAll($sql); $GLOBALS['autoindex'] = 0; foreach ($rows as $row) { $GLOBALS['autoindex']++; $lit = explode('||', $row['litpic']); $litpic = $lit[0]; $row['lit240'] = getUploadFileUrl(str_replace('litimg', 'lit240', $litpic)); //getPicByName($row['litpic'],'lit240'); $row['lit160'] = getUploadFileUrl(str_replace('litimg', 'lit160', $litpic)); $row['litpic'] = getUploadFileUrl($litpic); $row['kindid'] = $row['id']; $row['title'] = $row['kindname']; $row['pinyin'] = !empty($row['pinyin']) ? $row['pinyin'] : $row['id']; $desturl = GetWebURLByWebid(0); $row['url'] = $desturl . '/' . $row['pinyin'] . '/'; 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(); } return $revalue; }
function lib_getspotlist(&$ctag, &$refObj) { global $dsql; include SLINEDATA . "/webinfo.php"; $attlist = "row|8,flag|,type|top,sonid|,limit|0,kindid|"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnertext()); $revalue = ''; $basefield = 'a.aid,a.id,a.title,a.litpic,a.area,a.tagword,a.kindlist,a.webid,a.attrid,a.shownum,a.want,a.went,a.sellpoint,a.iconlist'; if ($type == 'top' && empty($flag)) { return ''; } //如果调用二级栏目则必须在显示类里指定sonid //加目的地页面显示条件 $destwhere = isset($refObj->Fields['kindid']) ? "and FIND_IN_SET({$refObj->Fields['kindid']},kindlist) " : ''; 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 { $orderby = 'order by case when c.displayorder is null then 9999 end,c.displayorder asc'; } } $orderby .= ",a.modtime desc,a.addtime desc"; //这里增加子站的判断 if ($GLOBALS['sys_child_webid'] != 0) { $dest_id = $GLOBALS['sys_child_webid']; } if (!empty($refObj->Fields['kindid']) || $dest_id) { $sonid = $refObj->Fields['kindid']; $sonid = empty($sonid) ? $dest_id : $sonid; $where = "where FIND_IN_SET({$sonid},a.kindlist) {$orderby} limit {$limit},{$row}"; $sql = "select a.* from #@__spot as a left join #@__kindorderlist as c on (c.classid={$sonid} and a.id=c.aid and c.typeid=5) {$where}"; //echo $sql; } else { $sql = "select {$basefield},b.isding as isding,b.isjian,b.displayorder from #@__spot as a left join #@__allorderlist b on (a.id=b.aid and b.typeid=5) 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 ($type == 'aroundspot') { $kindid = array_remove_value($refObj->Fields['kindlist']); $sql = "select * from #@__spot where FIND_IN_SET({$kindid},kindlist) order by modtime desc,addtime desc limit {$limit},{$row}"; } else { if ($type == 'top') { if ($flag == 'recommend') { $sql = "select a.ishidden,{$basefield},b.isding as isding,b.isjian,b.displayorder from #@__spot as a left join #@__allorderlist b on (a.id=b.aid and b.typeid=5) where a.ishidden=0 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 == 'hot') { $sql = "select {$basefield} from #@__spot a where webid is not null {$destwhere} order by a.modtime desc,a.addtime desc,a.shownum desc limit {$limit},{$row}"; } else { if ($flag == 'want') { $sql = "select {$basefield} from #@__spot a where a.webid is not null {$destwhere} order by a.want desc,a.shownum desc limit {$limit},{$row}"; } else { if ($flag == 'went') { $sql = "select {$basefield} from #@__spot a where a.webid is not null {$destwhere} order by a.went desc limit {$limit},{$row}"; } else { if ($flag == 'attr') { $attrid = $refObj->Fields['attrid']; $sql = "select {$basefield} from #@__spot a where FIND_IN_SET({$attrid},a.attrid) order by a.modtime desc,a.addtime desc limit {$limit},{$row}"; } else { if ($flag == 'relative') { $kindlist = $refObj->Fields['kindlist']; $maxkindid = array_remove_value($kindlist); //最后一级. $where = " FIND_IN_SET({$maxkindid},a.kindlist) "; $sql = "select {$basefield} from #@__spot a where {$where} order by a.modtime desc,a.addtime desc,a.shownum desc limit {$limit},{$row}"; } else { return ''; } } } } } } } else { if ($type == 'theme') { $themeid = $refObj->Fields['themeid']; if (empty($themeid)) { return ''; } $sql = "select {$basefield} from #@__spot a where FIND_IN_SET({$themeid},a.themelist) order by a.modtime desc,a.addtime desc limit {$limit},{$row}"; } } } } $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']); $url = $webroot . "/spots/show_{$row['aid']}.html"; $row['url'] = $url; $price = getSpotPrice($row['id']); //本站的价格 $sellprice = getSpotsellPrice($row['id']); //票面价格 $row['title'] = $row['title']; $row['lit240'] = getUploadFileUrl(str_replace('litpic', 'lit240', $row['litpic'])); $row['lit160'] = getUploadFileUrl(str_replace('litpic', 'lit160', $row['litpic'])); $row['litpic'] = getUploadFileUrl($row['litpic']); $row['sellprice'] = $price; $row['oldprice'] = $sellprice; $row['price'] = !empty($price) ? "<b>¥" . $price . "</b>起" : '电询'; $row['price2'] = empty($price) ? '电询' : '<span>¥</span><strong>' . $price . '</strong><i>起</i>'; //目的地页面用 $row['price3'] = $price; $row['satisfyscore'] = Helper_Archive::getSatisfyScore($row['id'], 5); //满意度 foreach ($ctp->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $ctp->Assign($tagid, $row); } else { if (!empty($row[$ctag->GetName()]) || $row[$ctag->GetName()] == '0') { $ctp->Assign($tagid, $row[$ctag->GetName()]); } else { $ctp->Assign($tagid, ''); } } } $revalue .= $ctp->GetResult(); } return $revalue; }
function getSpotPic($spotinfo, $spotid, $webid) { $picarr = explode(',', $spotinfo['piclist']); $url = GetWebURLByWebid($spotinfo['webid']) . '/spots/show_' . $spotinfo['aid'] . '.html'; $k = 1; foreach ($picarr as $pic) { if ($k <= 3) { $p = explode('||', $pic); $picname = !empty($p[1]) ? $p[1] : $spotinfo['title']; //图片名称 $litpic = !empty($p[0]) ? getUploadFileUrl($p[0]) : getUploadFileUrl($spotinfo['litpic']); //图片地址 //array_push($out,array('picname'=>$picname,'litpic'=>$litpic)); $out .= '<li><a class="sl_a1" href="' . $url . '" target="_blank"><img class="fl" src="' . $litpic . '" width="245" height="175" alt="' . $picname . '" title="' . $picname . '" /></a><a class="sl_a2" href="' . $url . '" target="_blank">' . $picname . '</a></li>'; $k++; } } return $out; }
function getArticleNewComment($articleid) { global $dsql; $newcomment = $dsql->GetOne("select * from #@__comment where typeid=4 and articleid={$articleid} and pid=0 order by addtime desc"); $userinfo = $GLOBALS['User']->getInfoByMid($newcomment['memberid']); if (empty($newcomment)) { return ''; } //最新评论及评论数量 $row['commentnum'] = Helper_Archive::getCommentNum($row['id'], 4); $row['commentlitpic'] = getUploadFileUrl($userinfo['litpic']); $row['commentnickname'] = empty($userinfo['nick']) ? '匿名' : $userinfo['nickname']; $row['commentid'] = $newcomment['id']; $row['commentcontent'] = $newcomment['content']; $row['commentaddtime'] = $newcomment['addtime']; return $row; }