Exemple #1
0
<?php

include dirname(dirname(dirname(__FILE__))) . '/common/config.php';
include dirname(dirname(dirname(__FILE__))) . '/common/server.php';
include dirname(dirname(dirname(__FILE__))) . '/common/session.php';
include 'apishared.php';
$call = api_checkarg_post('fn');
$db = getsql();
if ($call == 'create') {
    $binary = $db->real_escape_string(api_checkarg_post_required('binary', 'Zandronum version'));
    $hostname = $db->real_escape_string(api_checkarg_post_required('hostname', 'Host name'));
    $iwad = $db->real_escape_string(api_checkarg_post_required('iwad', 'IWAD'));
    $gamemode = $db->real_escape_string(api_checkarg_post_required('gamemode', 'Game mode'));
    $instagib = $db->real_escape_string(api_checkarg_post_required('instagib', 'Instagib') == 'true');
    $buckshot = $db->real_escape_string(api_checkarg_post_required('buckshot', 'Buckshot') == 'true');
    $stdata = $db->real_escape_string(api_checkarg_post_required('stdata', 'Skulltag data') == 'true');
    $skill = intval(api_checkarg_post('skill', 0));
    $dmflags = intval(api_checkarg_post('dmflags', 0));
    $dmflags2 = intval(api_checkarg_post('dmflags2', 0));
    $zadmflags = intval(api_checkarg_post('zadmflags', 0));
    $compatflags = intval(api_checkarg_post('compatflags', 0));
    $zacompatflags = intval(api_checkarg_post('zacompatflags', 0));
    $wads = api_checkarg_post('wads', array());
    $optwads = api_checkarg_post('optwads', array());
    $binary = disciple_json()->main_binary;
    $iwad = data_dir('/iwads/') . $iwad . '.wad';
    $s = new server($binary, $wads, $optwads, $iwad, $hostname, false, $gamemode, '', $skill, $stdata, $instagib, $buckshot, $dmflags, $dmflags2, $zadmflags, $compatflags, $zacompatflags);
    $s->start();
    echo "1 " . $s->id;
}
Exemple #2
0
             server::deleteDir($var);
         }
         echo message::success(lang::get('server_deleted'));
     } else {
         echo message::danger(lang::get('choose_server'));
     }
 }
 if ($action == 'install' && $id) {
     $server = new server($id);
     $server->install();
     $return = message::success(lang::get('server_install'));
 }
 if (ajax::is()) {
     if ($action == 'start' && $id) {
         $server = new server($id);
         $server->start();
         $return = message::success(lang::get('server_started'));
     }
     if ($action == 'stop' && $id) {
         $server = new server($id);
         $server->stop();
         $return = message::success(lang::get('server_stopped'));
     }
     ajax::addReturn($return);
 }
 $table = new table();
 $table->addCollsLayout('25, 32%, *, 70, 170');
 $table->addRow()->addCell("\n\t\t\t<input type='checkbox' id='all'>\n\t\t\t<label for='all'></label>\n\t\t", ['class' => 'checkbox'])->addCell(lang::get('name'))->addCell(lang::get('game'))->addCell(lang::get('port'))->addCell(lang::get('status'));
 $table->addSection('tbody');
 $table->setSql('SELECT * FROM ' . sql::table('server'));
 if ($table->numSql()) {