diff options
author | Lukas Fleischer <archlinux@cryptocrack.de> | 2011-01-24 18:08:29 +0100 |
---|---|---|
committer | Lukas Fleischer <archlinux@cryptocrack.de> | 2011-01-24 18:08:29 +0100 |
commit | 556de318aeeef6019bb7628389beee1358de93f8 (patch) | |
tree | 434794760f8df1c575b8771c80f0175477ffd5f6 /web/lib/aurjson.class.php | |
parent | 0bb2a7b5147f9eeec5df5f02f59f03b6e85a8ed2 (diff) | |
download | aur-556de318aeeef6019bb7628389beee1358de93f8.tar.gz aur-556de318aeeef6019bb7628389beee1358de93f8.tar.xz |
Build URLs from package names (fixes FS#15308, FS#19327).
Drop the "URLPath" field from the "Packages" table, build URLs from
package names instead.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/lib/aurjson.class.php')
-rw-r--r-- | web/lib/aurjson.class.php | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php index ab1bdbf2..0868cb2d 100644 --- a/web/lib/aurjson.class.php +++ b/web/lib/aurjson.class.php @@ -18,10 +18,23 @@ include_once("aur.inc"); **/ class AurJSON { private $dbh = false; - private $exposed_methods = array('search','info','msearch'); - private $fields = array('Packages.ID','Name','Version','CategoryID', - 'Description', 'LocationID', 'URL','URLPath','License','NumVotes', - '(OutOfDateTS IS NOT NULL) AS OutOfDate'); + private $exposed_methods = array(); + private $fields = array(); + + /** + * Initialize methods and database fields. + **/ + public function __construct() { + $this->exposed_methods = array('search', 'info', 'msearch'); + + $this->fields = array( + 'Packages.ID', 'Name', 'Version', 'CategoryID', + 'Description', 'LocationID', 'URL', 'CONCAT("' . + mysql_real_escape_string(URL_DIR) . + '", Name, "/", Name, ".tar.gz") AS URLPath', 'License', + 'NumVotes', '(OutOfDateTS IS NOT NULL) AS OutOfDate' + ); + } /** * Handles post data, and routes the request. |