foreach ($modules as $module) {
// Require its initialisation file
require 'core/modules/' . htmlspecialchars($module->name) . '/initialisation.php';
}
// Get site name from cache
$c->setCache('sitenamecache');
$sitename = htmlspecialchars($c->retrieve('sitename'));
$smarty->assign('SITE_NAME', $sitename);
// Perform tasks for signed in users
if ($user->isLoggedIn()) {
// Update a user's IP
$ip = $user->getIP();
if (filter_var($ip, FILTER_VALIDATE_IP)) {
$user->update(array('lastip' => $ip));
}
// Update user last online
$queries->update('users', $user->data()->id, array('last_online' => date('U')));
// Perform moderator actions
if ($user->canViewMCP($user->data()->id)) {
// Are there any open reports for moderators?
$reports = $queries->getWhere('reports', array('status', '<>', '1'));
if (count($reports)) {
$reports = true;
// Open reports
} else {
$reports = false;
// No open reports
}
}
}
}