From 1a1a6eb36e17315f08eee0e44a83fe4bdf0887f5 Mon Sep 17 00:00:00 2001 From: Loui Chang Date: Wed, 9 Jul 2008 14:38:08 -0400 Subject: Add a new DEFAULT_LANG constant. DEFAULT_LANG will essentially be used to specify what language strings are initially written in. This will eliminate the need for English translation arrays in AUR and make adding or changing the English strings a lot easier. DEFAULT_LANG may be required for strings to display properly. Also change the output when a translation isn't found. Eliminate the which can cause validation errors depending on where the string is placed. Signed-off-by: Loui Chang --- web/lib/aur.inc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'web/lib/aur.inc') diff --git a/web/lib/aur.inc b/web/lib/aur.inc index 81ffde2..ade5b82 100644 --- a/web/lib/aur.inc +++ b/web/lib/aur.inc @@ -311,12 +311,11 @@ function set_lang() { $LANG = $row[0]; } $update_cookie = 1; - } else { - $LANG = "en"; } + # Set $LANG to default if nothing is valid. if (!array_key_exists($LANG, $SUPPORTED_LANGS)) { - $LANG = "en"; # default to English + $LANG = DEFAULT_LANG; } if ($update_cookie) { @@ -336,7 +335,7 @@ function html_header($title="") { global $SUPPORTED_LANGS; $login = try_login(); - $login_error = $login['error']; + $login_error = $login['error']; $title = htmlspecialchars($title, ENT_QUOTES); @@ -410,4 +409,3 @@ function uid_from_username($username="") return $row[0]; } -?> -- cgit v1.2.3-70-g09d2 From 5c3f01909301f641f57b2ffe8b59609de6be2256 Mon Sep 17 00:00:00 2001 From: Loui Chang Date: Fri, 12 Sep 2008 20:19:42 -0400 Subject: Use system rm in rm_rf function. PHP can't properly handle symlinks which causes problems when self-referencing symlinks appear. This closes FS#11187. Signed-off-by: Loui Chang --- web/lib/aur.inc | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'web/lib/aur.inc') diff --git a/web/lib/aur.inc b/web/lib/aur.inc index ade5b82..a126bb9 100644 --- a/web/lib/aur.inc +++ b/web/lib/aur.inc @@ -374,19 +374,10 @@ function can_submit_pkg($name="", $sid="") { # recursive delete directory # function rm_rf($dirname="") { - $d = dir($dirname); - while ($f = $d->read()) { - if ($f != "." && $f != "..") { - if (is_dir($dirname."/".$f)) { - rm_rf($dirname."/".$f); - } - if (is_file($dirname."/".$f) || is_link($dirname."/".$f)) { - unlink($dirname."/".$f); - } - } + if ($dirname != "") { + exec('rm -rf ' . escapeshellcmd($dirname)); } - $d->close(); - rmdir($dirname); + return; } -- cgit v1.2.3-70-g09d2