예제 #1
0
 public function dodownload()
 {
     $tempFile = "";
     try {
         $this->_preExecute();
         $url = UrlUtils::GetRequestParam("Url");
         $id = UrlUtils::GetRequestParam("Id");
         $version = UrlUtils::GetRequestParam("Version");
         if ($id == null || $url == null || $version == null) {
             throw new Exception("Missing data");
         }
         global $loginController;
         if (!$loginController->Admin) {
             throw new Exception("Unauthorized");
         }
         $url = str_replace("@ID", $id, $url);
         $url = str_replace("@VERSION", $version, $url);
         $nupackage = getSslPage($url);
         $tempFile = Utils::WriteTemporaryFile($nupackage);
         $udb = new UserDb();
         $user = $udb->GetByUserId($loginController->UserId);
         $baseUrl = UrlUtils::CurrentUrl(Settings::$SiteRoot);
         $nugetReader = new NugetManager();
         $parsedNuspec = $nugetReader->LoadNuspecFromFile($tempFile);
         $parsedNuspec->UserId = $user->Id;
         $nuspecData = $nugetReader->SaveNuspec($tempFile, $parsedNuspec);
     } catch (Exception $ex) {
         if (file_exists($tempFile)) {
             unlink($tempFile);
         }
         ApiBase::ReturnError($ex->getMessage(), 500);
     }
     if (file_exists($tempFile)) {
         unlink($tempFile);
     }
     ApiBase::ReturnSuccess(null);
 }
예제 #2
0
        if (!$isVideo) {
            //Video objects seem to have a picture value which is a high-res (or as high-res as the source video is) dump, so no reason to do another fetch.
            $imageObject = json_decode(getSslPage("https://graph.facebook.com/" . $value->object_id));
            $feed_item->image = $imageObject->images[0]->source;
        }
        //Create thumbnail:
        downloadAndCreateThumbnail("facebook_" . $value->object_id, $feed_item, $downloadTempFolder, $imageResizeWidth, $imageResizeHeight, $thumbnailOptions, $resizedImagesFolder);
    } else {
        $feed_item->image = "";
    }
    array_push($feed_items, $feed_item);
}
/* Load and parse Instagram feed
   ==========================================================================
*/
$response = getSslPage("https://api.instagram.com/v1/users/self/feed?count={$downloadItemsCount}&access_token={$instagram_access_token}");
if ($DEBUG_MODE) {
    $filename = $downloadTempFolder . "/feeds/instagram_feed.json";
    forceFilePutContents($filename, $response);
}
$instagram_response = json_decode($response);
foreach ($instagram_response->data as $key => $value) {
    if (checkIfBlocked($value->id, $blockedItems) || $value->user->username != $instagram_username) {
        continue;
    }
    $feed_item = new stdClass();
    $feed_item->id = strval($value->id);
    $feed_item->timestamp = intval($value->created_time);
    $feed_item->message = isset($value->caption->text) ? $value->caption->text : "";
    $feed_item->image = $value->images->standard_resolution->url;
    //Other resolutions are available here, the standard_resolution is the highest resolution.