summaryrefslogtreecommitdiffstats
path: root/web/lib
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2014-06-02 18:15:26 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2014-06-02 18:15:26 +0200
commitb30bb6f534e20f0a93a08c129ec41f7cc87e440a (patch)
tree0b0aaf0ebde8d97dce402f1a5cc7c8a10e1ba5b4 /web/lib
parent019014a3acb6e10af11140082dfc319bd9d44fb3 (diff)
parente018670607ce6491163fbefb8eb84eec8588bf7b (diff)
downloadaurweb-b30bb6f534e20f0a93a08c129ec41f7cc87e440a.tar.xz
Merge branch 'maint'
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/acctfuncs.inc.php2
-rw-r--r--web/lib/aur.inc.php24
-rw-r--r--web/lib/pkgfuncs.inc.php26
3 files changed, 27 insertions, 25 deletions
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;
}
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
@@ -550,30 +550,6 @@ function end_atomic_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
*
* Merges entries of the first and the second array. If any key appears in both
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
index c35147f..3bbf1a1 100644
--- a/web/lib/pkgfuncs.inc.php
+++ b/web/lib/pkgfuncs.inc.php
@@ -942,3 +942,29 @@ 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 LEFT JOIN PackageBases ON ";
+ $q.= "PackageBases.ID = Packages.PackageBaseID ";
+ $q.= "ORDER BY SubmittedTS DESC ";
+ $q.= "LIMIT " . intval($numpkgs);
+ $result = $dbh->query($q);
+
+ $packages = array();
+ if ($result) {
+ while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
+ $packages[] = $row;
+ }
+ }
+
+ return $packages;
+}