Пример #1
0
 public function create($request)
 {
     $req = $request->getParameters();
     $response = new ViewResponse('assist/ticket');
     if (trim($req['bug']) != '') {
         if (Session::isActive()) {
             $user_id = Session::get()->id;
         } else {
             if (trim($req['email']) != '') {
                 $user_id = $req['email'];
             } else {
                 $user_id = 0;
             }
         }
         if (!empty(Ticket::find('all', ['conditions' => ['ip = ? AND timestamp < ' . (Utils::tps() + 60), $_SERVER['REMOTE_ADDR']]]))) {
             $r = $this->index($request);
             $r->addMessage(ViewMessage::error('Trop d\'envois avec la même IP en une minute, réssayez plus tard.'));
             return $r;
         }
         $ticket = Ticket::create(array('user_id' => $user_id, 'description' => $req['bug'], 'timestamp' => time(), 'ip' => $_SERVER['REMOTE_ADDR']));
         StaffNotification::createNotif('ticket', $user_id, null, $ticket->id);
         $ticket_id = $ticket->id;
         $response->addMessage(ViewMessage::success('Envoyé ! Vous serez notifié de l\'avancement par E-Mail ou Message Privé (Ticket #' . $ticket_id . ')'));
         /*$username = (Session::isActive()) ? Session::get()->username : '******';
         		$notif = new PushoverNotification();
         		$notif->setMessage('Nouveau ticket de '.$username);
         		$notif->setReceiver('all');
         		$notif->setExtraParameter('url', 'http://dreamvids.fr'.WEBROOT.'admin/tickets');
         		$notif->send();*/
     } else {
         $response->addMessage(ViewMessage::error('Merci de nous décrire votre problème.'));
     }
     return $response;
 }
Пример #2
0
 public function create($request)
 {
     $params = $request->getParameters();
     $data = ['success' => false];
     $user = Session::get();
     if ($params['title'] != '' && $params['content'] != '') {
         $new = News::create(['user_id' => $user->id, 'title' => $params['title'], 'content' => $params['content'], 'icon' => $params['icon'], 'level' => $params['level'], 'timestamp' => Utils::tps()]);
         StaffNotification::createNotif('news', Session::get()->id);
         $data['success'] = is_object($new);
     }
     return new JsonResponse($data);
 }
Пример #3
0
 public function create($request)
 {
     $params = $request->getParameters();
     $params['force_push'] = Session::get()->isAdmin() ? $params['force_push'] : 0;
     if (isset($params['type'])) {
         switch ($params['type']) {
             case 'private':
                 StaffNotification::createNotif('private', Session::get()->id, $params['to'], $params['content'], $params['level'], 'team_or_more', $params['force_push']);
                 return new JsonResponse(['success' => true]);
                 break;
             case 'broadcast':
                 StaffNotification::createNotif('broadcast', Session::get()->id, null, $params['content'], $params['level'], 'team_or_more', $params['force_push']);
                 return new JsonResponse(['success' => true]);
                 break;
         }
     } else {
         $notif = new PushBulletNotification('Dreamvids', "Test de notification !", [Session::get()->details->push_bullet_email]);
         $notif->send();
     }
 }
Пример #4
0
 public function update($id, $request)
 {
     $config = new Config(CONFIG . 'app.json');
     $config->parseFile();
     $data = $request->getParameters();
     if (isset($data['userRankSubmit'])) {
         if (User::exists($id)) {
             $user = User::find($id);
             $data['ranks'][$config->getValue('rankAdmin')] = ['Administrateur', 'danger'];
             $data['ranks'][$config->getValue('rankModo')] = ['Modérateur', 'warning'];
             $data['ranks'][$config->getValue('rankTeam')] = ['Equipe', 'success'];
             $data['ranks'][$config->getValue('rankContributor')] = ['Contributeur', 'info'];
             $data['ranks'][$config->getValue('rankUser')] = ['Utilisateur', 'primary'];
             $user->rank = $data['rank'];
             $user->save();
             StaffNotification::createNotif('rank', $user->id, Session::get()->id, $user->rank, $data['ranks'][$user->rank][1], 'admin');
             $data['user'] = $user;
             $r = new ViewResponse("admin/settings/edit_user", $data);
             $r->addMessage(ViewMessage::success($user->username . " désormais {$data['ranks'][$user->rank][0]}"));
             return $r;
         }
     }
 }
Пример #5
0
 public function suspend($userId)
 {
     $visibility = Config::getValue_('vid_visibility_suspended');
     $this->visibility = $visibility;
     $this->flagged = 1;
     $this->save();
     StaffNotification::createNotif('suspend_video', $userId, null, $this->id, 'danger', 'modo_or_more');
     ModoAction::create(array('id' => ModoAction::generateId(6), 'user_id' => $userId, 'type' => 'suspend', 'target' => $this->id, 'timestamp' => Utils::tps()));
 }
Пример #6
0
 public function update($id, $request)
 {
     $param = $request->getParameters();
     $ticket = Ticket::find($id);
     if (isset($param['new']) && $param['new']) {
         $level = TicketLevels::create(['label' => $param['label']]);
         $ticket->ticket_levels_id = $level->id;
     } else {
         $ticket->ticket_levels_id = $param['level_id'];
     }
     $ticket->save();
     StaffNotification::createNotif('ticket_level_change', Session::get()->id, null, $ticket->id);
     $r = $this->index($request);
     $r->addMessage(ViewMessage::success("Modification effectuée"));
     return $r;
 }