Пример #1
0
            $session_user = UserCache::getInstance()->getUser($_SESSION['userid']);
            if ($session_user->isTeamMember(Config::getInstance()->getValue(Config::id_adminTeamId))) {
                if (NULL != Constants::$codevtt_logfile && file_exists(Constants::$codevtt_logfile)) {
                    $nbLinesToDisplay = 1500;
                    $lines = file(Constants::$codevtt_logfile);
                    if (count($lines) > $nbLinesToDisplay) {
                        $offset = count($lines) - $nbLinesToDisplay;
                    } else {
                        $offset = 0;
                    }
                    $logs = array();
                    for ($i = $offset; $i <= $offset + $nbLinesToDisplay, $i < count($lines); $i++) {
                        $logs[$i + 1] = htmlspecialchars($lines[$i], ENT_QUOTES, "UTF-8");
                        #echo "DEBUG $line_num - ".$logs[$line_num]."<br>";
                    }
                    $this->smartyHelper->assign('logs', $logs);
                } else {
                    $this->smartyHelper->assign('error', T_('Sorry, logfile not found:') . ' [' . Constants::$codevtt_logfile . ']');
                }
            } else {
                $this->smartyHelper->assign('error', T_('Sorry, you need to be in the admin-team to access this page.'));
            }
        } else {
            $this->smartyHelper->assign('error', T_('Sorry, you need to be in the admin-team to access this page.'));
        }
    }
}
// ========== MAIN ===========
LogsController::staticInit();
$controller = new LogsController('../', 'CodevTT Logs', 'Admin');
$controller->execute();