public function ReadList()
 {
     $ndb = new NuGetDb();
     $queryString = UrlUtils::GetRequestParam("searchQuery", "post");
     if ($queryString == null) {
         return $ndb->GetAllRows(Settings::$ResultsPerPage);
     }
     return array();
 }
예제 #2
0
require_once dirname(__FILE__) . "/../root.php";
require_once __ROOT__ . "/settings.php";
require_once __ROOT__ . "/inc/api_users.php";
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');
예제 #3
0
    $items[] = $nu;
    $inferred = true;
}
$item = $items[0];
?>
<h3><?php 
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) {
예제 #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;
 }
예제 #5
0
<?php

require_once dirname(__FILE__) . "../../../root.php";
require_once __ROOT__ . "/settings.php";
require_once __ROOT__ . "/inc/api_users.php";
require_once __ROOT__ . "/inc/commons/url.php";
require_once __ROOT__ . "/inc/commons/http.php";
require_once __ROOT__ . "/inc/commons/apibase.php";
require_once __ROOT__ . "/inc/commons/smalltextdbapibase.php";
require_once __ROOT__ . "/inc/db_nugetpackages.php";
require_once __ROOT__ . "/inc/phpnugetobjectsearch.php";
//Author eq 'Microsoft'
$db = new NuGetDb();
$pg = new Pagination();
$searchQuery = UrlUtils::GetRequestParamOrDefault("searchQuery", null);
$orderBy = UrlUtils::GetRequestParamOrDefault("orderBy", null);
$originalOrderBy = $orderBy;
if ($searchQuery == "") {
    $q = UrlUtils::GetRequestParamOrDefault("q", "");
    if ($q != "") {
        $q = str_replace("'", "", $q);
        $q = str_replace("\"", "", $q);
        $q = preg_split('/\\s+/', $q);
        $t = array();
        foreach ($q as $qs) {
            $t[] = "substringof('" . $qs . "',Id)";
            $t[] = "substringof('" . $qs . "',Title)";
        }
        $searchQuery = implode(" and ", $t);
    }
}
예제 #6
0
 public function LoadAllPackagesEntries()
 {
     $nugetDb = new NuGetDb();
     $toret = $nugetDb->GetAllRows();
     return $toret;
 }