--- trunk/www/working/printable.php 2010/09/16 17:48:28 126 +++ trunk/www/working/printable.php 2010/10/07 02:13:03 144 @@ -1,52 +1,86 @@ - - - - - -

"; +if (substr($curPage,0,14) == "printable.php?" ) { + // + // This means we have a printable.php?xxx.html URL + // let's get the xxx.html part + // + $pageUrlName = substr( $curPage,14,strlen($curPage) ); + // echo "pageUrlName = $pageUrlName


"; +} else { + // + // trunk or demo are the local folders used to develop + // this file at my own private apache server + // + $pageUrlName=basename ($_SERVER['HTTP_REFERER']); + if ( $pageUrlName == 'clonezilla-sysresccd.hellug.gr' OR $pageUrlName == "localhost" OR $pageUrlName == "demo" OR $pageUrlName == "trunk" ) $pageUrlName='index.html'; + $eReg="{#.*}"; + $onlyURL=preg_replace($eReg,"",$pageUrlName); + // echo "pageUrlName = $pageUrlName


"; $thePage = getcwd() . '/' . basename ($_SERVER['HTTP_REFERER']); - $thePage = getcwd() . '/' . $pageUrlName; } +$thePage = getcwd() . '/' . $pageUrlName; +// echo "thePage = $thePage


"; + + + -// echo "$thePage"; -$file = file_get_contents ($thePage); -$eReg="[^<]*"; -$reg=array("0","0","0"); -ereg($eReg,$file,$reg); -// echo "$reg[0]"; - - -// // Find copyright and last update -$eReg="Copyright: .*@.*gr>"; -if(ereg($eReg,$file,$reg)){ - $copr="$reg[0]"; -}else{ - $eReg="Πνευματικά δικαιώματα: .*@.*gr>"; - ereg($eReg,$file,$reg); - $copr="$reg[0]"; +// // Read the file into $file +// $file = file_get_contents ($thePage); + + + +if($pageUrlName == "news.php" ){ +echo "\n +\n +\n +\n +\n +Clonezilla-SysRescCD - What's New\n + + + + - + + ]*>"; -$file = ereg_replace($eReg,"",$file); -$eReg="<.body>.*"; -$file = ereg_replace($eReg,"",$file); - -$eReg= "<" . "!" . "--site-only--" . ">" . ".*" . "
<". "!" . "--end-site-only--" . ">"; -$file = ereg_replace($eReg,"",$file); -$eReg= "<" . "!" . "--site-only--" . ">" . ".*" . "<". "!" . "--end-site-only--" . ">"; -$file = ereg_replace($eReg,"",$file); - -// // Remove [^] links -$eReg="\[\]"; -//$eReg = '\['; -$file = ereg_replace($eReg,"",$file); -// search for -// if found, this is site onepage.php -$eReg=""; -if(strpos($file,$eReg) === false) $eReg=""; -$toStr="\n

" . $copr . "
" . $upd . "

"; -$file = ereg_replace($eReg,$toStr,$file); +if($pageUrlName == "news.php" ){ -//$eReg= "
"; -$eReg = "
.*"; -$file = ereg_replace($eReg,"",$file); + $eReg = "#<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>.*#is"; + $file = preg_replace($eReg,"",$file); -$eReg = "
.*
"; -$file = ereg_replace($eReg,"
",$file); + $eReg = "#[^<]*<#"; + $tReg = '<a name=\0"></a>\0'; + $file = preg_replace($eReg,$tReg,$file); + + $file = str_replace('<">','">',$file); + $file = str_replace("<a name=<H2>","<a name=\"",$file); + + $file = str_replace("=<title>","=\"",$file); + $file = str_replace("<title>","<H2>",$file); + $file = str_replace(""," [^]",$file); + + $file = str_replace("","

Date: ",$file); + $file = str_replace("","

",$file); + $file = str_replace("","

",$file); + $file = str_replace("","",$file); + $file = str_replace("","",$file); + //$file = str_replace("","",$file); + $file = str_replace("","",$file); + //$file = str_replace("","",$file); + $file = str_replace("","",$file); + + $eReg = "#^" . ".*" . "<" . "/image" . ">#"; + $file = preg_replace($eReg,"",$file); + + + $eReg = "#<" . "guid" . "[^<]*" . "<" . "/guid" . ">#"; + $file = preg_replace($eReg,"",$file); + + + $eReg = "#<" . "link" . "[^<]*" . "<" . "/link" . ">#"; + + +// $file = preg_replace($eReg,"",$file); +// $indexFile = file_get_contents ("./index.html"); +// $headerTokken = preg_match("#
#is", $indexFile , $matches); +// if( $headerTokken == 0 ) +// echo "Error: Cannot find header in index.html!!!"; +// else{ +// $headerTokken = $matches[0]; +// $headerTokken = preg_replace( "#
.*
#is" , "" , $headerTokken ); +// $headerTokken = str_replace("position: absolute; left: 0px;","position: absolute; left: 40pt;",$headerTokken); +// $headerTokken = str_replace("position: absolute; right: 0px;","position: absolute; right: 40pt;",$headerTokken); +// $headerTokken = preg_replace( "#Well*come#" , "What's New" , $headerTokken ); +// $headerTokken = preg_replace( "#.*

#is" , "
" , $headerTokken ); +// // $headerTokken = preg_replace( "#(.*)

$#is" , "$1
" , $headerTokken ); +// // $headerTokken = str_replace( " style=\"margin:0; padding: 3px; width: 980; position relative;\">" , ">" , $headerTokken ); +// echo $headerTokken; +// } +// // $file = preg_replace( "##" , "\n".$headerTokken , $file ); +// + + echo "

