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


PHP XoopsMediaUploader::getErrors方法代码示例

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


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

示例1: publisher_pagewrap_upload

function publisher_pagewrap_upload(&$errors)
{
    $publisher = Publisher::getInstance();
    $post_field = 'fileupload';
    $max_size = $publisher->getConfig('maximum_filesize');
    $max_imgwidth = $publisher->getConfig('maximum_image_width');
    $max_imgheight = $publisher->getConfig('maximum_image_height');
    if (!is_dir(PublisherUtils::getUploadDir(true, 'content'))) {
        mkdir(PublisherUtils::getUploadDir(true, 'content'), 0757);
    }
    $allowed_mimetypes = array('text/html', 'text/plain', 'application/xhtml+xml');
    $uploader = new XoopsMediaUploader(PublisherUtils::getUploadDir(true, 'content') . '/', $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight);
    if ($uploader->fetchMedia($post_field)) {
        $uploader->setTargetFileName($uploader->getMediaName());
        if ($uploader->upload()) {
            return true;
        } else {
            $errors = array_merge($errors, $uploader->getErrors(false));
            return false;
        }
    } else {
        $errors = array_merge($errors, $uploader->getErrors(false));
        return false;
    }
}
开发者ID:mambax7,项目名称:publisher-26,代码行数:25,代码来源:pw_upload_file.php

示例2: publisher_pagewrap_upload

/**
 * @param $errors
 *
 * @return bool
 */
function publisher_pagewrap_upload(&$errors)
{
    //    include_once PUBLISHER_ROOT_PATH . '/class/uploader.php';
    xoops_load('XoopsMediaUploader');
    $publisher =& PublisherPublisher::getInstance();
    $postField = 'fileupload';
    $maxFileSize = $publisher->getConfig('maximum_filesize');
    $maxImageWidth = $publisher->getConfig('maximum_image_width');
    $maxImageHeight = $publisher->getConfig('maximum_image_height');
    if (!is_dir(publisherGetUploadDir(true, 'content'))) {
        mkdir(publisherGetUploadDir(true, 'content'), 0757);
    }
    $allowedMimeTypes = array('text/html', 'text/plain', 'application/xhtml+xml');
    $uploader = new XoopsMediaUploader(publisherGetUploadDir(true, 'content') . '/', $allowedMimeTypes, $maxFileSize, $maxImageWidth, $maxImageHeight);
    if ($uploader->fetchMedia($postField)) {
        $uploader->setTargetFileName($uploader->getMediaName());
        if ($uploader->upload()) {
            return true;
        } else {
            $errors = array_merge($errors, $uploader->getErrors(false));
            return false;
        }
    } else {
        $errors = array_merge($errors, $uploader->getErrors(false));
        return false;
    }
}
开发者ID:trabisdementia,项目名称:publisher,代码行数:32,代码来源:pw_upload_file.php

示例3: formulaire_upload

/**
 * Gestion de l'upload
 */
