當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Input::getVar方法代碼示例

本文整理匯總了PHP中Input::getVar方法的典型用法代碼示例。如果您正苦於以下問題:PHP Input::getVar方法的具體用法?PHP Input::getVar怎麽用?PHP Input::getVar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Input的用法示例。


在下文中一共展示了Input::getVar方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: index

 public function index()
 {
     if (IS_POST) {
         $this->redirect('index', $_POST);
     }
     //查詢條件
     $where = array();
     //搜索
     $search = I('get.search');
     if (!empty($search)) {
         $this->assign("search", $search);
         //添加開始時間
         $start_time = I('get.start_time');
         if (!empty($start_time)) {
             $start_time = strtotime($start_time);
             $where['create_time'] = array("EGT", $start_time);
             $this->assign('start_time', $start_time);
         }
         //添加結束時間
         $end_time = I('get.end_time');
         if (!empty($end_time)) {
             $end_time = strtotime($end_time);
             $where['create_time'] = array("ELT", $end_time);
             $this->assign('end_time', $end_time);
         }
         if ($end_time > 0 && $start_time > 0) {
             $where['create_time'] = array(array('EGT', $start_time), array('ELT', $end_time));
         }
         //搜索字段
         $searchtype = I('get.searchtype', null, 'intval');
         //搜索關鍵字
         $keyword = \Input::getVar(I('get.keyword'));
         if (!empty($keyword)) {
             $this->assign("searchtype", $searchtype);
             $this->assign("keyword", $keyword);
             if ($searchtype == 1) {
                 $where['mname'] = array("LIKE", "%{$keyword}%");
             } elseif ($searchtype == 2) {
                 $where['mtel'] = array("LIKE", "%{$keyword}%");
             } elseif ($searchtype == 3) {
                 $where['mprovince'] = array("LIKE", "%{$keyword}%");
             }
         }
         //狀態
         $status = I('get.status', 0, 'intval');
         if ($status == 1) {
             $where['status'] = array("EQ", true);
         } elseif ($status == 2) {
             $where['status'] = array('EQ', false);
         }
         $this->assign('status', $status);
     }
     $model = M('TryMember');
     //信息總數
     $count = $model->where($where)->count();
     $page = $this->page($count, 30);
     $data = $model->where($where)->limit($page->firstRow . ',' . $page->listRows)->order(array("id" => "DESC"))->select();
     $this->assign('Page', $page->show())->assign('count', $count)->assign('data', $data);
     $this->display();
 }
開發者ID:gzwyufei,項目名稱:hp,代碼行數:60,代碼來源:TryMemberController.class.php

示例2: index

 public function index()
 {
     if (IS_POST) {
         $this->redirect('index', $_POST);
     }
     //搜索
     $search = I('get.search');
     if (!empty($search)) {
         $this->assign("search", $search);
         //添加開始時間
         $start_time = I('get.start_time');
         if (!empty($start_time)) {
             $this->assign('start_times', $start_time);
             $start_time = strtotime($start_time);
             $where['create_time'] = array("EGT", $start_time);
             $this->assign('start_time', $start_time);
         }
         //添加結束時間
         $end_time = I('get.end_time');
         if (!empty($end_time)) {
             $this->assign('end_times', $end_time);
             $end_time = strtotime($end_time);
             $where['create_time'] = array("ELT", $end_time);
             $this->assign('end_time', $end_time);
         }
         //時間搜索條件
         if ($end_time > 0 && $start_time > 0) {
             $where['create_time'] = array(array('EGT', $start_time), array('ELT', $end_time));
         }
         //是否審核
         $status = I('get.status', 2, 'intval');
         if ($status != 2) {
             $where["status"] = array("EQ", $status);
         }
         $this->assign("status", $status);
         //全部欄目
         $menu = I('get.menu');
         if (!empty($menu)) {
             $where["menu"] = array("EQ", $menu);
             $this->assign("menu", $menu);
         }
         //搜索關鍵字
         $keyword = \Input::getVar(I('get.keyword'));
         if (!empty($keyword)) {
             $this->assign("keyword", $keyword);
             $where['title'] = array("LIKE", "%{$keyword}%");
         }
     } else {
         $this->assign("status", 2);
     }
     $count = M('Advert')->where($where)->count();
     $page = $this->page($count, 20);
     $list = M('Advert')->where($where)->limit($page->firstRow . ',' . $page->listRows)->order(array('id' => 'DESC'))->select();
     $this->assign("list", $list);
     $this->assign("Page", $page->show());
     session('backurl', get_url());
     //頁麵跳轉SESSION
     $this->display();
 }
開發者ID:gzwyufei,項目名稱:hp,代碼行數:59,代碼來源:AdvertController.class.php

