/**
  *杂志列表
  *@date 2010-7-21
  *@time 上午09:37:43
  */
 function ls()
 {
     //杂志列表
     $dao = D("Magazines");
     self::all_zine($dao);
     $arc = D("Archives");
     $condition = array();
     $condition = array("showtime" => array('lt', time()));
     $count = $dao->where($condition)->count();
     import("ORG.Util.Page");
     $page = new Page($count, 10);
     $page->config = array('header' => 'Rows', 'prev' => 'Previous', 'next' => 'Next', 'first' => '«', 'last' => '»', 'theme' => ' %nowPage%/%totalPage% %upPage% %downPage% %first%  %prePage%  %linkPage%  %nextPage% %end%');
     $this->assign('showpage', $page->show());
     $page->config = array('header' => '', 'prev' => '<', 'next' => '>', 'first' => '«', 'last' => '»', 'theme' => '%first% %upPage%  %prePage%  %linkPage%  %nextPage% %downPage% %end%');
     $this->assign('showpage_bot', $page->show_img());
     $limit = $page->firstRow . ',' . $page->listRows;
     $ls = $dao->where($condition)->order("id DESC")->limit($limit)->findAll();
     //获得最近两期杂志的相关文章
     $temp = array();
     foreach ($ls as $v) {
         $condition = array();
         $condition['typeid'] = '3001';
         $condition['ismake'] = '1';
         $condition['industry'] = 'vol' . $v['vol'];
         $condition['_string'] = "FIND_IN_SET('p',`flag`) > 0";
         $v['p'] = $arc->where($condition)->order("pubdate DESC")->limit("0,5")->findAll();
         $condition['_string'] = "FIND_IN_SET('f',`flag`) > 0";
         $v['f'] = $arc->where($condition)->order("pubdate DESC")->limit("0,6")->findAll();
         $temp[] = $v;
     }
     $this->assign("list", $temp);
     $this->ads('14', 'list', 0);
     $this->display();
 }
 /**
  *文章列表
  *@date 2010-6-3
  *@time 下午12:06:18
  */
 function ls()
 {
     //文章列表
     $typeid = intval($_GET['id']);
     $arctype = D("Arctype");
     $info = $arctype->where("id={$typeid}")->find();
     $condition = array();
     if ($typeid == '3001') {
         $condition['typeid'] = $typeid;
         if (!empty($_GET['type'])) {
             $condition['itype'] = $_GET['type'];
         }
     } elseif ($info['ispart'] == 1) {
         $small = $arctype->where("reid={$typeid}")->field("id")->findAll();
         $str = '';
         foreach ($small as $v) {
             $str .= $v['id'] . ',';
         }
         $condition['typeid'] = array('IN', trim($str, ','));
     } else {
         $condition['typeid'] = $typeid;
     }
     $condition['ismake'] = '1';
     //信息列表
     $now = time();
     import("ORG.Util.Page");
     $dao = D("Archives");
     //$count=$dao->where("((typeid={$typeid} AND (cid={$this->pcid}) OR cid=0) AND ismake=1) AND (showstart<{$now} AND showend>{$now})")->order("pubdate DESC")->count();
     $count = $dao->where($condition)->order("pubdate DESC")->count();
     $page = new Page($count, 10);
     $page->config = array('header' => 'Rows', 'prev' => 'Previous', 'next' => 'Next', 'first' => '«', 'last' => '»', 'theme' => ' %nowPage%/%totalPage% %upPage% %downPage% %first%  %prePage%  %linkPage%  %nextPage% %end%');
     $this->assign('showpage', $page->show());
     $page->config = array('header' => '', 'prev' => '<', 'next' => '>', 'first' => '«', 'last' => '»', 'theme' => ' %upPage% %downPage% %first%  %prePage%  %linkPage%  %nextPage% %end%');
     $this->assign('showpage_bot', $page->show_img());
     $limit = $page->firstRow . ',' . $page->listRows;
     //$data=$dao->where("((typeid={$typeid} AND cid={$this->pcid}) AND ismake=1) AND (showstart<{$now} AND showend>{$now}))")->order("pubdate DESC")->limit("$limit")->findAll();
     $data = $dao->where($condition)->order("pubdate DESC")->limit("{$limit}")->findAll();
     $this->assign('list', $data);
     //dump($dao->getLastSql());
     //分类信息 导航
     $this->assign('city_type', $this->_get_tree(1000));
     $this->assign('classifieds_type', $this->_get_tree(1));
     //页面信息
     $arctype = D("Arctype");
     $info = $arctype->where("id={$typeid}")->find();
     $this->assign('info', $info);
     $page = array();
     $page['title'] = empty($info['seotitle']) ? $info['typename'] . '  -  BeingfunChina 缤纷中国' : $info['seotitle'] . '  -  BeingfunChina 缤纷中国';
     $page['keywords'] = empty($info['keywords']) ? $info['typename'] : $info['keywords'];
     $page['description'] = empty($info['description']) ? $info['typename'] : $info['description'];
     $this->assign('page', $page);
     if ($info['reid'] != '1000') {
         $reinfo = $arctype->where("id={$info['reid']}")->find();
         $this->assign('reinfo', $reinfo);
     }
     $this->assign('group', $this->_get_group('new', '0,6'));
     $this->display();
 }
 /**
  *群内成员列表
  *@date 2010-6-4
  *@time 下午04:02:01
  */
 function members()
 {
     //群内成员
     $gid = Input::getVar($_GET['gid']);
     $dao = D("Tagspace");
     $count = $dao->where("tagid={$gid}")->count();
     import("ORG.Util.Page");
     $page = new Page($count, 50);
     $page->config = array('header' => 'Rows', 'prev' => 'Previous', 'next' => 'Next', 'first' => '«', 'last' => '»', 'theme' => ' %nowPage%/%totalPage% %upPage% %downPage% %first%  %prePage%  %linkPage%  %nextPage% %end%');
     $this->assign('showpage', $page->show());
     $page->config = array('header' => '', 'prev' => '<', 'next' => '>', 'first' => '«', 'last' => '»', 'theme' => '%first% %upPage%  %prePage%  %linkPage%  %nextPage% %downPage% %end%');
     $this->assign('showpage_bot', $page->show_img());
     $limit = $page->firstRow . ',' . $page->listRows;
     $member = $this->get_gmember($gid, '', $limit);
     $this->assign('member', $member);
     $this->display();
 }
 /**
  *分类信息列表页面
  *@date 2010-4-30
  *@time 下午04:36:24
  */
 function ls()
 {
     //分类信息列表页面
     $this->chk_cid();
     $typeid = intval($_GET['id']);
     $kinfo = '';
     $sql = '';
     $info = array();
     $city_str = "";
     if ($this->pcid) {
         //检查城市或者城市群
         if ($this->pcid > 1000) {
             $kinfo = $this->cgroup[$this->pcid]['name'];
             $this->assign('city_group', $this->cgroup[$this->pcid]['name']);
         } else {
             $kinfo = ' in ' . get_cityname($this->pcid);
         }
     }
     //检查城市或者城市群
     if ($this->pcid == '0') {
         $city_str = "";
     } elseif ($this->pcid < 1000) {
         $city_str = " AND (cid={$this->pcid} or cid='0')";
     } else {
         $city_temp = array('name' => '', 'id' => '');
         foreach ($this->cgroup[$this->pcid]['city'] as $k => $v) {
             $city_temp['id'] .= $k . ',';
             $city_temp['name'] .= $v . ',';
         }
         $city_str = " AND (cid in ({$city_temp['id']}) or cid='0')";
     }
     $typeid = empty($typeid) ? '1' : $typeid;
     if ($typeid == '1' && $_GET['flag'] == 'f') {
         $sql = "`channel` IN (4,5,6,7,8,9) AND (FIND_IN_SET('f',`flag`) > 0) AND ismake=1 {$city_str}";
     } else {
         $arctype = D("Arctype");
         //标题后面附加的城市后缀
         $info = $arctype->where("id={$typeid}")->find();
         $this->ads($info['channeltype'], 'list', '1');
         if ($info['ispart'] == 1) {
             $small = $arctype->where("reid={$typeid}")->field("id")->findAll();
             $str = '';
             foreach ($small as $v) {
                 $str .= $v['id'] . ',';
             }
             $str .= $typeid;
             $str = 'typeid IN (' . trim($str, ',') . ')';
         } else {
             $str = "typeid={$typeid}";
         }
         $sql = "{$str} {$city_str} AND ismake=1";
     }
     $this->assign("cityname", $kinfo);
     //信息列表
     $now = time();
     import("ORG.Util.Page");
     $dao = D("Archives");
     $count = $dao->where($sql)->order("pubdate DESC")->count();
     $page = new Page($count, 10);
     $page->config = array('header' => 'Rows', 'prev' => 'Previous', 'next' => 'Next', 'first' => '«', 'last' => '»', 'theme' => ' %nowPage%/%totalPage% %upPage% %downPage% %first%  %prePage%  %linkPage%  %nextPage% %end%');
     $this->assign('showpage', $page->show());
     $page->config = array('header' => '', 'prev' => '<', 'next' => '>', 'first' => '«', 'last' => '»', 'theme' => '  %first% %upPage%  %prePage%  %linkPage%  %nextPage% %downPage% %end%');
     $this->assign('showpage_bot', $page->show_img());
     $limit = $page->firstRow . ',' . $page->listRows;
     //$data=$dao->where("((typeid={$typeid} AND cid={$this->pcid}) AND ismake=1) AND (showstart<{$now} AND showend>{$now}))")->order("pubdate DESC")->limit("$limit")->findAll();
     $data = $dao->where($sql)->order("pubdate DESC")->limit("{$limit}")->findAll();
     //dump($dao->getLastSql());
     $this->assign('list', $data);
     //页面信息
     $arctype = D("Arctype");
     $info = $arctype->where("id={$typeid}")->find();
     $info['typename'] = $typeid == '1' ? "Featured Classifieds" : $info['typename'];
     $this->assign('info', $info);
     $group = $this->_get_group('new', "0,5");
     $this->assign('group', $group);
     $kinfo .= empty($_GET['p']) ? '' : " page " . $_GET['p'];
     $page = array();
     $page['title'] = empty($info['seotitle']) ? $info['typename'] . ' ' . $kinfo . ' ' . $city_temp['name'] . ' - BeingfunChina 缤纷中国' : $info['seotitle'] . ' ' . $kinfo . ' ' . $city_temp['name'] . ' - BeingfunChina 缤纷中国';
     $page['keywords'] = empty($info['keywords']) ? $info['typename'] . ' ' . $city_temp['name'] : $info['keywords'] . ' ' . $city_temp['name'];
     $page['description'] = empty($info['description']) ? $info['typename'] : $info['description'];
     if ($info['reid'] != '1') {
         $reinfo = $arctype->where("id={$info['reid']}")->find();
         $this->assign('reinfo', $reinfo);
     }
     $this->assign('city_type', $this->_get_tree(1000));
     $this->assign('classifieds_type', $this->_get_tree(1));
     $this->assign('page', $page);
     $this->display();
 }
 /**
  *搜索
  *@date 2010-6-30
  *@time 上午11:32:17
  */
 public function so()
 {
     //搜索
     $key = Input::getVar($_GET['key']);
     if ($key) {
         $this->_so_key($key);
         $ch = Input::getVar($_GET['channel']);
         $pnm = Input::getVar($_GET['pnm']);
         $cid = Input::getVar($_GET['cid']);
         $field = Input::getVar($_GET['field']);
         $order = Input::getVar($_GET['order']);
         $limit_arr = array('a' => '10', 'b' => '20', 'c' => '30', 'd' => '50');
         $order_arr = array('a' => 'id', 'b' => 'pubdate', 'c' => 'showend', 'd' => 'cid');
         $desc_arr = array('a' => " DESC", 'b' => " ASC");
         $channel = array('cityguide' => '2', 'classifieds' => '4,5,6,7,8,9', 'event' => '10', 'biz' => '11', 'art' => "12");
         //$enkey=Input::getVar($_GET['enkey']);
         //条件组合
         $condition = array();
         $condition['ismake'] = "1";
         /*if(empty($key)&&!empty($enkey)){
         			$enkey=mydecode($enkey);
         			$enkey=explode('|-|', $enkey);
         		}*/
         $condition['title'] = array("like", "%{$key}%");
         if (!empty($ch) && array_key_exists($ch, $channel)) {
             if ($ch == 'classifieds') {
                 $condition['channel'] = array("in", $channel[$ch]);
             } else {
                 $condition['channel'] = $channel[$ch];
             }
         }
         if ($cid) {
             if ($cid < 1000) {
                 $condition['cid'] = $cid;
             } else {
                 $city_temp = array('name' => '', 'id' => '');
                 foreach ($this->cgroup[$this->pcid]['city'] as $k => $v) {
                     $city_temp['id'] .= $k . ',';
                     $city_temp['name'] .= $v . ',';
                 }
                 $condition['cid'] = array('in', $city_temp['id']);
             }
         }
         //结果查询
         $dao = D("Archives");
         $cou = $dao->where($condition)->count();
         import("ORG.Util.Page");
         $pnm = array_key_exists($pnm, $limit_arr) ? $limit_arr[$pnm] : 20;
         $page = new Page($cou, $pnm);
         $page->config = array('header' => 'Rows', 'prev' => 'Previous', 'next' => 'Next', 'first' => '«', 'last' => '»', 'theme' => ' %nowPage%/%totalPage% %upPage% %downPage% %first%  %prePage%  %linkPage%  %nextPage% %end%');
         $this->assign('showpage', $page->show());
         $page->config = array('header' => '', 'prev' => '<', 'next' => '>', 'first' => '«', 'last' => '»', 'theme' => '  %first% %upPage%  %prePage%  %linkPage%  %nextPage% %downPage% %end%');
         $this->assign('showpage_bot', $page->show_img());
         $limit = $page->firstRow . ',' . $page->listRows;
         $field = array_key_exists($field, $order_arr) ? $order_arr[$field] : 'pubdate';
         $order = array_key_exists($order, $desc_arr) ? $desc_arr[$order] : " DESC";
         $order = $field . $order;
         $data = $dao->where($condition)->order($order)->limit("{$limit}")->findAll();
         $this->assign("data", $data);
         //dump($dao->getLastSql());
         //结果综合统计
         $count = array();
         $count['all'] = $cou;
         $condition['channel'] = '2';
         $count['cityguide'] = $dao->where($condition)->count();
         $condition['channel'] = array('in', $channel['classifieds']);
         $count['classifieds'] = $dao->where($condition)->count();
         $condition['channel'] = '10';
         $count['event'] = $dao->where($condition)->count();
         $condition['channel'] = '11';
         $count['biz'] = $dao->where($condition)->count();
         $condition['channel'] = '12';
         $count['art'] = $dao->where($condition)->count();
         $this->assign("count", $count);
     }
     $sokey = D("SoKey");
     $hotkey = $sokey->order("hot DESC")->limit("0,10")->findAll();
     $this->assign("hotkey", $hotkey);
     $page = array();
     $page['title'] = 'Search ' . $key . '  -  BeingfunChina 缤纷中国';
     $page['keywords'] = $key;
     $page['description'] = 'Search ' . $key;
     $this->assign('page', $page);
     $this->assign('city_type', $this->_get_tree(1000));
     $this->assign('classifieds_type', $this->_get_tree(1));
     $this->display("Common:so");
 }
 /**
  *分类信息发布的评论
  *@date 2010-5-20
  *@time 下午08:38:54
  */
 function my_comments()
 {
     //分类信息发布的评论
     $this->is_act(1, 2);
     $dao = D("Comment");
     $condition = array();
     $condition['uid'] = $this->user['uid'];
     if ($_REQUEST['types']) {
         $condition['types'] = $_REQUEST['types'];
     } else {
         $condition['types'] = array(array('egt', 4), array('elt', 9));
     }
     import("ORG.Util.Page");
     $count = $dao->where($condition)->order("dateline DESC")->count();
     $page = new Page($count, 25);
     $page->config = array('header' => 'Rows', 'prev' => 'Previous', 'next' => 'Next', 'first' => '«', 'last' => '»', 'theme' => ' %nowPage%/%totalPage% %upPage% %downPage% %first%  %prePage%  %linkPage%  %nextPage% %end%');
     $this->assign('showpage', $page->show());
     $page->config = array('header' => '', 'prev' => '<', 'next' => '>', 'first' => '«', 'last' => '»', 'theme' => ' %upPage% %downPage% %first%  %prePage%  %linkPage%  %nextPage% %end%');
     $this->assign('showpage_bot', $page->show_img());
     $limit = $page->firstRow . ',' . $page->listRows;
     //$data=$dao->where("((typeid={$typeid} AND cid={$this->pcid}) AND ismake=1) AND (showstart<{$now} AND showend>{$now}))")->order("pubdate DESC")->limit("$limit")->findAll();
     $data = $dao->where($condition)->order("dateline DESC")->limit("{$limit}")->findAll();
     $this->assign('list', $data);
     $page = array();
     $page['title'] = 'My Comments -  My Control Panel -  BeingfunChina';
     $page['keywords'] = 'My Comments';
     $page['description'] = 'My Comments';
     $this->assign('page', $page);
     $this->assign('content', 'Cp:my_classifieds_comments');
     $this->display("Cp:layout");
 }
 /**
  * 话题页面
  * @date 2010-6-4
  * @time 下午03:57:52
  */
 function thread()
 {
     //话题页面
     $tid = empty($_REQUEST['id']) ? 0 : intval($_REQUEST['id']);
     $lou = empty($_REQUEST['lou']) ? 0 : intval($_REQUEST['lou']);
     $condition = array();
     if ($tid) {
         $condition['topid'] = $tid;
     }
     if (empty($condition)) {
         $this->error('Wrong parameter.');
     }
     $condition['requery'] = '0';
     $condition['qid'] = '0';
     $pn = 1000;
     $post = D("Post");
     $count = $post->where($condition)->count();
     import("ORG.Util.Page");
     $page = new Page($count, $pn);
     $page->config = array('header' => 'Rows', 'prev' => 'Previous', 'next' => 'Next', 'first' => '«', 'last' => '»', 'theme' => ' %nowPage%/%totalPage% %upPage% %downPage% %first%  %prePage%  %linkPage%  %nextPage% %end%');
     $this->assign('showpage', $page->show());
     $page->config = array('header' => '', 'prev' => '<', 'next' => '>', 'first' => '«', 'last' => '»', 'theme' => '%first% %upPage%  %prePage%  %linkPage%  %nextPage% %downPage% %end%');
     $this->assign('showpage_bot', $page->show_img());
     $limit = $page->firstRow . ',' . $page->listRows;
     if ($lou) {
         $ls = $lou < $pn ? 1 : intval($lou / $pn) * $pn;
         $limit = $ls . ',' . $page->listRows;
     }
     $thread = $post->where($condition)->order("dateline DESC")->limit($limit)->findAll();
     $info = $post->where("id={$tid}")->find();
     $arr = array();
     foreach ($thread as $t) {
         //获取回复
         $arr[$t['id']] = $t;
         $condition['requery'] = $t['id'];
         $arr[$t['id']]['_rarr'] = $post->where("requery={$t['id']} or qid={$t['id']}")->order("dateline DESC")->findAll();
         //dump($post->getLastSql());
     }
     $this->assign('thread', $arr);
     $this->assign('info', $info);
     $ginfo = get_info($info['aid'], '*', 'Archives');
     $this->assign('ginfo', $ginfo);
     $this->assign('dh', $this->_get_dh($ginfo['typeid']));
     $page = array();
     $page['title'] = empty($info['title']) ? 'Events Thread  -  BeingfunChina 缤纷中国' : $info['title'] . '  -  BeingfunChina 缤纷中国';
     $page['keywords'] = empty($info['tags']) ? "Events,Thread" : $info['tags'];
     $page['description'] = empty($info['title']) ? "Events in BeingfunChina" : $info['title'];
     $this->assign('page', $page);
     $this->display();
 }
 /**
  *展会列表
  *@date 2010-5-28
  *@time 下午04:43:02
  */
 function ls()
 {
     //展会列表
     if ($_REQUEST['year']) {
         $_SESSION['year'] = $_REQUEST['year'];
     }
     if ($_REQUEST['id']) {
         if ($_REQUEST['id'] == 'all') {
             unset($_SESSION['fair_id']);
         } else {
             $_SESSION['fair_id'] = $_REQUEST['id'];
         }
     }
     if ($_REQUEST['bycity']) {
         if ($_REQUEST['bycity'] == 'all') {
             unset($_SESSION['bycity']);
         } else {
             $_SESSION['bycity'] = $_REQUEST['bycity'];
         }
     }
     if ($_REQUEST['tn']) {
         $_SESSION['tn'] = $_REQUEST['tn'];
     }
     if ($_REQUEST['order']) {
         $_SESSION['order'] = $_REQUEST['order'];
     } else {
         $_SESSION['order'] = 'DESC';
     }
     if ($_REQUEST['flang']) {
         $_SESSION['flang'] = $_REQUEST['flang'];
     }
     $condition = array();
     $year = array();
     $nowyear = date('Y');
     if ($_SESSION['year']) {
         $this->assign('date', $this->_get_time($_SESSION['year']));
         $year['sy']['name'] = $_SESSION['year'];
         $year['sy']['ms'] = mktime(0, 0, 0, 1, 1, $_SESSION['year']);
         $year['sy']['me'] = mktime(0, 0, 0, 1, 1, $_SESSION['year'] + 1) - 1;
         $year['ny']['name'] = $_SESSION['year'] + 1;
         $year['ny']['ms'] = mktime(0, 0, 0, 1, 1, $_SESSION['year'] + 1);
         $year['ny']['me'] = mktime(0, 0, 0, 1, 1, $_SESSION['year'] + 2) - 1;
         $_SESSION['ms'] = $year['sy']['ms'];
         $_SESSION['me'] = $year['sy']['me'];
     } else {
         $this->assign('date', $this->_get_time());
         $year['sy']['name'] = $nowyear;
         $year['sy']['ms'] = mktime(0, 0, 0, 1, 1, $nowyear);
         $year['sy']['me'] = mktime(0, 0, 0, 1, 1, $nowyear + 1) - 1;
         $year['ny']['name'] = $nowyear + 1;
         $year['ny']['ms'] = mktime(0, 0, 0, 1, 1, $nowyear + 1);
         $year['ny']['me'] = mktime(0, 0, 0, 1, 1, $nowyear + 2) - 1;
     }
     $this->assign('year', $year);
     if ($_REQUEST['ms']) {
         $_SESSION['ms'] = $_REQUEST['ms'];
     }
     if ($_REQUEST['me']) {
         $_SESSION['me'] = $_REQUEST['me'];
     }
     if ($_SESSION['fair_id']) {
         $condition['typeid'] = $_SESSION['fair_id'];
     } else {
         $small = $this->_get_fair();
         $str = '';
         foreach ($small as $v) {
             $str .= $v['id'] . ',';
         }
         $str = trim($str, ',');
         $condition['typeid'] = array('IN', $str);
     }
     if ($_SESSION['bycity']) {
         $condition['bycity'] = $_SESSION['bycity'];
     }
     $condition['industry'] = empty($_SESSION['flang']) ? 'EN' : $_SESSION['flang'];
     if ($_SESSION['ms'] || $_SESSION['me']) {
         $condition['_string'] = "(`showstart`>='{$_SESSION['ms']}' AND `showstart`<='{$_SESSION['me']}') OR (`showend`>='{$_SESSION['ms']}' AND `showend`>='{$_SESSION['me']}')";
     }
     $this->assign('industries', $this->_get_fair());
     $this->assign("city", $this->_get_city('fair'));
     $condition['ismake'] = 1;
     $dao = D("Archives");
     $count = $dao->where($condition)->order("id {$_SESSION['order']}")->count();
     import("ORG.Util.Page");
     $page = new Page($count, 10);
     $page->config = array('header' => 'Rows', 'prev' => 'Previous', 'next' => 'Next', 'first' => '«', 'last' => '»', 'theme' => ' %nowPage%/%totalPage% %upPage% %downPage% %first%  %prePage%  %linkPage%  %nextPage% %end%');
     $this->assign('showpage', $page->show());
     $page->config = array('header' => '', 'prev' => '<', 'next' => '>', 'first' => '«', 'last' => '»', 'theme' => '%first% %upPage%  %prePage%  %linkPage%  %nextPage% %downPage% %end%');
     $this->assign('showpage_bot', $page->show_img());
     $limit = $page->firstRow . ',' . $page->listRows;
     $data = $dao->where($condition)->order("id {$_SESSION['order']}")->limit($limit)->findAll();
     $this->assign('data', $data);
     unset($condition['_string']);
     unset($condition['bycity']);
     $condition['_string'] = "FIND_IN_SET('f',`flag`) > 0";
     $featured = $dao->where($condition)->limit("0,10")->order("edittime DESC")->findAll();
     //dump($dao->getLastSql());
     $this->assign('featured', $featured);
     $arctype = D("Arctype");
     $info = $arctype->where("id={$_SESSION['fair_id']}")->find();
     $this->assign('info', $info);
     $page = array();
     $title = '';
     if ($_SESSION['flang'] == 'CN') {
         $title = $info['seotitle'];
     } else {
         $title = $info['typename'];
     }
     $page['title'] = $title . ' - Fair -  BeingfunChina 缤纷中国';
     $page['keywords'] = empty($info['keywords']) ? $info['typename'] : $info['keywords'];
     $page['description'] = empty($info['description']) ? $info['typename'] : $info['description'];
     if ($info['reid'] != '1232') {
         $reinfo = $arctype->where("id={$info['reid']}")->find();
         $this->assign('reinfo', $reinfo);
     }
     $this->assign('page', $page);
     $this->display();
 }
 /**
  *分类信息列表页面
  *@date 2010-4-30
  *@time 下午04:36:24
  */
 function ls()
 {
     //分类信息列表页面
     $this->chk_cid();
     $typeid = intval($_GET['id']);
     $arctype = D("Arctype");
     $kinfo = '';
     //标题后面附加的城市后缀
     if ($this->pcid) {
         //检查城市或者城市群
         if ($this->pcid > 1000) {
             $kinfo = ' in ' . $this->cgroup[$this->pcid]['name'];
             $this->assign('city_group', $this->cgroup[$this->pcid]['name']);
         } else {
             $kinfo = ' in ' . get_cityname($this->pcid);
         }
         $this->assign("cityname", $kinfo);
     }
     //检查城市或者城市群
     $info = $arctype->where("id={$typeid}")->find();
     $small = $arctype->where("reid={$typeid}")->field("id")->findAll();
     $str = '';
     if ($small) {
         foreach ($small as $v) {
             $str .= $v['id'] . ',';
         }
         $str .= $typeid;
         $str = 'typeid IN (' . trim($str, ',') . ')';
     } else {
         $str = "typeid={$typeid}";
     }
     //信息列表
     $now = time();
     import("ORG.Util.Page");
     $dao = D("Archives");
     //$count=$dao->where("((typeid={$typeid} AND cid={$this->pcid}) AND ismake=1) AND (showstart<{$now} AND showend>{$now})")->order("pubdate DESC")->count();
     if ($info['id'] == '1393' || $info['reid'] == '1393' || $this->pcid == '0' || empty($this->pcid)) {
         $city = '1=1';
     } elseif ($this->pcid < 1000) {
         $city = "(cid={$this->pcid} or cid='0')";
     } else {
         $city_temp = array('name' => '', 'id' => '');
         foreach ($this->cgroup[$this->pcid]['city'] as $k => $v) {
             $city_temp['id'] .= $k . ',';
             $city_temp['name'] .= $v . ',';
         }
         $city = "(cid in ({$city_temp['id']}) or cid='0')";
     }
     $count = $dao->where("({$str} AND {$city}) AND ismake=1")->order("pubdate DESC")->count();
     $page = new Page($count, 10);
     $page->config = array('header' => 'Rows', 'prev' => 'Previous', 'next' => 'Next', 'first' => '«', 'last' => '»', 'theme' => ' %nowPage%/%totalPage% %upPage% %downPage% %first%  %prePage%  %linkPage%  %nextPage% %end%');
     $this->assign('showpage', $page->show());
     $page->config = array('header' => '', 'prev' => '<', 'next' => '>', 'first' => '«', 'last' => '»', 'theme' => '%first% %upPage%  %prePage%  %linkPage%  %nextPage% %downPage% %end%');
     $this->assign('showpage_bot', $page->show_img());
     $limit = $page->firstRow . ',' . $page->listRows;
     //$data=$dao->where("((typeid={$typeid} AND cid={$this->pcid}) AND ismake=1) AND (showstart<{$now} AND showend>{$now}))")->order("pubdate DESC")->limit("$limit")->findAll();
     $data = $dao->where("({$str} AND {$city}) AND ismake=1")->order("edittime DESC, pubdate DESC")->limit("{$limit}")->findAll();
     $this->assign('list', $data);
     //分类信息 导航
     $this->assign('city_type', $this->_get_tree(1000));
     $this->assign('classifieds_type', $this->_get_tree(1));
     //页面信息
     $arctype = D("Arctype");
     $info = $arctype->where("id={$typeid}")->find();
     $this->assign('info', $info);
     $page = array();
     $cityinfo = '';
     if ($this->pcid) {
         $cityinfo = get_cityname($this->pcid) ? ' in ' . get_cityname($this->pcid) : $kinfo;
     }
     $info['keywords'] = rand_arr($info['keywords'], 5);
     $info['keywords'] = $cityinfo ? $cityinfo . ' ' . $info['keywords'] : $info['keywords'];
     $info['keywords'] .= empty($_GET['p']) ? '' : " page " . $_GET['p'];
     $page['title'] = empty($info['seotitle']) ? $info['typename'] . $info['keywords'] . ' - BeingfunChina 缤纷中国' : $info['seotitle'] . $info['keywords'] . ' -  BeingfunChina 缤纷中国';
     $page['keywords'] = empty($info['keywords']) ? $info['typename'] : $info['keywords'];
     $page['description'] = empty($info['description']) ? $info['typename'] : $info['description'];
     $this->assign('page', $page);
     if ($info['reid'] != '1000') {
         $reinfo = $arctype->where("id={$info['reid']}")->find();
         $this->assign('reinfo', $reinfo);
     }
     $this->ads('2', 'list', 0, $typeid);
     if ($this->_is_admin()) {
         $this->assign('admin', true);
     }
     $this->display();
 }