function showWithTabs($postParams) { $smarty = new SmartyExst(); $todayForm = showTodayThings(); $futureForm = showFutureThings(); $lateForm = showLateThings(); $addForm = addThing($postParams); $allForm = showAllTable(); $smarty->assign("todayForm", $todayForm); $smarty->assign("lateForm", $lateForm); $smarty->assign("futureForm", $futureForm); $smarty->assign("addForm", $addForm); $smarty->assign("allForm", $allForm); return $smarty->fetch("crm.tpl"); }
/** * Зарегистрировать нового пользователя в системе * * @param string $mail Почта * @param string $password Пароль * @param string $name Имя * @param string $surname Фамилия * @param string $burthday Дата рождения * @param bool $gender Пол * @param integer $ip IP * @throws UserException Если пользователь уже существует * @throws UserException Если неверна дата рождения * @throws UserException Не заполнены имя и фамилия * @throws UserException Неверный формат почты */ public function register($mail, $password, $name, $surname, $burthday, $gender, $ip) { if (checkMail($mail)) { if ($this->checkIfExsist($mail)) { throw new UserException($mail, UserException::USR_ALREADY_EXIST); } if (!checkDateFormat($burthday)) { throw new UserException($mail, UserException::USR_CHECK_BURTHDAY); } else { if ($name == "" && $surname == "") { throw new UserException($mail, UserException::USR_NAME_EMPTY); } } $textPassword = $password; $password = md5($password); $date = date("Y-m-d"); $query = "\r\n INSERT INTO `SITE_USERS` SET\r\n `mail`='{$mail}',\r\n `password`='{$password}',\r\n `ip`={$ip},\r\n `register_date`='{$date}',\r\n `name`='{$name}',\r\n `second_name`='{$surname}',\r\n `gender`={$gender},\r\n `burthday`='{$burthday}'\r\n "; $this->_sql->query($query); $querySelectId = $this->_sql->selFieldsWhere("SITE_USERS", "`mail`='{$mail}'", "id"); $arr = $this->_sql->GetRows($querySelectId); $id = $arr[0]["id"]; $activationKey = $this->generateActivationKey(7); $insertActivationRowData = array($id, $activationKey); $this->_sql->insert("USERS_ACTIVATION_KEYS", $insertActivationRowData); $p = new UserMailer(); $p->mail = $mail; $embeddedImages = array("photos/no-photo.jpg", "photos/no-galary.jpg"); $s = new SmartyExst(); $s->assign("NAME", "{$name} {$surname}"); $s->assign("PASS", $textPassword); $s->assign("ID", $id); $s->assign("KEY", $activationKey); $sendString = $s->fetch($this->mailTemplate); $p->registerSend($sendString, $embeddedImages); return $id; } else { throw new UserException($mail, UserException::USR_NAME_INCORRECT); } }
* подключение модуля для работы с шаблонами * @package SmartyExst.php */ require_once "engine/kernel/SmartyExst.php"; $flag = false; try { $user = new User(); $UserID = $user->id; $flag = true; } catch (Exception $e) { echo " <font color=red>Пользователь не залогинился </font><br/>"; } $rss = new RssPub(); $smarty = new SmartyExst(); if ($flag) { $output["text"] = $smarty->fetch("rss/MainRSS.tpl"); switch ($data["parameters"][0]) { case "DoNew": $output["text"] = $smarty->fetch("rss/DoNew.tpl"); //$arr=$rss->addRSS(); break; case "Del": $smarty->assign("arr", $rss->getallRSS()); $output["text"] = $smarty->fetch("rss/Del.tpl"); //$arr=$rss->delRSS(); break; case "Show": $smarty->assign("arr", $rss->getallRSS()); $output["text"] = $smarty->fetch("rss/Show.tpl"); break; case "Upd":
require_once "engine/modules/finder/Finder.php"; $r = new UserRegister(); //var_dump($data["urlArray"]); $smarty = new SmartyExst(); $links = array("enterForm" => "/" . $data["urlArray"][1] . "/", "signInPath" => "/" . $data["urlArray"][1] . "/view/", "signOutPath" => "/" . $data["urlArray"][1] . "/logout/", "enter" => "/" . $data["urlArray"][1] . "/enter/", "register" => "/" . $data["urlArray"][1] . "/register/", "create" => "/" . $data["urlArray"][1] . "/create/", "settings" => "/" . $data["urlArray"][1] . "/settings/"); $smarty->assign("links", $links); $usersSignInOut = new UserSignInOut(); if (isset($_SESSION["error"])) { echo $_SESSION["error"]; unset($_SESSION["error"]); } switch ($data["parameters"][0]) { case "activate": if (isset($data["parameters"][1])) { $smarty->assign("ID", $data["parameters"][1]); $output["text"] = $smarty->fetch("users.activate.tpl"); } break; case "doactivate": $registerUser = new UserRegister(); try { if (!$registerUser->activateByKey($_POST["id"], $_POST["key"])) { $_SESSION["error"] = "WRONG KEY"; header("Location: /user/activate/{$_POST['id']}/"); } } catch (UserException $usEx) { $_SESSION["error"] = $usEx->getMessage(); header("Location: /user/activate/{$_POST['id']}/"); } break; case "enter":
$_SESSION["search"] = $_POST; } else { if ($_SESSION["search"] != $_POST && $_POST != NULL) { $_SESSION["search"] = $_POST; } } $finder->page = $data["parameters"][1]; $datS =& $_SESSION["search"]; switch ($_GET["type"]) { case "byData": $fUsers = $finder->findByData($datS["name"], $datS["surname"], $datS["gender"], $datS["ageFrom"], $datS["ageTo"], (bool) $datS["isOnline"]); $smarty->assign("COUNT", $finder->count); $smarty->assign("PAGES", $finder->getPages()); break; case "byMail": $fUsers = $finder->findByMail($datS["mail"]); break; case "byId": $fUsers = $finder->findById($datS["id"]); break; default: $fUsers = $finder->findByData($datS["name"], $datS["surname"], $datS["gender"], $datS["ageFrom"], $datS["ageTo"], (bool) $datS["isOnline"]); } $smarty->assign("FINDERS", $finder->getForView($fUsers)); $output["text"] = $smarty->fetch("finder.users.tpl"); break; default: unset($_SESSION["search"]); $output["text"] = $smarty->fetch("finder.main.tpl"); } //require_once "generator.php";
$groups = new GroupsCreator(); if (isset($data["parameters"][1])) { switch ($data["parameters"][1]) { case "add": $groups->create($_POST["group_name"]); header("Location: /friends/groups/"); break; case "del": $groups->delete($data["parameters"][2]); header("Location: /friends/groups/"); case "show": $group = $groups->getGroup($data["parameters"][2]); $smarty->assign("GROUP", $group); $smarty->assign("FRIENDS", $friends->getAllFriends()); $smarty->assign("GROUP_FRIENDS", $group->getFriends()); $output["text"] = $smarty->fetch("friends.groups.show.tpl"); break; case "addfriend": $group = $groups->getGroup($data["parameters"][2]); $group->addFriend($_POST["friend_ID"]); header("Location: /friends/groups/show/{$group->id}/"); break; case "deletefriend": $group = $groups->getGroup($data["parameters"][2]); $group->delFriend($data["parameters"][3]); header("Location: /friends/groups/show/{$group->id}/"); break; } } else { $smarty->assign("GROUPS", $groups->getAllGroups()); $output["text"] = $smarty->fetch("friends.groups.tpl");
function searcher($postParams, $getParams) { $searchPath = "/video/search/"; $searchStr = $postParams["searchStr"]; if ($searchStr != "") { $searchResult = drawSearchVideoList($searchStr, $getParams); } else { $searchResult = ""; } $numerator = "12345"; $smarty = new SmartyExst(); $smarty->assign("searchResults", $searchResult); $smarty->assign("numerator", $numerator); return $smarty->fetch("video/video.tpl"); }
* @package SmartyExst.php */ require_once "engine/kernel/SmartyExst.php"; $flag = false; try { $user = new User(); $UserID = $user->id; $flag = true; } catch (Exception $e) { echo " <font color=red>Пользователь не залогинился </font><br/>"; } $not = new NoticeTopicsPF(); $notADM = new NoticeCategoryPF(); $smarty = new SmartyExst(); if ($flag) { $output["text"] = $smarty->fetch("notice/MainNotice.tpl"); switch ($data["parameters"][0]) { case "DoNew": $output["text"] = $smarty->fetch("notice/DoNew.tpl"); break; case "GetAllMy": $arr = $not->allTopUI(255); $smarty->assign("arr", $arr); $output["text"] = $smarty->fetch("notice/GetAllMy.tpl"); break; case "DoNewADM": $output["text"] = $smarty->fetch("notice/DoNewADM.tpl"); break; case "GetAllADM": $arr = $notADM->showAllCat(); $smarty->assign("arr", $arr);
$f->addFriend(1233); */ /*- - -*/ $flag = false; try { $user = new User(); $UserID = $user->id; $frnd = new Friends($UserID); $flag = true; } catch (Exception $e) { echo " <font color=red>Пользователь не залогинился </font><br/>"; } $mess = new Message(); $smarty = new SmartyExst(); if ($flag) { $output["text"] = $smarty->fetch("message/MainMessage.tpl"); switch ($data["parameters"][0]) { case "DoSend": $smarty->assign("arr", $frnd->getAllFriends()); $output["text"] = $smarty->fetch("message/DoSend.tpl"); // if (isset($_POST["sbmt"])) {$str="NULL";} //if (isset($_POST["sv"])) {$state=0;} if (isset($_POST["sbmt"])) { $mess->saveMes($_POST["mes"], $_POST["sel"], $UserID, 1); unset($_POST["sbmt"]); } if (isset($_POST["sv"])) { $mess->saveMes($_POST["mes"], NULL, $UserID, 1); unset($_POST["sv"]); } break;