summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreric <eric>2005-01-25 23:52:32 +0100
committereric <eric>2005-01-25 23:52:32 +0100
commita54ca6bfaf72832e0ca98278c037b7a1bc75fa16 (patch)
treed906562fc4a21ae6b884e15b052d142722380a22
parent9641fdc735640af82606ee9b6a60a1cb3c046d16 (diff)
downloadaur-a54ca6bfaf72832e0ca98278c037b7a1bc75fa16.tar.gz
aur-a54ca6bfaf72832e0ca98278c037b7a1bc75fa16.tar.xz
started working on package delete support
-rw-r--r--web/html/account.php2
-rw-r--r--web/html/hacker.php2
-rw-r--r--web/html/index.php8
-rw-r--r--web/html/logout.php2
-rw-r--r--web/html/packages.php85
-rw-r--r--web/html/pkgmgmnt.php2
-rw-r--r--web/html/pkgsubmit.php512
-rw-r--r--web/html/timeout.php2
-rw-r--r--web/lib/acctfuncs.inc2
-rw-r--r--web/lib/config.inc.proto2
-rw-r--r--web/lib/pkgfuncs.inc3
11 files changed, 371 insertions, 251 deletions
diff --git a/web/html/account.php b/web/html/account.php
index 09849dab..0975ab7c 100644
--- a/web/html/account.php
+++ b/web/html/account.php
@@ -126,5 +126,5 @@ if (isset($_COOKIE["AURSID"])) {
}
html_footer("\$Id$");
-# vim: ts=2 sw=2 et ft=php
+# vim: ts=2 sw=2 noet ft=php
?>
diff --git a/web/html/hacker.php b/web/html/hacker.php
index 630d4668..894cc28e 100644
--- a/web/html/hacker.php
+++ b/web/html/hacker.php
@@ -10,5 +10,5 @@ print __("If this problem persists, please contact the site administrator.");
print "</p>\n";
html_footer("\$Id$");
-# vim: ts=2 sw=2 et ft=php
+# vim: ts=2 sw=2 noet ft=php
?>
diff --git a/web/html/index.php b/web/html/index.php
index 033a69e6..b05127be 100644
--- a/web/html/index.php
+++ b/web/html/index.php
@@ -19,10 +19,10 @@ if (isset($_REQUEST["user"]) || isset($_REQUEST["pass"])) {
if (!$login_error) {
# Try and authenticate the user
#
-
- #md5 hash it
+
+ #md5 hash it
$_REQUEST["pass"] = md5($_REQUEST["pass"]);
- $dbh = db_connect();
+ $dbh = db_connect();
$q = "SELECT ID, Suspended FROM Users ";
$q.= "WHERE Username = '" . mysql_escape_string($_REQUEST["user"]) . "' ";
$q.= "AND Passwd = '" . mysql_escape_string($_REQUEST["pass"]) . "'";
@@ -120,5 +120,5 @@ print "</table>\n";
html_footer("\$Id$");
-# vim: ts=2 sw=2 et ft=php
+# vim: ts=2 sw=2 noet ft=php
?>
diff --git a/web/html/logout.php b/web/html/logout.php
index 885bf3d1..66e49023 100644
--- a/web/html/logout.php
+++ b/web/html/logout.php
@@ -20,5 +20,5 @@ print __("You have been successfully logged out.")."<br />\n";
html_footer("\$Id$");
-# vim: ts=2 sw=2 et ft=php
+# vim: ts=2 sw=2 noet ft=php
?>
diff --git a/web/html/packages.php b/web/html/packages.php
index 07123a96..4d8a49e9 100644
--- a/web/html/packages.php
+++ b/web/html/packages.php
@@ -155,7 +155,85 @@ if (isset($_REQUEST["do_Flag"])) {
print "</p>\n";
} else {
print "<p>\n";
- print __("You did not select any packages to disowned.");
+ print __("You did not select any packages to disown.");
+ print "</p>\n";
+ }
+
+ pkgsearch_results_link();
+
+ }
+
+
+} elseif (isset($_REQUEST["do_Delete"])) {
+ if (!$atype) {
+ print __("You must be logged in before you can disown packages.");
+ print "<br />\n";
+
+ } else {
+ # Delete the packages in $ids array (but only if they are Unsupported)
+ #
+ if (!empty($ids)) {
+ $dbh = db_connect();
+
+ # Delete the packages in $ids array
+ #
+ $first = 1;
+ while (list($pid, $v) = each($ids)) {
+ if ($first) {
+ $first = 0;
+ $delete = $pid;
+ } else {
+ $delete .= ", ".$pid;
+ }
+ }
+ $atype = account_from_sid($_COOKIE["AURSID"]);
+ if ($atype == "Trusted User" || $atype == "Developer") {
+ $field = "AURMaintainerUID";
+ } elseif ($atype == "User") {
+ $field = "MaintainerUID";
+ } else {
+ $field = "";
+ }
+
+ if ($field) {
+ # Only grab Unsupported packages that "we" own or are not owned at all
+ #
+ $ids_to_delete = array();
+ $q = "SELECT Packages.ID FROM Packages, PackageLocations ";
+ $q.= "WHERE Packages.ID IN (" . $delete . ") ";
+ $q.= "AND Packages.LocationsID = PackageLocations.ID ";
+ $q.= "AND PackageLocations.Location = 'Unsupported' ";
+ $q.= "AND (".$field." = ".uid_from_sid($_COOKIE["AURSID"]);
+ $q.= "OR (AURMaintainerUID = 0 AND MaintainerUID = 0))";
+ $result = db_query($q, $dbh);
+ while ($row = mysql_fetch_assoc($result)) {
+ $ids_to_delete[] = $row['ID'];
+ }
+
+ if (!empty($ids_to_delete)) {
+ # TODO These are the packages that are safe to delete
+ #
+ # 1) delete from PackageVotes
+ # 2) delete from PackageContents
+ # 3) delete from PackageDepends
+ # 4) delete from PackageSources
+ # 5) delete from PackageUploadHistory
+ # 6) delete from Packages
+ # TODO question: Now that the package as been deleted, does
+ # the unsupported repo need to be regenerated?
+ } else {
+ print "<p>\n";
+ print __("None of the selected packages could be deleted.");
+ print "</p>\n";
+ }
+ }
+
+ print "<p>\n";
+ print __("The selected packages have been deleted.");
+ print "</p>\n";
+ } else {
+ print "<p>\n";
+ print __("You did not select any packages to delete.");
print "</p>\n";
}
@@ -196,6 +274,9 @@ if (isset($_REQUEST["do_Flag"])) {
}
if ($field) {
+ # NOTE: Only "orphaned" packages can be adopted at a particular
+ # user class (TU/Dev or User).
+ #
$q = "UPDATE Packages ";
$q.= "SET ".$field." = ".uid_from_sid($_COOKIE["AURSID"])." ";
$q.= "WHERE ID IN (" . $adopt . ") ";
@@ -346,5 +427,5 @@ if (isset($_REQUEST["do_Flag"])) {
}
html_footer("\$Id$");
-# vim: ts=2 sw=2 et ft=php
+# vim: ts=2 sw=2 noet ft=php
?>
diff --git a/web/html/pkgmgmnt.php b/web/html/pkgmgmnt.php
index a2e28c2d..6c8cddd7 100644
--- a/web/html/pkgmgmnt.php
+++ b/web/html/pkgmgmnt.php
@@ -15,5 +15,5 @@ print __("Manage package ID: %s", array($_REQUEST["ID"])) . "<br />\n";
html_footer("\$Id$");
-# vim: ts=2 sw=2 et ft=php
+# vim: ts=2 sw=2 noet ft=php
?>
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
index 80396cf3..f6e699bf 100644
--- a/web/html/pkgsubmit.php
+++ b/web/html/pkgsubmit.php
@@ -15,11 +15,11 @@ if ($_COOKIE["AURSID"]) {
# track upload errors
#
$error = "";
- if ($DBUG) {
- print "</center><pre>\n";
- print_r($_REQUEST);
- print "</pre><center>\n";
- }
+ if ($DBUG) {
+ print "</center><pre>\n";
+ print_r($_REQUEST);
+ print "</pre><center>\n";
+ }
if ($_REQUEST["pkgsubmit"]) {
# If this var is set, then the visitor is uploading a file...
@@ -27,9 +27,9 @@ if ($_COOKIE["AURSID"]) {
if (!$_REQUEST["pkgname"]) {
$error = __("You did not specify a package name.");
} else {
- $pkg_name = str_replace("'", "", $_REQUEST["pkgname"]);
+ $pkg_name = str_replace("'", "", $_REQUEST["pkgname"]);
$pkg_name = escapeshellarg($pkg_name);
- $pkg_name = str_replace("'", "", $pkg_name); # get rid of single quotes
+ $pkg_name = str_replace("'", "", $pkg_name); # get rid of single quotes
$presult = preg_match("/^[a-z][a-z0-9_-]*$/", $pkg_name);
if ($presult == FALSE || $presult <= 0) {
# FALSE => error processing regex, 0 => invalid characters
@@ -38,9 +38,9 @@ if ($_COOKIE["AURSID"]) {
}
}
- if (!$error && (!$_REQUEST["comments"] || $_REQUEST["comments"] == '')) {
- $error = __("You must supply a comment for this upload/change.");
- }
+ if (!$error && (!$_REQUEST["comments"] || $_REQUEST["comments"] == '')) {
+ $error = __("You must supply a comment for this upload/change.");
+ }
if (!$error) {
# first, see if this package already exists, and if it can be overwritten
@@ -59,13 +59,13 @@ if ($_COOKIE["AURSID"]) {
array("<b>", $pkg_name, "</b>"));
}
}
- }
+ }
- # TODO check to see if the user has the ability to 'change' package
- # attributes such as location and/or category. Examples: TUs can
- # only add/change packages in Unsupported and the AUR, normal users
- # can only add/change packages in Unsupported.
- #
+ # TODO check to see if the user has the ability to 'change' package
+ # attributes such as location and/or category. Examples: TUs can
+ # only add/change packages in Unsupported and the AUR, normal users
+ # can only add/change packages in Unsupported.
+ #
if (!$error) {
@@ -88,78 +88,80 @@ if ($_COOKIE["AURSID"]) {
#
$error = __("Error trying to upload file - please try again.");
}
- }
+ }
# at this point, we can safely unpack the uploaded file and parse
# its contents.
#
- if (!$error) {
- if (!@mkdir($INCOMING_DIR.$pkg_name)) {
- $error = __("Could not create incoming directory: %s.",
- array($INCOMING_DIR.$pkg_name));
- } else {
- if (!@chdir($INCOMING_DIR.$pkg_name)) {
- $error = __("Could not change directory to %s.",
- array($INCOMING_DIR.$pkg_name));
- } else {
- # try .gz first
- #
- @exec("/bin/sh -c 'tar xzf ".$upload_file."'", $trash, $retval);
- if (!$retval) {
- # now try .bz2 format
- #
- @exec("/bin/sh -c 'tar xjf ".$upload_file."'", $trash, $retval);
- }
- if (!$retval) {
- $error = __("Unknown file format for uploaded file.");
- }
- }
- }
- }
+ if (!$error) {
+ if (!@mkdir($INCOMING_DIR.$pkg_name)) {
+ $error = __("Could not create incoming directory: %s.",
+ array($INCOMING_DIR.$pkg_name));
+ } else {
+ if (!@chdir($INCOMING_DIR.$pkg_name)) {
+ $error = __("Could not change directory to %s.",
+ array($INCOMING_DIR.$pkg_name));
+ } else {
+ # try .gz first
+ #
+ @exec("/bin/sh -c 'tar xzf ".$upload_file."'", $trash, $retval);
+ if (!$retval) {
+ # now try .bz2 format
+ #
+ @exec("/bin/sh -c 'tar xjf ".$upload_file."'", $trash, $retval);
+ }
+ if (!$retval) {
+ $error = __("Unknown file format for uploaded file.");
+ }
+ }
+ }
+ }
# At this point, if no error exists, the package has been extracted
# There should be a $INCOMING_DIR.$pkg_name."/".$pkg_name directory
- # if the user packaged it correctly. However, if the file was
+ # if the user packaged it correctly. However, if the file was
# packaged without the $pkg_name subdirectory, try and create it
# and move the package contents into the new sub-directory.
#
- if (!$error) {
- if (is_dir($INCOMING_DIR.$pkg_name."/".$pkg_name) &&
- is_file($INCOMING_DIR.$pkg_name."/".$pkg_name."/PKGBUILD")) {
- # the files were packaged correctly
- #
- if (!@chdir($INCOMING_DIR.$pkg_name."/".$pkg_name)) {
- $error = __("Could not change to directory %s.",
- array($INCOMING_DIR.$pkg_name."/".$pkg_name));
- }
- $pkg_dir = $INCOMING_DIR.$pkg_name."/".$pkg_name;
- } elseif (is_file($INCOMING_DIR.$pkg_name."/PKGBUILD")) {
- # not packaged correctly, but recovery may be possible.
- # try and create $INCOMING_DIR.$pkg_name."/".$pkg_name and
- # move package contents into the new dir
- #
- if (!@mkdir($INCOMING_DIR.$pkg_name."/".$pkg_name)) {
- $error = __("Could not create directory %s.",
- array($INCOMING_DIR.$pkg_name."/".$pkg_name));
- } else {
- @exec("/bin/sh -c 'mv * ".$pkg_name."'");
- if (!file_exists($INCOMING_DIR.$pkg_name."/".$pkg_name."/PKGBUILD")) {
- $error = __("Error exec'ing the mv command.");
- }
- }
- if (!@chdir($INCOMING_DIR.$pkg_name."/".$pkg_name)) {
- $error = __("Could not change to directory %s.",
- array($INCOMING_DIR.$pkg_name."/".$pkg_name));
- }
- $pkg_dir = $INCOMING_DIR.$pkg_name."/".$pkg_name;
- } else {
- # some wierd packaging/extraction error - baal
- #
- $error = __("Error trying to unpack upload - PKGBUILD does not exist.");
- }
- }
-
- @exec("/bin/sh -c 'mv ".$upload_file." ".$INCOMING_DIR.$pkg_name."/".$_FILES["pfile"]["name"]."'");
+ if (!$error) {
+ if (is_dir($INCOMING_DIR.$pkg_name."/".$pkg_name) &&
+ is_file($INCOMING_DIR.$pkg_name."/".$pkg_name."/PKGBUILD")) {
+ # the files were packaged correctly
+ #
+ if (!@chdir($INCOMING_DIR.$pkg_name."/".$pkg_name)) {
+ $error = __("Could not change to directory %s.",
+ array($INCOMING_DIR.$pkg_name."/".$pkg_name));
+ }
+ $pkg_dir = $INCOMING_DIR.$pkg_name."/".$pkg_name;
+ } elseif (is_file($INCOMING_DIR.$pkg_name."/PKGBUILD")) {
+ # not packaged correctly, but recovery may be possible.
+ # try and create $INCOMING_DIR.$pkg_name."/".$pkg_name and
+ # move package contents into the new dir
+ #
+ if (!@mkdir($INCOMING_DIR.$pkg_name."/".$pkg_name)) {
+ $error = __("Could not create directory %s.",
+ array($INCOMING_DIR.$pkg_name."/".$pkg_name));
+ } else {
+ @exec("/bin/sh -c 'mv * ".$pkg_name."'");
+ if (!file_exists($INCOMING_DIR.$pkg_name."/".$pkg_name."/PKGBUILD")) {
+ $error = __("Error exec'ing the mv command.");
+ }
+ }
+ if (!@chdir($INCOMING_DIR.$pkg_name."/".$pkg_name)) {
+ $error = __("Could not change to directory %s.",
+ array($INCOMING_DIR.$pkg_name."/".$pkg_name));
+ }
+ $pkg_dir = $INCOMING_DIR.$pkg_name."/".$pkg_name;
+ } else {
+ # some wierd packaging/extraction error - baal
+ #
+ $error = __("Error trying to unpack upload - PKGBUILD does not exist.");
+ }
+ }
+
+ $shcmd = "/bin/sh -c 'mv ".$upload_file." ".$INCOMING_DIR.$pkg_name;
+ $shcmd.= "/".$_FILES["pfile"]["name"]."'");
+ @exec($shcmd);
# if no error, get list of directory contents and process PKGBUILD
#
@@ -185,14 +187,14 @@ if ($_COOKIE["AURSID"]) {
$current_line = "";
while (!feof($fp)) {
$line = trim(fgets($fp));
- $char_counts = count_chars($line, 0);
+ $char_counts = count_chars($line, 0);
if (substr($line, strlen($line)-1) == "\\") {
# continue appending onto existing line_no
#
$current_line .= substr($line, 0, strlen($line)-1);
$continuation_line = 1;
- } elseif ($char_counts[ord('(')] > $char_counts[ord(')')]) {
- # assumed continuation
+ } elseif ($char_counts[ord('(')] > $char_counts[ord(')')]) {
+ # assumed continuation
# continue appending onto existing line_no
#
$current_line .= $line . " ";
@@ -217,10 +219,10 @@ if ($_COOKIE["AURSID"]) {
}
fclose($fp);
- # Now process the lines and put any var=val lines into the
- # 'pkgbuild' array. Also check to make sure it has the build()
- # function.
- #
+ # Now process the lines and put any var=val lines into the
+ # 'pkgbuild' array. Also check to make sure it has the build()
+ # function.
+ #
$seen_build_function = 0;
while (list($k, $line) = each($lines)) {
$lparts = explode("=", $line, 2);
@@ -229,7 +231,7 @@ if ($_COOKIE["AURSID"]) {
# array parens and any quoting
#
$pkgbuild[$lparts[0]] = str_replace(array("(",")","\"","'"), "",
- $lparts[1]);
+ $lparts[1]);
} else {
# either a comment, blank line, continued line, or build function
#
@@ -241,7 +243,7 @@ if ($_COOKIE["AURSID"]) {
}
# some error checking on PKGBUILD contents - just make sure each
- # variable has a value. This does not do any validity checking
+ # variable has a value. This does not do any validity checking
# on the values, or attempts to fix line continuation/wrapping.
#
if (!$seen_build_function) {
@@ -272,142 +274,174 @@ if ($_COOKIE["AURSID"]) {
$error = __("Package names do not match.");
}
}
- }
-
- # TODO This is where other additional error checking can be
- # performed. Examples: #md5sums == #sources?, md5sums of any
- # included files match?, install scriptlet file exists?
- #
-
-
- # Now, run through the pkgbuild array and do any $pkgname/$pkgver
- # substituions.
- #
- if (!$error) {
- $pkgname_var = $pkgbuild["pkgname"];
- $pkgver_var = $pkgbuild["pkgver"];
- $new_pkgbuild = array();
- while (list($k, $v) = each($pkgbuild)) {
- $v = str_replace("\$pkgname", $pkgname_var, $v);
- $v = str_replace("\${pkgname}", $pkgname_var, $v);
- $v = str_replace("\$pkgver", $pkgver_var, $v);
- $v = str_replace("\${pkgver}", $pkgver_var, $v);
- $new_pkgbuild[$k] = $v;
- }
- }
+ }
+
+ # TODO This is where other additional error checking can be
+ # performed. Examples: #md5sums == #sources?, md5sums of any
+ # included files match?, install scriptlet file exists?
+ #
+
+
+ # Now, run through the pkgbuild array and do any $pkgname/$pkgver
+ # substituions.
+ #
+ if (!$error) {
+ $pkgname_var = $pkgbuild["pkgname"];
+ $pkgver_var = $pkgbuild["pkgver"];
+ $new_pkgbuild = array();
+ while (list($k, $v) = each($pkgbuild)) {
+ $v = str_replace("\$pkgname", $pkgname_var, $v);
+ $v = str_replace("\${pkgname}", $pkgname_var, $v);
+ $v = str_replace("\$pkgver", $pkgver_var, $v);
+ $v = str_replace("\${pkgver}", $pkgver_var, $v);
+ $new_pkgbuild[$k] = $v;
+ }
+ }
# update the backend database
#
- if (!$error) {
- $dbh = db_connect();
- # this is an overwrite of an existing package, the database ID
- # needs to be preserved so that any votes are retained. However,
- # PackageDepends, PackageSources, and PackageContents can be
- # purged.
- #
- $q = "SELECT * FROM Packages ";
- $q.= "WHERE Name = '".mysql_escape_string($new_pkgbuild['pkgname'])."'";
- $result = db_query($q, $dbh);
- $pdata = mysql_fetch_assoc($result);
-
- if ($pdata) {
-
- # flush out old data that will be replaced with new data
- #
- $q = "DELETE FROM PackageContents WHERE PackageID = ".$pdata["ID"];
- db_query($q, $dbh);
- $q = "DELETE FROM PackageDepends WHERE PackageID = ".$pdata["ID"];
- db_query($q, $dbh);
- $q = "DELETE FROM PackageSources WHERE PackageID = ".$pdata["ID"];
- db_query($q, $dbh);
+ if (!$error) {
+ $dbh = db_connect();
+ # this is an overwrite of an existing package, the database ID
+ # needs to be preserved so that any votes are retained. However,
+ # PackageDepends, PackageSources, and PackageContents can be
+ # purged.
+ #
+ $q = "SELECT * FROM Packages ";
+ $q.= "WHERE Name = '".mysql_escape_string($new_pkgbuild['pkgname'])."'";
+ $result = db_query($q, $dbh);
+ $pdata = mysql_fetch_assoc($result);
+
+ if ($pdata) {
+
+ # flush out old data that will be replaced with new data
+ #
+ $q = "DELETE FROM PackageContents WHERE PackageID = ".$pdata["ID"];
+ db_query($q, $dbh);
+ $q = "DELETE FROM PackageDepends WHERE PackageID = ".$pdata["ID"];
+ db_query($q, $dbh);
+ $q = "DELETE FROM PackageSources WHERE PackageID = ".$pdata["ID"];
+ db_query($q, $dbh);
# update package data
#
- $q = "UPDATE Packages SET Name='".mysql_escape_string($new_pkgbuild['pkgname'])."', Version='".mysql_escape_string($new_pkgbuild['pkgver'])."', CategoryID=".mysql_escape_string($_REQUEST['category']).", Description='".mysql_escape_string($new_pkgbuild['pkgdesc'])."', URL='".mysql_escape_string($new_pkgbuild['url'])."', LocationID=2, FSPath='".mysql_escape_string($INCOMING_DIR.$pkg_name."/".$_FILES["pfile"]["name"])."', URLPath='".mysql_escape_string($URL_DIR.$pkg_name."/".$_FILES["pfile"]["name"])."' ";
- $q .= "WHERE ID = " . $pdata["ID"];
- $result = db_query($q, $dbh);
-
- # update package contents
- #
- while (list($k, $v) = each($pkg_contents)) {
- $q = "INSERT INTO PackageContents (PackageID, FSPath, URLPath, FileSize) VALUES (";
- $q.= $pdata['ID'].", ";
- $q.= "'".$INCOMING_DIR.$pkg_name."/".$pkg_name."/".$k."', ";
- $q.= "'".$URL_DIR.$pkg_name."/".$pkg_name."/".$k."', ";
- $q.= $v.")";
- db_query($q);
- }
+ $q = "UPDATE Packages SET ";
+ $q.="Name='".mysql_escape_string($new_pkgbuild['pkgname'])."', ";
+ $q.="Version='".mysql_escape_string($new_pkgbuild['pkgver'])."',";
+ $q.="CategoryID=".mysql_escape_string($_REQUEST['category']).", ";
+ $q.="Description='".mysql_escape_string($new_pkgbuild['pkgdesc'])."', ";
+ $q.="URL='".mysql_escape_string($new_pkgbuild['url'])."', ";
+ $q.="LocationID=2, ";
+ $fspath=$INCOMING_DIR.$pkg_name."/".$_FILES["pfile"]["name"];
+ $q.="FSPath='".mysql_escape_string($fspath)."', ";
+ $urlpath=$URL_DIR.$pkg_name."/".$_FILES["pfile"]["name"];
+ $q.="URLPath='".mysql_escape_string($urlpath)."' ";
+ $q.="WHERE ID = " . $pdata["ID"];
+ $result = db_query($q, $dbh);
+
+ # update package contents
+ #
+ while (list($k, $v) = each($pkg_contents)) {
+ $q = "INSERT INTO PackageContents ";
+ $q.= "(PackageID, FSPath, URLPath, FileSize) VALUES (";
+ $q.= $pdata['ID'].", ";
+ $q.= "'".$INCOMING_DIR.$pkg_name."/".$pkg_name."/".$k."', ";
+ $q.= "'".$URL_DIR.$pkg_name."/".$pkg_name."/".$k."', ";
+ $q.= $v.")";
+ db_query($q);
+ }
# update package depends
#
- $depends = explode(" ", $new_pkgbuild['depends']);
- while (list($k, $v) = each($depends)) {
- $q = "INSERT INTO PackageDepends (PackageID, DepPkgID) VALUES (";
- $deppkgname = preg_replace("/[<>]?=.*/", "", $v);
+ $depends = explode(" ", $new_pkgbuild['depends']);
+ while (list($k, $v) = each($depends)) {
+ $q = "INSERT INTO PackageDepends (PackageID, DepPkgID) VALUES (";
+ $deppkgname = preg_replace("/[<>]?=.*/", "", $v);
$deppkgid = create_dummy($deppkgname, $_COOKIE['AURSID']);
- $q .= $pdata["ID"].", ".$deppkgid.")";
+ $q .= $pdata["ID"].", ".$deppkgid.")";
db_query($q, $dbh);
- }
+ }
- $sources = explode(" ", $new_pkgbuild['source']);
- while (list($k, $v) = each($sources)) {
- $q = "INSERT INTO PackageSources (PackageID, Source) VALUES (";
- $q .= $pdata["ID"].", '".mysql_escape_string($v)."')";
+ $sources = explode(" ", $new_pkgbuild['source']);
+ while (list($k, $v) = each($sources)) {
+ $q = "INSERT INTO PackageSources (PackageID, Source) VALUES (";
+ $q .= $pdata["ID"].", '".mysql_escape_string($v)."')";
db_query($q, $dbh);
- }
+ }
# add upload history
#
- $q = "INSERT INTO PackageUploadHistory (PackageID, UsersID, Comments, UploadTS) VALUES (";
- $q .= $pdata["ID"] . ", " . uid_from_sid($_COOKIE['AURSID']) . ", '" . mysql_escape_string($_REQUEST["comments"]) . "', UNIX_TIMESTAMP())";
- db_query($q);
-
- } else {
- # this is a brand new package
- #
- $q = "INSERT INTO Packages (Name, Version, CategoryID, Description, URL, LocationID, SubmittedTS, SubmitterUID, MaintainerUID, FSPath, URLPath) ";
- $q .= "VALUES ('".mysql_escape_string($new_pkgbuild['pkgname'])."', '".mysql_escape_string($new_pkgbuild['pkgver'])."', ".mysql_escape_string($_REQUEST['category']).", '".mysql_escape_string($new_pkgbuild['pkgdesc'])."', '".mysql_escape_string($new_pkgbuild['url'])."', 2, UNIX_TIMESTAMP(), ".uid_from_sid($_COOKIE["AURSID"]).", ".uid_from_sid($_COOKIE["AURSID"]).", '".mysql_escape_string($INCOMING_DIR.$pkg_name."/".$_FILES["pfile"]["name"])."', '".mysql_escape_string($URL_DIR.$pkg_name."/".$_FILES["pfile"]["name"])."')";
- $result = db_query($q, $dbh);
-# print $result . "<br>";
+ $q = "INSERT INTO PackageUploadHistory ";
+ $q.= "(PackageID, UsersID, Comments, UploadTS) VALUES (";
+ $q.= $pdata["ID"] . ", " . uid_from_sid($_COOKIE['AURSID']);
+ $q.= ", '" . mysql_escape_string($_REQUEST["comments"]);
+ $q.= "', UNIX_TIMESTAMP())";
+ db_query($q);
+
+ } else {
+ # this is a brand new package
+ #
+ $q = "INSERT INTO Packages ";
+ $q.= " (Name, Version, CategoryID, Description, URL, LocationID, ";
+ $q.= " SubmittedTS, SubmitterUID, MaintainerUID, FSPath, URLPath) ";
+ $q.= "VALUES ('";
+ $q.= mysql_escape_string($new_pkgbuild['pkgname'])."', '";
+ $q.= mysql_escape_string($new_pkgbuild['pkgver'])."', ";
+ $q.= mysql_escape_string($_REQUEST['category']).", '";
+ $q.= mysql_escape_string($new_pkgbuild['pkgdesc'])."', '";
+ $q.= mysql_escape_string($new_pkgbuild['url']);
+ $q.= "', 2, UNIX_TIMESTAMP(), ";
+ $q.= uid_from_sid($_COOKIE["AURSID"]).", ";
+ $q.= uid_from_sid($_COOKIE["AURSID"]).", '";
+ $fspath=$INCOMING_DIR.$pkg_name."/".$_FILES["pfile"]["name"];
+ $q.= mysql_escape_string($fspath)."', '";
+ $urlpath=$URL_DIR.$pkg_name."/".$_FILES["pfile"]["name"];
+ $q.= mysql_escape_string($urlpath)."')";
+ $result = db_query($q, $dbh);
+# print $result . "<br>";
$packageID = mysql_insert_id($dbh);
- # update package contents
- #
- while (list($k, $v) = each($pkg_contents)) {
- $q = "INSERT INTO PackageContents (PackageID, FSPath, URLPath, FileSize) VALUES (";
- $q.= $packageID.", ";
- $q.= "'".$INCOMING_DIR.$pkg_name."/".$pkg_name."/".$k."', ";
- $q.= "'".$URL_DIR.$pkg_name."/".$pkg_name."/".$k."', ";
- $q.= $v.")";
- db_query($q);
- }
+ # update package contents
+ #
+ while (list($k, $v) = each($pkg_contents)) {
+ $q = "INSERT INTO PackageContents ";
+ $q.= "(PackageID, FSPath, URLPath, FileSize) VALUES (";
+ $q.= $packageID.", ";
+ $q.= "'".$INCOMING_DIR.$pkg_name."/".$pkg_name."/".$k."', ";
+ $q.= "'".$URL_DIR.$pkg_name."/".$pkg_name."/".$k."', ";
+ $q.= $v.")";
+ db_query($q);
+ }
# update package depends
#
- $depends = explode(" ", $new_pkgbuild['depends']);
- while (list($k, $v) = each($depends)) {
- $q = "INSERT INTO PackageDepends (PackageID, DepPkgID) VALUES (";
- $deppkgname = preg_replace("/[<>]?=.*/", "", $v);
+ $depends = explode(" ", $new_pkgbuild['depends']);
+ while (list($k, $v) = each($depends)) {
+ $q = "INSERT INTO PackageDepends (PackageID, DepPkgID) VALUES (";
+ $deppkgname = preg_replace("/[<>]?=.*/", "", $v);
$deppkgid = create_dummy($deppkgname, $_COOKIE['AURSID']);
- $q .= $packageID.", ".$deppkgid.")";
+ $q .= $packageID.", ".$deppkgid.")";
db_query($q, $dbh);
- }
+ }
- $sources = explode(" ", $new_pkgbuild['source']);
- while (list($k, $v) = each($sources)) {
- $q = "INSERT INTO PackageSources (PackageID, Source) VALUES (";
- $q .= $packageID.", '".mysql_escape_string($v)."')";
+ $sources = explode(" ", $new_pkgbuild['source']);
+ while (list($k, $v) = each($sources)) {
+ $q = "INSERT INTO PackageSources (PackageID, Source) VALUES (";
+ $q .= $packageID.", '".mysql_escape_string($v)."')";
db_query($q, $dbh);
- }
+ }
# add upload history
#
- $q = "INSERT INTO PackageUploadHistory (PackageID, UsersID, Comments, UploadTS) VALUES (";
- $q .= $packageID . ", " . uid_from_sid($_COOKIE["AURSID"]) . ", '" . mysql_escape_string($_REQUEST["comments"]) . "', UNIX_TIMESTAMP())";
- db_query($q, $dbh);
- }
- }
+ $q = "INSERT INTO PackageUploadHistory ";
+ $q.= "(PackageID, UsersID, Comments, UploadTS) VALUES (";
+ $q.= $packageID . ", " . uid_from_sid($_COOKIE["AURSID"]) . ", '";
+ $q.= mysql_escape_string($_REQUEST["comments"]);
+ $q.= "', UNIX_TIMESTAMP())";
+ db_query($q, $dbh);
+ }
+ }
}
@@ -420,8 +454,8 @@ if ($_COOKIE["AURSID"]) {
print "<span class='error'>".$error."</span><br />\n";
print "<br />&nbsp;<br />\n";
}
- $pkg_categories = pkgCategories();
- $pkg_locations = pkgLocations();
+ $pkg_categories = pkgCategories();
+ $pkg_locations = pkgLocations();
print "<form action='/pkgsubmit.php' method='post'";
print " enctype='multipart/form-data'>\n";
@@ -430,65 +464,65 @@ if ($_COOKIE["AURSID"]) {
print initeger(ini_get("upload_max_filesize"))."' />\n";
print "<table border='0' cellspacing='5'>\n";
print "<tr>\n";
- print " <td span='f4' align='right'>";
+ print " <td span='f4' align='right'>";
print __("Package name").":</td>\n";
- print " <td span='f4' align='left'>";
+ print " <td span='f4' align='left'>";
print "<input type='text' name='pkgname' size='30' maxlength='15' />\n";
- print " </td>\n";
+ print " </td>\n";
print "</tr>\n";
- print "<tr>\n";
- print " <td span='f4' align='right'>";
- print __("Package Category").":</td>\n";
- print " <td span='f4' align='left'>";
- print "<select name='category'>";
- print "<option value='0'> " . __("Select Category") . "</option>";
- while (list($k, $v) = each($pkg_categories)) {
- print "<option value='".$k."'> " . $v . "</option>";
- }
- print "</select></td>\n";
- print "</tr>\n";
-# print "<tr>\n";
-# print " <td span='f4' align='right'>";
-# print __("Package Location").":</td>\n";
-# print " <td span='f4' align='left'>";
-# print "<select name='location'>";
-# print "<option value='0'> " . __("Select Location") . "</option>";
-# while (list($k, $v) = each($pkg_locations)) {
-# print "<option value='".$k."'> " . $v . "</option>";
-# }
-# print "</select></td>\n";
-# print "</tr>\n";
print "<tr>\n";
- print " <td span='f4' align='right'>";
+ print " <td span='f4' align='right'>";
+ print __("Package Category").":</td>\n";
+ print " <td span='f4' align='left'>";
+ print "<select name='category'>";
+ print "<option value='0'> " . __("Select Category") . "</option>";
+ while (list($k, $v) = each($pkg_categories)) {
+ print "<option value='".$k."'> " . $v . "</option>";
+ }
+ print "</select></td>\n";
+ print "</tr>\n";
+# print "<tr>\n";
+# print " <td span='f4' align='right'>";
+# print __("Package Location").":</td>\n";
+# print " <td span='f4' align='left'>";
+# print "<select name='location'>";
+# print "<option value='0'> " . __("Select Location") . "</option>";
+# while (list($k, $v) = each($pkg_locations)) {
+# print "<option value='".$k."'> " . $v . "</option>";
+# }
+# print "</select></td>\n";
+# print "</tr>\n";
+ print "<tr>\n";
+ print " <td span='f4' align='right'>";
print __("Upload package file").":</td>\n";
- print " <td span='f4' align='left'>";
+ print " <td span='f4' align='left'>";
print "<input type='file' name='pfile' size='30' />\n";
- print " </td>\n";
+ print " </td>\n";
print "</tr>\n";
print "<tr>\n";
- print " <td span='f4' align='right'>";
+ print " <td span='f4' align='right'>";
print __("Overwrite existing package?");
- print " </td>\n";
- print " <td span='f4' align='left'>";
+ print " </td>\n";
+ print " <td span='f4' align='left'>";
print "<input type='radio' name='overwrite' value='1'> ".__("Yes");
print "&nbsp;&nbsp;&nbsp;";
print "<input type='radio' name='overwrite' value='0' checked> ";
print __("No");
- print " </td>\n";
+ print " </td>\n";
print "</tr>\n";
print "<tr>\n";
- print " <td valign='top' span='f4' align='right'>";
- print __("Comments").":</td>\n";
- print " <td span='f4' align='left'>";
- print "<textarea rows='10' cols='50' name='comments'></textarea>";
- print " </td>\n";
+ print " <td valign='top' span='f4' align='right'>";
+ print __("Comments").":</td>\n";
+ print " <td span='f4' align='left'>";
+ print "<textarea rows='10' cols='50' name='comments'></textarea>";
+ print " </td>\n";
print "</tr>\n";
print "<tr>\n";
- print " <td>&nbsp;</td>\n";
- print " <td align='left'>";
+ print " <td>&nbsp;</td>\n";
+ print " <td align='left'>";
print "<input class='button' type='submit' value='".__("Upload")."' />\n";
- print "&nbsp;&nbsp;&nbsp;";
+ print "&nbsp;&nbsp;&nbsp;";
print "<input class='button' type='reset' value='".__("Reset")."' />\n";
print "</td>\n";
print "</tr>\n";
@@ -500,8 +534,8 @@ if ($_COOKIE["AURSID"]) {
print "<br />\n";
}
} else {
- print __("Package upload successful");
- }
+ print __("Package upload successful");
+ }
} else {
# visitor is not logged in
@@ -512,5 +546,5 @@ if ($_COOKIE["AURSID"]) {
print "</center>\n";
html_footer("\$Id$");
-# vim: ts=2 sw=2 et ft=php
+# vim: ts=2 sw=2 noet ft=php
?>
diff --git a/web/html/timeout.php b/web/html/timeout.php
index e2c99c33..a529e375 100644
--- a/web/html/timeout.php
+++ b/web/html/timeout.php
@@ -10,5 +10,5 @@ print __("Click on the Home link above to log in.");
print "</p>\n";
html_footer("\$Id$");
-# vim: ts=2 sw=2 et ft=php
+# vim: ts=2 sw=2 noet ft=php
?>
diff --git a/web/lib/acctfuncs.inc b/web/lib/acctfuncs.inc
index e56ceebc..52d69c67 100644
--- a/web/lib/acctfuncs.inc
+++ b/web/lib/acctfuncs.inc
@@ -265,7 +265,7 @@ function process_account_form($UTYPE,$TYPE,$A,$U="",$T="",$S="",$E="",
if (!$result) {
print __("Error trying to create account, %h%s%h: %s.",
array("<b>", $U, "</b>", mysql_error($dbh)));
- } else {
+ } else {
# account created/modified, tell them so.
#
print __("The account, %h%s%h, has been successfully created.",
diff --git a/web/lib/config.inc.proto b/web/lib/config.inc.proto
index 673a8962..d530fd7e 100644
--- a/web/lib/config.inc.proto
+++ b/web/lib/config.inc.proto
@@ -3,4 +3,6 @@
$UPLOAD_DIR = "/aur/temp/";
$INCOMING_DIR = "/aur/incoming/";
$URL_DIR = "/packages/";
+
+# vim: ts=2 sw=2 noet ft=php
?>
diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc
index 2a6fda28..da948fd4 100644
--- a/web/lib/pkgfuncs.inc
+++ b/web/lib/pkgfuncs.inc
@@ -576,6 +576,9 @@ function pkg_search_page($SID="") {
print " <td align='center'>";
print "<input type='submit' class='button' name='do_Disown'";
print " value='".__("Disown Packages")."'></td>\n";
+ #print " <td align='center'>";
+ #print "<input type='submit' class='button' name='do_Delete'";
+ #print " value='".__("Delete Packages")."'></td>\n";
print " <td align='center'>";
print "<input type='submit' class='button' name='do_Vote'";
print " value='".__("Vote")."'></td>\n";