Esempio n. 1
0
 function addPage()
 {
     system::setParam("page", "addPage");
     $fill = array();
     $doRedirect = false;
     $slug = "";
     if ($_POST) {
         $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);
         if ($savedPost) {
             $doRedirect = true;
         }
         if ($doRedirect) {
             system::redirect(system::param("urlBase") . "listPage");
         }
     }
     $this->smarty->assign("fill", $fill);
 }
Esempio n. 2
0
 function display()
 {
     if (!isset($this->args[1]) || !isset($this->args[2]) && !isset($this->args[3])) {
         return system::redirect("/");
     }
     $userID = intval($this->args[1]);
     $big = preg_replace(self::image_filter, '', $this->args[2]);
     $small = preg_replace(self::image_filter, '', $this->args[3]);
     system::setParam("page", "display");
     if (!file_exists(CONTENT_PATH . "/screenshots/{$userID}/{$big}")) {
         return system::redirect("/");
     }
     $dh = opendir(CONTENT_PATH . "/screenshots/{$userID}");
     $filename = "";
     $files = array();
     while (false !== ($filename = readdir($dh))) {
         if ($filename == "." || $filename == ".." || $filename == $big || $filename == $small) {
             continue;
         }
         if (preg_match("/_small/", $filename)) {
             continue;
         }
         $stmp = explode(".", $filename);
         $small = $stmp[0] . "_small.png";
         if (!file_exists(CONTENT_PATH . "/screenshots/{$userID}/{$small}")) {
             $small = "";
         }
         $files[] = array("big" => array("url" => system::param("urlBase") . "content/screenshots/{$userID}/{$filename}", "dt" => filemtime(CONTENT_PATH . "/screenshots/{$userID}/{$filename}"), "name" => $filename), "small" => array("url" => system::param("urlBase") . "content/screenshots/{$userID}/{$small}", "dt" => filemtime(CONTENT_PATH . "/screenshots/{$userID}/{$small}"), "name" => $small));
     }
     $this->smarty->assign("img", array("big" => array("url" => system::param("urlBase") . "content/screenshots/{$userID}/{$big}", "dt" => filemtime(CONTENT_PATH . "/screenshots/{$userID}/{$big}"), "name" => $big), "small" => array("url" => system::param("urlBase") . "content/screenshots/{$userID}/{$small}", "dt" => filemtime(CONTENT_PATH . "/screenshots/{$userID}/{$small}"), "name" => $small)));
     $this->smarty->assign("other", $files);
     $this->smarty->assign("userID", $userID);
 }
Esempio n. 3
0
 public static function _url_bbcode_preg($m)
 {
     $base = system::param("siteDomain");
     if (!isset($m[1]) || !$m[1]) {
         return $m[0];
     }
     return "<a target=\"_blank\" href=\"http://{$base}/away?url=" . urlencode($m[1]) . "\">{$m[2]}</a>";
 }
Esempio n. 4
0
 public static function setCookie($id, $data, $time)
 {
     // доменное имя должно держать как минимум 2 точки
     // если сайти на локалхосте - кука не поставится
     // поэтому такой хак
     if ($_SERVER["HTTP_HOST"] == "localhost") {
         $domain = false;
     } else {
         $domain = system::param("siteDomain");
         $domain = ".www.{$domain}";
     }
     return setcookie($id, $data, $time, '/', $domain, false);
 }
Esempio n. 5
0
 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");
     }
 }
Esempio n. 6
0
 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");
     }
 }
