Minor adjustments
[fa-stable.git] / frontaccounting.php
index df1ff02cfdcdb15bd5ada726c72b18b3aa2534fd..267780b191b40593fbf4880aea4d5c480ccf5415 100644 (file)
@@ -9,6 +9,8 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
+if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_to_root']))
+       die("Restricted access");
        include_once($path_to_root . '/applications/application.php');
        include_once($path_to_root . '/applications/customers.php');
        include_once($path_to_root . '/applications/suppliers.php');
        {
                foreach ($installed_extensions as $ext)
                {
-                       include_once($path_to_root."/".$ext['folder']."/".$ext['app_file']);
+                       if ($ext['type'] == 'module')
+                               @include_once($path_to_root."/".$ext['path']."/".$ext['filename']);
                }
        }       
 
-       include_once($path_to_root . '/modules/installed_modules.php');
-
        class front_accounting
                {
                var $user;
@@ -42,8 +43,9 @@
                        //$this->renderer =& new renderer();
                }
                function add_application(&$app)
-                               {
-                                                       $this->applications[$app->id] = &$app;
+                               {       
+                                       if ($app->enabled) // skip inactive modules
+                                               $this->applications[$app->id] = &$app;
                                }
                function get_application($id)
                                {
                        {
                                foreach ($installed_extensions as $ext)
                                {
-                                       get_text::add_domain($_SESSION['language']->code, 
-                                               $ext['folder']."/lang");
-                                       $class = $ext['name']."_app";
-                                       $this->add_application(new $class());
-                                       get_text::add_domain($_SESSION['language']->code, 
-                                               $path_to_root."/lang");
+                                       if (@($ext['active'] && $ext['type'] == 'module')) { // supressed warnings before 2.2 upgrade
+                                               $_SESSION['get_text']->add_domain($_SESSION['language']->code, 
+                                                       $ext['path']."/lang");
+                                               $class = $ext['tab']."_app";
+                                               if (class_exists($class))
+                                                       $this->add_application(new $class());
+                                               $_SESSION['get_text']->add_domain($_SESSION['language']->code, 
+                                                       $path_to_root."/lang");
+                                       }
                                }
                        }