本文整理汇总了PHP中connect::start方法的典型用法代码示例。如果您正苦于以下问题:PHP connect::start方法的具体用法?PHP connect::start怎么用?PHP connect::start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类connect
的用法示例。
在下文中一共展示了connect::start方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* builder constructor.
* @param string $tbuild
* @param string $lang
* @param int $server
* @param string $mwcedb
*/
public function __construct($tbuild, $lang, $server, $mwcedb = "mwce_settings")
{
$this->DB = connect::start();
$this->build = $tbuild;
$this->lang = $lang;
$this->server = $server;
$this->mwcedb = $mwcedb;
$this->checkBase();
}
示例2: __construct
private function __construct()
{
/**
* если не установлен билд, то сначала грузим главный конфиг. в нем читаем билд,
* устанавливаем и далее вычитываем конфиг конкретного билда.
*/
$mainpath = "configs" . DIRECTORY_SEPARATOR . "configs.php";
if (file_exists($mainpath)) {
require_once $mainpath;
} else {
die("main cfg error!");
}
if (empty($_SESSION["mwcbuild"])) {
$_SESSION["mwcbuild"] = $cfg["defaultbuild"];
}
define("tbuild", $_SESSION["mwcbuild"]);
$globalcfg = Configs::readCfg("main", $_SESSION["mwcbuild"]);
if (empty($_SESSION["mwcserver"])) {
//сервер
$_SESSION["mwcserver"] = 0;
}
if (empty($_SESSION["mwcbuild"])) {
//сервер
$_SESSION["mwcbuild"] = $globalcfg["tbuild"];
}
if (empty($_SESSION["mwclang"])) {
//язык
$_SESSION["mwclang"] = $globalcfg["dlang"];
}
if (empty($_SESSION["mwcpoints"])) {
//группа
$_SESSION["mwcpoints"] = $globalcfg["defgrp"];
}
$adres = $globalcfg["address"];
try {
$content = new content($adres, $globalcfg["theme"], $_SESSION["mwclang"]);
} catch (Exception $e) {
echo $e->getMessage();
die;
}
$isBackground = isset($_GET["bg"]) ? 1 : NULL;
//если идет обращение к серверу
try {
$db = connect::start();
if (empty($_SESSION["mwcuid"])) {
$uid = 0;
} else {
$uid = $_SESSION["mwcuid"];
}
$builder = new builder(tbuild, $_SESSION["mwclang"], $_SESSION["mwcserver"]);
// проверяем наличие списка модулей и плагинов
//region плагины
$plugin = "";
require_once "build" . DIRECTORY_SEPARATOR . tbuild . DIRECTORY_SEPARATOR . "_dat" . DIRECTORY_SEPARATOR . $_SESSION["mwcserver"] . "_" . $_SESSION["mwclang"] . "_plugins.php";
if (is_array($plugin) && is_null($isBackground)) {
foreach ($plugin as $name => $param) {
if ($param["pstate"] == 1) {
$contoller_path = "build" . DIRECTORY_SEPARATOR . tbuild . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR . "controller" . DIRECTORY_SEPARATOR . $name . ".php";
//region проверка на пользователя (если есть)
$ccfg = Configs::readCfg("plugin_" . $name, $_SESSION["mwcbuild"]);
if (!empty($ccfg["allowedUsrs"])) {
$usrs = explode(",", $ccfg["allowedUsrs"]);
if (!in_array($uid, $usrs)) {
$err = 2;
} else {
$err = 0;
}
} else {
$err = 2;
}
//endregion
if (file_exists($contoller_path) && (!empty($param["groups"]) || $err == 0)) {
if (empty($param["groups"])) {
$paccess = array();
} else {
$paccess = explode(",", $param["groups"]);
}
try {
if (!empty($param["mname"])) {
$model_path = "build" . DIRECTORY_SEPARATOR . tbuild . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR . "model" . DIRECTORY_SEPARATOR . $param["mname"] . ".php";
if (file_exists($model_path)) {
require $model_path;
}
require $contoller_path;
if ((in_array($_SESSION["mwcpoints"], $paccess) || in_array(4, $paccess) || $err == 0) && class_exists($param["mname"])) {
$tmp = $param["mname"];
$model = new $tmp();
$pcontoller = new $name($model, $content, $plugin, $_SESSION["mwcserver"]);
if (method_exists($name, "action_index")) {
$pcontoller->init();
$pcontoller->action_index();
$pcontoller->parentOut();
}
}
} else {
if (in_array($_SESSION["mwcpoints"], $paccess) || in_array(4, $paccess)) {
$model = new $globalcfg["defModel"]();
$pcontoller = new PController($model, $content, $plugin, $_SESSION["mwcserver"]);
$pcontoller->genNonMVC($contoller_path);
$pcontoller->parentOut($name);
//.........这里部分代码省略.........
示例3: __construct
private function __construct()
{
$mainpath = "configs" . DIRECTORY_SEPARATOR . "configs.php";
if (file_exists($mainpath)) {
require_once $mainpath;
} else {
die("main cfg error!");
}
$globalcfg = Configs::readCfg("main", $cfg["defaultabuild"]);
if (empty($_SESSION["mwcabuild"])) {
$_SESSION["mwcabuild"] = $cfg["defaultabuild"];
}
define("tbuild", $cfg["defaultabuild"]);
//$baseDir = substr(dirname( __FILE__ ),0,-4);
if (empty($_SESSION["mwcserver"])) {
//сервер
$_SESSION["mwcserver"] = 0;
}
if (empty($_SESSION["mwclang"])) {
//язык
$_SESSION["mwclang"] = $globalcfg["dlang"];
}
if (empty($_SESSION["mwcapoints"])) {
//группа в админке
$_SESSION["mwcapoints"] = $globalcfg["defgrp"];
}
$adres = $globalcfg["address"];
//для редактирования билдов (подгрузка всего и вся (настроек)
if (isset($_POST["whosconfig"])) {
$builds = Tools::getAllBuilds();
if (!empty($builds[$_POST["whosconfig"]])) {
$_SESSION["mwccfgread"] = $_POST["whosconfig"];
}
} else {
if (empty($_SESSION["whosconfig"])) {
$_SESSION["whosconfig"] = "admin";
}
}
$content = new content($adres, $globalcfg["theme"], $_SESSION["mwclang"]);
$isBackground = isset($_GET["bg"]) ? 1 : NULL;
//если идет обращение к серверу
try {
$db = connect::start();
$builder = new builder(tbuild, $_SESSION["mwclang"], $_SESSION["mwcserver"]);
// проверяем наличие списка модулей и плагинов
$action_name = "action_index";
//region плагины
$plugin = "";
require_once "build" . DIRECTORY_SEPARATOR . tbuild . DIRECTORY_SEPARATOR . "_dat" . DIRECTORY_SEPARATOR . $_SESSION["mwcserver"] . "_" . $_SESSION["mwclang"] . "_plugins.php";
if (is_array($plugin) && is_null($isBackground)) {
$aplugin = new ArrayIterator($plugin);
foreach ($aplugin as $name => $param) {
if ($param["pstate"] == 2) {
$contoller_path = "build" . DIRECTORY_SEPARATOR . tbuild . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR . "controller" . DIRECTORY_SEPARATOR . $name . ".php";
if (file_exists($contoller_path) && !empty($param["groups"])) {
$paccess = explode(",", $param["groups"]);
if (!empty($param["mname"])) {
$model_path = "build" . DIRECTORY_SEPARATOR . tbuild . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR . "model" . DIRECTORY_SEPARATOR . $param["mname"] . ".php";
if (file_exists($model_path)) {
require $model_path;
}
require $contoller_path;
if (in_array($_SESSION["mwcapoints"], $paccess) || in_array(4, $paccess) && class_exists($param["mname"])) {
$tmp = $param["mname"];
$model = new $tmp();
$pcontoller = new $name($model, $content, $plugin, $_SESSION["mwcserver"]);
if (method_exists($name, "action_index")) {
$pcontoller->init();
$pcontoller->action_index();
$pcontoller->parentOut();
}
}
} else {
if (in_array($_SESSION["mwcapoints"], $paccess) || in_array(4, $paccess)) {
$model = new $globalcfg["defModel"]();
$pcontoller = new PController($model, $content, $plugin, $_SESSION["mwcserver"]);
$pcontoller->genNonMVC($contoller_path);
$pcontoller->parentOut($name);
}
}
}
}
}
}
//endregion
//region страницы
//region получение контроллера и экшена
if (!isset($_GET["p"])) {
$controller = $globalcfg["defpage"];
} else {
$controller = htmlspecialchars($_GET["p"], ENT_QUOTES);
if ($controller == "index") {
$controller = $globalcfg["defpage"];
}
}
if (isset($_GET["a"])) {
$action_name = "action_" . $_GET["a"];
}
//endregion
require_once "build" . DIRECTORY_SEPARATOR . tbuild . DIRECTORY_SEPARATOR . "_dat" . DIRECTORY_SEPARATOR . $_SESSION["mwcserver"] . "_" . $_SESSION["mwclang"] . "_pages.php";
//.........这里部分代码省略.........
示例4: substr
address:"' . $content->getAdr() . 'install.php?st=4",
type:"POST",
data:$("#mainform").serialize(),
loadicon:"Loading..."
})\'></td></tr>';
break;
//заполнение данных одмина
//заполнение данных одмина
case 4:
$content->out("step4", "public", false);
break;
//создание админа, убийство инсталяшки
//создание админа, убийство инсталяшки
case 5:
try {
$db = connect::start($_SESSION["installmwcct"], $_SESSION["installmwcdb_host"], $_SESSION["installmwcdb_name"], $_SESSION["installmwcdb_usr"], $_SESSION["installmwcdb_pwd"]);
if (!empty($_POST["aname"]) && !empty($_POST["apw"])) {
$name = substr($_POST["aname"], 0, 19);
$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");
//убираем модуль админки, юольше не нужен
示例5: __construct
public function __construct()
{
$this->db = connect::start();
$this->init();
}