Ejemplo n.º 1
0
 * 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)
{
    $groups = explode('.', $botIp);
    $isIp = true;
    foreach ($groups as $group) {
Ejemplo n.º 2
0
$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;
$NOSubscribers = -1;
$partsList = $functions->getPartsList();
$renderedMenu = '';
foreach ($partsList as $parentName => $subItems) {
    $parentId = 'menu-parent-' . $parentName;
    $renderedMenu .= '<li class="dropdown" id="' . $parentId . '"><a nohref class="dropdown-toggle" role="button">' . ucwords($parentName) . '</a><ul class="dropdown-menu" role="menu">';
    $icon = 'fa-cog';
    switch ($parentName) {
        case 'games':
            $icon = 'fa-gamepad';
            break;
Ejemplo n.º 3
0
     $functions->sendBackOk($functions->getMusicPlayerPlaylist($dataStore->getVar('paths', 'youtubePlaylist')));
     break;
 case 'saveToConfig':
     if (array_key_exists('settingPath', $input) && array_key_exists('setting', $input)) {
         $path = explode('/', $input['settingPath']);
         if ($dataStore->setVar($path[0], $path[1], $input['setting'])) {
             $functions->sendBackOk('Setting Saved');
         } else {
             $functions->sendBackError('Failed to save setting', 418, 418);
         }
     } else {
         $functions->sendBackError('Missing parameters');
     }
     break;
 case 'testBotConnection':
     echo json_encode($connection->testConnection());
     break;
 case 'saveSfxCommand':
     if (array_key_exists('command', $input) && array_key_exists('file', $input)) {
         if ($functions->saveSfxCommand($input['command'], $input['file'])) {
             $functions->sendBackOk('Setting Saved');
         } else {
             $functions->sendBackError('Failed to save setting', 418, 418);
         }
     } else {
         $functions->sendBackError('Missing parameters');
     }
     break;
 case 'deleteSfxCommand':
     if (array_key_exists('command', $input)) {
         if ($functions->deleteSfxCommand($input['command'])) {