Exemplo n.º 1
0
 public static function sendErrorMessage($post)
 {
     $authStatus = Challenge::checkAuthenticationToken($post['token']);
     if (is_a($authStatus, 'ErrorObject')) {
         return $authStatus;
     }
     alertWhoops($post);
 }
 public static function approveComment(array $post)
 {
     $authStatus = Challenge::checkAuthenticationToken($post['token']);
     if (is_a($authStatus, 'ErrorObject')) {
         return $authStatus;
     }
     return Comments::approveComment($post['commentId']);
 }
 public static function setCategories(array $post)
 {
     $authStatus = Challenge::checkAuthenticationToken($post['token']);
     if (is_a($authStatus, 'ErrorObject')) {
         return $authStatus;
     }
     $categoryName = isset($post['category_name']) ? $post['category_name'] : false;
     $categorySelected = isset($post['category_selection']) ? $post['category_selection'] : false;
     $insertId = 0;
     if ($categoryName) {
         $insertId = null;
         if (isset($post['add_sub']) && $categorySelected) {
             $insertId = Categories::setNewSubCategory($categoryName, $categorySelected);
         } else {
             $insertId = Categories::setNewCategory($categoryName);
         }
         if (is_a($insertId, 'ErrorObject')) {
             return $insertId;
         }
         return array('id' => $insertId, 'name' => $categoryName);
     }
     return array();
 }