Esempio n. 7
0
File: blog.php Progetto: ygres/sblog
 private function editPost()
 {
     $id = intval($_GET["contentID"]);
     if (!$id) {
         return false;
     }
     $doRedirect = false;
     $fill = $_POST;
     if (isset($_POST["slug"]) && $_POST["slug"]) {
         $fill["slug"] = core::generateSlug($_POST["slug"]);
     }
     if (isset($_POST["uploadPicture"])) {
         $uploadedPics = blog::uploadOnePicture($fill["slug"]);
     }
     $fill["poster"] = "";
     if (isset($_FILES["poster"]) && $_FILES["poster"]["error"] == 0) {
         $uploadedPics = blog::uploadOnePicture($fill["slug"], "posterImages");
         if (isset($uploadedPics["poster"]) && $uploadedPics["poster"]) {
             $fill["poster"] = serialize($uploadedPics["poster"]);
         }
     }
     if (isset($_POST["savePost"])) {
         if (blog::updatePost($id, $fill)) {
             $doRedirect = true;
         }
     }
     blog::getAllCats($id);
     system::setParam("page", "editPost");
     $sqlData = blog::buildForm("content", array("AND `contentID`={$id}"));
     blog::showAttachedPics($sqlData);
     $this->smarty->assign("annotationRestriction", system::param("annotationRestriction"));
     if ($doRedirect) {
         system::redirect("/adm/blog/posts");
     }
 }
Esempio n. 8
0
 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);
 }
Esempio n. 9
0
 public function isCached($template = NULL, $cache_id = NULL, $compile_id = NULL, $parent = NULL)
 {
     if ($template) {
         $tpl = $template;
     } else {
         $tpl = system::param("page");
     }
     if ($cache_id) {
         $cacheID = $cache_id;
     } else {
         $cacheID = $this->cacheIdShow;
     }
     $checkStr = "{$tpl}.tpl";
     if (system::param("templateBase")) {
         $checkStr = "extends:" . system::param("templateBase") . "|{$checkStr}";
     }
     return parent::isCached($checkStr, $cacheID);
 }
Esempio n. 10
0
 public static function updateCategory($categoryID, $data)
 {
     self::$db->updateTable("categories", $data, "categoryID", $categoryID);
     system::redirect(system::param("urlBase") . "categories");
 }
Esempio n. 11
0
 public function display()
 {
     if (!system::$display) {
         return;
     }
     $this->smarty->assign("args", $this->args);
     $this->smarty->assign("get", $this->get);
     $page = system::param("page");
     $debug = system::param("debug");
     if ($this->controllerCall && $this->controllerCall != "index" && $this->pageWasSet) {
         $page = $this->controllerCall;
     }
     $page .= ".tpl";
     if ($debug && system::param("debugSmartyOutput")) {
         $this->smarty->assign("debugOut", $this->db->buildHtmlLog());
     }
     if ($this->moduleDisplayMode) {
         $this->smarty->moduleDisplay($page);
     } else {
         $this->smarty->display($page);
     }
     if ($debug && !system::param("debugSmartyOutput")) {
         echo $this->db->buildHtmlLog();
     }
 }
Esempio n. 12
0
<?php

