<?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 /** * Created by PhpStorm. * User: Robin * Date: 4-12-2015 * Time: 18:31 */ require_once 'AppLoader.class.php'; \PBPanel\AppLoader::loadUtil('DataStore'); $dataStore = new \PBPanel\Util\DataStore(); $done = false; $input = filter_input_array(INPUT_POST); if ($dataStore->getVar('connector', 'botIp') != '') { $done = true; } if (count($input) == 7 && !$done) { $dataStore->setVar('users', $input['username'], $input['password']); $dataStore->setVar('connector', 'botIp', $input['botIp']); $dataStore->setVar('connector', 'botBasePort', $input['botBasePort']); $dataStore->setVar('connector', 'botName', $input['botName']); $dataStore->setVar('connector', 'botOauthToken', $input['botOauthToken']); $dataStore->setVar('connector', 'channelOwner', $input['channelOwner']); $done = true; } ?> <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title>
<?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\FunctionLibrary($dataStore, $connection); $templates = new \PBPanel\Util\ComponentTemplates(); $botSettings = $functions->getDbTableArray('settings'); $youtubePlayerSettings = $functions->getDbTableArray('youtubePlayer'); $requestQueue = preg_split('/\\n/', trim($functions->getOtherFile($dataStore->getVar('paths', 'youtubePlaylist')))); $defaultPlaylist = preg_split('/\\n/', trim($functions->getOtherFile($dataStore->getVar('paths', 'defaultYoutubePlaylist')))); $defaultPlaylistLength = 0; $requestQueueLength = 0; $requestQueueDataRows = ''; $defaultPlaylistDataRows = ''; foreach ($defaultPlaylist as $item) { preg_match('/[0-9]+\\.\\s(.*)\\s\\(([a-z0-9=?\\/.:_-]+)\\)$/i', $functions->cleanYTVideoTitle($item), $matches); $defaultPlaylistDataRows .= '<tr><td>' . ($defaultPlaylistLength + 1) . '.</td><td>' . trim($matches[1]) . '</td><td><div class="btn-toolbar" style="width:125px;">' . $templates->botCommandButton('playsong ' . str_replace('https://youtube.com/watch?v=', '', $matches[2]), '<span class="fa fa-play"></span>', 'success btn-sm') . $templates->botCommandButton('musicplayer deldefault ' . $defaultPlaylistLength, '<span class="fa fa-trash"></span>', 'danger btn-sm') . $templates->botCommandButton('d !chat Youtube link for ' . $matches[1] . ' -> ' . $matches[2], '<span class="fa fa-link"></span>', 'default btn-sm') . '</div></td></tr>'; ++$defaultPlaylistLength;
<?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(); $sfxFiles = $functions->getSfxFiles(); $sfxCommands = $dataStore->getTableAsArray('sfxcommands'); $sfxSelectOptions = ''; $sfxTableDataRows = ''; if (count($sfxFiles) > 0) { foreach ($sfxFiles as $sfxFile) { $sfxSelectOptions .= '<option value="' . $sfxFile['path'] . '">' . $sfxFile['fileName'] . '</option>'; } } else { $sfxSelectOptions .= '<option>NO FILES!</option>'; } ksort($sfxCommands);
<?php /** * preferences.php * Created with PhpStorm * User: Robin | Juraji * Date: 12 okt 2015 * Time: 12:40 */ 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(); $botSettings = $functions->getIniArray('settings'); $currentTheme = $dataStore->getVar('misc', 'theme', 'style_dark'); $themeFiles = new \PBPanel\Util\SortedDirectoryIterator(\PBPanel\AppLoader::getBaseDir() . '/app/css', false); $themesOptions = ''; /* @var \DirectoryIterator $themeFile */ foreach ($themeFiles as $themeFile) { if ($themeFile->getExtension() == 'css' && strpos($themeFile->getBasename(), 'style_') === 0) { $themesOptions .= '<option value="' . $themeFile->getBasename('.css') . '">' . ucfirst(str_replace('style_', '', $themeFile->getBasename('.css'))) . '</option>'; } } ?> <script>
<?php /** * connect.php * Created with PhpStorm * User: Robin | Juraji * Date: 12 okt 2015 * Time: 12:46 */ require_once '../../AppLoader.class.php'; \PBPanel\AppLoader::load(); $dataStore = new \PBPanel\Util\DataStore(); $connection = new \PBPanel\Util\BotConnectionHandler($dataStore); $functions = new \PBPanel\Util\FunctionLibrary($dataStore, $connection); $input = filter_input_array(INPUT_POST); if (!array_key_exists('username', $input) || !array_key_exists('password', $input) || !$functions->isValidUser($input['username'], $input['password'])) { $functions->sendBackError('No login'); exit; } if (array_key_exists('action', $input) && $input['action'] != '') { $action = $input['action']; switch ($action) { case 'config': $functions->getJSConfig(); break; case 'getConfig': $functions->getConfig(); break; case 'command': if (array_key_exists('command', $input) && $input['username']) { echo json_encode($connection->send('!' . $input['command'], array_key_exists(strtolower($input['username']), $functions->getDbTableArray('visited')) ? $input['username'] : $dataStore->getVar('connector', 'channelOwner')));
<?php /** * check-network.php * Created with PhpStorm * User: Robin | Juraji * Date: 1 feb 2016 * Time: 21:47 */ require_once 'AppLoader.class.php'; if (!class_exists('SQLite3')) { $botIp = $botBasePort = 'Unknown (Settings could not be read by SQLite3)'; $foundBot = false; } else { \PBPanel\AppLoader::load(); $dataStore = new \PBPanel\Util\DataStore(true); $botConnection = new \PBPanel\Util\BotConnectionHandler($dataStore); $browser = new PBPanel\Util\Browser(); $foundBot = $botConnection->testConnection(); $botIp = $dataStore->getVar('connector', 'botIp', 'Unknown (Not Set)'); $botBasePort = $dataStore->getVar('connector', 'botBasePort', 'Unknown (Not Set)'); } $clientIp = filter_input(INPUT_SERVER, 'REMOTE_ADDR') == '::1' ? 'localhost' : filter_input(INPUT_SERVER, 'REMOTE_ADDR'); $serverHasInternet = @file_get_contents('http://www.google.com'); $contentWriteable = is_writeable(\PBPanel\AppLoader::getBaseDir() . '/app/content'); function yesNoText($state) { return $state ? '<span class="text-success">Yes</span>' : '<span class="text-danger">No</span>'; } function validateIpAdress($botIp) {
<?php /** * Created by PhpStorm. * User: Robin | Juraji * Date: 4-12-2015 * Time: 16:59 */ require_once 'AppLoader.class.php'; \PBPanel\AppLoader::loadUtil('DataStore'); $dataStore = new \PBPanel\Util\DataStore(); $currentVersion = floatval($dataStore->getVar('misc', 'currentVersion', 0.0)); $hasUpdate = \PBPanel\AppLoader::updateAvailable($dataStore); $messages = []; $messagesString = ''; if ($hasUpdate) { $updateFiles = glob(\PBPanel\AppLoader::getBaseDir() . '/updates/*'); foreach ($updateFiles as $file) { $updateFileVersion = floatval(basename($file, '.php')); if ($updateFileVersion > $currentVersion) { require_once $file; $messages[] = 'Applied update ' . $updateFileVersion; } } } else { $messages[] = 'There are no updates available!'; } foreach ($messages as $message) { $messagesString .= '<p>' . $message . '</p>'; } ?>
<?php /** * raiders.php * Created with PhpStorm * User: Robin | Juraji * Date: 12 okt 2015 * Time: 12:44 */ 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(); $botSettings = $functions->getIniArray('settings'); $pastRaiders = $functions->getIniArray('raiders'); $pastRaidersTableRows = ''; $doRaidCommandResponse = $functions->getIniValueByKey('command', 'doraid'); $firstTime = false; $addCommandJsActive = $functions->getModuleStatus('addCommand.js'); $doRaidCommandForm = $templates->botCommandForm('doraid', 'Raid target', '[username]'); if ($addCommandJsActive == 1 && (!$doRaidCommandResponse || $doRaidCommandResponse == '')) { $connection->send('!addcom doraid Let\'s raid (1)! Go to http://twitch.tv/(1) and say "' . $dataStore->getVar('connector', 'channelOwner') . ' Raid!", throw them a follow and show the love! <3'); $firstTime = true; } elseif ($addCommandJsActive == '0') { $doRaidCommandForm = $templates->addTooltip($templates->botCommandForm('doraid', 'Raid target', '[username]', null, 'Send', true), 'Enable the addCommand.js module to use this form.' . $templates->botCommandButton('!module enable ./commands/addCommand.js', 'Enable addCommand.js Now', 'primary btn-block'));
<?php /** * Created by PhpStorm. * User: Robin | Juraji * Date: 10-12-2015 * Time: 19:49 */ require_once '../../AppLoader.class.php'; \PBPanel\AppLoader::load(); $dataStore = new \PBPanel\Util\DataStore(); $connection = new PBPanel\Util\BotConnectionHandler($dataStore); $functions = new \PBPanel\Util\Functions($dataStore, $connection); $templates = new \PBPanel\Util\ComponentTemplates(); // Call this file like ".../external-example2.php?username=[USERNAME]" $username = filter_input(INPUT_GET, 'username'); if ($username) { $singleUserPoints = $functions->getIniValueByKey('points', strtolower($username), true); } else { die('Call this file like ".../external-example2.php?username=[USERNAME]"'); } ?> <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <link href="app/css/<?php echo $dataStore->getVar('misc', 'theme', 'style_dark'); ?> .css"
<?php /** * Created by PhpStorm. * User: Robin | Juraji * Date: 3-12-2015 * Time: 03:43 */ require_once 'AppLoader.class.php'; \PBPanel\AppLoader::loadUtil('DataStore'); $dataStore = new \PBPanel\Util\DataStore(); $eventServerAdress = $dataStore->getVar('connector', 'botIp') . ':' . (intval($dataStore->getVar('connector', 'botBasePort')) + 2); $alertSettings = json_encode(['bgColor' => $dataStore->getVar('misc', 'streamAlertBG', '#ffffff'), 'follow' => ['bgImage' => addslashes($dataStore->getVar('streamalertsettings', 'followerAlertBG')), 'textTemplate' => $dataStore->getVar('streamalertsettings', 'followerAlertText'), 'soundFile' => addslashes($dataStore->getVar('streamalertsettings', 'followerAlertSound')), 'customCss' => $dataStore->getVar('streamalertsettings', 'followerAlertCSS')], 'host' => ['bgImage' => addslashes($dataStore->getVar('streamalertsettings', 'hostAlertBG')), 'textTemplate' => $dataStore->getVar('streamalertsettings', 'hostAlertText'), 'soundFile' => addslashes($dataStore->getVar('streamalertsettings', 'hostAlertSound')), 'customCss' => $dataStore->getVar('streamalertsettings', 'hostAlertCSS')], 'subscribe' => ['bgImage' => addslashes($dataStore->getVar('streamalertsettings', 'subscribeAlertBG')), 'textTemplate' => $dataStore->getVar('streamalertsettings', 'subscribeAlertText'), 'soundFile' => addslashes($dataStore->getVar('streamalertsettings', 'subscribeAlertSound')), 'customCss' => $dataStore->getVar('streamalertsettings', 'subscribeAlertCSS')]]); ?> <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <link rel="icon" href="/favicon.ico" type="image/x-icon"/> <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/> <link rel="stylesheet" href="app/css/defaultAlertCSS.css"/> <script> var botAddress = '<?php echo $eventServerAdress; ?> ', alertSettings = <?php echo $alertSettings; ?> ;
<?php /** * Created by PhpStorm. * User: Robin | Juraji * Date: 3-12-2015 * Time: 03:43 */ require_once 'AppLoader.class.php'; \PBPanel\AppLoader::load(); $dataStore = new \PBPanel\Util\DataStore(); $connection = new \PBPanel\Util\BotConnectionHandler($dataStore); $functions = new \PBPanel\Util\Functions($dataStore, $connection); $eventServerAdress = $dataStore->getVar('connector', 'botIp') . ':' . (intval($dataStore->getVar('connector', 'botBasePort')) + 2); ?> <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <link href="app/css/music-player.css" rel="stylesheet" type="text/css"/> <link rel="icon" href="/favicon.ico" type="image/x-icon"/> <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/> <script> var botAddress = '<?php echo $eventServerAdress; ?> ', commandPermissions = <?php echo json_encode($functions->getIniArray('permcom')); ?>
<?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(); $alertCSSFields = ['followerAlertCSS', 'hostAlertCSS', 'subscribeAlertCSS', 'donationAlertCSS']; foreach ($alertCSSFields as $alertCSSField) { if (trim($dataStore->getVar('streamalertsettings', $alertCSSField)) == '') { $dataStore->setVar('streamalertsettings', $alertCSSField, $functions->getDefaultAlertCSS()); } } ?> <div class="app-part"> <script src="app/js/codemirror.min.js" type="text/javascript"></script> <script src="app/js/cm-css.min.js" type="text/javascript"></script> <div class="panel panel-default"> <div class="panel-heading">
<?php /** * music-player.php * Created with PhpStorm * User: Robin | Juraji * Date: 12 okt 2015 * Time: 12:48 */ require_once '../AppLoader.class.php'; \PBPanel\AppLoader::loadUtil('DataStore'); $dataStore = new \PBPanel\Util\DataStore(); $botControl = filter_input(INPUT_GET, 'botControl', FILTER_VALIDATE_BOOLEAN); $musicServerAdress = $dataStore->getVar('connector', 'botIp') . ':' . (intval($dataStore->getVar('connector', 'botBasePort')) + 1); ?> <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <link href="../app/css/music-player.css" rel="stylesheet" type="text/css"/> <link rel="icon" href="../favicon.ico" type="image/x-icon"/> <link rel="shortcut icon" href="../favicon.ico" type="image/x-icon"/> <script src="https://www.youtube.com/iframe_api"></script> <script> var botAddress = '<?php echo $musicServerAdress; ?> ', botControl = <?php echo $botControl ? 'true' : 'false';
<?php /** * dashboard.php * Created with PhpStorm * User: Robin | Juraji * Date: 12 okt 2015 * Time: 12:41 */ 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\FunctionLibrary($dataStore, $connection); $templates = new \PBPanel\Util\ComponentTemplates(); $botSettings = $functions->getDbTableArray('settings'); $botStreamInfo = $functions->getDbTableArray('streamInfo'); $noticeCount = count($functions->getDbTableArray('notices')); $latestFollower = checkFile($functions->getOtherFile($dataStore->getVar('paths', 'latestFollower'))); $latestDonator = checkFile($functions->getOtherFile($dataStore->getVar('paths', 'latestDonation'))); function checkFile($file) { return trim($file) == '' || substr(trim($file), 0, 1) == '<' ? false : $file; } ?> <div class="app-part"> <div class="panel panel-default">
<?php /** * dashboard.php * Created with PhpStorm * User: Robin | Juraji * Date: 12 okt 2015 * Time: 12:41 */ 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(); $botSettings = $functions->getIniArray('settings'); $botStreamInfo = $functions->getIniArray('stream_info', true); $noticeCount = $functions->getIniValueByKey('notice', 'num_messages'); ?> <div class="app-part"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">Dashboard <span class="text-muted">Update stream info</span></h3> </div> <div class="panel-body"> <h4>Quick Commands</h4>