aboutsummaryrefslogtreecommitdiffstats
path: root/_nav/html
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2013-06-05 12:15:00 +0000
committerRomain d'Alverny <rda@mageia.org>2013-06-05 12:15:00 +0000
commitc3fd3318eb10b96e06fb3e67c966e1341dcaf790 (patch)
tree8a587b032be9caef9eeade7c501b6138a16b5960 /_nav/html
parent61877c022ef13a678d0d98f28b5d459a0c6610f3 (diff)
downloadwww-c3fd3318eb10b96e06fb3e67c966e1341dcaf790.tar
www-c3fd3318eb10b96e06fb3e67c966e1341dcaf790.tar.gz
www-c3fd3318eb10b96e06fb3e67c966e1341dcaf790.tar.bz2
www-c3fd3318eb10b96e06fb3e67c966e1341dcaf790.tar.xz
www-c3fd3318eb10b96e06fb3e67c966e1341dcaf790.zip
sync code with working, master code from nav.mageia.org
Diffstat (limited to '_nav/html')
-rw-r--r--_nav/html/conf.php28
-rw-r--r--_nav/html/index.php18
2 files changed, 45 insertions, 1 deletions
diff --git a/_nav/html/conf.php b/_nav/html/conf.php
new file mode 100644
index 000000000..80871dd9a
--- /dev/null
+++ b/_nav/html/conf.php
@@ -0,0 +1,28 @@
+<?php
+/**
+*/
+
+/** Host running/serving the global nav. */
+$nav_host = $_SERVER['HTTP_HOST'];
+
+/** Host running main Web site www.m.o. */
+$www_host = 'www.mageia.org';
+
+/** Where precomputed nav templates are cached. */
+$cache_path = 'var/tmp/cache';
+
+// erk
+if ($nav_host == 'www.mageia.org') {
+ $cache_path = '../var/tmp/cache';
+}
+
+/** You may overload this config by defining APP_MODE env
+ * variable, and using the switch construct below.
+*/
+$mode = isset($_SERVER['APP_MODE']) ? $_SERVER['APP_MODE'] : null;
+
+switch ($mode) {
+case 'dev':
+case 'dev-rda': $www_host = 'mageia:8888'; break;
+// add your own case if needed.
+}
diff --git a/_nav/html/index.php b/_nav/html/index.php
index 8623f0954..0450a94c3 100644
--- a/_nav/html/index.php
+++ b/_nav/html/index.php
@@ -1,5 +1,20 @@
<?php
/**
+ * mageia.org global nav bar.
+ *
+ * PHP version 5.4
+ *
+ * @category Mageia
+ * @package Mageia\Web\nav
+ * @author rda <rda@mageia.org>
+ * @link http://nav.mageia.org/
+ *
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL v2+
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License aspublished by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
*/
$t0 = microtime();
@@ -26,6 +41,7 @@ $context = isset($_GET['c']) ? trim($_GET['c']) : null;
/** wrap the returned HTML in <header id="hmgn" />? */
$wrap = isset($_GET['w']) ? true : false;
+require 'conf.php';
include '../lib.php';
header('Access-Control-Allow-Origin: *');
@@ -33,6 +49,6 @@ header('Access-Control-Allow-Methods: GET');
header('Content-Type: text/html;charset=utf-8');
header(sprintf('Expires: %s', gmdate('r', strtotime('+1 day'))));
-echo _mgnav_html($wrap, $lang, null, 'www.mageia.org', NCache::build('../var/tmp/cache'));
+echo _mgnav_html($wrap, $lang, null, $www_host, NCache::build($cache_path));
apache_note('navMakeTime', number_format(microtime() - $t0, 6)); \ No newline at end of file