Exemplo n.º 1
0
 public static function getposition($array)
 {
     $loc = Database::GetOne("config", array('mod' => 'locations'));
     $tchar = Database::GetOne("characters", array('_id' => toId($_SESSION['cid'])));
     $answer = json_encode(array('answer' => '1', 'loc' => $tchar['map'], 'map' => $loc[$tchar['map']]['map'], 'x' => $tchar['pos_x'], 'y' => $tchar['pos_y'], 'dir' => $tchar['dir'], 'skin' => $tchar['skin']));
     return $answer;
 }
Exemplo n.º 2
0
 function actionIndex()
 {
     if (!isset($_SESSION['id'])) {
         header("Location: /");
         die;
     }
     if (!isset($_SESSION['cid'])) {
         header("Location: /cabinet");
         die;
     }
     $main = new Templater();
     $main->import("interface/game.tpl");
     $main->setvar("%URL%", "http://" . $GLOBALS['url']);
     $main->setvar("%STORAGE_TPL_URL%", "/storage/tpl");
     $main->setvar("%YEAR%", date("Y"));
     $main->setvar("%CSS%", "<style>" . templater("css/game.css", array("%ROOT%" => "/storage/tpl")) . "</style>");
     $main->setvar("%GAME_TITLE%", $GLOBALS['name']);
     $main->setvar("%STORAGE_STATIC_URL%", "/storage/static");
     $GLOBALS['current_loc_info'] = Database::GetOne("config", array("mod" => "locations"))[char()->map];
     if (!isset($GLOBALS['current_loc_info']['type']) or $GLOBALS['current_loc_info']['type'] == 'default') {
         $main->setvar("%GUI%", template("interface/GUI.tpl"));
     } else {
         $GLOBALS['current_loc_type_info'] = Database::GetOne("config", array("mod" => "location_types"))[$GLOBALS['current_loc_info']['type']];
         require_once MODS_ROOT . SEPARATOR . $GLOBALS['current_loc_type_info']['module'] . SEPARATOR . "location_type.php";
         $main->setvar("%GUI%", isset($GLOBALS['to_gui']) ? $GLOBALS['to_gui'] : '');
     }
     $main->setvar("%CHATBOX%", template("boxes/chat.tpl"));
     $main->renderEcho();
 }
 public function read($id)
 {
     $data = Database::GetOne("sessions", array("sess_id" => $id));
     if (is_array($data)) {
         Database::Edit("sessions", array("sess_id" => $id), array("sess_id" => $id, "time" => time()));
         return $data['data'];
     } else {
         Database::Insert("sessions", array("sess_id" => $id, "time" => time()));
         return "";
     }
 }
Exemplo n.º 4
0
 public function actionIndex()
 {
     $article = Database::GetOne('wiki_pages', array('type' => 'main'));
     //$side_menu = Database::GetOne('wiki_side_menu',array('status' => 1));
     $tpl = new Templater();
     $tpl->import('wiki/wiki.tpl');
     $tpl->setvar('%GAME_TITLE%', $GLOBALS['name']);
     $tpl->setvar("%YEAR%", date("Y"));
     $tpl->setvar("%CONTENT%", $article['content']);
     $tpl->setvar("%SIDE_MENU%", 'Тут будет кастомное меню');
     $tpl->renderEcho();
 }
Exemplo n.º 5
0
 function actionRead()
 {
     $main = new Templater();
     $main->import("interface/news_list.tpl");
     $main->setvar("%URL%", "http://" . $GLOBALS['url']);
     $main->setvar("%STORAGE_TPL_URL%", "/storage/tpl");
     $main->setvar("%YEAR%", date("Y"));
     $main->setvar("%GAME_TITLE%", $GLOBALS['name']);
     $main->setvar("%STORAGE_STATIC_URL%", "/storage/static");
     $array = Database::GetOne("news", array('_id' => toId($_GET['id'])));
     $html = templater("interface/news_full.tpl", array("%SUBJECT%" => $array['title'], "%DATE%" => $array['date'], "%ANNOUNCE%" => $array['short'], "%TEXT%" => $array['full'], "%ID%" => $array['_id']));
     $main->setvar("%CONTENT%", $html);
     $main->renderEcho();
 }