示例3: get

 /**
  * 獲取模型字段信息
  * @param type $data
  * @return type 
  */
 function get($data = array())
 {
     //信息ID
     if (isset($data['id'])) {
         $this->id = $data['id'];
     }
     $this->data = $data;
     $info = array();
     foreach ($this->fields as $field => $v) {
         //判斷是否後台
         if (defined('IN_ADMIN') && IN_ADMIN) {
             //判斷是否內部字段,如果是,跳過
             if ($v['iscore']) {
                 continue;
             }
         } else {
             //判斷是否內部字段或者,是否禁止前台投稿字段
             if ($v['iscore']) {
                 continue;
             }
             if (!$v['isadd']) {
                 continue;
             }
         }
         $func = $v['formtype'];
         $value = isset($data[$field]) ? Input::getVar($data[$field]) : '';
         if ($func == 'pages' && isset($data['maxcharperpage'])) {
             $value = $data['paginationtype'] . '|' . $data['maxcharperpage'];
         }
         //判斷對應方法是否存在,不存在跳出本次循環
         if (!method_exists($this, $func)) {
             continue;
         }
         //傳入參數 字段名 字段值 字段信息
         $form = $this->{$func}($field, $value, $v);
         if ($form !== false) {
             //作為基本信息
             if ($v['isbase']) {
                 $star = $v['minlength'] || $v['pattern'] ? 1 : 0;
                 $info['base'][$field] = array('name' => $v['name'], 'tips' => $v['tips'], 'form' => $form, 'star' => $star, 'isomnipotent' => $v['isomnipotent'], 'formtype' => $v['formtype']);
             } else {
                 $star = $v['minlength'] || $v['pattern'] ? 1 : 0;
                 $info['senior'][$field] = array('name' => $v['name'], 'tips' => $v['tips'], 'form' => $form, 'star' => $star, 'isomnipotent' => $v['isomnipotent'], 'formtype' => $v['formtype']);
             }
         }
     }
     //配合 validate 插件,生成對應的js驗證規則
     $this->formValidateRules = $this->ValidateRulesJson($this->formValidateRules);
     $this->formValidateMessages = $this->ValidateRulesJson($this->formValidateMessages, true);
     return $info;
 }
開發者ID:BGCX262,項目名稱:ztoa-svn-to-git,代碼行數:56,代碼來源:content_form.class.php

示例4: index

 public function index()
 {
     $get = I('get.');
     $type = I('get.t');
     $keyword = \Input::getVar(I('get.keyword'));
     if (empty($type)) {
         $this->_empty();
     }
     if (empty($keyword)) {
         $this->error('親愛的,你似乎沒有輸入需要搜索的關鍵詞...');
     }
     $url = '&keyword=' . $keyword . '&t=' . $type;
     if ($type == 1) {
         //中間廣告位
         $this->assign('midad', parent::getAdvert(2, 1, 0, 1));
         $worksModel = M('Works');
         $where['status'] = array('EQ', true);
         $where['title'] = array("LIKE", "%{$keyword}%");
         $count = $worksModel->where($where)->count();
         $page = $this->Pages($count, 30);
         $pageurl = '?page=' . urlencode('[PAGE]');
         $page->url = __APP__ . '/search/' . $pageurl . $url;
         $Model = new Model();
         $list = $Model->table(array(C('DB_PREFIX') . 'works' => 'W', C('DB_PREFIX') . 'user' => 'U'))->where("W.userid=U.userid and W.status=true and W.title like '%" . $keyword . "%'")->field('W.title,W.type,W.content,W.goodnum,W.msgnum,W.workid,W.create_time,W.image,U.nickname,U.uavatar,U.openuid,U.uprovince,U.ucity,U.userid,U.ifrz')->order('msgnum DESC')->limit($page->firstRow . ',' . $page->listRows)->select();
         foreach ($list as $key => $value) {
             $list[$key]['dignum'] = M('Dig')->where(array('status' => true, 'infoid' => $value['workid'], 'userid' => $this->userid))->count();
         }
         $this->assign('keywords', $keyword);
         $this->assign("list", $list);
         $this->assign("Page", $page->show());
         $this->display('works');
     } else {
         $userModel = M('User');
         $where['status'] = array('EQ', true);
         $where['nickname'] = array("LIKE", "%{$keyword}%");
         $count = $userModel->where($where)->count();
         $page = $this->Pages($count, 40);
         $pageurl = '?page=' . urlencode('[PAGE]');
         $page->url = __APP__ . '/search/' . $pageurl . $url;
         $list = $userModel->where($where)->field('userid,uavatar,openuid,nickname,worksnum,spnum,fansnum')->order('worksnum DESC')->limit($page->firstRow . ',' . $page->listRows)->select();
         foreach ($list as $key => $value) {
             $list[$key]['worknums'] = $value['worksnum'] + $value['spnum'];
             if (M('UserFans')->where(array('userid' => $value['userid'], 'myid' => $this->userid, 'status' => true))->count() > 0) {
                 $list[$key]['isfans'] = true;
             }
         }
         $this->assign("list", $list);
         $this->assign("Page", $page->show());
         $this->display('user');
     }
 }
