Exemplo n.º 1
0
 /**
  * The Symphony constructor initialises the class variables of Symphony.
  * It will set the DateTime settings, define new date constants and initialise
  * the correct Language for the currently logged in Author. If magic quotes
  * are enabled, Symphony will sanitize the `$_SERVER`, `$_COOKIE`,
  * `$_GET` and `$_POST` arrays. The constructor loads in
  * the initial Configuration values from the `CONFIG` file
  */
 protected function __construct()
 {
     self::$Profiler = Profiler::instance();
     self::$Profiler->sample('Engine Initialisation');
     if (get_magic_quotes_gpc()) {
         General::cleanArray($_SERVER);
         General::cleanArray($_COOKIE);
         General::cleanArray($_GET);
         General::cleanArray($_POST);
     }
     $this->initialiseConfiguration();
     define_safe('__SYM_DATE_FORMAT__', self::Configuration()->get('date_format', 'region'));
     define_safe('__SYM_TIME_FORMAT__', self::Configuration()->get('time_format', 'region'));
     define_safe('__SYM_DATETIME_FORMAT__', __SYM_DATE_FORMAT__ . self::Configuration()->get('datetime_separator', 'region') . __SYM_TIME_FORMAT__);
     DateTimeObj::setSettings(self::Configuration()->get('region'));
     // Initialize language management
     Lang::initialize();
     $this->initialiseLog();
     GenericExceptionHandler::initialise(self::Log());
     GenericErrorHandler::initialise(self::Log());
     $this->initialiseDatabase();
     $this->initialiseExtensionManager();
     $this->initialiseCookie();
     // If the user is not a logged in Author, turn off the verbose error messages.
     if (!self::isLoggedIn() && is_null($this->Author)) {
         GenericExceptionHandler::$enabled = false;
     }
     // Set system language
     Lang::set(self::$Configuration->get('lang', 'symphony'));
 }
 /**
  * The Symphony constructor initialises the class variables of Symphony.
  * It will set the DateTime settings, define new date constants and initialise
  * the correct Language for the currently logged in Author. If magic quotes
  * are enabled, Symphony will sanitize the `$_SERVER`, `$_COOKIE`,
  * `$_GET` and `$_POST` arrays. The constructor loads in
  * the initial Configuration values from the `CONFIG` file
  */
 protected function __construct()
 {
     $this->Profiler = Profiler::instance();
     $this->Profiler->sample('Engine Initialisation');
     if (get_magic_quotes_gpc()) {
         General::cleanArray($_SERVER);
         General::cleanArray($_COOKIE);
         General::cleanArray($_GET);
         General::cleanArray($_POST);
     }
     // Includes the existing CONFIG file and initialises the Configuration
     // by setting the values with the setArray function.
     include CONFIG;
     self::$Configuration = new Configuration(true);
     self::$Configuration->setArray($settings);
     DateTimeObj::setDefaultTimezone(self::$Configuration->get('timezone', 'region'));
     define_safe('__SYM_DATE_FORMAT__', self::$Configuration->get('date_format', 'region'));
     define_safe('__SYM_TIME_FORMAT__', self::$Configuration->get('time_format', 'region'));
     define_safe('__SYM_DATETIME_FORMAT__', __SYM_DATE_FORMAT__ . self::$Configuration->get('datetime_separator', 'region') . __SYM_TIME_FORMAT__);
     // Initialize language management
     Lang::initialize();
     $this->initialiseLog();
     GenericExceptionHandler::initialise(self::$Log);
     GenericErrorHandler::initialise(self::$Log, self::$Configuration->get('strict_error_handling', 'symphony'));
     $this->initialiseDatabase();
     $this->initialiseExtensionManager();
     $this->initialiseCookie();
     // If the user is not a logged in Author, turn off the verbose error
     // messages.
     if (!self::isLoggedIn() && is_null($this->Author)) {
         GenericExceptionHandler::$enabled = false;
     }
     // Set system language
     Lang::set(self::$Configuration->get('lang', 'symphony'));
 }
