From 5a1c9f87c2d7d65664e249a116de5f0c52e0163d Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Wed, 11 Nov 2015 11:08:41 +0900 Subject: [PATCH] Update core class include style and smarty test page All libs/classes have an loop to find the needed previous class file. Smarty test page included. --- www/admin/smarty_test.php | 23 +++++++++++++++++++ www/configs/config.inc | 9 ++++++++ .../admin/default/templates/smarty_test.tpl | 3 +++ www/libs/Class.Admin.Backend.inc | 8 ++++++- www/libs/Class.DB.Array.IO.inc | 8 ++++++- www/libs/Class.DB.IO.inc | 8 ++++++- www/libs/Class.Form.Generate.inc | 8 ++++++- www/libs/Class.Login.inc | 8 ++++++- www/libs/Class.Smarty.Extend.inc | 8 ++++++- www/libs/Class.l10n.inc | 8 ++++++- 10 files changed, 84 insertions(+), 7 deletions(-) create mode 100644 www/admin/smarty_test.php create mode 100644 www/layout/admin/default/templates/smarty_test.tpl diff --git a/www/admin/smarty_test.php b/www/admin/smarty_test.php new file mode 100644 index 00000000..4ed39093 --- /dev/null +++ b/www/admin/smarty_test.php @@ -0,0 +1,23 @@ +DATA['SMARTY_TEST'] = 'Test Data'; + + require("smarty.inc"); + require("footer.inc"); +?> diff --git a/www/configs/config.inc b/www/configs/config.inc index 34eec5e9..dec3aa0f 100644 --- a/www/configs/config.inc +++ b/www/configs/config.inc @@ -236,6 +236,15 @@ $DEBUG_ALL = 0; $PRINT_ALL = 0; $DB_DEBUG = 0; + $ENABLE_ERROR_HANDLING = 0; + } + else + { + $ECHO_ALL = 1; + $DEBUG_ALL = 1; + $PRINT_ALL = 1; + $DB_DEBUG = 1; + $ENABLE_ERROR_HANDLING = 1; } // any other global definitons here diff --git a/www/layout/admin/default/templates/smarty_test.tpl b/www/layout/admin/default/templates/smarty_test.tpl new file mode 100644 index 00000000..8d2bb078 --- /dev/null +++ b/www/layout/admin/default/templates/smarty_test.tpl @@ -0,0 +1,3 @@ +
+ {$SMARTY_TEST} +
diff --git a/www/libs/Class.Admin.Backend.inc b/www/libs/Class.Admin.Backend.inc index 36885856..0a14345b 100644 --- a/www/libs/Class.Admin.Backend.inc +++ b/www/libs/Class.Admin.Backend.inc @@ -25,7 +25,13 @@ * *********************************************************************/ - require_once(LIBS."Class.DB.IO.inc"); + // try to include file from LIBS path, or from normal path + $include_file = 'Class.DB.IO.inc'; + foreach (array('', LIBS, __DIR__.'/') as $folder) + { + if (file_exists($folder.$include_file)) + require_once($folder.$include_file); + } class AdminBackend extends db_io { diff --git a/www/libs/Class.DB.Array.IO.inc b/www/libs/Class.DB.Array.IO.inc index 57e8e5c2..908bc1db 100644 --- a/www/libs/Class.DB.Array.IO.inc +++ b/www/libs/Class.DB.Array.IO.inc @@ -38,7 +38,13 @@ // as it actually has nothing to do with this one here ? (or at least // put into separete function in this class) - require_once(LIBS."Class.DB.IO.inc"); + // try to include file from LIBS path, or from normal path + $include_file = 'Class.DB.IO.inc'; + foreach (array('', LIBS, __DIR__.'/') as $folder) + { + if (file_exists($folder.$include_file)) + require_once($folder.$include_file); + } // subclass for one array handling class db_array_io extends db_io diff --git a/www/libs/Class.DB.IO.inc b/www/libs/Class.DB.IO.inc index 9f085719..97256775 100644 --- a/www/libs/Class.DB.IO.inc +++ b/www/libs/Class.DB.IO.inc @@ -240,7 +240,13 @@ * 23.11.2000: erster Test *********************************************************************/ - require_once(LIBS.'Class.Basic.inc'); + // try to include file from LIBS path, or from normal path + $include_file = 'Class.Basic.inc'; + foreach (array('', LIBS, __DIR__.'/') as $folder) + { + if (file_exists($folder.$include_file)) + require_once($folder.$include_file); + } class db_io extends basic { diff --git a/www/libs/Class.Form.Generate.inc b/www/libs/Class.Form.Generate.inc index 1cdb335a..95c405c3 100644 --- a/www/libs/Class.Form.Generate.inc +++ b/www/libs/Class.Form.Generate.inc @@ -212,7 +212,13 @@ * save data, loads data, etc *********************************************************************/ - require_once(LIBS."Class.DB.Array.IO.inc"); + // try to include file from LIBS path, or from normal path + $include_file = 'Class.DB.Array.IO.inc'; + foreach (array('', LIBS, __DIR__.'/') as $folder) + { + if (file_exists($folder.$include_file)) + require_once($folder.$include_file); + } class form extends db_array_io { diff --git a/www/libs/Class.Login.inc b/www/libs/Class.Login.inc index 422192c0..c023d3b2 100644 --- a/www/libs/Class.Login.inc +++ b/www/libs/Class.Login.inc @@ -59,7 +59,13 @@ * 2000-06-01: created basic idea and functions *********************************************************************/ - require_once(LIBS."Class.DB.IO.inc"); + // try to include file from LIBS path, or from normal path + $include_file = 'Class.DB.IO.inc'; + foreach (array('', LIBS, __DIR__.'/') as $folder) + { + if (file_exists($folder.$include_file)) + require_once($folder.$include_file); + } class login extends db_io { diff --git a/www/libs/Class.Smarty.Extend.inc b/www/libs/Class.Smarty.Extend.inc index 4d0a29e8..092c6543 100644 --- a/www/libs/Class.Smarty.Extend.inc +++ b/www/libs/Class.Smarty.Extend.inc @@ -10,7 +10,13 @@ // read in the Smarty class for definition // use smarty BC for backwards compability - require_once(SMARTY.'SmartyBC.class.php'); + // try to include file from LIBS path, or from normal path + $include_file = 'SmartyBC.class.php'; + foreach (array('', SMARTY, __DIR__.'/../'.SMARTY) as $folder) + { + if (file_exists($folder.$include_file)) + require_once($folder.$include_file); + } class SmartyML extends SmartyBC { diff --git a/www/libs/Class.l10n.inc b/www/libs/Class.l10n.inc index 0762bede..d91dc89a 100644 --- a/www/libs/Class.l10n.inc +++ b/www/libs/Class.l10n.inc @@ -25,7 +25,13 @@ * 2005/10/17 (cs) made an on the fly switch method (reload of lang) *********************************************************************/ - require_once(LIBS."Class.Basic.inc"); + // try to include file from LIBS path, or from normal path + $include_file = 'Class.Basic.inc'; + foreach (array('', LIBS, __DIR__.'/') as $folder) + { + if (file_exists($folder.$include_file)) + require_once($folder.$include_file); + } class l10n extends basic {