Esempio n. 1
0
     // Hash argument is empty or not set, throw error.
     $restAPI->throwError(1, 'hash');
 } else {
     if (!$restAPI->isAuthenticated() && !$restAPI->isPublicAction()) {
         // Hash is not valid and action is not public, throw error.
         $restAPI->throwError(6, $restAPI->getHash(), 'hash');
     } else {
         if (!$restAPI->hasRequest('action')) {
             // Action argument was not found, throw error.
             $restAPI->throwError(3, 'action');
         } else {
             if (!$restAPI->getAction()) {
                 // Action argument is empty or not set, throw error.
                 $restAPI->throwError(1, 'action');
             } else {
                 if (!$restAPI->isSupportedAction()) {
                     // Action is not supported, throw error.
                     $restAPI->throwError(2, $restAPI->getAction());
                 } else {
                     if (!$restAPI->isPermitted()) {
                         // User does not have permission to use this action, throw error.
                         if ($restAPI->hasRequest('value') && $restAPI->isUserAction()) {
                             $restAPI->throwError(9, $restAPI->getAction());
                         } else {
                             $restAPI->throwError(10, $restAPI->getAction());
                         }
                     }
                 }
             }
         }
     }