Exemplo n.º 3
0
 /**
  * The Symphony constructor initialises the class variables of Symphony. At present
  * constructor has a couple of responsibilities:
  * - Start a profiler instance
  * - If magic quotes are enabled, clean `$_SERVER`, `$_COOKIE`, `$_GET` and `$_POST` arrays 
  * - Initialise the correct Language for the currently logged in Author.
  * - Start the session and adjust the error handling if the user is logged in
  */
 protected function __construct()
 {
     self::$Profiler = Profiler::instance();
     if (get_magic_quotes_gpc()) {
         General::cleanArray($_SERVER);
         General::cleanArray($_COOKIE);
         General::cleanArray($_GET);
         General::cleanArray($_POST);
     }
     // Initialize language management
     Lang::initialize();
     Lang::set(self::$Configuration->get('lang', 'symphony'));
     self::initialiseCookie();
     // If the user is not a logged in Author, turn off the verbose error messages.
     if (!self::isLoggedIn() && is_null(self::$Author)) {
         GenericExceptionHandler::$enabled = false;
     }
     // Engine is ready.
     self::$Profiler->sample('Engine Initialisation');
 }
Exemplo n.º 4
0
$final_page = ob_get_clean();
$replace = array("<!-- CONTENT -->" => $content, "<!-- RENDER TIME -->" => precision_timer("stop", STARTTIME), "<!-- PAGE TITLE -->" => $GLOBALS['pageTitle'], "<!-- ONLOAD EVENT -->" => $GLOBALS['onloadEvent'], "<!-- HEAD EXTRAS -->" => "\t" . @implode("\n\t", $GLOBALS['headExtras']));
$final_page = str_replace(array_keys($replace), array_values($replace), $final_page);
$Admin->processLogs();
if ($template == "login" || $template == "update") {
    $final_page = str_replace("<!-- ERRORS -->", defined("__SYM_ERROR_MESSAGE__") ? "<p>" . __SYM_ERROR_MESSAGE__ . "</p>" : "", $final_page);
} else {
    $error = NULL;
    if (defined('__SYM_ERROR_MESSAGE__')) {
        $error = '<p id="notice" class="error">' . __SYM_ERROR_MESSAGE__ . '</p>';
    } elseif (defined('__SYM_NOTICE_MESSAGE__')) {
        $error = '<p id="notice">' . __SYM_NOTICE_MESSAGE__ . '</p>';
    }
    $final_page = str_replace("<!-- ERRORS -->", $error ? $error : "", $final_page);
}
$profiler->sample("Page Render Time");
##Generate page headers
$Admin->renderHeaders();
####
# Delegate: PreRender
# Description: Immediately before displaying the admin page. Provided with the final page code.
#              Manipulating it will alter the output for this page
$CampfireManager->notifyMembers('PreRender', CURRENTPAGE, array('output' => &$final_page));
##Display the final rendered code
print $final_page;
$render_time = $profiler->retrieve(0);
####
# Delegate: PostRender
# Description: After rendering the page contents. Profiler and also final page source provided.
#              Manipulation will not effect anything.
$CampfireManager->notifyMembers('PostRender', CURRENTPAGE, array('profiler' => $profiler, 'output' => $final_page));
 * @version 1.7
 * @licence https://github.com/symphonycms/symphony-1.7/blob/master/LICENCE
 *
 ***/
print '<?xml version="1.0" encoding="utf-8"?' . '>';
$page_handle = $_GET['handle'] ? $_GET['handle'] : NULL;
require_once LIBRARY . "/class.site.php";
require_once TOOLKIT . "/class.profiler.php";
require_once TOOLKIT . "/class.xmlrepair.php";
$active = "xml";
switch ($_REQUEST['type']) {
    case "page":
        $profiler = new Profiler();
        $Site = new Site($page_handle, $DB, $Admin->_config, $profiler, false);
        $page_name = $DB->fetchVar("title", 0, "SELECT `title` FROM `tbl_pages` WHERE `handle` = '" . $Site->_page . "'");
        $profiler->sample("Page Initialization", PROFILE_LAP);
        ##Use preview mode
        if ($_GET['mode'] == 'preview') {
            $Site->togglePreviewMode();
        }
        #Render the page
        $output = $Site->display(array(), 'TRANSFORMED', false);
        $xml = $Site->buildXML(NULL, NULL, true, false);
        $xsl = $Site->display(array(), "XSL", false);
        #Record the render time
        $profiler->sample("Total Page Render Time");
        break;
    case "datasource":
        $DSM = new DatasourceManager(array('parent' => &$Admin));
        $obXML = new XMLElement("data");
        $obXML->setIncludeHeader(true);