1
0
mirror of https://github.com/GOSTSec/gostcoin.i2p synced 2025-03-13 05:41:09 +00:00
gostco.in/class/pages.php
Warlock-Dalbaeb b3609dcc4a Multilagual PHP version
by Plaz
2017-05-28 14:16:31 +03:00

56 lines
1.3 KiB
PHP

<?php
class pages extends language
{
public function create_cache($namepage,$content)
{
$page = fopen(CACHE."/".$this->lang."_".$namepage.".php","wb");
if(!fwrite($page,$content)) return die("Permission denied");
fclose($page);
}
public function __construct()
{
$this->lang=$this->getLang();
}
public function ParseTemplate($what)
{
$langArray = $this->LanguageConstantGet($this->lang);
$keys = array_keys($langArray);
foreach ($keys as &$tmp)
$tmp = "{".$tmp."}";
unset($tmp);
$what = str_replace($keys, array_values($langArray), $what );
return $what;
}
public function GetPage($namepage)
{
if(file_exists(CACHE."/".$this->lang."_".$namepage.".php"))
{
$namefile = CACHE."/".$this->lang."_".$namepage.".php";
include($namefile);
if(LIFECACHE != 0)
if(filemtime($namefile) >= (filemtime($namefile)+LIFECACHE) )
{
if(!unlink($namefile))
die( "Permission denied" );
}
return 1;
}// IF CACHE
if(! file_exists(PAGES."/".$namepage.".tlp") ) return header("Location: .");
$page = fopen(PAGES."/".$namepage.".tlp","rb");
///////////
$content = $this->ReadSomeFile($page);
$content = $this->ParseTemplate($content);
/////////
$this->create_cache($namepage,$content);
$this->GetPage($namepage);
}
public function __destruct() {
clearstatcache();
}
}
?>