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"); } }
public static function picture() { if (!portfolio::initialVerify(true)) { echo '<script type="text/javascript">parent.pupld.uploadError ("' . addslashes(json_encode(system::$errors)) . '")</script>'; return; } if (isset($_POST["ajaxFileUpload"]) && isset($_POST["pageDir"])) { if (isset($_POST["slug"]) && $_POST["slug"]) { $slug = preg_replace("/[^a-zа-яё0-9\\-\\_]+/i", '', $_POST["slug"]); } else { $slug = ""; } if (isset($_POST["pageDir"]) && $_POST["pageDir"]) { $pageDir = preg_replace("/[^a-z0-9]+/i", '', $_POST["pageDir"]); } else { $pageDir = ""; } $uploadedPics = blog::uploadOnePicture($slug, $pageDir); $uploadedPics["picUpld"]["itemName"] = $slug; if (!empty($uploadedPics)) { echo '<script type="text/javascript">parent.pupld.uploadFinished ("' . addslashes(json_encode($uploadedPics["picUpld"])) . '")</script>'; } } }
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"); } }
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"); } }