Exemplo n.º 1
0
 function mapautotrim()
 {
     perm('worlds', 'runMapAutoTrim', $this->Session->read("user_perm"), true);
     if (!$this->request->is('post')) {
         throw new MethodNotAllowedException();
     }
     require APP . 'spacebukkitcall.php';
     //notify users
     $args = array($this->Session->read("Sbvars.10"), '$bServer will shut down shortly due to map mainteniance with MapAutoTrim');
     $api->call("broadcastWithName", $args, false);
     sleep(10);
     //run MapAutoTrim
     $vars = $this->request->data;
     $args2 = array($vars['world'], $vars['dilatation'], $vars['blocks']);
     $api->call("runMapTrimmer", $args2, true);
     sleep(5);
     w_serverlog($this->Session->read("current_server"), __('[WORLDS] ') . $this->Auth->user('username') . ' ' . __('ran MapAutoTrim on') . ' ' . $vars['world']);
     while (is_null($api->call('getWorlds', array(), false))) {
         sleep(1);
     }
     $this->redirect($this->referer());
 }
 function deop($name)
 {
     perm('users', 'op', $this->Session->read("user_perm"), true);
     if ($this->request->is('ajax')) {
         $this->disableCache();
         Configure::write('debug', 0);
         $this->autoRender = false;
         include APP . 'spacebukkitcall.php';
         $args = array($name);
         $api->call("deopPlayer", $args, false);
         echo $name . __(' was deopped!');
         w_serverlog($this->Session->read("current_server"), __('[USERS] ') . $this->Auth->user('username') . ' ' . __('deopped') . ' ' . $name);
     }
 }
 function restore($uid, $cleardest)
 {
     // function to restore a certain backup
     perm('backups', 'restore', $this->Session->read("user_perm"), true);
     if ($this->request->is('ajax')) {
         $this->disableCache();
         Configure::write('debug', 0);
         $this->autoRender = false;
         require APP . 'spacebukkitcall.php';
         $args = array($this->Session->read("Sbvars.10"), 'Server is shutting down to restore a backup!');
         $api->call('broadcastWithName', $args, false);
         sleep(3);
         $args = array($uid, $cleardest, true);
         $api->call('restoreBackup', $args, true);
         w_serverlog($this->Session->read("current_server"), __('[WORLDS] ') . $this->Auth->user('username') . ' ' . __('restored') . ' ' . $name);
     }
 }
 function saveBukkitConfig()
 {
     perm('servers', 'serverProperties', $this->Session->read("user_perm"), true);
     require APP . 'spacebukkitcall.php';
     //request replacement data
     $new = $this->request->data;
     $bukkit = array();
     unset($new['save']);
     $args = array("bukkit.yml");
     $bukkityml = $api->call("getFileContent", $args, true);
     $old['spawn-radius'] = $this->get_string_between($bukkityml, 'spawn-radius: ', "\n");
     $old['update-folder'] = $this->get_string_between($bukkityml, 'update-folder: ', "\n");
     $old['permissions-file'] = $this->get_string_between($bukkityml, 'permissions-file: ', "\n");
     $old['connection-throttle'] = $this->get_string_between($bukkityml, 'connection-throttle: ', "\n");
     $old['animal-spawns'] = $this->get_string_between($bukkityml, 'animal-spawns: ', "\n");
     $old['monster-spawns'] = $this->get_string_between($bukkityml, 'monster-spawns: ', "\n");
     $old['allow-end'] = $this->get_string_between($bukkityml, 'allow-end: ', "\n");
     $old['warn-on-overload'] = $this->get_string_between($bukkityml, 'warn-on-overload: ', "\n");
     $old['use-exact-login-location'] = $this->get_string_between($bukkityml, 'use-exact-login-location: ', "\n");
     $old['plugin-profiling'] = $this->get_string_between($bukkityml, 'plugin-profiling: ', "\n");
     if (NULL == isset($new['allow-end'])) {
         $new['allow-end'] = 'false';
     }
     if (NULL == isset($new['warn-on-overload'])) {
         $new['warn-on-overload'] = 'false';
     }
     if (NULL == isset($new['use-exact-login-location'])) {
         $new['use-exact-login-location'] = 'false';
     }
     if (NULL == isset($new['plugin-profiling'])) {
         $new['plugin-profiling'] = 'false';
     }
     foreach ($new as $name => $value) {
         $init = $name . ': ' . $old[$name];
         $result = $name . ': ' . $value;
         $bukkityml = str_replace($init, $result, $bukkityml);
     }
     $args = array("bukkit.yml", $bukkityml);
     $api->call("setFileContent", $args, true);
     w_serverlog($this->Session->read("current_server"), __(__('[SERVERS] ')) . $this->Auth->user('username') . ' ' . __('updated the bukkit.yml'));
     $this->Session->write('Page.tab', 4);
     $this->redirect($this->referer());
 }
 function update_plugin($name)
 {
     perm('plugins', 'updatePlugin', $this->Session->read("user_perm"), true);
     require APP . 'spacebukkitcall.php';
     //Disable plugin
     $args = array($name, true);
     $api->call("pluginUpdate", $args, true);
     $w = $api->call('getWorlds', array(), false);
     while (empty($w)) {
         sleep(2);
         $w = $api->call('getWorlds', array(), false);
     }
     w_serverlog($this->Session->read("current_server"), __('[PLUGINS] ') . $this->Auth->user('username') . ' ' . __('updated') . ' ' . $name);
     $this->redirect(array('controller' => 'Tplugins', 'action' => 'index'));
 }
Exemplo n.º 6
0
 function runcommand()
 {
     if ($this->request->is('ajax')) {
         $this->disableCache();
         Configure::write('debug', 0);
         $this->autoRender = false;
         if ($this->request->is('post')) {
             $command = $this->request->data;
             require APP . 'spacebukkitcall.php';
             $command = str_replace("/", "", $command['command']);
             $args = array($command);
             $runConsole = $api->call("consoleCommand", $args, true);
             echo __('The command') . ' "' . $command . '" ' . __('was executed!');
             //Sleep if command is 'stop'
             if ($command == 'stop') {
                 sleep(7);
             }
         }
     }
     w_serverlog($this->Session->read("current_server"), '[GLOBAL] ' . $this->Auth->user('username') . ' ' . __('executed the command') . ' "' . $command . '"');
 }
Exemplo n.º 7
0
 function saysomething()
 {
     if ($this->request->is('ajax')) {
         if ($this->request->is('post')) {
             $this->disableCache();
             Configure::write('debug', 0);
             $this->autoRender = false;
             $say = $this->request->data;
             require APP . 'spacebukkitcall.php';
             $args = array($this->Session->read("Sbvars.10"), "(" . $this->Auth->user('username') . ") " . $say['say']);
             $runConsole = $api->call("broadcastWithName", $args, false);
             echo __('You said ') . $say['say'];
             w_serverlog($this->Session->read("current_server"), '[DASHBOARD] ' . $this->Auth->user('username') . ' said "' . $say['say'] . '" ');
         }
     }
 }