Exemplo n.º 6
0
 function actionIndex()
 {
     if (!isset($char)) {
         $char = new Char();
     }
     $currency = Database::GetOne("config", array("mod" => "currency"));
     $inv_params = Database::GetOne("config", array("mod" => "inv_params"));
     $inv_actions = Database::GetOne("config", array("mod" => "inv_actions"));
     $main = new Templater();
     $main->import("boxes/inv_page.tpl");
     $main->setvar("%URL%", "http://" . $GLOBALS['url']);
     $main->setvar("%STORAGE_TPL_URL%", "/storage/tpl");
     $main->setvar("%YEAR%", date("Y"));
     $main->setvar("%CSS%", "<style>" . templater("css/game.css", array("%ROOT%" => "/storage/tpl")) . "</style>");
     $main->setvar("%GAME_TITLE%", $GLOBALS['name']);
     $main->setvar("%STORAGE_STATIC_URL%", "/storage/static");
     $result = '';
     foreach ($char->inv->getItems() as $key => $value) {
         if (!is_array($value)) {
             continue;
         }
         $addparams = array("%NAME%" => $value['name'], "%IMG%" => $value['image'], "%COST%" => $value['cost'], "%COUNT%" => $value['count'], "%C_NAME%" => $currency[$value['currency']]['name'], "%C_IMG%" => $currency[$value['currency']]['img'], "%CAT%" => $value['cat']);
         $id = $key;
         foreach ($inv_params as $skey => $svalue) {
             if (!strstr($skey, "p_")) {
                 continue;
             }
             $addparams["%" . $skey . "%"] = $char->inv->getParam($skey, $key);
             $addparams['%_PARAMS_%'] .= "<tr><td>" . $inv_params[$skey]['name'] . "</td><td>" . $char->inv->getParam($skey, $key) . "</td></tr>";
         }
         foreach ($inv_actions as $skey => $svalue) {
             if (!strstr($skey, "act_")) {
                 continue;
             }
             if (eval($svalue['eval'])) {
                 $addparams["%_SCR_ACTIONS_%"][] = "<a href='?act=" . $skey . "&id=" . $id . "'>" . $svalue['name'] . "</a>";
                 if ($_GET['act'] == $skey and $_GET['id'] == $id) {
                     call_user_func("UseItem", $skey, $id);
                 }
             }
         }
         $addparams["%_SCR_ACTIONS_%"] = isset($addparams["%_SCR_ACTIONS_%"]) ? implode(" / ", $addparams["%_SCR_ACTIONS_%"]) : '';
         $result .= templater("boxes/inv_list.tpl", $addparams);
     }
     $main->setvar("%CONTENT%", $result);
     $main->renderEcho();
 }
Exemplo n.º 7
0
 function actionMakechar()
 {
     $error = '';
     if (isset($_POST['name'])) {
         $maxchars = Database::GetOne("config", array("mod" => "auth"))['maxchars'];
         $chars = Database::Get("characters", array("player" => $_SESSION['id']))->count();
         if ($chars >= $maxchars) {
             echo "Исчерпан лимит персонажей на одного игрока (" . $maxchars . ")";
         } else {
             $id = Char::create(array("name" => $_POST['name'], "gender" => $_POST['gender'], "about" => $_POST['about']));
             if ($id != false) {
                 header("Location: /");
             } else {
                 $error = "Персонаж уже существует";
             }
         }
     }
 }
Exemplo n.º 8
0
 function actionRegister()
 {
     if (Database::GetOne("config", array("mod" => "auth"))['allowRegister'] == 0 and $_SESSION['invited'] !== true) {
         echo "<script>alert('Регистрация закрыта'); window.location = '/';</script>";
         die;
     }
     if ($res = Player::register($_POST['login'], $_POST['password'], $_POST['email'])) {
         $_SESSION['id'] = $res;
         if ($_SESSION['invited'] === true) {
             $_SESSION['invited'] = false;
         }
         call_user_func("onPlayerRegister", $_POST['login'], $_POST['password'], $_POST['email']);
         @header("Location: /cabinet");
         die("<script>location.href = '/cabinet';</script>");
     } else {
         @header("Location: /index?result=regerror");
         die("<script>location.href = '/index?result=regerror';</script>");
     }
 }
Exemplo n.º 9
0
 function __call($func, $args)
 {
     $func = str_replace("action", "", $func);
     if ($func != 'index') {
         $array = Database::GetOne("characters", array("name" => $func));
     } else {
         $array = Database::GetOne("characters", array("_id" => toId($_SESSION['cid'])));
         $func = $array['name'];
     }
     if (!isset($array['name'])) {
         die("<h1>Персонаж " . $func . " не найден</h1>");
     }
     $params = Database::GetOne("config", array("mod" => "params"));
     $main = new Templater();
     $main->import("interface/playerinfo.tpl");
     $main->setvar("%URL%", "http://" . $GLOBALS['url']);
     $main->setvar("%STORAGE_TPL_URL%", "/storage/tpl");
     $main->setvar("%YEAR%", date("Y"));
     $main->setvar("%CSS%", "<style>" . templater("css/game.css", array("%ROOT%" => "/storage/tpl")) . "</style>");
     $main->setvar("%GAME_TITLE%", $GLOBALS['name']);
     $main->setvar("%STORAGE_STATIC_URL%", "/storage/static");
     $main->setvar("%GUI%", template("interface/GUI.tpl"));
     $main->setvar("%CHATBOX%", template("boxes/chat.tpl"));
     $params_all = '';
     foreach ($array as $key => $value) {
         if (MongoReserved($key) or MongoReserved($value) or strstr($key, "p_")) {
             continue;
         }
         $main->setvar("%" . $key . "%", $array[$key]);
     }
     foreach ($params as $key => $value) {
         if (!strstr($key, "p_")) {
             continue;
         }
         $v = char(__toString($array['_id']))->getParam($key);
         $main->setvar("%" . $key . "%", $v);
         $params_all .= '<p><b>' . $value['name'] . '</b>: ' . $v . '</p>';
     }
     $main->setvar("%PARAMS_ALL%", $params_all);
     $main->renderEcho();
 }
