Author: nextgens
Date: 2008-05-08 09:28:07 +0000 (Thu, 08 May 2008)
New Revision: 19836
Removed:
trunk/website/includes/common.inc.php~
Modified:
trunk/website/index.php
trunk/website/pages/de/fairshare.php
trunk/website/pages/de/news.php
Log:
website: attempt to redirect old-links to new ones
Deleted: trunk/website/includes/common.inc.php~
===================================================================
--- trunk/website/includes/common.inc.php~ 2008-05-08 09:23:12 UTC (rev
19835)
+++ trunk/website/includes/common.inc.php~ 2008-05-08 09:28:07 UTC (rev
19836)
@@ -1,139 +0,0 @@
-<?php
-
-function setLanguage() {
- global $lang;
-
- $lang = $_GET['lang'];
-
- if(!isset($lang))
- {
- $languages = split(",", $_SERVER['HTTP_ACCEPT_LANGUAGE'] );
- foreach ($languages as $language) {
- $lang_array = split(";q=", trim( $language ) );
- $lang = trim( $lang_array[0] );
- if( !isset( $lang_array[1] ) )
- $q = 1;
- else
- $q = trim($lang_array[1]);
- $lang_q["$lang"] = (float)$q;
- }
-
- arsort($lang_q);
- $i = 0;
- $lang_index = Array();
- foreach($lang_q as $lang => $q) {
- $lang_index[$i] = $lang; //add to a new array the index
key/language
- $i++;
- }
-
- }
- else
- {
- $lang_q[$lang] = '1' ;
- }
-
- //return $lang_index; // uncomment for returning array with keys={0..n-1},
values={most..least preferred}
- return $lang_q;
-
-}
-
-function selectPage($lang_q, $page) {
-
- if (isset($page))
- {
- #echo "common - page exists
".dirname(__FILE__).'/'.$page.'.inc.php';
- if (file_exists(dirname(__FILE__).'/'.$page.'.inc.php')) {
- #echo "file exists";
- include dirname(__FILE__).'/'.$page.'.inc.php';
// include file with $pages-array
- foreach ( $lang_q as $aLang => $relevance )
// loop through each language
- {
- foreach ( $pages as $userlang => $path )
// loop through each language-file
- {
- if ($aLang == $userlang) {
// if we have a
match, set file-include to $path
- $file = $path;
- if
(file_exists($_SERVER['DOCUMENT_ROOT'].$file))
// if file exists, break loop
- {
- break 2;
- }
- }
- }
-
- }
- if (!isset($file))
- {
- $file = $pages['en']; //if no match, default to
english
- }
- }
- }
- return $file;
-
-}
-
-function otherLanguages() {
-
- include dirname(__FILE__).'/languages.inc.php'; // Include language
descriptions
-
- global $page;
-
-
- if (isset($page))
- {
- if (file_exists(dirname(__FILE__).'/'.$page.'.inc.php'))
- {
- include dirname(__FILE__).'/'.$page.'.inc.php';
-
- $out .= '<div id="additionalLang">:: ';
-
- foreach ( $pages as $userlang => $path )
- {
- foreach ( $languages as $abbr_lang_name =>
$full_lang_name )
- {
- if ($userlang == $abbr_lang_name)
- {
- $out .= '<a
href="'.$abbr_lang_name.'/'.($page ? $page :
"index").'.html">'.$full_lang_name.'</a> :: ';
- }
- }
- }
-
- $out .= '</div>';
- }
- }
- return $out;
-
-}
-
-if (isset($_REQUEST["lang"]))
-{
- $lang_q = array( $_REQUEST["lang"] => '1' );
- $lang = $_REQUEST["lang"];
-}
-else
-{
- $lang_q = setLanguage();
-}
-
-if (isset($_REQUEST["page"])) {
- $page = htmlentities($_REQUEST["page"]);
- $file = selectPage($lang_q, $page);
- if(!file_exists($file) )
- {
- header('HTTP/1.0 404 Not Found');
- if(empty($_SERVER["HTTP_REFERER"]) ||
empty($_SERVER["REQUEST_URI"])){
- header("Location: /");
- }else{
- echo "<html><head><title>404</title><head>";
- echo "<body>404 error - broken link</body>";
- $to="webmaster";
- $subject="404 error";
- $content="\nA 404 error has occurred on the website :
may you fix it ?\nFrom : ".$_SERVER["HTTP_REFERER"]."\nTo :
".$_SERVER["REQUEST_URI"]."\nAt : ".date("D M j Y g:i:s a T"."\nUser-agent :
".$_SERVER["HTTP_USER_AGENT"]);
- @mail($to,$subject,$content,"svn-build");
- }
- die;
- }
-} else {
- $page = "index";
- $lang_q = setLanguage();
- $file = selectPage($lang_q, $page);
-}
-
-?>
\ No newline at end of file
Modified: trunk/website/index.php
===================================================================
--- trunk/website/index.php 2008-05-08 09:23:12 UTC (rev 19835)
+++ trunk/website/index.php 2008-05-08 09:28:07 UTC (rev 19836)
@@ -1,5 +1,14 @@
<?
+if (!isset($_REQUEST["rewritten"])) {
+ $currentURI = "$_SERVER["REQUEST_URI"]";
+ $newURI = ereg_replace("/test\.php\?page=(.+)","/$1.html",$currentURI);
+ header("Request-URI: $newURI");
+ header("Content-Location: $newURI");
+ header("Location: $newURI");
+ die;
+}
+
include 'includes/common.inc.php';
?>
Modified: trunk/website/pages/de/fairshare.php
===================================================================
--- trunk/website/pages/de/fairshare.php 2008-05-08 09:23:12 UTC (rev
19835)
+++ trunk/website/pages/de/fairshare.php 2008-05-08 09:28:07 UTC (rev
19836)
@@ -2,7 +2,7 @@
<h3>Ian Clarke - 29. M?rz 2001</h3>
<!-- Translation disclaimer -->
<p>Dies ist die deutsche ?bersetzung des Artikels. Die englische
- Originalversion finden Sie <a href="/index.php?page=fairshare&lang=en"
+ Originalversion finden Sie <a href="/fairshare.html?lang=en"
>hier</a>.</p>
<h3>Einleitung</h3>
@@ -120,4 +120,4 @@
des Effekts von Freenet auf das Urheberrecht bekamen, uns dazu gebracht hat
?ber dieses Problem nachzudenken.
</p>
-
\ No newline at end of file
+
Modified: trunk/website/pages/de/news.php
===================================================================
--- trunk/website/pages/de/news.php 2008-05-08 09:23:12 UTC (rev 19835)
+++ trunk/website/pages/de/news.php 2008-05-08 09:28:07 UTC (rev 19836)
@@ -6,7 +6,7 @@
<h3>Neuigkeiten</h3>
<!-- Translation disclaimer - do not remove. Modify date of translation! -->
<p>Die deutsche Übersetzung der Neuigkeiten (Stand vom 5.4.2008)
-ist evtl. veraltet, die <a href="/index.php?page=news&lang=en">Englische
Version</a>
+ist evtl. veraltet, die <a href="/news.html?lang=en">Englische Version</a>
sollte aber auf dem neusten Stand sein.</p>
<!-- End of translation disclaimer -->