示例#1
0
if ($sessionhandler == 'db') {
    require_once $rootdir . "/classes/adodb/session/adodb-session2.php";
    $sessionoptions['table'] = $dbprefix . 'sessions';
    ADOdb_Session::config($databasetype, $databaselocation, $databaseuser, $databasepass, $databasename, $sessionoptions);
}
$dbprefix = strtolower($dbprefix);
define("_PHPVERSION", phpversion());
// This is the same as the server defined 'PHP_VERSION'
// Deal with server systems having not set a default time zone
if (function_exists("date_default_timezone_set") and function_exists("date_default_timezone_get")) {
    @date_default_timezone_set(@date_default_timezone_get());
}
//Every 50th time clean up the temp directory of old files (older than 1 day)
//depending on the load the  probability might be set higher or lower
if (rand(1, 50) == 25) {
    cleanTempDirectory();
}
// Array of JS and CSS scripts to include in client header
$js_header_includes = array();
$css_header_includes = array();
// JS scripts and CSS to include in admin header
// updated by admin scripts
$js_admin_includes = array();
$css_admin_includes = array();
/*
 * $sourcefrom variable checks the location of the current script against
 * the administration directory, and if the current script is running
 * in the administration directory, it is set to "admin". Otherwise it is set
 * to "public". When $sourcefrom is "admin" certain administration only functions
 * are loaded.
 */
示例#2
0
 protected function _init()
 {
     // Check for most necessary requirements
     // Now check for PHP & db version
     // Do not localize/translate this!
     $dieoutput = '';
     if (version_compare(PHP_VERSION, '5.1.6', '<')) {
         $dieoutput .= 'This script can only be run on PHP version 5.1.6 or later! Your version: ' . PHP_VERSION . '<br />';
     }
     if (!function_exists('mb_convert_encoding')) {
         $dieoutput .= "This script needs the PHP Multibyte String Functions library installed: See <a href='http://docs.limesurvey.org/tiki-index.php?page=Installation+FAQ'>FAQ</a> and <a href='http://de.php.net/manual/en/ref.mbstring.php'>PHP documentation</a><br />";
     }
     if ($dieoutput != '') {
         throw new CException($dieoutput);
     }
     if (ini_get("max_execution_time") < 1200) {
         @set_time_limit(1200);
     }
     // Maximum execution time - works only if safe_mode is off
     // The following function (when called) includes FireBug Lite if true
     defined('FIREBUG') or define('FIREBUG', Yii::app()->getConfig('use_firebug_lite'));
     // Deal with server systems having not set a default time zone
     if (function_exists("date_default_timezone_set") and function_exists("date_default_timezone_get")) {
         @date_default_timezone_set(@date_default_timezone_get());
     }
     //Every 50th time clean up the temp directory of old files (older than 1 day)
     //depending on the load the  probability might be set higher or lower
     if (rand(1, 50) == 1) {
         cleanTempDirectory();
     }
     //GlobalSettings Helper
     Yii::import("application.helpers.globalsettings");
     enforceSSLMode();
     // This really should be at the top but for it to utilise getGlobalSetting() it has to be here
     if (Yii::app()->getConfig('debug') == 1) {
         //For debug purposes - switch on in config.php
         @ini_set("display_errors", 1);
         error_reporting(E_ALL);
     } elseif (Yii::app()->getConfig('debug') == 2) {
         //For debug purposes - switch on in config.php
         @ini_set("display_errors", 1);
         error_reporting(E_ALL | E_STRICT);
     } else {
         @ini_set("display_errors", 0);
         error_reporting(0);
     }
     //SET LOCAL TIME
     $timeadjust = Yii::app()->getConfig("timeadjust");
     if (substr($timeadjust, 0, 1) != '-' && substr($timeadjust, 0, 1) != '+') {
         $timeadjust = '+' . $timeadjust;
     }
     if (strpos($timeadjust, 'hours') === false && strpos($timeadjust, 'minutes') === false && strpos($timeadjust, 'days') === false) {
         Yii::app()->setConfig("timeadjust", $timeadjust . ' hours');
     }
 }