From 44268778c824c2d5f49f00f9276a864aeb2e9681 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Thu, 29 May 2014 21:13:27 +0200 Subject: Move latest_pkgs() to pkgfuncs.inc.php Signed-off-by: Lukas Fleischer --- web/lib/aur.inc.php | 24 ------------------------ web/lib/pkgfuncs.inc.php | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 24 deletions(-) (limited to 'web') diff --git a/web/lib/aur.inc.php b/web/lib/aur.inc.php index ff46455..99f5ae4 100644 --- a/web/lib/aur.inc.php +++ b/web/lib/aur.inc.php @@ -549,30 +549,6 @@ function end_atomic_commit() { $dbh->commit(); } -/** - * Determine package information for latest package - * - * @param int $numpkgs Number of packages to get information on - * - * @return array $packages Package info for the specified number of recent packages - */ -function latest_pkgs($numpkgs) { - $dbh = DB::connect(); - - $q = "SELECT * FROM Packages "; - $q.= "ORDER BY SubmittedTS DESC "; - $q.= "LIMIT " .intval($numpkgs); - $result = $dbh->query($q); - - if ($result) { - while ($row = $result->fetch(PDO::FETCH_ASSOC)) { - $packages[] = $row; - } - } - - return $packages; -} - /** * Merge pkgbase and package options * diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index c35147f..a43512c 100644 --- a/web/lib/pkgfuncs.inc.php +++ b/web/lib/pkgfuncs.inc.php @@ -942,3 +942,27 @@ function pkg_add_lic($pkgid, $licid) { ); $dbh->exec($q); } + +/** + * Determine package information for latest package + * + * @param int $numpkgs Number of packages to get information on + * + * @return array $packages Package info for the specified number of recent packages + */ +function latest_pkgs($numpkgs) { + $dbh = DB::connect(); + + $q = "SELECT * FROM Packages "; + $q.= "ORDER BY SubmittedTS DESC "; + $q.= "LIMIT " .intval($numpkgs); + $result = $dbh->query($q); + + if ($result) { + while ($row = $result->fetch(PDO::FETCH_ASSOC)) { + $packages[] = $row; + } + } + + return $packages; +} -- cgit v1.2.3-70-g09d2 From 4cd6841541ef6464342ef865366fb88d02a5b51c Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Thu, 29 May 2014 21:18:01 +0200 Subject: pkgfuncs.inc.php: Fix latest_pkgs() This fixes a regression introduced when adding split package support and makes the RSS feed work again. Signed-off-by: Lukas Fleischer --- web/lib/pkgfuncs.inc.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'web') diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index a43512c..3bbf1a1 100644 --- a/web/lib/pkgfuncs.inc.php +++ b/web/lib/pkgfuncs.inc.php @@ -953,11 +953,13 @@ function pkg_add_lic($pkgid, $licid) { function latest_pkgs($numpkgs) { $dbh = DB::connect(); - $q = "SELECT * FROM Packages "; + $q = "SELECT * FROM Packages LEFT JOIN PackageBases ON "; + $q.= "PackageBases.ID = Packages.PackageBaseID "; $q.= "ORDER BY SubmittedTS DESC "; - $q.= "LIMIT " .intval($numpkgs); + $q.= "LIMIT " . intval($numpkgs); $result = $dbh->query($q); + $packages = array(); if ($result) { while ($row = $result->fetch(PDO::FETCH_ASSOC)) { $packages[] = $row; -- cgit v1.2.3-70-g09d2 From e018670607ce6491163fbefb8eb84eec8588bf7b Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 30 May 2014 09:32:48 +0200 Subject: Accept upper case letters in valid_username() In commit 0722f46 (Simplify valid_user() and valid_username(), 2014-02-06), the conversion to lower case letters was unintentionally removed and in consequence, names with upper case letters have been rejected since then. Instead of reintroducing the conversion, add the "i" modifier to the regular expression validating the name to do case-insensitive pattern matching. Signed-off-by: Lukas Fleischer --- web/lib/acctfuncs.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web') diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php index 962ebb4..51ffec6 100644 --- a/web/lib/acctfuncs.inc.php +++ b/web/lib/acctfuncs.inc.php @@ -538,7 +538,7 @@ function valid_username($user) { if (strlen($user) < USERNAME_MIN_LEN || strlen($user) > USERNAME_MAX_LEN) { return false; - } else if (!preg_match("/^[a-z0-9]+[.\-_]?[a-z0-9]+$/", $user)) { + } else if (!preg_match("/^[a-z0-9]+[.\-_]?[a-z0-9]+$/i", $user)) { return false; } -- cgit v1.2.3-70-g09d2