Exemplo n.º 10
0
 public static function login($login, $password, $session = true)
 {
     if (empty($login)) {
         raptor_warning("Trying to login player with no login");
     }
     if (empty($password)) {
         raptor_warning("Trying to login player with no password");
     }
     $data = Database::GetOne("config", array("mod" => "auth"))['authType'];
     $check = Database::GetOne("players", array($data => $login, "password" => md5($password)));
     if (empty($check['login'])) {
         return false;
     } else {
         if ($session === true) {
             $_SESSION['id'] = $check['_id']->__toString();
         }
         Database::Edit("players", array("_id" => $check['_id']), array("last_ip" => $_SERVER['REMOTE_ADDR'], "last_date" => raptor_date()));
         return $check['_id'];
     }
     call_user_func("onPlayerLogin", $_POST['name']);
 }
Exemplo n.º 11
0
 function actionIndex()
 {
     $char = new Char();
     $params = Database::GetOne("config", array("mod" => "currency"));
     $main = new Templater();
     $main->import("boxes/money_page.tpl");
     $main->setvar("%URL%", "http://" . $GLOBALS['url']);
     $main->setvar("%STORAGE_TPL_URL%", "/storage/tpl");
     $main->setvar("%YEAR%", date("Y"));
     $main->setvar("%CSS%", "<style>" . templater("game.css", array("%ROOT%" => "/storage/tpl")) . "</style>");
     $main->setvar("%GAME_TITLE%", $GLOBALS['name']);
     $main->setvar("%STORAGE_STATIC_URL%", "/storage/static");
     $result = '';
     foreach ($params as $key => $value) {
         if (!is_array($value)) {
             continue;
         }
         $result .= templater("boxes/money_list.tpl", array("%NAME%" => $value['name'], "%IMG%" => $value['img'], "%COUNT%" => $char->{$key}));
     }
     $main->setvar("%CONTENT%", $result);
     $main->renderEcho();
 }
Exemplo n.º 12
0
 function actionIndex()
 {
     $char = new Char();
     $params = Database::GetOne("config", array("mod" => "mod_paidservice"));
     $main = new Templater();
     $main->import("boxes/ps_page.tpl");
     $main->setvar("%URL%", "http://" . $GLOBALS['url']);
     $main->setvar("%STORAGE_TPL_URL%", "/storage/tpl");
     $main->setvar("%YEAR%", date("Y"));
     $main->setvar("%CSS%", "<style>" . templater("css/game.css", array("%ROOT%" => "/storage/tpl")) . "</style>");
     $main->setvar("%GAME_TITLE%", $GLOBALS['name']);
     $main->setvar("%STORAGE_STATIC_URL%", "/storage/static");
     $result = '';
     if (isset($_GET['buy'])) {
         if (!isset($params[$_GET['buy']]['time'])) {
             $main->setvar("%CONTENT%", "<h2>Услуга не найдена</h2>");
             $main->renderEcho();
             return 1;
         }
         if ($char->{$params}[$_GET['buy']]['currency'] < $params[$_GET['buy']]['cost']) {
             $main->setvar("%CONTENT%", "<h2>Недостаточно денег</h2>");
             $main->renderEcho();
             return 1;
         }
         $char->giveMoney(-$params[$_GET['buy']]['cost'], $params[$_GET['buy']]['currency']);
         eval($params[$_GET['buy']]['eval_bought']);
         createTimer($_GET['buy'], $params[$_GET['buy']]['time'], $params[$_GET['buy']]['eval_expired']);
     }
     foreach ($params as $key => $value) {
         if (!is_array($value)) {
             continue;
         }
         $result .= templater("boxes/ps_list.tpl", array("%ID%" => $key, "%NAME%" => $value['name'], "%COST%" => $value['cost'], "%TIME%" => $value['time'], "%CURRENCY%" => Database::GetOne("config", array("mod" => "currency"))[$value['currency']]['name'], "%TIME%" => $value['time']));
     }
     $main->setvar("%CONTENT%", $result);
     $main->renderEcho();
 }
