aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--functions.inc.php48
-rw-r--r--templates/users_main.tpl2
2 files changed, 20 insertions, 30 deletions
diff --git a/functions.inc.php b/functions.inc.php
index 3f0b3b6..6311346 100644
--- a/functions.inc.php
+++ b/functions.inc.php
@@ -34,12 +34,10 @@ function check_session ()
return $SESSID_USERNAME;
}
-function check_user_session ()
-{
- session_start ();
- if (!$_SESSION['sessid']['username'])
- {
- header ("Location: login.php");
+function check_user_session() {
+ session_start();
+ if (!isset($_SESSION['sessid']['username'])) {
+ header("Location: login.php");
exit;
}
$USERID_USERNAME = $_SESSION['sessid']['username'];
@@ -53,33 +51,25 @@ function check_user_session ()
// Action: checks what language the browser uses
// Call: check_language
//
-function check_language ()
-{
- global $CONF;
- $supported_languages = array ('en');
- $lang_array = preg_split ('/(\s*,\s*)/', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
- if (is_array ($lang_array))
- {
- $lang_first = strtolower ((trim (strval ($lang_array[0]))));
- $lang_first = substr ($lang_first, 0, 2);
- if (in_array ($lang_first, $supported_languages))
- {
- $lang = $lang_first;
- }
- else
- {
- $lang = $CONF['default_language'];
- }
- }
- else
- {
- $lang = $CONF['default_language'];
- }
- return $lang;
+function check_language() {
+ global $CONF;
+ $supported_languages = array ('en');
+ if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
+ $lang_array = preg_split ('/(\s*,\s*)/', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
+ if (is_array($lang_array)) {
+ $lang_first = strtolower((trim(strval($lang_array[0]))));
+ $lang_first = substr($lang_first, 0, 2);
+ if (in_array($lang_first, $supported_languages)) {
+ return $lang_first;
+ }
+ }
+ }
+ return $CONF['default_language'];
}
+
//
// check_string
// Action: checks if a string is valid and returns TRUE is this is the case.
diff --git a/templates/users_main.tpl b/templates/users_main.tpl
index 3b455ad..4cbf7ea 100644
--- a/templates/users_main.tpl
+++ b/templates/users_main.tpl
@@ -2,7 +2,7 @@
<table>
<tr>
<td>&nbsp;</td>
- <td><?php print $_SESSION['userid']['username']; ?></td>
+ <td><?php print $_SESSION['sessid']['username']; ?></td>
</tr>
<?php if ($CONF['vacation'] == 'YES') { ?>
<tr>