示例#1
0
 /**
  * 题库管理员密码重置
  * from 后台管理员批量导入
  */
 public function resetpwd()
 {
     $hash = $this->input->get('code');
     $admin_id = admin_email_hash('decode', $hash, 1800);
     $admin_id && ($admin = CpUserModel::get_cpuser($admin_id));
     if (!$admin) {
         message('重置链接已失效,请重新提交申请', 'admin/index/login');
     }
     if ($this->input->post('act') == 'submit') {
         $password = $this->input->post('password');
         $newpwd_confirm = $this->input->post('password_confirm');
         if (is_string($passwd_msg = is_password($password))) {
             message($passwd_msg);
         }
         if ($password != $newpwd_confirm) {
             message('您两次输入密码不一致,返回请确认!');
         }
         $this->db->update('admin', array('password' => my_md5($password)), array('admin_id' => $admin_id));
         message('您的新密码已设置成功.', 'admin/index/login', 'success');
     } else {
         // 模版
         $this->load->view('cpuser/resetpwd', array('hash' => $hash));
     }
 }
示例#2
0
 /**
  * 评估规则页面
  *
  * @return  void
  */
 public function index()
 {
     if (!$this->check_power('evaluate_rule_list,evaluate_rule_manage')) {
         return;
     }
     // 查询条件
     $query = array();
     $param = array();
     $search = array();
     $page = intval($this->input->get('page'));
     $page = $page ? $page : 1;
     $per_page = intval($this->input->get('per_page'));
     $per_page = $per_page ? $per_page : 15;
     $selectWhat = null;
     //拼接查询条件
     $query_exam_pid = $this->input->get('exam_pid');
     if ($query_exam_pid) {
         $query['exam_pid'] = trim($query_exam_pid);
         $search['exam_pid'] = $query_exam_pid;
         $param[] = "exam_pid={$query_exam_pid}";
     } else {
         $search['exam_pid'] = '';
     }
     $query_place_id = $this->input->get('place_id');
     if ($query_place_id) {
         $query['place_id'] = trim($query_place_id);
         $search['place_id'] = $query_place_id;
         $param[] = "place_id={$query_place_id}";
     } else {
         $search['place_id'] = '';
     }
     $query_subject_id = $this->input->get('subject_id');
     if ($query_subject_id) {
         $query['subject_id'] = trim($query_subject_id);
         $search['subject_id'] = $query_subject_id;
         $param[] = "subject_id={$query_subject_id}";
     } else {
         $search['subject_id'] = '';
     }
     $query_is_trash = (int) $this->input->get('trash');
     if ($query_is_trash) {
         $query['is_delete'] = '1';
         $search['trash'] = $query_is_trash;
         $param[] = "trash={$query_is_trash}";
     } else {
         $query['is_delete'] = '0';
     }
     // 按照时间排序,最新的在最前边
     $order = 'id desc';
     $result = EvaluateRuleModel::get_evaluate_rule_list($query, $page, $per_page, $order, $selectWhat);
     //附加信息
     $list = array();
     $this->load->model('cron/report/task_report_model');
     foreach ($result as &$item) {
         $exam_pid = $item['exam_pid'];
         $place_id = $item['place_id'];
         $subject_id = $item['subject_id'];
         $exam_name = ExamModel::get_exam($exam_pid, 'exam_name');
         $item['exam_name'] = !count($exam_name) ? '--' : $exam_name;
         $place_name = ExamPlaceModel::get_place($place_id, 'place_name');
         $item['place_name'] = !($place_name && count($place_name)) ? $place_id == 0 ? '所有考场' : '--' : $place_name;
         $item['subject_name'] = $subject_id > 0 ? SubjectModel::get_subject($subject_id, 'subject_name') : '总结';
         //关联一级知识点数量
         $item['count_knowledges'] = EvaluateRuleModel::count_knowledge_lists(array('er_id' => $item['id']), 'count(distinct(knowledge_id))');
         //检查该规则的生成报告状态
         $task = $this->task_report_model->get_task($item['id']);
         $item['task_status'] = isset($task['status']) ? $task['status'] : '-1';
         //检查考试期次是否生成成绩
         //if ($subject_id == 0)
         //{
         $exam_result = $this->db->select('status')->get_where('cron_task_exam_result', array('exam_pid' => $exam_pid))->row_array();
         if ($exam_result && $exam_result['status'] >= 1) {
             $item['is_exam_result'] = true;
         }
         //}
         //检查是否已生html页面
         $exist_html = $this->db->select('id')->get_where('rd_convert2pdf', array('rule_id' => $item['id'], 'html_status' => 1))->row_array();
         if ($exist_html) {
             $item['is_exist_html'] = true;
         }
         /* 面试报告状态 1.未关联评分标准不显示生成面试结果按钮 2.正在处理状态 3.生成完毕,显示查看生成报告按钮*/
         /* rd_evaluation_standard_exam 评分标准关联考试期次 1 */
         $sql = "select id from {pre}evaluation_standard_exam where exam_id={$exam_pid}";
         $interview_result = $this->db->query($sql)->row_array();
         if ($interview_result && !empty($interview_result)) {
             $item['is_interview'] = true;
             /* rd_cron_interview_task_report 报告生成结果 1:正在处理 2:部分处理完成 3:全部处理完成 */
             $sql = "select status from {pre}cron_interview_task_report where rule_id={$item['id']}";
             $interview_task_status = $this->db->query($sql)->row_array();
             $item['interview_task_status'] = isset($interview_task_status['status']) ? $interview_task_status['status'] : '-1';
         }
         //添加管理员信息
         $item['admin_name'] = CpUserModel::get_cpuser($item['admin_id'], 'realname');
         $list[] = $item;
     }
     // 分页
     $purl = site_url('admin/evaluate_rule/index/') . (count($param) ? '?' . implode('&', $param) : '');
     $total = EvaluateRuleModel::count_lists($query);
     $data['pagination'] = multipage($total, $per_page, $page, $purl);
     $data['detail'] =& $search;
     $data['list'] =& $list;
     $data['comparison_levels'] = C('evaluate_comparison_level');
     $data['priv_manage'] = $this->check_power('evaluate_rule_manage', FALSE);
     $data['has_report_command_priv'] = $this->check_power_new('report_command_index', FALSE);
     // 模版
     $this->load->view('evaluate_rule/index', $data);
 }
