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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 131 - (hide annotations)
Mon Sep 20 18:49:07 2010 UTC (10 years, 10 months ago) by sng
File size: 4514 byte(s)
adding support for ...php?xxx.html URLs

1 sng 28 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2     <html>
3     <head>
4     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5     <link rel="alternate" type="application/rss+xml" title="RSS" href="http://clonezilla-sysresccd.hellug.gr/clonezilla-sysresccd.rss">
6     <link rel="shortcut icon" href="favicon.ico">
7     <?php
8     error_reporting(E_ALL);
9 sng 130 // error_reporting(E_ERROR);
10 sng 28 ini_set('display_errors', '1');
11    
12 sng 131 $curPage = basename( $_SERVER["REQUEST_URI"] );
13     // echo "pageURL = $curPage<br><br><br>";
14     if (substr($curPage,0,14) == "printable.php?" ) {
15     //
16     // This means we have a printable.php?xxx.html URL
17     // let's get the xxx.html part
18     //
19     $pageUrlName = substr( $curPage,14,strlen($curPage) );
20     // echo "pageUrlName = $pageUrlName<br><br><br>";
21     } else {
22     //
23     // 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']);
32     }
33 sng 130 $thePage = getcwd() . '/' . $pageUrlName;
34     // echo "thePage = $thePage<br><br><br>";
35 sng 28
36 sng 130 // Read the file into $file
37 sng 28 $file = file_get_contents ($thePage);
38    
39    
40 sng 130 // Remove text starting from line 1 to
41     // line containing <body> tag
42     $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 sng 28
49 sng 130
50 sng 28 ?>
51 sng 130 <style type="text/css">
52 sng 126 body { background : fixed no-repeat; background-color: White; }
53 sng 28 H1,H2,H3{color: #990000; text-align: left;}
54     H1{margin-top: 4em; margin-bottom: 2em;}
55     H2{margin-top: 2em;}
56     H3{margin-top: 1.5em}
57     li{margin-top: 1em;}
58     :link { color: #0000C0; text-decoration: none; }
59     :visited { color: #0000C0; text-decoration: none; }
60     a:hover { color: #0000C0; text-decoration: underline; }
61 sng 130 img { display: block; margin:0 auto; }
62 sng 28 /*p,td,table,tr,li{margin-left: 15pt;}*/
63     .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;}
65     .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;}
67     #header {color: #990000; }
68 sng 130 .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 sng 28 </style>
72     <META NAME="Keywords" CONTENT="multiboot Multi Boot bootable cd rescue clonezilla sysresccd">
73     </head>
74 sng 130 <body style="margin: 40pt;">
75 sng 28 <?php
76    
77    
78 sng 130 // // // Remove [^] links
79     $eReg="#\[<a href=[^>]*>\^</a>\]#i";
80     $file = preg_replace($eReg,"",$file);
81 sng 28
82 sng 130 $eReg = "#<div id=.rss.>.*<!-- docline-top-->#i";
83     $file = preg_replace($eReg,"<!-- docline-top-->",$file);
84 sng 28
85 sng 130 $eReg = "{<div id=.lphp.*<H2>Clonezilla-SysRescCD</H2>}";
86     preg_replace($eReg,"<H2>Clonezilla-SysRescCD</H2>",$file);
87 sng 28
88    
89 sng 130 // Remove RSS
90     $eReg="#<div id=\"lphp\" style=.*</div>#";
91     $file=preg_replace($eReg,"",$file);
92 sng 28
93 sng 130 // 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 sng 28
97    
98 sng 130 // 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 sng 28 $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);
113    
114 sng 130 $eReg = "#<H2>Clonezilla-SysRescCD<br>(.*)</H3>#i";
115     $file = preg_replace($eReg,"<H1>Clonezilla-SysRescCD<br>$1</H1>",$file);
116 sng 28
117     echo $file;
118 sng 130 // echo "</div>
119     // ";
120 sng 28
121     ?>
122     </body>
123     </html>

Properties

Name Value
svn:executable *

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26