hi,
Changed some URL's and used mod_rewrite to make them look nicer.
I left the search function of packages.
But I still work on it.
>From 74f5fd4b4df031b3f93c616238f822159c378706 Mon Sep 17 00:00:00 2001
From: Viktor Leonhardt <[email protected]>
Date: Sun, 7 Mar 2010 20:03:20 +0100
Subject: [PATCH] Changed some URL's and used mod_rewrite to make them look
nicer. I left the search function of packages.
---
web/html/.htaccess | 21 +++++++++++++++++++++
web/template/header.php | 17 +++++++++--------
web/template/pkg_search_form.php | 2 +-
3 files changed, 31 insertions(+), 9 deletions(-)
create mode 100755 web/html/.htaccess
diff --git a/web/html/.htaccess b/web/html/.htaccess
new file mode 100755
index 0000000..289322a
--- /dev/null
+++ b/web/html/.htaccess
@@ -0,0 +1,21 @@
+RewriteEngine on
+
+RewriteBase /
+
+# if its not a file do:
+# if there is no slash at the end do:
+# replace the whole URL and set it into slashes
+
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{REQUEST_URI} !(.*)/$
+RewriteRule ^(.*)$ /$1/ [R=301]
+
+RewriteRule ^$ index.php
+
+RewriteRule ^(account|packages|pkgsubmit|logout)/$ /$1.php
+RewriteRule ^trusteduser/$ /tu.php
+
+RewriteRule
^(account|packages|pkgsubmit|trusteduser)/setlang-([a-z][_a-zA-Z]+)/$
/$1.php?setlang=$2
+RewriteRule ^setlang-([a-z][_a-zA-Z]+)/$ /index.php?setlang=$1
+
+RewriteRule ^packages/(.*)/$ /packages.php?SeB=m&K=$1
\ No newline at end of file
diff --git a/web/template/header.php b/web/template/header.php
index 3f8cff1..d1d3c30 100644
--- a/web/template/header.php
+++ b/web/template/header.php
@@ -5,6 +5,7 @@
xml:lang="<?php print "$LANG\" lang=\"$LANG"; ?>">
<head>
<title>AUR (<?php print $LANG; ?>)<?php if ($title != "") { print " - " .
$title; } ?></title>
+ <base href="http://aur/" />
<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' />
@@ -21,13 +22,13 @@
<a href="http://bbs.archlinux.org/">Forums</a>
<a href="http://wiki.archlinux.org/">Wiki</a>
<a href="http://bugs.archlinux.org/">Bugs</a>
- <a class="selected" href="index.php">AUR</a>
+ <a class="selected" href="/">AUR</a>
<a href="http://www.archlinux.org/download/">Download</a>
</div>
<div id="sub_nav">
- <a href="index.php">AUR <?php print __("Home"); ?></a>
- <a href="account.php"><?php print __("Accounts"); ?></a>
- <a href="packages.php"><?php print __("Packages"); ?></a>
+ <a href="/">AUR <?php print __("Home"); ?></a>
+ <a href="/account/"><?php print __("Accounts"); ?></a>
+ <a href="/packages/"><?php print __("Packages"); ?></a>
<a
href="http://bugs.archlinux.org/index.php?tasks=all&project=2"><?php print
__("Bugs"); ?></a>
<a href="http://archlinux.org/mailman/listinfo/aur-general">
<?php print __("Discussion"); ?></a>
@@ -37,12 +38,12 @@ if (isset($_COOKIE["AURSID"])) {
$atype = account_from_sid($SID);
if ($atype == "Trusted User" || $atype == "Developer") {
?>
- <a href="tu.php"><?php print __("Trusted User"); ?></a>
+ <a href="trusteduser/"><?php print __("Trusted User"); ?></a>
<?php
}
?>
- <a href="packages.php?SeB=m&K=<?php print
username_from_sid($_COOKIE["AURSID"]); ?>"><?php print __("My Packages"); ?></a>
- <a href="pkgsubmit.php"><?php print __("Submit"); ?></a>
+ <a href="packages/<?php print username_from_sid($_COOKIE["AURSID"]);
?>/"><?php print __("My Packages"); ?></a>
+ <a href="pkgsubmit/"><?php print __("Submit"); ?></a>
<?php
}
?>
@@ -54,7 +55,7 @@ if (isset($_COOKIE["AURSID"])) {
reset($SUPPORTED_LANGS);
foreach ($SUPPORTED_LANGS as $lang => $lang_name) {
print '<a href="'
- . $_SERVER["PHP_SELF"]."?setlang=$lang\""
+ .(($_SERVER["PHP_SELF"]=="/index.php") ? "" :
substr($_SERVER["PHP_SELF"],0,strlen($_SERVER["PHP_SELF"])-4)."/")
."setlang-$lang\""
. " title=\"$lang_name\">"
. strtolower($lang) . "</a>\n";
}
diff --git a/web/template/pkg_search_form.php b/web/template/pkg_search_form.php
index 567db5a..b7d777f 100644
--- a/web/template/pkg_search_form.php
+++ b/web/template/pkg_search_form.php
@@ -11,7 +11,7 @@
<input type='submit' style='width:80px' class='button'
name='do_Orphans' value='<?php print __("Orphans"); ?>' />
<?php endif; ?>
- <a href="?<?php print mkurl('detail=' . ((!empty($_GET['detail'])) ? 0
: 1) ) ?>"><?php print __("Advanced"); ?></a>
+ <a href="packages.php?<?php print mkurl('detail=' .
((!empty($_GET['detail'])) ? 0 : 1) ) ?>"><?php print __("Advanced"); ?></a>
</div>
<?php if (!empty($_GET['detail'])): ?>
--
1.7.0.1