]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Get system timezone for PHP if possible
authorMarcin Haba <marcin.haba@bacula.pl>
Sat, 12 Dec 2015 21:11:48 +0000 (22:11 +0100)
committerMarcin Haba <marcin.haba@bacula.pl>
Sat, 12 Dec 2015 21:11:48 +0000 (22:11 +0100)
gui/baculum/index.php
gui/baculum/protected/Init.php [new file with mode: 0644]
gui/baculum/protected/application.xml

index f64ca15ce6efce98995b6066e082351bbc08f582..683acb7efcd9382ea16002ffc106a541a10946e3 100644 (file)
  *
  * Bacula(R) is a registered trademark of Kern Sibbald.
  */
-date_default_timezone_set('UTC');
-
-// Support for web servers which do not provide direct info about HTTP Basic auth to PHP superglobal $_SERVER array.
-if(!isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['PHP_AUTH_PW'])) {
-    list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
-}
-
 define('APPLICATION_DIRECTORY', __DIR__);
 
-require_once('./protected/Pages/Requirements.php');
-new Requirements(__DIR__);
+require_once('./protected/Init.php');
 require_once('./framework/prado.php');
 
 $application=new TApplication;
-Prado::using('Application.Portlets.BButton');
-Prado::using('Application.Portlets.BActiveButton');
 $application->run();
 ?>
diff --git a/gui/baculum/protected/Init.php b/gui/baculum/protected/Init.php
new file mode 100644 (file)
index 0000000..a58e640
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+/*
+ * Bacula(R) - The Network Backup Solution
+ * Baculum   - Bacula web interface
+ *
+ * Copyright (C) 2013-2015 Marcin Haba
+ *
+ * The main author of Baculum is Marcin Haba.
+ * The original author of Bacula is Kern Sibbald, with contributions
+ * from many others, a complete list can be found in the file AUTHORS.
+ *
+ * You may use this file and others of this release according to the
+ * license defined in the LICENSE file, which includes the Affero General
+ * Public License, v3.0 ("AGPLv3") and some additional permissions and
+ * terms pursuant to its AGPLv3 Section 7.
+ *
+ * This notice must be preserved when any source code is
+ * conveyed and/or propagated.
+ *
+ * Bacula(R) is a registered trademark of Kern Sibbald.
+ */
+
+$timezone = 'UTC';
+if (!ini_get('date.timezone')) {
+       if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
+               exec('date +%Z', $tz, $retcode);
+               if ($retcode === 0 && count($tz) === 1) {
+                       $timezone = $tz[0];
+               }
+       }
+       date_default_timezone_set($timezone);
+}
+
+// Support for web servers which do not provide direct info about HTTP Basic auth to PHP superglobal $_SERVER array.
+if(!isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['PHP_AUTH_PW'])) {
+    list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
+}
+
+require_once('./protected/Pages/Requirements.php');
+new Requirements(__DIR__);
+
+?>
index 2ec14fe6cf0d09ca0014717e6d2d3ead3beae9ea..d682bf82f7002dd28011443853782f5714acdf94 100644 (file)
@@ -4,6 +4,8 @@
                <using namespace="Application.Class.*" />
                <using namespace="System.Data.ActiveRecord.*" />
                <using namespace="System.I18N.*" />
+               <using namespace="Application.Portlets.BButton" />
+               <using namespace="Application.Portlets.BActiveButton" />
        </paths>
        <modules>
                <module id="request" class="THttpRequest" EnableCookieValidation="true" />