summaryrefslogtreecommitdiffstats
path: root/web/html
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2011-07-29 23:49:12 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2011-07-29 23:51:29 +0200
commit16cda58ff85aa3ae3534a2fe1fd0c998e01e8bb4 (patch)
treea3c2f3832ba043e57b57f57aecf2799c12de110c /web/html
parenta32b2f2ef7d290c9470e3718fab4b2e68b82c0c6 (diff)
downloadaur-16cda58ff85aa3ae3534a2fe1fd0c998e01e8bb4.tar.gz
aur-16cda58ff85aa3ae3534a2fe1fd0c998e01e8bb4.tar.xz
Fix empty depends database insert
Do not try to insert a falsey value into the database in case of "depends=()". Signed-off-by: Manuel <manutortosa@chakra-project.org> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/html')
-rw-r--r--web/html/pkgsubmit.php27
1 files changed, 16 insertions, 11 deletions
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
index fd51c7ef..793f8ca8 100644
--- a/web/html/pkgsubmit.php
+++ b/web/html/pkgsubmit.php
@@ -361,20 +361,25 @@ if ($uid):
# Update package depends
$depends = explode(" ", $new_pkgbuild['depends']);
- foreach ($depends as $dep) {
- $deppkgname = preg_replace("/(<|<=|=|>=|>).*/", "", $dep);
- $depcondition = str_replace($deppkgname, "", $dep);
+ if ($depends !== false) {
+ foreach ($depends as $dep) {
+ $deppkgname = preg_replace("/(<|<=|=|>=|>).*/", "", $dep);
+ $depcondition = str_replace($deppkgname, "", $dep);
- if ($deppkgname == "#") {
- break;
- }
+ if ($deppkgname == "") {
+ continue;
+ }
+ else if ($deppkgname == "#") {
+ break;
+ }
- $q = sprintf("INSERT INTO PackageDepends (PackageID, DepName, DepCondition) VALUES (%d, '%s', '%s')",
- $packageID,
- mysql_real_escape_string($deppkgname),
- mysql_real_escape_string($depcondition));
+ $q = sprintf("INSERT INTO PackageDepends (PackageID, DepName, DepCondition) VALUES (%d, '%s', '%s')",
+ $packageID,
+ mysql_real_escape_string($deppkgname),
+ mysql_real_escape_string($depcondition));
- db_query($q, $dbh);
+ db_query($q, $dbh);
+ }
}
# Insert sources