summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/README.txt8
-rw-r--r--web/html/pkgsubmit.php64
-rw-r--r--web/lib/aur.inc32
-rw-r--r--web/lib/config.inc.proto42
-rw-r--r--web/lib/pkgfuncs.inc5
5 files changed, 77 insertions, 74 deletions
diff --git a/web/README.txt b/web/README.txt
index aae2c69..09a0c28 100644
--- a/web/README.txt
+++ b/web/README.txt
@@ -1,7 +1,7 @@
Setup on ArchLinux:
===================
-1) Install Apache, MySQL, PHP, and Subversion
- # pacman -Sy apache mysql php subversion
+1) Install Apache, MySQL, PHP, and git
+ # pacman -Sy apache mysql php git
2) Set a local 'hostname' of 'aur'
- Edit /etc/hosts and append 'aur' to loopback address
@@ -31,9 +31,9 @@ Setup on ArchLinux:
- Edit /etc/php.ini and uncomment the mysql extension line:
extension=mysql.so
-5) Check out the AUR project (using the MYUSER from above)
+5) Clone the AUR project (using the MYUSER from above)
$ cd
- $ svn co https://xentac.net/svn/aur/trunk aur
+ $ git clone http://projects.archlinux.org/git/aur.git
6) Configure MySQL
- Connect to the mysql client
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
index 24aeea5..abccd66 100644
--- a/web/html/pkgsubmit.php
+++ b/web/html/pkgsubmit.php
@@ -90,15 +90,15 @@ if ($_COOKIE["AURSID"]) {
# the uploaded package file.
#
- $upload_file = $UPLOAD_DIR . $_FILES["pfile"]["name"];
+ $upload_file = UPLOAD_DIR . $_FILES["pfile"]["name"];
if (move_uploaded_file($_FILES["pfile"]["tmp_name"], $upload_file)) {
# ok, we can proceed
#
- if (file_exists($INCOMING_DIR . $pkg_name)) {
+ if (file_exists(INCOMING_DIR . $pkg_name)) {
# blow away the existing file/dir and contents
#
- rm_rf($INCOMING_DIR . $pkg_name);
+ rm_rf(INCOMING_DIR . $pkg_name);
}
} else {
@@ -113,13 +113,13 @@ if ($_COOKIE["AURSID"]) {
#
if (!$error) {
- if (!@mkdir($INCOMING_DIR.$pkg_name)) {
+ if (!@mkdir(INCOMING_DIR.$pkg_name)) {
$error = __("Could not create incoming directory: %s.",
- array($INCOMING_DIR.$pkg_name));
+ array(INCOMING_DIR.$pkg_name));
} else {
- if (!@chdir($INCOMING_DIR.$pkg_name)) {
+ if (!@chdir(INCOMING_DIR.$pkg_name)) {
$error = __("Could not change directory to %s.",
- array($INCOMING_DIR.$pkg_name));
+ array(INCOMING_DIR.$pkg_name));
} else {
# try .gz first
#
@@ -137,40 +137,40 @@ if ($_COOKIE["AURSID"]) {
}
# At this point, if no error exists, the package has been extracted
- # There should be a $INCOMING_DIR.$pkg_name."/".$pkg_name directory
+ # There should be a INCOMING_DIR.$pkg_name."/".$pkg_name directory
# 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")) {
+ 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)) {
+ if (!@chdir(INCOMING_DIR.$pkg_name."/".$pkg_name)) {
$error = __("Could not change to directory %s.",
- array($INCOMING_DIR.$pkg_name."/".$pkg_name));
+ array(INCOMING_DIR.$pkg_name."/".$pkg_name));
}
- $pkg_dir = $INCOMING_DIR.$pkg_name."/".$pkg_name;
- } elseif (is_file($INCOMING_DIR.$pkg_name."/PKGBUILD")) {
+ $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
+ # 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)) {
+ if (!@mkdir(INCOMING_DIR.$pkg_name."/".$pkg_name)) {
$error = __("Could not create directory %s.",
- array($INCOMING_DIR.$pkg_name."/".$pkg_name));
+ 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")) {
+ 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)) {
+ if (!@chdir(INCOMING_DIR.$pkg_name."/".$pkg_name)) {
$error = __("Could not change to directory %s.",
- array($INCOMING_DIR.$pkg_name."/".$pkg_name));
+ array(INCOMING_DIR.$pkg_name."/".$pkg_name));
}
- $pkg_dir = $INCOMING_DIR.$pkg_name."/".$pkg_name;
+ $pkg_dir = INCOMING_DIR.$pkg_name."/".$pkg_name;
} else {
# some wierd packaging/extraction error - baal
#
@@ -179,7 +179,7 @@ if ($_COOKIE["AURSID"]) {
}
$shcmd = "/bin/mv ".$upload_file." ";
- $shcmd.= escapeshellarg($INCOMING_DIR.$pkg_name."/".$_FILES["pfile"]["name"]);
+ $shcmd.= escapeshellarg(INCOMING_DIR.$pkg_name."/".$_FILES["pfile"]["name"]);
@exec($shcmd);
# if no error, get list of directory contents and process PKGBUILD
@@ -355,9 +355,9 @@ if ($_COOKIE["AURSID"]) {
# Re-tar the package for consistency's sake
#
if (!$error) {
- if (!@chdir($INCOMING_DIR.$pkg_name)) {
+ if (!@chdir(INCOMING_DIR.$pkg_name)) {
$error = __("Could not change directory to %s.",
- array($INCOMING_DIR.$pkg_name));
+ array(INCOMING_DIR.$pkg_name));
}
}
if (!$error) {
@@ -417,9 +417,9 @@ if ($_COOKIE["AURSID"]) {
} else {
$q.="Safe=0, ";
}
- $fspath=$INCOMING_DIR.$pkg_name."/".$_FILES["pfile"]["name"];
+ $fspath=INCOMING_DIR.$pkg_name."/".$_FILES["pfile"]["name"];
$q.="FSPath='".mysql_real_escape_string($fspath)."', ";
- $urlpath=$URL_DIR.$pkg_name."/".$_FILES["pfile"]["name"];
+ $urlpath=URL_DIR.$pkg_name."/".$_FILES["pfile"]["name"];
$q.="URLPath='".mysql_real_escape_string($urlpath)."' ";
$q.="WHERE ID = " . $pdata["ID"];
$result = db_query($q, $dbh);
@@ -430,8 +430,8 @@ if ($_COOKIE["AURSID"]) {
$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.= "'".INCOMING_DIR.$pkg_name."/".$pkg_name."/".$k."', ";
+ $q.= "'".URL_DIR.$pkg_name."/".$pkg_name."/".$k."', ";
$q.= $v.")";
db_query($q);
}
@@ -500,9 +500,9 @@ if ($_COOKIE["AURSID"]) {
$q.= "UNIX_TIMESTAMP(), ";
$q.= uid_from_sid($_COOKIE["AURSID"]).", ";
$q.= uid_from_sid($_COOKIE["AURSID"]).", '";
- $fspath=$INCOMING_DIR.$pkg_name."/".$_FILES["pfile"]["name"];
+ $fspath=INCOMING_DIR.$pkg_name."/".$_FILES["pfile"]["name"];
$q.= mysql_real_escape_string($fspath)."', '";
- $urlpath=$URL_DIR.$pkg_name."/".$_FILES["pfile"]["name"];
+ $urlpath=URL_DIR.$pkg_name."/".$_FILES["pfile"]["name"];
$q.= mysql_real_escape_string($urlpath)."')";
$result = db_query($q, $dbh);
# print $result . "<br>";
@@ -515,8 +515,8 @@ if ($_COOKIE["AURSID"]) {
$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.= "'".INCOMING_DIR.$pkg_name."/".$pkg_name."/".$k."', ";
+ $q.= "'".URL_DIR.$pkg_name."/".$pkg_name."/".$k."', ";
$q.= $v.")";
db_query($q);
}
diff --git a/web/lib/aur.inc b/web/lib/aur.inc
index ce662f7..380e2b6 100644
--- a/web/lib/aur.inc
+++ b/web/lib/aur.inc
@@ -12,26 +12,6 @@ include_once("aur_po.inc");
# is using...
#
-# Define global variables
-#
-$LOGIN_TIMEOUT = 7200; # number of idle seconds before timeout
-$SUPPORTED_LANGS = array( # what languages we have translations for
- "en" => "English",
- "pl" => "Polski",
- "it" => "Italiano",
- "ca" => "Català",
- "pt" => "Português",
- # Eventually we will comment these in, when they are ready - PJM - 4/2005
- "es" => "Español",
- "de" => "Deutsch",
- "ru" => "Русский",
- "fr" => "Français",
-);
-
-# debugging variables
-#
-$QBUG = 1; # toggle query logging to /var/tmp/aurq.log
-$DBUG = 1; # use dbug($msg) to log to /var/tmp/aurd.log
# return an array of info for each Trusted user
@@ -268,17 +248,13 @@ function uid_from_sid($sid="") {
# connect to the database
#
function db_connect() {
- global $AUR_db_host;
- global $AUR_db_name;
- global $AUR_db_user;
- global $AUR_db_pass;
- $handle = mysql_pconnect($AUR_db_host, $AUR_db_user, $AUR_db_pass);
+ $handle = mysql_pconnect(AUR_db_host, AUR_db_user, AUR_db_pass);
if (!$handle) {
die("Error connecting to AUR database: " . mysql_error());
}
- mysql_select_db($AUR_db_name, $handle) or
+ mysql_select_db(AUR_db_name, $handle) or
die("Error selecting AUR database: " . mysql_error());
return $handle;
@@ -296,7 +272,7 @@ function db_query($query="", $db_handle="") {
$db_handle = db_connect();
}
if ($QBUG) {
- $fp = fopen("/var/tmp/aurq.log", "a");
+ $fp = fopen(AURQ_LOG, "a");
fwrite($fp, $query . "\n");
fclose($fp);
}
@@ -453,7 +429,7 @@ function html_footer($ver="") {
# debug logging
#
function dbug($msg) {
- $fp = fopen("/var/tmp/aurd.log", "a");
+ $fp = fopen(AURD_LOG, "a");
fwrite($fp, $msg . "\n");
fclose($fp);
return;
diff --git a/web/lib/config.inc.proto b/web/lib/config.inc.proto
index fcb8b3a..bad94a0 100644
--- a/web/lib/config.inc.proto
+++ b/web/lib/config.inc.proto
@@ -1,15 +1,43 @@
<?php
# NOTE: modify these variables if your MySQL setup is different
#
-$AUR_db_host = "localhost:/tmp/mysql.sock";
-$AUR_db_name = "aur";
-$AUR_db_user = "aur";
-$AUR_db_pass = "aur";
+define( "AUR_db_host", "localhost:/tmp/mysql.sock" );
+define( "AUR_db_name", "aur" );
+define( "AUR_db_user", "aur" );
+define( "AUR_db_pass", "aur" );
# Configuration of directories where things live
-$UPLOAD_DIR = "/home/aur/unsupported-temp/";
-$INCOMING_DIR = "/home/aur/unsupported/";
-$URL_DIR = "/packages/";
+define( "UPLOAD_DIR", "/home/aur/unsupported-temp/" );
+define( "INCOMING_DIR", "/home/aur/unsupported/" );
+define( "URL_DIR", "/packages/" );
+
+define( "AURQ_LOG", "/home/aur/aurq.log" );
+define( "AURD_LOG", "/home/aur/aurd.log" );
+
+define( "USERNAME_MIN_LEN", 3 );
+define( "USERNAME_MAX_LEN", 16 );
+define( "PASSWD_MIN_LEN", 4 );
+define( "PASSWD_MAX_LEN", 128 );
+
+
+$LOGIN_TIMEOUT = 7200; # number of idle seconds before timeout
+
+# debugging variables
+#
+$QBUG = 1; # toggle query logging to /var/tmp/aurq.log
+$DBUG = 1; # use dbug($msg) to log to /var/tmp/aurd.log
+
+$SUPPORTED_LANGS = array( # what languages we have translations for
+ "en" => "English",
+ "pl" => "Polski",
+ "it" => "Italiano",
+ "ca" => "Català",
+ "pt" => "Português",
+ "es" => "Español",
+ "de" => "Deutsch",
+ "ru" => "Русский",
+ "fr" => "Français"
+);
# vim: ts=2 sw=2 noet ft=php
?>
diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc
index 2e5bd4b..cf87268 100644
--- a/web/lib/pkgfuncs.inc
+++ b/web/lib/pkgfuncs.inc
@@ -347,9 +347,8 @@ function package_details($id=0, $SID="") {
echo " <tr><td class='boxSoft' colspan='2'><img src='/images/pad.gif' height='15'></td></tr>\n";
echo " <tr><td class='boxSoft' colspan='2'><span class='f3'>";
if ($row["LocationID"] == 2) {
- global $URL_DIR;
- $urlpath = $URL_DIR.$row["Name"]."/".$row["Name"];
- echo "<a href='$urlpath.tar.gz'>".__("Tarball")."</a> :: <a href='$urlpath'>".__("Files")."</a> :: <a href='$urlpath/PKGBUILD'>PKGBUILD</a></span></td>";
+ $urlpath = URL_DIR.$row["Name"]."/".$row["Name"];
+ print "<a href='$urlpath.tar.gz'>".__("Tarball")."</a> :: <a href='$urlpath'>".__("Files")."</a> :: <a href='$urlpath/PKGBUILD'>PKGBUILD</a></span></td>";
} elseif ($row["LocationID"] == 3) {
echo "<a href='http://cvs.archlinux.org/cgi-bin/viewcvs.cgi/" . $row["Category"] . "/" . $row["Name"] . "/?cvsroot=AUR&only_with_tag=CURRENT'>CVS</td>";
}