Exemplo n.º 13
0
    if (isset($_POST['name'])) {
        Database::Edit("config", array("mod" => "inv_params"), array($_GET['edit'] => $_POST));
        echo '<div class="alert alert-success">Параметр <b>' . $_GET['edit'] . '</b> успешно отредактирован</div>';
    }
    $param = Database::GetOne("config", array("mod" => "inv_params"))[$_GET['edit']];
    echo '<form action="" method="POST">
		<div class="form-group"><label for="disabledSelect">Код параметра</label><input class="form-control" id="disabledInput" placeholder="' . $_GET['edit'] . '" disabled="" type="text"></div>
		<div class="form-group"><label>Название параметра</label><input name="name" value="' . $param['name'] . '" class="form-control"><p class="help-block">Название, отображаемое игрокам</p></div>
		<div class="form-group"><label>Название параметра на английском</label><input name="name_en" value="' . $param['name_en'] . '" class="form-control"></div>
		<div class="form-group"><label>Тип параметра</label><select name="type" onchange="if (this.selectedIndex == 3) document.getElementById(\'script_text\').style.display = \'block\'" class="form-control"><option value="int" ' . ($param['type'] == 'int' ? 'selected' : '') . '>Целое число</option><option value="float" ' . ($param['type'] == 'float' ? 'selected' : '') . '>Дробное число</option><option ' . ($param['type'] == 'str' ? 'selected' : '') . ' value="str">Строка</option><option ' . ($param['type'] == 'id' ? 'selected' : '') . ' value="id">ID персонажа</option><option ' . ($param['type'] == 'script' ? 'selected' : '') . ' value="script" >Формула (скриптовое выражение)</option></select></div>
		<div class="form-group" style="display: ' . ($param['type'] == 'script' ? 'block' : 'none') . ';" id="script_text"><label>Формула</label><input name="script" value="' . $param['script'] . '" class="form-control"><p class="help-block">PHP-код. Переменная $char - объект с персонажем, $inv - с инвентарём. Пример использования: <b>return $char->name;</b></p></div>
		<button type="submit" class="btn btn-default">Сохранить</button>
		</form>';
} else {
    echo '<div class="container-fluid"><h2>Параметры предметов</h2>
	<h5>Различные характеристики предметов</h5>
	<br>
	<form method="POST">
	<p><input name="name" value="p_" type="text"></p>
	<p><button name="new" type="submit" value="1" class="btn btn-xs btn-default">Создать параметр</button></p>
	</form>
	<hr><div class="table-responsive">
	<table class="table table-hover table-striped"><tbody>';
    foreach (Database::GetOne("config", array("mod" => "inv_params")) as $key => $value) {
        if (!strstr($key, "p_")) {
            continue;
        }
        echo "<tr><td> <b><font size=3>" . $value['name'] . "</font></b> </td> <td> <b><font size=3>" . $key . "</font></b> </td> <td> <a href='?edit=" . $key . "'>Редактировать</a> </td></tr>";
    }
    echo '</tbody></table>';
}
Exemplo n.º 14
0
<?php

if (isset($_POST['edit'])) {
    Database::Edit('wiki_pages', array('content' => $_POST['edit']));
}
if (isset($_POST['add'])) {
    if ($_POST['type'] == true) {
        $type = 'main';
    } else {
        $type = 'default';
    }
    Database::Insert('wiki_pages', array('content' => $_POST['add'], 'type' => 'default', 'title' => $_POST['title'], 'alias' => $_POST['alias'], 'type' => $type));
}
if (isset($_GET['edit'])) {
    $content = Database::GetOne('wiki_pages', array('alias' => $_GET['edit']));
    echo "<form action='' method='POST'>\n        <input type='hidden' name='file' value='" . $_GET['edit'] . "'>\n\t\t<label for='page_type'>Тип страницы</label>\n\t\t<input id='page_type' type='radio' name='type'>\n        <textarea rows=15 cols=105 name='edit'>" . $content['content'] . "</textarea> <br>\n        <button type='submit' class='btn btn-default'>Сохранить</button>\n        </form>\n        <hr>";
} else {
    echo "";
}
if (isset($_GET['remove'])) {
    $content = Database::Remove('wiki_pages', array('alias' => $_GET['remove']));
} else {
    echo "";
}
if (isset($_GET['add'])) {
    echo "<form action='' method='POST'>\n        <label for='title'>Название страницы</label>\n\t\t<input id='title' type='text' style='width:635px;' name='title'><br>\n\t\t<label for='page_type'>Избранное</label>\n\t\t<input id='page_type' type='radio' name='type'><br>\n        <label for='title'>Алиас (только английские буквы)</label>\n        <input id='title' type='text' style='width:513px;' name='alias'><br>\n        <textarea rows=15 cols=105 name='add'></textarea> <br>\n        <button type='submit' class='btn btn-success'>Добавить</button>\n        </form>\n        <hr>";
} else {
    echo "";
}
?>
<h2>Страницы</h2>
Exemplo n.º 15
0
<h2>Права доступа</h2>
<h4>Здесь можно настроить права доступа для любого игрока. Обратите внимания, что наименования прав доступа - это разделы админ-панели, к которым имеет доступ игрок</h4>

