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

Diff of /trunk/www/printable.php

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

revision 132 by sng, Tue Sep 21 13:14:15 2010 UTC revision 134 by sng, Fri Sep 24 12:58:07 2010 UTC
# Line 27  if (substr($curPage,0,14) == "printable. Line 27  if (substr($curPage,0,14) == "printable.
27  $thePage = getcwd() . '/' . $pageUrlName;  $thePage = getcwd() . '/' . $pageUrlName;
28  // echo "thePage = $thePage<br><br><br>";  // echo "thePage = $thePage<br><br><br>";
29    
 // Read the file into $file  
 $file = file_get_contents ($thePage);  
30    
 // Get top navigation div  
 $eReg = "#<div id=\"docline-top\">.*#";  
 $numMatch = preg_match($eReg,$file,$matches);  
 if($numMatch > 0)  
   $topNav = $matches[0];  
 // echo $topNav;  
   
 // Get bottom navigation div  
 $eReg = "#<div id=\"docline-bottom\">.*#";  
 $numMatch = preg_match($eReg,$file,$matches);  
 if($numMatch > 0)  
   $bottomNav = $matches[0];  
 // echo $bottomNav;  
   
 // Remove text starting from line 1 to  
 //   line containing <body> tag  
 $eReg="#<html.*</head>#is";  
 $file = preg_replace($eReg,"",$file);  
 $eReg = "#<!DOCTYPE HTML PUBLIC.*#i";  
 $file = preg_replace($eReg,"",$file);  
 $eReg = "#<body.*#i";  
 $file = preg_replace($eReg,"",$file);  
