<?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>
* 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; } foreach ($requestQueue as $item) { if ($item == '') { continue; } preg_match('/(.*)\\s\\(.+\\s([a-z0-9_]+)\\)$/i', $functions->cleanYTVideoTitle($item), $matches);
* 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) { $groups = explode('.', $botIp); $isIp = true; foreach ($groups as $group) { $group = intval($group);
* 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> $('#toggle-information-button').prop('checked', pBotStorage.get(pBotStorage.keys.informationActive, true)); $('#toggle-tooltips-button').prop('checked', !pBotStorage.get(pBotStorage.keys.tooltipsActive, false)); $('#toggle-chat-default-button').prop('checked', pBotStorage.get(pBotStorage.keys.chatDefaultState, false)); </script> <div class="app-part">
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')); } foreach ($pastRaiders as $username => $timesRaided) { $pastRaidersTableRows .= '<tr><td>' . str_replace('_count', '', $username) . '</td><td>' . $timesRaided . ' raids</td></tr>'; } ?> <div class="app-part"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"> Raid System <?php echo $templates->toggleFavoriteButton();
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'))); } else { $functions->sendBackError('Command is empty'); } break; case 'getIni': if (array_key_exists('uri', $input)) { $functions->getDbTableArray($input['uri'], false); } else { $functions->sendBackError('Missing ini uri'); } break; case 'getOtherFile': if (array_key_exists('uri', $input)) { $functions->getOtherFile($input['uri'], false); } else {
<?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: 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>'; } ?>
$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" 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"/> </head> <body> <div id="page-wrapper"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">User points for <?php echo $username; ?> </h3> </div>
<?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')); ?>
* 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"> <h3 class="panel-title"> Stream Alerts <?php echo $templates->toggleFavoriteButton(); ?> </h3>
* 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"> <div class="panel-heading"> <h3 class="panel-title">Dashboard <span class="text-muted">Update stream info</span></h3> </div> <div class="panel-body"> <?php echo $latestFollower ? '<h4><small>Latest Follower</small> ' . $latestFollower . '</h4>' : ''; ?>
echo $templates->botCommandButton('botuptime', 'Announce Current Bot-up-time'); ?> </div> </div> <div class="btn-toolbar"> <?php echo $noticeCount > 0 ? $templates->botCommandButton('notice get ' . rand(0, $noticeCount - 1), 'Random Notice', 'default btn-sm') : ''; ?> <?php echo $templates->botCommandButton('clear', 'Clear Chat', 'default btn-sm'); ?> <?php echo $templates->switchToggle('Mute Bot', $templates->_wrapInJsToggledDoQuickCommand('response', array_key_exists('response_@all', $botSettings) && $botSettings['response_@all'] == 0 ? 'true' : 'false', 'enable', 'disable'), '[]', '', array_key_exists('response_@all', $botSettings) && $botSettings['response_@all'] == 0, true); ?> <?php echo $templates->botCommandButton('d !exit', 'Shutdown ' . $dataStore->getVar('connector', 'botName'), 'danger btn-sm'); ?> </div> <hr/> <h4 class="collapsible-master">Edit Stream Title & Game</h4> <div class="collapsible-content"> <div class="row"> <div class="col-sm-8"> <?php echo $templates->botCommandForm('title', 'Title', 'title', array_key_exists('title', $botStreamInfo) ? $botStreamInfo['title'] : ''); ?> </div> <div class="col-sm-8"> <?php echo $templates->botCommandForm('game', 'Game', 'game', array_key_exists('game', $botStreamInfo) ? $botStreamInfo['game'] : '');