public function index()
 {
     $kinfo = '';
     //标题后面附加的城市后缀
     if ($this->pcid) {
         //检查城市或者城市群
         if ($this->pcid > 1000) {
             $kinfo = $this->cgroup[$this->pcid]['name'];
             $this->assign('city_group', $this->cgroup[$this->pcid]['name']);
         } else {
             $kinfo = get_cityname($this->pcid);
         }
         $this->assign("cityname", $kinfo);
     }
     //检查城市或者城市群
     /*$this->assign('pick',$this->_new_list(2001,'h','0,1',$this->pcid));
      	$this->assign('pick2',$this->_new_list(2001,'p','0,2',$this->pcid));*/
     $slide = $this->_new_list('3001', 'l', '0,5', $this->pcid);
     //dump($slide);
     $this->assign('slide', $slide);
     $pick8 = $this->_new_list('', 'f', '0,20', $this->pcid, '11,12');
     shuffle($pick8);
     $this->assign('pick8', $pick8);
     $this->assign('do', $this->_new_list(2004, '', '0,1', $this->pcid));
     //$this->assign('biz_news',$this->_new_list(2003,'','0,10'));
     $group = $this->_get_group('hot', '0,4');
     $this->assign('group', $group);
     $this->assign('city_type', $this->_get_tree(1000));
     $this->assign('classifieds_type', $this->_get_tree(1));
     $classifieds_type = $this->_get_classifieds_type();
     $classifieds = array();
     foreach ($classifieds_type as $v) {
         $classifieds = array_merge($classifieds, $this->_get_carc($v['id'], '0,10', 0));
         //$this->pcid
     }
     $classifieds_ch = trim($classifieds_ch, ',');
     shuffle($classifieds);
     $this->assign('classifieds', $classifieds);
     //dump($classifieds);
     unset($classifieds);
     $dao = D("Archives");
     $citygui_featured = array();
     $condition = array();
     $condition['ismake'] = '1';
     $condition['channel'] = '2';
     $condition['_string'] = "FIND_IN_SET('f',`flag`) > 0";
     if ($this->pcid == '0') {
         $condition['_string'] .= "";
     } elseif ($this->pcid < 1000) {
         $condition['_string'] .= " 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 . ',';
         }
         $condition['_string'] .= " AND (cid in ({$city_temp['id']}) or cid='0')";
     }
     $citygui_featured = $dao->where($condition)->order("pubdate DESC")->limit("0,20")->findAll();
     shuffle($citygui_featured);
     $this->assign('citygui_featured', $citygui_featured);
     unset($citygui_featured);
     $classifieds_featured = array();
     $condition = array();
     $condition['ismake'] = '1';
     $classifieds_ch = '4,5,6,7,8,9';
     $condition['channel'] = array('in', "{$classifieds_ch}");
     $condition['_string'] = "FIND_IN_SET('f',`flag`) > 0";
     if ($this->pcid == '0') {
         $condition['_string'] .= "";
     } elseif ($this->pcid < 1000) {
         $condition['_string'] .= " 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 . ',';
         }
         $condition['_string'] .= " AND (cid in ({$city_temp['id']}) or cid='0')";
     }
     $classifieds_featured = $dao->where($condition)->order("pubdate DESC")->limit("0,20")->findAll();
     shuffle($classifieds_featured);
     $this->assign('classifieds_featured', $classifieds_featured);
     unset($classifieds_featured, $dao);
     $event = array();
     $event = $this->new_event();
     $this->assign('event', $event);
     $fair = array();
     $fair = $this->new_fair();
     $this->assign('fair', $fair);
     $page = array();
     $page['title'] = '缤纷中国 Beingfunchina: Being fun in China, start with us!' . $kinfo;
     $page['keywords'] = '缤纷中国,City Guide, Classifieds, Feature Columns, China Fairs, Events, E-magazines, Groups' . $kinfo;
     $page['description'] = $kinfo . '缤纷中国 Beingfunchina is an English website providing practical and localized information, supporting free posts of classifieds and facilitating interpersonal communication for foreigners in China. Our channels include City Guide, Classifieds, Feature Columns, China Fairs, Events, E-magazines and Groups. ';
     $this->assign('page', $page);
     $ad = array();
     $ad['right'] = '';
     $ads = M("Ad");
     $condition = array();
     $condition['wz'] = 'index';
     $condition['is_show'] = '1';
     $condition['begintime'] = array('lt', time());
     $condition['endtime'] = array('gt', time());
     $condition['_string'] = "FIND_IN_SET('" . $this->pcid . "',`cid`) > 0";
     $adlist = $ads->where($condition)->findAll();
     shuffle($adlist);
     foreach ($adlist as $adl) {
         if ($adl['type'] == 'banner') {
             if (empty($adl['adcode'])) {
                 $ad['banner'][] = '<a href="' . jump($adl['adlink'], $adl['id']) . '" target="' . $adl['isclose'] . '" alt="' . $adl['title'] . '"><img src="' . $adl['picurl'] . '" /></a>';
             } else {
                 $ad['banner'][] = $adl['adcode'];
             }
         } elseif ($adl['type'] == 'right') {
             if (empty($adl['adcode'])) {
                 $ad['right'] .= '<a href="' . jump($adl['adlink'], $adl['id']) . '" target="' . $adl['isclose'] . '" alt="' . $adl['title'] . '"><img src="' . $adl['picurl'] . '" /></a><br>';
             } else {
                 $ad['right'] .= $adl['adcode'];
             }
         } elseif ($adl['type'] == 'left') {
             if (empty($adl['adcode'])) {
                 $ad['left'] .= '<a href="' . jump($adl['adlink'], $adl['id']) . '" target="' . $adl['isclose'] . '" alt="' . $adl['title'] . '"><img src="' . $adl['picurl'] . '" /></a><br>';
             } else {
                 $ad['left'] .= $adl['adcode'];
             }
         }
     }
     $this->assign('ad', $ad);
     $chau_list = array();
     /*$chau_list['0']['id']='1';
       $chau_list['0']['name']='Asia';
       $chau_list['0']['ename']='asia';*/
     $chau_list['1']['id'] = '2';
     $chau_list['1']['name'] = 'Europe';
     $chau_list['1']['ename'] = 'europe';
     $chau_list['1']['url'] = 'http://www.listenlive.eu';
     $chau_list['2']['id'] = '3';
     $chau_list['2']['name'] = 'Canadian';
     $chau_list['2']['ename'] = 'canadian';
     $chau_list['3']['id'] = '4';
     $chau_list['3']['name'] = 'United States';
     $chau_list['3']['ename'] = 'unitedstates';
     /*$chau_list['4']['id']='5';
       $chau_list['4']['name']='South America';
       $chau_list['4']['ename']='south_america';*/
     $chau_list['5']['id'] = '6';
     $chau_list['5']['name'] = 'Australia';
     $chau_list['5']['ename'] = 'oceania';
     $chau_list['6']['id'] = '7';
     $chau_list['6']['name'] = 'New Zealand';
     $chau_list['6']['ename'] = 'newzealand';
     $this->assign('chau', $chau_list);
     $cityname = array(1 => array('GUANGZHOU', 'CH006'), 2 => array('BEIJING', 'CH002'), 3 => array('SHANGHAI', 'CH024'), 4 => array('SHENZHEN', 'CH006'));
     $incity = empty($this->pcid) ? $cityname['2'] : $cityname[$this->pcid];
     $this->assign('city_name', $incity);
     $dao = D("Magazines");
     $magazine_index = array();
     $condition = array("showtime" => array('lt', time()));
     $magazine_index = $dao->where($condition)->order("id DESC")->find();
     $this->assign('magazine_index', $magazine_index);
     $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年 05月 04日 星期二 10:57:56 CST
  */
 function ls()
 {
     //活动列表页
     $this->chk_cid();
     if ($_GET['id']) {
         $_SESSION['typeid'] = Input::getVar($_GET['id']);
     }
     if ($_GET['type'] == 'all') {
         unset($_SESSION['typeid']);
     }
     //$condition['cid'] = $this->pcid;
     $range_time = $this->range_time();
     $this->assign('range_time', $range_time);
     $this->assign('class_tree', $this->get_class(2050));
     //设置时间段筛选时间
     if ($_GET['tk']) {
         foreach ($range_time as $v) {
             if ($v['tk'] == Input::getVar($_GET['tk'])) {
                 $_SESSION['sql'] = $v['sql'];
                 $_SESSION['tk'] = $v['tk'];
                 $_SESSION['tk_name'] = $v['name'];
             }
         }
     }
     if ($_GET['clrt'] == "ok") {
         unset($_SESSION['sql']);
         unset($_SESSION['tk']);
         unset($_SESSION['tk_name']);
     }
     $time = time();
     $dao = D("Archives");
     $condition = array();
     if (!empty($this->pcid) && $this->pcid != '0') {
         if ($this->pcid < 1000) {
             $condition['cid'] = $this->pcid;
         }
     }
     $condition['channel'] = '10';
     $condition['ismake'] = '1';
     if ($_SESSION['sql']) {
         $this->assign("tk", $_SESSION['tk']);
         //$condition['_string'] = "(`showstart`>='{$_SESSION['st']}' AND `showstart`<='{$_SESSION['et']}') OR (`showend`>='{$_SESSION['st']}' AND `showend`>='{$_SESSION['et']}')";
         $condition['_string'] = $_SESSION['sql'];
     }
     if ($_SESSION['typeid']) {
         $this->assign("typeid", $_SESSION['typeid']);
         $condition['typeid'] = $_SESSION['typeid'];
     }
     $count = $dao->where($condition)->order("showstart DESC")->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("showstart DESC")->limit($limit)->findAll();
     //dump($dao->getLastSql());
     $this->assign('data', $data);
     //获取类别信息
     $info = array();
     if ($_SESSION['typeid']) {
         $arctype = D("Arctype");
         $info = $arctype->where("id={$_SESSION['typeid']}")->find();
         $this->assign("info", $info);
     } else {
         $info['typename'] = "All";
         $this->assign("info", $info);
     }
     //导航
     $this->assign('dh', $this->_get_dh($_SESSION['typeid']));
     //页头信息
     $cityinfo = '';
     if ($this->pcid) {
         $cityinfo = get_cityname($this->pcid) ? ' in ' . get_cityname($this->pcid) : '';
     }
     $title = "";
     $title .= empty($info['typename']) ? 'Events list' : $info['typename'];
     $title .= empty($_SESSION['tk_name']) ? '' : ',' . $_SESSION['tk_name'];
     $title .= $cityinfo;
     $page = array();
     $page['title'] = empty($info['title']) ? $title . ' - BeingfunChina 缤纷中国' : $title . ' - BeingfunChina 缤纷中国';
     $page['keywords'] = empty($info['tags']) ? $title : $info['tags'];
     $page['description'] = empty($info['title']) ? "Events list in BeingfunChina" : $title;
     $this->assign('page', $page);
     $this->ads('10', 'list');
     //调用广告
     if ($this->_is_admin()) {
         //检查管理权限
         $this->assign('admin', true);
     }
     $this->display();
 }
