Restore of the 4 include files in types.inc
[fa-stable.git] / includes / lang / language.php
index 059901cfc66cfee89278b72f929ea583d6973b3e..f9b86b17ceaf2bfb84cfb10a54c87b893315dca1 100644 (file)
@@ -9,6 +9,9 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
+// Prevent register_globals vulnerability
+if (isset($_GET['path_to_root']) || isset($_POST['path_to_root']))
+       die("Restricted access");
 include_once($path_to_root . "/lang/installed_languages.inc");
 include_once($path_to_root . "/includes/lang/gettext.php");
 
@@ -54,10 +57,9 @@ class language
                        // check id file exists only once for session
                        $_SESSION['language']->is_locale_file = file_exists($locale);
                }
-
                $lang = $_SESSION['language'];
-               get_text::set_language($lang->code, $lang->encoding);
-               get_text::add_domain($lang->code, $path_to_root . "/lang");
+               $_SESSION['get_text']->set_language($lang->code, $lang->encoding);
+               $_SESSION['get_text']->add_domain($lang->code, $path_to_root . "/lang");
                
                // Necessary for ajax calls. Due to bug in php 4.3.10 for this 
                // version set globally in php.ini
@@ -66,7 +68,7 @@ class language
                if (isset($_SESSION['App']) && $changed)
                        $_SESSION['App']->init(); // refresh menu
        }
-
+}
        /**
         * This method loads an array of language objects into a session variable
      * called $_SESSIONS['languages']. Only supported languages are added.
@@ -89,36 +91,16 @@ class language
                        $_SESSION['language'] = $_SESSION['languages'][$dflt_lang];
        }
 
-}
-/*
-       Test if named function is defined in locale.inc file.
-*/
-function has_locale($fun=null)
-{
-       global $path_to_root;
-       
-       if ($_SESSION['language']->is_locale_file)
-       {
-               global $path_to_root;
-               include_once($path_to_root . "/lang/" . 
-                       $_SESSION['language']->code . "/locale.inc");
-
-               if (!isset($fun) || function_exists($fun))
-                       return true;
-       }
-       return false;
-}
-
 function _set($key,$value) 
 {
-       get_text::set_var($key,$value);
+       $_SESSION['get_text']->set_var($key,$value);
 }
 
 if (!function_exists("_")) 
 {
        function _($text) 
        {
-               $retVal = get_text::gettext($text);
+               $retVal = $_SESSION['get_text']->gettext($text);
                if ($retVal == "")
                        return $text;
                return $retVal;