当前位置: 首页>>代码示例>>PHP>>正文


PHP XoopsMediaUploader::getSavedFileName方法代码示例

本文整理汇总了PHP中XoopsMediaUploader::getSavedFileName方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsMediaUploader::getSavedFileName方法的具体用法?PHP XoopsMediaUploader::getSavedFileName怎么用?PHP XoopsMediaUploader::getSavedFileName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XoopsMediaUploader的用法示例。


在下文中一共展示了XoopsMediaUploader::getSavedFileName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: storeUpload

 function storeUpload($post_field, $response = null, $allowed_mimetypes = null)
 {
     //global $xoopsModuleConfig, $xoopsUser, $xoopsDB, $xoopsModule;
     include_once XHELP_CLASS_PATH . '/uploader.php';
     $config =& xhelpGetModuleConfig();
     $ticketid = $this->getVar('id');
     if (!isset($allowed_mimetypes)) {
         $hMime =& xhelpGetHandler('mimetype');
         $allowed_mimetypes = $hMime->checkMimeTypes();
         if (!$allowed_mimetypes) {
             return false;
         }
     }
     $maxfilesize = $config['xhelp_uploadSize'];
     $maxfilewidth = $config['xhelp_uploadWidth'];
     $maxfileheight = $config['xhelp_uploadHeight'];
     if (!is_dir(XHELP_UPLOAD_PATH)) {
         mkdir(XHELP_UPLOAD_PATH, 0757);
     }
     $uploader = new XoopsMediaUploader(XHELP_UPLOAD_PATH . '/', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
     if ($uploader->fetchMedia($post_field)) {
         if (!isset($response)) {
             $uploader->setTargetFileName($ticketid . "_" . $uploader->getMediaName());
         } else {
             $uploader->setTargetFileName($ticketid . "_" . $response . "_" . $uploader->getMediaName());
         }
         if ($uploader->upload()) {
             $hFile =& xhelpGetHandler('file');
             $file =& $hFile->create();
             $file->setVar('filename', $uploader->getSavedFileName());
             $file->setVar('ticketid', $ticketid);
             $file->setVar('mimetype', $allowed_mimetypes);
             $file->setVar('responseid', isset($response) ? intval($response) : 0);
             if ($hFile->insert($file)) {
                 return $file;
             } else {
                 return $uploader->getErrors();
             }
         } else {
             return $uploader->getErrors();
         }
     }
 }
开发者ID:trabisdementia,项目名称:xuups,代码行数:43,代码来源:responses.php

示例2: createFile

 function createFile($eventId)
 {
     $userId = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getVar('uid') : 0;
     $allowedMimeType = array();
     $mimeType = (include XOOPS_ROOT_PATH . '/class/mimetypes.inc.php');
     foreach ($GLOBALS['xoopsModuleConfig']['allowed_file_extention'] as $fileExt) {
         $allowedMimeType[] = $mimeType[$fileExt];
     }
     $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH . '/uploads/extcal', $allowedMimeType, 3145728);
     $uploader->setPrefix($userId . '-' . $eventId . '_');
     if ($uploader->fetchMedia('event_file')) {
         if (!$uploader->upload()) {
             return false;
         }
     } else {
         return false;
     }
     $data = array('file_name' => $uploader->getSavedFileName(), 'file_nicename' => $uploader->getMediaName(), 'file_mimetype' => $uploader->getMediaType(), 'file_size' => $_FILES['event_file']['size'], 'file_date' => time(), 'file_approved' => 1, 'event_id' => $eventId, 'uid' => $userId);
     $file = $this->create();
     $file->setVars($data);
     return $this->insert($file);
 }
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:22,代码来源:file.php

