Beispiel #1
0
 public static function checkAddon($addons)
 {
     $return = '';
     foreach ($addons as $name => $version) {
         if (is_int($name)) {
             $name = $version;
             $version = false;
         }
         if (isset(rp::get('addons')[$name])) {
             $config = rp::get('addons')[$name];
         }
         if (!isset($config) || !is_array($config)) {
             $return .= sprintf(lang::get('addon_not_found'), $name);
             continue;
         }
         if (!addonConfig::isActive($name)) {
             $return .= sprintf(lang::get('addon_not_install_active'), $name);
             continue;
         }
         if (rp::checkVersion($config['version'], $version) === false) {
             $return .= sprintf(lang::get('addon_need_version'), $name, $version);
             continue;
         }
     }
     if ($return == '') {
         return true;
     } else {
         return $return;
     }
 }
Beispiel #2
0
 public static function add($name, $value, $toSave = false)
 {
     self::$params[$name] = $value;
     if ($toSave) {
         self::$isChange = true;
         self::$newEntrys[$name] = $value;
     }
 }
Beispiel #3
0
 public static function loadAllConfig()
 {
     $addons = [];
     foreach (self::getAll() as $name) {
         $addons[$name] = self::getConfig($name);
     }
     rp::add('addons', $addons);
     return true;
 }
Beispiel #4
0
 public static function replaceControl($game, $array)
 {
     $keys = [];
     $vals = [];
     $emailNot = rp::get('emailNot') ? 'on' : 'off';
     $array = array_merge($array, ['ip' => rp::get('ip'), 'email' => rp::get('email'), 'emailNot' => $emailNot]);
     foreach ($array as $key => $val) {
         $keys[] = '{{' . $key . '}}';
         $vals[] = $val;
     }
     return str_replace($keys, $vals, self::getControl($game));
 }
Beispiel #5
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();
 }
Beispiel #6
0
    echo message::success($success);
}
layout::addNav(lang::get('dashboard'), 'dashboard', 'home', ['refresh'], true);
layout::addNav(lang::get('settings'), 'settings', 'settings', [], false);
layout::addNav(lang::get('server'), 'server', 'list', ['add'], true);
layout::addNav(lang::get('addons'), 'addons', 'alt', [], true);
layout::addNav(lang::get('user'), 'user', 'users', ['add'], true);
foreach (addonConfig::includeAllConfig() as $file) {
    include $file;
}
if (userLogin::isLogged()) {
    $path = 'pages/' . $page . '.php';
    $path = extension::get('PAGE_PATH', $path);
    if (file_exists($path)) {
        include $path;
    } else {
        echo message::danger(lang::get('page_not_found'), false);
    }
}
$content = ob_get_contents();
ob_end_clean();
rp::add('content', $content);
if (ajax::is()) {
    echo ajax::getReturn();
    die;
}
if (userLogin::isLogged()) {
    include dir::layout('index.php', rp::get('layout'));
} else {
    include dir::layout('login.php', rp::get('layout'));
}
Beispiel #7
0
 public static function svg($icon)
 {
     ob_start();
     include dir::layout('icons/' . $icon . '.svg', rp::get('layout'));
     $return = ob_get_contents();
     ob_end_clean();
     return $return;
 }
Beispiel #8
0
<div class="panel">
	<div class="content">
        <div id="terminal">
            <?php 
$SSH = rp::get('SSH');
$host = $SSH['ip'];
$user = $SSH['user'];
$pass = $SSH['password'];
unset($SSH);
$ssh = new ssh($host, $user, $pass);
if (ajax::is()) {
    $test = 1;
} else {
    echo nl2br($ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX));
    $ssh->write("screen -r test123 \n\r");
    $ssh->setTimeout(4);
    $ssh->write("ping google.de \n\r");
}
if (ajax::is()) {
    #$ssh->setTimeout(1);
    #$ssh->write("ping google.de \n\r");
    $ssh->setTimeout(4);
    $ssh->exec("screen -r test123");
    #$return = nl2br($ssh->read('/.*@.*[$|#]/', NET_SSH2_READ_REGEX));
    ajax::addReturn($return);
}
?>
        </div>
    </div>
</div>
Beispiel #9
0
echo lang::get('yes');
?>
</div>
                        </div>
                        
                    </div>
                </div>
            
                <div class="input row">
                    <label class="col-sm-4"><?php 
echo lang::get('email');
?>
</label>
                    <div class="col-sm-8">
                        <input type="text" name="email" value="<?php 
echo rp::get('email');
?>
">
                    </div>
                </div>
                
            </div>
        </div>
        
        <button type="submit" class="mbt15" name="send"><?php 
echo lang::get('apply');
?>
</button>
    
    </div>
                