function formulaire_upload($indice, $dstpath, $destname, $permittedtypes, $maxUploadSize)
{
    //	global $destname;
    //$permittedtypes = array("image/gif","image/pjpeg","image/jpeg","image/x-png") ;
    $permittedtypes = $allowed_mimetypes;
    if (isset($_POST['xoops_upload_file'])) {
        include_once XOOPS_ROOT_PATH . '/class/uploader.php';
        if (isset($_FILES[$_POST['xoops_upload_file'][$indice]])) {
            $fldname = $_FILES[$_POST['xoops_upload_file'][$indice]];
            $fldname = get_magic_quotes_gpc() ? stripslashes($fldname['name']) : $fldname['name'];
            if (xoops_trim($fldname != '')) {
                $uploader = new XoopsMediaUploader($dstpath, $permittedtypes, $maxUploadSize);
                if ($uploader->fetchMedia($_POST['xoops_upload_file'][$indice])) {
                    if ($uploader->upload()) {
                        return true;
                    } else {
                        echo _ERRORS . ' ' . $uploader->getErrors();
                        echo "indice :" . $indice . "<br> dstpath :" . $dstpath . "<br> destname :" . $destname . " - " . $uploadDestName . "<br> permittedtypes :" . $permittedtypes[0] . "-" . $permittedtypes[1] . "-" . $permittedtypes[2] . "-" . $permittedtypes[3] . "<br>Max upload file:" . $maxUploadSize;
                        exit;
                    }
                } else {
                    echo $uploader->getErrors();
                }
            }
        }
    }
    return false;
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:31,代码来源:formulaire.php

示例4: smartsection_pagewrap_upload

function smartsection_pagewrap_upload(&$errors)
{
    include_once SMARTSECTION_ROOT_PATH . "class/uploader.php";
    global $xoopsUser, $xoopsDB, $xoopsModule, $xoopsModule, $xoopsModuleConfig;
    include_once SMARTSECTION_ROOT_PATH . 'class/uploader.php';
    $config =& smartsection_getModuleConfig();
    $post_field = 'fileupload';
    //$allowed_mimetypes = '';
    // TODO : this needs to be managed by the MimeType section but we need a new parameter for allowed mimetype for pagewrap
    /*	if(!isset($allowed_mimetypes)){
           $hMime =& xoops_getmodulehandler('mimetype');
           $allowed_mimetypes = $hMime->checkMimeTypes($post_field);
           if(!$allowed_mimetypes){
           	$errors[] = _SMARTSECTION_MESSAGE_WRONG_MIMETYPE;
               return false;
           }
       }*/
    /*$maxfilesize = $config['xhelp_uploadSize'];
      $maxfilewidth = $config['xhelp_uploadWidth'];
      $maxfileheight = $config['xhelp_uploadHeight'];*/
    $max_size = $xoopsModuleConfig['maximum_filesize'];
    $max_imgwidth = $xoopsModuleConfig['maximum_image_width'];
    $max_imgheight = $xoopsModuleConfig['maximum_image_height'];
    if (!is_dir(smartsection_getUploadDir(true, 'content'))) {
        mkdir(smartsection_getUploadDir(true, 'content'), 0757);
    }
    $allowed_mimetypes = array('text/html', 'text/plain', 'application/xhtml+xml');
    $uploader = new XoopsMediaUploader(smartsection_getUploadDir(true, 'content') . '/', $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight);
    if ($uploader->fetchMedia($post_field)) {
        $uploader->setTargetFileName($uploader->getMediaName());
        if ($uploader->upload()) {
            return true;
        } else {
            $errors = array_merge($errors, $uploader->getErrors(false));
            return false;
        }
    } else {
        $errors = array_merge($errors, $uploader->getErrors(false));
        return false;
    }
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:41,代码来源:pw_upload_file.php

示例5: addTopic

function addTopic()
{
    global $xoopsDB, $xoopsModule, $xoopsModuleConfig;
    $topicpid = isset($_POST['topic_pid']) ? intval($_POST['topic_pid']) : 0;
    $xt = new AmsTopic($xoopsDB->prefix("ams_topics"));
    if (!$xt->topicExists($topicpid, $_POST['topic_title'])) {
        $xt->setTopicPid($topicpid);
        if (empty($_POST['topic_title']) || trim($_POST['topic_title']) == '') {
            redirect_header("index.php?op=topicsmanager", 2, _AMS_AM_ERRORTOPICNAME);
        }
        $xt->setTopicTitle($_POST['topic_title']);
        if (isset($_POST['topic_imgurl']) && $_POST['topic_imgurl'] != "") {
            $xt->setTopicImgurl($_POST['topic_imgurl']);
        }
        if (isset($_POST['xoops_upload_file'])) {
            $fldname = $_FILES[$_POST['xoops_upload_file'][0]];
            $fldname = get_magic_quotes_gpc() ? stripslashes($fldname['name']) : $fldname['name'];
            if (trim($fldname != '')) {
                $sfiles = new sFiles();
                $dstpath = XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->dirname() . '/images/topics';
                $destname = $sfiles->createUploadName($dstpath, $fldname, true);
                $permittedtypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png');
                $uploader = new XoopsMediaUploader($dstpath, $permittedtypes, $xoopsModuleConfig['maxuploadsize']);
                $uploader->setTargetFileName($destname);
                if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
                    if ($uploader->upload()) {
                        $xt->setTopicImgurl(basename($destname));
                    } else {
                        echo _AMS_AM_UPLOAD_ERROR;
                    }
                } else {
                    echo $uploader->getErrors();
                }
            }
        }
        $xt->banner_inherit = isset($_POST['banner_inherit']) ? 1 : 0;
        $xt->banner = $_POST['banner'];
        $xt->forum_id = isset($_POST['forum_id']) ? intval($_POST['forum_id']) : 0;
        if ($xt->store()) {
            //This will set default audience
            global $xoopsModule;
            $allTopics = $xt->getAllTopics();
            $totaltopics = count($allTopics);
            if ($totaltopics = 1) {
                //Make sure xoopsModule is AMS.
                if (!isset($xoopsModule) || $xoopsModule->getVar('dirname') != "AMS") {
                    $mod_handler =& xoops_gethandler('module');
                    $amsModule =& $mod_handler->getByDirname('AMS');
                } else {
                    $amsModule =& $xoopsModule;
                }
                // Check audience, and set default value if not yet exist
                if (!ams_isaudiencesetup($amsModule->getVar('mid'))) {
                    $gperm_handler =& xoops_gethandler('groupperm');
                    $member_handler =& xoops_gethandler('member');
                    $group_id_ref =& $member_handler->getGroups(null, true);
                    //insert all groups into default audience
                    foreach (array_keys($group_id_ref) as $i) {
                        $gperm_handler->addRight("ams_audience", 1, intval($group_id_ref[$i]->getVar('groupid')), intval($amsModule->getVar('mid')));
                    }
                }
            }
            //Added in AMS 2.50 Final. Use News 1.62 permission style
            // Permissions
            $gperm_handler =& xoops_gethandler('groupperm');
            if (isset($_POST['groups_AMS_can_approve'])) {
                foreach ($_POST['groups_AMS_can_approve'] as $onegroup_id) {
                    $gperm_handler->addRight('ams_approve', $xt->topic_id(), $onegroup_id, $xoopsModule->getVar('mid'));
                }
            }
            if (isset($_POST['groups_AMS_can_submit'])) {
                foreach ($_POST['groups_AMS_can_submit'] as $onegroup_id) {
                    $gperm_handler->addRight('ams_submit', $xt->topic_id(), $onegroup_id, $xoopsModule->getVar('mid'));
                }
            }
            if (isset($_POST['groups_AMS_can_view'])) {
                foreach ($_POST['groups_AMS_can_view'] as $onegroup_id) {
                    $gperm_handler->addRight('ams_view', $xt->topic_id(), $onegroup_id, $xoopsModule->getVar('mid'));
                }
            }
            AMS_updateCache();
            $notification_handler =& xoops_gethandler('notification');
            $tags = array();
            $tags['TOPIC_NAME'] = $_POST['topic_title'];
            $notification_handler->triggerEvent('global', 0, 'new_category', $tags);
            redirect_header('index.php?op=topicsmanager', 1, _AMS_AM_DBUPDATED);
            exit;
        }
    } else {
        redirect_header('index.php?op=topicsmanager', 2, _AMS_AM_ADD_TOPIC_ERROR);
        exit;
    }
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:93,代码来源:index.php

示例6: XoopsMediaUploader

     if (isset($_POST["rank_id"])) {
         $obj = $userrank_Handler->get($_POST["rank_id"]);
     } else {
         $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');
开发者ID:RanLee,项目名称:XoopsCore,代码行数:31,代码来源:userrank.php

示例7: trim

             redirect_header('admin.php?fct=filemanager', 2, _AM_SYSTEM_FILEMANAGER_RESTORE_ERROR_FILE_EXISTS);
         }
     }
     break;
 case 'filemanager_upload_save':
     if ($_REQUEST['path'] != '') {
         $path = trim($_REQUEST['path']);
     } else {
         $path = XOOPS_ROOT_PATH . '/';
     }
     include_once XOOPS_ROOT_PATH . '/class/uploader.php';
     $mimetypes = (include $GLOBALS['xoops']->path('include/mimetypes.inc.php'));
     $uploader = new XoopsMediaUploader($path, $mimetypes, 500000);
     if ($uploader->fetchMedia('upload_file')) {
         if (!$uploader->upload()) {
             $err[] =& $uploader->getErrors();
         }
     }
     if (isset($err)) {
         foreach ($err as $line) {
             echo $line;
         }
     }
     redirect_header('admin.php?fct=filemanager', 2, _AM_SYSTEM_FILEMANAGER_UPLOAD_FILE);
     break;
 case 'filemanager_add_dir_save':
     $path = system_CleanVars($_REQUEST, 'path', XOOPS_ROOT_PATH . '/', 'string');
     xoops_load('XoopsFile');
     XoopsFile::load('folder');
     $folder = XoopsFile::getHandler('folder');
     if ($folder->create($path . $_REQUEST['dir_name'], 0777)) {
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:31,代码来源:main.php

示例8: implode

     redirect_header('admin.php?fct=images', 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
 }
 $imgcat_handler =& xoops_gethandler('imagecategory');
 $imagecategory =& $imgcat_handler->get(intval($imgcat_id));
 if (!is_object($imagecategory)) {
     redirect_header('admin.php?fct=images', 1);
 }
 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', 'image/bmp'), $imagecategory->getVar('imgcat_maxsize'), $imagecategory->getVar('imgcat_maxwidth'), $imagecategory->getVar('imgcat_maxheight'));
 $uploader->setPrefix('img');
 $err = array();
 $ucount = count($_POST['xoops_upload_file']);
 for ($i = 0; $i < $ucount; $i++) {
     if ($uploader->fetchMedia($_POST['xoops_upload_file'][$i])) {
         if (!$uploader->upload()) {
             $err[] = $uploader->getErrors();
         } else {
             $image_handler =& xoops_gethandler('image');
             $image =& $image_handler->create();
             $image->setVar('image_name', $uploader->getSavedFileName());
             $image->setVar('image_nicename', $image_nicename);
             $image->setVar('image_mimetype', $uploader->getMediaType());
             $image->setVar('image_created', time());
             $image_display = empty($image_display) ? 0 : 1;
             $image->setVar('image_display', $image_display);
             $image->setVar('image_weight', $image_weight);
             $image->setVar('imgcat_id', $imgcat_id);
             if ($imagecategory->getVar('imgcat_storetype') == 'db') {
                 $fp = @fopen($uploader->getSavedDestination(), 'rb');
                 $fbinary = @fread($fp, filesize($uploader->getSavedDestination()));
                 @fclose($fp);
开发者ID:BackupTheBerlios,项目名称:soopa,代码行数:31,代码来源:main.php

示例9: addTopic

function addTopic()
{
    global $xoopsDB, $xoopsModule, $xoopsModuleConfig;
    $topicpid = isset($_POST['topic_pid']) ? intval($_POST['topic_pid']) : 0;
    $xt = new NewsTopic();
    if (!$xt->topicExists($topicpid, $_POST['topic_title'])) {
        $xt->setTopicPid($topicpid);
        if (empty($_POST['topic_title']) || xoops_trim($_POST['topic_title']) == '') {
            redirect_header("index.php?op=topicsmanager", 2, _AM_ERRORTOPICNAME);
        }
        $xt->setTopicTitle($_POST['topic_title']);
        //$xt->Settopic_rssurl($_POST['topic_rssfeed']);
        $xt->setTopic_color($_POST['topic_color']);
        if (isset($_POST['topic_imgurl']) && $_POST['topic_imgurl'] != "") {
            $xt->setTopicImgurl($_POST['topic_imgurl']);
        }
        $xt->setMenu(intval($_POST['submenu']));
        $xt->setTopicFrontpage(intval($_POST['topic_frontpage']));
        if (isset($_POST['xoops_upload_file'])) {
            $fldname = $_FILES[$_POST['xoops_upload_file'][0]];
            $fldname = get_magic_quotes_gpc() ? stripslashes($fldname['name']) : $fldname['name'];
            if (xoops_trim($fldname != '')) {
                $sfiles = new sFiles();
                $dstpath = XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->dirname() . '/images/topics';
                $destname = $sfiles->createUploadName($dstpath, $fldname, true);
                $permittedtypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png');
                $uploader = new XoopsMediaUploader($dstpath, $permittedtypes, $xoopsModuleConfig['maxuploadsize']);
                $uploader->setTargetFileName($destname);
                if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
                    if ($uploader->upload()) {
                        $xt->setTopicImgurl(basename($destname));
                    } else {
                        echo _AM_UPLOAD_ERROR . ' ' . $uploader->getErrors();
                    }
                } else {
                    echo $uploader->getErrors();
                }
            }
        }
        $xt->setTopicDescription($_POST['topic_description']);
        $xt->store();
        updateCache();
        $notification_handler =& xoops_gethandler('notification');
        $tags = array();
        $tags['TOPIC_NAME'] = $_POST['topic_title'];
        $notification_handler->triggerEvent('global', 0, 'new_category', $tags);
        redirect_header('index.php?op=topicsmanager', 1, _AM_DBUPDATED);
    } else {
        redirect_header('index.php?op=topicsmanager', 2, _AM_ADD_TOPIC_ERROR);
    }
    exit;
}
开发者ID:BackupTheBerlios,项目名称:soopa,代码行数:52,代码来源:index.php

示例10: trim

    $op = trim($_GET['op']);
} elseif (!empty($_POST['op'])) {
    $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)) {
开发者ID:RanLee,项目名称:Xoops_demo,代码行数:31,代码来源:xoopsemotions.php

示例11: implode

         }
     }
 } else {
     $error = true;
 }
 if ($error != false) {
     xoops_header(false);
     echo '</head><body><div style="text-align:center;">' . implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()) . '<br /><input value="' . _BACK . '" type="button" onclick="javascript:history.go(-1);" /></div>';
     xoops_footer();
     exit;
 }
 $uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH, array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png'), $imgcat->getVar('imgcat_maxsize'), $imgcat->getVar('imgcat_maxwidth'), $imgcat->getVar('imgcat_maxheight'));
 $uploader->setPrefix('img');
 if ($uploader->fetchMedia($xoops_upload_file[0])) {
     if (!$uploader->upload()) {
         $err = $uploader->getErrors();
     } else {
         $image_handler =& xoops_gethandler('image');
         $image =& $image_handler->create();
         $image->setVar('image_name', $uploader->getSavedFileName());
         $image->setVar('image_nicename', $image_nicename);
         $image->setVar('image_mimetype', $uploader->getMediaType());
         $image->setVar('image_created', time());
         $image->setVar('image_display', 1);
         $image->setVar('image_weight', 0);
         $image->setVar('imgcat_id', $imgcat_id);
         if ($imgcat->getVar('imgcat_storetype') == 'db') {
             $fp = @fopen($uploader->getSavedDestination(), 'rb');
             $fbinary = @fread($fp, filesize($uploader->getSavedDestination()));
             @fclose($fp);
             $image->setVar('image_body', $fbinary, true);
开发者ID:yunsite,项目名称:xoopsdc,代码行数:31,代码来源:imagemanager.php

示例12: XoopsMediaUploader

        if (!$imgcatpermHandler->checkRight('imgcat_write', $imgcat_id, $GLOBALS['xoopsUser']->getGroups())) {
            $error = _CO_PUBLISHER_IMAGE_CAT_NONE;
        }
    } else {
        if (!$imgcatpermHandler->checkRight('imgcat_write', $imgcat_id, XOOPS_GROUP_ANONYMOUS)) {
            $error = _CO_PUBLISHER_IMAGE_CAT_NOPERM;
        }
    }
}
if ($error === false) {
    xoops_load('XoopsMediaUploader');
    $uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH . '/images', array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png'), $imgcat->getVar('imgcat_maxsize'), $imgcat->getVar('imgcat_maxwidth'), $imgcat->getVar('imgcat_maxheight'));
    $uploader->setPrefix('img');
    if ($uploader->fetchMedia('publisher_upload_file')) {
        if (!$uploader->upload()) {
            $error = implode('<br />', $uploader->getErrors(false));
        } else {
            $imageHandler =& xoops_getHandler('image');
            $image = $imageHandler->create();
            $image->setVar('image_name', 'images/' . $uploader->getSavedFileName());
            $image->setVar('image_nicename', $image_nicename);
            $image->setVar('image_mimetype', $uploader->getMediaType());
            $image->setVar('image_created', time());
            $image->setVar('image_display', 1);
            $image->setVar('image_weight', 0);
            $image->setVar('imgcat_id', $imgcat_id);
            if ($imgcat->getVar('imgcat_storetype') === 'db') {
                $fp = @fopen($uploader->getSavedDestination(), 'rb');
                $fbinary = @fread($fp, filesize($uploader->getSavedDestination()));
                @fclose($fp);
                $image->setVar('image_body', $fbinary, true);
开发者ID:trabisdementia,项目名称:publisher,代码行数:31,代码来源:ajax_upload.php

示例13: XoopsMediaUploader

     if (!empty($filename) || $filename != "") {
         global $xoopsModuleConfig;
         $max_size = 10000000;
         $max_imgwidth = 800;
         $max_imgheight = 800;
         $allowed_mimetypes = ss_getAllowedImagesTypes();
         include_once XOOPS_ROOT_PATH . "/class/uploader.php";
         if ($_FILES[$filename]['tmp_name'] == "" || !is_readable($_FILES[$filename]['tmp_name'])) {
             redirect_header('javascript:history.go(-1)', 2, _AM_SS_FILEUPLOAD_ERROR);
             exit;
         }
         $uploader = new XoopsMediaUploader(ss_getImageDir('item'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight);
         if ($uploader->fetchMedia($filename) && $uploader->upload()) {
             $itemObj->setVar('image', $uploader->getSavedFileName());
         } else {
             redirect_header('javascript:history.go(-1)', 2, _AM_SS_FILEUPLOAD_ERROR . $uploader->getErrors());
             exit;
         }
     }
 } else {
     $itemObj->setVar('image', $_POST['image']);
 }
 //$itemObj->setVar('status', (isset($_POST['status'])) ? intval($_POST['status']) : _SS_STATUS_NOTSET);
 $old_status = $itemObj->status();
 $new_status = isset($_POST['status']) ? intval($_POST['status']) : _SS_STATUS_NOTSET;
 $itemObj->setVar('uid', isset($_POST['uid']) ? intval($_POST['uid']) : 0);
 $itemObj->setVar('datesub', isset($_POST['datesub']) ? strtotime($_POST['datesub']['date']) + $_POST['datesub']['time'] : date());
 $itemObj->setVar('weight', isset($_POST['weight']) ? intval($_POST['weight']) : $itemObj->weight());
 $itemObj->setVar('dohtml', isset($_POST['dohtml']) ? intval($_POST['dohtml']) : 0);
 $itemObj->setVar('dosmiley', isset($_POST['dosmiley']) ? intval($_POST['dosmiley']) : 0);
 $itemObj->setVar('doxcode', isset($_POST['doxcode']) ? intval($_POST['doxcode']) : 0);
开发者ID:BackupTheBerlios,项目名称:soopa,代码行数:31,代码来源:item.php

示例14: realpath

                        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);
                            }
                        }
                    }
                    $sql = sprintf('UPDATE %s SET user_avatar = %s WHERE uid = %u', $xoopsDB->prefix('users'), $xoopsDB->quoteString('avatars/' . $uploader->getSavedFileName()), $xoopsUser->getVar('uid'));
                    $xoopsDB->query($sql);
                    $avt_handler->addUser($avatar->getVar('avatar_id'), $xoopsUser->getVar('uid'));
                    redirect_header('userinfo.php?t=' . time() . '&amp;uid=' . $xoopsUser->getVar('uid'), 3, _US_PROFUPDATED);
                }
            }
        }
        redirect_header('edituser.php?op=avatarform', 3, $uploader->getErrors());
    }
}
if ($op === 'avatarchoose') {
    if (!$GLOBALS['xoopsSecurity']->check()) {
        redirect_header('index.php', 3, _US_NOEDITRIGHT . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
    }
    $uid = 0;
    if (!empty($_POST['uid'])) {
        $uid = (int) $_POST['uid'];
    }
    if (empty($uid) || $xoopsUser->getVar('uid') != $uid) {
        redirect_header('index.php', 3, _US_NOEDITRIGHT);
    }
    $user_avatar = '';
    $avt_handler = xoops_getHandler('avatar');
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:31,代码来源:edituser.php

示例15: XoopsMediaUploader

        if (!$imgcatperm_handler->checkRight('imgcat_write', $imgcat_id, $xoops->user->getGroups())) {
            $error = _CO_PUBLISHER_IMAGE_CAT_NONE;
        }
    } else {
        if (!$imgcatperm_handler->checkRight('imgcat_write', $imgcat_id, FixedGroups::ANONYMOUS)) {
            $error = _CO_PUBLISHER_IMAGE_CAT_NOPERM;
        }
    }
}
$image = null;
if ($error == false) {
    $uploader = new XoopsMediaUploader(\XoopsBaseConfig::get('uploads-path') . '/images', array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png'), $imgcat->getVar('imgcat_maxsize'), $imgcat->getVar('imgcat_maxwidth'), $imgcat->getVar('imgcat_maxheight'));
    $uploader->setPrefix('img');
    if ($uploader->fetchMedia('publisher_upload_file')) {
        if (!$uploader->upload()) {
            $error = implode("<br>", $uploader->getErrors(false));
        } else {
            $image_handler = Images::getInstance()->getHandlerImages();
            $image = $image_handler->create();
            $image->setVar('image_name', $uploader->getSavedFileName());
            $image->setVar('image_nicename', $image_nicename);
            $image->setVar('image_mimetype', $uploader->getMediaType());
            $image->setVar('image_created', time());
            $image->setVar('image_display', 1);
            $image->setVar('image_weight', 0);
            $image->setVar('imgcat_id', $imgcat_id);
            if ($imgcat->getVar('imgcat_storetype') === 'db') {
                $fp = @fopen($uploader->getSavedDestination(), 'rb');
                $fbinary = @fread($fp, filesize($uploader->getSavedDestination()));
                @fclose($fp);
                $image->setVar('image_body', $fbinary);
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:ajax_upload.php


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