[aur-dev] [PATCH] Make all web paths relative.

Loui Chang louipc.ist at gmail.com
Sat Dec 20 23:42:35 EST 2008


The site no longer needs to be hosted from the
root of a domain, or virtual host.

Signed-off-by: Loui Chang <louipc.ist at gmail.com>
---
 web/html/css/arch.css       |    4 ++--
 web/lib/acctfuncs.inc       |    4 ++--
 web/lib/pkgfuncs.inc        |   22 +++++++++++-----------
 web/template/header.php     |   14 +++++++-------
 web/template/login_form.php |    2 +-
 5 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/web/html/css/arch.css b/web/html/css/arch.css
index 9dc630e..bc629e8 100644
--- a/web/html/css/arch.css
+++ b/web/html/css/arch.css
@@ -2,7 +2,7 @@
 * ul { padding: 20px; }
 body {
   min-width: 600px;
-  background: #fbf8f1 url("/images/titlebar.png") repeat-x top left;
+  background: #fbf8f1 url("../images/titlebar.png") repeat-x top left;
   padding: 0 30px;
   color: #555;
   font-family: "DejaVu Sans", "Bitstream Vera Sans", "Lucida Grande", Arial, sans-serif;
@@ -125,7 +125,7 @@ body {
 }
 #logo h1#archtitle a {
   display: block;
-  background: transparent url("/images/titlelogo.png") top left no-repeat;
+  background: transparent url("../images/titlelogo.png") top left no-repeat;
   width: 350px;
   height: 103px;
 }
diff --git a/web/lib/acctfuncs.inc b/web/lib/acctfuncs.inc
index 6120777..d7fabcf 100644
--- a/web/lib/acctfuncs.inc
+++ b/web/lib/acctfuncs.inc
@@ -463,7 +463,7 @@ function search_results_page($UTYPE,$O=0,$SB="",$U="",$T="",
 				}
 				print "<tr>";
 				print "<td class='".$c."'>";
-				print "<span class='f5'><a href='/packages.php?SeB=m&K=".$row["Username"]."'>".$row["Username"]."</a></span></td>";
+				print "<span class='f5'><a href='packages.php?SeB=m&K=".$row["Username"]."'>".$row["Username"]."</a></span></td>";
 				print "<td class='".$c."'>";
 				print "<span class='f5'>".$row["AccountType"];
 				print "</span></td>";