Beispiel #10
0
$table->addCollsLayout('40%, *');
$table->addSection('tbody');
$table->addRow()->addCell(lang::get('distribution'), ['class' => 'first'])->addCell($host->distribution());
$table->addRow()->addCell(lang::get('firmware'), ['class' => 'first'])->addCell($host->firmware());
$table->addRow()->addCell(lang::get('hostname'), ['class' => 'first'])->addCell($host->hostname());
$table->addRow()->addCell(lang::get('kernel'), ['class' => 'first'])->addCell($host->kernel());
$ethernet = $host->ethernet();
$table->addRow()->addCell(lang::get('ethernet'), ['class' => 'first'])->addCell('Up: ' . byteToSize($ethernet['up']) . ' / Down: ' . byteToSize($ethernet['down']));
echo $table->show();
?>
            </div>
        </div>
    
    </div>
    
    <div class="col-lg-4 col-md-5">
    
    	<h2><?php 
echo lang::get('latest_blog');
?>
</h2>
    
        <div class="timeline">
            <?php 
echo rp::getBlog();
?>
        </div>
    
    </div>

</div>
Beispiel #11
0
lang::setDefault();
lang::setLang(rp::get('lang'));
$page = type::super('page', 'string', 'lang');
$action = type::super('action', 'string');
$lang = type::super('lang', 'string');
$id = type::super('id', 'int');
if ($lang) {
    lang::setLang($lang);
    rp::add('lang', $lang, true);
    rp::save();
}
$success = type::get('success', 'string');
$error = type::get('error', 'string');
if (!is_null($error)) {
    echo message::danger($error);
} elseif (!is_null($success)) {
    echo message::success($success);
}
$path = 'pages/' . $page . '.php';
if (file_exists($path)) {
    include $path;
} else {
    echo message::danger(lang::get('page_not_found'), false);
}
$content = ob_get_contents();
ob_end_clean();
layout::addNav(lang::get('choose_lang'), 'lang', '', [], true);
rp::add('content', $content);
include 'inc/head.php';
echo rp::get('content');
include 'inc/foot.php';
Beispiel #12
0
     $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 {
             foreach ($ids as $var) {
                 $sql = new sql();
                 $sql->setTable('user');
                 $sql->setWhere("id=" . $var);
                 $sql->delete();
             }
             echo message::success(lang::get('user_deleted'));
         }
     } else {
         echo message::danger(lang::get('choose_user'));
     }
 }
 $table = new table();
Beispiel #13
0
    $DB = rp::get('DB');
    sql::connect($DB['host'], $DB['user'], $DB['password'], $DB['database']);
    unset($DB);
    $sql = new sql();
    $salt = userLogin::generateSalt();
    $sql->setTable('user');
    $sql->addPost('firstname', type::post('firstname'));
    $sql->addPost('name', type::post('name'));
    $sql->addPost('username', type::post('username'));
    $sql->addPost('email', type::post('email'));
    $sql->addPost('password', userLogin::hash(type::post('password'), $salt));
    $sql->addPost('salt', $salt);
    $sql->addPost('admin', 1);
    $sql->save();
    rp::add('setup', false, true);
    rp::save();
    header('Location: ?page=finish');
    exit;
}
?>
        
            <div class="input row">
            	<label class="col-sm-4"><?php 
echo lang::get('firstname');
?>
</label>
            	<div class="col-sm-8">
            		<input type="text" name="firstname" value="<?php 
echo type::post('firstname');
?>
">
Beispiel #14
0
 public function getPosts($post)
 {
     if (!is_array($post) && rp::get('debug')) {
         throw new InvalidArgumentException(__CLASS__ . '::' . __METHOD__ . ' ertwartet als 1. Parameter ein array');
     }
     foreach ($post as $val => $cast) {
         $this->values[$val] = $this->escape(type::post($val, $cast, ''));
     }
     return $this;
 }
Beispiel #15
0
    $host = type::post('host');
    $user = type::post('user');
    $password = type::post('password');
    $database = type::post('database');
    $prefix = type::post('prefix');
    ob_start();
    $sqlCheck = sql::connect($host, $user, $password, $database);
    $error = ob_get_contents();
    ob_end_clean();
    if ($sqlCheck) {
        echo message::danger(lang::get('db_not_correct') . ' - <small>' . lang::get('show_errors') . '</small>', false);
    } else {
        $DB = ['host' => $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix];
        rp::add('DB', $DB, true);
        rp::save();
        $DB = rp::get('DB');
        sql::connect($DB['host'], $DB['user'], $DB['password'], $DB['database']);
        unset($DB);
        $sql = new sql();
        $sql->query('DROP TABLE IF EXISTS `' . sql::table('addons') . '`');
        $sql->query('CREATE TABLE `' . sql::table("addons") . '` (
							`id` int(11) unsigned NOT NULL,
							`name` varchar(255) NOT NULL,
							`active` int(1) NOT NULL,
							`install` int(1) NOT NULL
							) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
        $sql = new sql();
        $sql->query('DROP TABLE IF EXISTS `' . sql::table('server') . '`');
        $sql->query('CREATE TABLE `' . sql::table("server") . '` (
							`id` int(11) NOT NULL,
							`gameID` varchar(255) NOT NULL,