コード例 #1
0
ファイル: AppVersionModel.php プロジェクト: Zartas/appDB
 public function deleteByAppID($app_id, $clearCache = true)
 {
     $alm = AppLinkModel::getInstance();
     if (!$alm->deleteByAppID($app_id, $clearCache)) {
         return false;
     }
     $query = new Query('DELETE');
     $query->from('versions');
     $query->where('app_id = ?', $app_id);
     $stmt = $query->prepare();
     if (($success = $stmt->execute()) && $clearCache) {
         $this->cm->clearGroup('appdetails');
     }
     return $success;
 }
コード例 #2
0
ファイル: LinkObject.php プロジェクト: Zartas/appDB
 public static function action_submit($args, &$returncode, &$profile, &$auth = false, $format = false)
 {
     if (!$profile->perm_link_submit_auth) {
         $returncode = ResponseCode::ACTION_NOT_ALLOWED;
         return false;
     }
     if (!$auth) {
         $returncode = ResponseCode::UNAUTHORIZED;
         return false;
     }
     if (!isset($args->itunes_id) || !isset($args->version) || !isset($args->cracker) || !isset($args->links) || $args->itunes_id != (int) $args->itunes_id || !is_array($args->links) || count($args->links) == 0 || count($args->links) > 10) {
         $returncode = ResponseCode::BAD_REQUEST;
         return false;
     }
     $alm = AppLinkModel::getInstance();
     $result = $alm->submit($args->itunes_id, $args->version, $args->cracker, $args->links, $auth, $profile->name);
     switch ($result) {
         case AppLinkModel::SUBMIT_OK:
             $returncode = ResponseCode::CREATED;
             return true;
         case AppLinkModel::SUBMIT_PARTIAL_OK:
             $returncode = ResponseCode::PARTIALLY_CREATED;
             return true;
         case AppLinkModel::SUBMIT_FAIL_APP_NOT_FOUND:
             $returncode = ResponseCode::RESOURCE_NOT_FOUND;
             return false;
         case AppLinkModel::SUBMIT_FAIL_USER_CANNOT_SUBMIT_NEW_APP:
         case AppLinkModel::SUBMIT_FAIL_USER_CANNOT_SUBMIT_NEW_VERSION:
         case AppLinkModel::SUBMIT_FAIL_USER_CANNOT_SUBMIT_FREE_APP:
         case AppLinkModel::SUBMIT_FAIL_USER_CANNOT_SUBMIT_LINKS:
             $returncode = ResponseCode::USER_NOT_PERMITTED;
             return false;
         case AppLinkModel::SUBMIT_FAIL_ITUNES_TIMEOUT:
             $returncode = ResponseCode::RESOURCE_TIMEOUT;
             return false;
         case AppLinkModel::SUBMIT_FAIL_NO_VALID_LINKS:
             $returncode = ResponseCode::UNACCEPTABLE_DATA;
             return false;
         case AppLinkModel::SUBMIT_FAIL_UNKNOWN_ERROR:
         default:
             $returncode = ResponseCode::INTERNAL_SERVER_ERROR;
             return false;
     }
 }
コード例 #3
0
ファイル: getapps.php プロジェクト: Zartas/appDB
     if (count($apps) == 1) {
         $jsonShots = array();
         $sm = ScreenshotModel::getInstance();
         $shots = $sm->getByAppIDCached($app->id);
         foreach ($shots as $shot) {
             $jsonShot = array();
             $jsonShot['url'] = $shot->shot_url;
             $jsonShot['is_horiz'] = $shot->is_horiz ? 1 : 0;
             $jsonShots[] = $jsonShot;
         }
         $jsonApp['screenshots'] = $jsonShots;
     }
     break;
 case 'links':
     if (count($apps) == 1) {
         $alm = AppLinkModel::getInstance();
         $links = $alm->getByAppIDCached($app->id);
         $jsonLinks = array();
         foreach ($links as $link) {
             $jsonLink = array();
             $jsonLink['id'] = $link->id;
             $jsonLink['version'] = $link->version;
             $jsonLink['type'] = $link->filetype;
             $jsonLink['cracker'] = $link->cracker;
             $jsonLink['addeddate'] = $link->date_added;
             $jsonLink['url'] = $link->url;
             $jsonLinks[] = $jsonLink;
         }
         $jsonApp['links'] = $jsonLinks;
     }
     break;