This will fix an issue with templates of other users being applied to different users logged in. Basically the first cached page would be displayed for all users. Created a new cache key for smarty to allow the user ID to be reference in the cache key. Hence each user has their own cached file which will be used. Improved caching by creating subdirectories for cached files. This way we won't run into a file limit per directory with a lot of cached files. This fixes #430 and the mentioned issue in that report.
22 lines
771 B
PHP
22 lines
771 B
PHP
<?php
|
|
|
|
// Make sure we are called from index.php
|
|
if (!defined('SECURITY')) die('Hacking attempt');
|
|
|
|
// Check user to ensure they are admin
|
|
if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
|
|
header("HTTP/1.1 404 Page not found");
|
|
die("404 Page not found");
|
|
}
|
|
|
|
if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
|
|
$debug->append('No cached version available, fetching from backend', 3);
|
|
$aTransactions = $transaction->getAllTransactions(@$_REQUEST['start']);
|
|
if (!$aTransactions) $_SESSION['POPUP'][] = array('CONTENT' => 'Could not find any transaction', 'TYPE' => 'errormsg');
|
|
} else {
|
|
$debug->append('Using cached page', 3);
|
|
}
|
|
$smarty->assign('TRANSACTIONS', $aTransactions);
|
|
$smarty->assign('CONTENT', 'default.tpl');
|
|
?>
|