function StartServer() { conprint("Server START", "server"); conprint("HOST=" . $_SERVER['HTTP_HOST'], "server"); conprint("Client=" . $_SERVER['HTTP_USER_AGENT'], "server"); conprint("IP=" . $_SERVER['REMOTE_ADDR'], "server"); }
function DelLink($id) { $mysql = new MySQL(); if ($mysql->RemoveString($this->NameBase, "Link", "id=" . $id)) { conprint("DelLink =" . $id, "1"); return true; } else { conprint("DelLink =" . $id, "0"); return false; } }
function DelMap($id, $data) { $mysql = new MySQL(); if ($mysql->RemoveString($this->NameBase, "Maps", "id=" . $id)) { conprint("DelMap =" . $id, "1"); if (unlink($data)) { conprint("DelMap file=" . $data, "1"); } return true; } }
function SetUSER($login, $password) { $mysql = new MySQL(); $err = array(); if (!preg_match("/^[a-zA-Z0-9@.]+\$/", $login)) { $err[] = "Логин может состоять только из букв английского алфавита и цифр"; } if (strlen($login) < 3 or strlen($login) > 30) { $err[] = "Логин должен быть не меньше 3-х символов и не больше 30"; } if ($this->FindLogin($login)) { $err[] = "Пользователь с таким логином уже существует"; } if (count($err) == 0) { $password = md5(md5(trim($password))); if ($mysql->InsertString($this->NameBase, "User", array("login" => $login, "password" => $password))) { conprint("SetUSER: "******"1"); if ($mysql->CreateBaseData($login)) { if ($mysql->CreateTable($login, "FullProfile", "id int(11) auto_increment primary key,Id_NTO int(11),Id_NTOFP int(11)")) { if ($mysql->CreateTable($login, "Link", "id int(11) auto_increment primary key,Id_OBJ int(11),Id_MAP int(11),Id_MAPOBJ varchar(256)")) { if ($mysql->CreateTable($login, "Maps", "id int(11) auto_increment primary key,name varchar(256),Type ENUM('svg','googlemaps'),data text")) { if ($mysql->CreateTable($login, "NameTypeObject", "id int(11) auto_increment primary key,name varchar(256),Type ENUM('GL','FP')")) { if ($mysql->CreateTable($login, "Objects", "id int(11) auto_increment primary key,name varchar(256),Id_NTO int(11),Id_OBJ int(11)")) { if ($mysql->CreateTable($login, "SmallProfile", "id int(11) auto_increment primary key,name varchar(256),Id_NTO int(11),Type ENUM('Текст','Изображение')")) { if ($mysql->CreateTable($login, "SmallProfileData", "id int(11) auto_increment primary key,text varchar(256),Id_SP int(11),Id_OBJ int(11)")) { if ($mysql->CreateView($login, "FullData", "AS select `NameTypeObject`.`id` AS `id`,`NameTypeObject`.`name` AS `name`,`FullProfile`.`Id_NTO` AS `Id_NTO`,`FullProfile`.`id` AS `Id_FP` from (`NameTypeObject` join `FullProfile`) where (`NameTypeObject`.`id` = `FullProfile`.`Id_NTOFP`)")) { if ($mysql->CreateView($login, "SmallData", " AS select `SmallProfileData`.`id` AS `id`,`SmallProfileData`.`text` AS `text`,`SmallProfileData`.`Id_SP` AS `Id_SP`,`SmallProfileData`.`Id_OBJ` AS `Id_OBJ`,`SmallProfile`.`name` AS `name`,`SmallProfile`.`Type` AS `Type` from (`SmallProfileData` join `SmallProfile`) where (`SmallProfileData`.`Id_SP` = `SmallProfile`.`id`)")) { if ($mysql->CreateView($login, "LinkOBJ", " AS select `Link`.`id` AS `id`,`Link`.`Id_MAP` AS `Id_MAP`,`Link`.`Id_OBJ` AS `Id_OBJ`,`Link`.`Id_MAPOBJ` AS `Id_MAPOBJ`,`Objects`.`Id_NTO` AS `Id_NTO`,`Objects`.`name` AS `nameOBJ` from (`Link` join `Objects`) where (`Link`.`Id_OBJ` = `Objects`.`id`)")) { return true; } } } } } } } } } } } } else { conprint("SetLINK: ", "0"); return false; } } }
function FuncRun() { if (!empty($this->Params)) { if ($this->Response(call_user_func_array(array($this->Object, $this->Functions), $this->Params), $this->TypeResp) != false) { conprint("Server Call Function:" . $this->Functions, "server"); return true; } else { conprint("ERROR Server Call Function:" . $this->Functions, "server"); return false; } } else { if ($this->Response(call_user_func(array($this->Object, $this->Functions)), $this->TypeResp) != false) { conprint("Server Call Function:" . $this->Functions, "server"); return true; } else { conprint("ERROR Server Call Function:" . $this->Functions, "server"); return false; } } }
function ReloadeFullProfile($Name, $Id_FP) { $mysql = new MySQL(); $name_table = $mysql->GetTable($this->NameBase, "FullProfile", NULL, "id=" . $Id_FP); $Id_NTOFP = $name_table[0]["Id_NTOFP"]; conprint("Id_NTOFP: " . $Id_NTOFP, "0"); if ($this->ReloadeTypeObject($Name, $Id_NTOFP)) { conprint("ReloadeFullProfile: " . $Name, "1"); return true; } else { conprint("ReloadeFullProfile " . $Name, "0"); return false; } }
function RemoveString($NameBase, $NameTable, $Where) { if (empty($NameBase)) { conprint("НЕ ЗАДАННО ИМЯ БАЗЫ ДАННЫХ ПРИ УДАЛЕНИИ СТРОКИ: ", "0"); return false; } if (empty($NameTable)) { conprint("НЕ ЗАДАННО ИМЯ ТАБЛИЦЕ ПРИ УДАЛЕНИИ СТРОКИ: ", "0"); return false; } $string = "DELETE FROM " . $NameTable; if (empty($Where)) { conprint("НЕ ЗАДАННО WHERE ПРИ УДАЛЕНИИ СТРОКИ: ", "0"); } else { $string .= " WHERE " . $Where; } $this->CreateConection($NameBase); if ($this->Query($string)) { conprint("УДАЛЕНИЕ СТРОКИ ИЗ ТАБЛИЦЫ: " . $NameTable, "1"); return true; } else { conprint("УДАЛЕНИЕ СТРОКИ ИЗ ТАБЛИЦЫ:" . $NameTable, "0"); return false; } }
function RemoveSmallDataAll($Id_OBJ) { if ($this->GetSmallObject($Id_OBJ) != false) { $mysql = new MySQL(); if ($mysql->RemoveString($this->NameBase, "SmallProfileData", "Id_OBJ=" . $Id_OBJ)) { conprint("RemoveSmallDataAll =" . $Id_OBJ, "1"); return true; } else { conprint("RemoveSmallDataAll =" . $Id_OBJ, "0"); return false; } } else { return true; } }
function GetSmallProfile() { if (!empty($this->Id_NTO)) { $mysql = new MySQL(); return $mysql->GetTable("DataBase", "SmallProfile", NULL, "Id_NTO=" . $this->Id_NTO); function GetFullProfile() { $mysql = new MySQL(); return $mysql->GetTable("DataBase", "FullProfile", NULL, "Id_NTO=" . $this->Id_NTO); } } else { conprint("ReloadeFullProfile Id_FP не задано", "0"); return false; } }