Esempio n. 1
0
 public static function isSaved($addon, $save = true)
 {
     $sql = new sql();
     $num = $sql->num('SELECT 1 FROM ' . sql::table('addons') . ' WHERE `name` = "' . $addon . '"');
     if (!$num && $save) {
         $save = new sql();
         $save->setTable('addons');
         $save->addPost('name', $addon);
         $save->save();
     }
     return $num;
 }
Esempio n. 2
0
 protected function control($type)
 {
     $id = $this->id;
     $SSH = rp::get('SSH');
     $host = $SSH['ip'];
     $user = $SSH['user'];
     $pass = $SSH['password'];
     unset($SSH);
     $ssh = new ssh($host, $user, $pass);
     $sql = new sql();
     $sql->setTable('server');
     $sql->setWhere('id=' . $id);
     #$ssh->read('[prompt]');
     switch ($type) {
         case 'install':
             $ssh->exec("cd {$id}; ./control.sh auto-install  > /dev/null &");
             $sql->addPost('status', 0);
             break;
         case 'start':
             $ssh->exec("cd {$id}; ./control.sh start >> /dev/null 2>&1 & /n");
             $sql->addPost('status', 1);
             break;
         case 'stop':
             $ssh->exec("cd {$id}; ./control.sh stop >> /dev/null 2>&1 & /n");
             $sql->addPost('status', 0);
             break;
         case 'restart':
             $ssh->exec("cd {$id}; ./control.sh restart >> /dev/null 2>&1 & /n");
             $sql->addPost('status', 1);
             break;
     }
     $sql->update();
 }