<?php 
if (isset($_POST['submit'])) {
    unset($_POST['submit']);
    $astack = array("perms" => array_keys($_POST));
    Database::Edit("characters", array("name" => $_GET['name']), $astack);
    echo '<div class="alert alert-success">Права доступа изменены успешно</div>';
}
if (isset($_GET['name'])) {
    $chara = Database::GetOne("characters", array("name" => $_GET['name']));
    if (!isset($chara['_id'])) {
        echo '<div class="alert alert-danger">Персонаж не найден</div>';
    } else {
        $skip = array('.', '..', '.htaccess', '.conf', 'header.inc.php', 'footer.inc.php');
        $files = scandir(ADMIN_ROOT);
        $stack = $chara['perms'];
        echo '<div class="table-responsive">
                      <table class="table table-bordered table-hover table-striped">
                      <thead>
                      <tr>
                          <td>Наименование</td>
                          <td></td>
                      </tr>
                      </thead>
                      <tbody>';
        foreach ($files as $file) {
            if (!in_array($file, $skip)) {
                $file = str_replace(".php", "", $file);
                $value = in_array($file, $stack) ? 'checked' : '';
Exemplo n.º 16
0
<?php

if (isset($_GET['name'])) {
    $char = Database::GetOne("characters", array("name" => $_GET['name']));
    if (isset($char['_id'])) {
        echo '<div class="alert alert-success"><strong>Персонаж найден</strong><br>';
        foreach ($char as $key => $value) {
            echo "<p>" . $key . " = " . $value . "</p>";
        }
        echo '<p><a href="/admin/char?id=' . $char['_id'] . '">Открыть управление персонажем</a></p>
            </div>';
    } else {
        echo '<div class="alert alert-danger">Персонаж не найден</div>';
    }
    $player = Database::GetOne("players", array("login" => $_GET['name']));
    if (isset($player['_id'])) {
        echo '<div class="alert alert-success"><strong>Игрок найден</strong><br>';
        foreach ($player as $key => $value) {
            echo "<p>" . $key . " = " . $value . "</p>";
        }
        echo '<p><a href="/admin/player?id=' . $player['_id'] . '">Открыть управление игроком</a></p>
            </div>';
    } else {
        echo '<div class="alert alert-danger">Игрок не найден</div>';
    }
}
?>
<form role="form" method="GET">
    <div class="form-group input-group">
        <input class="form-control" value="<?php 
echo $_GET['name'];
Exemplo n.º 17
0
<link href="/storage/admin/scredit.css" rel="stylesheet">
<script src="/storage/admin/scredit.js"></script>

<h2>Скрипты</h2>
<h5>Здесь вы можете редактировать PHP скрипты. Для изменения Javascript используйте <a href='/admin/scredit'>JS SCREdit</a></h5>
<br>
<hr>

<?php 
if (isset($_POST['file'])) {
    Database::Edit('scripts', array('name' => $_POST['file']), array('code' => base64_encode($_POST['edit'])));
    Cache::set("script_" . $_POST['file'], base64_encode($_POST['edit']), 86400);
    echo '<div class="alert alert-success">Скрипт успешно отредактирован. Кэш обновлен.</div>';
}
if (isset($_GET['edit'])) {
    $content = isset($_POST['edit']) ? $_POST['edit'] : base64_decode(Database::GetOne('scripts', array('name' => $_GET['edit']))['code']);
    echo "<form action='' method='POST'>\n        <input type='hidden' name='file' value='" . $_GET['edit'] . "'>\n        <textarea rows=15 cols=105 name='edit'>" . $content . "</textarea> <br>\n        <button type='submit' class='btn btn-default'>Сохранить</button>\n        </form>\n        <hr>";
}
?>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
    <td>Скрипт</td>
    <td></td>
</tr>
</thead>
<tbody>

<?php 
$files = Database::GetAll('scripts');
Exemplo n.º 18
0
<?php

if (empty($_GET['id'])) {
    $_GET['id'] = $_SESSION['id'];
}
if (isset($_POST['change'])) {
    unset($_POST['change']);
    Database::Edit("players", array("_id" => toId($_GET['id'])), $_POST);
}
if (isset($_POST['make'])) {
    Database::Edit("players", array("_id" => toId($_GET['id'])), array($_POST['name'] => 0));
}
if (isset($_POST['notes'])) {
    Database::Edit("players", array("_id" => toId($_GET['id'])), array("notes" => $_POST['notes']));
}
$char = Database::GetOne("players", array("_id" => toId($_GET['id'])));
if (empty($char['_id'])) {
    echo '<div class="alert alert-danger">Игрок не найден</div>';
    die;
}
?>


<div class="row">
    <div class="col-sm-4">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">Поля базы данных</h3>
            </div>
            <div class="panel-body">
<?php 
Exemplo n.º 19
0
    $param = Database::GetOne("config", array("mod" => "location_types"))[$_GET['edit']];
    echo '<form action="" method="POST">
		<div class="form-group"><label for="disabledSelect">ID типа</label><input class="form-control" id="disabledInput" placeholder="' . $_GET['edit'] . '" disabled="" type="text"></div>
		<div class="form-group"><label>Название типа</label><input name="name" value="' . $param['name'] . '" class="form-control"><p class="help-block">Название, отображаемое игрокам</p></div>
		<div class="form-group"><label>Название услуги на английском</label><input name="name_en" value="' . $param['name_en'] . '" class="form-control"></div>
		<div class="form-group"><label>Модуль системы</label>
		<select name="module" class="form-control">';
    foreach ($GLOBALS['modules'] as $mod) {
        echo '<option ' . ($param['module'] == $mod ? 'selected' : '') . ' value="' . $mod . '">' . $mod . '</option>';
    }
    echo '</select></div>
		<button type="submit" class="btn btn-default">Сохранить</button>
		</form>';
} else {
    echo '<div class="container-fluid"><h2>Типы локаций</h2>
			<h5>Здесь можно настраивать типы локаций (например: текстовые, RPG.JS, Canvas, Unity, Flash). Для нормальной работы требуется отдельный модуль.</h5>
			<br>
			<form method="POST">
			<p><input name="name" value="" type="text"></p>
			<p><button name="new" type="submit" value="1" class="btn btn-xs btn-default">Создать тип</button></p>
			</form>
			<hr><div class="table-responsive">
			<table class="table table-hover table-striped"><tbody>';
    foreach (Database::GetOne("config", array("mod" => "location_types")) as $key => $value) {
        if (!is_array($value)) {
            continue;
        }
        echo "<tr><td> <b><font size=3>" . $value['name'] . "</font></b> </td> <td> <b><font size=3>" . $key . "</font></b> </td> <td> <a href='?edit=" . $key . "'>Редактировать</a> </td></tr>";
    }
    echo '</tbody></table>';
}
Exemplo n.º 20
0
function onMessage($connect, $data)
{
    $f = explode(";", decode($data)['payload']);
    if (!is_array($f)) {
        $f = array($f);
    }
    $answer = array();
    if ($f[0] == "sid" and isset($f[1])) {
        $GLOBALS['connects'][$f[1]] = $connect;
        $sid = $f[1];
        $GLOBALS['sess_data'][$f[1]] = Database::GetOne('sessions', array('sess_id' => $sid))['array'];
        $char_array = Database::GetOne('characters', array('_id' => toId($GLOBALS['sess_data'][$f[1]]['cid'])));
        $GLOBALS['sess_data'][$f[1]]['name'] = $char_array['name'];
        $GLOBALS['sess_data'][$f[1]]['player'] = $char_array['player'];
        $GLOBALS['sess_data'][$f[1]]['x'] = $char_array['x'];
        $GLOBALS['sess_data'][$f[1]]['y'] = $char_array['y'];
        $GLOBALS['sess_data'][$f[1]]['dir'] = $char_array['dir'];
        $GLOBALS['sess_data'][$f[1]]['online'] = $char_array['online'];
        $GLOBALS['sess_data'][$f[1]]['map'] = $char_array['map'];
        $GLOBALS['sess_data'][$f[1]]['skin'] = $char_array['skin'];
        $GLOBALS['sess_data'][$f[1]]['_id'] = $GLOBALS['sess_data'][$f[1]]['cid'];
    } elseif ($sid = array_search($connect, $GLOBALS['connects'])) {
    }
    $answer = apply_ws_query($connect, $sid, $f);
    fwrite($connect, encode(trim(json_encode($answer, JSON_UNESCAPED_UNICODE), "")));
}
Exemplo n.º 21
0
		<button type="submit" class="btn btn-default">Сохранить</button>
		</form>';
} else {
    echo '<h2>Валюты</h2>
		<h5>Различные игровые валюты</h5>
		<br>
		<form method="POST">
		<p><input name="name" value="money_" type="text"></p>
		<p><button name="new" type="submit" value="1" class="btn btn-xs btn-default">Создать валюту</button></p>
		</form>
		<hr>
		<div class="table-responsive">
		<hr><table class="table table-bordered table-hover table-striped">
		<thead>
		<tr>
			<td>Название</td>
			<td>Код</td>
			<td></td>
		</tr>
		</thead>
		<tbody>';
    foreach (Database::GetOne("config", array("mod" => "currency")) as $key => $value) {
        if (!strstr($key, "money_")) {
            continue;
        }
        echo "<tr><td> <b><font size=3>" . $value['name'] . "</font></b> </td> <td> <b><font size=3>" . $key . "</font></b> </td> <td> <a href='?edit=" . $key . "'>Редактировать</a> </td></tr>";
    }
    echo '</tbody>
		</table>
		</div>';
}
Exemplo n.º 22
0
            continue;
        }
        echo '<div class="form-group"><label>' . $value['name'] . '</label><input name="' . $key . '" value="' . $param[$key] . '" class="form-control"></div>';
    }
    echo '<button type="submit" class="btn btn-default">Сохранить</button></form>';
} else {
    echo '<h2>Предметы</h2>
		<h5>Различные предметы инвентаря</h5>
		<br>
		<form method="POST">
		<p><input name="name" value="Наименование" type="text"></p>
		<p><button name="new" type="submit" value="1" class="btn btn-xs btn-default">Создать предмет</button></p>
		</form>
		<hr><div class="table-responsive"><table class="table table-bordered table-hover table-striped">
		<thead>
		<tr>
			<td>Название</td>
			<td>ID</td>
			<td></td>
		</tr>
		</thead>
		<tbody>';
    $inv = Database::GetOne("config", array('mod' => 'inventory'));
    foreach ($inv as $key => $value) {
        if (!is_array($value)) {
            continue;
        }
        echo "<tr><td> <b><font size=3>" . $value['name'] . "</font></b> </td> <td> <b><font size=3>" . $key . "</font></b> </td> <td> <a href='?edit=" . $key . "'>Редактировать</a> </td></tr>";
    }
    echo base64_decode('PC90Ym9keT4NCjwvdGFibGU+DQo8L2Rpdj4=');
}
Exemplo n.º 23
0
<?php 
if (isset($_POST['new'])) {
    Database::Edit("config", array("mod" => "char_actions"), array("mod" => "char_actions", $_POST['name'] => array()));
    echo '<div class="alert alert-success">Действие <b>' . $_POST['name'] . '</b> успешно создано</div>';
}
if (isset($_GET['edit'])) {
    if (isset($_POST['name'])) {
        Database::Edit("config", array("mod" => "char_actions"), array($_GET['edit'] => $_POST));
        echo '<div class="alert alert-success">Действие <b>' . $_GET['edit'] . '</b> успешно отредактировано</div>';
    }
    $param = Database::GetOne("config", array("mod" => "char_actions"))[$_GET['edit']];
    echo '<form action="" method="POST">
		<div class="form-group"><label for="disabledSelect">Код действия</label><input class="form-control" id="disabledInput" placeholder="' . $_GET['edit'] . '" disabled="" type="text"></div>
		<div class="form-group"><label>Название действия</label><input name="name" value="' . $param['name'] . '" class="form-control"><p class="help-block">Название, отображаемое игрокам</p></div>
		<button type="submit" class="btn btn-default">Сохранить</button>
		</form>';
} else {
    raptor_print('PGg1PtCg0LDQt9C70LjRh9C90YvQtSDQtNC10LnRgdGC0LLQuNGPINC90LDQtCDQv9C10YDRgdC+0L3QsNC20LDQvNC4PC9oNT4NCjxicj4NCtCX0LTQtdGB0Ywg0LLRiyDQvNC+0LbQtdGC0LUg0L7RgtGA0LXQtNCw0LrRgtC40YDQvtCy0LDRgtGMINC00LXQudGB0YLQstC40Y8sINC60L7RgtC+0YDRi9C1INC80L7QttC10YIg0YHQvtCy0LXRgNGI0LDRgtGMINC+0LTQuNC9INC/0LXRgNGB0L7QvdCw0LYg0L3QsNC0INC00YDRg9Cz0LjQvCAo0L3QsNC/0YDQuNC80LXRgDog0L3QsNC/0LDRgdGC0YwsINC+0YLQv9GA0LDQstC40YLRjCDRgdC+0L7QsdGJ0LXQvdC40LUpDQo8Zm9ybSBtZXRob2Q9IlBPU1QiPg0KPHA+PGlucHV0IG5hbWU9Im5hbWUiIHZhbHVlPSJhY3RfIiB0eXBlPSJ0ZXh0Ij48L3A+DQo8cD48YnV0dG9uIG5hbWU9Im5ldyIgdHlwZT0ic3VibWl0IiB2YWx1ZT0iMSIgY2xhc3M9ImJ0biBidG4teHMgYnRuLWRlZmF1bHQiPtCh0L7Qt9C00LDRgtGMINC00LXQudGB0YLQstC40LU8L2J1dHRvbj48L3A+DQo8L2Zvcm0+DQo8aHI+DQo8ZGl2IGNsYXNzPSJ0YWJsZS1yZXNwb25zaXZlIj48dGFibGUgY2xhc3M9InRhYmxlIHRhYmxlLWJvcmRlcmVkIHRhYmxlLWhvdmVyIHRhYmxlLXN0cmlwZWQiPg0KPHRoZWFkPg0KPHRyPg0KICAgIDx0ZD7QndCw0LfQstCw0L3QuNC1PC90ZD4NCgk8dGQ+0JrQvtC0PC90ZD4NCiAgICA8dGQ+PC90ZD4NCjwvdHI+DQo8L3RoZWFkPg==');
    foreach (Database::GetOne("config", array("mod" => "char_actions")) as $key => $value) {
        if (!strstr($key, "act_")) {
            continue;
        }
        echo "<tr><td> <b><font size=3>" . $value['name'] . "</font></b> </td> <td> <b><font size=3>" . $key . "</font></b> </td> <td> <a href='?edit=" . $key . "'>Редактировать</a> </td></tr>";
    }
    raptor_print('PC90Ym9keT4NCjwvdGFibGU+DQo8L2Rpdj4=');
}
Exemplo n.º 24
0
 function __construct()
 {
     $mods = Database::GetOne("config", array("active" => '1'));
     $this->list = is_array($mods['modules']) ? $mods['modules'] : array();
     $this->saveOnDestruct = false;
 }
