diff --git a/config/config.ini b/config/config.ini
index 604cb72..e150a1d 100644
--- a/config/config.ini
+++ b/config/config.ini
@@ -398,9 +398,12 @@ warningThreshold=10
urgentThreshold=5
[CustomErrorMessages]
-;Turn custom error messages on or off here // account wide
-customerrormessages=on
-;name or url of custom error page
+;Turn custom error messages on or off here.
+customerrormessages=off
+;name or url of custom error page.
customerrorpagepath=customerrorpage.php
-;Turn custom error handler on or off
+;Turn custom error handler on or off.
+;The custom error handler will log any non php errors caught
+;by the custom error handler if it is turned on.
+;Php errors are always logged by php itself.
customerrorhandler=on
diff --git a/config/dmsDefaults.php b/config/dmsDefaults.php
index 3e0c17c..228e3d0 100644
--- a/config/dmsDefaults.php
+++ b/config/dmsDefaults.php
@@ -97,6 +97,7 @@ if (!defined('PATH_SEPARATOR')) {
}
require_once(KT_LIB_DIR . '/Log.inc');
+require_once(KT_LIB_DIR . '/validation/customerror.php');
// {{{ KTInit
class KTInit {
@@ -388,18 +389,27 @@ class KTInit {
// }}}
-function catchFatalErrors($p_OnOff='On'){
- ini_set('display_errors','On');
- $phperror='>
Error!! - You have encountered a problem starting your document management system.
Please contact your systems administrator
-
For more details, click here
+
For more details, click here
diff --git a/lib/dispatcher.inc.php b/lib/dispatcher.inc.php
index 3bf4474..bf631f1 100644
--- a/lib/dispatcher.inc.php
+++ b/lib/dispatcher.inc.php
@@ -537,38 +537,17 @@ class KTErrorDispatcher extends KTStandardDispatcher {
}
function dispatch() {
- require_once(KT_LIB_DIR . '/validation/errorviewer.inc.php');
- require_once(KT_LIB_DIR . '/validation/customerrorviewer.inc.php');
-
- $oCustomViewer =& KTCustomErrorViewer::initCustomErrorViewer();
-
- //if the custom error messages are set to 'on' in the config file
- //we check if the error page exists and redirect to it if it does.
- //if either the page doesn't exit or the custom error option is off in the config file
- //we carry out default error reporting
- if ($oCustomViewer->getCustomErrorConfigSetting() == 'on'){
- $CustomErrorPage = $oCustomViewer->getCustomErrorRedirectPage();
- if ( $CustomErrorPage != '0') //if an error is not returned from getCustomErrorRedirectPage();
- {
- $sErrorHandler = $oCustomViewer->getCustomErrorHandlerSetting();
-
- //redirect
- if ($sErrorHandler == 'on')
- {
- //if custom error handler is set to on inside config.ini then send error object with error page
- $oCustomViewer->doCustomErrorPageRedirect($CustomErrorPage, $this->oError);
- }
- else if ($sErrorHandler != 'on')
- {
- //if custom error handler is set to off inside config.ini then just send error page
- $oCustomViewer->doCustomErrorPageRedirect($CustomErrorPage);
- }
-
- //exit without errors
- exit(0);
- }
+
+ require_once(KT_LIB_DIR . '/validation/customerror.php');
+
+ $bCustomCheck = KTCustomErrorCheck::customErrorInit($this->oError);
+
+ if($bCustomCheck)
+ {
+ exit(0);
}
+
//if either customer error messages is off or the custom error page doesn't exist the function will run
//the default error handling here
$oRegistry =& KTErrorViewerRegistry::getSingleton();
diff --git a/lib/validation/customerror.php b/lib/validation/customerror.php
new file mode 100644
index 0000000..07d3094
--- /dev/null
+++ b/lib/validation/customerror.php
@@ -0,0 +1,84 @@
+.
+ *
+ * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
+ * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
+ *
+ * The interactive user interfaces in modified source and object code versions
+ * of this program must display Appropriate Legal Notices, as required under
+ * Section 5 of the GNU General Public License version 3.
+ *
+ * In accordance with Section 7(b) of the GNU General Public License version 3,
+ * these Appropriate Legal Notices must retain the display of the "Powered by
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
+ * must display the words "Powered by KnowledgeTree" and retain the original
+ * copyright notice.
+ * Contributor( s): ______________________________________
+ */
+
+require_once(KT_LIB_DIR . '/validation/errorviewer.inc.php');
+require_once(KT_LIB_DIR . '/validation/customerrorviewer.inc.php');
+
+class KTCustomErrorCheck
+{
+ function customErrorInit($error)
+ {
+ $oCustomViewer =& KTCustomErrorViewer::initCustomErrorViewer();
+
+ //if the custom error messages are set to 'on' in the config file
+ //we check if the error page exists and redirect to it if it does.
+ //if either the page doesn't exit or the custom error option is off in the config file
+ //we carry out default error reporting
+ if ($oCustomViewer->getCustomErrorConfigSetting() == 'on')
+ {
+
+ $CustomErrorPage = $oCustomViewer->getCustomErrorRedirectPage();
+ if ( $CustomErrorPage != '0') //if an error is not returned from getCustomErrorRedirectPage();
+ {
+
+ $sErrorHandler = $oCustomViewer->getCustomErrorHandlerSetting();
+
+
+ if ($sErrorHandler == 'on')
+ {
+ $oErrorHandler = KTCustomErrorHandler::initCustomErrorHandler();
+ $oErrorHandler->logError($error);
+ }
+
+ //redirect
+ $oCustomViewer->doCustomErrorPageRedirect($CustomErrorPage, $error);
+
+
+ //exit without errors
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+}
+?>
\ No newline at end of file
diff --git a/lib/validation/customerrorhandler.php b/lib/validation/customerrorhandler.php
index 2847a00..7c74abe 100644
--- a/lib/validation/customerrorhandler.php
+++ b/lib/validation/customerrorhandler.php
@@ -33,7 +33,7 @@
* copyright notice.
* Contributor( s): ______________________________________
*/
- require_once('config/dmsDefaults.php');
+ //require_once(KT_DIR.'config/dmsDefaults.php');
require_once(KT_LIB_DIR.'/Log.inc');
class KTCustomErrorHandler
diff --git a/lib/validation/customerrorviewer.inc.php b/lib/validation/customerrorviewer.inc.php
index 3dc822b..0af1d6a 100644
--- a/lib/validation/customerrorviewer.inc.php
+++ b/lib/validation/customerrorviewer.inc.php
@@ -72,7 +72,11 @@
if (substr($sCustomErrorPage, 0, 4) != 'http')
{
- $sCustomErrorPage = 'http://'.$_SERVER['HTTP_HOST'].'/'.$sCustomErrorPage;
+ $sUrl = KTInit::guessRootUrl();
+ global $default;
+ $sRootUrl = ($default->sslEnabled ? 'https' : 'http') .'://'.$_SERVER['HTTP_HOST'].$sUrl;
+ $sCustomErrorPage = $sRootUrl.'/'.$sCustomErrorPage;
+
}
@@ -106,7 +110,6 @@
// {{{ customErrorPageRedirect()
function doCustomErrorPageRedirect($CustomErrorPage, $oError = null)
{
- $sErrorMessage = '';
if($oError != null)
{
//call error handler
@@ -114,22 +117,19 @@
$aErrorMessage = array ();
$aErrorMessage['Error_MessageOne'] = $oError->getMessage();
$aErrorMessage['Error_MessageTwo'] = $oError->getUserInfo();
- //echo '