@@ -593,7 +593,7 @@ function display_account_info($U="",$T="",
 	print "  </tr>\n";
 
 	print "  <tr>\n";
-	print "    <td colspan='2'><a href='/packages.php?K=".$U."&SeB=m'>".__("View this user's packages")."</a></td>\n";
+	print "    <td colspan='2'><a href='packages.php?K=".$U."&SeB=m'>".__("View this user's packages")."</a></td>\n";
 	print "  </tr>\n";
 
 	print "</table>\n";
diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc
index f99810a..ca054db 100644
--- a/web/lib/pkgfuncs.inc
+++ b/web/lib/pkgfuncs.inc
@@ -306,7 +306,7 @@ function package_details($id=0, $SID="") {
 					uid_from_sid($SID) == $row["MaintainerUID"] or
 					(account_from_sid($SID) == "Developer" or
 					 account_from_sid($SID) == "Trusted User"))) {
-			  $edit_cat = "<a href='/pkgedit.php?change_Category=1&ID=";
+			  $edit_cat = "<a href='pkgedit.php?change_Category=1&ID=";
 			  $edit_cat .= intval($_REQUEST["ID"])."'>".$row["Category"]."</a>";
 			  $edit_cat .= " &nbsp;<span class='fix'>(";
 			  $edit_cat .= __("change category").")</span>";
@@ -318,7 +318,7 @@ function package_details($id=0, $SID="") {
 			if ($row["MaintainerUID"]) {
 				$maintainer = username_from_id($row["MaintainerUID"]);
 				if ($SID) {
-					echo "<a href='/account.php?Action=AccountInfo&ID=";
+					echo "<a href='account.php?Action=AccountInfo&ID=";
 					echo $row["MaintainerUID"] . "'>";
 					echo $maintainer . "</a></span></td>";
 				} else {
@@ -473,7 +473,7 @@ function package_details($id=0, $SID="") {
                 echo "<div class=\"pgbox\">\n";
                 echo "  <div class=\"pgboxtitle\"><span class=\"f3\">".__("Actions")."</span></div>\n";
                 echo "  <div class=\"pgboxbody\">\n";
-                echo "    <form action='/packages.php?ID=".$row['ID']."' method='post'>\n";
+                echo "    <form action='packages.php?ID=".$row['ID']."' method='post'>\n";
 				echo "      <input type='hidden' name='IDs[".$row["ID"]."]' value='1'>\n";
 				echo "      <input type='hidden' name='ID' value='".$row["ID"]."'>\n";
 				# Voting Button
@@ -537,7 +537,7 @@ function package_details($id=0, $SID="") {
 			echo "    <table width='100%'>\n";
 			if (isset($_COOKIE['AURSID'])) {
 				echo "<tr><td>";
-				echo "          <form action='/pkgedit.php' method='post'>\n";
+				echo "          <form action='pkgedit.php' method='post'>\n";
 				echo "            <input type='hidden' name='ID' value='".$row["ID"]."'>\n";
 				echo "            <input type='submit' class='button' name='add_Comment' value=\"";
 				echo __("Add Comment")."\">\n";
@@ -555,7 +555,7 @@ function package_details($id=0, $SID="") {
 					echo "            <tr>\n";
 					echo "              <td class='boxSoftTitle'><span class='f3'>";
 					if (canDeleteComment($carr["ID"], account_from_sid($SID), $SID)) {
-						$durl = "<a href='/pkgedit.php?del_Comment=1";
+						$durl = "<a href='pkgedit.php?del_Comment=1";
 						$durl.= "&comment_id=".$carr["ID"]."&ID=".$row["ID"];
 						$durl.= "'><img src='/images/x.png' border='0'";
 						$durl.= " alt=\"".__("Delete comment")."\"></a>";
@@ -564,7 +564,7 @@ function package_details($id=0, $SID="") {
 					}
 					if ($SID) {
 						echo __("Comment by: %h%s%h on %h%s%h",
-							array("<a href='/account.php?Action=AccountInfo&ID=".$carr["UsersID"]."'><b>",$carr["UserName"],"</b></a>",
+							array("<a href='account.php?Action=AccountInfo&ID=".$carr["UsersID"]."'><b>",$carr["UserName"],"</b></a>",
 							      "<i>",gmdate("Ymd [H:i:s]",$carr["CommentTS"]),"</i>"));
 					} else {
 						echo __("Comment by: %h%s%h on %h%s%h",
@@ -767,7 +767,7 @@ function pkg_search_page($SID="") {
     $result = db_query($q, $dbh);
     $total = mysql_result(db_query('SELECT FOUND_ROWS() AS Total', $dbh), 0);
 
-    print "<form action='/packages.php?".$_SERVER['QUERY_STRING']."' method='post'>\n";
+    print "<form action='packages.php?".$_SERVER['QUERY_STRING']."' method='post'>\n";
     print "<center>\n";
     print "<table cellspacing='3' class='boxSoft'>\n";
     print "<tr>\n";
@@ -856,7 +856,7 @@ function pkg_search_page($SID="") {
             print "  <td class='".$c."'><span class='f5'><span class='blue'>";
             print $row["Category"]."</span></span></td>\n";
             print "  <td class='".$c."'><span class='f4'>";
-            $url = "<a href='/packages.php?";
+            $url = "<a href='packages.php?";
             $url .= "ID=";
             $url .= $row["ID"];
             $url.= "'>";
@@ -957,15 +957,15 @@ function pkg_search_page($SID="") {
         print "  <tr>";
         print "    <td align='left'>";
         if (($O-$PP) >= 0) {
-            print "<a href='/packages.php?O=" . ($O - $PP) . "&L=".intval($_REQUEST["L"])."&C=".intval($_REQUEST["C"])."&K=$K&SB=$SB&SO=$SO&PP=$PP&SeB=".$_REQUEST["SeB"]."&do_Orphans=".$_REQUEST["do_Orphans"]. "'>" . __("Less") . "</a>";
+            print "<a href='packages.php?O=" . ($O - $PP) . "&L=".intval($_REQUEST["L"])."&C=".intval($_REQUEST["C"])."&K=$K&SB=$SB&SO=$SO&PP=$PP&SeB=".$_REQUEST["SeB"]."&do_Orphans=".$_REQUEST["do_Orphans"]. "'>" . __("Less") . "</a>";
         } else if ($O<$PP && $O>0) {
-            print "<a href='/packages.php?O=0&L=".intval($_REQUEST["L"])."&C=".intval($_REQUEST["C"])."&K=$K&SB=$SB&SO=$SO&PP=$PP&SeB=".$_REQUEST["SeB"]."&do_Orphans=".$_REQUEST["do_Orphans"]. "'>" . __("Less") . "</a>";
+            print "<a href='packages.php?O=0&L=".intval($_REQUEST["L"])."&C=".intval($_REQUEST["C"])."&K=$K&SB=$SB&SO=$SO&PP=$PP&SeB=".$_REQUEST["SeB"]."&do_Orphans=".$_REQUEST["do_Orphans"]. "'>" . __("Less") . "</a>";
         }
         print "    </td>";
         // RIGHT
         print "    <td align='right'>";
         if ($total - $PP - $O > 0) {
-            print "<a href='/packages.php?O=" . ($O + $PP) .
+            print "<a href='packages.php?O=" . ($O + $PP) .
                 "&L=".intval($_REQUEST["L"])."&C=".intval($_REQUEST["C"]) .
                 "&K=$K&SB=$SB&SO=$SO&PP=$PP&SeB=".$_REQUEST["SeB"] .
                 "&do_Orphans=".$_REQUEST["do_Orphans"]."'>" .
diff --git a/web/template/header.php b/web/template/header.php
index 352135a..dcf99f3 100644
--- a/web/template/header.php
+++ b/web/template/header.php
@@ -5,9 +5,9 @@
 	xml:lang="<?php print "$LANG\" lang=\"$LANG"; ?>">
   <head>
     <title>AUR (<?php print $LANG; ?>)<?php if ($title != "") { print " - " . $title; } ?></title>
-	<link rel='stylesheet' type='text/css' href='/css/fonts.css' />
-	<link rel='stylesheet' type='text/css' href='/css/containers.css' />
-	<link rel='stylesheet' type='text/css' href='/css/arch.css' />
+	<link rel='stylesheet' type='text/css' href='css/fonts.css' />
+	<link rel='stylesheet' type='text/css' href='css/containers.css' />
+	<link rel='stylesheet' type='text/css' href='css/arch.css' />
 	<link rel='shortcut icon' href='images/favicon.ico' />
 	<link rel='alternate' type='application/rss+xml' title='Newest Packages RSS' href='rss2.php' />
 	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@@ -20,7 +20,7 @@
       <div id="main_nav">
         <ul>
           <li><a href="http://www.archlinux.org/download/">Download</a></li>
-          <li class="selected"><a href="/">AUR</a></li>
+          <li class="selected"><a href="index.php">AUR</a></li>
           <li><a href="http://bugs.archlinux.org/">Bugs</a></li>
           <li><a href="http://wiki.archlinux.org/">Wiki</a></li>
           <li><a href="http://bbs.archlinux.org/">Forums</a></li>
@@ -46,13 +46,13 @@
 <?php
 if (isset($_COOKIE["AURSID"])) {
 ?>
-	      <li><a href="/pkgsubmit.php"><?php print __("Submit"); ?></a></li>
-          <li><a href="/packages.php?SeB=m&K=<?php print username_from_sid($_COOKIE["AURSID"]); ?>"><?php print __("My Packages"); ?></a></li>
+	      <li><a href="pkgsubmit.php"><?php print __("Submit"); ?></a></li>
+          <li><a href="packages.php?SeB=m&K=<?php print username_from_sid($_COOKIE["AURSID"]); ?>"><?php print __("My Packages"); ?></a></li>
 <?php
 	if (account_from_sid($_COOKIE["AURSID"]) == "Trusted User"
 		|| account_from_sid($_COOKIE["AURSID"]) == "Developer") {
 ?>
-	      <li><a href="/tu.php"><?php print __("Trusted User"); ?></a></li>
+	      <li><a href="tu.php"><?php print __("Trusted User"); ?></a></li>
 <?php
 	}
 }
diff --git a/web/template/login_form.php b/web/template/login_form.php
index 70c24c7..1eba5cf 100644
--- a/web/template/login_form.php
+++ b/web/template/login_form.php
@@ -3,7 +3,7 @@
   if (isset($_COOKIE["AURSID"])) {
     print __("Logged-in as: %h%s%h", array("<b>", username_from_sid($_COOKIE["AURSID"]), "</b>"));
 ?>
-<br /><a href="/logout.php"><?php print __("Logout"); ?></a>
+<br /><a href="logout.php"><?php print __("Logout"); ?></a>
 <?php
   }
   else {
-- 
1.6.0.5



More information about the aur-dev mailing list