Пример #1
0
         $errorFields[] = 'limitedState';
     }
     if (!isset($_GET['zip']) || !$adminService->isIntR($_GET['zip'])) {
         $errorFields[] = 'limitedZip';
     }
     if (count($errorFields)) {
         throw new Exception('validation');
     }
     $ajaxReturn['data'] = $adminService->createLimitedUser($_GET['name'], $_GET['email'], $_GET['street'], $_GET['city'], $_GET['state'], $_GET['zip']);
 } elseif ($_GET['function'] === 'createUser') {
     if (!isset($_GET['email']) || !$adminService->isEmailR($_GET['email'])) {
         $errorFields[] = 'newEmail';
         throw new Exception('validation');
     }
     $access = isset($_GET['admin']) ? 1 : 2;
     $ajaxReturn['data'] = $adminService->createUser($_GET['email'], $access);
 } elseif ($_GET['function'] === 'deactivateJob') {
     if (!isset($_GET['jobID']) || !$adminService->isIntR($_GET['jobID'])) {
         $errorFields[] = 'jobID';
         throw new Exception('validation');
     }
     $ajaxReturn['data'] = $adminService->deactivateJob($_GET['jobID']);
 } elseif ($_GET['function'] === 'deactivateUser') {
     if (!isset($_GET['userID']) || !$adminService->isIntR($_GET['userID'])) {
         $errorFields[] = 'userID';
         throw new Exception('validation');
     }
     $ajaxReturn['data'] = $adminService->deactivateUser($_GET['userID']);
 } elseif ($_GET['function'] === 'getJob') {
     if (!isset($_GET['jobID']) || !$adminService->isIntR($_GET['jobID'])) {
         $errorFields[] = 'jobID';