From c3fd3318eb10b96e06fb3e67c966e1341dcaf790 Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Wed, 5 Jun 2013 12:15:00 +0000 Subject: sync code with working, master code from nav.mageia.org --- _nav/README.md | 2 +- _nav/css/index.php | 20 +++++++++++++++++++- _nav/html/conf.php | 28 ++++++++++++++++++++++++++++ _nav/html/index.php | 18 +++++++++++++++++- _nav/index.php | 22 ++++++++++++++++++++-- _nav/js/index.php | 20 +++++++++++++++++++- _nav/lib.php | 23 ++++++++++++++++++++--- _nav/robots.txt | 2 ++ 8 files changed, 126 insertions(+), 9 deletions(-) create mode 100644 _nav/html/conf.php create mode 100644 _nav/robots.txt (limited to '_nav') 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 @@ + * @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 @@ + + * @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
? */ $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 @@ - + + * @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. +*/ +?> mognase doc @@ -15,6 +33,6 @@ echo Markdown(file_get_contents('README.md')); ?> - + \ 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 @@ + * @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 @@ + * @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: / -- cgit v1.2.1