\PBPanel\AppLoader::load();
$session = new \PBPanel\Util\PanelSession();
if (!$session->checkSessionToken(filter_input(INPUT_POST, 'token'))) {
    die('Invalid session token. Are you trying to hack me?!');
}
$dataStore = new \PBPanel\Util\DataStore();
$connection = new \PBPanel\Util\BotConnectionHandler($dataStore);
$functions = new \PBPanel\Util\Functions($dataStore, $connection);
$templates = new \PBPanel\Util\ComponentTemplates();
$botSettings = $functions->getIniArray('settings');
$recordedFollows = $functions->getIniArray('followed');
$userLastSeen = $functions->getIniArray('lastseen');
$followersTableRows = '';
foreach ($recordedFollows as $username => $follows) {
    if ($follows == '1') {
        $followersTableRows .= '<tr><td>' . ucfirst($username) . '</td><td>' . (array_key_exists($username, $userLastSeen) ? $functions->botTimeToStandardFormat($userLastSeen[$username]) : 'No data yet!') . '</td></tr>';
    }
}
?>
<div class="app-part">
  <div class="panel panel-default">
    <div class="panel-heading">
      <h3 class="panel-title">
        Follow Events
        <?php 
echo $templates->toggleFavoriteButton();
?>
        <?php 
echo $templates->moduleActiveIndicator($functions->getModuleStatus('followHandler.js'));
?>
      </h3>