Example #1
0
 */
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')));
            } else {
                $functions->sendBackError('Command is empty');
            }
            break;
        case 'getIni':
            if (array_key_exists('uri', $input)) {
                $functions->getDbTableArray($input['uri'], false);
            } else {