Update of /cvsroot/gc-linux/htdocs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1961
Modified Files:
docs
Log Message:
...
Index: docs
===================================================================
RCS file: /cvsroot/gc-linux/htdocs/docs,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- docs 23 Jan 2004 11:50:35 -0000 1.1.1.1
+++ docs 3 Mar 2004 12:25:16 -0000 1.2
@@ -18,8 +18,6 @@
{
$lang = "en";
}
-
-$fileurl = preg_split("/\//",$_SERVER["REQUEST_URI"]);
$script_url = preg_replace("/^([^\?]*?)(\?.*)?$/",
"\\1",
@@ -27,29 +25,50 @@
$script_name = $_SERVER["SCRIPT_NAME"];
$pathinfo = preg_replace("'$script_name'", "", "$script_url",1);
-$pathinfo = str_replace("-","/",$pathinfo);
+
$path = preg_split("/\//", "".$pathinfo);
$pathlen = count($path)-1;
if (strlen($path[$pathlen])<2) { $path[$pathlen] ="index.xml"; }
-if ($pathlen==1)
- {
- $user_lang = $lang;
- }
+
+if ($pathlen > 0)
+{
+ if (strpos($path[$pathlen],"-")===false)
+ {
+ $language = $lang;
+ $filename = $path[$pathlen];
+ }
+ else
+ {
+ $start = strpos($path[$pathlen],"-")+1;
+ $language = substr($path[$pathlen],0,2);
+ $filename = substr($path[$pathlen],$start);
+ }
+
+}
else
- {
- $user_lang = $path[$pathlen-1];
- }
-$doc = $path[$pathlen];
+{
+ $filename = "index.xml";
+ $language = $lang;
+}
-$path[$pathlen] = ereg_replace(".html",".xml",$path[$pathlen]);
-$filepath = "./xml";
+for ($index=1;$index<$pathlen;$index++)
+{
+ $filepath .= "/".$path[$index];
+}
+$doc = $filename;
+$filename = ereg_replace(".html",".xml",$filename);
+//echo "[language: $language]";
+//echo "[filename: $filename]";
+//echo "[path: $filepath]";
+
+$root = "./xml";
for ($index=0;$index<count($lang_list);$index++)
{
- if (file_exists($filepath."/".$lang_list[$index]."/".$path[$pathlen]))
+ if (file_exists($root."/".$lang_list[$index].$filepath."/".$filename))
{
array_push($doc_lang,$lang_list[$index]);
}
@@ -58,23 +77,23 @@
reset($path);
reset($doc_lang);
-if (!in_array($user_lang,$doc_lang) && (count($doc_lang)!=0))
+$file .= $root;
+if (!in_array($language,$doc_lang) && (count($doc_lang)!=0))
{
- $filepath .= "/en/".$path[$pathlen];
+ $file .= "/en".$filepath."/".$filename;
}
else
{
- $filepath .= "/".$user_lang."/".$path[$pathlen];
+ $file .= "/".$language.$filepath."/".$filename;
}
+//echo "[file to load: $file]";
if (count($doc_lang)==0) { header("HTTP/1.0 404 Not Found"); exit(); }
-$filepath = ereg_replace(".html",".xml",$filepath);
-
reset($path);
//dl("php_libxslt.so");
dl("../../../../../home/groups/g/gc/gc-linux/php/php_libxslt.so");
-$xml = file_get_contents($filepath);
+$xml = file_get_contents($file);
if (strstr($doc,"faq.html")===false)
{
$xsl = file_get_contents('./xml/en/iparticle.xsl');
@@ -123,7 +142,7 @@
}
echo "</div>";
-if (!in_array($user_lang,$doc_lang) && (count($doc_lang)!=0))
+if (!in_array($language,$doc_lang) && (count($doc_lang)!=0))
{
echo "<div align=center><font color=\"red\" size=\"6\"><b>Sorry the document you requested doesn't exist in your desired language!</b></font></div><div align=center><font color=red><b>You can help us translating this document to your native language. Interested? Read <a href=\"en-docsystem.html\">how to do it here!</a></b></font></div><br/><div align=center><font color=red><a href=\"en-{$doc}\">Click here</a> to display the English version of the requested document</font></div>";
exit();
|