Accept a default value for baseurl
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 28 Oct 2007 17:55:08 +0000 (18:55 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 28 Oct 2007 17:55:08 +0000 (18:55 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
bin/connect.db.inc.php
configs/platal.ini
include/banana/hooks.inc.php
include/globals.inc.php.in

index 1cade25..3e61ba1 100644 (file)
@@ -26,6 +26,5 @@ require_once('xorg.misc.inc.php');
 
 require_once 'xdb.php';
 
-$globals->baseurl = "https://www.polytechnique.org";
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>
index 545ac84..fe98ecb 100644 (file)
@@ -2,6 +2,7 @@
 locale   = "fr_FR.UTF-8"
 timezone = "Europe/Paris"
 secure_domain = ""
+baseurl = "https://www.example.org/"
 
 skin = "default"
 register_skin = "register"
index 7a6367e..ed55ec0 100644 (file)
@@ -150,7 +150,7 @@ function hook_makeLink($params)
         $base .= '/' . $params['group'];
     } else if (Banana::$protocole->name() == 'NNTP' && $xnet) {
         if ($feed) {
-            return 'http://www.polytechnique.org/banana' . hook_platalRSS(@$params['group']);
+            return $globals->baseurl . '/banana' . hook_platalRSS(@$params['group']);
         }
         $base = $globals->baseurl . '/' . $platal->ns . 'forum';
     } else if (Banana::$protocole->name() == 'MLArchives') {
index 9bb1b54..37a8cfe 100644 (file)
@@ -53,7 +53,9 @@ class PlatalGlobals
         $this->session   = $sess;
 
         $base = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
-        $this->baseurl   = @trim($base.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']), '/');
+        if (isset($_SERVER) && isset($_SERVER['SERVER_NAME'])) {
+            $this->baseurl   = @trim($base.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']), '/');
+        }
         $this->spoolroot = dirname(dirname(__FILE__));
 
         $this->read_config();