Export static pages
Create a page object e. g. named statify and let a cron job call it on a regular basis. This will create a static version of your site in the folder pages. Additionally you could restrict accessing php-files to your / certain IP-ranges i. e. letting them redirect to the static version with an nginx rule.The page object statify must contain this code
×
[h:]
<?php
ignore_user_abort(true);
set_time_limit(0);
mkdir('pages');
$srcurl='[_myurl_]?c=';
foreach(glob("pages/*") as $f) {if(strpos($f,'_')>1)unlink($f);}
$sql_a="SELECT name FROM resources WHERE typ='p' AND deleted!=1 AND logins='' AND name NOT LIKE '!%' AND name NOT LIKE 'tx!%' AND name NOT LIKE 's!%' ORDER BY lastmut DESC";
$result_a=mysql_query($sql_a);
if ($result_a==false) echo 'SQL_a-Query did not work!<p>'.mysql_error().'<p><font color=red>'.$sql_a.'</font><p>';
$num_a = mysql_num_rows($result_a);
for ($i_a=0; $i_a<$num_a; $i_a++) {
$row_a = mysql_fetch_array($result_a);
$f=$row_a['name'];
echo $f.' ';
$b=array('f.php?f=', 'r/P/', '"r/', '<div id="search">','index.php','edit.php?','href="thumb.php?','&f=r/');
$a=array('../', '../r/P/', '"../r/', '<div id="search" style="visibility:hidden">','index.html','../u5admin?\',\'','data-old="','" href="../r/');
$lan1content=str_replace($b,$a,file_get_contents($srcurl.$f.'&l='.$lan1na));
$lan2content=str_replace($b,$a,file_get_contents($srcurl.$f.'&l='.$lan2na));
$lan3content=str_replace($b,$a,file_get_contents($srcurl.$f.'&l='.$lan3na));
$lan4content=str_replace($b,$a,file_get_contents($srcurl.$f.'&l='.$lan4na));
$lan5content=str_replace($b,$a,file_get_contents($srcurl.$f.'&l='.$lan5na));
file_put_contents('pages/'.$f.'_'.$lan1na.'.html',$lan1content);
file_put_contents('pages/'.$f.'_'.$lan2na.'.html',$lan2content);
file_put_contents('pages/'.$f.'_'.$lan3na.'.html',$lan3content);
file_put_contents('pages/'.$f.'_'.$lan4na.'.html',$lan4content);
file_put_contents('pages/'.$f.'_'.$lan5na.'.html',$lan5content);
}
$sql_a="SELECT name FROM resources WHERE deleted!=1 AND ishomepage=1";
$result_a=mysql_query($sql_a);
if ($result_a==false) echo 'SQL_a-Query did not work!<p>'.mysql_error().'<p><font color=red>'.$sql_a.'</font><p>';
$row_a = mysql_fetch_array($result_a);
$thehomepage=$row_a['name'];
$htmlconstruct="<!DOCTYPE html><html><head><script>if(location.href.split('&').length>1)article='&'+location.href.split('&')[location.href.split('&').length-1];else article='';if(location.href.indexOf('c=')<0)location.href='".$thehomepage."_".$lan1na.".html?&l='+(navigator.language || navigator.userLanguage).substring(0,2);if(location.href.indexOf('l=')<0)location.href=location.href+'?&l='+(navigator.language || navigator.userLanguage).substring(0,2);function getget(parameterName) { var result = null, tmp = []; location.search .substr(1) .split('&') .forEach(function (item) { tmp = item.split('='); if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]); });result=result.replace(/[^a-z0-9!]/g,''); return result;}c=getget('c');l=getget('l');la=l;if(location.href.indexOf('c=!')>0){document.cookie='tryint='+c;location.href='/pages/index.html?c=noaccess';}else {if(c=='')c='".$thehomepage."';if(l=='') {l='de';la=(navigator.language || navigator.userLanguage).substring(0,2);}if(document.referrer.indexOf('stage=r')>0)stage='&stage=r';else if(document.referrer.indexOf('stage=a')>0)stage='&stage=a';else if(document.referrer.indexOf('stage=t')>0)stage='&stage=t';else if(document.referrer.indexOf('stage=d')>0)stage='&stage=d';else stage='';location.href=c+'_'+l+'.html?&l='+la+article+stage;}</script></head><body>...</body></html>";
file_put_contents('pages/index.html',$htmlconstruct);
function copyDirectory($source, $destination) {
if (!is_dir($destination)) {
mkdir($destination, 0755, true);
}
$files = scandir($source);
foreach ($files as $file) {
if ($file !== '.' && $file !== '..') {
$sourceFile = $source . '/' . $file;
$destinationFile = $destination . '/' . $file;
if (is_dir($sourceFile)) {
copyDirectory($sourceFile, $destinationFile);
} else {
copy($sourceFile, $destinationFile);
}
}
}
}
$sourceDirectory = 'images';
$destinationDirectory = 'pages/images';
copyDirectory($sourceDirectory, $destinationDirectory);
$sourceDirectory = 'js';
$destinationDirectory = 'pages/js';
copyDirectory($sourceDirectory, $destinationDirectory);
copy('favicon.ico','pages/favicon.ico');
copy('clickycorner.gif','pages/clickycorner.gif');
copy('fallback.css','pages/fallback.css');
$u5jsad="function getget(parameterName) { var result = null, tmp = []; location.search .substr(1) .split('&') .forEach(function (item) { tmp = item.split('='); if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]); });result=result.replace(/[^a-z0-9!]/g,''); return result;}if(location.href.indexOf('&ll=1'>0)&&location.href.split('&')[2]>0&&location.href.split('&')[location.href.split('&').length-1]=='ll=1')location.href=location.href+'&'+location.href.split('&')[2];if(location.href.indexOf('&ll=1')<0) { if(location.href.indexOf('&l=rm')>0&&location.href.indexOf('_rm.html')<0)location.href=location.href.split('_')[0]+'_'+getget('l')+'.html'+location.href.split('.html')[1]+'&ll=1'; else if(location.href.indexOf('&l=it')>0&&location.href.indexOf('_it.html')<0)location.href=location.href.split('_')[0]+'_'+getget('l')+'.html'+location.href.split('.html')[1]+'&ll=1'; else if(location.href.indexOf('&l=fr')>0&&location.href.indexOf('_fr.html')<0)location.href=location.href.split('_')[0]+'_'+getget('l')+'.html'+location.href.split('.html')[1]+'&ll=1'; else if(location.href.indexOf('&l=en')>0&&location.href.indexOf('_en.html')<0)location.href=location.href.split('_')[0]+'_'+getget('l')+'.html'+location.href.split('.html')[1]+'&ll=1'; else if(location.href.indexOf('&l=de')>0&&location.href.indexOf('_de.html')<0)location.href=location.href.split('_')[0]+'_'+getget('l')+'.html'+location.href.split('.html')[1]+'&ll=1';}";
$u5jsfile=file_get_contents('pages/js/u5_scripts.js');
file_put_contents('pages/js/u5_scripts.js',$u5jsfile.$u5jsad);
?>
[:h]