public function del() { //验证用户权限 parent::userauth(63); if ($this->isAjax()) { if (!($delid = explode(',', $this->_post('delid')))) { R('Public/errjson', array('请选中后再删除')); } //将最后一个元素弹出栈 array_pop($delid); $id = join(',', $delid); $dmenu = M('dmenu'); if ($dmenu->delete("{$id}")) { parent::operating(__ACTION__, 0, '删除成功'); R('Public/errjson', array('ok')); } else { parent::operating(__ACTION__, 1, '删除失败:' . $dmenu->getError()); R('Public/errjson', array('删除失败')); } } else { parent::operating(__ACTION__, 1, '非法请求'); R('Public/errjson', array('非法请求')); } }
public function newsindel() { //验证用户权限 parent::userauth(51); if ($this->isAjax()) { if (!($delid = explode(',', I('post.delid', '')))) { R('Public/errjson', array('请选中后再删除')); } //将最后一个元素弹出栈 array_pop($delid); $id = join(',', $delid); $news = M('news'); if ($news->delete("{$id}")) { parent::operating(__ACTION__, 0, '删除成功'); R('Public/errjson', array('ok')); } else { parent::operating(__ACTION__, 1, '删除失败'); R('Public/errjson', array('删除失败')); } } else { parent::operating(__ACTION__, 1, '非法请求'); R('Public/errjson', array('非法请求')); } }
public function roledel() { //验证用户权限 parent::userauth(10); //判断是否是ajax请求 if ($this->isAjax()) { if (I('post.post', '') == 'ok') { $id = I('post.id', ''); if ($id == '' || !is_numeric($id)) { parent::operating(__ACTION__, 1, '参数错误'); R('Public/errjson', array('参数ID类型错误')); } else { $id = intval($id); if ($id == 1) { parent::operating(__ACTION__, 1, '不能删除系统默认角色'); R('Public/errjson', array('不能删除此角色')); } $role = M('role'); $where = array('ID' => $id); if ($role->where($where)->getField('ID')) { $role->where($where)->delete(); parent::operating(__ACTION__, 0, '删除成功'); R('Public/errjson', array('ok')); } else { parent::operating(__ACTION__, 1, '数据不存在:' . $id); R('Public/errjson', array('数据不存在')); } } } else { parent::operating(__ACTION__, 1, '非法请求'); R('Public/errjson', array('非法请求')); } } else { parent::operating(__ACTION__, 1, '非法请求'); R('Public/errjson', array('非法请求')); } }
public function in_user_del() { //验证用户权限 parent::userauth(5); if ($this->isAjax()) { if (!($delid = explode(',', I('post.delid', '')))) { R('Public/errjson', array('请选中后再删除')); } //将最后一个元素弹出栈 array_pop($delid); if (in_array(1, $delid)) { R('Public/errjson', array('不能删除ID号为1的数据')); } $id = join(',', $delid); $user = M('user'); if ($user->delete("{$id}")) { parent::operating(__ACTION__, 0, '批量删除ID为:' . $id . '的数据'); R('Public/errjson', array('ok')); } else { parent::operating(__ACTION__, 1, '批量删除用户失败:' . $user->getError()); R('Public/errjson', array($user->getError())); } } else { parent::operating(__ACTION__, 1, '非法请求'); R('Public/errjson', array('非法请求')); } }
public function systemwebsite_do() { //验证用户权限 parent::userauth2(53); if ($this->isPost()) { $config = $_POST; $settingstr = "<?php \n return array(\n"; foreach ($config as $key => $val) { $settingstr .= "\t'" . $key . "'=>'" . $val . "',\n"; } $settingstr .= "\n);\n?>"; if (file_put_contents(CONF_PATH . 'webconfig.php', $settingstr, FILE_USE_INCLUDE_PATH)) { parent::operating(__ACTION__, 0, '网站配置文件修改成功'); $this->success('修改成功', 'systemwebsite', 2); } else { parent::operating(__ACTION__, 1, '网站配置文件修改失败'); $this->error('修改失败,可能是由于没有写入权限导致。'); } } else { parent::operating(__ACTION__, 1, '非法请求'); $this->error('非法请求'); } }
public function filemovedo() { parent::userauth(39); $moveid = I('post.moveid', ''); $sid = I('post.sid', ''); //切割文件ID $arrid = explode(',', $moveid); array_pop($arrid); //判断目录ID是否正确 if ($sid != '' && is_numeric($sid)) { $file = M('file'); $data['Sid'] = $sid; //循环更新对应文件目录 for ($i = 0; $i < count($arrid); $i++) { if (!$file->where('ID=' . $arrid[$i])->save($data)) { //失败直接返回 parent::operating(__ACTION__, 1, '文件移动失败'); R('Public/errjson', array('文件移动失败')); } } parent::operating(__ACTION__, 0, '文件移动成功'); R('Public/errjson', array('ok')); } else { parent::operating(__ACTION__, 1, '目录ID获取失败'); R('Public/errjson', array('目录ID获取失败')); } }
public function cdel() { //验证用户权限 parent::userauth(15); //判断是否是ajax请求 if ($this->isAjax()) { if (I('post.post', '') == 'ok') { $id = I('post.id', ''); if ($id == '' || !is_numeric($id)) { parent::operating(__ACTION__, 1, '参数错误'); R('Public/errjson', array('参数ID类型错误')); } else { $id = intval($id); $role = M('competence'); $where = array('ID' => $id, 'Sid' => $id, '_logic' => 'OR'); if ($role->where("ID={$id}")->getField('ID')) { $role->where($where)->delete(); parent::operating(__ACTION__, 0, '删除成功'); R('Public/errjson', array('ok')); } else { parent::operating(__ACTION__, 1, '删除失败'); R('Public/errjson', array('数据不存在')); } } } else { parent::operating(__ACTION__, 1, '非法请求'); R('Public/errjson', array('非法请求')); } } else { parent::operating(__ACTION__, 1, '非法请求'); R('Public/errjson', array('非法请求')); } }
public function with_indel() { //验证用户权限 parent::userauth(81); if ($this->isAjax()) { if (!($delid = explode(',', I('post.delid', '')))) { R('Public/errjson', array('请选中后再删除')); } //将最后一个元素弹出栈 array_pop($delid); $id = join(',', $delid); $with = M('with'); $co['ID'] = array('in', $id); if ($with->delete("{$id}")) { parent::operating(__ACTION__, 0, '删除成功'); R('Public/errjson', array('ok')); } else { parent::operating(__ACTION__, 1, '删除失败'); R('Public/errjson', array('删除失败')); } } else { parent::operating(__ACTION__, 1, '非法请求'); $this->error('非法请求'); } }
public function indel() { //验证用户权限 parent::userauth(20); if ($this->isAjax()) { if (!($delid = explode(',', $this->_post('delid')))) { R('Public/errjson', array('请选中后再删除')); } //将最后一个元素弹出栈 array_pop($delid); $id = join(',', $delid); $log = M('loginlog'); if ($log->delete("{$id}")) { parent::operating(__ACTION__, 0, '登录日志删除成功'); R('Public/errjson', array('ok')); } else { parent::operating(__ACTION__, 1, '登录日志删除失败'); R('Public/errjson', array('删除失败')); } } else { parent::operating(__ACTION__, 1, '非法请求'); R('Public/errjson', array('非法请求')); } }
public function client_c_indel() { //验证用户权限 parent::userauth(76); if ($this->isAjax()) { if (!($delid = explode(',', I('post.delid', '')))) { R('Public/errjson', array('请选中后再删除')); } //将最后一个元素弹出栈 array_pop($delid); $id = join(',', $delid); $client = M('client'); $contact = M('contact'); $co['Cid'] = array('in', $id); if ($client->delete("{$id}")) { $contact->where($co)->delete(); parent::operating(__ACTION__, 0, '删除成功'); R('Public/errjson', array('ok')); } else { parent::operating(__ACTION__, 1, '删除失败'); R('Public/errjson', array('删除失败')); } } else { parent::operating(__ACTION__, 1, '非法请求'); R('Public/errjson', array('非法请求')); } }