diff --git a/Application/Admin/Controller/CheckController.class.php b/Application/Admin/Controller/CheckController.class.php index 68a066a..2409b19 100644 --- a/Application/Admin/Controller/CheckController.class.php +++ b/Application/Admin/Controller/CheckController.class.php @@ -12,9 +12,24 @@ use Think\Controller; class CheckController extends Controller { + /** + * 导出漏洞报告 + */ + public function view(){ + $id = I('get.session_id'); + $model = M('post')->where('visible=1')->where(array('session'=>$id))->find(); + $arr['id']= $model['id']; + $arr['title']= $model['title']; + $arr['content']= $model['content']; + $arr['advise']= $model['advise']; + $arr['time']= $model['time']; + $arr['type']= $model['type']; + $this->ajaxReturn ($arr,'JSON'); + } + /** * 临时查看漏洞报告 - */ + public function view(){ $id = I('get.session_id',0,'number_int'); //seesion token防注入 $model = M('post')->where('session='.$id)->find(); @@ -23,9 +38,12 @@ class CheckController extends Controller $this->assign('model',$model); $this->display(); } + */ + + + /** * 添加漏洞处理进展 - */ public function add() { //默认显示添加表单 @@ -46,4 +64,5 @@ class CheckController extends Controller } } } + */ } diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index 0ff9701..b5f5fb6 100644 --- a/Application/Admin/Controller/MemberController.class.php +++ b/Application/Admin/Controller/MemberController.class.php @@ -115,13 +115,21 @@ class MemberController extends BaseController } /** * 删除用户 - * @param [type] $id [管理员ID] */ public function delete() { $id = I('get.id',0,'intval'); $model = M('member'); - if($model->where('id='.$id)->delete()){ + $data['username'] = '[已删除]'; + $data['realname'] = '[已删除]'; + $data['email'] = '0'; + $data['salt'] = '0'; + $data['passwd'] = '0'; + $data['team'] = '[已删除]'; + $data['description'] = '[已删除]'; + $data['website'] = '[已删除]'; + $data['status'] = 1; + if($model->where('id='.$id)->save($data)){ $this->success("用户删除成功", U('member/index')); }else{ $this->error("用户删除失败"); diff --git a/Application/Admin/Controller/PostController.class.php b/Application/Admin/Controller/PostController.class.php index 03d9dba..18f11cc 100644 --- a/Application/Admin/Controller/PostController.class.php +++ b/Application/Admin/Controller/PostController.class.php @@ -178,23 +178,63 @@ class PostController extends BaseController /** * 生成session key + **/ - public function session(){ - $id = I('get.id',0,'intval'); - $str = '1234567890'; - $session = $str[rand(0,10)].$str[rand(0,10)].$str[rand(0,10)].$str[rand(0,10)].$str[rand(0,10)].$str[rand(0,10)].$str[rand(0,10)].$str[rand(0,10)].$str[rand(0,10)].$str[rand(0,10)].$str[rand(0,10)].$str[rand(0,10)].$str[rand(0,10)].$str[rand(0,10)].$str[rand(0,10)].$str[rand(0,10)].$str[rand(0,10)].$str[rand(0,10)].$str[rand(0,10)].$str[rand(0,10)].$str[rand(0,10)]; + public function session(){ + $id = I('get.id'); + $str = '1234567890abcdefg'; + $session = $str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)].$str[rand(0,17)]; $visible = 1; $model = M('post'); $model->session = $session; $model->visible = $visible; - $result = $model->where('id='.$id)->save(); + $result = $model->where(array('id'=>$id))->save(); if($result){ - $this->success("授权成功", U('Check/view?session_id='.$session)); + $this->success("授权成功", U('post/index')); }else{ $this->error("授权失败"); } } - */ + + + /** + * 取消导出 + **/ + + public function cancel(){ + $id = I('get.id'); + $visible = 0; + $model = M('post'); + $model->visible = $visible; + $result = $model->where(array('id'=>$id))->save(); + if($result){ + $this->success("取消成功", U('post/index')); + }else{ + $this->error("取消失败"); + } + } + + + /** + * 导出全部 + **/ + + public function portall(){ + $model = M('post')->field('id,title,content,advise,time,day,bounty')->limit(100)->select(); + set_time_limit(0); + ini_set('memory_limit', '512M'); + $output = fopen('php://output', 'w') or die("can't open php://output"); + $filename = "安全应急响应中心外部漏洞报告统计表" . date('Y-m-d', time()); + header("Content-Type: application/csv"); + header("Content-Disposition: attachment; filename=$filename.csv"); + $table_head = array('报告编号','报告名称','报告内容', '修复建议','提交时间','修补期限','漏洞奖励'); + fputcsv($output, $table_head); + foreach ($model as $e) { + fputcsv($output, array_values($e)); + } + fclose($output) or die("can't close php://output"); + exit; + } /** 添加报告评论 diff --git a/Application/Admin/View/Post/index.html b/Application/Admin/View/Post/index.html index 06f221f..12b8578 100644 --- a/Application/Admin/View/Post/index.html +++ b/Application/Admin/View/Post/index.html @@ -15,6 +15,16 @@
版本:v2.0.0-alpha.1. Code licensed MIT.
+ +版本:v2.2.0-final.1. Code licensed GPL.
+ 版本:v2.0.0-alpha.1. Code licensed MIT.
+ +版本:v2.2.0-final.1. Code licensed GPL.
+