Example #1
0
 function actionIndex()
 {
     if (isset($_SESSION['id'])) {
         header("Location: /cabinet");
     }
     if (isset($_GET['result'])) {
         switch (@$_GET['result']) {
             case 'regerror':
                 echo "<script>alert('Введены неверные данные или аккаунт уже существует');</script>";
                 break;
             case 'loginerror':
                 echo "<script>alert('Неверный логин или пароль');</script>";
                 break;
             default:
                 break;
         }
     }
     $main = new Templater();
     $main->import("interface/index.tpl");
     $main->setvar("%URL%", "http://" . $GLOBALS['url']);
     $main->setvar("%LOGIN_URL%", "/index/login");
     $main->setvar("%STORAGE_TPL_URL%", "/storage/tpl");
     $main->setvar("%YEAR%", date("Y"));
     $main->setvar("%CSS%", "<style>" . templater("css/main.css", array("%ROOT%" => "/storage/tpl")) . "</style>");
     $main->setvar("%REGISTER%", template("interface/register.tpl"));
     $cursor = Database::Get("news", array('public' => 1))->sort(array('date' => -1))->limit(1)->getNext();
     $newss = templater("interface/news.tpl", array("%SUBJECT%" => $cursor['title'], "%DATE%" => $cursor['date'], "%ANNOUNCE%" => $cursor['short'], "%LINK_MORE%" => "http://" . $GLOBALS['url'] . "/news/read?id=" . $cursor['_id'], "%ID%" => $cursor['_id']));
     $main->setvar("%NEWS%", $newss);
     $main->setvar("%GAME_TITLE%", $GLOBALS['name']);
     $main->setvar("%STORAGE_STATIC_URL%", "/storage/static");
     $main->renderEcho();
 }
Example #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();
 }
Example #3
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();
 }
Example #4
0
 function actionIndex()
 {
     $main = new Templater();
     $main->import("boxes/settings.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("%CONTENT%", $result);
     $main->renderEcho();
 }
 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();
 }
Example #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();
 }
Example #7
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();
 }
Example #8
0
 function actionIndex()
 {
     if (is_object($_SESSION['id'])) {
         $_SESSION['id'] = $_SESSION['id']->__toString();
     }
     $chars = Database::Get("characters", array("player" => $_SESSION['id']));
     $cabinet_list = '';
     foreach ($chars as $array) {
         $cabinet_list = $cabinet_list . templater("interface/cabinet_lst.tpl", array("%ID%" => $array['_id'], "%NAME%" => $array['name'], "%LVL%" => isset($array['p_lvl']) ? $array['p_lvl'] : '0', "%MONEY%" => isset($array['money']) ? $array['money'] : '0', "%DONATE_MONEY%" => isset($array['money_donate']) ? $array['money_donate'] : '0'));
     }
     $main = new Templater();
     $plr = new Player();
     $main->import("interface/cabinet.tpl");
     $main->setvar("%URL%", "http://" . $GLOBALS['url']);
     $main->setvar("%STORAGE_TPL_URL%", "/storage/tpl");
     $main->setvar("%CHARS_COUNT%", $chars->count());
     $main->setvar("%YEAR%", date("Y"));
     $main->setvar("%GAME_TITLE%", $GLOBALS['name']);
     $main->setvar("%LIST%", $cabinet_list);
     $main->setvar("%CURRENT_PLAYER%", $plr->login);
     $main->setvar("%STORAGE_STATIC_URL%", "/storage/static");
     $main->renderEcho();
 }
Example #9
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();
 }
Example #10
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();
 }