示例#3
0
 function admin_email_hash($operation, $key, $validate_time = 0)
 {
     if ($operation == 'encode') {
         $admin_id = intval($key);
         $CI =& get_instance();
         //$CI->load->model('admin/cpuser_model');
         $addtime = CpUserModel::get_cpuser($admin_id, 'addtime');
         $hash = substr(md5($admin_id . C('hash_code') . $addtime), 16, 8);
         return base64_encode($admin_id . ',' . $hash . ',' . time());
     } else {
         $hash = base64_decode(trim($key));
         $row = explode(',', $hash);
         if (count($row) != 3) {
             return FALSE;
         }
         $admin_id = intval($row[0]);
         $salt = trim($row[1]);
         $time = intval($row[2]);
         if ($admin_id <= 0 || $validate_time && time() - $time > $validate_time) {
             return FALSE;
         }
         $CI =& get_instance();
         $query = $CI->db->select('addtime')->get_where('admin', array('admin_id' => $admin_id));
         $row = $query->row_array();
         $pre_salt = substr(md5($admin_id . C('hash_code') . $row['addtime']), 16, 8);
         if ($pre_salt == $salt) {
             return $admin_id;
         } else {
             return FALSE;
         }
     }
 }
示例#4
0
 /**
  * @description  重置密码
  * @author
  * @final
  * @param int $uid 管理员id
  * @param string $password 密码
  * @param string $password_confirm 确认密码
  */
 public function reset_password()
 {
     $new_password = $this->input->post('new_password');
     $new_confirm_password = $this->input->post('confirm_password');
     $admin_id = intval($this->input->post('uid'));
     if (is_string($passwd_msg = is_password($new_password))) {
         output_json(CODE_ERROR, $passwd_msg);
     }
     if (!strlen(trim($new_confirm_password))) {
         output_json(CODE_ERROR, '确认密码不能为空.');
     }
     if ($new_confirm_password != $new_password) {
         output_json(CODE_ERROR, '两次密码输入不一致.');
     }
     //检查旧密码是否正确
     $passwd = CpUserModel::get_cpuser($admin_id, 'password');
     if (!count($passwd)) {
         output_json(CODE_ERROR, '不存在该管理员.');
     }
     //检查帐号密码是否正确
     $flag = $this->db->update('admin', array('password' => my_md5($new_password)), array('admin_id' => $admin_id));
     if (!$flag) {
         output_json(CODE_ERROR, '密码修改失败,请重试');
     }
     output_json(CODE_SUCCESS, '密码修改成功.');
 }