Exemplo n.º 25
0
<?php 
if (isset($_POST['mod'])) {
    Database::Edit("config", array("mod" => "locations"), $_POST);
    foreach ($_POST as $key => $value) {
        Cache::set("rpgjs_cmd" . $key, $value, 3600);
    }
    echo "<div class='alert alert-success'>Настройки применены. Кэш обновлен.</div>";
}
$data = Database::GetOne("config", array("mod" => "locations"));
?>

<div class="well">Под <b>командами</b> здесь подразумеваются команды скриптового движка из RPG.JS в формате JSON<br> <a target="_blank" href='/ahelp/cmdlist'>Подробный список команд</a></div>

<form action="" method="POST">
    <div class="form-group">
        <label>Команды, вызываемые при запуске игры</label>
        <textarea class="form-control" name="_onrun" rows="3"><?php 
echo $data['_onrun'];
?>
</textarea>
    </div>
    <div class="form-group">
        <label>Команды, вызываемые каждые 1.5 секунд</label>
        <textarea class="form-control" name="_onsync" rows="3"><?php 
echo $data['_onsync'];
?>
</textarea>
    </div>
    <button type="submit" name="mod" value="locations" class="btn btn-default">Сохранить</button>
</form>
Exemplo n.º 26
0
<?php 
if (isset($_POST['mod'])) {
    Database::Edit("config", array("mod" => "_payments"), $_POST);
    echo "<div class='alert alert-success'>Настройки сохранены. <a href=?>Обновить страницу</a></div>";
}
$psconfig = Database::GetOne("config", array("mod" => "_payments"));
?>

