/[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 28 by sng, Wed Mar 17 23:46:34 2010 UTC revision 131 by sng, Mon Sep 20 18:49:07 2010 UTC
# Line 6  Line 6 
6  <link rel="shortcut icon" href="favicon.ico">  <link rel="shortcut icon" href="favicon.ico">
7  <?php  <?php
8  error_reporting(E_ALL);  error_reporting(E_ALL);
9    // error_reporting(E_ERROR);
10  ini_set('display_errors', '1');  ini_set('display_errors', '1');
11    
12  $pageUrlName=basename ($_SERVER['HTTP_REFERER']);  $curPage = basename( $_SERVER["REQUEST_URI"] );
13  if ( $pageUrlName == 'clonezilla-sysresccd.hellug.gr' OR $pageUrlName == "localhost" OR $pageUrlName == "demo") $pageUrlName='index.html';  // echo "pageURL = $curPage<br><br><br>";
14    if (substr($curPage,0,14) == "printable.php?" ) {
15  $eReg="#.*";    //
16  $onlyURL=ereg_replace($eReg,"",$pageUrlName);    // This means we have a printable.php?xxx.html URL
17      // let's get the xxx.html part
18  // echo "pageUrlName = $pageUrlName";    //
19  if (substr($onlyURL,strlen($pageUrlName)-3,3) == "php" OR substr($onlyURL,strlen($pageUrlName)-6,6) == "php?el")    $pageUrlName = substr( $curPage,14,strlen($curPage) );
20    $thePage = "http://clonezilla-sysresccd.hellug.gr/" . $pageUrlName;    // echo "pageUrlName = $pageUrlName<br><br><br>";
21  //   $thePage = "http://localhost/" . $pageUrlName;  } else {
22  else {    //
23    //echo "Basename = $pageUrlName\n";    // trunk or demo are the local folders used to develop
24      // this file at my own private apache server
25      //
26      $pageUrlName=basename ($_SERVER['HTTP_REFERER']);
27      if ( $pageUrlName == 'clonezilla-sysresccd.hellug.gr' OR $pageUrlName == "localhost" OR $pageUrlName == "demo" OR $pageUrlName == "trunk" ) $pageUrlName='index.html';
28      $eReg="{#.*}";
29      $onlyURL=preg_replace($eReg,"",$pageUrlName);
30      // echo "pageUrlName = $pageUrlName<br><br><br>";
31    $thePage = getcwd() . '/' . basename ($_SERVER['HTTP_REFERER']);    $thePage = getcwd() . '/' . basename ($_SERVER['HTTP_REFERER']);
   $thePage = getcwd() . '/' . $pageUrlName;  
32  }  }
33    $thePage = getcwd() . '/' . $pageUrlName;
34    // echo "thePage = $thePage<br><br><br>";
35    
36  // echo "$thePage";  // Read the file into $file
37  $file = file_get_contents ($thePage);  $file = file_get_contents ($thePage);
38    
39  $eReg="<title>[^<]*</title>";  
40  $reg=array("0","0","0");  // Remove text starting from line 1 to
41  ereg($eReg,$file,$reg);  //   line containing <body> tag
42  // echo "$reg[0]";  $eReg="#<html.*</head>#is";
43    $file = preg_replace($eReg,"",$file);
44    $eReg = "#<!DOCTYPE HTML PUBLIC.*#i";
45    $file = preg_replace($eReg,"",$file);
46    $eReg = "#<body.*#i";
47    $file = preg_replace($eReg,"",$file);
48    
49    
 // // Find copyright and last update  
 $eReg="Copyright: .*@.*gr&gt;</a>";  
 if(ereg($eReg,$file,$reg)){  
   $copr="$reg[0]";  
 }else{  
   $eReg="Πνευματικά δικαιώματα: .*@.*gr&gt;</a>";  
   ereg($eReg,$file,$reg);  
   $copr="$reg[0]";  
 }  
 $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]";  
