Пример #1
0
<?php

/**
 * login.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\Functions($dataStore, $connection);
$input = filter_input_array(INPUT_POST);
if (!array_key_exists('username', $input) || trim($input['username']) == '') {
    $functions->sendBackError('No username defined', 203);
} elseif (!array_key_exists('password', $input) || trim($input['password']) == '') {
    $functions->sendBackError('No password defined', 203);
} elseif (!$functions->isValidUser($input['username'], $input['password'])) {
    $functions->sendBackError('No Access', 203);
} else {
    $functions->sendBackOk(true);
}
Пример #2
0
     if (array_key_exists('uri', $input)) {
         $functions->getIniArray($input['uri'], false);
     } else {
         $functions->sendBackError('Missing ini uri');
     }
     break;
 case 'getOtherFile':
     if (array_key_exists('uri', $input)) {
         $functions->getOtherFile($input['uri'], false);
     } else {
         $functions->sendBackError('Missing ini uri');
     }
     break;
 case 'getIniValueByKey':
     if (array_key_exists('uri', $input) && array_key_exists('key', $input)) {
         $functions->sendBackOk($functions->getIniValueByKey($input['uri'], $input['key']));
     } else {
         $functions->sendBackError('Missing parameters');
     }
     break;
 case 'getCurrentTitle':
     $functions->getCurrentTitle();
     break;
 case 'getMusicPlayerPlaylist':
     $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');