summaryrefslogtreecommitdiffstats
path: root/web/lib
diff options
context:
space:
mode:
authoreric <eric>2004-06-23 20:54:50 +0200
committereric <eric>2004-06-23 20:54:50 +0200
commit252855ad9cbc9667faba0627680333137d70da9f (patch)
tree6c1117f54c366fb708bfb894e691ac5b26c1e1e1 /web/lib
parent342d5dfce063550faa6c8871768367e56577bb2c (diff)
downloadaur-252855ad9cbc9667faba0627680333137d70da9f.tar.gz
aur-252855ad9cbc9667faba0627680333137d70da9f.tar.xz
possibly merge some scripts?
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/aur.inc30
1 files changed, 23 insertions, 7 deletions
diff --git a/web/lib/aur.inc b/web/lib/aur.inc
index ecedb51f..ce3b7d9a 100644
--- a/web/lib/aur.inc
+++ b/web/lib/aur.inc
@@ -1,6 +1,12 @@
<?
include_once("aur_po.inc");
+# TODO do we need to set the domain on cookies? I seem to remember some
+# security concerns about not using domains - but it's not like
+# we really care if another site can see what language/SID a user
+# is using...
+#
+
# Define global variables
#
$LOGIN_TIMEOUT = 1800; # number of idle seconds before timeout
@@ -223,18 +229,28 @@ function set_lang() {
#
$LANG = $_COOKIE['AURLANG'];
- } # TODO query the database if the user is logged in
+ } elseif (isset($_COOKIE["AURSID"])) {
+ $dbh = db_connect();
+ $q = "SELECT LangPreference FROM Users, Sessions ";
+ $q.= "WHERE Users.ID = Sessions.UsersID ";
+ $q.= "AND Sessions.SessionID = '";
+ $q.= mysql_escape_string($_COOKIE["AURSID"])."'";
+ $result = db_query($q, $dbh);
+ if (!$result) {
+ $LANG = "en";
+ } else {
+ $row = mysql_fetch_array($result);
+ $LANG = $row[0];
+ }
+ } else {
+ $LANG = "en";
+ }
- if (!$LANG || !array_key_exists($LANG, $SUPPORTED_LANGS)) {
+ if (!array_key_exists($LANG, $SUPPORTED_LANGS)) {
$LANG = "en"; # default to English
}
if ($update_cookie) {
- # TODO do we need to set the domain too? I seem to remember some
- # security concerns about not using domains - but it's not like
- # we really care if another site can see what language our visitor
- # was using....
- #
setcookie("AURLANG", $LANG, 0, "/");
}
return;