예제 #1
0
파일: todo.php 프로젝트: netixx/frankiz
 function handler_ajax_todo_uncheck($page)
 {
     S::assert_xsrf_token();
     if (Json::has('todo_id')) {
         XDB::execute('UPDATE  todo
                          SET  checked = 0
                        WHERE  uid = {?} AND todo_id = {?}', S::user()->id(), Json::i('todo_id'));
         if (XDB::affectedRows() != 1) {
             $page->jsonAssign('error', "Impossible de décocher la tâche");
         }
     } else {
         $page->jsonAssign('error', "Requête invalide");
     }
     return PL_JSON;
 }
예제 #2
0
파일: qdj.php 프로젝트: netixx/frankiz
 public function handler_ajax_get($page)
 {
     $qdj = QDJ::last(Json::i('daysShift', 0));
     if ($qdj === false) {
         $page->jsonAssign('success', false);
         return PL_JSON;
     }
     $array_qdj = $qdj->export();
     if ($qdj->date()->format('Y-m-d') == date('Y-m-d')) {
         $voted = $qdj->hasVoted();
     } else {
         $voted = true;
     }
     $page->jsonAssign('success', true);
     $page->jsonAssign('voted', $voted);
     $page->jsonAssign('qdj', $array_qdj);
     $page->jsonAssign('votes', $qdj->last_votes());
     return PL_JSON;
 }
예제 #3
0
파일: groups.php 프로젝트: netixx/frankiz
 function handler_ajax_comment($page)
 {
     S::assert_xsrf_token();
     $g = Group::fromId(Json::i('gid'));
     if ($g) {
         $user = Json::has('uid') ? new User(Json::i('uid')) : S::user();
         if ($user->isMe(S::user()) || S::user()->hasRights($g, Rights::admin()) || S::user()->isWeb()) {
             $comments = Json::t('comments');
             $user->comments($g, $comments);
             $page->jsonAssign('uid', $user->id());
         }
     } else {
         $page->jsonAssign('error', "Ce groupe n'existe pas");
     }
     return PL_JSON;
 }