Clonezilla-SysRescCD
What's New

"; + +} else { + + + // Remove RSS + $eReg="#
#"; + $file=preg_replace($eReg,"",$file); + + // Remove link line + $eReg="#
.*
#is"; + $file=preg_replace($eReg,"\n
",$file); + + + // Remove footer + $eReg = "#
.*
#is"; + $file = preg_replace($eReg,"",$file); + $eReg = "#
.*
#is"; + $file = preg_replace($eReg,"",$file); + + $eReg = "#[^<]*

#"; + $file = preg_replace($eReg,"
",$file); + + $eReg = "#

#"; + $file = preg_replace($eReg,"

",$file); + + + $file = str_replace("position: absolute; left: 0px;","position: absolute; left: 40pt;",$file); + $file = str_replace("position: absolute; right: 0px;","position: absolute; right: 40pt;",$file); + + $eReg = "#

Clonezilla-SysRescCD
(.*)

#i"; + $file = preg_replace($eReg,"

Clonezilla-SysRescCD
$1

",$file); + + + // Place top navigation + if(! empty($topNav)){ + $eReg = "#
#"; + $file = preg_replace($eReg, $topNav."\n
", $file); + } + $file = preg_replace( "#id=\"docline-top\"#" , "align=\"center\" class=\"docline-top\"" , $file ); + + // Place bottom navigation + if(! empty($bottomNav)){ + $eReg = "##i"; + $file = preg_replace($eReg, $bottomNav."\n", $file); + } + $file = preg_replace( "#id=\"docline-bottom\"#" , "align=\"center\" class=\"docline-bottom\"" , $file ); + + // Remove extra tags + $file = preg_replace( "#
#" , "" , $file ); + $file = preg_replace( "#
#" , "" , $file ); + +} -$eReg = "
Clonezilla-SysRescCD"; -$file = ereg_replace($eReg,"

Clonezilla-SysRescCD

",$file); +// Remove [^] links +$eReg="#\[]*>\^\]#i"; +$file = preg_replace($eReg,"",$file); +$eReg = "#
.*#i"; +$file = preg_replace($eReg,"",$file); -$eReg = "
.*
"; -$file = ereg_replace($eReg,"",$file); +$eReg = "{
Clonezilla-SysRescCD}"; +preg_replace($eReg,"

Clonezilla-SysRescCD

",$file); -$eReg = "[^<]*

"; -$file = ereg_replace($eReg,"
",$file); -$eReg = "

"; -$file = ereg_replace($eReg,"

",$file); +$file = preg_replace( "#href=\"\"#i" , "href=\"printable.php?index.html\"" , $file ); -$file = str_replace("position: absolute; left: 0px;","position: absolute; left: 40pt;",$file); -$file = str_replace("position: absolute; right: 0px;","position: absolute; right: 40pt;",$file); -//position: absolute; right: 0px; +// Convert href="XXX.html#YYY" to href="printable.php?XXX.html#YYY" +$eReg = "@href=\"([^hf][^t][^t]?[^p][^s]?[^\"]*)\"@i"; +//$eReg = "@href=\"([:alpha:]]\.html#?[^\"]*\")@i"; +$file = preg_replace( $eReg, "href=\"printable.php?$1\"" , $file ); +// Convert href="#YYY" to href="printable.php?XXX.html#YYY" +// Because of previous conversion, the link is now: +// href="printable.php?#YYY" +$eReg = "@href=\"printable.php\?(#[^\"]*)\"@i"; +$file = preg_replace( $eReg, "href=\"printable.php?".$pageUrlName."$1\"" , $file ); +echo $file; -$eReg = "

.*

"; -$file = ereg_replace($eReg,"
",$file); +// echo "

+// "; -$eReg = "
.*
"; -$file = ereg_replace($eReg,"",$file); +?> -echo $file; -echo "
-"; -?> +
+WARNING
+This is the BETA version of Clonezilla-SysRescCD
+To acces our current stable version, please click here +