Example #4
0
$minutes = $date_time_array['minutes'];
$seconds = $date_time_array['seconds'];
$month = $date_time_array['mon'];
$day = $date_time_array['mday'];
$year = $date_time_array['year'];
// use mktime to recreate the unix timestamp
// adding 19 hours to $hours
$timestamp = mktime($hours + 0, $minutes, $seconds, $month, $day, $year);
$theDate = strftime('%Y-%m-%d %H:%M:%S', $timestamp);
// END DATE FUNCTION
//Search API Script
$q = $_SESSION['defaultcityId'];
if (isset($_SESSION['defaultcityId'])) {
    ?>
 <span title="Visit more cities" class="city_link">  <?php 
    $result = get_cityname();
    while ($row = mysql_fetch_array($result)) {
        $city = html_entity_decode($row['cityname']);
        $city = urlencode($city);
    }
}
$search = "http://search.twitter.com/search.atom?q=" . $city . "";
$tw = curl_init();
curl_setopt($tw, CURLOPT_URL, $search);
curl_setopt($tw, CURLOPT_RETURNTRANSFER, TRUE);
$twi = curl_exec($tw);
$search_res = new SimpleXMLElement($twi);
## Echo the Search Data
$limit = 1;
foreach ($search_res->entry as $twit1) {
    if ($limit <= 5) {
 /**
  *分类信息列表页面
  *@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();
 }