summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreric <eric>2004-07-12 22:12:42 +0000
committereric <eric>2004-07-12 22:12:42 +0000
commitcbe2050420a65349a5fcf1f4cce6e7c76490f881 (patch)
tree167ebed2b4b7ab322a2c2492d6b2e688f4ca2fe6
parent7b9956f225cd885c861db0cb145b16b3b8441ca7 (diff)
downloadaurweb-cbe2050420a65349a5fcf1f4cce6e7c76490f881.tar.xz
started on the package submit script
-rw-r--r--support/schema/dummy-data.sql.bz2bin782756 -> 784649 bytes
-rwxr-xr-xsupport/schema/gendummydata.py14
-rwxr-xr-xsupport/schema/reloadtestdb.sh23
-rw-r--r--web/html/pkgsubmit.php29
-rw-r--r--web/lib/aur.inc23
5 files changed, 81 insertions, 8 deletions
diff --git a/support/schema/dummy-data.sql.bz2 b/support/schema/dummy-data.sql.bz2
index 7f34228..a97c77d 100644
--- a/support/schema/dummy-data.sql.bz2
+++ b/support/schema/dummy-data.sql.bz2
Binary files differ
diff --git a/support/schema/gendummydata.py b/support/schema/gendummydata.py
index 32e202d..738b99d 100755
--- a/support/schema/gendummydata.py
+++ b/support/schema/gendummydata.py
@@ -13,7 +13,7 @@ DB_HOST = "localhost"
DB_NAME = "AUR"
DB_USER = "aur"
DB_PASS = "aur"
-USER_ID = 5 # Users.ID of first user
+USER_ID = 5 # Users.ID of first bogus user
PKG_ID = 1 # Packages.ID of first package
MAX_USERS = 500 # how many users to 'register'
MAX_DEVS = .1 # what percentage of MAX_USERS are Developers
@@ -123,8 +123,9 @@ if DBUG: print "Generating random user names..."
user_id = USER_ID
while len(seen_users) < MAX_USERS:
user = random.randrange(0, len(contents))
- word = contents[user].strip().replace("'", "").replace(" ", "_")
- if not seen_users.has_key(user):
+ word = contents[user].replace("'", "").replace(".","").replace(" ", "_")
+ word = word.strip().lower()
+ if not seen_users.has_key(word):
seen_users[word] = user_id
user_id += 1
user_keys = seen_users.keys()
@@ -135,7 +136,8 @@ if DBUG: print "Generating random package names..."
num_pkgs = PKG_ID
while len(seen_pkgs) < MAX_PKGS:
pkg = random.randrange(0, len(contents))
- word = contents[pkg].strip().replace("'", "").replace(" ", "_")
+ word = contents[pkg].replace("'", "").replace(".","").replace(" ", "_")
+ word = word.strip().lower()
if not need_dupes:
if not seen_pkgs.has_key(word) and not seen_users.has_key(word):
seen_pkgs[word] = num_pkgs
@@ -145,6 +147,10 @@ while len(seen_pkgs) < MAX_PKGS:
seen_pkgs[word] = num_pkgs
num_pkgs += 1
+# free up contents memory
+#
+contents = None
+
# Load package categories from database
#
if DBUG: print "Loading package categories/locations..."
diff --git a/support/schema/reloadtestdb.sh b/support/schema/reloadtestdb.sh
new file mode 100755
index 0000000..53ddf86
--- /dev/null
+++ b/support/schema/reloadtestdb.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+mydir=`pwd`
+if [ `basename $mydir` != "schema" ]; then
+ echo "you must be in the aur/support/schema directory to run this script"
+ exit
+fi
+
+echo "dropping old database..."
+yes | mysqladmin -uaur -paur drop AUR
+
+echo "recreating database..."
+mysqladmin -uaur -paur create AUR
+
+echo "recreating tables..."
+mysql -uaur -paur AUR < ./aur-schema.sql
+
+echo "loading dummy-data..."
+bzcat ./dummy-data.sql.bz2 | mysql -uaur -paur AUR
+
+echo "done."
+exit
+
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
index 60b6dc5..02f3c05 100644
--- a/web/html/pkgsubmit.php
+++ b/web/html/pkgsubmit.php
@@ -5,12 +5,33 @@ set_lang(); # this sets up the visitor's language
check_sid(); # see if they're still logged in
html_header(); # print out the HTML header
-
-# Any text you print out to the visitor, use the __() function
-# for i18n support. See 'testpo.php' for more details.
+# this is the directory that new packages will be uploaded to
#
-print __("Under construction...")."<br />\n";
+$UPLOAD_DIR = "/tmp/aur/temp";
+
+if ($_REQUEST["upload"]) {
+ # try and process the upload
+ #
+} else {
+ # give the visitor the default upload page
+ #
+ print "<center>\n";
+ if (ini_get("file_uploads")) {
+ print "<form action='/pkgsubmit.php' method='post'";
+ print " enctype='multipart/form-data'>\n";
+ print "<input type='hidden' name='MAX_FILE_SIZE' value='";
+ print initeger(ini_get("upload_max_filesize"))."' />\n";
+ print "Upload package: ";
+ print "<input type='file' name='pfile' size='30' />\n";
+ print "&nbsp;&nbsp;&nbsp;&nbsp;";
+ print "<input class='button' type='submit' value='Upload' />\n";
+ print "</form>\n";
+ } else {
+ print "Sorry, uploads are not permitted by this server.\n<br />\n";
+ }
+ print "</center>\n";
+}
html_footer("\$Id$");
?>
diff --git a/web/lib/aur.inc b/web/lib/aur.inc
index 7ea1e96..686154f 100644
--- a/web/lib/aur.inc
+++ b/web/lib/aur.inc
@@ -444,5 +444,28 @@ function dbug($msg) {
return;
}
+# convert an ini_get number to a real integer - stupid PHP!
+#
+function initeger($inival="0", $isbytes=1) {
+ $last_char = strtolower(substr($inival, -1));
+ if ($isbytes) {
+ switch ($last_char) {
+ case 't': $multiplier = 1024 * 1024 * 1024; break;
+ case 'm': $multiplier = 1024 * 1024; break;
+ case 'k': $multiplier = 1024; break;
+ default: $multiplier = 1; break;
+ }
+ } else {
+ switch ($last_char) {
+ case 't': $multiplier = 1000 * 1000 * 1000; break;
+ case 'm': $multiplier = 1000 * 1000; break;
+ case 'k': $multiplier = 1000; break;
+ default: $multiplier = 1; break;
+ }
+ }
+
+ return intval($inival) * $multiplier;
+}
+
# vim: ts=2 sw=2 noet ft=php
?>