/[clonezilla-sysresccd]/trunk/www/working/printable.php
ViewVC logotype

Diff of /trunk/www/working/printable.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 126 by sng, Thu Sep 16 17:48:28 2010 UTC revision 145 by sng, Thu Oct 7 09:19:52 2010 UTC
# Line 1  Line 1 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
 <html>  
 <head>  
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
 <link rel="alternate" type="application/rss+xml" title="RSS" href="http://clonezilla-sysresccd.hellug.gr/clonezilla-sysresccd.rss">  
 <link rel="shortcut icon" href="favicon.ico">  
1  <?php  <?php
2  error_reporting(E_ALL);  error_reporting(E_ALL);
3    // error_reporting(E_ERROR);
4  ini_set('display_errors', '1');  ini_set('display_errors', '1');
5    
6  $pageUrlName=basename ($_SERVER['HTTP_REFERER']);  $curPage = basename( $_SERVER["REQUEST_URI"] );
7  if ( $pageUrlName == 'clonezilla-sysresccd.hellug.gr' OR $pageUrlName == "localhost" OR $pageUrlName == "demo") $pageUrlName='index.html';  // echo "pageURL = $curPage<br><br><br>";
8    if (substr($curPage,0,14) == "printable.php?" ) {
9  $eReg="#.*";    //
10  $onlyURL=ereg_replace($eReg,"",$pageUrlName);    // This means we have a printable.php?xxx.html URL
11      // let's get the xxx.html part
12  // echo "pageUrlName = $pageUrlName";    //
13  if (substr($onlyURL,strlen($pageUrlName)-3,3) == "php" OR substr($onlyURL,strlen($pageUrlName)-6,6) == "php?el")    $pageUrlName = substr( $curPage,14,strlen($curPage) );
14    $thePage = "http://clonezilla-sysresccd.hellug.gr/" . $pageUrlName;    // echo "pageUrlName = $pageUrlName<br><br><br>";
15  //   $thePage = "http://localhost/" . $pageUrlName;  } else {
16  else {    //
17    //echo "Basename = $pageUrlName\n";    // trunk or demo are the local folders used to develop
18      // this file at my own private apache server
19      //
20      $pageUrlName=basename ($_SERVER['HTTP_REFERER']);
21      if ( $pageUrlName == 'clonezilla-sysresccd.hellug.gr' OR $pageUrlName == "localhost" OR $pageUrlName == "demo" OR $pageUrlName == "trunk" ) $pageUrlName='index.html';
22      $eReg="{#.*}";
23      $onlyURL=preg_replace($eReg,"",$pageUrlName);
24      // echo "pageUrlName = $pageUrlName<br><br><br>";
25    $thePage = getcwd() . '/' . basename ($_SERVER['HTTP_REFERER']);    $thePage = getcwd() . '/' . basename ($_SERVER['HTTP_REFERER']);
   $thePage = getcwd() . '/' . $pageUrlName;  
26  }  }
27    $thePage = getcwd() . '/' . $pageUrlName;
28    // echo "thePage = $thePage<br><br><br>";
29    
30    
31    
32    
33    
34  // echo "$thePage";  // // Read the file into $file
35  $file = file_get_contents ($thePage);  // $file = file_get_contents ($thePage);
36    
37  $eReg="<title>[^<]*</title>";  
38  $reg=array("0","0","0");  
39  ereg($eReg,$file,$reg);  if($pageUrlName == "news.php" ){
40  // echo "$reg[0]";  echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n
41    <html>\n
42    <head>\n
43  // // Find copyright and last update  <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"http://clonezilla-sysresccd.hellug.gr/clonezilla-sysresccd.rss\">\n
44  $eReg="Copyright: .*@.*gr&gt;</a>";  <link rel=\"shortcut icon\" href=\"favicon.ico\">\n
45  if(ereg($eReg,$file,$reg)){  <title>Clonezilla-SysRescCD - What's New</title>\n
46    $copr="$reg[0]";  <style type=\"text/css\">\n";
47  }else{  
48    $eReg="Πνευματικά δικαιώματα: .*@.*gr&gt;</a>";    $thePage = dirname($thePage) . "/clonezilla-sysresccd.rss";
49    ereg($eReg,$file,$reg);  
50    $copr="$reg[0]";    // Read the file into $file
51      $file = file_get_contents ($thePage);
52    
53    } else {
54    
55      // Read the file into $file
56      $file = file_get_contents ($thePage);
57    
58      // Get top navigation div
59      $eReg = "#<div id=\"docline-top\">.*#";
60      $numMatch = preg_match($eReg,$file,$matches);
61      if($numMatch > 0)
62        $topNav = $matches[0];
63      // echo $topNav;
64      
65      // Get bottom navigation div
66      $eReg = "#<div id=\"docline-bottom\">.*#";
67      $numMatch = preg_match($eReg,$file,$matches);
68      if($numMatch > 0)
69        $bottomNav = $matches[0];
70      // echo $bottomNav;
71      
72      // Remove text starting from line 1 to
73      //   line containing <body> tag
74      $eReg="#<html.*</head>#is";
75      $file = preg_replace($eReg,"",$file);
76      $eReg = "#<!DOCTYPE HTML PUBLIC.*#i";
77      $file = preg_replace($eReg,"",$file);
78      $eReg = "#<body.*#i";
79      $file = preg_replace($eReg,"",$file);
80  }  }
81  $eReg="<font size=\"-1\">[^<]*: [0-9][0-9]/[0-9][0-9]/[0-9][0-9][0-9][0-9]</font>";  
 ereg($eReg,$file,$reg);  
 $upd="$reg[0]";  