/*!
* HybridAuth
* http://hybridauth.sourceforge.net | http://github.com/hybridauth/hybridauth
* (c) 2009-2012, HybridAuth authors | http://hybridauth.sourceforge.net/licenses.html
*/
// ----------------------------------------------------------------------------------------
//	HybridAuth Config file: http://hybridauth.sourceforge.net/userguide/Configuration.html
// ----------------------------------------------------------------------------------------
return array("base_url" => "http://" . system::param("siteDomain") . "/engine/libs/hybridauth/", "providers" => array("OpenID" => array("enabled" => true), "Vkontakte" => array("enabled" => true, "keys" => array("id" => "", "secret" => "")), "Yahoo" => array("enabled" => true, "keys" => array("id" => "", "secret" => "")), "AOL" => array("enabled" => true), "Google" => array("enabled" => true, "keys" => array("id" => "", "secret" => ""), "scope" => "https://www.googleapis.com/auth/userinfo.profile " . "https://www.googleapis.com/auth/userinfo.email", "access_type" => "offline", "approval_prompt" => "force"), "Facebook" => array("enabled" => true, "keys" => array("id" => "", "secret" => ""), "scope" => "email, user_about_me"), "Twitter" => array("enabled" => true, "keys" => array("key" => "", "secret" => "")), "Live" => array("enabled" => true, "keys" => array("id" => "", "secret" => "")), "MySpace" => array("enabled" => true, "keys" => array("key" => "", "secret" => "")), "LinkedIn" => array("enabled" => true, "keys" => array("key" => "", "secret" => "")), "Foursquare" => array("enabled" => true, "keys" => array("id" => "", "secret" => ""))), "debug_mode" => false, "debug_file" => "");
Esempio n. 13
0
 private static function __smarty_url_handler($matches)
 {
     if (isset($matches[1]) && $matches[1]) {
         return $matches[0];
     }
     //print_r ( $matches );
     if (isset($matches[3]) && $matches[3]) {
         $base = system::param("siteDomain");
         $protocol = "http://";
         $postfix = "...";
         if (isset($matches[2]) && $matches[2]) {
             $protocol = $matches[2];
         }
         $mask = substr($matches[3], 0, 50);
         $maskInt = $protocol . $matches[3];
         if ($mask == $matches[3]) {
             $postfix = "";
         }
         if (preg_match("/([a-zа-яё0-9-._]+\\.[a-zа-яё0-9]{2,4})(?:\\/.*)/ui", $matches[3], $m2)) {
             if (isset($m2[1]) && $m2[1] == $base) {
                 return "<a target=\"_blank\" href=\"http://{$matches[3]}\">{$mask}{$postfix}</a>";
             } else {
                 return "<a target=\"_blank\" href=\"http://{$base}/away/?url=" . urlencode($maskInt) . "\">{$mask}{$postfix}</a>";
             }
         } else {
             return "<a target=\"_blank\" href=\"http://{$base}/away/?url=" . urlencode($maskInt) . "\">{$mask}{$postfix}</a>";
         }
     }
     return "";
 }
Esempio n. 14
0
 function addPage()
 {
     system::setParam("page", "addPage");
     article::getAllCats();
     $fill = array();
     $doRedirect = false;
     if (!empty($_POST["slug"])) {
         $fill["slug"] = core::generateSlug($_POST["slug"]);
     } else {
         if (!empty($_POST["title"])) {
             $fill["slug"] = core::generateSlug($_POST["title"]);
         }
     }
     $fill += $_POST;
     if (isset($_POST["picRealUpload"])) {
         $uploadedPics = blog::uploadOnePicture($fill["slug"]);
     }
     $fill["poster"] = "";
     if (isset($_FILES["poster"]) && $_FILES["poster"]["error"] == 0) {
         $uploadedPics = blog::uploadOnePicture($fill["slug"], "articleImages");
         if (isset($uploadedPics["poster"]) && $uploadedPics["poster"]) {
             $fill["poster"] = serialize($uploadedPics["poster"]);
         }
     }
     if (isset($_POST["savePost"])) {
         $savedPost = blog::writePost($fill, "article");
         if ($savedPost) {
             $doRedirect = true;
         }
     }
     blog::showAttachedPics($fill);
     $this->smarty->assign("fill", $fill);
     if ($doRedirect) {
         system::redirect(system::param("urlBase") . "listPage");
     }
 }
Esempio n. 15
0
 public static function redirect($url, $delay = false, $txt = "")
 {
     // первый символ /, заменими его на полный путь
     if (substr($url, 0, 1) == '/') {
         $url = system::param("urlBase") . substr($url, 1, strlen($url));
     }
     $delay = intval($delay);
     $url = addslashes($url);
     if (!empty($txt)) {
         self::$core->smarty->assign("text", $txt);
         self::$core->smarty->assign("delay", $delay);
         self::$core->smarty->assign("url", $url);
         self::setParam("page", "redirect");
     }
     if ($delay) {
         $form = 'Refresh: ' . $delay . '; URL=' . $url;
     } else {
         $form = 'Location: ' . $url;
     }
     return header($form);
 }