50  ?>  ?>
51      <style type="text/css">  <style type="text/css">
52  body { background : url(null) fixed no-repeat; background-color: White; }  body { background : fixed no-repeat; background-color: White; }
53  H1,H2,H3{color: #990000; text-align: left;}  H1,H2,H3{color: #990000; text-align: left;}
54  H1{margin-top: 4em; margin-bottom: 2em;}  H1{margin-top: 4em; margin-bottom: 2em;}
55  H2{margin-top: 2em;}  H2{margin-top: 2em;}
# Line 56  li{margin-top: 1em;} Line 58  li{margin-top: 1em;}
58  :link    { color: #0000C0; text-decoration: none; }  :link    { color: #0000C0; text-decoration: none; }
59  :visited { color: #0000C0; text-decoration: none; }  :visited { color: #0000C0; text-decoration: none; }
60  a:hover   { color: #0000C0; text-decoration: underline; }  a:hover   { color: #0000C0; text-decoration: underline; }
61    img { display: block; margin:0 auto; }
62  /*p,td,table,tr,li{margin-left: 15pt;}*/  /*p,td,table,tr,li{margin-left: 15pt;}*/
63  .nav{margin-left: 0pt;}  .nav{margin-left: 0pt;}
64  .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;}
65  .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;}
66  hr{color: Black; background-color: Black; height: 1px; border: none;}  hr{color: Black; background-color: Black; height: 1px; border: none;}
67  #header {color: #990000; }  #header {color: #990000; }
68    .newcode{font-family : "Courier New", Courier, monospace; font-weight: bold; background-color: #F2F2F2; border: solid 1px #DEDEDE;padding: 20pt;}
69    .note{margin-top: 30pt; margin-bottom: 30pt; text-align: left; background-color: #FFEFEF; border: double 3px; border-color: #FFD5D5;}
70    .otherpage{border: solid 1px darkgoldenrod; padding: 20pt; background-color: lemonchiffon;}
71  </style>  </style>
72  <META NAME="Keywords" CONTENT="multiboot Multi Boot bootable cd rescue clonezilla sysresccd">  <META NAME="Keywords" CONTENT="multiboot Multi Boot bootable cd rescue clonezilla sysresccd">
73  </head>  </head>
74  <body style="margin-left: 40pt; margin-right: 40pt;">  <body style="margin: 40pt;">
75  <?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);  
   
   
 $eReg = "<div id=.linkline.>.*<div id=.contarea.>";  
 $file = ereg_replace($eReg,"<div id=\"contarea\">",$file);  
   
   
 $eReg = "<div id=.lphp.*<H2>Clonezilla-SysRescCD</H2>";  
 $file = ereg_replace($eReg,"<H2>Clonezilla-SysRescCD</H2>",$file);  
   
   
 $eReg = "<div id=.menu.>.*</div>";  
 $file = ereg_replace($eReg,"",$file);  
   
 $eReg = "</H2>[^<]*<H3>";  
 $file = ereg_replace($eReg,"<br>",$file);  
   
 $eReg = "<H2 style=.margin-top: 0;.>";  
 $file = ereg_replace($eReg,"<H2 style=\"margin-top: 4em;\">",$file);  
76    
77    
78    // // // Remove [^] links
79    $eReg="#\[<a href=[^>]*>\^</a>\]#i";
80    $file = preg_replace($eReg,"",$file);
81    
82    $eReg = "#<div id=.rss.>.*<!-- docline-top-->#i";
83    $file = preg_replace($eReg,"<!-- docline-top-->",$file);
84    
85    $eReg = "{<div id=.lphp.*<H2>Clonezilla-SysRescCD</H2>}";
86    preg_replace($eReg,"<H2>Clonezilla-SysRescCD</H2>",$file);
87    
88    
89    // Remove RSS
90    $eReg="#<div id=\"lphp\" style=.*</div>#";
91    $file=preg_replace($eReg,"",$file);
92    
93    // Remove link line
94    $eReg="#<div id=\"linkline\">.*<div id=\"contarea\">#is";
95    $file=preg_replace($eReg,"<!-- docline-top-->\n<div id=\"contarea\">",$file);
96    
97    
98    // Remove footer
99    $eReg = "#<div id=\"menu\">.*</div>#is";
100    $file = preg_replace($eReg,"",$file);
101    $eReg = "#<div id=\"footer\">.*</div>#is";
102    $file = preg_replace($eReg,"",$file);
103    //
104    $eReg = "#</H2>[^<]*<H3>#";
105    $file = preg_replace($eReg,"<br>",$file);
106    //
107    $eReg = "#<H2 style=\"margin-top: 0;\">#";
108    $file = preg_replace($eReg,"<H2 style=\"margin-top: 4em;\">",$file);
109    //
110    //
111  $file = str_replace("position: absolute; left: 0px;","position: absolute; left: 40pt;",$file);  $file = str_replace("position: absolute; left: 0px;","position: absolute; left: 40pt;",$file);
112  $file = str_replace("position: absolute; right: 0px;","position: absolute; right: 40pt;",$file);  $file = str_replace("position: absolute; right: 0px;","position: absolute; right: 40pt;",$file);
 //position: absolute; right: 0px;  
   
   
 $eReg = "</H4></div>.*<div style=.position: absolute; right: 40pt;.><H4>";  
 $file = ereg_replace($eReg,"<br>",$file);  
   
   
 $eReg = "<div id=.footer.>.*</div>";  
 $file = ereg_replace($eReg,"",$file);  
113    
114    $eReg = "#<H2>Clonezilla-SysRescCD<br>(.*)</H3>#i";
115    $file = preg_replace($eReg,"<H1>Clonezilla-SysRescCD<br>$1</H1>",$file);
116    
117  echo $file;  echo $file;
118  echo "</div>  // echo "</div>
119  ";  // ";
120    
121  ?>  ?>
122  </body>  </body>

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

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26