diff options
author | Romain d'Alverny <rda@mageia.org> | 2013-03-30 16:50:02 +0000 |
---|---|---|
committer | Romain d'Alverny <rda@mageia.org> | 2013-03-30 16:50:02 +0000 |
commit | 82fc8821a315e9b5a535d58b1988c637f181a886 (patch) | |
tree | dcf3af4db2aef2c4a77dd609239f3fb8b9a03805 | |
parent | 1a7ef0b9afe2e21df458fc3b7660057e8369805d (diff) | |
download | nav-82fc8821a315e9b5a535d58b1988c637f181a886.tar nav-82fc8821a315e9b5a535d58b1988c637f181a886.tar.gz nav-82fc8821a315e9b5a535d58b1988c637f181a886.tar.bz2 nav-82fc8821a315e9b5a535d58b1988c637f181a886.tar.xz nav-82fc8821a315e9b5a535d58b1988c637f181a886.zip |
makes navigation local, depends on nav vhost; easier for local dev
-rw-r--r-- | css/index.php | 2 | ||||
-rw-r--r-- | html/conf.php | 14 | ||||
-rw-r--r-- | html/index.php | 3 | ||||
-rw-r--r-- | js/index.php | 2 |
4 files changed, 18 insertions, 3 deletions
diff --git a/css/index.php b/css/index.php index 493b1c8..36cbc34 100644 --- a/css/index.php +++ b/css/index.php @@ -19,4 +19,4 @@ header('Content-Type: text/css;charset=utf-8'); header(sprintf('Expires: %s', gmdate('r', strtotime('+1 day')))); -readfile('source.css'); +echo str_replace('nav.mageia.org', $_SERVER['HTTP_HOST'], file_get_contents('source.css')); diff --git a/html/conf.php b/html/conf.php new file mode 100644 index 0000000..34a0f88 --- /dev/null +++ b/html/conf.php @@ -0,0 +1,14 @@ +<?php +/** +*/ + +$nav_host = $_SERVER['HTTP_HOST']; +$www_host = 'www.mageia.org'; + +$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/html/index.php b/html/index.php index e93080e..843f9b3 100644 --- a/html/index.php +++ b/html/index.php @@ -41,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: *'); @@ -48,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('var/tmp/cache')); apache_note('navMakeTime', number_format(microtime() - $t0, 6));
\ No newline at end of file diff --git a/js/index.php b/js/index.php index 9373b09..a9a07a3 100644 --- a/js/index.php +++ b/js/index.php @@ -21,4 +21,4 @@ //header('Access-Control-Allow-Methods: GET'); header('Content-Type: text/javascript;charset=utf-8'); header(sprintf('Expires: %s', gmdate('r', strtotime('+2 day')))); -readfile('source.js');
\ No newline at end of file +echo str_replace('nav.mageia.org', $_SERVER['HTTP_HOST'], file_get_contents('source.js')); |