/[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 131 by sng, Mon Sep 20 18:49:07 2010 UTC revision 132 by sng, Tue Sep 21 13:14:15 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);  // error_reporting(E_ERROR);
# Line 36  $thePage = getcwd() . '/' . $pageUrlName Line 30  $thePage = getcwd() . '/' . $pageUrlName
30  // Read the file into $file  // Read the file into $file
31  $file = file_get_contents ($thePage);  $file = file_get_contents ($thePage);
32    
33    // Get top navigation div
34    $eReg = "#<div id=\"docline-top\">.*#";
35    $numMatch = preg_match($eReg,$file,$matches);
36    if($numMatch > 0)
37      $topNav = $matches[0];
38    // echo $topNav;
39    
40    // Get bottom navigation div
41    $eReg = "#<div id=\"docline-bottom\">.*#";
42    $numMatch = preg_match($eReg,$file,$matches);
43    if($numMatch > 0)
44      $bottomNav = $matches[0];
45    // echo $bottomNav;
46    
47  // Remove text starting from line 1 to  // Remove text starting from line 1 to
48  //   line containing <body> tag  //   line containing <body> tag
# Line 68  hr{color: Black; background-color: Black Line 75  hr{color: Black; background-color: Black
75  .newcode{font-family : "Courier New", Courier, monospace; font-weight: bold; background-color: #F2F2F2; border: solid 1px #DEDEDE;padding: 20pt;}  .newcode{font-family : "Courier New", Courier, monospace; font-weight: bold; background-color: #F2F2F2; border: solid 1px #DEDEDE;padding: 20pt;}
76  .note{margin-top: 30pt; margin-bottom: 30pt; text-align: left; background-color: #FFEFEF; border: double 3px; border-color: #FFD5D5;}  .note{margin-top: 30pt; margin-bottom: 30pt; text-align: left; background-color: #FFEFEF; border: double 3px; border-color: #FFD5D5;}
77  .otherpage{border: solid 1px darkgoldenrod; padding: 20pt; background-color: lemonchiffon;}  .otherpage{border: solid 1px darkgoldenrod; padding: 20pt; background-color: lemonchiffon;}
78    .docline-top {color: #990000 ; font-weight: bold; display:block;}
79    .docline-top a{color: #990000; font-weight: bold;}
80    .docline-bottom {color: #990000 ; font-weight: bold; display:block;}
81    .docline-bottom a{color: #990000; font-weight: bold;}
82    
83    @media print {
84    .docline-top {display: none;}
85    .docline-bottom {display: none;}
86    }
87  </style>  </style>
88  <META NAME="Keywords" CONTENT="multiboot Multi Boot bootable cd rescue clonezilla sysresccd">  <META NAME="Keywords" CONTENT="multiboot Multi Boot bootable cd rescue clonezilla sysresccd">
89  </head>  </head>
# Line 75  hr{color: Black; background-color: Black Line 91  hr{color: Black; background-color: Black
91  <?php  <?php
92    
93    
94  // // // Remove [^] links  // Remove [^] links
95  $eReg="#\[<a href=[^>]*>\^</a>\]#i";  $eReg="#\[<a href=[^>]*>\^</a>\]#i";
96  $file = preg_replace($eReg,"",$file);  $file = preg_replace($eReg,"",$file);
97    
# Line 100  $eReg = "#<div id=\"menu\">.*</div>#is"; Line 116  $eReg = "#<div id=\"menu\">.*</div>#is";
116  $file = preg_replace($eReg,"",$file);  $file = preg_replace($eReg,"",$file);
117  $eReg = "#<div id=\"footer\">.*</div>#is";  $eReg = "#<div id=\"footer\">.*</div>#is";
118  $file = preg_replace($eReg,"",$file);  $file = preg_replace($eReg,"",$file);
119  //  
120  $eReg = "#</H2>[^<]*<H3>#";  $eReg = "#</H2>[^<]*<H3>#";
121  $file = preg_replace($eReg,"<br>",$file);  $file = preg_replace($eReg,"<br>",$file);
122  //  
123  $eReg = "#<H2 style=\"margin-top: 0;\">#";  $eReg = "#<H2 style=\"margin-top: 0;\">#";
124  $file = preg_replace($eReg,"<H2 style=\"margin-top: 4em;\">",$file);  $file = preg_replace($eReg,"<H2 style=\"margin-top: 4em;\">",$file);
125  //  
126  //  
127  $file = str_replace("position: absolute; left: 0px;","position: absolute; left: 40pt;",$file);  $file = str_replace("position: absolute; left: 0px;","position: absolute; left: 40pt;",$file);
128  $file = str_replace("position: absolute; right: 0px;","position: absolute; right: 40pt;",$file);  $file = str_replace("position: absolute; right: 0px;","position: absolute; right: 40pt;",$file);
129    
130  $eReg = "#<H2>Clonezilla-SysRescCD<br>(.*)</H3>#i";  $eReg = "#<H2>Clonezilla-SysRescCD<br>(.*)</H3>#i";
131  $file = preg_replace($eReg,"<H1>Clonezilla-SysRescCD<br>$1</H1>",$file);  $file = preg_replace($eReg,"<H1>Clonezilla-SysRescCD<br>$1</H1>",$file);
132    
133    
134    // Place top navigation
135    if(! empty($topNav)){
136      $eReg = "#<div id=\"contarea\">#";
137      $file = preg_replace($eReg, $topNav."\n<div id=\"contarea\">", $file);
138    }
139    $file = preg_replace( "#id=\"docline-top\"#" , "align=\"center\" class=\"docline-top\"" , $file );
140    
141    // Place bottom navigation
142    if(! empty($bottomNav)){
143      $eReg = "#</body>#i";
144      $file = preg_replace($eReg, $bottomNav."\n</body>", $file);
145    }
146    $file = preg_replace( "#id=\"docline-bottom\"#" , "align=\"center\" class=\"docline-bottom\"" , $file );
147    
148    // Remove extra tags
149    $file = preg_replace( "#<div id=\"contarea\">#" , "" , $file );
150    $file = preg_replace( "#<div id=\"content\">#" , "" , $file );
151    
152    
153    $file = preg_replace( "#href=\"\"#i" , "href=\"printable.php?index.html\"" , $file );
154    
155    // Convert href="XXX.html#YYY" to href="printable.php?XXX.html#YYY"
156    $eReg = "@href=\"([^hf][^t][^t]?[^p][^s]?[^\"]*)\"@i";
157    //$eReg = "@href=\"([:alpha:]]\.html#?[^\"]*\")@i";
158    $file = preg_replace( $eReg, "href=\"printable.php?$1\"" , $file );
159    
160    // Convert href="#YYY" to href="printable.php?XXX.html#YYY"
161    // Because of previous conversion, the link is now:
162    //    href="printable.php?#YYY"
163    $eReg = "@href=\"printable.php\?(#[^\"]*)\"@i";
164    $file = preg_replace( $eReg, "href=\"printable.php?".$pageUrlName."$1\"" , $file );
165    
166  echo $file;  echo $file;
167    
168  // echo "</div>  // echo "</div>
169  // ";  // ";
170    

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

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26