示例3: XoopsMediaUploader

 }
 if (!empty($_POST['uid'])) {
     $uid = (int) $_POST['uid'];
 }
 if (empty($uid) || $xoopsUser->getVar('uid') != $uid) {
     redirect_header('index.php', 3, _US_NOEDITRIGHT);
 }
 if ($xoopsConfigUser['avatar_allow_upload'] == 1 && $xoopsUser->getVar('posts') >= $xoopsConfigUser['avatar_minposts']) {
     include_once $GLOBALS['xoops']->path('class/uploader.php');
     $uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH . '/avatars', array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png'), $xoopsConfigUser['avatar_maxsize'], $xoopsConfigUser['avatar_width'], $xoopsConfigUser['avatar_height']);
     if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
         $uploader->setPrefix('cavt');
         if ($uploader->upload()) {
             $avt_handler = xoops_getHandler('avatar');
             $avatar = $avt_handler->create();
             $avatar->setVar('avatar_file', 'avatars/' . $uploader->getSavedFileName());
             $avatar->setVar('avatar_name', $xoopsUser->getVar('uname'));
             $avatar->setVar('avatar_mimetype', $uploader->getMediaType());
             $avatar->setVar('avatar_display', 1);
             $avatar->setVar('avatar_type', 'C');
             if (!$avt_handler->insert($avatar)) {
                 @unlink($uploader->getSavedDestination());
             } else {
                 $oldavatar = $xoopsUser->getVar('user_avatar');
                 if (!empty($oldavatar) && false !== strpos(strtolower($oldavatar), 'cavt')) {
                     $avatars = $avt_handler->getObjects(new Criteria('avatar_file', $oldavatar));
                     if (!empty($avatars) && count($avatars) == 1 && is_object($avatars[0])) {
                         $avt_handler->delete($avatars[0]);
                         $oldavatar_path = realpath(XOOPS_UPLOAD_PATH . '/' . $oldavatar);
                         if (0 === strpos($oldavatar_path, XOOPS_UPLOAD_PATH) && is_file($oldavatar_path)) {
                             unlink($oldavatar_path);
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:31,代码来源:edituser.php

示例4: NewsletterCreateDir

     $original_dir = NewsletterCreateDir($dir);
     $mid_dir = NewsletterCreateDir($dir);
     $thumb_dir = NewsletterCreateDir($dir);
     $mid_wh = array(360, 360);
     $thumb_wh = array(300, 300);
     $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/jpg', 'image/png');
     $maxfilesize = 500000000;
     $maxfilewidth = 2000;
     $maxfileheight = 2000;
     $uploader = new XoopsMediaUploader($original_dir, $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
     if ($uploader->fetchMedia('header_img')) {
         $uploader->setPrefix('newsletter_header_');
         if (!$uploader->upload()) {
             echo $uploader->getErrors();
         } else {
             $model_obj->setVar('header_img', $uploader->getSavedFileName());
             setImageThumb($original_dir, $uploader->getSavedFileName(), $mid_dir, 'mid_' . $uploader->getSavedFileName(), array($mid_wh[0], $mid_wh[1]));
             setImageThumb($original_dir, $uploader->getSavedFileName(), $thumb_dir, 'thumb_' . $uploader->getSavedFileName(), array($thumb_wh[0], $thumb_wh[1]));
             if (!empty($header_img)) {
                 unlink(str_replace("\\", "/", realpath($original_dir . $header_img)));
                 unlink(str_replace("\\", "/", realpath($mid_dir . 'mid_' . $header_img)));
                 unlink(str_replace("\\", "/", realpath($thumb_dir . 'thumb_' . $header_img)));
             }
         }
     }
 }
 if ($model_handler->insert($model_obj)) {
     redirect_header('admin.manual.php', 3, '保存成功!');
 } else {
     echo $model_handler->getHtmlErrors();
     redirect_header('admin.manual.php', 3, '保存有誤!');
开发者ID:yunsite,项目名称:xoopsdc,代码行数:31,代码来源:admin.manual.php

示例5: array

    $obj = $helper->getHandlerSmilies()->create();
    $obj->setVar('smiley_code', Request::getString('smiley_code', ''));
    $obj->setVar('smiley_emotion', Request::getString('smiley_emotion', ''));
    $obj->setVar('smiley_display', Request::getBool('smiley_display', 1));
    $obj->setVar('smiley_url', 'smilies/' . Request::getPath('smiley_url', ''));
    $xoops_upload_file = Request::getArray('xoops_upload_file', array());
    $mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png');
    $upload_size = 500000;
    $uploader = new XoopsMediaUploader(\XoopsBaseConfig::get('uploads-path') . '/smilies', $mimetypes, $upload_size, null, null);
    if ($uploader->fetchMedia($xoops_upload_file[0])) {
        $uploader->setPrefix('smil');
        if (!$uploader->upload()) {
            $msg[] = $uploader->getErrors();
            $obj->setVar('smiley_url', 'blank.gif');
        } else {
            $obj->setVar('smiley_url', 'smilies/' . $uploader->getSavedFileName());
        }
    }
    if ($helper->getHandlerSmilies()->insert($obj)) {
        $xoops->redirect('xoops_smilies.php', 2, implode('<br />', $msg));
    }
}
$xoopsTpl = new XoopsTpl();
if ($op === 'more') {
    $xoopsTpl->assign('smileys', Xoops\Module\Helper::getHelper('smilies')->getHandlerSmilies()->getSmilies(0, 0, false));
} else {
    $xoopsTpl->assign('smileys', Xoops\Module\Helper::getHelper('smilies')->getHandlerSmilies()->getActiveSmilies(false));
}
// check user/group
$groups = $xoops->getUserGroups();
$gperm_handler = $xoops->getHandlerGroupPermission();
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:xoops_smilies.php

示例6: array

         }
     }
     if (!empty($_POST["xoops_upload_file"][0])) {
         include_once XOOPS_ROOT_PATH . "/class/uploader.php";
         $link_dir = XOOPS_ROOT_PATH . $xoopsModuleConfig['logo_dir'];
         $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/jpg', 'image/png');
         $maxfilesize = 500000;
         $maxfilewidth = 1200;
         $maxfileheight = 1200;
         $uploader = new XoopsMediaUploader($link_dir, $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
         if ($uploader->fetchMedia('link_image')) {
             $uploader->setPrefix('link_');
             if (!$uploader->upload()) {
                 echo $uploader->getErrors();
             } else {
                 $link_obj->setVar('link_image', $uploader->getSavedFileName());
                 if (!empty($link_image)) {
                     unlink(str_replace("\\", "/", realpath($link_dir . $link_image)));
                 }
             }
         }
     }
     if ($link_handler->insert($link_obj)) {
         redirect_header('admin.links.php?sort=' . $sort, 3, $message);
     } else {
         redirect_header('admin.links.php?sort=' . $sort, 3, _AM_LINKS_ACTIVEERROR);
     }
     break;
 case 'delete':
     $link_obj =& $link_handler->get($link_id);
     if (isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1) {
开发者ID:yunsite,项目名称:xoopsdc,代码行数:31,代码来源:action.links.php

示例7: rmmfSaveImg

/**
 * Guardamos una im?gen
 */
function rmmfSaveImg()
{
    global $db, $mc;
    $id = isset($_POST['id']) ? $_POST['id'] : 0;
    if ($id <= 0) {
        header('location: index.php');
        die;
    }
    include_once '../class/work.class.php';
    $work = new MFWork($id);
    if (!$work->getVar('found')) {
        redirect_header('index.php', 1, _MA_RMMF_ERRNOEXIST);
        die;
    }
    $dir = rmmf_add_slash($mc['storedir']);
    if (!is_uploaded_file($_FILES['archivo']['tmp_name'])) {
        redirect_header('index.php?op=imgs&id=' . $id, 1, _MA_RMMF_ERRIMG);
        die;
    }
    include_once XOOPS_ROOT_PATH . '/class/uploader.php';
    $upload = new XoopsMediaUploader($mc['storedir'], array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/jpg', 'image/pjpg', 'image/x-png', 'image/png'), 1024 * 1024);
    $ext = strrchr($_FILES['archivo']['name'], ".");
    $ext = strtolower($ext);
    do {
        $newname = rmmf_make_random(8, 'mfex') . $ext;
    } while (file_exists($dir . $newname));
    $upload->setTargetFileName($newname);
    $upload->fetchMedia('archivo');
    if (!$upload->upload()) {
        redirect_header("?op=imgs&amp;id=" . $id, 1, $upload->getErrors());
        exit;
    } else {
        $newname = $upload->getSavedFileName();
    }
    // Redimensionamos las im?genes
    rmmf_image_resize($dir . $newname, $dir . $newname, $mc['imgw'], $mc['imgh']);
    if (!is_dir($dir . 'ths/')) {
        mkdir($dir . 'ths/', 0777);
    }
    //rmmf_image_resize($dir . $newname, $dir . 'ths/' . $newname, $mc['thw'], $mc['thh']);
    resize_then_crop($dir . $newname, $dir . 'ths/' . $newname, $mc['thw'], $mc['thh'], 255, 255, 255);
    // Guardamos en la base de datos
    $db->query("INSERT INTO " . $db->prefix("rmmf_images") . " (`archivo`,`work`)\n\t\t\tVALUES ('{$newname}', '{$id}')");
    if ($db->error() != '') {
        redirect_header('index.php?op=imgs&amp;id=' . $id, 2, sprintf(_MA_RMMF_ERRDB, $db->error()));
        die;
    } else {
        redirect_header('index.php?op=imgs&amp;id=' . $id, 2, '');
        die;
    }
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:54,代码来源:index.php

示例8: trim

    $op = trim($_POST['op']);
}
$myts =& MyTextSanitizer::getInstance();
if ($admin && $op == 'SmilesAdd') {
    if (!$GLOBALS['xoopsSecurity']->check()) {
        redirect_header($current_file, 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
    }
    $db =& XoopsDatabaseFactory::getDatabaseConnection();
    include_once XOOPS_ROOT_PATH . '/class/uploader.php';
    $uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH, array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png'), 100000, 120, 120);
    $uploader->setPrefix('smil');
    if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
        if (!$uploader->upload()) {
            $err = $uploader->getErrors();
        } else {
            $smile_url = $uploader->getSavedFileName();
            $smile_code = $myts->stripSlashesGPC($_POST['smile_code']);
            $smile_desc = $myts->stripSlashesGPC($_POST['smile_desc']);
            $smile_display = intval($_POST['smile_display']) > 0 ? 1 : 0;
            $newid = $db->genId($db->prefix('smilies') . "_id_seq");
            $sql = sprintf("INSERT INTO %s (id, code, smile_url, emotion, display) VALUES (%d, %s, %s, %s, %d)", $db->prefix('smiles'), $newid, $db->quoteString($smile_code), $db->quoteString($smile_url), $db->quoteString($smile_desc), $smile_display);
            if (!$db->query($sql)) {
                $err = 'Failed storing smiley data into the database';
            }
        }
    } else {
        $err = $uploader->getErrors();
    }
    if (!isset($err)) {
        unset($_SESSION['XoopsEmotions']);
        unset($_SESSION['XoopsEmotions_expire']);
开发者ID:RanLee,项目名称:Xoops_demo,代码行数:31,代码来源:xoopsemotions.php

示例9: XoopsMediaUploader

if ($op == 'avatarupload') {
    if (!$xoopsGTicket->check(true, 'avatarupload', false)) {
        redirect_header(XOOPS_URL . '/', 3, $xoopsGTiket->getErrors());
        exit;
    }
    if ($myxoopsConfigUser['avatar_allow_upload'] == 1 && $u_obj->getVar('posts', 's') >= $myxoopsConfigUser['avatar_minposts']) {
        include_once XOOPS_ROOT_PATH . '/class/uploader.php';
        $uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH, array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png'), $myxoopsConfigUser['avatar_maxsize'], $myxoopsConfigUser['avatar_width'], $myxoopsConfigUser['avatar_height']);
        $uploader->setAllowedExtensions(array('gif', 'jpeg', 'jpg', 'png'));
        $xoops_upload_file = $formdata->getValueArray('post', 'xoops_upload_file', 's', true);
        if ($uploader->fetchMedia($xoops_upload_file[0])) {
            $uploader->setPrefix('cavt');
            if ($uploader->upload()) {
                $avt_handler =& xoops_gethandler('avatar');
                $avatar =& $avt_handler->create();
                $avatar->setVar('avatar_file', $uploader->getSavedFileName());
                $avatar->setVar('avatar_name', $u_obj->getVar('uname', 'n'), true);
                // not gpc
                $avatar->setVar('avatar_mimetype', $uploader->getMediaType());
                $avatar->setVar('avatar_display', 1);
                $avatar->setVar('avatar_type', 'C');
                if (!$avt_handler->insert($avatar)) {
                    @unlink($uploader->getSavedDestination());
                } else {
                    $oldavatar = $u_obj->getVar('user_avatar', 's');
                    if (!empty($oldavatar) && $oldavatar != 'blank.gif' && !preg_match('/^savt/', strtolower($oldavatar))) {
                        $avatars =& $avt_handler->getObjects(new Criteria('avatar_file', $oldavatar));
                        $avt_handler->delete($avatars[0]);
                        $oldavatar_path = str_replace("\\", '/', realpath(XOOPS_UPLOAD_PATH . '/' . $oldavatar));
                        if (0 === strpos($oldavatar_path, XOOPS_UPLOAD_PATH) && is_file($oldavatar_path)) {
                            unlink($oldavatar_path);
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:31,代码来源:edituser.php

示例10: array

     if (!empty($_FILES['cat_image']['name'])) {
         include_once XOOPS_ROOT_PATH . '/class/uploader.php';
         $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/jpg', 'image/png', 'image/x-png');
         $maxfilesize = 500000;
         $maxfilewidth = 1200;
         $maxfileheight = 1200;
         $uploader = new XoopsMediaUploader($upload_path, $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
         if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
             $uploader->setPrefix('cat_');
             if (!$uploader->upload()) {
                 $error_upload = $uploader->getErrors();
             } elseif (file_exists($uploader->getSavedDestination())) {
                 if ($cat_obj->getVar("cat_image")) {
                     @unlink($upload_path . '/' . $cat_obj->getVar("cat_image"));
                 }
                 $cat_obj->setVar('cat_image', $uploader->getSavedFileName());
             }
         }
     }
     // delete iamge
     if (isset($_POST['delete_image']) && empty($_FILES['cat_image']['name'])) {
         @unlink($upload_path . '/' . $cat_obj->getVar("cat_image"));
         $cat_obj->setVar('cat_image', '');
     }
     // insert object
     if ($cat_id = $category_handler->insert($cat_obj)) {
         redirect_header('admin.category.php', 3, '保存成功');
     }
     break;
 case 'delete':
     $cat_obj =& $category_handler->get($cat_id);
开发者ID:yunsite,项目名称:xoopsdc,代码行数:31,代码来源:action.category.php

示例11: XoopsMediaUploader

         $obj = $userrank_Handler->create();
     }
     $obj->setVar("rank_title", $_POST["rank_title"]);
     $obj->setVar("rank_min", $_POST["rank_min"]);
     $obj->setVar("rank_max", $_POST["rank_max"]);
     $verif_rank_special = $_POST["rank_special"] == 1 ? "1" : "0";
     $obj->setVar("rank_special", $verif_rank_special);
     $uploader_rank_img = new XoopsMediaUploader(\XoopsBaseConfig::get('uploads-url') . '/ranks', $mimetypes, $upload_size, null, null);
     if ($uploader_rank_img->fetchMedia("rank_image")) {
         $uploader_rank_img->setPrefix("rank");
         $uploader_rank_img->fetchMedia("rank_image");
         if (!$uploader_rank_img->upload()) {
             $errors = $uploader_rank_img->getErrors();
             $xoops->redirect("javascript:history.go(-1)", 3, $errors);
         } else {
             $obj->setVar("rank_image", 'ranks/' . $uploader_rank_img->getSavedFileName());
         }
     } else {
         $obj->setVar("rank_image", 'ranks/' . $_POST["rank_image"]);
     }
     if ($userrank_Handler->insert($obj)) {
         $xoops->redirect("userrank.php", 2, _AM_USERRANK_SAVE);
     }
     break;
     // Delete userrank
 // Delete userrank
 case 'userrank_delete':
     $admin_page->addItemButton(_AM_USERRANK_ADD, './userrank.php?op=userrank_new', 'add');
     $admin_page->addItemButton(_AM_USERRANK_LIST, './userrank.php', 'list');
     $admin_page->renderButton();
     $rank_id = $system->cleanVars($_REQUEST, 'rank_id', 0, 'int');
开发者ID:RanLee,项目名称:XoopsCore,代码行数:31,代码来源:userrank.php

示例12: addFolder

function addFolder($language_text = false)
{
    global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $myts, $smartmedia_folder_handler;
    include_once XOOPS_ROOT_PATH . "/class/uploader.php";
    $max_size = 10000000;
    $max_imgwidth = 1000;
    $max_imgheight = 1000;
    $allowed_mimetypes = smartmedia_getAllowedMimeTypes();
    $upload_msgs = array();
    $folderid = isset($_POST['folderid']) ? intval($_POST['folderid']) : 0;
    if (isset($_POST['languageid'])) {
        $languageid = $_POST['languageid'];
    } elseif (isset($_POST['default_languageid'])) {
        $languageid = $_POST['default_languageid'];
    } else {
        $languageid = $xoopsModuleConfig['default_language'];
    }
    if ($folderid != 0) {
        $folderObj = $smartmedia_folder_handler->get($folderid, $languageid);
    } else {
        $folderObj = $smartmedia_folder_handler->create();
    }
    if (!$language_text) {
        /*		// Upload lr_image
                 if ( $_FILES['lr_image_file']['name'] != "" ) {
                 $filename = $_POST["xoops_upload_file"][0] ;
                 if( !empty( $filename ) || $filename != "" ) {
        
                 if( $_FILES[$filename]['tmp_name'] == "" || ! is_readable( $_FILES[$filename]['tmp_name'] ) ) {
                 $upload_msgs[_AM_SMEDIA_FILEUPLOAD_ERROR];
                 } else {
                 $uploader = new XoopsMediaUploader(smartmedia_getImageDir('folder'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight);
                 	
                 if( $uploader->fetchMedia( $filename ) && $uploader->upload() ) {
                 $folderObj->setVar('image_lr', $uploader->getSavedFileName());
                 } else {
                 $upload_msgs[_AM_SMEDIA_FILEUPLOAD_ERROR];
                 }
                 }
                 }
                 } else {
                 $folderObj->setVar('image_lr', $_POST['image_lr']);
                 }
                 */
        // Upload hr_image
        if ($_FILES['hr_image_file']['name'] != "") {
            $filename = $_POST["xoops_upload_file"][0];
            if (!empty($filename) || $filename != "") {
                if ($_FILES[$filename]['tmp_name'] == "" || !is_readable($_FILES[$filename]['tmp_name'])) {
                    $upload_msgs[_AM_SMEDIA_FILEUPLOAD_ERROR];
                } else {
                    $uploader = new XoopsMediaUploader(smartmedia_getImageDir('folder'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight);
                    if ($uploader->fetchMedia($filename) && $uploader->upload()) {
                        $folderObj->setVar('image_hr', $uploader->getSavedFileName());
                    } else {
                        $upload_msgs[_AM_SMEDIA_FILEUPLOAD_ERROR];
                    }
                }
            }
        } else {
            $folderObj->setVar('image_hr', $_POST['image_hr']);
        }
        $folderObj->setVar('statusid', isset($_POST['statusid']) ? intval($_POST['statusid']) : 0);
        $folderObj->setVar('categoryid', isset($_POST['categoryid']) ? intval($_POST['categoryid']) : 0);
        $folderObj->setVar('new_category', isset($_POST['category_action']) ? $_POST['category_action'] == 'add' : false);
        $folderObj->setVar('weight', isset($_POST['weight']) ? intval($_POST['weight']) : 1);
        $folderObj->setVar('default_languageid', isset($_POST['default_languageid']) ? $_POST['default_languageid'] : $xoopsModuleConfig['default_language']);
        $folderObj->setTextVar('languageid', isset($_POST['default_languageid']) ? $_POST['default_languageid'] : $xoopsModuleConfig['default_language']);
    } else {
        $folderObj->setTextVar('languageid', $languageid);
    }
    $folderObj->setTextVar('languageid', $languageid);
    $folderObj->setTextVar('title', $_POST['title']);
    $folderObj->setTextVar('short_title', $_POST['short_title']);
    $folderObj->setTextVar('summary', $_POST['summary']);
    $folderObj->setTextVar('description', $_POST['description']);
    $folderObj->setTextVar('meta_description', $_POST['meta_description']);
    if ($folderObj->isNew()) {
        $redirect_msg = _AM_SMEDIA_FOLDER_CREATED;
        $redirect_to = 'folder.php';
    } else {
        if ($language_text) {
            $redirect_to = 'folder.php?op=mod&folderid=' . $folderObj->folderid();
        } else {
            $redirect_to = 'folder.php';
        }
        $redirect_msg = _AM_SMEDIA_FOLDER_MODIFIED;
    }
    if (!$folderObj->store()) {
        redirect_header("javascript:history.go(-1)", 3, _AM_SMEDIA_FOLDER_SAVE_ERROR . smartmedia_formatErrors($folderObj->getErrors()));
        exit;
    }
    redirect_header($redirect_to, 2, $redirect_msg);
    exit;
}
开发者ID:trabisdementia,项目名称:xuups,代码行数:95,代码来源:folder.php

示例13: XoopsMediaUploader

     $error_msg .= XoopsLocale::E_YOU_NEED_A_POSITIVE_INTEGER . '<br />';
     $obj->setVar("banner_imptotal", 0);
 } else {
     $obj->setVar("banner_imptotal", Request::getInt('imptotal', 0));
 }
 $obj->setVar("banner_clickurl", Request::getString('clickurl', ''));
 $obj->setVar("banner_htmlbanner", Request::getInt('htmlbanner', 0));
 $obj->setVar("banner_htmlcode", Request::getString('htmlcode', ''));
 $uploader_banners_img = new XoopsMediaUploader($xoops_upload_path . '/banners', $mimetypes, $upload_size, null, null);
 if ($uploader_banners_img->fetchMedia("banners_imageurl")) {
     $uploader_banners_img->setPrefix("banner");
     $uploader_banners_img->fetchMedia("banners_imageurl");
     if (!$uploader_banners_img->upload()) {
         $error_msg .= $uploader_banners_img->getErrors();
     } else {
         $obj->setVar("banner_imageurl", $xoops_upload_url . '/banners/' . $uploader_banners_img->getSavedFileName());
     }
 } else {
     if ($_POST["banners_imageurl"] === 'blank.gif') {
         $obj->setVar("banner_imageurl", Request::getString('imageurl', ''));
     } else {
         $obj->setVar("banner_imageurl", $xoops_upload_url . '/banners/' . Request::getString('banners_imageurl', ''));
     }
 }
 if ($error_msg == '') {
     if ($banner_Handler->insert($obj)) {
         $xoops->redirect("banners.php", 2, XoopsLocale::S_ITEM_SAVED);
     }
     $error_msg .= $obj->getHtmlErrors();
 }
 $admin_page->addItemButton(_AM_BANNERS_BANNERS_LIST, 'banners.php', 'application-view-detail');
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:banners.php

示例14: intval

 if (!empty($_POST['uid'])) {
     $uid = intval($_POST['uid']);
 }
 if (empty($uid) || $GLOBALS['xoopsUser']->getVar('uid') != $uid) {
     redirect_header('index.php', 3, _US_NOEDITRIGHT);
     exit;
 }
 if ($GLOBALS['xoopsConfigUser']['avatar_allow_upload'] == 1 && $GLOBALS['xoopsUser']->getVar('posts') >= $GLOBALS['xoopsConfigUser']['avatar_minposts']) {
     include_once $GLOBALS['xoops']->path('class/uploader.php');
     $uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH, array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png'), $GLOBALS['xoopsConfigUser']['avatar_maxsize'], $GLOBALS['xoopsConfigUser']['avatar_width'], $GLOBALS['xoopsConfigUser']['avatar_height']);
     if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
         $uploader->setPrefix('cavt');
         if ($uploader->upload()) {
             $avt_handler =& xoops_gethandler('avatar');
             $avatar =& $avt_handler->create();
             $avatar->setVar('avatar_file', $uploader->getSavedFileName());
             $avatar->setVar('avatar_name', $GLOBALS['xoopsUser']->getVar('uname'));
             $avatar->setVar('avatar_mimetype', $uploader->getMediaType());
             $avatar->setVar('avatar_display', 1);
             $avatar->setVar('avatar_type', 'C');
             if (!$avt_handler->insert($avatar)) {
                 @unlink($uploader->getSavedDestination());
             } else {
                 $oldavatar = $GLOBALS['xoopsUser']->getVar('user_avatar');
                 if (!empty($oldavatar) && preg_match("/^cavt/", strtolower($oldavatar))) {
                     $avatars = $avt_handler->getObjects(new Criteria('avatar_file', $oldavatar));
                     if (!empty($avatars) && count($avatars) == 1 && is_object($avatars[0])) {
                         $avt_handler->delete($avatars[0]);
                         $oldavatar_path = str_replace("\\", "/", realpath(XOOPS_UPLOAD_PATH . '/' . $oldavatar));
                         if (0 === strpos($oldavatar_path, XOOPS_UPLOAD_PATH) && is_file($oldavatar_path)) {
                             unlink($oldavatar_path);
开发者ID:gauravsaxena21,项目名称:simantz,代码行数:31,代码来源:edituser.php

示例15: XoopsMediaUploader

    include XOOPS_ROOT_PATH . '/footer.php';
}
if ($op == 'avatarupload') {
    if (!is_object($xoopsUser) || $xoopsUser->getVar('uid') != $uid) {
        redirect_header('index.php', 3, _US_NOEDITRIGHT);
        exit;
    }
    if ($xoopsConfigUser['avatar_allow_upload'] == 1 && $xoopsUser->getVar('posts') >= $xoopsConfigUser['avatar_minposts']) {
        include_once XOOPS_ROOT_PATH . '/class/uploader.php';
        $uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH, array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png'), $xoopsConfigUser['avatar_maxsize'], $xoopsConfigUser['avatar_width'], $xoopsConfigUser['avatar_height']);
        if ($uploader->fetchMedia($HTTP_POST_VARS['xoops_upload_file'][0])) {
            $uploader->setPrefix('cavt');
            if ($uploader->upload()) {
                $avt_handler =& xoops_gethandler('avatar');
                $avatar =& $avt_handler->create();
                $avatar->setVar('avatar_file', $uploader->getSavedFileName());
                $avatar->setVar('avatar_name', $xoopsUser->getVar('uname'));
                $avatar->setVar('avatar_mimetype', $uploader->getMediaType());
                $avatar->setVar('avatar_display', 1);
                $avatar->setVar('avatar_type', 'C');
                if (!$avt_handler->insert($avatar)) {
                    @unlink($uploader->getSavedDestination());
                } else {
                    $oldavatar = $xoopsUser->getVar('user_avatar');
                    if ($oldavatar && $oldavatar != 'blank.gif' && !preg_match("/^savt/", strtolower($oldavatar))) {
                        $avatars =& $avt_handler->getObjects(new Criteria('avatar_file', $oldavatar));
                        $avt_handler->delete($avatars[0]);
                        @unlink('uploads/' . $oldavatar);
                    }
                    $sql = sprintf("UPDATE %s SET user_avatar = '%s' WHERE uid = %u", $xoopsDB->prefix('users'), $uploader->getSavedFileName(), $xoopsUser->getVar('uid'));
                    $xoopsDB->query($sql);
开发者ID:amjadtbssm,项目名称:website,代码行数:31,代码来源:edituser.php


注:本文中的XoopsMediaUploader::getSavedFileName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。