Пример #1
0
 if ($art_id != $spotlight_current->getVar("art_id")) {
     $spotlight_obj =& $spotlight_handler->create();
     $spotlight_obj->setVar("art_id", $art_id);
 } else {
     $spotlight_obj =& $spotlight_current;
 }
 if ($art_id != $spotlight_current->getVar("art_id") || $spotlight_obj->isNew()) {
     $spotlight_obj->setVar("sp_time", time());
 }
 $sp_categories = empty($_POST["sp_categories"]) ? array() : $_POST["sp_categories"];
 $sp_note = $_POST["sp_note"];
 $error_upload = "";
 $sp_image_file = "";
 if (!empty($_FILES['userfile']['name'])) {
     require_once XOOPS_ROOT_PATH . "/modules/" . $GLOBALS["artdirname"] . "/class/uploader.php";
     $uploader = new art_uploader(XOOPS_ROOT_PATH . "/" . $xoopsModuleConfig['path_image']);
     if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
         if (!$uploader->upload()) {
             $error_upload = $uploader->getErrors();
         } elseif (file_exists($uploader->getSavedDestination())) {
             $sp_image_file = $uploader->getSavedFileName();
         }
     } else {
         $error_upload = $uploader->getErrors();
     }
 }
 $sp_image_caption = !empty($_POST["sp_image_caption"]) ? $_POST["sp_image_caption"] : "";
 $sp_image_caption_strip = $myts->htmlSpecialChars($myts->stripSlashesGPC($sp_image_caption));
 $sp_image["caption"] = $sp_image_caption;
 if ($sp_image_file) {
     $sp_image["file"] = $sp_image_file;
Пример #2
0
    if (!empty($_POST[$var])) {
        art_setcookie($var, $_POST[$var]);
    }
}
include XOOPS_ROOT_PATH . "/header.php";
include XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar("dirname") . "/include/vars.php";
// Article actions
// "delete": delete one page
// "edit": edit
// "save": save
// "save_edit": submit and continue to edit
// "publish": regular submission
// "preview": preview and continue to edit
$art_image_file_upload = "";
if ($canupload && empty($_POST["del"]) && empty($_POST["delete"]) && !empty($_FILES["userfile"]["name"])) {
    $uploader = new art_uploader(XOOPS_ROOT_PATH . "/" . $xoopsModuleConfig["path_image"], array("jpg", "png", "gif", "jpeg"));
    if ($uploader->fetchMedia($_POST["xoops_upload_file"][0])) {
        if (!$uploader->upload()) {
            xoops_error($uploader->getErrors());
        } elseif (file_exists($uploader->getSavedDestination())) {
            $art_image_file_upload = $uploader->getSavedFileName();
        }
    } else {
        xoops_error($uploader->getErrors());
    }
    if (!empty($_POST["art_image_file_tmp"])) {
        @unlink(XOOPS_ROOT_PATH . "/" . $xoopsModuleConfig["path_image"] . "/" . $_POST["art_image_file_tmp"]);
        unset($_POST["art_image_file_tmp"]);
    }
}
if (!empty($_POST["del"]) && isset($_POST["page"]) && $art_id > 0) {