<script>
    function generateNewID() 
	{
        $.get('/api?a=uniqid', 
			function (data) 
			{
				document.getElementById('id').value = data;
			}
		);
    }
</script>

<h4>Обратите внимание! В большинстве случаев модуль каждой платёжной системы имеет свои дополнительные настройки</h4>

<form action="" method="POST">
	<div class="form-group"><label>Модуль платёжной системы</label>
		<select name="pay_mod" class="form-control">'; 
		<?php 
foreach ($GLOBALS['modules'] as $mod) {
    echo '<option ' . ($psconfig['pay_mod'] == $mod ? 'selected' : '') . ' value="' . $mod . '">' . $mod . '</option>';
}
?>
		</select>
 function getParam($pname, $id)
 {
     $param = Database::GetOne("config", array("mod" => "inv_params"))[$pname];
     if (!is_array($param)) {
         raptor_warning("Object as array (" . __METHOD__ . "->" . $pname . ")");
         return false;
     }
     if (empty($param['type'])) {
         return $this->conf[$id][$pname];
     }
     switch ($param['type']) {
         case "script":
             $char = new Char();
             $inv = $this;
             return eval($param['script']);
             break;
         case "id":
             return new Char($id);
             break;
         case "int":
             return (int) $this->conf[$id][$pname];
             break;
         case "float":
             return (double) $this->conf[$id][$pname];
             break;
         default:
             return $this->conf[$id][$pname];
             break;
     }
 }
