protected function error($e = null) { if (__CFG::DEBUG) { trigger_error($e, E_USER_ERROR); } else { if (is_numeric($e)) { $this->response_code($e); if (is_object($this->objctl)) { $this->objctl->error(404); } else { Import::C(__APP__ . ':index'); $objctl = new Ctl_Index($this); $objctl->error(404); } } } }
<?php Import::C('ucenter/ucenter'); class Ctl_Ucenter_Diary extends Ctl_Ucenter { protected $_diary_allower_fields = 'title,home_id,face_pic,company_id,type_id,way_id,total_price,start_date,end_date'; protected $_diary_detail_allower_fields = ''; public function index() { $filter = $pager = array(); $pager['page'] = max(intval($page), 1); $pager['limit'] = $limit = 10; $filter['uid'] = $this->uid; if ($items = K::M('diary/diary')->items($filter, null, $page, $limit, $count)) { foreach ($items as $k => $v) { if ($v['home_id']) { $home_ids[$v['home_id']] = $v['home_id']; } if ($v['company_id']) { $company_ids[$v['company_id']] = $v['company_id']; } $items[$k]['create_ip'] = $v['create_ip'] . '(' . K::M("misc/location")->location($v['create_ip']) . ')'; } if (!empty($home_ids)) { $this->pagedata['home_list'] = K::M('home/main')->items_by_ids($home_ids); } if (!empty($company_ids)) { $this->pagedata['company_list'] = K::M('company/company')->items_by_ids($company_ids); } $pager['count'] = $count; $pager['pagebar'] = $this->mkpage($count, $limit, $page, $this->mklink(null, array('{page}'), array(), true), array());
<?php /** * Copy Right Anuike.com * Each engineer has a duty to keep the code elegant * Author @shzhrui<*****@*****.**> * $Id: news.ctl.php 2772 2014-01-06 02:45:07Z youyi $ */ Import::C('mall/shop'); class Ctl_Mall_News extends Ctl_Mall_Shop { public function index() { } public function detail($news_id = null) { if (!($news_id = (int) $news_id)) { $this->error(404); } else { if (!($detail = K::M('shop/news')->detail($news_id))) { $this->error(404); } else { if (empty($detail['audit'])) { $this->err->add('内容还在审核中', 211); } else { $shop = $this->check_shop($detail['shop_id']); if ($next = K::M('shop/news')->items(array('shop_id' => $detail['shop_id'], 'news_id' => '>:' . $news_id), array('news_id' => 'ASC'), 1, 1)) { $pager['next'] = $next; } if ($next = K::M('shop/news')->items(array('shop_id' => $detail['shop_id'], 'news_id' => '<:' . $news_id), array('news_id' => 'DESC'), 1, 1)) { $pager['next'] = $next;