diff options
author | Romain d'Alverny <rda@mageia.org> | 2013-06-05 12:15:00 +0000 |
---|---|---|
committer | Romain d'Alverny <rda@mageia.org> | 2013-06-05 12:15:00 +0000 |
commit | c3fd3318eb10b96e06fb3e67c966e1341dcaf790 (patch) | |
tree | 8a587b032be9caef9eeade7c501b6138a16b5960 /_nav | |
parent | 61877c022ef13a678d0d98f28b5d459a0c6610f3 (diff) | |
download | www-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')
-rw-r--r-- | _nav/README.md | 2 | ||||
-rw-r--r-- | _nav/css/index.php | 20 | ||||
-rw-r--r-- | _nav/html/conf.php | 28 | ||||
-rw-r--r-- | _nav/html/index.php | 18 | ||||
-rw-r--r-- | _nav/index.php | 22 | ||||
-rw-r--r-- | _nav/js/index.php | 20 | ||||
-rw-r--r-- | _nav/lib.php | 23 | ||||
-rw-r--r-- | _nav/robots.txt | 2 |
8 files changed, 126 insertions, 9 deletions
diff --git a/_nav/README.md b/_nav/README.md index 8e0fd4d1c..a109ae78f 100644 --- a/_nav/README.md +++ b/_nav/README.md @@ -78,7 +78,7 @@ The detected and used features are: ## Code & license * code is in [svn://svn.mageia.org/svn/web/nav/](http://svn.mageia.org/web/nav/) -* licensed under GNU GPL-3+, 2012, rda +* licensed under GNU GPL-2+, 2012, rda * issues on [bugs.mageia.org](https://bugs.mageia.org/buglist.cgi?query_format=advanced&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&component=nav.mageia.org&product=Websites) * patches and discussions welcome in [Mageia Web team](https://wiki.mageia.org/en/Web_team) diff --git a/_nav/css/index.php b/_nav/css/index.php index 3960012fc..36cbc34bd 100644 --- a/_nav/css/index.php +++ b/_nav/css/index.php @@ -1,4 +1,22 @@ <?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. +*/ + 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/_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 diff --git a/_nav/index.php b/_nav/index.php index f55f29411..6467e80b7 100644 --- a/_nav/index.php +++ b/_nav/index.php @@ -1,4 +1,22 @@ -<html lang="en"> +<?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. +*/ +?><html lang="en"> <head> <meta name="robots" content="noindex,nosnippet,nofollow"> <title>mognase doc</title> @@ -15,6 +33,6 @@ echo Markdown(file_get_contents('README.md')); ?> </div> - <script src="/_nav/js/"></script> + <script src="/js/"></script> </body> </html>
\ No newline at end of file diff --git a/_nav/js/index.php b/_nav/js/index.php index ed17b0401..a9a07a3ca 100644 --- a/_nav/js/index.php +++ b/_nav/js/index.php @@ -1,6 +1,24 @@ <?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. +*/ + //header('Access-Control-Allow-Origin: *'); //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')); diff --git a/_nav/lib.php b/_nav/lib.php index 7cf917de6..164a5bf64 100644 --- a/_nav/lib.php +++ b/_nav/lib.php @@ -1,4 +1,21 @@ <?php +/** + * mageia.org global nav bar utilities. + * + * 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. +*/ // definition class NCache @@ -13,7 +30,7 @@ class NCache * * @return NCache */ - function build($path, $timeout = 3600) + public static function build($path, $timeout = 3600) { $path = __DIR__ . '/' . $path; @@ -118,7 +135,7 @@ class l10n * * @return void */ - function load($lang) + public static function load($lang) { global $_t; $_t = array(); @@ -173,7 +190,7 @@ P; * * @return string */ - function _t($s) { + public static function _t($s) { if (trim($s) == '') return ''; diff --git a/_nav/robots.txt b/_nav/robots.txt new file mode 100644 index 000000000..1f53798bb --- /dev/null +++ b/_nav/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / |