Пример #1
0
 * Created with PhpStorm
 * User: Robin | Juraji
 * 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();
$sfxFiles = $functions->getSfxFiles();
$sfxCommands = $dataStore->getTableAsArray('sfxcommands');
$sfxSelectOptions = '';
$sfxTableDataRows = '';
if (count($sfxFiles) > 0) {
    foreach ($sfxFiles as $sfxFile) {
        $sfxSelectOptions .= '<option value="' . $sfxFile['path'] . '">' . $sfxFile['fileName'] . '</option>';
    }
} else {
    $sfxSelectOptions .= '<option>NO FILES!</option>';
}
ksort($sfxCommands);
foreach ($sfxCommands as $command => $file) {
    $sfxTableDataRows .= '<tr><td>' . $templates->botCommandButton($command, '!' . $command, 'default btn-sm') . '</td><td>' . $file . '</td><td><button class="btn btn-danger" onclick="deleteSfx(\'' . $command . '\')"><span class="fa fa-trash"></span></button></td></tr>';
}
?>