/** * 增加模型展示页面 默认页面aad.html * @author gongfei * @access public * @return */ public function add() { checkPower('33'); $this->assign('action_name', '增加'); $this->assign('action_code', 'addModule'); $this->display(); }
/** * 检查权限. * * @access public * {@inheritDoc} * @see \YbirdsAdmin\Controller\CommonController::_initialize() */ public function _initialize() { parent::_initialize(); checkPower('12'); }
$log_level = LOG__NONE; // possible output strings $criticals = ""; $warnings = ""; $unknowns = ""; $normals = ""; // set default values for command line arguments $cmdargs = ['port' => '161', 'log_level' => LOG__NONE, 'memwarn' => 80, 'memcrit' => 90, 'reboot' => 3600, 'thres-cpu-1sec' => '95,98', 'thres-cpu-5sec' => '85,95', 'thres-cpu-1min' => '70,90']; // parse the command line arguments parseArguments(); //print_r( $cmdargs ); die(); require 'OSS_SNMP/OSS_SNMP/SNMP.php'; $snmp = new \OSS_SNMP\SNMP($cmdargs['host'], $cmdargs['community']); checkCPU(); checkReboot(); checkPower(); checkFans(); checkTemperature(); checkMemory(); checkOthers(); if ($status == STATUS_OK) { $msg = "OK -{$normals}\n"; } else { $msg = "{$criticals}{$warnings}{$unknowns}\n"; } echo $msg; exit($status); /** * Checks the chassis temperature * */
/** * 新增分类 * @author liuxiaolin <*****@*****.**> * @access public * @param $post * @return void */ public function addAction() { checkPower('18'); $name = I('post.name'); $fid = I('post.fid'); $seoKey = I('post.seoKey'); $seoDesc = I('post.seoDesc'); $index_tpl = I('post.index_tpl'); $list_tpl = I('post.list_tpl'); $detail_tpl = I('post.detail_tpl'); $priceData = array(); //存储价格数据 $mark = I('post.mark'); //栏目标记 //如果不是终极分类,则将模型ID设置为0,表示不属于任何模型 if (I('post.type') == 'y') { $type = 0; $mid = I('post.mid'); if (empty($mid)) { $this->error('请选择模型'); } $priceData['price1'] = number_format(I('post.price1'), 2, '.', ''); $priceData['price2'] = number_format(I('post.price2'), 2, '.', ''); $priceData['price3'] = number_format(I('post.price3'), 2, '.', ''); $priceData['price4'] = number_format(I('post.price4'), 2, '.', ''); $status1 = preg_match('/^\\d+(\\.\\d+)?$/', $priceData['price1']); $status2 = preg_match('/^\\d+(\\.\\d+)?$/', $priceData['price2']); $status3 = preg_match('/^\\d+(\\.\\d+)?$/', $priceData['price3']); $status4 = preg_match('/^\\d+(\\.\\d+)?$/', $priceData['price4']); if (!$status1 || !$status2 || !$status3 || !$status4) { $this->error('请填写正确的推广价格', U('YbirdsAdmin/Category/add')); } } else { $type = 1; $mid = 0; } $name = trim($name); //判断输入是否为空 if (empty($name)) { $this->error('输入栏目名称为空,请重新输入'); } //判断输入是否为空 if (empty($mark)) { $this->error('请选择所属国家'); } $data = array(); //构建写入分类栏目的数据 $model = M('ctgClass'); //生成要插入的数据 $data = array('ctgClassName' => $name, 'fctgClassID' => $fid, 'modID' => $mid, 'type' => $type, 'level' => 1, 'seoKey' => $seoKey, 'seoDesc' => $seoDesc, 'index_tpl' => $index_tpl, 'list_tpl' => $list_tpl, 'detail_tpl' => $detail_tpl, 'mark' => $mark); $model = M('CtgClass'); $model->startTrans(); $res1 = $model->data($data)->add(); $priceData['classID'] = $res1; $res2 = M('ctg_price')->data($priceData)->add(); if ($res1 !== FALSE && $res2 !== FALSE) { $model->commit(); operateLog('创建分类"' . $name . '"成功!', 4); $this->success('创建分类"' . $name . '"成功!', U('YbirdsAdmin/Category/index')); } else { $model->rollback(); $this->error('创建分类"' . implode(' ', $name) . '"失败!'); } }
function handlePower($powerName) { if (checkPower($powerName) == false) { Eerr('提示', '你没有【' . $powerName . '】权限,<a href=\'javascript:history.go(-1);\'>点击返回</a>'); } }
/** * 管理的所有已上线的广告 * * @author kylin <*****@*****.**> * @param void * @access public * @return void */ public function adminAdvInfo() { checkPower('36'); $model = M('ad_info'); $search = I('get.'); if ($search['aid']) { $where['a.aid'] = substr($search['aid'], 3); } if ($search['title']) { $where['c.title'] = array('like', "%" . $search['title'] . "%"); } if ($search['userName']) { $where['u.userName'] = array('like', "%" . $search['userName'] . "%"); } if ($search['page']) { $where['c.page'] = array('like', "%" . $search['page'] . "%"); } //广告类型 switch ($search['type']) { case '1': $where['c.type'] = 1; break; case '2': $where['c.type'] = 2; break; } //投放国家 if ($search['name']) { $where['d.name'] = array('like', "%" . $search['name'] . "%"); } //起止时间 if ($search['beginTime']) { $where['a.beginTime'] = array('egt', strtotime($search['beginTime'])); } if ($search['endTime']) { $where['a.endTime'] = array('elt', strtotime($search['endTime'])); } //购买时长 if ($search['num']) { $where['a.num'] = $search['num']; } $field = 'a.id, a.aid, a.beginTime, a.endTime, a.adContent,a.price, a.status, a.num, c.type, c.page, c.title, c.width, c.height, d.name,u.userName'; $join = array('LEFT JOIN __AD_ALL__ AS b on a.aid = b.id', 'LEFT JOIN __AD_POSITION__ AS c on b.pid = c.id', 'LEFT JOIN __AD_COUNTRY__ AS d on b.gid = d.gid', 'LEFT JOIN __USER__ AS u on u.userID = a.uid'); $where['a.status'] = 2; $count = $model->alias('a')->join($join)->where($where)->count(); $page = new \Think\Page($count, 25); $show = $page->show(); $data = $model->alias('a')->field($field)->join($join)->where($where)->limit($page->firstRow . ', ' . $page->listRows)->select(); $this->assign('search', $search); $this->assign('data', $data); $this->assign('page', $show); $this->display(); }
public function cancelMailList($list_id, $user_id) { $cancelsql = "UPDATE `mail_user_list`\n\t\t\t\t\t\t SET `user_isdelete`=1\n\t\t\t\t\t\t WHERE `user_list_id`='{$list_id}'\n\t\t\t\t\t\t AND `user_name_id` = '{$user_id}'"; $result = $this->dbconn->query($cancelsql); //更新memcache $memret = checkPower($list_id); mem($memname, $memret); return $result; }
public function gag() { checkPower('42'); $uid = $data['uid'] = I('get.uid'); $data['type'] = I('get.type'); //$data['reason'] = I('get.reason'); $data['c_uid'] = session('adminUserID'); $data['create_time'] = time(); $modelGroup = M('group'); $gid = $modelGroup->where(array('groupName' => '黑名单'))->getField('groupID'); $reasonList = array('1' => '内容重复', '2' => '标题中含有特殊字符', '3' => '内容与板块不符合', '4' => '文中含微信二维码', '5' => '虚假诈骗内容', '6' => '违法违规内容', '7' => '被用户举报'); //把用户放在黑名单组 M('user')->where(array('userID' => $uid))->setField(array('groupID' => $gid)); //给用户发送邮件提醒 $info = M('user')->where(array('userID' => $uid))->find(); $email = $info['email']; $username = $info['userName']; $subject = file_get_contents('./cron/sendGapEmail.html'); $subject = str_replace('{$name}', $username, $subject); $subject = str_replace('{$type}', $reasonList[$data['type']], $subject); M('gag')->data($data)->add(); if ($email) { if (IS_CGI === 1) { $pid = pcntl_fork(); if ($pid == 0) { $pid = pcntl_fork(); if (0 < $pid) { $id = posix_getpid(); posix_kill($id, SIGHUP); exit(0); } elseif ($pid == 0) { @send_email($email, '英鸟系统通知[No Reply]', $subject); $id = posix_getpid(); posix_kill($id, SIGHUP); exit(0); } } pcntl_wait($staus); } else { @send_email($email, '英鸟系统通知[No Reply]', $subject); } } //删除用户发布的所有信息 $numData = M('ctg_data')->field('dataID')->where(array('userID' => $uid))->select(); foreach ($numData as $value) { $this->verifyLog($value['dataID'], 0); } $res1 = M('ctg_data')->where(array('userID' => $uid))->setField('verify', 0); $res2 = M('sq_data')->where(array('userID' => $uid))->setField('verify', 0); operateLog('用户禁言,用户ID' . $uid, 1); if ($res1 !== false && $res2 !== false) { $result['status'] = true; $result['message'] = '禁言成功,所有该用户发送的帖子设置成未审核'; } else { $result['status'] = false; $result['message'] = '禁言失败'; } $this->ajaxReturn($result, 'json'); }
/** * @查看后台操作日志 * @Author: 段涛 * @function name operateLog */ public function operateLog() { checkPower('40'); //对搜索内容进行处理 $showSearch['userID'] = I('get.userID'); if ($showSearch['userID'] != "") { $where['userID'] = $showSearch['userID']; } $showSearch['userName'] = I('get.userName'); if ($showSearch['userName'] != "") { $where['userName'] = $showSearch['userName']; } $showSearch['type'] = I('get.type'); if ($showSearch['type'] != "" && $showSearch['type'] != "99") { $where['type'] = $showSearch['type']; } $showSearch['timeStart'] = I('get.timeStart'); if ($showSearch['timeStart'] != "") { //当只有起始时间的时候,只查询大于等于目前这个时间的数据 $where['createTime'] = array('egt', strtotime($showSearch['timeStart'])); } $showSearch['timeEnd'] = I('get.timeEnd'); if ($showSearch['timeEnd'] != "") { //当只有结束时间的时候,只查询小于等于目前这个时间的数据 $where['createTime'] = array('elt', strtotime($showSearch['timeEnd'] + 1)); } if ($showSearch['timeEnd'] != "" && $showSearch['timeStart'] != "") { //当有起始和结束的时间,查时间之间的数据 $where['createTime'] = array('between', array(strtotime($showSearch['timeStart']), strtotime($showSearch['timeEnd']))); //时间范围 } $this->assign('showSearch', $showSearch); //对数据进行查询 $count = M('operate_log')->where($where)->count(); // 查询满足要求的总记录数 $Page = new \Think\Page($count, 15); // 实例化分页类 传入总记录数和每页显示的记录数(25) $show = $Page->show(); // 分页显示输出 $list = M('operate_log')->where($where)->order("id DESC")->limit($Page->firstRow . ',' . $Page->listRows)->select(); $this->assign('page', $show); // 赋值分页输出 $type = $this->operateType(); foreach ($list as $rs) { $key = $this->findId($type, $rs['type']); $rs['typeName'] = $type[$key]['name']; $allList[] = $rs; } $this->assign('list', $allList); $this->assign('listType', $this->operateType()); $this->display(); }