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/"; |
76 |
|
77 |
$queryString = $_SERVER['QUERY_STRING']; |
78 |
if($queryString == "el") |
79 |
$theFileName="el-index.html"; |
80 |
else |
81 |
$theFileName="index.html"; |
82 |
|
83 |
$file = file_get_contents ($theFileName); |
84 |
|
85 |
$eReg="<title>[^<]*</title>"; |
86 |
// $reg=array("0","0","0"); |
87 |
$reg=array(); |
88 |
ereg($eReg,$file,$reg); |
89 |
//echo "$reg[0]"; |
90 |
|
91 |
$eReg="Copyright: .*@.*gr></a>"; |
92 |
if(ereg($eReg,$file,$reg)){ |
93 |
$copr="$reg[0]"; |
94 |
}else{ |
95 |
$eReg="Πνευματικά δικαιώματα: .*@.*gr></a>"; |
96 |
ereg($eReg,$file,$reg); |
97 |
$copr="$reg[0]"; |
98 |
} |
99 |
$eReg="<font size=\"-1\">[^<]*: [0-9][0-9]/[0-9][0-9]/[0-9][0-9][0-9][0-9]</font>"; |
100 |
ereg($eReg,$file,$reg); |
101 |
$upd="$reg[0]"; |
102 |
|
103 |
|
104 |
|
105 |
|
106 |
$style = <<<END |
107 |
<style type="text/css"> |
108 |
body { background : url(null) fixed no-repeat; background-color: White; } |
109 |
H1,H2,H3{color: #990000; text-align: left;} |
110 |
H2{margin-top: 2em;} |
111 |
H3{margin-top: 1.5em} |
112 |
li{margin-top: 1em;} |
113 |
a{text-decoration: none;} |
114 |
a:hover{text-decoration: underline;} |
115 |
p,td,table,tr,li{margin-left: 15pt;} |
116 |
.nav{margin-left: 0pt;} |
117 |
.newcode{font-family : "Courier New", Courier, monospace, sans-serif, serif; font-weight: bold; background-color: #F2F2F2; border: solid 1px #DEDEDE;padding: 20pt;} |
118 |
.note{margin-top: 30pt; margin-bottom: 30pt; text-align: center; background-color: #FFEFEF; border: solid 1px; border-color: #FFD5D5;} |
119 |
hr{color: Black; background-color: Black; height: 1px; border: none;} |
120 |
</style> |
121 |
<META NAME="Keywords" CONTENT="multiboot Multi Boot bootable cd rescue clonezilla sysresccd"> |
122 |
</head> |
123 |
<body style="margin-left: 40pt; margin-right: 40pt;"> |
124 |
<a name="onepage-top"></a> |
125 |
END; |
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
$eReg=".*<body[^>]*>"; |
132 |
$file = ereg_replace($eReg,"",$file); |
133 |
$eReg="<.body>.*"; |
134 |
$file = ereg_replace($eReg,"",$file); |
135 |
|
136 |
// find starting headers |
137 |
$eReg=".*<hr style=\"margin: 0;\"><!--end-site-only-->"; |
138 |
ereg($eReg,$file,$reg); |
139 |
$startPart=str_replace("index.html","onepage.php","$reg[0]"); |
140 |
$startPart=str_replace("el-onepage.php","onepage.php?el","$startPart"); |
141 |
$startPart=str_replace("<a name=\"project-top\"></a>","",$startPart); |
142 |
// remove "One page link" |
143 |
$eReg="<font size=\"-1\"><a href=\"onepage.php[^>]*>[^<]*</a>"; |
144 |
$startPart = ereg_replace($eReg,"<font size=\"-1\">",$startPart); |
145 |
$eReg="</H1>"; |
146 |
$startPart = ereg_replace($eReg,"<!--copyright data only here--></H1>",$startPart); |
147 |
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
// $file = ereg_replace($eReg,"",$file); |
153 |
|
154 |
// find ending headers |
155 |
$eReg="<!--site-only--><hr style=\"margin: 0;\">.*"; |
156 |
ereg($eReg,$file,$reg); |
157 |
$endPart=str_replace("index.html","onepage.php","$reg[0]"); |
158 |
$file = ereg_replace($eReg,"",$file); |
159 |
|
160 |
// $eReg="\n<a href=[^<]*<\/a>"; |
161 |
// $count=ereg($eReg,$file,$reg); |
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
$Hcount=0; |
168 |
$file=convertPage($theFileName,0,$theFilePath,0); |
169 |
$eReg="<a href=\"[^#<]*#"; |
170 |
$file = ereg_replace($eReg,"<a href=\"#",$file); |
171 |
$indexPart=str_replace("<a name=\"project-top\"></a>","",$file); |
172 |
$Hcount++; |
173 |
|
174 |
// $links has raw links |
175 |
$links = array(); |
176 |
$links =NULL; |
177 |
$links=explode("<a href=",$file); |
178 |
|
179 |
$contents=""; |
180 |
$regIn=array(); |
181 |
foreach ( $links as $key => $value){ |
182 |
$isValid=0; |
183 |
// If it has a #, throw it away |
184 |
$pos = strpos($value, "#"); |
185 |
if($pos === false){ |
186 |
$pos = strpos($value, ".html"); |
187 |
if($pos === false){ |
188 |
$pos = strpos($value, ".php"); |
189 |
if($pos === false) |
190 |
echo "\n"; |
191 |
else{ |
192 |
// It is php file |
193 |
$isValid=1; |
194 |
$tPath=$siteURL; |
195 |
} |
196 |
}else{ |
197 |
// it is html file |
198 |
$isValid=1; |
199 |
$tPath=$theFilePath; |
200 |
} |
201 |
// Get filename from link link |
202 |
if($isValid==1){ |
203 |
$file=convertPage($value,$key,$tPath,$Hcount); |
204 |
$contents = $contents . $file; |
205 |
// echo "$file"; |
206 |
// echo "\n"; |
207 |
|
208 |
// fix links |
209 |
$eReg="<a name=\"[^>]*-top\">"; |
210 |
if((ereg($eReg,$file,$regIn)) != 0){ |
211 |
// // // ereg($eReg,$file,$regIn); |
212 |
$regIn[0]=str_replace("name=\"","href=\"#",$regIn[0]); |
213 |
$eReg="href\"#*"; |
214 |
$regIn[0]=ereg_replace($eReg,"href\"#",$regIn[0]); |
215 |
// echo "<p>regIn[0] = $regIn[0]</p>"; |
216 |
// echo "\n"; |
217 |
|
218 |
|
219 |
|
220 |
// echo "<p>value = $value</p>"; |
221 |
// echo "\n"; |
222 |
|
223 |
$eReg=">.*"; |
224 |
$eReg=ereg_replace($eReg,"",$value); |
225 |
$eReg="<a href=" . $eReg . ">"; |
226 |
|
227 |
// echo "<p>eReg = $eReg</p>"; |
228 |
|
229 |
$indexPart = ereg_replace($eReg,$regIn[0],$indexPart); |
230 |
|
231 |
// echo "\n";echo "\n";echo "\n";echo "\n";echo "\n"; |
232 |
|
233 |
} |
234 |
|
235 |
$Hcount++; |
236 |
} |
237 |
} |
238 |
} |
239 |
// echo everything |
240 |
echo $style; |
241 |
echo "\n"; |
242 |
echo "$startPart"; |
243 |
echo "\n"; |
244 |
echo "$indexPart"; |
245 |
echo "\n"; |
246 |
echo "$contents"; |
247 |
echo "\n"; |
248 |
echo "\n<p></p>\n"; |
249 |
echo "$endPart"; |
250 |
?> |
251 |
</body> |
252 |
</html> |