Example #1
0
 public function showAction($ticketId = 0)
 {
     $ticketId = (int) $ticketId;
     $ticket = $this->model->getTicketById($ticketId);
     if (!$ticket) {
         $this->output->error404();
     }
     $this->output->view('blog/show.html.php', $ticket);
 }
 public function actionAddManyUsers()
 {
     $persons = array_map('trim', explode("\n", "\n\t\t\tЗдоренко Э.Б.\n\t\t\tГреков Е.Г.\n\t\t\tАнтонюк Э.П.\n\t\t\tМахмут С.И.\n\t\t\tКононов А.Е.\n\t\t\tВолгапкин А.И.\n\t\t\tМацегора А.Л.\n\t\t\tХоменко Н.В.\n\t\t\tБакланов Ю.А.\n\t\t\tТренихин А.В.\n\t\t\tСмирнов П.А.\n\t\t\tГусев А.П."));
     $this->render('', false);
     $tmod = new TicketModel();
     $result = [];
     foreach ($persons as $user) {
         if (empty($user)) {
             continue;
         }
         $ans = $tmod->findPersonByName($user, false);
         if ($ans) {
             $uid = get_param($ans, 'id', null);
             $fname = get_param($ans, 'fullname');
             $ans[] = $user;
             $ans[] = $this->model->updateUser($uid, $fname, 4, 1);
             $result[] = $ans;
         }
     }
     var_dump($result);
     $this->render('');
 }
    $settings['topic_id'] = $_REQUEST['topic_id'];
}
if (isset($_REQUEST['status'])) {
    $settings['status'] = $_REQUEST['status'];
}
if ($settings['keywords']) {
    // Don't show stat counts for searches
    $openTickets = $closedTickets = -1;
} elseif ($settings['topic_id']) {
    $openTickets = $thisclient->getNumTopicTicketsInState($settings['topic_id'], 'open');
    $closedTickets = $thisclient->getNumTopicTicketsInState($settings['topic_id'], 'closed');
} else {
    $openTickets = $thisclient->getNumOpenTickets();
    $closedTickets = $thisclient->getNumClosedTickets();
}
$tickets = TicketModel::objects();
$qs = array();
$status = null;
if ($settings['status']) {
    $status = strtolower($settings['status']);
}
switch ($status) {
    default:
        $status = 'open';
    case 'open':
    case 'closed':
        $results_type = $status == 'closed' ? __('Closed Tickets') : __('Open Tickets');
        $tickets->filter(array('status__state' => $status));
        break;
}
$sortOptions = array('id' => 'number', 'subject' => 'cdata__subject', 'status' => 'status__name', 'dept' => 'dept__name', 'date' => 'created');
Example #4
0
 public function resetpasswordAction()
 {
     if ($_POST) {
         $ticket = $_POST["ticket"];
         $ticketModel = new TicketModel();
         $data = $ticketModel->isTicketExistedAndVaild($ticket);
         if (!$data) {
             $this->message("请求过期", "你的重置密码请求已经过期,请重新申请。");
             die;
         }
         $this->message("修改成功", "你的密码已经修改成功了。");
         $userModel = new UserModel();
         $userModel->changePassword($data["userid"], $_POST["password"]);
         $ticketModel->removeTicket($ticket);
         die;
     }
     $ticket = $_GET["ticket"];
     if ($ticket == "") {
         $this->message("这里一片荒芜", "你走到了无人之地");
         die;
     }
     $ticketModel = new TicketModel();
     $data = $ticketModel->isTicketExistedAndVaild($ticket);
     if (!$data) {
         $this->message("请求过期", "你的重置密码请求已经过期,请重新申请。");
         die;
     }
     $this->_mainContent->assign("ticket", $ticket);
     $this->display();
 }
Example #5
0
 public function resetPassword($username)
 {
     $data["userid"] = $this->useridByName($username);
     if ($data["userid"] == 0) {
         return 0;
     }
     $ticketModel = new TicketModel();
     $data = $ticketModel->newTicket($data["userid"]);
     $userinfo = $this->userInfo($data["userid"]);
     $mail = $userinfo["email"];
     $mailModel = new MailModel();
     $page = "<p>你好,</p>\n    <p>您收到这封邮件的原因是,有人请求重置 {$username} 在 OurCoders(我们程序员)社区的密码。如果您确定这不是您自己的行为,请删除这封邮件。</p>\n    \n    <p>如果您可以确认是您自己的行为,请点击链接重置密码 <a href=http://ourcoders.com/user/resetpassword/?ticket={$data['ticket']}>重置密码</a></p>";
     $mailModel->generateMail($mail, "OurCoders社区 <*****@*****.**>", "OurCoders社区-重置密码邮件", $page, 1);
     return 1;
 }
 public function indexAction()
 {
     echo $this->output->render('home.html.php', ['tickets' => $this->model->getAllTickets()]);
 }
 public function actionSetOperTabel()
 {
     $this->render('', false);
     $personal = $this->model->getAllOperNames();
     $tmod = new TicketModel();
     $cache = [];
     $result = 1;
     $this->model->startTransaction();
     foreach ($personal as $user) {
         //$short = trim(join(' ', get_array_part($user, 'lname fname pname')));
         $short = get_param($user, 'lname');
         $short .= ' ' . mb_substr(get_param($user, 'fname'), 0, 1);
         $short .= ' ' . mb_substr(get_param($user, 'pname'), 0, 1);
         $full = $tmod->findPersonByName($short, 'id');
         if ($full) {
             $uid = get_param($user, 'id');
             $result *= $this->model->setOperTabel($uid, $full);
         } else {
             $cache[] = $short;
         }
     }
     //if ($result)
     var_dump($cache);
     $this->model->stopTransaction($result);
     $this->render('');
 }