/** * DataStore constructor. * @param bool $skipWriteableTest */ public function __construct($skipWriteableTest = false) { if (!$skipWriteableTest && !is_writable(\PBPanel\AppLoader::getBaseDir() . '/app/content/')) { die('The webserver needs read/write permissions on "' . \PBPanel\AppLoader::getBaseDir() . '/app/content/' . '" and it\'s contents!'); } $this->db = new \SQLite3(\PBPanel\AppLoader::getBaseDir() . '/app/content/dataStore.sqlite', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE, null); register_shutdown_function([$this, 'shutdown']); }
<small><?php echo $dataStore->getVar('misc', 'currentVersion'); ?> </small> / <a href="//juraji.nl" target="_blank">juraji</a> ©<?php echo date('Y'); ?> / Compatible with <a href="//www.phantombot.net/" target="_blank">PhantomBot <?php echo $dataStore->getVar('misc', 'pbCompat'); ?> </a> </div> </div> </div> <div id="chat-sidebar" class="chat-responsive"> <iframe id="chat-iframe" src="" scrolling="no"></iframe> </div> <div id="general-alert" class="alert"></div> <div id="music-player-controls"> <?php require_once \PBPanel\AppLoader::getBaseDir() . '/app/parts/static/music-player-controls.php'; ?> </div> <?php echo $templates->sideTab('Twitch Preview', 'http://www.twitch.tv/' . strtolower($dataStore->getVar('connector', 'channelOwner')) . '/embed', 'fa-video-camera'); echo $templates->sideTab('Music Player', 'pops/music-player.php?botControl=true', 'fa-music', true); ?> </body> </html>
* 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"> <div class="panel panel-default">
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); if ($group < 0 || $group > 255) { $isIp = false; break; } }
/** * 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>'; } ?> <!DOCTYPE html>
<?php /** * Created by PhpStorm. * User: Robin * Date: 3-12-2015 * Time: 14:12 */ $oldConfig = []; if (file_exists(\PBPanel\AppLoader::getBaseDir() . '/app/content/vars/config.php')) { $oldConfig = json_decode(file_get_contents(\PBPanel\AppLoader::getBaseDir() . '/app/content/vars/config.php'), JSON_OBJECT_AS_ARRAY); $messages[] = '<span class="text-warning">Please delete the "vars" folder in "./app/content", since it are no longer used.</span>'; } /* Create bot connector table */ if ($dataStore->getVar('connector', 'botIp') == '') { $dataStore->setVar('connector', 'botIp', array_key_exists('botIp', $oldConfig) ? $oldConfig['botIp'] : ''); $dataStore->setVar('connector', 'botBasePort', array_key_exists('botBasePort', $oldConfig) ? $oldConfig['botBasePort'] : '25000'); $dataStore->setVar('connector', 'botName', array_key_exists('botName', $oldConfig) ? $oldConfig['botName'] : ''); $dataStore->setVar('connector', 'botOauthToken', array_key_exists('botOauthToken', $oldConfig) ? $oldConfig['botOauthToken'] : ''); $dataStore->setVar('connector', 'channelOwner', array_key_exists('channelOwner', $oldConfig) ? $oldConfig['channelOwner'] : ''); } /* Create panel users table */ if (array_key_exists('panelUsers', $oldConfig)) { foreach ($oldConfig['panelUsers'] as $username => $hash) { $dataStore->setVar('users', $username, $hash); } } /* Create paths table */ $dataStore->setVar('paths', 'latestFollower', array_key_exists('latestFollower', $oldConfig['paths']) ? $oldConfig['paths']['latestFollower'] : '/web/latestfollower.txt'); $dataStore->setVar('paths', 'latestDonation', array_key_exists('latestDonation', $oldConfig['paths']) ? $oldConfig['paths']['latestDonation'] : '/addons/donationchecker/latestdonation.txt'); $dataStore->setVar('paths', 'youtubeCurrentSong', array_key_exists('youtubeCurrentSong', $oldConfig['paths']) ? $oldConfig['paths']['youtubeCurrentSong'] : '/addons/youtubePlayer/currentsong.txt');
public function getDefaultAlertCSS() { return file_get_contents(AppLoader::getBaseDir() . '/app/css/defaultAlertCSS.css'); }