mirror of
https://github.com/kleeja-official/kleeja.git
synced 2026-05-06 23:46:02 +02:00
Revert "Version 3.1.7"
This commit is contained in:
@@ -42,13 +42,20 @@ class cache
|
||||
include PATH . 'cache/' . $name . '.php';
|
||||
return empty($data) ? false : $data;
|
||||
}
|
||||
return false;
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function exists($name): bool
|
||||
public function exists($name)
|
||||
{
|
||||
$name = preg_replace('![^a-z0-9_]!', '_', $name);
|
||||
return file_exists(PATH . 'cache/' . $name . '.php');
|
||||
|
||||
if (file_exists(PATH . 'cache/' . $name . '.php'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public function save($name, $data, $time = 86400)
|
||||
@@ -57,23 +64,17 @@ class cache
|
||||
$data_for_save = '<?' . 'php' . "\n";
|
||||
$data_for_save .= '//Cache file, generated for Kleeja at ' . gmdate('d-m-Y h:i A') . "\n\n";
|
||||
$data_for_save .= '//No direct opening' . "\n";
|
||||
$data_for_save .= '(!defined("IN_COMMON") ? exit("hacking attempt!") : null);' . "\n\n";
|
||||
$data_for_save .= '(!defined("IN_COMMON") ? exit("hacking attemp!") : null);' . "\n\n";
|
||||
$data_for_save .= '//return false after x time' . "\n";
|
||||
$data_for_save .= 'if(time() > ' . (time() + $time) . ') return false;' . "\n\n";
|
||||
$data_for_save .= '$data = ' . var_export($data, true) . ";\n\n//end of cache";
|
||||
|
||||
try
|
||||
if ($fd = @fopen(PATH . 'cache/' . $name . '.php', 'w'))
|
||||
{
|
||||
$fd = fopen(PATH . 'cache/' . $name . '.php', 'w');
|
||||
flock($fd, LOCK_EX); // exclusive look
|
||||
fwrite($fd, $data_for_save);
|
||||
flock($fd, LOCK_UN);
|
||||
fclose($fd);
|
||||
return true;
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
return false;
|
||||
@flock($fd, LOCK_EX); // exlusive look
|
||||
@fwrite($fd, $data_for_save);
|
||||
@flock($fd, LOCK_UN);
|
||||
@fclose($fd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +113,7 @@ if (! ($config = $cache->get('data_config')))
|
||||
is_array($plugin_run_result = Plugins::getInstance()->run('qr_select_config_cache', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook
|
||||
|
||||
$result = $SQL->build($query);
|
||||
$config = [];
|
||||
|
||||
while ($row=$SQL->fetch_array($result))
|
||||
{
|
||||
$config[$row['name']] = $row['value'];
|
||||
@@ -129,8 +130,6 @@ if (! ($config = $cache->get('data_config')))
|
||||
|
||||
if (! ($olang = $cache->get('data_lang' . $config['language'])))
|
||||
{
|
||||
$olang = [];
|
||||
|
||||
$query = [
|
||||
'SELECT' => 'l.word, l.trans',
|
||||
'FROM' => "{$dbprefix}lang l",
|
||||
|
||||
Reference in New Issue
Block a user