82  ?>  ?>
83      <style type="text/css">  <style type="text/css">
84  body { background : fixed no-repeat; background-color: White; }  body { background : fixed no-repeat; background-color: White; }
85  H1,H2,H3{color: #990000; text-align: left;}  H1,H2,H3{color: #990000; text-align: left;}
86  H1{margin-top: 4em; margin-bottom: 2em;}  H1{margin-top: 4em; margin-bottom: 2em;}
# Line 56  li{margin-top: 1em;} Line 90  li{margin-top: 1em;}
90  :link    { color: #0000C0; text-decoration: none; }  :link    { color: #0000C0; text-decoration: none; }
91  :visited { color: #0000C0; text-decoration: none; }  :visited { color: #0000C0; text-decoration: none; }
92  a:hover   { color: #0000C0; text-decoration: underline; }  a:hover   { color: #0000C0; text-decoration: underline; }
93    img { display: block; margin:0 auto; }
94  /*p,td,table,tr,li{margin-left: 15pt;}*/  /*p,td,table,tr,li{margin-left: 15pt;}*/
95  .nav{margin-left: 0pt;}  .nav{margin-left: 0pt;}
 .otherpage{border: solid 1px darkgoldenrod; padding: 20pt; background-color: lemonchiffon;}  
96  .newcode{font-family : "Courier New", Courier, monospace, sans-serif, serif; font-weight: bold; background-color: #F2F2F2; border: solid 1px #DEDEDE;padding: 20pt;}  .newcode{font-family : "Courier New", Courier, monospace, sans-serif, serif; font-weight: bold; background-color: #F2F2F2; border: solid 1px #DEDEDE;padding: 20pt;}
97  .note{margin-top: 30pt; margin-bottom: 30pt; text-align: center; background-color: #FFEFEF; border: solid 1px; border-color: #FFD5D5;}  .note{margin-top: 30pt; margin-bottom: 30pt; text-align: center; background-color: #FFEFEF; border: solid 1px; border-color: #FFD5D5;}
98  hr{color: Black; background-color: Black; height: 1px; border: none;}  hr{color: Black; background-color: Black; height: 1px; border: none;}
99  #header {color: #990000; }  #header {color: #990000; }
100    .newcode{font-family : "Courier New", Courier, monospace; font-weight: bold; background-color: #F2F2F2; border: solid 1px #DEDEDE;padding: 20pt;}
101    .note{margin-top: 30pt; margin-bottom: 30pt; text-align: left; background-color: #FFEFEF; border: double 3px; border-color: #FFD5D5;}
102    .otherpage{border: solid 1px darkgoldenrod; padding: 20pt; background-color: lemonchiffon;}
103    .docline-top {color: #990000 ; font-weight: bold; display:block;}
104    .docline-top a{color: #990000; font-weight: bold;}
105    .docline-bottom {color: #990000 ; font-weight: bold; display:block;}
106    .docline-bottom a{color: #990000; font-weight: bold;}
107        #warning { margin: 5px; padding: .4em; background-color: Red; color: White; align: center; font-weight: bold; border-width: 2px; border-color: white; border-style: solid; }
108        #warning a { color: white; font-weight: bold; text-decoration: underline;  }
109    
110    @media print {
111    .docline-top {display: none;}
112    .docline-bottom {display: none;}
113        #warning { margin: 0; padding: .4em; background-color: Red; color: White; align: center; font-weight: bold; border-width: 2px; border-color: white; border-style: solid; }
114        #warning a { color: white; font-weight: bold; text-decoration: underline;  }
115    }
116  </style>  </style>
117    <link href="warning.css" rel="stylesheet" type="text/css" />  
118    <!--
119    The file waring.css exists only in the root of the site
120    and it hides the BETA warnings. Its contents are
121        #warning { display: none; }
122    -->
123    
124  <META NAME="Keywords" CONTENT="multiboot Multi Boot bootable cd rescue clonezilla sysresccd">  <META NAME="Keywords" CONTENT="multiboot Multi Boot bootable cd rescue clonezilla sysresccd">
125  </head>  </head>
126  <body style="margin-left: 40pt; margin-right: 40pt;">  <body style="margin: 40pt;">
127    <!--<div id="warning" align="center">
128    WARNING<br>
129    This is the BETA version of Clonezilla-SysRescCD<br>
130    To acces our current stable version, please click <a href="../index.html">here</a>
131    </div>-->
132  <?php  <?php
 $eReg=".*<body[^>]*>";  
 $file = ereg_replace($eReg,"",$file);  
 $eReg="<.body>.*";  
 $file = ereg_replace($eReg,"",$file);  
   
 $eReg= "<" . "!" . "--site-only--" . ">" . ".*" . "<hr style=\"margin: 0;\"><". "!" . "--end-site-only--" . ">";  
 $file = ereg_replace($eReg,"",$file);  
 $eReg= "<" . "!" . "--site-only--" . ">" . ".*" . "<". "!" . "--end-site-only--" . ">";  
 $file = ereg_replace($eReg,"",$file);  
   
 // // Remove [^] links  
 $eReg="\[<a [^<]*\^\^*</a>\]";  
 //$eReg = '\[';  
 $file = ereg_replace($eReg,"",$file);  
   
 // search for <!--H1--></H1>  
 // if found, this is site onepage.php  
 $eReg="<!--copyright data only here--></H1>";  
 if(strpos($file,$eReg) === false) $eReg="</H1>";  
 $toStr="</H1>\n<p><font size=\"-1\">" . $copr . "<br></font>" . $upd  . "<br><br></p>";  
 $file = ereg_replace($eReg,$toStr,$file);  
   
 //$eReg= "<div id=\"lphp\"" . ".*" . "<\/div>";  
 $eReg = "<div id=.rss.>.*<!-- docline-top-->";  
 $file = ereg_replace($eReg,"<!-- docline-top-->",$file);  
133    
134    if($pageUrlName == "news.php" ){
135    
136  $eReg = "<div id=.linkline.>.*<div id=.contarea.>";    $eReg = "#<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>.*</image>#is";
137  $file = ereg_replace($eReg,"<div id=\"contarea\">",$file);    $file = preg_replace($eReg,"",$file);
138    
139    
140  $eReg = "<div id=.lphp.*<H2>Clonezilla-SysRescCD</H2>";    $eReg = "#<title>[^<]*<#";
141  $file = ereg_replace($eReg,"<H2>Clonezilla-SysRescCD</H2>",$file);    $tReg = '<a name=\0"></a>\0';
142      $file = preg_replace($eReg,$tReg,$file);
143      
144      $file = str_replace('<">','">',$file);
145      $file = str_replace("<a name=<H2>","<a name=\"",$file);
146      
147      $file = str_replace("=<title>","=\"",$file);
148      $file = str_replace("<title>","<H2>",$file);
149      $file = str_replace("</title>"," <span class=\"hideprint\">[<a href=\"#news-top\" title=\"go to top of the page\">^</a>]</span></H2>",$file);
150      
151      $file = str_replace("<pubDate>","<p><b>Date: </b>",$file);
152      $file = str_replace("</pubDate>","<br><br>",$file);
153      $file = str_replace("<description><![CDATA[","",$file);
154      $file = str_replace("]]></description>","</p>",$file);
155      $file = str_replace("<item>","",$file);
156      $file = str_replace("</item>","",$file);
157      //$file = str_replace("<rss>","",$file);
158      $file = str_replace("</rss>","",$file);
159      //$file = str_replace("<channel>","",$file);
160      $file = str_replace("</channel>","",$file);
161      
162      $eReg = "#^" . ".*" . "<" . "/image" . ">#";
163      $file = preg_replace($eReg,"",$file);
164      
165      
166      $eReg = "#<" . "guid" . "[^<]*" . "<" . "/guid" . ">#";
167      $file = preg_replace($eReg,"",$file);
168      
169      
170      $eReg = "#<" . "link" . "[^<]*" . "<" . "/link" . ">#";
171    
172    
173    //  $file = preg_replace($eReg,"",$file);
174    //   $indexFile = file_get_contents ("./index.html");
175    //   $headerTokken = preg_match("#<div id=\"header\".*<div id=\"contarea\">#is", $indexFile , $matches);
176    //   if( $headerTokken == 0 )
177    //     echo "<big>Error: Cannot find header in <b>index.html</b>!!!</big>";
178    //   else{
179    //     $headerTokken = $matches[0];
180    //     $headerTokken = preg_replace( "#<div id=\"lphp\".*#" , "" , $headerTokken );
181    //     $headerTokken = preg_replace( "#<div id=\"linkline\">.*<div id=\"contarea\">#is" , "" , $headerTokken );
182    //     $headerTokken = str_replace("position: absolute; left: 0px;","position: absolute; left: 40pt;",$headerTokken);
183    //     $headerTokken = str_replace("position: absolute; right: 0px;","position: absolute; right: 40pt;",$headerTokken);
184    //     $headerTokken = preg_replace( "#Well*come#" , "What's New" , $headerTokken );
185    //     $headerTokken = preg_replace( "#</H2>.*<H3>#is" , "<br>" , $headerTokken );
186    // //    $headerTokken = preg_replace( "#(.*)</div>$#is" , "$1<div></div style=\"margin-bottom: 300px;\"></div>" , $headerTokken );
187    // //    $headerTokken = str_replace( " style=\"margin:0; padding: 3px; width: 980; position relative;\">" , ">" , $headerTokken );
188    //     echo $headerTokken;
189    //   }
190    // //  $file = preg_replace( "#<body style=\"margin: 40pt;\">#" , "<body style=\"margin: 40pt;\">\n".$headerTokken , $file );
191    //
192    
193      echo "<H2>Clonezilla-SysRescCD<br>What's New</H2>";
194    
195    } else {
196      
197      
198      // Remove RSS
199      $eReg="#<div id=\"lphp\" style=.*</div>#";
200      $file=preg_replace($eReg,"",$file);
201      
202      // Remove link line
203      $eReg="#<div id=\"linkline\">.*<div id=\"contarea\">#is";
204      $file=preg_replace($eReg,"<!-- docline-top-->\n<div id=\"contarea\">",$file);
205      
206      
207      // Remove footer
208      $eReg = "#<div id=\"menu\">.*</div>#is";
209      $file = preg_replace($eReg,"",$file);
210      $eReg = "#<div id=\"footer\">.*</div>#is";
211      $file = preg_replace($eReg,"",$file);
212      
213      $eReg = "#</H2>[^<]*<H3>#";
214      $file = preg_replace($eReg,"<br>",$file);
215      
216      $eReg = "#<H2 style=\"margin-top: 0;\">#";
217      $file = preg_replace($eReg,"<H2 style=\"margin-top: 4em;\">",$file);
218      
219      
220      $file = str_replace("position: absolute; left: 0px;","position: absolute; left: 40pt;",$file);
221      $file = str_replace("position: absolute; right: 0px;","position: absolute; right: 40pt;",$file);
222      
223      $eReg = "#<H2>Clonezilla-SysRescCD<br>(.*)</H3>#i";
224      $file = preg_replace($eReg,"<H1>Clonezilla-SysRescCD<br>$1</H1>",$file);
225      
226      
227      // Place top navigation
228      if(! empty($topNav)){
229        $eReg = "#<div id=\"contarea\">#";
230        $file = preg_replace($eReg, $topNav."\n<div id=\"contarea\">", $file);
231      }
232      $file = preg_replace( "#id=\"docline-top\"#" , "align=\"center\" class=\"docline-top\"" , $file );
233      
234      // Place bottom navigation
235      if(! empty($bottomNav)){
236        $eReg = "#</body>#i";
237        $file = preg_replace($eReg, $bottomNav."\n</body>", $file);
238      }
239      $file = preg_replace( "#id=\"docline-bottom\"#" , "align=\"center\" class=\"docline-bottom\"" , $file );
240      
241      // Remove extra tags
242      $file = preg_replace( "#<div id=\"contarea\">#" , "" , $file );
243      $file = preg_replace( "#<div id=\"content\">#" , "" , $file );
244      
245    }
246    
247    
248  $eReg = "<div id=.menu.>.*</div>";  // Remove [^] links
249  $file = ereg_replace($eReg,"",$file);  $eReg="#\[<a href=[^>]*>\^</a>\]#i";
250    $file = preg_replace($eReg,"",$file);
251    
252  $eReg = "</H2>[^<]*<H3>";  $eReg = "#<div id=.rss.>.*<!-- docline-top-->#i";
253  $file = ereg_replace($eReg,"<br>",$file);  $file = preg_replace($eReg,"<!-- docline-top-->",$file);
254    
255  $eReg = "<H2 style=.margin-top: 0;.>";  $eReg = "{<div id=.lphp.*<H2>Clonezilla-SysRescCD</H2>}";
256  $file = ereg_replace($eReg,"<H2 style=\"margin-top: 4em;\">",$file);  preg_replace($eReg,"<H2>Clonezilla-SysRescCD</H2>",$file);
257    
258    
 $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;  
259    
260    $file = preg_replace( "#href=\"\"#i" , "href=\"printable.php?index.html\"" , $file );
261    
262  $eReg = "</H4></div>.*<div style=.position: absolute; right: 40pt;.><H4>";  // Convert href="XXX.html#YYY" to href="printable.php?XXX.html#YYY"
263  $file = ereg_replace($eReg,"<br>",$file);  $eReg = "@href=\"([^hf][^t][^t]?[^p][^s]?[^\"]*)\"@i";
264    //$eReg = "@href=\"([:alpha:]]\.html#?[^\"]*\")@i";
265    $file = preg_replace( $eReg, "href=\"printable.php?$1\"" , $file );
266    
267    // Convert href="#YYY" to href="printable.php?XXX.html#YYY"
268    // Because of previous conversion, the link is now:
269    //    href="printable.php?#YYY"
270    $eReg = "@href=\"printable.php\?(#[^\"]*)\"@i";
271    $file = preg_replace( $eReg, "href=\"printable.php?".$pageUrlName."$1\"" , $file );
272    echo $file;
273    
274  $eReg = "<div id=.footer.>.*</div>";  // echo "</div>
275  $file = ereg_replace($eReg,"",$file);  // ";
276    
277    
 echo $file;  
 echo "</div>  
 ";  
   
278  ?>  ?>
279    
280    <div id="warning" align="center">
281    WARNING<br>
282    This is the BETA version of Clonezilla-SysRescCD<br>
283    To acces our current stable version, please click <a href="../index.html">here</a>
284    </div>
285  </body>  </body>
286  </html>  </html>

Legend:
Removed from v.126  
changed lines
  Added in v.145

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26