示例#1
0
<?php

if (!defined('__PREPEND_INCLUDED__')) {
    define('__PREPEND_INCLUDED__', 1);
    require dirname(__FILE__) . '/configuration.qcubed.inc.php';
    if (get_magic_quotes_gpc()) {
        require __QCUBED_CORE__ . '/framework/DisableMagicQuotes.inc.php';
    }
    require __QCUBED_CORE__ . '/qcubed.inc.php';
    require_once dirname(__FILE__) . '/QApplication.class.php';
    QDateTime::$DefaultFormat = QDateTime::FormatIso;
    function t($strText)
    {
        return QApplication::Translate($strText);
    }
    ///////////////////////
    // Setup Error Handling
    ///////////////////////
    if (array_key_exists('SERVER_PROTOCOL', $_SERVER)) {
        set_error_handler('QcodoHandleError', error_reporting());
        set_exception_handler('QcodoHandleException');
    }
    spl_autoload_register(array('QApplication', 'Autoload'));
    QApplication::Initialize();
    QApplication::InitializeDatabaseConnections();
    QApplication::$EncodingType = 'UTF-8';
    NarroUser::GetDatabase()->NonQuery("SET NAMES 'utf8'");
    NarroUser::RegisterPreference('Items per page', 'number', t('How many items are displayed per page'), 10);
    NarroUser::RegisterPreference('Font size', 'option', t('The application font size'), 'medium', array('x-small', 'small', 'medium', 'large', 'x-large'));
    NarroUser::RegisterPreference('Language', 'option', t('The language you are translating to'), QApplication::QueryString('l'), array(QApplication::QueryString('l')));
    NarroUser::RegisterPreference('Application language', 'option', t('The language you want to see Narro in'), isset(QApplication::$TargetLanguage) ? QApplication::$TargetLanguage->LanguageCode : NarroLanguage::SOURCE_LANGUAGE_CODE, array(isset(QApplication::$TargetLanguage) ? QApplication::$TargetLanguage->LanguageCode : NarroLanguage::SOURCE_LANGUAGE_CODE));