mirror of
https://github.com/slawkens/myaac.git
synced 2025-05-11 16:39:21 +02:00
* optimize template load code (less file_exists checks)
This commit is contained in:
parent
e6b052f8e9
commit
45a387000d
15
index.php
15
index.php
@ -407,19 +407,7 @@ if($config['backward_support']) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$title_full = (isset($title) ? $title . $config['title_separator'] : '') . $config['lua']['serverName'];
|
$title_full = (isset($title) ? $title . $config['title_separator'] : '') . $config['lua']['serverName'];
|
||||||
if(file_exists($template_path . '/index.php'))
|
require $template_path . '/' . $template_index;
|
||||||
require $template_path . '/index.php';
|
|
||||||
else if(file_exists($template_path . '/template.php')) // deprecated
|
|
||||||
require $template_path . '/template.php';
|
|
||||||
else if($config['backward_support'] && file_exists($template_path . '/layout.php'))
|
|
||||||
{
|
|
||||||
require $template_path . '/layout.php';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// TODO: save more info to log file
|
|
||||||
die('ERROR: Cannot load template.');
|
|
||||||
}
|
|
||||||
|
|
||||||
echo base64_decode('PCEtLSBQb3dlcmVkIGJ5IE15QUFDIDo6IGh0dHBzOi8vd3d3Lm15LWFhYy5vcmcvIC0tPg==') . PHP_EOL;
|
echo base64_decode('PCEtLSBQb3dlcmVkIGJ5IE15QUFDIDo6IGh0dHBzOi8vd3d3Lm15LWFhYy5vcmcvIC0tPg==') . PHP_EOL;
|
||||||
if(superAdmin()) {
|
if(superAdmin()) {
|
||||||
@ -435,4 +423,3 @@ if(superAdmin()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$hooks->trigger(HOOK_FINISH);
|
$hooks->trigger(HOOK_FINISH);
|
||||||
?>
|
|
||||||
|
@ -33,40 +33,46 @@ if($config['template_allow_change'])
|
|||||||
}
|
}
|
||||||
$template_path = 'templates/' . $template_name;
|
$template_path = 'templates/' . $template_name;
|
||||||
|
|
||||||
if(!file_exists(BASE . $template_path . '/index.php') &&
|
if(file_exists(BASE . $template_path . '/index.php')) {
|
||||||
!file_exists(BASE . $template_path . '/template.php') &&
|
$template_index = 'index.php';
|
||||||
!file_exists(BASE . $template_path . '/layout.php'))
|
}
|
||||||
{
|
elseif(file_exists(BASE . $template_path . '/template.php')) {
|
||||||
|
$template_index = 'template.php';
|
||||||
|
}
|
||||||
|
elseif($config['backward_support'] && file_exists(BASE . $template_path . '/layout.php')) {
|
||||||
|
$template_index = 'layout.php';
|
||||||
|
}
|
||||||
|
else {
|
||||||
$template_name = 'kathrine';
|
$template_name = 'kathrine';
|
||||||
$template_path = 'templates/' . $template_name;
|
$template_path = 'templates/' . $template_name;
|
||||||
|
$template_index = 'template.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
$file = BASE . $template_path . '/config.ini';
|
if(file_exists(BASE . $template_path . '/config.php')) {
|
||||||
$exists = file_exists($file);
|
require BASE . $template_path . '/config.php';
|
||||||
if($exists || ($config['backward_support'] && file_exists(BASE . $template_path . '/layout_config.ini')))
|
}
|
||||||
{
|
else {
|
||||||
if(!$exists)
|
$file = BASE . $template_path . '/config.ini';
|
||||||
|
$exists = file_exists($file);
|
||||||
|
if ($exists || ($config['backward_support'] && file_exists(BASE . $template_path . '/layout_config.ini'))) {
|
||||||
|
if (!$exists)
|
||||||
$file = BASE . $template_path . '/layout_config.ini';
|
$file = BASE . $template_path . '/layout_config.ini';
|
||||||
|
|
||||||
if($cache->enabled())
|
if ($cache->enabled()) {
|
||||||
{
|
|
||||||
$tmp = '';
|
$tmp = '';
|
||||||
if($cache->fetch('template_ini_' . $template_name, $tmp))
|
if ($cache->fetch('template_ini_' . $template_name, $tmp))
|
||||||
$template_ini = unserialize($tmp);
|
$template_ini = unserialize($tmp);
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
$template_ini = parse_ini_file($file);
|
$template_ini = parse_ini_file($file);
|
||||||
$cache->set('template_ini_' . $template_name, serialize($template_ini));
|
$cache->set('template_ini_' . $template_name, serialize($template_ini));
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
$template_ini = parse_ini_file($file);
|
$template_ini = parse_ini_file($file);
|
||||||
|
|
||||||
foreach($template_ini as $key => $value)
|
foreach ($template_ini as $key => $value)
|
||||||
$config[$key] = $value;
|
$config[$key] = $value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(file_exists(BASE . $template_path . '/config.php'))
|
|
||||||
require BASE . $template_path . '/config.php';
|
|
||||||
|
|
||||||
$template = array();
|
$template = array();
|
||||||
$template['link_account_manage'] = getLink('account/manage');
|
$template['link_account_manage'] = getLink('account/manage');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user