private function processSection($keyName, $sectionArray) { $test = ""; foreach ($sectionArray as $sectionName => $value) { $test = isset($this->core->{$keyName}) ? $this->core->{$keyName} : ""; if (is_array($value)) { $this->processSection($sectionName, $value); continue; } if (method_exists($test, $sectionName)) { $test->{$sectionName}($value); continue; } if (isset($this->core->config["{$keyName}Config"])) { $this->core->config["{$keyName}Config"][$sectionName] = $value; continue; } $test = isset($this->core->{$keyName}->{$sectionName}) ? $this->core->{$keyName}->{$sectionName} : null; if ($test) { $this->core->{$keyName}->{$sectionName} = $value; } else { system::setParam($sectionName, $value); } } //print_r ($conf); }
function index() { system::setParam("page", "globalSearch"); if (!empty($_GET["text"])) { $words = htmlspecialchars(addslashes($_GET["text"])); $offset = 0; if (isset($this->get["offset"])) { $offset = intval($this->get["offset"]); } $cacheID = "SEARCH_RES|{$words}|blogsearchoffset_{$offset}"; $this->smarty->assign("searchWord", $words); if (mb_strlen($words) <= 2) { $this->smarty->assign("smallWord", true); return false; } $this->smarty->setCacheID($cacheID); if (!$this->smarty->isCached()) { $res = search::searchWithType($words, "blog"); if ($res->getNumRows() > 0) { $posts = $res->fetchAll(); $this->smarty->assign("searchRes", $posts); } } } else { system::redirect('/'); } }
public function criticalError() { if (!empty($this->coreErrors)) { system::setParam("page", "coreErrorPage"); return $this->coreErrors; } return false; }
function index() { if ($this->args[0] != 'index') { system::setParam("page", "showPage"); video::getPostBySlug($this->args[0]); //$this->smarty->addCacheID(); // @Mgenry что ты несёшь блять ??? } else { system::setParam("page", "listPage"); $fill = video::getPosts()->fetchAll(); $this->smarty->assign("fill", $fill); } }
function add() { system::setParam("page", "addUser"); $doRedirect = false; if (isset($_POST["savePost"])) { $data = $_POST; unset($data["savePost"]); $this->db->query("INSERT INTO `users` SET `nick`='?', `email`='?', `password`=md5(md5('?')), \n\t\t\t\t`source`='?', `profileURL`='?'", $data["nick"], $data["email"], $data["password"], $data["source"], $data["profileURL"]); $doRedirect = true; } if ($doRedirect) { system::redirect(system::param("urlBase") . "users"); } }
function add() { system::setParam("page", "addPage"); $fill = array(); $doRedirect = false; if (isset($_POST) && $_POST) { $url = $_POST["URL"]; $code = redirect::generateRandomString(10); if ($this->db->query("INSERT INTO `redirect` (`URL`,`code`) VALUES ('?','?')", $url, $code)) { $doRedirect = true; } } $this->smarty->assign("fill", $fill); if ($doRedirect) { system::redirect("/adm/redirect/listPage"); } }
function editItem() { $id = intval($_GET["id"]); $doRedirect = false; if (isset($_POST["savePost"])) { blog::updatePost($id, $_POST); $doRedirect = true; } if (isset($_POST["uploadPicture"])) { $uploadedPics = blog::uploadOnePicture($_POST["slug"]); } system::setParam("page", "editPortfolioItem"); $sqlData = blog::buildForm("portfolio", "AND `id`={$id}"); blog::showAttachedPics($sqlData, "portfolioPics"); if ($doRedirect) { system::redirect(system::param("urlBase") . "items"); } }
function index() { system::setParam("page", "server-status"); $this->smarty->setCacheID("SERVER_STATUS"); if (!$this->smarty->isCached("server-status.tpl", "SERVER_STATUS")) { $this->smarty->assign("cpu", server_status::cpuInfo()); $this->smarty->assign("totalMemory", server_status::totalMemory()); $this->smarty->assign("uptime", server_status::uptime()); $this->smarty->assign("load", server_status::getLoad()); $this->smarty->assign("kernelVersion", server_status::kernel()); $cpuLoad = server_status::cpuLoad(); $memory = server_status::memory(); $this->smarty->assign("cpuLoad", $cpuLoad); $this->smarty->assign("memory", $memory); $this->smarty->assign("memoryScale", server_status::scaleData(round($memory))); $this->smarty->assign("cpuScale", server_status::scaleData(round($cpuLoad))); $this->smarty->assign("programms", server_status::installedSoft()); } }
public function readConfig() { if ($this->configIsReaded) { return true; } $this->params = array(); if (!file_exists(ROOT_PATH . "/config.php")) { throw new exception("configReadError"); } include ROOT_PATH . "/config.php"; if (!isset($configuration)) { throw new exception("configIsEmpty"); } $configParser = new config($this); $configParser->processArray($configuration); system::setParam("page", "main"); $this->configIsReaded = true; return true; }
function addPageAjax() { system::setParam("page", "ajax"); if ($_POST) { $fill = array(); $slug = ""; $fill = $_POST; if (!empty($_POST["slug"])) { $slug = core::generateSlug($_POST["slug"]); } else { if (!empty($_POST["title"])) { $slug = core::generateSlug($_POST["title"]); } } $fill["slug"] = $slug; $savedPost = video::writePost($fill); // $this->smarty->assign ("fill", $fill); return true; } }
function date() { system::setParam("page", "blogByDate"); $offset = 1; if (isset($this->get["offset"])) { $offset = intval($this->get["offset"]); } $cacheID = "DTSELECT|ARTICLE|dateoffset_{$offset}"; if (isset($this->args[1])) { $date = preg_replace("/[^0-9.]/uims", '', $this->args[1]); $cacheID = $date . "|" . $cacheID; } $this->smarty->setCacheID($cacheID); if (!$this->smarty->isCached()) { $allCount = $this->db->query("SELECT COUNT(*) as cnt FROM `content` as c, `content_category` as cc, `categories` as cts WHERE \n cc.`contentID`=c.`contentID` AND c.`type`='article' AND cts.`categoryID`=cc.`catID` AND c.`showOnSite`='Y' AND c.`dt` >= \n STR_TO_DATE ('?', '%d.%m.%Y')", $date)->fetch(); $posts = news::getPostsByDate($date, core::pagination($allCount["cnt"], $offset), "article")->fetchAll(); $this->smarty->assign("posts", $posts); $this->smarty->assign("date", $date); } }
function registration() { system::setParam("page", "userRegistration"); }
function profile() { if (!isset($this->get["profile"]) || !$this->get["profile"]) { return system::redirect('/'); } $userID = intval($this->get["profile"]); $systemUserID = 0; system::setParam("page", "userProfileOpen"); $cacheID = "USERPROFILE|USERPANEL|user_" . $userID; if (!empty($_SESSION["user"])) { $systemUserID = intval($_SESSION["user"]["userID"]); $cacheID .= "|logined"; } else { $cacheID .= "|notlogined"; } $this->smarty->setCacheID($cacheID); if (!$this->smarty->isCached()) { if (!empty($_SESSION["user"])) { $user = $this->db->query("SELECT * FROM `users` as u LEFT JOIN `friends` as f ON f.`u2`=u.`userID`" . " WHERE u.`userID`=?", $userID)->fetch(); } else { $user = $this->db->query("SELECT *, 0 as friendshipID FROM `users` WHERE `userID`=?", $userID)->fetch(); } $this->smarty->assign("user", $user); } $this->smarty->assign("userID", $userID); }
function addCat() { system::setParam("page", "addCat"); if (!empty($_POST)) { if (blog::addCat($_POST)) { system::redirect("/adm/blog/categories"); } } }
function addPage() { system::setParam("page", "addPage"); $fill = array(); $doRedirect = false; $slug = ""; if (isset($_POST) && $_POST) { $fill = $_POST; $this->add($fill); if ($savedPost) { $doRedirect = true; } if ($doRedirect) { system::redirect(system::param("urlBase") . "listPage"); } } $this->smarty->assign("fill", $fill); }
public function moduleDisplay($page) { $this->assign("mainTPL", TPL_PATH); $moduleResources = system::param("urlBase") . "engine/modules/" . core::$router->controllerCall . "/resources/"; system::setParam("moduleResources", $moduleResources); $this->assign("moduleResources", $moduleResources); if ($page) { $this->pageName = $page; } $this->eventHandler(); $this->addTemplateDir(array("modules" => MODULES_PATH . "/" . core::$router->controllerCall . "/" . system::$frontController . "/tpl")); $this->cacheIdShow .= "|MODULES|MODULE_NAME_" . strtoupper(core::$router->controllerCall); $this->displayWrap(); }
function search() { system::setParam("page", "search"); if (!empty($_GET["text"])) { $words = $_GET["text"]; $cacheID = "SEARCH_RES|{$words}"; $this->smarty->assign("searchWord", addslashes($words)); if (mb_strlen($words) <= 2) { $this->smarty->assign("smallWord", true); return false; } $this->smarty->setCacheID($cacheID); if (!$this->smarty->isCached()) { $res = blog::search($words); if ($res->num_rows > 0) { $posts = $res->fetchAll(); $this->smarty->assign("searchRes", $posts); } } //this->smarty->clearCache ("main.tpl"); //$this->smarty->clearCache ("search.tpl"); } else { system::redirect('/'); } }
function token() { if (!isset($_SESSION["user"])) { return system::redirect("/user/login?to=" . urlencode("/screenshot/token")); } system::setParam("page", "token"); $userID = intval($_SESSION["user"]["userID"]); $mres = $this->db->query("SELECT * FROM `tokens` WHERE `userID`=? LIMIT 1", $userID); $res = array(); if ($mres->getNumRows()) { $res = $mres->fetch(); $token = $res["token"]; } else { $token = screenshot::generateRandomString(); $this->db->query("INSERT INTO `tokens` SET `userID`=?, `token`='?'", $userID, $token); } $_SESSION["user"]["APIs"]["screenshot"]["token"] = $token; }
private function getController(&$file, &$controller, &$action) { $route = isset($_GET["act"]) ? $_GET["act"] : ""; $route = trim($route, '/\\'); $this->routePath = $route; $this->smarty->assign("routePath", $this->routePath); system::setParam("routePath", $route); $parts = explode('/', $route); if (!isset($parts[0]) || !$parts[0]) { $parts[0] = $this->routeOptions["default"]["controller"]; } $this->controllerAction =& $action; $this->saveArgs($parts); $controller = array_shift($parts); $action = array_shift($parts); $this->getAdvancedRouting($file, $controller, $action, $model); $this->arg = $action; }