開發者ID:gzwyufei,項目名稱:hp,代碼行數:51,代碼來源:SearchController.class.php

示例5: chk_cid

 /**
  *檢查城市選項
  *@date 2010-6-23
  *@time 上午10:17:39
  */
 protected function chk_cid()
 {
     //檢查城市選項
     $cid = Input::getVar($_GET['cid']);
     if ($cid) {
         if ($_SESSION['cid']) {
             $this->pcid = $cid;
         } else {
             $_SESSION['cid'] = $cid;
             $this->pcid = $cid;
             cookie('cid', null);
             if ($_REQUEST['remember']) {
                 cookie('cid', $cid, array('expire' => 60 * 60 * 60 * 24 * 30));
             }
         }
     } else {
         //$this->_set_cid();
         $this->pcid = empty($this->cid) ? 0 : $this->cid;
     }
 }
開發者ID:putera99,項目名稱:iic-classified,代碼行數:25,代碼來源:ClassifiedsAction.class.php

示例6: pm

 /**
  *發送短消息
  *@date 2010-9-29
  *@time 下午05:41:19
  */
 function pm()
 {
     //發送短消息
     if (!$this->_is_login()) {
         $this->error("Login please.", $_REQUEST['is_ajax']);
     }
     if (Input::getVar($_REQUEST['fromusername']) && empty($_REQUEST['fromuid'])) {
         $member = D("Members");
         $condition = array('username' => Input::getVar($_REQUEST['fromusername']));
         $info = $member->where($condition)->find();
         if ($info['id']) {
             $fromuid = $info['id'];
         } else {
             $this->error("Wrong user name!", $_REQUEST['is_ajax']);
         }
     } else {
         $fromuid = Input::getVar($_REQUEST['fromuid']);
     }
     $content = Input::getVar($_REQUEST['content']);
     $title = Input::getVar($_REQUEST['title']);
     if (!empty($fromuid)) {
         if (empty($content)) {
             $this->error('You must fill in the field of "Content".', $_REQUEST['is_ajax']);
         }
         if (empty($title)) {
             $this->error('You must fill in the field of "Title".', $_REQUEST['is_ajax']);
         }
         $data = array();
         $data['fromuid'] = $fromuid;
         $data['content'] = nl2br(remove_xss($content));
         $data['title'] = $title;
         $data['itype'] = Input::getVar($_REQUEST['itype']);
         $data['xid'] = Input::getVar($_REQUEST['xid']);
         $dao = D("Pm");
         $vo = $dao->create($data);
         if ($vo) {
             $id = $dao->add($vo);
             if ($id) {
                 $this->success('sucess.', $_REQUEST['is_ajax']);
             } else {
                 $this->error('failure.', $_REQUEST['is_ajax']);
             }
         } else {
             $this->error($dao->getError(), $_REQUEST['is_ajax']);
         }
     } else {
         $this->error("Wrong parameter!");
     }
 }
開發者ID:putera99,項目名稱:iic-classified,代碼行數:54,代碼來源:CommonAction.class.php

示例7: edit

 /**
  *修改用戶資料
  *@date 2010-7-20
  *@time 上午11:23:52
  */
 function edit()
 {
     //修改用戶資料
     $dao = D("Members");
     if ($_POST['act'] == 'edit') {
         $data = array();
         $data = $dao->create();
         if (empty($_FILES['avatar']['name'])) {
             $data['avatar'] = $_POST['old_avatar'];
         } else {
             $finfo = $this->_avatar();
             $data['avatar'] = '/Public/avatar/s_' . $finfo[0]['savename'];
         }
         $data['bday'] = Input::getVar($_POST['bdayyear']) . '-' . Input::getVar($_POST['birthmonth']) . '-' . Input::getVar($_POST['birthday']);
         $address = Input::getVar($_POST['address']);
         $data['address'] = empty($address) ? Input::getVar($_POST['address2']) : $address;
         $data['id'] = $this->user['uid'];
         $re = $dao->save($data);
         if ($re) {
             $info = $dao->where(array('id' => $this->user['uid']))->find();
             $info['avatar'] = avatar($info['avatar']);
             unset($_SESSION["info"]);
             $_SESSION["info"] = $info;
             redirect("/Cp/edit");
         } else {
             //$this->redirect("/Cp/edit",array(),5,'','Failed to update the Profile.');
             $this->assign('jumpUrl', __APP__ . "/Cp/edit");
             $this->error('Failed to update the Profile.');
         }
     } else {
         $info = $dao->where(array('id' => $this->user['uid']))->find();
         $bday = explode('-', $info['bday']);
         $info['bdayyear'] = $bday['0'];
         $info['birthmonth'] = $bday['1'];
         $info['birthday'] = $bday['2'];
         $this->assign('info', $info);
     }
     $page = array();
     $page['title'] = 'Edit Profile -  My Control Panel -  BeingfunChina';
     $page['keywords'] = 'Edit Profile';
     $page['description'] = 'Edit Profile';
     $this->assign('page', $page);
     $this->assign('content', 'Cp:edit');
     $this->display("Cp:layout");
 }
