Esempio n. 1
0
File: user.php Progetto: ygres/sblog
 function login()
 {
     system::setParam("page", "auth");
     $authRes = false;
     //print_r($this->get);
     $through = system::HTTPGet("through");
     if ($through) {
         $up = user::socialLogin($through);
         if ($up) {
             $userID = user::socialRegister($through, $up);
         }
         if (isset($userID)) {
             $authRes = user::userLogin($userID, '-', $through);
         }
     }
     if (isset($_POST["email"])) {
         system::checkFields(array("email" => "E-mail", "password" => "Пароль"));
         if (!system::checkErrors()) {
             $authRes = user::userLogin();
         }
         if (!$authRes) {
             return system::redirect("/user/passwordRestore");
         }
     }
     if ($authRes) {
         if (isset($_GET["to"]) && $_GET["to"]) {
             system::redirect(urldecode($_GET["to"]), 5, "Вы вошли как <strong>{$_SESSION["user"]["nick"]}</strong>.");
         } else {
             system::redirect("/", 5, "Вы вошли как <strong>{$_SESSION["user"]["nick"]}</strong>.");
         }
     }
 }
Esempio n. 2
0
File: blog.php Progetto: ygres/sblog
 function posts()
 {
     switch (system::HTTPGet("posts")) {
         case "edit":
             $this->editPost();
             break;
         case "write":
             $this->writePost();
             break;
         default:
             system::setParam("page", "posts");
             blog::buildList("content", "blog");
             break;
     }
 }
Esempio n. 3
0
 public static function pagination($allCount, $offset = 1)
 {
     $offset = intval(system::HTTPGet("offset"));
     if ($offset == 0) {
         $offset = 1;
     }
     $smarty = array();
     $smarty["itemsOnPage"] = intval(system::param("itemsOnPage"));
     $smarty["offset"] = $offset;
     $smarty["allCount"] = $allCount;
     $pageCompose = new pagination($allCount);
     $pageCompose->setPerPage($smarty["itemsOnPage"]);
     $pageCompose->readInputData($offset);
     $mysqlLimits = $pageCompose->calculateOffset();
     $smarty["pages"] = $pageCompose->genPages();
     $smarty["pagesTotal"] = count($smarty["pages"]);
     system::$core->smarty->assign("pagination", $smarty);
     return $mysqlLimits;
 }
Esempio n. 4
0
File: blog.php Progetto: ygres/sblog
 function offset()
 {
     $offset = system::HTTPGet("offset");
     if (!$offset) {
         return system::redirect('/');
     }
     $cacheID = "MAINPAGE|offset_{$offset}";
     $this->smarty->setCacheID($cacheID);
     if (!$this->smarty->isCached($cacheID)) {
         $sqlData = index::mainPage();
         $this->smarty->assign("posts", $sqlData);
     }
 }