function _initialize() { //预处理 $this->permissions = array("1" => "Article", "2" => "Gropus", "3" => "Albums", "4" => "Events", "5" => "Cityguide"); if (!$this->_is_login()) { $arr = array('/cid/3', '/cid/2', '/cid/1', '/cid/4', '/cid/0', '/1.html', '/0.html', '/2.html', '/3.html', '/4.html', '.html', '/index.php?s=', '/Public/select_city'); $url = str_replace($arr, '', $_SERVER["REQUEST_URI"]); $url = $url == '/' ? '/Index/index' : $url; $url = myencode($url); redirect("/Public/login/to/{$url}"); } parent::_initialize(); $rudao = D("RoleUser"); $condition = array("user_id" => $this->user['uid']); $data = array(); $data = $rudao->where($condition)->find(); //dump($rudao->getlastsql()); if (count($data) > 0) { $data['per'] = unserialize($data['permissions']); $this->user_per = $data; $this->assign("permissions", $this->permissions); $this->assign("per", $data); } import("ORG.Util.Page"); $this->assign('pmnum', $this->ckh_pm()); }
/** *分类信息内容页面 *@date 2010-4-30 *@time 下午05:08:30 */ function show() { //分类信息内容页面 $aid = intval($_GET['aid']); if (empty($aid)) { $this->error("error: aid is null!"); } $dao = D("Archives"); $info = $dao->where("id={$aid}")->find(); if (empty($info)) { $this->error("error: info is null!"); } if ($info['ismake'] == '0') { $this->error("error: the information has been deleted!"); } $this->ads($info['channel'], 'content', '1'); $city = $this->_get_city('localion'); switch (true) { case $info['channel'] == 4: //Jobs $info['_jobs'] = $dao->relationGet("jobs"); $info['itype'] = $info['itype'] == '0' ? 'All' : $info['itype'] == '1' ? 'Offered' : 'Wanted'; $category = array("All", "Full time", "Part time", "Internship", "Voluntary"); $info['category'] = $category[$info['category']]; break; case $info['channel'] == 5: //realestate $info['_realestate'] = $dao->relationGet("realestate"); break; case $info['channel'] == 6: //commerce $types = array(1 => 'All', 2 => 'Offered', 3 => 'Wanted'); $cat = array('Brand-new', 'Second-hand'); $info['itype'] = $types[$info['type']]; $info['category'] = $cat[$info['category']]; $info['_commerce'] = $dao->relationGet("commerce"); break; case $info['channel'] == 7: //agents $info['_agents'] = $dao->relationGet("agents"); break; case $info['channel'] == 8: //personals $info['_personals'] = $dao->relationGet("personals"); break; case $info['channel'] == 9: //services $info['itype'] = $info['itype'] == 1 ? 'All' : $info['itype'] == 2 ? 'Offered' : 'Wanted'; $category = array("All", "Full time", "Part time", "Internship", "Voluntary"); $info['category'] = $category[$info['category']]; $info['_services'] = $dao->relationGet("services"); break; } $local = ''; if ($info['zone_id'] && $info['city_id']) { $local = $city[$info['city_id']]['_zone'][$info['zone_id']]['name'] . ',' . $city[$info['city_id']]['cename']; } elseif (empty($info['zone_id']) && $info['city_id']) { $local = $city[$info['city_id']]['cename']; } $info['position'] = trim($info['position'] . ',' . $local, ','); $album = $this->get_album($info['id'], $info['channel']); if ($info['picurl']) { $info['picurl'] = str_replace('../Public/Uploads', '/Public/Uploads', $info['picurl']); } else { $info['picurl'] = out_images($album['0'], 's'); } $info['albumnum'] = count($album); $this->assign("album", $album); $this->assign('info', $info); //$this->assign('comments',$this->_get_comments($info['id'],$info['channel'])); $this->assign("group", $this->member_group($this->member_comments($info['id'], $info['channel']), "0,6")); $page = array(); $page['title'] = $info['title'] . ' - BeingfunChina 缤纷中国'; $page['keywords'] = $info['keywords']; $page['description'] = $info['description']; $this->assign('page', $page); if ($this->_is_admin() || $this->user['uid'] == $info['uid']) { $cp = '<a href="/Cp/photo/info/' . $info['channel'] . '_' . $info['id'] . '">Add Photos</a> / <a href="/Cp/my_edit_classifieds/info/' . $info['channel'] . '_' . $info['id'] . '">edit</a> / <a href="/Cp/del_arc/info/' . $info['channel'] . '_' . $info['id'] . '/to/' . myencode("/clist/{$info['typeid']}.html") . '/">remove</a>'; $cp .= string2checked('f', $info['flag'], ',', '1') == 1 ? " / <a href=\"/Cp/attr/info/{$info['channel']}_{$info['id']}/clear/f/to/" . myencode("/clss/{$info['id']}.html") . "\" title=\"clear Featured\"><font color=\"#FF0000\">Featured</font></a> / " : " / <a href=\"/Cp/attr/info/{$info['channel']}_{$info['id']}/fld/f/to/" . myencode("/clss/{$info['id']}.html") . "\" title=\"Set Featured\">Featured</a> / "; $this->assign('cp', $cp); } //dump($this->_get_dh($info['typeid'])); $this->assign('dh', $this->_get_dh($info['typeid'])); $cid_sql = ''; if ($this->pcid == '0') { $cid_sql = ""; } elseif ($this->pcid < 1000) { $cid_sql = " 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 . ','; } $cid_sql = " AND (cid in ({$city_temp['id']} or cid='0')"; } $this->assign("new_arc", $this->_get_uptype_arc($info['typeid'])); $f_arc = 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')"; } $f_arc = $dao->where($condition)->order("pubdate DESC")->limit("0,20")->findAll(); shuffle($f_arc); $this->assign('f_arc', $f_arc); $condition = array(); $st = mktime(0, 0, 1, date("m"), date("d"), date("Y")); $et = mktime(59, 59, 59, date("m"), date("d") + 30, date("Y")); $condition['channel'] = '10'; $condition['ismake'] = '1'; $condition['_string'] = "`showstart`>={$st} AND `showstart`<={$et}"; if ($this->pcid == '0' || empty($this->pcid)) { $city = ''; } elseif ($this->pcid < 1000) { $city = " 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 = " AND (cid in ({$city_temp['id']}) or cid='0')"; } $condition['_string'] .= $city; $f_event = array(); $f_event = $dao->where($condition)->order("pubdate DESC")->limit("0,20")->findAll(); shuffle($f_event); $this->assign("event", $f_event); $this->display(); }
/** *分享到群组收藏夹 *@date 2010-6-28 *@time 下午03:04:23 */ public function share() { //分享到群组收藏夹 if (!$this->_is_login()) { $url = myencode($_SERVER["REQUEST_URI"]); $this->assign("jumpUrl", "/Public/login/to/{$url}"); $this->error('Log in please.'); } else { $act = Input::getVar($_POST['act']); if ($act != "share") { $this->ajax_group(); } else { $gid = Input::getVar($_POST['gid']); $xid = Input::getVar($_POST['xid']); $types = Input::getVar($_POST['xtype']); $dao = D("MtagCollection"); foreach ($gid as $g) { $data = array(); $return = ''; $msg = ''; $data['gid'] = $g; $data['xid'] = $xid; $data['types'] = $types; $data['listid '] = 0; $data = $dao->create($data); $return = $dao->add($data); if (empty($return)) { $msg .= '"' . get_info($g) . '" Your sharing is failed.<br>'; } else { $msg .= '"' . get_info($g) . '" You’ve shared successfully.<br>'; } } $this->success($msg); } } }
/** *邮件列表 *@date 2010-8-20 *@time 上午10:47:07 */ function maillist() { //邮件列表 if ($_POST['submit']) { $dao = D("MailList"); $mail = trim($_POST['email ']); $this->assign("jumpUrl", '/index.html'); if ($mail) { $this->error("Failed to subscribe!"); } $vo = $dao->create(); $condition = array(); $condition['email'] = $mail; $info = $dao->where($condition)->find(); if ($info) { $this->error("You've been sucessfully subscribe to Beingfunchina newsletter."); } if ($vo) { $vo['types'] = 'news'; $vo['status'] = '0'; $id = $dao->add($vo); if ($id) { //发送验证邮件 $repw = $vo['mail'] . '||' . $vo['ctime'] . '||' . $vo['status']; $repw = myencode($repw); $Title = "Confirmation Letter-Beingfunchina Newsletter"; $Content = 'Hello, <br>Welcome, and thank you for becoming a Beingfunchina.com Insider. <br>'; $Content .= "you have subscribed {$vo['mail']} to Beingfunchina.com's newsletter. <br>"; $Content .= 'To confirm this subscription, please click the link below:<br>'; $Content .= "<br><br><A HREF='http://www.beingfunchina.com/Public/chmail/key/{$repw}.html' target='_blank'>http://www.beingfunchina.com/Public/chmail/key/{$repw}.html</A>\n <br>"; $Content .= 'If you do not wish to subscribe, do nothing. <br>'; $Content .= 'You will be automatically removed. <br>'; $Content .= 'Regards,Beingfunchina.com<br>'; /*if(!C('MAILSERVER')||!C('MAILPORT')||!C('MAILID')||!C('MAILPW')){ $this->error("Please administrator to set up mail server"); } import("@.COM.Smtp"); //require_once(BeingfunChina_PATH."inc/class.mail.php"); $smtp = new smtp(C('MAILSERVER'),C('MAILPORT'),true,C('MAILID'),C('MAILPW')); $smtp->debug = false; if($smtp->sendmail($info['email'],C("MAILID"), $Title, $Content, "HTML")){ $msg="New password has been successfully sent to your mailbox, please watch for!"; }else{ $msg="Failed to send e-mail. This may be due to wrong e-mail address or problems of the mail server."; }*/ $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $headers .= 'From: beingfunchina@gmail.com' . "\r\n"; //$headers .= 'Reply-To: webmaster@example.com' . "\r\n"; if (mail($vo['mail'], $Title, $Content, $headers)) { //$this->assign("jumpUrl","/Public/login.html"); $text = "<h1>Thank you!</h1><p>We appreciate your time. Check your e-mail inbox for the latest newsletter from Beingfunchina.</p>"; $this->success($text); } else { $this->error("Oops! Please try again."); } //发送验证邮件 } else { $this->error("Oops! Please try again."); } } else { $this->error("Oops! Please try again."); } } else { $this->display(); } }
/** *编码需要打开的网址 *@date 2010-9-8 *@time 下午06:06:25 */ function jump($url, $id) { //编码需要打开的网址 $url = $url . '||' . $id; $url = myencode($url); return __APP__ . '/link/' . $url; }
/** *城市指南内容页 *@date 2010-5-12 *@time 下午04:13:26 */ function show() { //城市指南内容页 $aid = intval($_GET['aid']); if (empty($aid)) { $this->error("error: aid is null!"); } $this->chk_cid(); /*$dao=D("CityGuideView"); $info=$dao->where("Archives.id=$aid")->find();*/ $dao = D("Archives"); $info = $dao->where("id={$aid}")->find(); if (!empty($info['reurl']) && $info['reurl'] != 'http://') { redirect($info['reurl']); } if ($info['ismake'] == '0') { $this->error("error: the information has been deleted!"); } $info['content'] = $dao->relationGet("article"); $cname = array('bj' => 'Beijing', 'sh' => 'Shanghai', 'gz' => 'Guangzhou', 'sz' => 'Shenzhen'); //if(empty($info['maps'])){ $city = $this->_get_city('localion'); $local = ''; if ($info['zone_id'] && $info['city_id']) { $local = $cname[$city[$info['city_id']]['cename']] . ' ' . $city[$info['city_id']]['_zone'][$info['zone_id']]['name'] . ' District'; } elseif (empty($info['zone_id']) && $info['city_id']) { $local = $city[$info['city_id']]['cename']; } $local = trim($info['position'] . ',' . $local, ','); $info['maps'] = $info['contact']; //} $album = $this->get_album($info['id'], $info['channel']); if ($info['picurl']) { $info['picurl'] = str_replace('../Public/Uploads', '/Public/Uploads', $info['picurl']); } else { $info['picurl'] = out_images($album['0'], 's'); } $info['albumnum'] = count($album); $this->assign("album", $album); $this->assign("group", $this->member_group($this->member_comments($info['id'], $info['channel']), "0,6")); $this->assign('info', $info); $page = array(); $page['title'] = $info['title'] . ' - BeingfunChina 缤纷中国'; $page['keywords'] = $info['keywords']; $page['description'] = $info['description']; $this->assign('page', $page); $this->assign('dh', $this->_get_dh($info['typeid'])); $this->ads('2', 'content', 0, $info['typeid']); if ($this->_is_admin()) { $cp = '<a href="/Cp/photo/info/2_' . $info['id'] . '">Add Photos</a> / <a href="/Cp/my_edit_cityguide/info/2_' . $info['id'] . '">edit</a> / <a href="/Cp/del_arc/info/2_' . $info['id'] . '/to/' . myencode("/cglist/{$info['typeid']}.html") . '">remove</a>'; $this->assign('cp', $cp); } $this->assign("new_arc", $this->_get_uptype_arc($info['typeid'])); $condition = array(); $st = mktime(0, 0, 1, date("m"), date("d"), date("Y")); $et = mktime(59, 59, 59, date("m"), date("d") + 30, date("Y")); $condition['channel'] = '10'; $condition['ismake'] = '1'; $condition['_string'] = "`showstart`>={$st} AND `showstart`<={$et}"; if ($this->pcid == '0' || empty($this->pcid)) { $city = ''; } elseif ($this->pcid < 1000) { $city = " 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 = " AND (cid in ({$city_temp['id']}) or cid='0')"; } $condition['_string'] .= $city; $f_event = array(); $f_event = $dao->where($condition)->order("pubdate DESC")->limit("0,20")->findAll(); shuffle($f_event); //dump($dao->getLastSql()); $this->assign("event", $f_event); self::album(); self::ctg_news(); $this->display(); }