Esempio n. 3
0
            $sql->addPost('active', 0);
        }
        $sql->update();
        echo message::success(lang::get('addon_save_success'));
    }
}
if ($action == 'active') {
    $addonClass = new addon($addon, false);
    $active = $addonClass->isActive() ? 0 : 1;
    if (!$addonClass->isInstall()) {
        echo message::danger(sprintf(lang::get('addon_install_first'), $addon));
    } else {
        $sql = new sql();
        $sql->setTable('addons');
        $sql->setWhere('`name` = "' . $addon . '"');
        $sql->addPost('active', $active);
        $sql->update();
        echo message::success(lang::get('addon_save_success'));
    }
}
if ($action == 'help') {
    $curAddon = new addon($addon);
    ?>
	<div class="panel">
		<div class="top">
			<h3><?php 
    echo $curAddon->get('name');
    ?>
</h3>
        </div>
        <div class="content">           
Esempio n. 4
0
    echo lang::get('apply');
    ?>
</button>
        
        </div>
    </div>
</form>

<?php 
} else {
    if (isset($_POST['sendNew'])) {
        $new = new sql();
        $new->setTable('user');
        $admin = isset($_POST['admin']) ? 1 : 0;
        $salt = userLogin::generateSalt();
        $new->addPost('salt', $salt);
        $new->addPost('firstname', type::post('firstname'));
        $new->addPost('name', type::post('name'));
        $new->addPost('email', type::post('email'));
        $new->addPost('admin', $admin);
        $new->addPost('username', type::post('username'));
        $new->addPost('password', userLogin::hash(type::post('password'), $salt));
        $new->save();
        echo message::success(lang::get('user_added'));
    }
    if (isset($_POST['delete'])) {
        $ids = type::post('ids');
        if (is_array($ids) && count($ids) >= 1) {
            if (in_array(rp::get('user')->get('id'), $ids)) {
                echo message::danger(lang::get('user_delete_own'));
            } else {
Esempio n. 5
0
    echo lang::get('add');
    ?>
</button>
        
        </form>
        
    </div>
</div>
	
<?php 
} else {
    if (isset($_POST['sendNew'])) {
        $new = new sql();
        $new->setTable('server');
        $vars = type::post('var');
        $new->addPost('gameID', type::post('gameID'));
        $new->addPost('name', type::post('name'));
        $new->addPost('port', $vars['port']);
        $new->addPost('status', '');
        $new->save();
        $newID = $new->insertId();
        $vars['id'] = type::post('gameID') . $newID;
        $server = new server($newID);
        $server->create((array) $vars);
        echo message::success(lang::get('server_added'));
    }
    if (isset($_POST['delete'])) {
        $ids = type::post('ids');
        if (is_array($ids) && count($ids) >= 1) {
            foreach ($ids as $var) {
                $sql = new sql();
Esempio n. 6
0
    public static function newInstall()
    {
        $sql = new sql();
        $sql->query('DROP TABLE `' . sql::table('module') . '`');
        $sql->query('CREATE TABLE `' . sql::table("module") . '` (
		  `id` 			int(16)		unsigned 	NOT NULL 	auto_increment,
		  `name`		varchar(255) 			NOT NULL,
		  `input` 		text 					NOT NULL,
		  `output`		text 					NOT NULL,
		  `sort`		int(16)		unsigned 	NOT NULL,
		  PRIMARY KEY  (`id`)
		) ENGINE=MyISAM  DEFAULT CHARSET=utf8;');
        $sql->query('DROP TABLE `' . sql::table('structure') . '`');
        $sql->query('CREATE TABLE `' . sql::table("structure") . '` (
		  `id` 			int(16)		unsigned	NOT NULL 	auto_increment,
		  `name`		varchar(255) 			NOT NULL,
		  `template`	varchar(255) 			NOT NULL,
		  `sort`		int(16)		unsigned	NOT NULL,
		  `parent_id`	int(16)		unsigned	NOT NULL,
		  `online`		int(1)		unsigned	NOT NULL,
		  PRIMARY KEY  (`id`)
		) ENGINE=MyISAM  DEFAULT CHARSET=utf8;');
        $sql->query('DROP TABLE `' . sql::table('user') . '`');
        $sql->query('CREATE TABLE `' . sql::table("user") . '` (
		  `id` 			int(11) 	unsigned	NOT NULL	auto_increment,
		  `firstname` 	varchar(255)			NOT NULL,
		  `name` 		varchar(255)			NOT NULL,
		  `email` 		varchar(255)			NOT NULL,
		  `password`	varchar(255)			NOT NULL,
		  `perms`		varchar(255)			NOT NULL,
		  `admin`		int(1) 		unsigned	NOT NULL,
		  PRIMARY KEY  (`id`)
		) ENGINE=MyISAM  DEFAULT CHARSET=utf8;');
        $sql->setTable('user');
        $sql->addPost('firstname', type::post('firstname'));
        $sql->addPost('name', type::post('name'));
        $sql->addPost('email', type::post('email'));
        $sql->addPost('password', userLogin::hash(type::post('password')));
        $sql->addPost('admin', 1);
        $sql->save();
        $sql->query('DROP TABLE `' . sql::table('structure_area') . '`');
        $sql->query('CREATE TABLE `' . sql::table("structure_area") . '` (
		  `id`			int(16)		unsigned	NOT NULL		auto_increment,
		  `structure_id`int(16) 	unsigned	NOT NULL,
		  `sort`		int(16)		unsigned	NOT NULL,
		  `modul`		int(16)		unsigned	NOT NULL,
		  `online`		int(1)		unsigned	NOT NULL,
		  `value1` 		text 					NOT NULL,
		  `value2` 		text					NOT NULL,
		  `value3` 		text 					NOT NULL,
		  `value4` 		text					NOT NULL,
		  `value5` 		text					NOT NULL,
		  `value6` 		text 					NOT NULL,
		  `value7`		text 					NOT NULL,
		  `value8` 		text 					NOT NULL,
		  `value9` 		text 					NOT NULL,
		  `value10` 	text 					NOT NULL,
		  `value11` 	text 					NOT NULL,
		  `value12` 	text 					NOT NULL,
		  `value13` 	text 					NOT NULL,
		  `value14` 	text 					NOT NULL,
		  `value15` 	text 					NOT NULL,
		  `link1` 		int(11)					NOT NULL,
		  `link2` 		int(11)					NOT NULL,
		  `link3` 		int(11)					NOT NULL,
		  `link4` 		int(11)					NOT NULL,
		  `link5` 		int(11)					NOT NULL,
		  `link6` 		int(11)					NOT NULL,
		  `link7`		int(11)					NOT NULL,
		  `link8` 		int(11)					NOT NULL,
		  `link9` 		int(11)					NOT NULL,
		  `link10` 		int(11)					NOT NULL,
		  `linklist1`	varchar(255)			NOT NULL,
		  `linklist2` 	varchar(255)			NOT NULL,
		  `linklist3` 	varchar(255) 			NOT NULL,
		  `linklist4` 	varchar(255)			NOT NULL,
		  `linklist5` 	varchar(255)			NOT NULL,
		  `linklist6` 	varchar(255)			NOT NULL,
		  `linklist7`	varchar(255)			NOT NULL,
		  `linklist8` 	varchar(255)			NOT NULL,
		  `linklist9` 	varchar(255) 			NOT NULL,
		  `linklist10`	varchar(255) 			NOT NULL,
		  `php1` 		text 					NOT NULL,
		  `php2` 		text 					NOT NULL,
		  PRIMARY KEY  (`id`)
		) ENGINE=MyISAM  DEFAULT CHARSET=utf8;');
        $sql->query('DROP TABLE `' . sql::table('addons') . '`');
        $sql->query('CREATE TABLE `' . sql::table("addons") . '` (
		  `id` 			int(11) 	unsigned	NOT NULL	auto_increment,
		  `name` 		varchar(255)			NOT NULL,
		  `active`		int(1)					NOT NULL,
		  `install`		int(1)					NOT NULL,
		  PRIMARY KEY  (`id`)
		) ENGINE=MyISAM  DEFAULT CHARSET=utf8;');
        $sql->query('DROP TABLE `' . sql::table('slots') . '`');
        $sql->query('CREATE TABLE `' . sql::table("slots") . '` (
		  `id` 			int(11) 	unsigned	NOT NULL	auto_increment,
		  `name` 		varchar(255)			NOT NULL,
		  `description`	varchar(255)			NOT NULL,
		  `template` 	varchar(255)			NOT NULL,
		  `modul`	 	int(11)		unsigned	NOT NULL,
		  `is-structure`int(1)		unsigned	NOT NULL	DEFAULT "1",
		  `structure` 	varchar(255)			NOT NULL,
		  `value1` 		text 					NOT NULL,
		  `value2` 		text					NOT NULL,
		  `value3` 		text 					NOT NULL,
		  `value4` 		text					NOT NULL,
		  `value5` 		text					NOT NULL,
		  `value6` 		text 					NOT NULL,
		  `value7`		text 					NOT NULL,
		  `value8` 		text 					NOT NULL,
		  `value9` 		text 					NOT NULL,
		  `value10` 	text 					NOT NULL,
		  `value11` 	text 					NOT NULL,
		  `value12` 	text 					NOT NULL,
		  `value13` 	text 					NOT NULL,
		  `value14` 	text 					NOT NULL,
		  `value15` 	text 					NOT NULL,
		  `link1` 		int(11)					NOT NULL,
		  `link2` 		int(11)					NOT NULL,
		  `link3` 		int(11)					NOT NULL,
		  `link4` 		int(11)					NOT NULL,
		  `link5` 		int(11)					NOT NULL,
		  `link6` 		int(11)					NOT NULL,
		  `link7`		int(11)					NOT NULL,
		  `link8` 		int(11)					NOT NULL,
		  `link9` 		int(11)					NOT NULL,
		  `link10` 		int(11)					NOT NULL,
		  `linklist1`	varchar(255)			NOT NULL,
		  `linklist2` 	varchar(255)			NOT NULL,
		  `linklist3` 	varchar(255) 			NOT NULL,
		  `linklist4` 	varchar(255)			NOT NULL,
		  `linklist5` 	varchar(255)			NOT NULL,
		  `linklist6` 	varchar(255)			NOT NULL,
		  `linklist7`	varchar(255)			NOT NULL,
		  `linklist8` 	varchar(255)			NOT NULL,
		  `linklist9` 	varchar(255) 			NOT NULL,
		  `linklist10`	varchar(255) 			NOT NULL,
		  `php1` 		text 					NOT NULL,
		  `php2` 		text 					NOT NULL,
		  PRIMARY KEY  (`id`)
		) ENGINE=MyISAM  DEFAULT CHARSET=utf8;');
    }
Esempio n. 7
0
 public static function sortTable($table, $sort, $where = '', $select = ['id', 'sort'])
 {
     if ($where) {
         $where = ' WHERE ' . $where;
     }
     $update = new sql();
     $update->setTable($table);
     $i = 1;
     $sql = new sql();
     $sql->query('SELECT `' . $select[0] . '`, `' . $select[1] . '` FROM ' . self::table($table) . $where . ' ORDER BY `' . $select[1] . '` ASC')->result();
     while ($sql->isNext()) {
         if ($sort == $i) {
             $i++;
         }
         $update->addPost($select[1], $i);
         $update->setWhere($select[0] . '=' . $sql->get($select[0]));
         $update->update();
         $sql->next();
         $i++;
     }
 }