Exemplo n.º 28
0
                    @(include_once MODS_ROOT . SEPARATOR . $module . SEPARATOR . $class . ".class.php");
                }
            }
        }
    }
}
include_once API_ROOT . "/abstract.php";
include_once API_ROOT . "/defines.php";
if (!defined("NOT_CLIENT_USE")) {
    new Sessions();
    @session_start();
}
if (is_string(Cache::get("config_main"))) {
    $cursor = Cache::get("config_main");
} else {
    $cursor = Database::GetOne("config", array("active" => '1'));
    Cache::set("config_main", $cursor, 3600);
}
if (empty($cursor['active']) and $GLOBALS['debug'] == false and file_exists(CACHE_ROOT . SEPARATOR . "installed.cache")) {
    die("Cannot load configuration");
}
if (is_array($cursor)) {
    $GLOBALS = array_merge($GLOBALS, $cursor);
}
function raptor_error_handler($errno, $errstr, $errfile, $errline)
{
    #Database::Insert("errors", array("text" => $errstr, "date" => raptor_date(), "file" => $errfile, "line" => $errline));
    log_error("[{$errno}] {$errstr} (file: {$errfile}, line {$errline}) \n");
    if (defined("HIDE_ERRORS")) {
        return false;
    }
Exemplo n.º 29
0
<form method="POST"><p><button name="new" type="submit" value="1" class="btn btn-xs btn-default">Создать новость</button></p></form>
<hr>

<?php 
if (isset($_POST['title'])) {
    $_POST['_id'] = toId($_GET['edit']);
    Database::Edit("news", array("_id" => toId($_GET['edit'])), $_POST);
    echo '<div class="alert alert-success">Новость успешно отредактирована</div>';
}
if (isset($_POST['new'])) {
    $id = new MongoId();
    Database::Insert("news", array("_id" => $id, "short" => '', "title" => '', "full" => '', "date" => raptor_date(), "public" => '1'));
    die("<script>location.href = '/admin/news?edit=" . $id . "';</script>");
}
if (isset($_GET['edit'])) {
    $array = Database::GetOne("news", array("_id" => toId($_GET['edit'])));
    echo "<form action='' method='POST'>\n\t\t<input class='form-control' name='title' value='" . $array['title'] . "' placeholder='Заголовок'>\n\t\t<textarea rows=15 cols=105 placeholder='Анонс (краткое описание)' name='short'>" . $array['short'] . "</textarea> <br>\n        <textarea rows=15 cols=105 placeholder='Полный текст' name='full'>" . $array['full'] . "</textarea> <br>\n        <button type='submit' class='btn btn-default'>Сохранить</button>\n        </form>\n        <hr>";
}
?>

<div class="table-responsive">
    <table class="table table-bordered table-hover table-striped">
        <thead>
            <tr>
                <td>Заголовок</td>
                <td></td>
            </tr>
        </thead>
        <tbody>

            <?php 
Exemplo n.º 30
-1
function CharByName($name)
{
    $id = Database::GetOne("characters", array("name" => $name));
    if (is_array($id)) {
        return char(__toString($id['_id']));
    } else {
        return false;
    }
}