<?php

/**
 * part-template.php
 * Created with PhpStorm
 * User: Robin | Juraji
 * Date: 12 okt 2015
 * Time: 12:47
 */
require_once '../../../AppLoader.class.php';
\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();
$users = $dataStore->getTableAsArray('users');
$usersDataRows = '';
$usersDataRowsCurrentPosition = 0;
$usersDataRowsIsFirst = true;
$currentValidatedUser = filter_input(INPUT_POST, 'username');
$userIsAdmin = false;
foreach ($users as $username => $md5Password) {
    $uuid = $templates->randomId();
    $usersDataRowsIsFirst = $username == $currentValidatedUser;
    ++$usersDataRowsCurrentPosition;
    if ($usersDataRowsCurrentPosition == 1 && $username != $currentValidatedUser) {
        continue;
<?php

/**
 * control-panel.php
 * Created with PhpStorm
 * User: Robin | Juraji
 * Date: 12 okt 2015
 * Time: 12:47
 */
require_once 'AppLoader.class.php';
\PBPanel\AppLoader::load();
$session = new \PBPanel\Util\PanelSession();
$dataStore = new PBPanel\Util\DataStore();
$connection = new \PBPanel\Util\BotConnectionHandler($dataStore);
$functions = new \PBPanel\Util\FunctionLibrary($dataStore, $connection);
$templates = new \PBPanel\Util\ComponentTemplates();
if (\PBPanel\AppLoader::runInstall($dataStore)) {
    require_once 'install.php';
    exit;
}
if (\PBPanel\AppLoader::updateAvailable($dataStore)) {
    require_once 'update.php';
    exit;
}
$session->createToken();
$botSettings = $functions->getDbTableArray('settings');
$isBotOnline = $connection->testConnection()[2] == 52;
$hostHandlerActive = $functions->getDbTableValueByKey('modules.ini', 'hostHandler.js', true);
$subscribeHandlerActive = $functions->getDbTableValueByKey('modules.ini', 'subscribeHandler.js', true);
$musicPlayerCurrentSong = $functions->getOtherFile($dataStore->getVar('paths', 'youtubeCurrentSong'));
$NOHosts = -1;