開發者ID:putera99,項目名稱:iic-classified,代碼行數:50,代碼來源:CpAction.class.php

示例8: show

 /**
  *展會信息
  *@date 2010-6-2
  *@time 上午10:38:22
  */
 function show()
 {
     //展會信息
     $aid = intval($_REQUEST['aid']);
     $this->assign('industries', $this->_get_fair());
     $this->assign("city", $this->_get_city('fair'));
     $this->assign('date', $this->_get_time());
     $year = array();
     $nowyear = date('Y');
     $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);
     $flang = Input::getVar($_REQUEST['flang']);
     $dao = D("Archives");
     $condition = array();
     if ($flang) {
         $lan = explode('_', $flang);
         if ($lan['1'] == 'CN') {
             $flang = $lan['0'] . '_CN';
         } else {
             $flang = $lan['0'] . '_EN';
         }
         $condition['writer'] = $flang;
         $condition['channel'] = 11;
         $_SESSION['flang'] = $lan['1'];
     } else {
         $condition['id'] = $aid;
     }
     $info = $dao->where($condition)->find();
     if ($info['ismake'] == '0') {
         $this->error("error: the information has been deleted!");
     }
     if (empty($info)) {
         $this->error("sorry,the information is not available now.<br/>\n您查看的信息暫時空缺。");
     }
     $lan = explode('_', $info['writer']);
     $lang['cn'] = $lan['0'] . '_CN';
     $lang['en'] = $lan['0'] . '_EN';
     $this->assign('lang', $lang);
     $info['_fair'] = $dao->relationGet("fair");
     $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);
     $page = array();
     $page['title'] = $info['title'] . ' - BeingfunChina 繽紛中國';
     $page['keywords'] = $info['keywords'] . ',fair,china,biz';
     $page['description'] = $info['description'];
     $this->assign('page', $page);
     $this->assign('dh', $this->_get_dh($info['typeid']));
     $this->display();
 }
開發者ID:putera99,項目名稱:iic-classified,代碼行數:66,代碼來源:BizAction.class.php

示例9: checktel

 public function checktel()
 {
     //搜索關鍵字
     $keyword = \Input::getVar(I('get.shtxt'));
     if (empty($keyword)) {
         exit(json_encode(array('status' => false)));
     }
     $where['mtel'] = array("LIKE", "%{$keyword}%");
     $list = M('TryMember')->field('mname,mtel,id')->where($where)->select();
     if ($list) {
         exit(json_encode(array('status' => true, 'datas' => $list)));
     } else {
         exit(json_encode(array('status' => false)));
     }
 }
開發者ID:gzwyufei,項目名稱:hp,代碼行數:15,代碼來源:TryItemsController.class.php

