set_exception_handler('globalExceptionHandler'); /*function fatalErrorHandler() { global $responseHandler; $info = "PHP fatal error: ".Util::array2str(error_get_last()); Logging::logError($info); if ($responseHandler == NULL) $responseHandler = new ResponseHandler(new OutputHandler()); $responseHandler->unknownServerError($info); die(); } register_shutdown_function("fatalErrorHandler");*/ require_once "configuration.php"; global $CONFIGURATION, $VERSION; Logging::initialize($CONFIGURATION, $VERSION); require_once "include/MollifyBackend.class.php"; require_once "include/Settings.class.php"; $responseHandler = new ResponseHandler(new OutputHandler(getSetting($CONFIGURATION, 'mime_types', array()), isSetting($CONFIGURATION, 'support_output_buffer'))); try { $settings = new Settings($CONFIGURATION); $backend = new MollifyBackend($settings, getDB($settings), $responseHandler); $backend->processRequest(new Request()); } catch (ServiceException $e) { Logging::logException($e); $responseHandler->error($e->type(), $e->details(), $e->data()); } catch (Exception $e) { Logging::logException($e); $responseHandler->unknownServerError($e->getMessage()); } function getDB($settings) { require_once "db/DBConnectionFactory.class.php"; $f = new DBConnectionFactory();
require "template.php"; $script = basename(getenv("SCRIPT_NAME")); $sql = "SELECT * FROM perm WHERE script = '{$script}'"; $rs = db_exec($sql); if (pg_numrows($rs) < 1) { $sql = "INSERT INTO perm(script) VALUES('{$script}')"; $rs = db_exec($sql); $sql = "INSERT INTO userscripts (username, script) VALUES ('{$_SESSION['USER_NAME']}', '{$script}')"; //$rs = db_exec($sql); } $OUTPUT = "<li class=err>You <b>don't have sufficient permissions</b> to use this command." . getenv("SCRIPT_NAME") . "<br>\n\t\t\tIf you have been given permission to this function please email andre@cubit.co.za with the details of this problem"; require "template.php"; } } } if (isSetting("BANK_DET")) { $bankid = getdSetting("BANK_DET"); # Get bank account name db_connect(); $sql = "SELECT * FROM bankacct WHERE bankid = '{$bankid}' AND div = '" . USER_DIV . "'"; $bankRslt = db_exec($sql); $bank = pg_fetch_array($bankRslt); define("BNK_BANKNAME", $bank['bankname']); define("BNK_BRANCHNAME", $bank['branchname']); define("BNK_BRANCHCODE", $bank['branchcode']); define("BNK_ACCNAME", $bank['accname']); define("BNK_ACCNUM", $bank['accnum']); define("BNK_BANKDET", "Bank : {$bank['bankname']}<br>Branch : {$bank['branchname']} ({$bank['branchcode']})<br>Acc No. : {$bank['accnum']}"); } else { define("BNK_BANKNAME", ""); define("BNK_BRANCHNAME", "");