public function ReadList()
 {
     $ndb = new NuGetDb();
     $queryString = UrlUtils::GetRequestParam("searchQuery", "post");
     if ($queryString == null) {
         return $ndb->GetAllRows(Settings::$ResultsPerPage);
     }
     return array();
 }
Esempio n. 2
0
require_once __ROOT__ . "/inc/commons/url.php";
require_once __ROOT__ . "/inc/commons/http.php";
require_once __ROOT__ . "/inc/api_nuget.php";
$id = UrlUtils::GetRequestParamOrDefault("id", null);
$version = UrlUtils::GetRequestParamOrDefault("version", null);
if ($id == null || $version == null) {
    HttpUtils::ApiError(500, "Wrong data. Missing param.");
}
if (strlen($id) == 0 || strlen($version) == 0) {
    HttpUtils::ApiError(500, "Wrong data. Empty id or version.");
}
$query = "Id eq '" . $id . "' and Version eq '" . $version . "'";
$db = new NuGetDb();
$os = new PhpNugetObjectSearch();
$os->Parse($query, $db->GetAllColumns());
$allRows = $db->GetAllRows(1, 0, $os);
if (sizeof($allRows) == 0) {
    HttpUtils::ApiError(404, "Not found.");
}
$file = $allRows[0]->Id . "." . $allRows[0]->Version . ".nupkg";
$path = Path::Combine(Settings::$PackagesRoot, $file);
if (!file_exists($path)) {
    HttpUtils::ApiError(404, "Not found " . $file);
}
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename=' . basename($path));
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($path));
readfile($path);
echo $item->Name;
?>
's Profile</h3> 
<?php 
if ($inferred) {
    echo "This profile is extrapolated from the data.<br>";
    echo "It <b>DOES NOT EXISTS</b> on this server.<br>";
}
$query = "substringof('" . $item->Name . "',Author) or substringof('" . $item->UserId . "',Author) orderby Title asc, Version desc groupby Id";
$db = new NuGetDb();
$os = new PhpNugetObjectSearch();
$os->Parse($query, $db->GetAllColumns());
$pg = new Pagination();
$pg->Skip = UrlUtils::GetRequestParamOrDefault("skip", 0);
$pg->Top = UrlUtils::GetRequestParamOrDefault("top", 10);
$items = $db->GetAllRows(999999, 0, $os);
$count = sizeof($items);
?>
<h3> There are <?php 
echo $count;
?>
 packages for the given profile</h3> 

<?php 
if (sizeof($items) > 0) {
    ?>
		Displaying results <?php 
    echo $pg->Skip;
    ?>
 - <?php 
    echo sizeof($items);
Esempio n. 4
0
 function _query($query)
 {
     $pg = $this->_getPagination();
     $db = new NuGetDb();
     $os = new PhpNugetObjectSearch();
     if (strlen($query) > 0) {
         $os->Parse($query, $db->GetAllColumns());
     } else {
         $os = null;
     }
     $count = UrlUtils::GetRequestParamOrDefault("count", "false");
     if ($count == "true") {
         $allRows = $db->GetAllRows(999999, 0, $os);
         HttpUtils::WriteData(sizeof($allRows));
     }
     $allRows = $db->GetAllRows($pg->Top + 1, $pg->Skip, $os);
     if (!UrlUtils::IsFake()) {
         header('Content-Type: 	application/atom+xml;type=feed;charset=utf-8');
     }
     $baseUrl = UrlUtils::CurrentUrl(Settings::$SiteRoot);
     //
     $r = array();
     $r["@BASEURL@"] = $baseUrl;
     $r["@NEXTITEM@"] = "";
     echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
     echo Utils::ReplaceInFile(Path::Combine($this->_path, "entrytemplatepre.xml"), $r);
     for ($i = 0; $i < sizeof($allRows) && $i < $pg->Top; $i++) {
         $row = $allRows[$i];
         echo $this->_buildNuspecEntity($baseUrl, $row);
     }
     if (sizeof($allRows) >= $pg->Top) {
         $act = strtolower(UrlUtils::GetRequestParamOrDefault("action", null));
         if ($act == "packages") {
             $act = "Packages";
         }
         if ($act == "search") {
             $act = "Search";
         }
         if ($act == "findpackagesbyd") {
             $act = "FindPackagesById";
         }
         if ($act == "getupdates") {
             $act = "GetUpdates";
         }
         $nq = $this->_setupLastQuery();
         if ($act != "Search") {
             $nq = "\$skip=" . ($pg->Skip + $pg->Top) . "&amp;\$top=" . $pg->Top . $nq;
             echo "<link rel=\"next\" href=\"" . $baseUrl . "/api/" . $this->_version . "/" . $act . "?" . $nq . "\"/>";
         }
         /*?><link rel="next" href="http://localhost:8020/phpnuget/api/v2/Search?$skip=30&amp;$top=30&amp;searchTerm=''&amp;$filter=IsAbsoluteLatestVersion&amp;$orderby=DownloadCount+desc%2CId"/><?php*/
     }
     echo Utils::ReplaceInFile(Path::Combine($this->_path, "entrytemplatepost.xml"), $r);
     die;
 }
Esempio n. 5
0
    $os->Parse("(" . $searchQuery . ") and Listed eq true " . $orderBy . $groupBy, $db->GetAllColumns());
} else {
    if ($orderBy != null) {
        $orderBy = "orderby " . $orderBy;
        $os = new PhpNugetObjectSearch();
        $os->Parse("Listed eq true " . $orderBy . $groupBy, $db->GetAllColumns());
    } else {
        $os = new PhpNugetObjectSearch();
        $os->Parse("orderby Title asc, Version desc" . $groupBy, $db->GetAllColumns());
    }
}
$next = Settings::$SiteRoot . "?specialType=packages";
if ($searchQuery != null) {
    $next .= "&searchQuery=" . urlencode($searchQuery);
}
$items = $db->GetAllRows(999999, 0, $os);
$count = sizeof($items);
$items = $db->GetAllRows($pg->Top, $pg->Skip, $os);
?>
<h3> There are <?php 
echo $count;
?>
 packages</h3> 


<?php 
if (sizeof($items) > 0) {
    ?>
		Displaying results <?php 
    echo $pg->Skip;
    ?>
Esempio n. 6
0
 public function LoadAllPackagesEntries()
 {
     $nugetDb = new NuGetDb();
     $toret = $nugetDb->GetAllRows();
     return $toret;
 }