Default theme and language for not logged user.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 22 Feb 2009 20:19:20 +0000 (20:19 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 22 Feb 2009 20:19:20 +0000 (20:19 +0000)
includes/current_user.inc
includes/prefs/userprefs.inc

index d180d0fbd5e6c8fe049192e5d999951decd178f5..dabec3ce2cfd94f6b33ed52cbbbce8e5cef8dcb5 100644 (file)
@@ -30,10 +30,10 @@ class current_user
 
        function current_user()
        {
-               $this->loginname = $username = $this->name = $this->company = "";
+               $this->loginname = $this->username = $this->name = $this->company = "";
                $this->logged = false;
 
-               $this->prefs = null;
+               $this->prefs = new user_prefs();
        }
 
        function logged_in()
index 00b77a9a34fe2df0d4d1cce5f1efbb0a841da130..43afba6fff0225fb97466ea2648a1d6692273e61 100644 (file)
@@ -34,30 +34,38 @@ class user_prefs
        var $query_size; // table pager page length
        var $graphic_links; // use graphic links
 
-       function user_prefs(&$user) 
-       {
-
-               $this->language = $user["language"];
-               language::set_language($this->language);
-
-               $this->qty_dec = $user["qty_dec"];
-               $this->price_dec = $user["prices_dec"];
-               $this->exrate_dec = $user["rates_dec"];
-               $this->percent_dec = $user["percent_dec"];
-
-               $this->show_gl_info = $user["show_gl"];
-               $this->show_codes = $user["show_codes"];
-               $this->date_format = $user["date_format"];
-               $this->date_sep = $user["date_sep"];
-               $this->tho_sep = $user["tho_sep"];
-               $this->dec_sep = $user["dec_sep"];
-               $this->theme = $user["theme"];
-               $this->pagesize = $user["page_size"];
-               $this->show_hints = $user["show_hints"];
-               $this->print_profile = $user["print_profile"];
-               $this->rep_popup = $user["rep_popup"];
-               $this->query_size = $user["query_size"];
-               $this->graphic_links = $user["graphic_links"];
+       function user_prefs($user=null)
+       {
+               if ($user == null) { 
+                       // set default values, used before login
+                       global $dflt_lang;
+                       
+                       $this->language = $dflt_lang;
+                       $this->theme = 'default';
+                       
+               } else {
+                       $this->language = $user["language"];
+                       language::set_language($this->language);
+
+                       $this->qty_dec = $user["qty_dec"];
+                       $this->price_dec = $user["prices_dec"];
+                       $this->exrate_dec = $user["rates_dec"];
+                       $this->percent_dec = $user["percent_dec"];
+
+                       $this->show_gl_info = $user["show_gl"];
+                       $this->show_codes = $user["show_codes"];
+                       $this->date_format = $user["date_format"];
+                       $this->date_sep = $user["date_sep"];
+                       $this->tho_sep = $user["tho_sep"];
+                       $this->dec_sep = $user["dec_sep"];
+                       $this->theme = $user["theme"];
+                       $this->pagesize = $user["page_size"];
+                       $this->show_hints = $user["show_hints"];
+                       $this->print_profile = $user["print_profile"];
+                       $this->rep_popup = $user["rep_popup"];
+                       $this->query_size = $user["query_size"];
+                       $this->graphic_links = $user["graphic_links"];
+               }
        }
 
        function language()