Пример #1
0
 /**
  * Sets anything that's needed to make the RA PHP Framework work as expected. Usually we don't document __constructors as the name
  * of the method says it all, but in this case we need to document that the 'ERR' __constructor is called to initialize the RA
  * PHP Framework as it's the first non-abstract inherited CLASS. For this purpose only, it will set the default configuration
  * options, the Ouput Buffering mechanis, the Error Handling mechanism and other properties;
  *
  * @return B Returns true if the object has been constructed properly
  * @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 public
  */
 public function __construct()
 {
     if (!TheFactoryMethodOfSingleton::checkHasInstance(__CLASS__)) {
         self::$objErrorHappened = new I(0);
         self::$objHT = new A();
         self::$objExecutionTime = new A();
         self::$objTokensReplace = new A();
         self::$objStringReplace = new A();
         self::$objOutputBuffer = new A();
         self::$objOutputBufferCount = new I(0);
         if (self::setRAPHPFrameworkINIObjectProps()->toBoolean()) {
             self::setExeTime(new S(__CLASS__));
             self::setOutputStreamCallbackWorker(new S(__CLASS__ . _DC . 'executionStreamedOutput'));
             self::setOutputErrorCatcherCallback(new S(__CLASS__ . _DC . 'executionCatchPHPErrors'));
             self::executeOutputStream();
             self::setCacheHeaderKeys();
             self::setHTAutoPHP();
             // If the LOAD is ok, go on!
             if (self::getRAPHPFrameworkAverageLoading()->toInt() > SYSTEM_LOAD_MAX) {
                 // SYSTEM_LOAD_TO_HIGH, show an error screen;
                 self::renderScreenOfDeath(new S(__CLASS__), new S(SYSTEM_LOAD_TOO_HIGH), new S(SYSTEM_LOAD_TOO_HIGH_FIX));
             } else {
                 // If an attempt to re-open the session is made, output an error;
                 if (!self::checkSessionVar(new S('in_session'), new O(TRUE))->toBoolean()) {
                     if (self::openSession()) {
                         // Set _SESSION variables;
                         if (self::setSessionVar(new S('in_session'), new O(TRUE)) && self::setSessionVar(new S('skin'), new O(SKIN)) && self::setSessionVar(new S('language'), new O(LANGUAGE)) && self::setSessionVar(new S('default_timezone'), new O(DATE_TIMEZONE))) {
                             // Do return;
                             return new B(TRUE);
                         } else {
                             // Error me proudly;
                             self::renderScreenOfDeath(new S(__CLASS__), new S(CANNOT_START_SESSION), new S(CANNOT_START_SESSION_FIX));
                         }
                     }
                 } else {
                     // Error me proudly;
                     self::renderScreenOfDeath(new S(__CLASS__), new S(CANNOT_START_SESSION), new S(CANNOT_START_SESSION_FIX));
                 }
             }
         }
     } else {
         // Return the object instance, from the array;
         return TheFactoryMethodOfSingleton::getInstance(__CLASS__);
     }
 }