31    
32    
33    
34    // // Read the file into $file
35    // $file = file_get_contents ($thePage);
36    
37    
38    
39    if($pageUrlName == "news.php" ){
40    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    <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"http://clonezilla-sysresccd.hellug.gr/clonezilla-sysresccd.rss\">\n
44    <link rel=\"shortcut icon\" href=\"favicon.ico\">\n
45    <title>Clonezilla-SysRescCD - What's New</title>\n
46    <style type=\"text/css\">\n";
47    
48      $thePage = dirname($thePage) . "/clonezilla-sysresccd.rss";
49    
50      // 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    
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; }
# Line 90  hr{color: Black; background-color: Black Line 115  hr{color: Black; background-color: Black
115  <body style="margin: 40pt;">  <body style="margin: 40pt;">
116  <?php  <?php
117    
118    if($pageUrlName == "news.php" ){
119    
120      $eReg = "#<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>.*</image>#is";
121      $file = preg_replace($eReg,"",$file);
122    
123    
124      $eReg = "#<title>[^<]*<#";
125      $tReg = '<a name=\0"></a>\0';
126      $file = preg_replace($eReg,$tReg,$file);
127      
128      $file = str_replace('<">','">',$file);
129      $file = str_replace("<a name=<H2>","<a name=\"",$file);
130      
131      $file = str_replace("=<title>","=\"",$file);
132      $file = str_replace("<title>","<H2>",$file);
133      $file = str_replace("</title>"," <span class=\"hideprint\">[<a href=\"#news-top\" title=\"go to top of the page\">^</a>]</span></H2>",$file);
134      
135      $file = str_replace("<pubDate>","<p><b>Date: </b>",$file);
136      $file = str_replace("</pubDate>","<br><br>",$file);
137      $file = str_replace("<description><![CDATA[","",$file);
138      $file = str_replace("]]></description>","</p>",$file);
139      $file = str_replace("<item>","",$file);
140      $file = str_replace("</item>","",$file);
141      //$file = str_replace("<rss>","",$file);
142      $file = str_replace("</rss>","",$file);
143      //$file = str_replace("<channel>","",$file);
144      $file = str_replace("</channel>","",$file);
145      
146      $eReg = "#^" . ".*" . "<" . "/image" . ">#";
147      $file = preg_replace($eReg,"",$file);
148      
149      
150      $eReg = "#<" . "guid" . "[^<]*" . "<" . "/guid" . ">#";
151      $file = preg_replace($eReg,"",$file);
152      
153      
154      $eReg = "#<" . "link" . "[^<]*" . "<" . "/link" . ">#";
155    
156    
157      // Remove <link> content
158      $file = preg_replace( "#<link>.*</link>#i" , "" , $file );
159    
160      echo "<H2>Clonezilla-SysRescCD<br>What's New</H2>";
161    
162    } else {
163      
164      // Remove RSS
165      $eReg="#<div id=\"lphp\" style=.*</div>#";
166      $file=preg_replace($eReg,"",$file);
167      
168      // Remove link line
169      $eReg="#<div id=\"linkline\">.*<div id=\"contarea\">#is";
170      $file=preg_replace($eReg,"<!-- docline-top-->\n<div id=\"contarea\">",$file);
171      
172      
173      // Remove footer
174      $eReg = "#<div id=\"menu\">.*</div>#is";
175      $file = preg_replace($eReg,"",$file);
176      $eReg = "#<div id=\"footer\">.*</div>#is";
177      $file = preg_replace($eReg,"",$file);
178      
179      $eReg = "#</H2>[^<]*<H3>#";
180      $file = preg_replace($eReg,"<br>",$file);
181      
182      $eReg = "#<H2 style=\"margin-top: 0;\">#";
183      $file = preg_replace($eReg,"<H2 style=\"margin-top: 4em;\">",$file);
184      
185      
186      $file = str_replace("position: absolute; left: 0px;","position: absolute; left: 40pt;",$file);
187      $file = str_replace("position: absolute; right: 0px;","position: absolute; right: 40pt;",$file);
188      
189      $eReg = "#<H2>Clonezilla-SysRescCD<br>(.*)</H3>#i";
190      $file = preg_replace($eReg,"<H1>Clonezilla-SysRescCD<br>$1</H1>",$file);
191      
192      
193      // Place top navigation
194      if(! empty($topNav)){
195        $eReg = "#<div id=\"contarea\">#";
196        $file = preg_replace($eReg, $topNav."\n<div id=\"contarea\">", $file);
197      }
198      $file = preg_replace( "#id=\"docline-top\"#" , "align=\"center\" class=\"docline-top\"" , $file );
199      
200      // Place bottom navigation
201      if(! empty($bottomNav)){
202        $eReg = "#</body>#i";
203        $file = preg_replace($eReg, $bottomNav."\n</body>", $file);
204      }
205      $file = preg_replace( "#id=\"docline-bottom\"#" , "align=\"center\" class=\"docline-bottom\"" , $file );
206      
207      // Remove extra tags
208      $file = preg_replace( "#<div id=\"contarea\">#" , "" , $file );
209      $file = preg_replace( "#<div id=\"content\">#" , "" , $file );
210      
211    }
212    
213    
214  // Remove [^] links  // Remove [^] links
215  $eReg="#\[<a href=[^>]*>\^</a>\]#i";  $eReg="#\[<a href=[^>]*>\^</a>\]#i";
# Line 102  $eReg = "{<div id=.lphp.*<H2>Clonezilla- Line 222  $eReg = "{<div id=.lphp.*<H2>Clonezilla-
222  preg_replace($eReg,"<H2>Clonezilla-SysRescCD</H2>",$file);  preg_replace($eReg,"<H2>Clonezilla-SysRescCD</H2>",$file);
223    
224    
 // Remove RSS  
 $eReg="#<div id=\"lphp\" style=.*</div>#";  
 $file=preg_replace($eReg,"",$file);  
   
 // Remove link line  
 $eReg="#<div id=\"linkline\">.*<div id=\"contarea\">#is";  
 $file=preg_replace($eReg,"<!-- docline-top-->\n<div id=\"contarea\">",$file);  
   
   
 // Remove footer  
 $eReg = "#<div id=\"menu\">.*</div>#is";  
 $file = preg_replace($eReg,"",$file);  
 $eReg = "#<div id=\"footer\">.*</div>#is";  
 $file = preg_replace($eReg,"",$file);  
   
 $eReg = "#</H2>[^<]*<H3>#";  
 $file = preg_replace($eReg,"<br>",$file);  
   
 $eReg = "#<H2 style=\"margin-top: 0;\">#";  
 $file = preg_replace($eReg,"<H2 style=\"margin-top: 4em;\">",$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 = "#<H2>Clonezilla-SysRescCD<br>(.*)</H3>#i";  
 $file = preg_replace($eReg,"<H1>Clonezilla-SysRescCD<br>$1</H1>",$file);  
   
   
 // Place top navigation  
 if(! empty($topNav)){  
   $eReg = "#<div id=\"contarea\">#";  
   $file = preg_replace($eReg, $topNav."\n<div id=\"contarea\">", $file);  
 }  
 $file = preg_replace( "#id=\"docline-top\"#" , "align=\"center\" class=\"docline-top\"" , $file );  
   
 // Place bottom navigation  
 if(! empty($bottomNav)){  
   $eReg = "#</body>#i";  
   $file = preg_replace($eReg, $bottomNav."\n</body>", $file);  
 }  
 $file = preg_replace( "#id=\"docline-bottom\"#" , "align=\"center\" class=\"docline-bottom\"" , $file );  
   
 // Remove extra tags  
 $file = preg_replace( "#<div id=\"contarea\">#" , "" , $file );  
 $file = preg_replace( "#<div id=\"content\">#" , "" , $file );  
   
225    
226  $file = preg_replace( "#href=\"\"#i" , "href=\"printable.php?index.html\"" , $file );  $file = preg_replace( "#href=\"\"#i" , "href=\"printable.php?index.html\"" , $file );
227    
# Line 162  $file = preg_replace( $eReg, "href=\"pri Line 235  $file = preg_replace( $eReg, "href=\"pri
235  //    href="printable.php?#YYY"  //    href="printable.php?#YYY"
236  $eReg = "@href=\"printable.php\?(#[^\"]*)\"@i";  $eReg = "@href=\"printable.php\?(#[^\"]*)\"@i";
237  $file = preg_replace( $eReg, "href=\"printable.php?".$pageUrlName."$1\"" , $file );  $file = preg_replace( $eReg, "href=\"printable.php?".$pageUrlName."$1\"" , $file );
   
238  echo $file;  echo $file;
239    
240  // echo "</div>  // echo "</div>
241  // ";  // ";
242    
243    
244  ?>  ?>
245  </body>  </body>
246  </html>  </html>

Legend:
Removed from v.132  
changed lines
  Added in v.134

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26