$pwd = md5($_POST["apw"]); $db->query("INSERT INTO mwc_admin (name,pwd,nick,sacc,access) VALUES ('{$name}','{$pwd}','{$name}','{$name}',1)"); //одмин пошел! $config = array("ctype" => $_SESSION["installmwcct"], "address" => $gaddress, "dlang" => "ru", "theme" => "admin", "db_host" => array($_SESSION["installmwcdb_host"]), "db_name" => array($_SESSION["installmwcdb_name"]), "db_user" => array($_SESSION["installmwcdb_usr"]), "db_upwd" => array($_SESSION["installmwcdb_pwd"]), "licecount" => 1, "defgrp" => 2, "defpage" => "admin", "defController" => "aController", "defModel" => "ausermodel"); $mainpath = "configs" . DIRECTORY_SEPARATOR . "configs.php"; if (file_exists($mainpath)) { require_once $mainpath; } else { die("main cfg error!"); } Configs::writeCfg($config, "main", $cfg["defaultabuild"]); rename("install.php", "configs/install.php"); //убираем модуль админки, юольше не нужен //region for muonline //admin $config = array("ctype" => $_SESSION["installmwcct"], "address" => $gaddress, "dlang" => "ru", "theme" => "muadmin", "db_host" => array($_SESSION["installmwcdb_host"]), "db_name" => array($_SESSION["installmwcdb_name"]), "db_user" => array($_SESSION["installmwcdb_usr"]), "db_upwd" => array($_SESSION["installmwcdb_pwd"]), "licecount" => 1, "defgrp" => 2, "defpage" => "admin", "defController" => "aController", "defModel" => "ausermodel"); Configs::writeCfg($config, "main", "muadmin"); //muonline site $config = array("ctype" => $_SESSION["installmwcct"], "address" => $gaddress, "dlang" => "ru", "theme" => "espada-legend", "usemd5" => 0, "db_host" => array($_SESSION["installmwcdb_host"]), "db_name" => array($_SESSION["installamwcdb_name"]), "db_user" => array($_SESSION["installmwcdb_usr"]), "db_upwd" => array($_SESSION["installmwcdb_pwd"]), "licecount" => 1, "defgrp" => 2, "defpage" => "news", "tryCount" => 5, "banMin" => 15, "defController" => "muController", "defModel" => "MuonlineUser"); Configs::writeCfg($config, "main", "muonline"); //endregion session_unset(); session_destroy(); echo "<tr><td colspan='2' style='font-weight: bold;'>Congratulation! Core installation completed! Please, replace install.php from root directory, if it doesn't. We remind you, that was core install. Next step - build install.\n Core Admin-panel <a href='{$gaddress}control.php'>here</a></td></tr>"; } } catch (Exception $ex) { echo $ex->getMessage(); } break; } }
/** * добавляем новый параметр */ public function action_addparam() { if (!empty($_GET["cid"]) && !empty($_POST["pname"]) && isset($_POST["pval"]) && !empty($_POST["id"])) { $id_ = (int) $_GET["cid"]; $name = $_POST["pname"]; $val = $_POST["pval"]; $cid = $_POST["id"]; $dirInfo = scandir("build" . DIRECTORY_SEPARATOR . $_SESSION["mwccfgread"] . DIRECTORY_SEPARATOR . "configs"); $adirInfo = new ArrayIterator($dirInfo); foreach ($adirInfo as $id => $fname) { if ($id == $id_) { $tm_ = substr($fname, 0, -4); break; } } if ($tm_ == $cid) { $cfg = Configs::readCfg($tm_, $_SESSION["mwccfgread"]); if (!is_array($cfg)) { $cfg = array(); } $cfg[$name] = $val; Configs::writeCfg($cfg, $tm_, $_SESSION["mwccfgread"]); if (!empty($_POST["ldesc"])) { $path = "build" . DIRECTORY_SEPARATOR . $_SESSION["mwccfgread"] . DIRECTORY_SEPARATOR . "lang" . DIRECTORY_SEPARATOR . $_SESSION["mwclang"] . DIRECTORY_SEPARATOR . "cfg_{$cid}.php"; if (file_exists($path)) { require $path; $lang[$name] = $_POST["ldesc"]; $ai = new ArrayIterator($lang); $content = '<?php '; foreach ($ai as $id => $val) { $content .= '$lang["' . $id . '"]="' . $val . '"; '; } $fh = fopen($path, "w"); fwrite($fh, $content); fclose($fh); } } } } }