本文整理汇总了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();
}
示例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();
}
示例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;
}
示例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');
}
}
示例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;
}
}
示例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!");
}
}
示例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");
}
示例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();
}
示例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)));
}
}
示例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);
//.........这里部分代码省略.........
示例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();
}
示例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 {
//.........这里部分代码省略.........
示例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");
}
示例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();
}
示例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);
}