user_theme() fixed to be used also before login, warning suppressed in array_search_value
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Thu, 5 Aug 2010 10:03:06 +0000 (10:03 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Thu, 5 Aug 2010 10:03:06 +0000 (10:03 +0000)
includes/current_user.inc

index a7a35303fc73aea76e4375991e87473220a268f4..ab5073a63d8a95329324c12909689c82b815eab5 100644 (file)
@@ -353,7 +353,8 @@ function user_dec_sep()
 
 function user_theme()
 {
-       return $_SESSION["wa_current_user"]->prefs->get_theme();
+       return isset($_SESSION["wa_current_user"]) ?
+               $_SESSION["wa_current_user"]->prefs->get_theme() : 'default';
 }
 
 function user_pagesize()
@@ -469,7 +470,7 @@ function array_append(&$array, $elements)
 function array_search_value($needle, $haystack, $valuekey=null)
 {
        foreach($haystack as $key => $value) {
-               $val = isset($valuekey) ? $value[$valuekey] : $value;
+               $val = isset($valuekey) ? @$value[$valuekey] : $value;
                if ($needle == $val){
                        return $value;
                }