1 |
<!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 |
|
9 |
function convertPage($value,$key,$tPath,$Hcount){ |
10 |
global $queryString; |
11 |
// remove " |
12 |
$myLink=str_replace("\"","",$value); |
13 |
// remove >.* |
14 |
$eReg=">.*"; |
15 |
$myLink=ereg_replace($eReg,"",$myLink); |
16 |
// |
17 |
// |
18 |
// |
19 |
// open file |
20 |
$file=""; |
21 |
$myLink=$tPath . $myLink; |
22 |
$file = file_get_contents ($myLink); |
23 |
|
24 |
// remove html start/end |
25 |
$eReg=".*<body[^>]*>"; |
26 |
$file = ereg_replace($eReg,"",$file); |
27 |
$eReg="<.body>.*"; |
28 |
$file = ereg_replace($eReg,"",$file); |
29 |
|
30 |
$eReg= "<" . "!" . "--site-only--" . ">" . ".*" . "<hr style=\"margin: 0;\"><". "!" . "--end-site-only--" . ">"; |
31 |
$file = ereg_replace($eReg,"",$file); |
32 |
$eReg= "<" . "!" . "--site-only--" . ">" . ".*" . "<". "!" . "--end-site-only--" . ">"; |
33 |
$file = ereg_replace($eReg,"", $file); |
34 |
|
35 |
|
36 |
// Fix go to top... |
37 |
$file=str_replace("go to top of the page","go to the begining of the section",$file); |
38 |
$file=str_replace("μετάβαση στην αρχή της σελίδας","μετάβαση στην αρχή της ενότητας",$file); |
39 |
|
40 |
|
41 |
// Fix H1 header |
42 |
//<H1> Clonezilla-SysRescCD<br>Starting page<br>03/11/2007 - v 1.3.0</H1> |
43 |
$eReg="<H1>[^<]*<br>"; |
44 |
if($Hcount == 0){ |
45 |
$file = ereg_replace($eReg,"<H1>",$file); |
46 |
|
47 |
// remove this if first page is not the index |
48 |
$eReg="<H1>[^<]*</H1>"; |
49 |
$file = ereg_replace($eReg,"",$file); |
50 |
|
51 |
}else |
52 |
$file = ereg_replace($eReg,"<H1><br>",$file); |
53 |
$eReg="<br>[^<]*</H1>"; |
54 |
if($queryString == "el") |
55 |
$rReg=" [<a href=\"#onepage-top\" title=\"μετάβαση στην αρχή της σελίδας\">^^</a>]</H1>"; |
56 |
else |
57 |
$rReg=" [<a href=\"#onepage-top\" title=\"go to top of the page\">^^</a>]</H1>"; |
58 |
$file = ereg_replace($eReg,$rReg,$file); |
59 |
|
60 |
|
61 |
return $file; |
62 |
} |
63 |
|
64 |
|
65 |
// |
66 |
// |
67 |
// Starting here |
68 |
// |
69 |
// |
70 |
error_reporting(E_ALL); |
71 |
ini_set('display_errors', '1'); |
72 |
|
73 |
// $theFilePath="/home/projects/clonezilla-sysresccd/public_html/test/"; |
74 |
$theFilePath=""; |
75 |
$siteURL="http://clonezilla-sysresccd.hellug.gr/new-site/"; |
76 |
|
77 |
$queryString = $_SERVER['QUERY_STRING']; |
78 |
$theFileName="index.html"; |
79 |
|
80 |
$file = file_get_contents ($theFileName); |
81 |
|
82 |
$eReg="<title>[^<]*</title>"; |
83 |
// $reg=array("0","0","0"); |
84 |
$reg=array(); |
85 |
ereg($eReg,$file,$reg); |
86 |
//echo "$reg[0]"; |
87 |
|
88 |
$eReg="Copyright: .*@.*gr></a>"; |
89 |
if(ereg($eReg,$file,$reg)){ |
90 |
$copr="$reg[0]"; |
91 |
}else{ |
92 |
$eReg="Πνευματικά δικαιώματα: .*@.*gr></a>"; |
93 |
ereg($eReg,$file,$reg); |
94 |
$copr="$reg[0]"; |
95 |
} |
96 |
$eReg="<font size=\"-1\">[^<]*: [0-9][0-9]/[0-9][0-9]/[0-9][0-9][0-9][0-9]</font>"; |
97 |
ereg($eReg,$file,$reg); |
98 |
$upd="$reg[0]"; |
99 |
|
100 |
|
101 |
|
102 |
|
103 |
$style = <<<END |
104 |
<style type="text/css"> |
105 |
body { background : url(null) fixed no-repeat; background-color: White; } |
106 |
H1,H2,H3{color: #990000; text-align: left;} |
107 |
H2{margin-top: 2em;} |
108 |
H3{margin-top: 1.5em} |
109 |
li{margin-top: 1em;} |
110 |
a{text-decoration: none;} |
111 |
a:hover{text-decoration: underline;} |
112 |
p,td,table,tr,li{margin-left: 15pt;} |
113 |
.nav{margin-left: 0pt;} |
114 |
.newcode{font-family : "Courier New", Courier, monospace, sans-serif, serif; font-weight: bold; background-color: #F2F2F2; border: solid 1px #DEDEDE;padding: 20pt;} |
115 |
.note{margin-top: 30pt; margin-bottom: 30pt; text-align: center; background-color: #FFEFEF; border: solid 1px; border-color: #FFD5D5;} |
116 |
hr{color: Black; background-color: Black; height: 1px; border: none;} |
117 |
</style> |
118 |
<META NAME="Keywords" CONTENT="multiboot Multi Boot bootable cd rescue clonezilla sysresccd"> |
119 |
</head> |
120 |
<body style="margin-left: 40pt; margin-right: 40pt;"> |
121 |
<a name="onepage-top"></a> |
122 |
END; |
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
$eReg=".*<body[^>]*>"; |
129 |
$file = ereg_replace($eReg,"",$file); |
130 |
$eReg="<.body>.*"; |
131 |
$file = ereg_replace($eReg,"",$file); |
132 |
|
133 |
// find starting headers |
134 |
$eReg=".*<hr style=\"margin: 0;\"><!--end-site-only-->"; |
135 |
ereg($eReg,$file,$reg); |
136 |
$startPart=str_replace("index.html","onepage.php","$reg[0]"); |
137 |
$startPart=str_replace("el-onepage.php","onepage.php?el","$startPart"); |
138 |
$startPart=str_replace("<a name=\"project-top\"></a>","",$startPart); |
139 |
// remove "One page link" |
140 |
$eReg="<font size=\"-1\"><a href=\"onepage.php[^>]*>[^<]*</a>"; |
141 |
$startPart = ereg_replace($eReg,"<font size=\"-1\">",$startPart); |
142 |
$eReg="</H1>"; |
143 |
$startPart = ereg_replace($eReg,"<!--copyright data only here--></H1>",$startPart); |
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 |
// $file = ereg_replace($eReg,"",$file); |
150 |
|
151 |
// find ending headers |
152 |
$eReg="<!--site-only--><hr style=\"margin: 0;\">.*"; |
153 |
ereg($eReg,$file,$reg); |
154 |
$endPart=str_replace("index.html","onepage.php","$reg[0]"); |
155 |
$endPart=str_replace("el-onepage.php","onepage.php?el","$endPart"); |
156 |
$file = ereg_replace($eReg,"",$file); |
157 |
|
158 |
// $eReg="\n<a href=[^<]*<\/a>"; |
159 |
// $count=ereg($eReg,$file,$reg); |
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
$Hcount=0; |
166 |
$file=convertPage($theFileName,0,$theFilePath,0); |
167 |
$eReg="<a href=\"[^#<]*#"; |
168 |
$file = ereg_replace($eReg,"<a href=\"#",$file); |
169 |
$indexPart=str_replace("<a name=\"project-top\"></a>","",$file); |
170 |
$Hcount++; |
171 |
|
172 |
// $links has raw links |
173 |
$links = array(); |
174 |
$links =NULL; |
175 |
$links=explode("<a href=",$file); |
176 |
|
177 |
$contents=""; |
178 |
$regIn=array(); |
179 |
foreach ( $links as $key => $value){ |
180 |
$isValid=0; |
181 |
// If it has a #, throw it away |
182 |
$pos = strpos($value, "#"); |
183 |
if($pos === false){ |
184 |
$pos = strpos($value, ".html"); |
185 |
if($pos === false){ |
186 |
$pos = strpos($value, ".php"); |
187 |
if($pos === false) |
188 |
echo "\n"; |
189 |
else{ |
190 |
// It is php file |
191 |
$isValid=1; |
192 |
$tPath=$siteURL; |
193 |
} |
194 |
}else{ |
195 |
// it is html file |
196 |
$isValid=1; |
197 |
$tPath=$theFilePath; |
198 |
} |
199 |
// Get filename from link link |
200 |
if($isValid==1){ |
201 |
$file=convertPage($value,$key,$tPath,$Hcount); |
202 |
$contents = $contents . $file; |
203 |
// echo "$file"; |
204 |
// echo "\n"; |
205 |
|
206 |
// fix links |
207 |
$eReg="<a name=\"[^>]*-top\">"; |
208 |
if((ereg($eReg,$file,$regIn)) != 0){ |
209 |
// // // ereg($eReg,$file,$regIn); |
210 |
$regIn[0]=str_replace("name=\"","href=\"#",$regIn[0]); |
211 |
$eReg="href\"#*"; |
212 |
$regIn[0]=ereg_replace($eReg,"href\"#",$regIn[0]); |
213 |
// echo "<p>regIn[0] = $regIn[0]</p>"; |
214 |
// echo "\n"; |
215 |
|
216 |
|
217 |
|
218 |
// echo "<p>value = $value</p>"; |
219 |
// echo "\n"; |
220 |
|
221 |
$eReg=">.*"; |
222 |
$eReg=ereg_replace($eReg,"",$value); |
223 |
$eReg="<a href=" . $eReg . ">"; |
224 |
|
225 |
// echo "<p>eReg = $eReg</p>"; |
226 |
|
227 |
$indexPart = ereg_replace($eReg,$regIn[0],$indexPart); |
228 |
|
229 |
// echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; |
230 |
|
231 |
} |
232 |
|
233 |
$Hcount++; |
234 |
} |
235 |
} |
236 |
} |
237 |
// echo everything |
238 |
echo $style; |
239 |
echo "\n"; |
240 |
echo "$startPart"; |
241 |
echo "\n"; |
242 |
echo "$indexPart"; |
243 |
echo "\n"; |
244 |
echo "$contents"; |
245 |
echo "\n"; |
246 |
echo "\n<p></p>\n"; |
247 |
echo "$endPart"; |
248 |
?> |
249 |
</body> |
250 |
</html> |