private function err($e, $dop_string = '') { global $err; if ($this->on_error_rollback) { $this->rollBack(); } if (is_object($this->conn[$this->connect_pool_nr])) { $this->error = $this->conn[$this->connect_pool_nr]->errorCode(); } else { $this->error = 4; } // PDO Objekt existiert nicht $err = new ERR(); $err->err_log($e->getMessage() . " " . $dop_string, $this->show_errors, $this->stop_after_error, true); }
public function __construct() { // Make a CALL to the parent; parent::__construct(); // Make it private to avoid inheritance; self::explodeURLFromGET(); }
public function __construct() { parent::__construct(); // Register this object with the chain; ChainOfCommand::registerExecutor($this); // Do the Factory-Singleton method; if (!TheFactoryMethodOfSingleton::checkHasInstance(__CLASS__)) { // Set specific TPL object properties; self::setExeTime(new S(__CLASS__)); self::$objPageTitle = new A(); self::$objPageCSS = new A(); self::$objPageJSS = new A(); self::$objMetaTAG = new A(); self::$objMetaEQV = new A(); self::$objMetaLNK = new A(); self::$objUserAgentCapability = new A(); self::$objPageTitleBackward = new I(0); self::$objContainerHTML = new I(1); self::$objTPLLoaded = new B(TRUE); self::$objRequestIsPHP = new I(1); self::$objTpEXECounter = new I(0); // If this is a CSS File, then setupCSSEnvironmentIfCSSFile for it; self::setupCSSEnvironmentIfCSSFile(); self::setupJSSEnvironmentIfJSSFile(); self::activateDeactiveAjax(); // Output Gzipped content, if that's the case for it; self::setGzippedOutputRequest(new S('set_header_information')); // Set document type, UserAgent stats and more ... if (self::$objRequestIsPHP->toInt() == 1) { // Set the document type to a default; self::setDocumentType(new S('xhtml_strict')); // Set an array of 'f_path' (file path); self::$objFilePathArray = new A(); self::getUserAgentStats(); } } else { // Return the instantiated object; return TheFactoryMethodOfSingleton::getInstance(__CLASS__); } }
/** * This method, renderScreenOfDeath, would do it's best to try to render an error screen using the static method of * ERR::renderScreenOfDeath, which is the first non-abstract descendant CLASS that takes care of error reporting & handling; * * The name of the 'ERR' CLASS is subject to change, so THIS IS THE ONLY PLACE where the complex auto-loading, loose-coupling * RA PHP Framework is able to fail. Thus, the lack of knowledge that a parent object has over it's children, makes it quite * hard to output any kind of useful information unless statically called. THAT MEANS: that if the [ERR] CLASS changes its * name, you, the developer are obligated to change it here also. This can be done through a smart editor, like Eclipse PDT * to ensure that this kind of 'code refactoring' is done OK; * * By default, any error screen assumes the following: * <ol> * <li>geSHi and Firebug plugins work as expected;</li> * <li>ERROR_REPORTING_LEVEL is set to E_ALL;</li> * </ol> * * @return string Tries to render the 'Screen Of Death', or fails throwing an Exception, at least. * @param string $errFrom From what SOURCE did the error come from; * @param string $errString What's the error string we're interested in; * @param string $errTip Can we help the developer, by providing an error tip?! * @param string $debugErrString If we hava a PHP generated debugString, use it ... */ protected static function renderScreenOfDeath(S $errFrom, S $errString, S $errTip, S $debugErrString = NULL) { if (self::checkCanOutputErrorScreen()->toBoolean()) { // IF the 'ERR' CLASS exists; // IF the 'ERR' screen doesn't show-up sometime, this is __THE PLACE__ to search for errors; return ERR::renderScreenOfDeath($errFrom, $errString, $errTip, $debugErrString); } else { // Else, throw an even bigger error; throw new Exception(CANNOT_OUTPUT_ERROR_SCREEN); } }
/** * Will render the 'Screen Of Death', by using tested and well working PHP functions. This method relies on the fact that, at least * the framework abstract classes are working. Non-core developers should not modify anything here as they can get their hands * dirty really quick and destroy something without even knowing it; * * @param S $errFrom Error from where did it came * @param S $errString What's the string of the error * @param S $errTip Do you have an information to show * @param S $debugErrorString Should we show the debugger * @param B $errFATAL Is this error FATAL * @return S Will return the error screen string, or just void, depends on what kind of error we caught * @author Catalin Z. Alexandru <*****@*****.**> * @copyright Under the terms of the GNU General Public License v3 * @version $Id: 08_ERR.php 313 2009-10-09 13:27:52Z catalin.zamfir $ * @since Version 1.0 * @access protected * @static * @final */ protected static function renderScreenOfDeath(S $errFrom, S $errString = NULL, S $errTip = NULL, S $debugErrorString = NULL, B $errFATAL = NULL) { // Set the execution time, discard the output stream, and set the error status to TRUE; self::setExeTime(new S(__FUNCTION__)); // Add header, if it's a CSS file, on an error!; switch (checkIfItsACSSFile() or checkIfItsAJSSFile()) { case TRUE: // Set the text/HTML, header!; self::setHeaderKey(new S('text/html'), new S('Content-type:')); break; } // Se the errorStatus to TRUE; self::setErrorStatus(); $catchedKrumoContent = _NONE; // Change behaviour, if this is a FATAL error; if ($errFATAL != NULL && $errFATAL->toBoolean() == TRUE) { $errString = new S(FATAL_ERROR); $errTip = new S(FATAL_ERROR_CHECK_LOG); // Clean the output buffer; self::$objOutputBuffer = _NONE; } else { // Clean the output buffer; self::discardOutputStream(new B(TRUE)); // Execute the KRUMO PLUGIN Framework; $catchedKrumoContent = self::getKrumoContent(); } // Get the file contents; $debugContent = new FileContent(FORM_TP_DIR . _S . 'frm_error_screen.tp'); // Do an if, for the [%CODE%] part of our template; if (GESHI >= 1 && DEBUG >= 1) { // Replace [%CODE%], with GeSHi parsed code from our PHP files; // Really helpfull when trying to find hidden bugs; $debugContent->doToken('[%CODE%]', self::getDebugBacktrace(array_reverse(debug_backtrace()))); $debugContent->doToken('[%KRUMO%]', $catchedKrumoContent); } else { // Replace [%CODE%], with _NONE, hiding the output; // Well, can't help the developer here!; $debugContent->doToken('[%CODE%]', _NONE); $debugContent->doToken('[%KRUMO%]', _NONE); // Set as 'Hacking attempt'; $errString = VIEW_FILE_DIRECTLY_DENIED; $errTip = VIEW_FILE_DIRECTLY_DENIED_FIX; $debugErrorString = HACKING_ATTEMPT_BANG_YOU_DEAD; } // Start replacing information in the 'frm_error_screen.tp'; $debugContent->doToken('[%HSIMG%]', DOCUMENT_HOST . IMAGE_DIR . _WS); $debugContent->doToken('[%HSJSS%]', DOCUMENT_HOST . JAVASCRIPT_DIR . _WS); $debugContent->doToken('[%ERBGR%]', ERBGR); $debugContent->doToken('[%ERPIX%]', ERPIX); $debugContent->doToken('[%ERPXL%]', ERPXL); $debugContent->doToken('[%MEMORY%]', memory_get_usage() / 1024); $debugContent->doToken('[%PID%]', getmypid()); $debugContent->doToken('[%MICROTIME%]', self::getExeTime(new S(__CLASS__), new S(__FUNCTION__))); $debugContent->doToken('[%ERROR_FROM%]', $errFrom); $debugContent->doToken('[%ERROR_DATE%]', date(DATE_STRING, $_SERVER['REQUEST_TIME'])); $debugContent->doToken('[%ERROR_EMSG%]', $errString); $debugContent->doToken('[%ERROR_ETIP%]', $errTip); $debugContent->doToken('[%ERROR_FROM_PHP%]', $debugErrorString); // Try to MAIL ... If we got this far, we have MAIL ... if (self::checkClassExistence(new S('MAIL'))->toBoolean() == TRUE) { // Set some requirements ... if ($errString == NULL) { $errString = new S(); } if ($errTip == NULL) { $errTip = new S(); } // Make'em as new as possible ... $objEML = new MAIL(); $objEML->setFrom(new S(MAIL_FROM)); $objEML->setStringAttachment(new S($debugContent)); $objEML->doMAIL(new S(MAIL_FROM), $errString, new S($errTip . _DCSP . URL::rewriteURL() . _DCSP . $_SERVER['HTTP_USER_AGENT'] . _DCSP . $_SERVER['REMOTE_ADDR'])); } // Exit, with an error screen. We could also die, it would mean the same; if ($errFATAL != NULL && $errFATAL->toBoolean() == TRUE) { // Return the content; if (OB_GZIP == TRUE && OB_GZIP_LEVEL > 0 && OB_GZIP_LEVEL <= 9) { return gzencode($debugContent, OB_GZIP_LEVEL); } else { return $debugContent; } } else { // Or die script now; if (OB_GZIP == TRUE && OB_GZIP_LEVEL > 0 && OB_GZIP_LEVEL <= 9) { exit(gzencode($debugContent, OB_GZIP_LEVEL)); } else { exit($debugContent); } } }