diff options
-rw-r--r-- | core/js/js.js | 2 | ||||
-rw-r--r-- | core/templates/layout.base.php | 1 | ||||
-rw-r--r-- | core/templates/layout.guest.php | 1 | ||||
-rw-r--r-- | lib/db.php | 17 | ||||
-rw-r--r-- | lib/setup.php | 4 | ||||
-rw-r--r-- | lib/templatelayout.php | 17 |
6 files changed, 24 insertions, 18 deletions
diff --git a/core/js/js.js b/core/js/js.js index 23ace89f4e3..6241036b1b8 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -88,7 +88,7 @@ var OC={ PERMISSION_DELETE:8, PERMISSION_SHARE:16, webroot:oc_webroot, - appswebroots:oc_appswebroots, + appswebroots:(typeof oc_appswebroots !== 'undefined') ? oc_appswebroots:false, currentUser:(typeof oc_current_user!=='undefined')?oc_current_user:false, coreApps:['', 'admin','log','search','settings','core','3rdparty'], /** diff --git a/core/templates/layout.base.php b/core/templates/layout.base.php index 47f4b423b3e..cb2f9773839 100644 --- a/core/templates/layout.base.php +++ b/core/templates/layout.base.php @@ -10,7 +10,6 @@ <script type="text/javascript"> var oc_debug = <?php echo (defined('DEBUG') && DEBUG) ? 'true' : 'false'; ?>; var oc_webroot = '<?php echo OC::$WEBROOT; ?>'; - var oc_appswebroots = <?php echo $_['apps_paths'] ?>; var oc_requesttoken = '<?php echo $_['requesttoken']; ?>'; </script> <?php foreach ($_['jsfiles'] as $jsfile): ?> diff --git a/core/templates/layout.guest.php b/core/templates/layout.guest.php index 8395426e4e4..5b39503474d 100644 --- a/core/templates/layout.guest.php +++ b/core/templates/layout.guest.php @@ -10,7 +10,6 @@ <script type="text/javascript"> var oc_debug = <?php echo (defined('DEBUG') && DEBUG) ? 'true' : 'false'; ?>; var oc_webroot = '<?php echo OC::$WEBROOT; ?>'; - var oc_appswebroots = <?php echo $_['apps_paths'] ?>; var oc_requesttoken = '<?php echo $_['requesttoken']; ?>'; var datepickerFormatDate = <?php echo json_encode($l->l('jsdate', 'jsdate')) ?>; var dayNames = <?php echo json_encode(array((string)$l->t('Sunday'), (string)$l->t('Monday'), (string)$l->t('Tuesday'), (string)$l->t('Wednesday'), (string)$l->t('Thursday'), (string)$l->t('Friday'), (string)$l->t('Saturday'))) ?>; diff --git a/lib/db.php b/lib/db.php index 7cc65673d10..51f7c7679d4 100644 --- a/lib/db.php +++ b/lib/db.php @@ -184,7 +184,14 @@ class OC_DB { try{ self::$PDO=new PDO($dsn, $user, $pass, $opts); }catch(PDOException $e) { - OC_Template::printErrorPage( 'can not connect to database, using '.$type.'. ('.$e->getMessage().')' ); + OC_Log::write('core', $e->getMessage(), OC_Log::FATAL); + OC_User::setUserId(null); + + // send http status 503 + header('HTTP/1.1 503 Service Temporarily Unavailable'); + header('Status: 503 Service Temporarily Unavailable'); + OC_Template::printErrorPage('Failed to connect to database'); + die(); } // We always, really always want associative arrays self::$PDO->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); @@ -281,7 +288,13 @@ class OC_DB { if( PEAR::isError( self::$MDB2 )) { OC_Log::write('core', self::$MDB2->getUserInfo(), OC_Log::FATAL); OC_Log::write('core', self::$MDB2->getMessage(), OC_Log::FATAL); - OC_Template::printErrorPage( 'can not connect to database, using '.$type.'. ('.self::$MDB2->getUserInfo().')' ); + OC_User::setUserId(null); + + // send http status 503 + header('HTTP/1.1 503 Service Temporarily Unavailable'); + header('Status: 503 Service Temporarily Unavailable'); + OC_Template::printErrorPage('Failed to connect to database'); + die(); } // We always, really always want associative arrays diff --git a/lib/setup.php b/lib/setup.php index 28882b6bede..4dd190b99fb 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -165,7 +165,9 @@ class OC_Setup { if(count($error) == 0) { OC_Appconfig::setValue('core', 'installedat', microtime(true)); OC_Appconfig::setValue('core', 'lastupdatedat', microtime(true)); - + OC_AppConfig::setValue('core', 'remote_core.css', '/core/minimizer.php'); + OC_AppConfig::setValue('core', 'remote_core.js', '/core/minimizer.php'); + OC_Group::createGroup('admin'); OC_Group::addToGroup($username, 'admin'); OC_User::login($username, $password); diff --git a/lib/templatelayout.php b/lib/templatelayout.php index 4173e008ba7..83d36199986 100644 --- a/lib/templatelayout.php +++ b/lib/templatelayout.php @@ -28,23 +28,16 @@ class OC_TemplateLayout extends OC_Template { break; } } + $apps_paths = array(); + foreach(OC_App::getEnabledApps() as $app) { + $apps_paths[$app] = OC_App::getAppWebPath($app); + } + $this->assign( 'apps_paths', str_replace('\\/', '/', json_encode($apps_paths)), false ); // Ugly unescape slashes waiting for better solution } else if ($renderas == 'guest') { parent::__construct('core', 'layout.guest'); } else { parent::__construct('core', 'layout.base'); } - - $apps_paths = array(); - foreach(OC_App::getEnabledApps() as $app) { - $apps_paths[$app] = OC_App::getAppWebPath($app); - } - $this->assign( 'apps_paths', str_replace('\\/', '/', json_encode($apps_paths)), false ); // Ugly unescape slashes waiting for better solution - - if (OC_Config::getValue('installed', false) && !OC_AppConfig::getValue('core', 'remote_core.css', false)) { - OC_AppConfig::setValue('core', 'remote_core.css', '/core/minimizer.php'); - OC_AppConfig::setValue('core', 'remote_core.js', '/core/minimizer.php'); - } - // Add the js files $jsfiles = self::findJavascriptFiles(OC_Util::$scripts); $this->assign('jsfiles', array(), false); |