public static function initialize() { $url = explode('.', $_SERVER['HTTP_HOST']); if ($url[0] . '.' . $url[1] != self::rootDomainName) { // Repair problem where fast CGI is sending *.globalclassroom.us as // the $_SERVER['SERVER_NAME'] $_SERVER['SERVER_NAME'] = str_replace('*', $url[0], $_SERVER['SERVER_NAME']); // redirect all http:// to https:// if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === 'off' || $_SERVER['SERVER_PORT'] != 443) { header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); die; } if ((defined('GC_SYMFONY_LOADED') && GC_SYMFONY_LOADED) == false) { self::loadSymfony(); define('GC_SYMFONY_LOADED', true); } global $CFG; if ($institution = Doctrine::getTable('GcrInstitution')->findOneByShortName($url[0])) { if (isset($CFG)) { GcrInstitutionTable::constructCurrentInstitution($institution); } else { define('INTERNAL', 1); define('PUBLIC', 1); global $USER, $db, $THEME, $SESSION; require '/var/www/globalclassroom4/web/portal/init.php'; } } else { if ($eschool = Doctrine::getTable('GcrEschool')->findOneByShortName($url[0])) { if (isset($CFG)) { GcrEschoolTable::constructCurrentEschool($eschool); } else { require_once '/var/www/globalclassroom4/web/stratus/config.php'; } } else { // redirect to front page if the short_name doesn't exist header('Location: https://' . self::frontPageDomain . '/notfound'); die; } } return true; } return false; }
// // Information about this file is available on the Mahara wiki: // http://wiki.mahara.org/System_Administrator's_Guide/Installing_Mahara#Create_Mahara's_config.php // $cfg = new StdClass(); if (!defined('GC_SYMFONY_LOADED')) { require_once '/var/www/globalclassroom4/lib/model/gcr_model/gcr.class.php'; } if (isset($argv[2])) { $shortname = $argv[2]; if ((defined('GC_SYMFONY_LOADED') && GC_SYMFONY_LOADED) == false) { gcr::loadSymfony(); define('GC_SYMFONY_LOADED', true); } $institution = Doctrine::getTable('GcrInstitution')->findOneByShortName($shortname); GcrInstitutionTable::constructCurrentInstitution($institution); $cfg->dbtype = 'postgres8'; $cfg->dbhost = gcr::DBHostName; $cfg->dbport = gcr::DBPort; $cfg->dbname = gcr::DBName; $cfg->dataroot = gcr::moodledataDir . $shortname; $cfg->dbuser = '******' . $shortname . 'admin'; $cfg->dbpass = $CFG->current_app->getAdminPassword(); $cfg->dbprefix = gcr::maharaPrefix; $cfg->wwwroot = $CFG->current_app->getAppUrl(); define('GC_CRON_RUNNING', true); } else { if (gcr::initialize()) { global $CFG; if (!$CFG->current_app->isMahara()) { // the url is bad because it points to the Mahara folder on a moodle short_name