예제 #1
0
/**
 * 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;
}
예제 #2
0
function genobio_uploading($uploaddir = "uploads", $allowed_mimetypes = '', $redirecturl = "index.php", $num = 0, $redirect = 0, $usertype = 1, $index = 0)
{
    global $_FILES, $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
    $down = array();
    include_once XOOPS_ROOT_PATH . "/modules/genobio/class/uploader.php";
    $upload_dir = XOOPS_ROOT_PATH . "/" . $uploaddir . "/";
    genobio_makeWritable($upload_dir);
    $maxfilesize = isset($xoopsModuleConfig['maxfilesize']) ? $xoopsModuleConfig['maxfilesize'] : 10000000000.0;
    $maxfilewidth = isset($xoopsModuleConfig['maximgwidth']) ? $xoopsModuleConfig['maximgwidth'] : 5000;
    $maxfileheight = isset($xoopsModuleConfig['maximgheight']) ? $xoopsModuleConfig['maximgheight'] : 5000;
    $uploader = new XoopsMediaUploader($upload_dir, $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
    $uploader->setPrefix('img_' . time());
    $uploader->noAdminSizeCheck(1);
    if ($uploader->fetchMedia($_POST['xoops_upload_file'][$num])) {
        if (!$uploader->upload()) {
            $down['error'] = $uploader->getErrors();
            return $down;
        } else {
            if ($redirect) {
                redirect_header($redirecturl, 1, _AM_PDD_UPLOADFILE);
            } else {
                if (is_file($uploader->savedDestination)) {
                    $down['path'] = "/" . $uploaddir . "/" . strtolower($uploader->savedFileName);
                    $down['size'] = filesize(XOOPS_ROOT_PATH . "/" . $uploaddir . "/" . strtolower($uploader->savedFileName));
                }
                return $down;
            }
        }
    } else {
        $down['error'] = $uploader->getErrors();
        return $down;
    }
}
예제 #3
0
/**
 * @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;
    }
}
예제 #4
0
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;
    }
}
예제 #5
0
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;
    }
}
예제 #6
0
 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);
 }
예제 #7
0
 // Uploading the logo, if any
 // Retreive the filename to be uploaded
 if ($_FILES['logo_file']['name'] != "") {
     $filename = $_POST["xoops_upload_file"][0];
     if (!empty($filename) || $filename != "") {
         global $xoopsModuleConfig;
         $max_size = 10000000;
         $max_imgwidth = $xoopsModuleConfig['img_max_width'];
         $max_imgheight = $xoopsModuleConfig['img_max_height'];
         $allowed_mimetypes = smartclient_getAllowedMimeTypes();
         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, _CO_SCLIENT_FILE_UPLOAD_ERROR);
             exit;
         }
         $uploader = new XoopsMediaUploader(smartclient_getImageDir(), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight);
         // TODO : prefix the image file with the clientid, but for that we need to first save the client to get clientid...
         // $uploader->setTargetFileName($clientObj->clientid() . "_" . $_FILES['logo_file']['name']);
         if ($uploader->fetchMedia($filename) && $uploader->upload()) {
             $clientObj->setVar('image', $uploader->getSavedFileName());
         } else {
             redirect_header('javascript:history.go(-1)', 2, _CO_SCLIENT_FILE_UPLOAD_ERROR . $uploader->getErrors());
             exit;
         }
     }
 } else {
     $clientObj->setVar('image', $_POST['image']);
 }
 // Putting the values in the client object
 $clientObj->setVar('id', isset($_POST['id']) ? intval($_POST['id']) : 0);
 $clientObj->setVar('status', isset($_POST['status']) ? intval($_POST['status']) : 0);
예제 #8
0
     redirect_header('index.php', 3, _US_NOEDITRIGHT . '<br>' . implode('<br>', $GLOBALS['xoopsSecurity']->getErrors()));
 }
 $xoops_upload_file = array();
 $uid = 0;
 if (!empty($_POST['xoops_upload_file']) && is_array($_POST['xoops_upload_file'])) {
     $xoops_upload_file = $_POST['xoops_upload_file'];
 }
 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')) {
예제 #9
0
$gperm_handler =& xoops_gethandler('groupperm');
$admin = $gperm_handler->checkRight('system_admin', XOOPS_SYSTEM_SMILE, $groups);
$op = '';
if (!empty($_GET['op'])) {
    $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';
            }
        }
예제 #10
0
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;
    }
}
예제 #11
0
파일: file.php 프로젝트: ming-hai/XoopsCore
 /**
  * @param string      $post_field
  * @param array       $allowed_mimetypes
  * @param array       $errors
  *
  * @return bool
  */
 public function storeUpload($post_field, $allowed_mimetypes = array(), &$errors)
 {
     $itemid = $this->getVar('itemid');
     if (empty($allowed_mimetypes)) {
         $allowed_mimetypes = $this->publisher->getMimetypeHandler()->getArrayByType();
     }
     $maxfilesize = $this->publisher->getConfig('maximum_filesize');
     $maxfilewidth = $this->publisher->getConfig('maximum_image_width');
     $maxfileheight = $this->publisher->getConfig('maximum_image_height');
     if (!is_dir(PublisherUtils::getUploadDir())) {
         mkdir(PublisherUtils::getUploadDir(), 0757);
     }
     $uploader = new XoopsMediaUploader(PublisherUtils::getUploadDir() . '/', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
     if ($uploader->fetchMedia($post_field)) {
         $uploader->setTargetFileName($itemid . "_" . $uploader->getMediaName());
         if ($uploader->upload()) {
             $this->setVar('filename', $uploader->getSavedFileName());
             if ($this->getVar('name') == '') {
                 $this->setVar('name', $this->getNameFromFilename());
             }
             $this->setVar('mimetype', $uploader->getMediaType());
             return true;
         } else {
             $errors = array_merge($errors, $uploader->getErrors(false));
             return false;
         }
     } else {
         $errors = array_merge($errors, $uploader->getErrors(false));
         return false;
     }
 }
예제 #12
0
 } else {
     $greenep_obj =& $greenep_handler->create();
 }
 foreach (array_keys($greenep_obj->vars) as $key) {
     if (isset($_POST[$key])) {
         $greenep_obj->setVar($key, $_POST[$key]);
     }
 }
 if (!empty($_POST["xoops_upload_file"])) {
     include_once XOOPS_ROOT_PATH . "/class/uploader.php";
     $logo_dir = XOOPS_ROOT_PATH . "/uploads/";
     $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/jpg', 'image/png');
     $maxfilesize = 500000;
     $maxfilewidth = 2200;
     $maxfileheight = 2200;
     $uploader = new XoopsMediaUploader($logo_dir, $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
     if ($uploader->fetchMedia('greenep_logo')) {
         $uploader->setPrefix('greenep_');
         if (!$uploader->upload()) {
             echo $uploader->getErrors();
         } else {
             $greenep_obj->setVar('greenep_logo', $uploader->getSavedFileName());
             if (!empty($greenep_logo)) {
                 unlink(str_replace("\\", "/", realpath($logo_dir . $greenep_logo)));
             }
         }
     }
 }
 if ($greenep_handler->insert($greenep_obj)) {
     redirect_header('admin.greenep.php', 3, _AM_CATALOG_ACTIVSUCCESS);
 } else {
예제 #13
0
 // Uploading the image, if any
 // Retreive the filename to be uploaded
 if ($_FILES['image_file']['name'] != "") {
     $filename = $_POST["xoops_upload_file"][0];
     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());
예제 #14
0
             exit;
         }
     }
     redirect_header('admin.php?fct=images', 2, _MD_AM_DBUPDATED);
 }
 if ($op == 'addfile') {
     if (!$GLOBALS['xoopsSecurity']->check()) {
         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;
예제 #15
0
     $admin_page->renderButton();
     $xoops->tpl()->assign('info_msg', $xoops->alert('info', $info_msg, XoopsLocale::INFORMATION_FOR_UPLOADS));
     // Create form
     $obj = $avatar_Handler->get(Request::getInt('avatar_id', 0));
     $form = $xoops->getModuleForm($obj, 'avatar');
     // Assign form
     $xoops->tpl()->assign('form', $form->render());
     break;
     // Save
 // Save
 case "save":
     // Check security
     if (!$xoops->security()->check()) {
         $xoops->redirect('avatar_custom.php', 3, implode('<br />', $xoops->security()->getErrors()));
     }
     $uploader_avatars_img = new XoopsMediaUploader($xoops_upload_path . '/avatars', $mimetypes, $upload_size, $width, $height);
     // Get avatar id
     $avatar_id = Request::getInt('avatar_id', 0);
     if ($avatar_id > 0) {
         $obj = $avatar_Handler->get($avatar_id);
     } else {
         $obj = $avatar_Handler->create();
     }
     $error_msg = '';
     $obj->setVars($_POST);
     if (preg_match('/^\\d+$/', $_POST["avatar_weight"]) == false) {
         $error_msg .= XoopsLocale::E_YOU_NEED_A_POSITIVE_INTEGER . '<br />';
         $obj->setVar("avatar_weight", 0);
     } else {
         $obj->setVar("avatar_weight", Request::getInt('avatar_weight', 0));
     }
예제 #16
0
     } else {
         redirect_header("admin.php?fct=userrank&amp;op=RankForumAdmin", 1, _MD_AM_DBUPDATED);
     }
     break;
 case "RankForumSave":
     $rank_id = isset($_POST['rank_id']) ? intval($_POST['rank_id']) : 0;
     if ($rank_id <= 0 | !$GLOBALS['xoopsSecurity']->check()) {
         redirect_header("admin.php?fct=userrank", 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
     }
     $db =& Database::getInstance();
     $myts =& MyTextSanitizer::getInstance();
     $rank_special = isset($_POST['rank_special']) && intval($_POST['rank_special']) ? 1 : 0;
     $rank_title = $myts->stripSlashesGPC($_POST['rank_title']);
     $delete_old_image = false;
     include_once XOOPS_ROOT_PATH . '/class/uploader.php';
     $uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH, array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png'), 100000, 120, 120);
     $uploader->setPrefix('rank');
     if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
         if ($uploader->upload()) {
             $rank_image = $uploader->getSavedFileName();
             $delete_old_image = true;
         }
     }
     if ($rank_special > 0) {
         $_POST['rank_min'] = $_POST['rank_max'] = -1;
     }
     $sql = "UPDATE " . $db->prefix("ranks") . " SET rank_title = " . $db->quoteString($rank_title) . ", rank_min = " . intval($_POST['rank_min']) . ", rank_max = " . intval($_POST['rank_max']) . ", rank_special = " . $rank_special;
     if ($delete_old_image) {
         $sql .= ", rank_image = " . $db->quoteString($rank_image);
     }
     $sql .= " WHERE rank_id = " . $rank_id;
예제 #17
0
$op = Request::getCmd('op', '');
if ($op === 'save') {
    if (!$xoops->security()->check()) {
        $xoops->redirect('xoops_xlanguage.php', 2, implode(',', $xoops->security()->getErrors()));
    }
    XoopsLoad::load('system', 'system');
    $msg[] = _AM_SMILIES_SAVE;
    $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') {
예제 #18
0
 $HotelObj->setVar('hotel_alias', isset($_POST['hotel_alias']) ? $alias_url : '');
 $HotelObj->setVar('hotel_keywords', isset($_POST['hotel_keywords']) ? addslashes($_POST['hotel_keywords']) : '');
 $HotelObj->setVar('hotel_tags', isset($_POST['hotel_tags']) ? addslashes($_POST['hotel_tags']) : '');
 $HotelObj->setVar('hotel_description', isset($_POST['hotel_description']) ? addslashes($_POST['hotel_description']) : '');
 $HotelObj->setVar('hotel_star', isset($_POST['hotel_star']) ? intval($_POST['hotel_star']) : 0);
 $HotelObj->setVar('hotel_address', isset($_POST['hotel_address']) ? addslashes($_POST['hotel_address']) : '');
 $HotelObj->setVar('hotel_telephone', isset($_POST['hotel_telephone']) ? addslashes($_POST['hotel_telephone']) : '');
 $HotelObj->setVar('hotel_fax', isset($_POST['hotel_fax']) ? addslashes($_POST['hotel_fax']) : '');
 $HotelObj->setVar('hotel_room_count', isset($_POST['hotel_room_count']) ? intval($_POST['hotel_room_count']) : 0);
 //file upload
 $hotel_icon = isset($_POST['hotel_icon_old']) ? $_POST['hotel_icon_old'] : null;
 include XOOPS_ROOT_PATH . '/class/uploader.php';
 if (!empty($_FILES['hotel_icon']['tmp_name'])) {
     $path = MARTIN_ROOT_PATH . '/images/hotelicon/';
     $FileTypeUpload = array("image/jpg", "image/png", "image/gif", "image/jpeg");
     $uploader = new XoopsMediaUploader($path, $FileTypeUpload, 2048 * 1024);
     if ($uploader->fetchMedia($_POST["xoops_upload_file"][0])) {
         $uploader->ext = strtolower(ltrim(strrchr($uploader->getMediaName(), '.'), '.'));
         $SaveFileName = time() . rand(1000, 10000) . "." . $uploader->ext;
         $uploader->setTargetFileName($SaveFileName);
         if (!$uploader->upload()) {
             xoops_error($uploader->getErrors());
             exit;
         } elseif (file_exists($uploader->getSavedDestination())) {
             //delete images
             if (!empty($hotel_icon)) {
                 unlink(MARTIN_ROOT_PATH . '/images/hotelicon/' . $hotel_icon);
             }
             $hotel_icon = $uploader->getSavedFileName();
         }
     } else {
 if ($_FILES['mp3file']['name'] != '' && $_POST['link'] != '') {
     redirect_header('index.php', 1, _AM_DEBASER_UPLOADFILELINKNO);
     die;
 }
 if (isset($_FILES['mp3file'])) {
     /* sets the value for admin uploads */
     $usertype = 1;
     /* -- */
     /* checks the mimetype of the file and if the user is allowed to upload this one */
     $allowed_mimetypes = retdebasermime($_FILES['mp3file']['name'], $usertype);
     /* -- */
     /* reads the maximum size for uploads defined in preferences */
     $maxfilesize = $xoopsModuleConfig['debasermaxsize'];
     /* -- */
     $uploaddir = XOOPS_ROOT_PATH . '/modules/debaser/upload/';
     $uploader = new XoopsMediaUploader($uploaddir, $allowed_mimetypes, $maxfilesize);
     if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
         if (!$uploader->upload()) {
             @unlink($uploaddir . $uploader->getSavedFileName());
             $errors = $uploader->getErrors();
             redirect_header("upload.php", 2, $errors);
         } else {
         }
         $filename = $uploader->getSavedFileName();
         $filepath = $uploaddir . $uploader->getSavedFileName();
         $mimetyp = debasermimecompare();
         require_once '../class/getid3/getid3.php';
         $getID3 = new getID3();
         $ThisFileInfo = $getID3->analyze($filepath);
         getid3_lib::CopyTagsToComments($ThisFileInfo);
         include XOOPS_ROOT_PATH . '/modules/debaser/include/readinfo.php';
예제 #20
0
if (!is_object($imgcat)) {
    $error = _CO_PUBLISHER_IMAGE_CAT_NONE;
} else {
    $imgcatperm_handler = xoops_gethandler('groupperm');
    if (is_object($xoopsUser)) {
        if (!$imgcatperm_handler->checkRight('imgcat_write', $imgcat_id, $xoopsUser->getGroups())) {
            $error = _CO_PUBLISHER_IMAGE_CAT_NONE;
        }
    } else {
        if (!$imgcatperm_handler->checkRight('imgcat_write', $imgcat_id, XOOPS_GROUP_ANONYMOUS)) {
            $error = _CO_PUBLISHER_IMAGE_CAT_NOPERM;
        }
    }
}
if ($error == false) {
    $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('publisher_upload_file')) {
        if (!$uploader->upload()) {
            $error = implode("<br />", $uploader->getErrors(false));
        } 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') {
    $form2->addElement(new XoopsFormHidden('uid', $uid));
    $form2->addElement(new XoopsFormHidden('op', 'avatarchoose'));
    $xoopsGTicket->addTicketXoopsFormElement($form2, __LINE__, 1800, 'avatarchoose');
    $form2->addElement(new XoopsFormButton('', 'submit2', _SUBMIT, 'submit'));
    $form2->display();
    include XOOPS_ROOT_PATH . '/footer.php';
    exit;
}
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());
예제 #22
0
         $res_obj->setVar($key, $_POST[$key]);
     }
 }
 $res_obj->setVar('update_time', time());
 // insert object
 if ($res_id = $resources_handler->insert($res_obj)) {
     // upload annex
     $att_num = $res_obj->getVar('res_attachment');
     if (!empty($_POST["xoops_upload_file"])) {
         include_once XOOPS_ROOT_PATH . "/class/uploader.php";
         if (Resourcesmkdirs(XOOPS_UPLOAD_PATH . '/' . $xoopsModule->dirname())) {
             $files_dir = XOOPS_UPLOAD_PATH . '/' . $xoopsModule->dirname();
         }
         $allowed_mimetypes = $att_handler->getTypes();
         $maxfilesize = 50000000;
         $uploader = new XoopsMediaUploader($files_dir, $allowed_mimetypes, $maxfilesize);
         foreach ($_POST["xoops_upload_file"] as $k => $v) {
             if ($uploader->fetchMedia($v)) {
                 $uploader->setPrefix('support_');
                 if (!$uploader->upload()) {
                     echo $uploader->getErrors();
                 } else {
                     $att_obj =& $att_handler->create();
                     $att_obj->setVar('res_id', $res_id);
                     if (!empty($xoopsUser)) {
                         $att_obj->setVar('uid', $xoopsUser->getVar("uid"));
                     }
                     $att_obj->setVar("att_filename", $uploader->getMediaName());
                     $att_obj->setVar("att_attachment", $uploader->getSavedFileName());
                     $att_obj->setVar("att_type", $uploader->getMediaType());
                     $att_obj->setVar("att_size", $uploader->getMediaSize());
예제 #23
0
         } else {
             if (!$imgcatperm_handler->checkRight('imgcat_write', $imgcat_id, XOOPS_GROUP_ANONYMOUS)) {
                 $error = true;
             }
         }
     }
 } 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') {
예제 #24
0
                 redirect_header('admin.php?fct=filemanager', 2, _AM_SYSTEM_FILEMANAGER_RESTORE_ERROR_FILE_DELETE);
             }
         } else {
             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');
예제 #25
0
     $link_obj =& $link_handler->create();
     $message = _AM_LINKS_SAVEDSUCCESS;
 }
 foreach (array_keys($link_obj->vars) as $key) {
     if (isset($_POST[$key]) && $_POST[$key] != $link_obj->getVar($key)) {
         $link_obj->setVar($key, $_POST[$key]);
     }
 }
 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 {
예제 #26
0
         if (!$imgcatperm_handler->checkRight('imgcat_write', $imgcat_id, $xoopsUser->getGroups())) {
             $error = true;
         }
     } else {
         if (!$imgcatperm_handler->checkRight('imgcat_write', $imgcat_id, XOOPS_GROUP_ANONYMOUS)) {
             $error = true;
         }
     }
 }
 if ($error != false) {
     xoops_header(false);
     echo '</head><body><div style="text-align:center;"><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($HTTP_POST_VARS['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') {
예제 #27
0
/**
 * 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;
    }
}
예제 #28
0
     if (isset($_POST[$key]) && $_POST[$key] != $cat_obj->getVar($key)) {
         $cat_obj->setVar($key, $_POST[$key]);
     }
 }
 $cat_obj->setVar('update_time', time());
 if (Resourcesmkdirs(XOOPS_UPLOAD_PATH . '/' . $xoopsModule->dirname())) {
     $upload_path = XOOPS_UPLOAD_PATH . '/' . $xoopsModule->dirname();
 }
 // upload image
 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"));
예제 #29
0
         foreach ($lines as $line) {
             echo 'preview_window.document.writeln("' . str_replace('"', '\\"', $line) . '");';
         }
         echo '
     preview_window.focus();
     preview_window.document.close();
     //-->
     </script>';
     }
     break;
 case 'update':
     if (!$GLOBALS['xoopsSecurity']->check()) {
         redirect_header('admin.php?fct=tplsets', 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
     }
     include_once XOOPS_ROOT_PATH . '/class/uploader.php';
     $uploader = new XoopsMediaUploader(XOOPS_UPLOAD_PATH, array('text/html', 'application/x-cdf'), 200000);
     $uploader->setPrefix('tmp');
     $msg = array();
     foreach ($_POST['xoops_upload_file'] as $upload_file) {
         // '.' is converted to '_' when upload
         $upload_file2 = str_replace('.', '_', $upload_file);
         if ($uploader->fetchMedia($upload_file2)) {
             if (!$uploader->upload()) {
                 $msg[] = $uploader->getErrors();
             } else {
                 $tpltpl_handler =& xoops_gethandler('tplfile');
                 if (!isset($old_template[$upload_file])) {
                     $tplfile =& $tpltpl_handler->find('default', null, null, $moddir, $upload_file);
                     if (count($tplfile) > 0) {
                         $tpl =& $tplfile[0]->xoopsClone();
                         $tpl->setVar('tpl_id', 0);
예제 #30
0
 // Save rank
 case 'userrank_save':
     if (!$xoops->security()->check()) {
         $xoops->redirect("userrank.php", 3, implode(",", $xoops->security()->getErrors()));
     }
     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);
     }