示例10: trylist

 public function trylist($where)
 {
     $worksModel = M('TryItems');
     $gets = I('get.');
     $where['status'] = array('EQ', true);
     $cat = $gets['cat'];
     $order = $gets['order'];
     $postfee = $gets['postfee'];
     $sort = $gets['sort'];
     $keywords = \Input::getVar($gets['keyword']);
     if (!empty($keywords)) {
         $where['title'] = array('LIKE', "%{$keywords}%");
         $this->keyword = $keywords;
         $keywordurl = "&keyword=" . $keywords;
     }
     if (!empty($cat)) {
         $caturl = "cat=" . $cat;
         $where['cateid'] = $cat;
         $this->cat = $cat;
         $linkarrow = "&";
         $this->catename = getTryCateName($cat);
     } else {
         $this->catename = '全部商品';
         $this->cat = 0;
     }
     if (!empty($postfee)) {
         $postfeeurl = "&postfee=" . $postfee;
         $where['postfee'] = $postfee;
         $this->postfee = $postfee;
     } else {
         $postfeeurl = "&postfee=0";
         $this->postfee = 0;
     }
     if (empty($order)) {
         $orders = 'tryid';
         $orderurl = "&order=1";
     } else {
         $orders = $this->getorder($order);
         $orderurl = "&order=" . $order;
     }
     $this->order = !empty($order) ? $order : '0';
     if (empty($sort)) {
         $sort = 'desc';
     }
     if ($order == 1 && $sort == 'desc') {
         $this->cls1 = 'b-fenlei_up_on';
         $sort = 'asc';
     } elseif ($order == 1 && $sort == 'asc') {
         $this->cls1 = 'b-fenlei_down_on';
         $sort = 'desc';
     } else {
         $this->cls1 = 'b-fenlei_down';
     }
     if ($order == 2 && $sort == 'desc') {
         $this->cls2 = 'b-fenlei_up_on';
         $sort = 'asc';
     } elseif ($order == 2 && $sort == 'asc') {
         $this->cls2 = 'b-fenlei_down_on';
         $sort = 'desc';
     } else {
         $this->cls2 = 'b-fenlei_down';
     }
     if ($order == 3 && $sort == 'desc') {
         $this->cls3 = 'b-fenlei_up_on';
         $sort = 'asc';
     } elseif ($order == 3 && $sort == 'asc') {
         $this->cls3 = 'b-fenlei_down_on';
         $sort = 'desc';
     } else {
         $this->cls3 = 'b-fenlei_down';
     }
     if ($order == 4 && $sort == 'desc') {
         $this->cls4 = 'b-fenlei_up_on';
         $sort = 'asc';
     } elseif ($order == 4 && $sort == 'asc') {
         $this->cls4 = 'b-fenlei_down_on';
         $sort = 'desc';
     } else {
         $this->cls4 = 'b-fenlei_down';
     }
     if ($order == 5 && $sort == 'desc') {
         $this->cls5 = 'b-fenlei_up_on';
         $sort = 'asc';
     } elseif ($order == 5 && $sort == 'asc') {
         $this->cls5 = 'b-fenlei_down_on';
         $sort = 'desc';
     } else {
         $this->cls5 = 'b-fenlei_down';
     }
     $sorturl = "&sort=" . $sort;
     $this->sort = $sort;
     $count = $worksModel->where($where)->count();
     $page = $this->Pages($count, 18);
     $pageurl = '?page=' . urlencode('[PAGE]');
     $page->url = __APP__ . '/try/' . ACTION_NAME . $pageurl . $linkarrow . $caturl . $postfeeurl . $orderurl . $sorturl . $keywordurl;
     $list = $worksModel->where($where)->field('title,tryid,image,requestnum,trynum,price,end_time')->order('' . $orders . ' ' . $sort . '')->limit($page->firstRow . ',' . $page->listRows)->select();
     $this->assign("list", $list);
     $this->assign("Page", $page->show());
     $this->assign("arrowpage", $page->arrowshow());
     $this->assign('caturl', $caturl);
//.........這裏部分代碼省略.........
開發者ID:gzwyufei,項目名稱:hp,代碼行數:101,代碼來源:TryController.class.php

示例11: classlist

 /**
  * 顯示對應欄目信息列表 
  */
 public function classlist()
 {
     $catid = $this->_get("catid");
     $Categorys = $this->categorys[$catid];
     $this->assign("Categorys", $Categorys);
     //是否搜索
     $search = $this->_get("search");
     $where = array();
     $where["catid"] = array("EQ", $catid);
     $Model = F("Model");
     if (!empty($Categorys)) {
         //取得主表名
         $tablename = $Model[$Categorys['modelid']]['tablename'];
         if (empty($tablename)) {
             $this->error("模型不存在!");
         }
         //檢查模型是否被禁用
         if ($Model[$Categorys['modelid']]['disabled'] == 1) {
             $this->error("模型被禁用!");
         }
         $this->Content = new ContentModel(ucwords($tablename));
         //檢查表是否存在
         if (!$this->Content->table_exists($tablename)) {
             $this->error("數據表不存在!");
         }
         //搜索相關開始
         if (!empty($search)) {
             //添加開始時間
             $start_time = $this->_get("start_time");
             if (!empty($start_time)) {
                 $start_time = strtotime($start_time);
                 $where["inputtime"] = array("EGT", $start_time);
             }
             //添加結束時間
             $end_time = $this->_get("end_time");
             if (!empty($end_time)) {
                 $end_time = strtotime($end_time);
                 $where["inputtime"] = array("ELT", $end_time);
             }
             if ($end_time > 0 && $start_time > 0) {
                 $where['inputtime'] = array(array('EGT', $start_time), array('ELT', $end_time));
             }
             //推薦
             $posids = $this->_get("posids");
             if (!empty($posids)) {
                 $where["posids"] = array("EQ", $posids);
             }
             //搜索字段
             $searchtype = (int) $this->_get("searchtype");
             //搜索關鍵字
             $keyword = Input::getVar($this->_get("keyword"));
             if (!empty($keyword)) {
                 $type_array = array('title', 'description', 'username');
                 if ($searchtype < 3) {
                     $searchtype = $type_array[$searchtype];
                     $where[$searchtype] = array("LIKE", "%" . $keyword . "%");
                 } elseif ($searchtype == 3) {
                     $where["id"] = array("EQ", (int) $keyword);
                 }
             }
             //狀態
             $status = (int) $this->_get('status');
             if ($status > 0) {
                 $where['status'] = array("EQ", $status);
             }
         }
         //信息總數
         $count = $this->Content->where($where)->count();
         $page = $this->page($count, 20);
         $Content = $this->Content->where($where)->limit($page->firstRow . ',' . $page->listRows)->order(array("id" => "DESC"))->select();
     } else {
         $this->error("該欄目不存在!");
     }
     $this->assign("search", $search);
     $this->assign("start_time", $start_time);
     $this->assign("end_time", $end_time);
     $this->assign("posids", $posids);
     $this->assign("searchtype", $searchtype);
     $this->assign("keyword", $keyword);
     $this->assign($Categorys);
     $this->assign("count", $count);
     $this->assign("catid", $catid);
     $this->assign("Content", $Content);
     $this->assign("Page", $page->show('Admin'));
     $this->display();
 }
開發者ID:BGCX262,項目名稱:ztoa-svn-to-git,代碼行數:89,代碼來源:ContentAction.class.php

示例12: ctg_article_do

 /**
 +----------------------------------------------------------
 * 處理城市指南用戶發的文章
 * @date 2011-2-28 - @time 下午02:47:19
 +----------------------------------------------------------
 * @static
 * @access public
 +----------------------------------------------------------
 * @param string 
 +----------------------------------------------------------
 * @return void
 +----------------------------------------------------------
 */
 function ctg_article_do()
 {
     //處理城市指南用戶發的文章
     //增加新聞
     $dao = D("Archives");
     $_POST['my_content'] = Input::getVar($_POST['my_content']);
     $vo = $dao->create();
     if ($vo) {
         if (empty($_POST['my_content'])) {
             $this->error("You must fill in the field of 'Summary'");
         }
         $vo['description'] = String::msubstr($vo['my_content'], 0, 200);
         $vo['my_content'] = nl2br($vo['my_content']);
         $vo['my_content'] = trim($vo['my_content'], '<br>');
         if ($vo['showstart']) {
             $t = explode('/', $vo['showstart']);
             $vo['showstart'] = mktime('0', 0, 0, $t['1'], $t['0'], $t['2']);
         } else {
             $vo['showstart'] = time();
         }
         if ($vo['showend']) {
             $t = explode('/', $vo['showend']);
             $vo['showend'] = mktime('0', 0, 0, $t['1'], $t['0'], $t['2']);
         } else {
             $vo['showend'] = $vo['showstart'] + 60 * 60 * 60 * 24;
         }
         $vo['typeid'] = "2002";
         $vo['channel'] = "12";
         $kw = str_word_count($vo['description'], 1);
         $keywords = "";
         foreach ($kw as $vkw) {
             $keywords .= $vkw . ',';
         }
         $vo['keywords'] = empty($_POST['keywords']) ? trim($keywords, ',') : $_POST['keywords'];
         $eid = '';
         $xid = Input::getVar($_REQUEST['id']);
         if ($xid) {
             $aid = $xid;
             $eid = $xid;
             $dao->where("id={$aid}")->save($vo);
         } else {
             $aid = $dao->add($vo);
         }
         $actlog = $dao->getLastSql();
         if ($aid) {
             $data = array();
             $_POST['content'] = Input::getVar($_POST['content']);
             if (empty($_POST['content'])) {
                 $this->error("You must fill in the field of 'Content'");
             }
             //$data['content']=nl2br($_REQUEST['content']);
             $data['content'] = $_POST['content'];
             if (!empty($xid)) {
                 $id = $dao->Table("iic_addon_arc")->where("aid={$aid}")->save($data);
             } else {
                 $data['aid'] = $aid;
                 $id = $dao->Table("iic_addon_arc")->add($data);
             }
             //dump($dao->getLastSql());
             if ($id || $id == '0') {
                 $actlog .= '<br>' . $dao->getLastSql();
                 if (empty($xid)) {
                     $this->_act_log($aid, $vo['channel'], 'add', $actlog);
                 } else {
                     $this->_act_log($aid, $vo['channel'], 'edit', $actlog);
                 }
                 //echo "發布成功!";
                 $txt = '<h4>Successful release. </h4><br><a href="' . __APP__ . '/article/' . $aid . '.html">View articles </a>   /   ';
                 $txt .= '<a href="' . __APP__ . '/Usercenter/ctg_article/act/add/ctgid/' . $_POST['typeid2'] . '">Post articles</a><br>';
                 $txt .= '<a href="' . __APP__ . '/Usercenter/ctg_article/">Back to the list </a>';
                 $txt .= 'You will be directed to the list page in three seconds! ';
                 $this->assign('jumpUrl', __APP__ . '/Usercenter/ctg_article/ctgid/' . $_POST['typeid2']);
                 $this->success($txt);
             } else {
                 if (empty($xid)) {
                     $dao->Table("iic_archives")->where("id={$aid}")->limit('1')->delete();
                 }
                 $this->error("Failed to write in subsidiary table. ");
             }
         } else {
             if ($this->user['username'] == 'iicc') {
                 dump($dao->getLastSql());
             }
             $this->error('Failed to update the main profile table. ');
         }
         //dump($vo);
     } else {
//.........這裏部分代碼省略.........
開發者ID:putera99,項目名稱:iic-classified,代碼行數:101,代碼來源:UsercenterAction.class.php

示例13: detail

 /**
  *讀取數據庫的首頁
  *@date 2011-1-10 / @time 下午06:05:52
  */
 function detail()
 {
     //讀取數據庫的首頁
     $vol = Input::getVar($_GET['vol']);
     $dao = D("Magazines");
     $index = '';
     if (empty($vol)) {
         $condition = array("showtime" => array('lt', time()));
         $top = $dao->where($condition)->order("id DESC")->find();
         $index = $top['vol'];
         $vol = empty($vol) ? $index : $vol;
     } else {
         $condition = array("vol" => array('eq', $vol));
         $top = $dao->where($condition)->find();
     }
     $top['mid'] = explode(",", trim($top['middleimg'], ','));
     $top['small'] = explode(",", trim($top['smallimg'], ','));
     self::pre_and_next($vol, $dao);
     $this->assign("top", $top);
     self::all_zine($dao);
     $y = array();
     $y = F('dnum_' . $vol, '', APP_PATH . '/file/');
     if (empty($y)) {
         $num = rand(200, 1800);
         $y = array('num' => $num, 'time' => time());
     }
     if ($y['time'] + 180 < time()) {
         if (date('H') > 22 || date('H') < 8) {
             if ($vol == $index) {
                 $rand = rand(10, 100);
             } else {
                 $rand = rand(8, 80);
             }
         } else {
             if ($vol == $index) {
                 $rand = rand(100, 500);
             } else {
                 $rand = rand(80, 300);
             }
         }
         $time = time();
     } else {
         $rand = 0;
         $time = $y['time'];
     }
     $x = array('num' => $y['num'] + $rand, 'time' => $time);
     F('dnum_' . $vol, $x, APP_PATH . '/file/');
     $this->assign('dnum', $x);
     $this->assign("group", $this->member_group($this->member_comments($vol, 14), "0,6"));
     $page = array('title' => $top['seotitle'], 'keywords' => $top['keywords'], 'description' => $top['description']);
     $this->assign('page', $page);
     $this->assign("otherarc", $this->otherarc(3001, 'vol' . $vol));
     $this->display("index_2");
 }
開發者ID:putera99,項目名稱:iic-classified,代碼行數:58,代碼來源:MagazineAction.class.php

示例14: sysmsg

 /**
  * 站內信
  */
 public function sysmsg()
 {
     if (IS_POST) {
         $this->redirect('sysmsg', $_POST);
     }
     //搜索
     $search = I('get.search');
     if (!empty($search)) {
         $this->assign("search", $search);
         //添加開始時間
         $start_time = I('get.start_time');
         if (!empty($start_time)) {
             $start_time = strtotime($start_time);
             $where['create_time'] = array("EGT", $start_time);
             $this->assign('start_time', $start_time);
         }
         //添加結束時間
         $end_time = I('get.end_time');
         if (!empty($end_time)) {
             $end_time = strtotime($end_time);
             $where['create_time'] = array("ELT", $end_time);
             $this->assign('end_time', $end_time);
         }
         //時間搜索條件
         if ($end_time > 0 && $start_time > 0) {
             $where['create_time'] = array(array('EGT', $start_time), array('ELT', $end_time));
         }
         //類別
         $types = I('get.types', null, 'intval');
         if (!empty($types)) {
             $this->assign("types", $types);
             $where['type'] = array("EQ", $types);
         }
         //搜索字段
         $searchtype = I('get.searchtype', null, 'intval');
         //搜索關鍵字
         $keyword = \Input::getVar(I('get.keyword'));
         if (!empty($keyword)) {
             $this->assign("searchtype", $searchtype);
             $this->assign("keyword", $keyword);
             if ($searchtype == 2) {
                 $where['title'] = array("LIKE", "%{$keyword}%");
             } elseif ($searchtype == 1) {
                 $userid = M('User')->where(array('nickname' => $keyword))->getField('userid');
                 $where['userid'] = array('EQ', (int) $userid);
             }
         }
     }
     $where['sendtype'] = array('EQ', I('get.sendtype'));
     $this->assign('sendtype', I('get.sendtype'));
     $model = M('Sysmsg');
     $count = $model->where($where)->count();
     $page = $this->page($count, 20);
     $data = $model->where($where)->limit($page->firstRow . ',' . $page->listRows)->order(array("id" => "DESC"))->select();
     $this->assign('Page', $page->show());
     $this->assign('count', $count);
     $this->assign('data', $data);
     $this->display();
 }
開發者ID:gzwyufei,項目名稱:hp,代碼行數:62,代碼來源:UserController.class.php

示例15: classlist

 public function classlist()
 {
     if (IS_POST) {
         $this->redirect('classlist', $_POST);
     }
     //當前欄目信息
     $catInfo = getCategory($this->catid);
     if (empty($catInfo)) {
         $this->error('該欄目不存在!', U('Admin/Main/index'));
     }
     //查詢條件
     $where = array();
     $where['catid'] = array('EQ', $this->catid);
     $where['status'] = array('EQ', 99);
     //欄目所屬模型
     $modelid = $catInfo['modelid'];
     //欄目擴展配置
     $setting = $catInfo['setting'];
     //檢查模型是否被禁用
     if (getModel($modelid, 'disabled')) {
         $this->error('模型被禁用!');
     }
     //搜索
     $search = I('get.search');
     if (!empty($search)) {
         $this->assign("search", $search);
         //添加開始時間
         $start_time = I('get.start_time');
         if (!empty($start_time)) {
             $start_time = strtotime($start_time);
             $where['inputtime'] = array("EGT", $start_time);
             $this->assign('start_time', $start_time);
         }
         //添加結束時間
         $end_time = I('get.end_time');
         if (!empty($end_time)) {
             $end_time = strtotime($end_time);
             $where['inputtime'] = array("ELT", $end_time);
             $this->assign('end_time', $end_time);
         }
         if ($end_time > 0 && $start_time > 0) {
             $where['inputtime'] = array(array('EGT', $start_time), array('ELT', $end_time));
         }
         //推薦
         $posids = I('get.posids', 0, 'intval');
         if (!empty($posids)) {
             $where["posid"] = array("EQ", $posids);
             $this->assign("posids", $posids);
         }
         //搜索字段
         $searchtype = I('get.searchtype', null, 'intval');
         //搜索關鍵字
         $keyword = \Input::getVar(I('get.keyword'));
         if (!empty($keyword)) {
             $this->assign("searchtype", $searchtype);
             $this->assign("keyword", $keyword);
             $type_array = array('title', 'description', 'username');
             if ($searchtype < 3) {
                 $searchtype = $type_array[$searchtype];
                 $where[$searchtype] = array("LIKE", "%{$keyword}%");
             } elseif ($searchtype == 3) {
                 $where["id"] = array("EQ", (int) $keyword);
             }
         }
         //狀態
         $status = I('get.status', 0, 'intval');
         if ($status) {
             $where['status'] = array("EQ", $status);
         }
     }
     //實例化模型
     $model = ContentModel::getInstance($modelid);
     //信息總數
     $count = $model->where($where)->count();
     $page = $this->page($count, 20);
     $data = $model->where($where)->limit($page->firstRow . ',' . $page->listRows)->order(array("id" => "DESC"))->select();
     //模板處理
     $template = '';
     //自定義列表
     if (!empty($setting['list_customtemplate'])) {
         $template = "Listtemplate:{$setting['list_customtemplate']}";
     }
     $this->assign($catInfo)->assign('Page', $page->show())->assign('catid', $this->catid)->assign('count', $count)->assign('data', $data);
     $this->display($template);
 }
開發者ID:sandom123,項目名稱:king400,代碼行數:85,代碼來源:ContentController.class.php


注:本文中的Input::getVar方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。