コード例 #1
0
ファイル: file.php プロジェクト: severnaya99/Sg-2010
 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);
 }
コード例 #2
0
function dispatch()
{
	if($this->isGuest()){
		redirect_header(XOOPS_URL, 2, _NOPERM);
	}
	
	require XSNS_FRAMEWORK_DIR.'/global.php';
	require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
	require_once XOOPS_ROOT_PATH.'/language/'.$xoopsConfig['language'].'/user.php';
	
	if (!$this->validateToken('upload')) {
		redirect_header(XSNS_URL_MYPAGE_PROFILE, 3, _US_NOEDITRIGHT);
	}
	$config_handler =& xoops_gethandler('config');
	if(defined('XOOPS_CUBE_LEGACY')){
		$xoopsConfigUser =& $config_handler->getConfigsByDirname('user');
	}
	else{
		$xoopsConfigUser =& $config_handler->getConfigsByCat(XOOPS_CONF_USER);
	}
	
	$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 = intval($_POST['uid']);
	}
	if (empty($uid) || $xoopsUser->getVar('uid') != $uid ) {
		redirect_header(XSNS_URL_MYPAGE_PROFILE, 3, _US_NOEDITRIGHT);
	}
	if ($xoopsConfigUser['avatar_allow_upload'] == 1 && $xoopsUser->getVar('posts') >= $xoopsConfigUser['avatar_minposts']) {
		require_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']);
		$uploader->setAllowedExtensions(array('gif', 'jpeg', 'jpg', 'png'));
		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', $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) && $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);
						}
					}
					$sql = sprintf("UPDATE %s SET user_avatar = %s WHERE uid = %u", $this->db->prefix('users'), $this->db->quoteString($uploader->getSavedFileName()), $xoopsUser->getVar('uid'));
					$this->db->query($sql);
					$avt_handler->addUser($avatar->getVar('avatar_id'), $xoopsUser->getVar('uid'));
					redirect_header(XSNS_URL_MYPAGE_PROFILE, 2, _US_PROFUPDATED);
				}
			}
		}
		redirect_header(XSNS_URL_MYPAGE_PROFILE, 2, _MD_XSNS_PROFILE_AVATAR_UPLOAD_NG);
	}
	redirect_header(XSNS_URL_MYPAGE_PROFILE, 2, _MD_XSNS_PROFILE_AVATAR_UPLOAD_NG);
}
コード例 #3
0
ファイル: avatar_custom.php プロジェクト: ming-hai/XoopsCore
 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));
 }
 $obj->setVar('avatar_type', 'C');
 if ($uploader_avatars_img->fetchMedia('avatar_file')) {
     $uploader_avatars_img->setPrefix('savt');
     $uploader_avatars_img->fetchMedia('avatar_file');
     if (!$uploader_avatars_img->upload()) {
         $error_msg .= $uploader_avatars_img->getErrors();
         $obj->setVar('avatar_file', 'avatars/blank.gif');
     } else {
         $obj->setVar('avatar_mimetype', $uploader_avatars_img->getMediaType());
         $obj->setVar('avatar_file', 'avatars/' . $uploader_avatars_img->getSavedFileName());
     }
 } else {
     $file = Request::getString('avatar_file', 'blank.gif');
     $obj->setVar('avatar_file', 'avatars/' . $file);
 }
 if ($error_msg == '') {
     if ($avatar_Handler->insert($obj)) {
         $xoops->redirect('avatar_custom.php', 2, XoopsLocale::S_ITEM_SAVED);
コード例 #4
0
ファイル: action.links.php プロジェクト: yunsite/xoopsdc
 }
 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 {
     redirect_header('admin.links.php?sort=' . $sort, 3, _AM_LINKS_ACTIVEERROR);
 }
コード例 #5
0
    $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());
                } 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));
コード例 #6
0
ファイル: userrank.php プロジェクト: RanLee/XoopsCore
 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);
 }
 break;
 // Delete userrank
コード例 #7
0
     }
     redirect_header($current_file . "?target=" . $target, 3, _MD_AM_DBUPDATED);
 }
 // Save Image modification - end
 // Add new image - start
 if (!empty($_POST["op"]) && $op == "addfile") {
     if (!$GLOBALS["xoopsSecurity"]->check()) {
         redirect_header($current_file . "?target=" . $target, 3, implode("<br />", $GLOBALS["xoopsSecurity"]->getErrors()));
     }
     $imgcat =& $imgcat_handler->get(intval($imgcat_id));
     if (!is_object($imgcat)) {
         redirect_header($current_file . "?target=" . $target, 3);
     }
     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"), $imgcat->getVar("imgcat_maxsize"), $imgcat->getVar("imgcat_maxwidth"), $imgcat->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);
コード例 #8
0
ファイル: main.php プロジェクト: geekwright/XoopsCore25
 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);
 $err = array();
 include_once XOOPS_ROOT_PATH . '/class/uploader.php';
 $uploader_rank_img = new XoopsMediaUploader(XOOPS_UPLOAD_PATH . '/ranks', $mimetypes, $upload_size, null, null);
 if ($_FILES['rank_image']['error'] != UPLOAD_ERR_NO_FILE) {
     if ($uploader_rank_img->fetchMedia('rank_image')) {
         $uploader_rank_img->setPrefix('rank');
         $uploader_rank_img->fetchMedia('rank_image');
         if (!$uploader_rank_img->upload()) {
             $err[] =& $uploader_rank_img->getErrors();
         } else {
             $obj->setVar('rank_image', 'ranks/' . $uploader_rank_img->getSavedFileName());
             if (!$userrank_Handler->insert($obj)) {
                 $err[] = sprintf(_FAILSAVEIMG, $obj->getVar('rank_title'));
             }
         }
     } else {
         $err[] = $uploader_rank_img->getErrors();
     }
 } else {
     $obj->setVar('rank_image', 'ranks/' . $_POST['rank_image']);
     if (!$userrank_Handler->insert($obj)) {
コード例 #9
0
ファイル: main.php プロジェクト: BackupTheBerlios/haxoo-svn
 $xoBreadCrumb->addTips(sprintf(_AM_SYSTEM_SMILIES_NAV_TIPS_FORM1, implode(', ', $mimetypes)) . sprintf(_AM_SYSTEM_SMILIES_NAV_TIPS_FORM2, $upload_size / 1000));
 $xoBreadCrumb->render();
 if (isset($_POST["smilies_id"])) {
     $obj =& $smilies_Handler->get(system_CleanVars($_POST, 'smilies_id', 0, 'int'));
 } else {
     $obj =& $smilies_Handler->create();
 }
 // erreur
 $obj->setVar("code", $_POST["code"]);
 $obj->setVar("emotion", $_POST["emotion"]);
 $display = $_POST["display"] == 1 ? "1" : "0";
 $obj->setVar("display", $display);
 include_once XOOPS_ROOT_PATH . '/class/uploader.php';
 $uploader_smilies_img = new XoopsMediaUploader(XOOPS_UPLOAD_PATH . '/smilies', $mimetypes, $upload_size, null, null);
 if ($uploader_smilies_img->fetchMedia("smile_url")) {
     $uploader_smilies_img->setPrefix("smil");
     $uploader_smilies_img->fetchMedia("smile_url");
     if (!$uploader_smilies_img->upload()) {
         $errors = $uploader_smilies_img->getErrors();
         redirect_header("javascript:history.go(-1)", 3, $errors);
     } else {
         $obj->setVar("smile_url", 'smilies/' . $uploader_smilies_img->getSavedFileName());
     }
 } else {
     $obj->setVar("smile_url", 'smilies/' . $_POST["smile_url"]);
 }
 if ($smilies_Handler->insert($obj)) {
     redirect_header("admin.php?fct=smilies", 2, _AM_SYSTEM_SMILIES_SAVE);
 }
 echo $obj->getHtmlErrors();
 // Create form
コード例 #10
0
ファイル: yogurt_audio.php プロジェクト: trabisdementia/xuups
 /**
  * Upload the file and Save into database
  * 
  * @param text $title A litle description of the file
  * @param text $path_upload The path to where the file should be uploaded
  * @param text $author the author of the music or audio file
  * @return bool FALSE if upload fails or database fails
  */
 function receiveAudio($title, $path_upload, $author, $maxfilebytes)
 {
     global $xoopsUser, $xoopsDB, $_POST, $_FILES;
     //busca id do user logado
     $uid = $xoopsUser->getVar('uid');
     //create a hash so it does not erase another file
     //$hash1 = date();
     //$hash = substr($hash1,0,4);
     // mimetypes and settings put this in admin part later
     $allowed_mimetypes = array("audio/mp3", "audio/x-mp3", "audio/mpeg");
     $maxfilesize = $maxfilebytes;
     // create the object to upload
     $uploader = new XoopsMediaUploader($path_upload, $allowed_mimetypes, $maxfilesize);
     // fetch the media
     if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
         //lets create a name for it
         $uploader->setPrefix('aud_' . $uid . '_');
         //now let s upload the file
         if (!$uploader->upload()) {
             // if there are errors lets return them
             echo "<div style=\"color:#FF0000; background-color:#FFEAF4; border-color:#FF0000; border-width:thick; border-style:solid; text-align:center\"><p>" . $uploader->getErrors() . "</p></div>";
             return false;
         } else {
             // now let s create a new object audio and set its variables
             //echo "passei aqui";
             $audio = $this->create();
             $url = $uploader->getSavedFileName();
             $audio->setVar("url", $url);
             $audio->setVar("title", $title);
             $audio->setVar("author", $author);
             $uid = $xoopsUser->getVar('uid');
             $audio->setVar("uid_owner", $uid);
             $this->insert($audio);
             $saved_destination = $uploader->getSavedDestination();
             //print_r($_FILES);
         }
     } else {
         echo "<div style=\"color:#FF0000; background-color:#FFEAF4; border-color:#FF0000; border-width:thick; border-style:solid; text-align:center\"><p>" . $uploader->getErrors() . "</p></div>";
         return false;
     }
     return true;
 }
コード例 #11
0
ファイル: teams.php プロジェクト: ggoffy/wgteams
     $teamsObj = $teamsHandler->get($teamId);
 } else {
     $teamsObj = $teamsHandler->create();
 }
 // Set Vars
 // Set Var team_name
 $teamsObj->setVar('team_name', $_POST['team_name']);
 // Set Var team_descr
 $teamsObj->setVar('team_descr', $_POST['team_descr']);
 // Set Var team_image
 include_once XOOPS_ROOT_PATH . '/class/uploader.php';
 $uploader = new XoopsMediaUploader(WGTEAMS_UPLOAD_PATH . '/teams/images', $wgteams->getConfig('wgteams_img_mimetypes'), $wgteams->getConfig('wgteams_img_maxsize'), null, null);
 if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
     $extension = preg_replace('/^.+\\.([^.]+)$/sU', '', $_FILES['attachedfile']['name']);
     $imgName = str_replace(' ', '', $_POST['team_name']) . '.' . $extension;
     $uploader->setPrefix($imgName);
     $uploader->fetchMedia($_POST['xoops_upload_file'][0]);
     if (!$uploader->upload()) {
         $errors = $uploader->getErrors();
         redirect_header('javascript:history.go(-1)', 3, $errors);
     } else {
         $teamsObj->setVar('team_image', $uploader->getSavedFileName());
     }
 } else {
     $teamsObj->setVar('team_image', $_POST['team_image']);
 }
 // Set Var team_nb_cols
 $teamsObj->setVar('team_nb_cols', $_POST['team_nb_cols']);
 // Set Var team_tablestyle
 $teamsObj->setVar('team_tablestyle', $_POST['team_tablestyle']);
 // Set Var team_imagestyle
コード例 #12
0
ファイル: userrank.php プロジェクト: amjadtbssm/website
/**
 * Saves a new/updated rank into the database
 * 
 * @todo	$_FILES['rank_image'] is an array and should be treated as such!
 */
function RankForumSave($rank_id, $rank_title, $rank_min, $rank_max, $rank_image, $rank_special, $old_rank)
{
    global $HTTP_POST_VARS, $HTTP_POST_FILES;
    $db =& Database::getInstance();
    $myts =& MyTextSanitizer::getInstance();
    if (isset($rank_image['name']) && trim($rank_image['name']) != '') {
        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($HTTP_POST_VARS['xoops_upload_file'][0])) {
            if (!$uploader->upload()) {
                $err = $uploader->getErrors();
            } else {
                $rank_title = $myts->makeTboxData4Save($rank_title);
                $rank_image = $myts->makeTboxData4Save($uploader->getSavedFileName());
                if ($rank_special != 1) {
                    $sql = "UPDATE " . $db->prefix("ranks") . " SET rank_title='{$rank_title}',rank_min=" . intval($rank_min) . ", rank_max=" . intval($rank_max) . ", rank_special=0, rank_image='{$rank_image}' WHERE rank_id=" . $rank_id;
                } else {
                    $sql = "UPDATE " . $db->prefix("ranks") . " SET rank_title='{$rank_title}', rank_min=-1, rank_max=-1, rank_special=1, rank_image='{$rank_image}' WHERE rank_id=" . $rank_id;
                }
                if (!$db->query($sql)) {
                    $err = 'Failed storing rank data into the database';
                } else {
                    @unlink(XOOPS_UPLOAD_PATH . '/' . $old_rank);
                }
            }
        } else {
            $err = $uploader->getErrors();
        }
    } else {
        $rank_title = $myts->makeTboxData4Save($rank_title);
        if ($rank_special != 1) {
            $sql = "UPDATE " . $db->prefix("ranks") . " SET rank_title='{$rank_title}',rank_min=" . intval($rank_min) . ", rank_max=" . intval($rank_max) . ", rank_special=0 WHERE rank_id=" . $rank_id;
        } else {
            $sql = "UPDATE " . $db->prefix("ranks") . " SET rank_title='{$rank_title}', rank_min=-1, rank_max=-1, rank_special=1 WHERE rank_id=" . $rank_id;
        }
        if (!$db->query($sql)) {
            $err = 'Failed storing rank data into the database';
        }
    }
    if (!isset($err)) {
        redirect_header("admin.php?fct=userrank&amp;op=RankForumAdmin", 1, _AM_DBUPDATED);
    } else {
        xoops_cp_header();
        xoops_error($err);
        xoops_cp_footer();
        exit;
    }
}
コード例 #13
0
ファイル: slides.php プロジェクト: mambax7/presenter
 $obj->setVar('slides_rotation_y', $_REQUEST['slides_rotation_y']);
 $obj->setVar('slides_rotation_z', $_REQUEST['slides_rotation_z']);
 $obj->setVar('slides_scale_x', $_REQUEST['slides_scale_x']);
 $obj->setVar('slides_scale_y', $_REQUEST['slides_scale_y']);
 $obj->setVar('slides_scale_z', $_REQUEST['slides_scale_z']);
 $obj->setVar('slides_created', strtotime($_REQUEST['slides_created']));
 $obj->setVar('slides_published', strtotime($_REQUEST['slides_published']));
 $obj->setVar('slides_position', $_REQUEST['slides_position']);
 $obj->setVar('slides_online', $_REQUEST['slides_online'] == 1 ? '1' : '0');
 $obj->setVar('slides_type', $_REQUEST['slides_type']);
 $obj->setVar('slides_notes', $_REQUEST['slides_notes']);
 include_once XOOPS_ROOT_PATH . '/class/uploader.php';
 $uploaddir = XOOPS_UPLOAD_PATH . '/presenter/files/slides/';
 $uploader = new XoopsMediaUploader($uploaddir, $GLOBALS['xoopsModuleConfig']['mimetypes'], $GLOBALS['xoopsModuleConfig']['maxsize'], null, null);
 if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
     $uploader->setPrefix('slides_mp3_');
     $uploader->fetchMedia($_POST['xoops_upload_file'][0]);
     if (!$uploader->upload()) {
         $errors = $uploader->getErrors();
         redirect_header('javascript:history.go(-1)', 3, $errors);
     } else {
         $obj->setVar("slides_mp3", $uploader->getSavedFileName());
     }
 }
 $obj->setVar('slides_time', $_REQUEST['slides_time']);
 $obj->setVar('slides_status', $_REQUEST['slides_status'] == 1 ? '1' : '0');
 $obj->setVar('slides_waiting', $_REQUEST['slides_waiting'] == 1 ? '1' : '0');
 $obj->setVar('slides_online', $_REQUEST['slides_online'] == 1 ? '1' : '0');
 if ($slidesHandler->insert($obj)) {
     redirect_header('slides.php?op=list', 2, _AM_PRESENTER_FORMOK);
 }
コード例 #14
0
ファイル: category.php プロジェクト: jlm69/alumni-26x
             unlink('' . $destination . '/' . $photo_old . '');
         }
         $obj->setVar('scphoto', '');
     }
 }
 $obj->setVar('pid', Request::getInt('pid'));
 $obj->setVar('title', Request::getString('title'));
 include_once XOOPS_ROOT_PATH . '/class/uploader.php';
 $uploaddir = XOOPS_ROOT_PATH . '/modules/alumni/images/cat/';
 $photomax = $xoops->getModuleConfig('alumni_photomax');
 $maxwide = $xoops->getModuleConfig('alumni_maxwide');
 $maxhigh = $xoops->getModuleConfig('alumni_maxhigh');
 $allowedMimetypes = array('image/gif', 'image/jpg', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png');
 $uploader = new XoopsMediaUploader($uploaddir, $allowedMimetypes, $photomax, $maxwide, $maxhigh);
 if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
     $uploader->setPrefix('category_img_');
     $uploader->fetchMedia($_POST['xoops_upload_file'][0]);
     if (!$uploader->upload()) {
         $errors = $uploader->getErrors();
         $xoops->redirect('javascript:history.go(-1)', 3, $errors);
     } else {
         $obj->setVar('img', $uploader->getSavedFileName());
     }
 } else {
     $obj->setVar('img', Request::getString('img'));
 }
 $obj->setVar('ordre', Request::getInt('ordre'));
 $obj->setVar('scaddress', Request::getString('scaddress'));
 $obj->setVar('scaddress2', Request::getString('scaddress2'));
 $obj->setVar('sccity', Request::getString('sccity'));
 $obj->setVar('scstate', Request::getString('scstate'));
コード例 #15
0
ファイル: banners.php プロジェクト: ming-hai/XoopsCore
     $obj->setVar("banner_status", 1);
 }
 $error_msg = '';
 $obj->setVar("banner_cid", Request::getInt('cid', 0));
 if (preg_match('/^[0-9]*[0-9]+$|^[0-9]+[0-9]*$/', $_POST["imptotal"]) == false) {
     $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)) {
コード例 #16
0
ファイル: admin.page.php プロジェクト: yunsite/xoopsdc
 $page_obj->setVar('page_author', $xoopsUser->getVar('uid'));
 $page_obj->setVar('page_pushtime', time());
 // upload image
 if (!empty($_FILES['userfile']['name'])) {
     include_once XOOPS_ROOT_PATH . '/class/uploader.php';
     include_once dirname(dirname(__FILE__)) . '/include/functions.php';
     if (Aboutmkdirs(XOOPS_UPLOAD_PATH . '/' . $xoopsModule->dirname())) {
         $upload_path = XOOPS_UPLOAD_PATH . '/' . $xoopsModule->dirname();
     }
     $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('attch_');
         if (!$uploader->upload()) {
             $error_upload = $uploader->getErrors();
         } elseif (file_exists($uploader->getSavedDestination())) {
             if ($page_obj->getVar("page_image")) {
                 @unlink($upload_path . '/' . $page_obj->getVar("page_image"));
             }
             $page_obj->setVar('page_image', $uploader->getSavedFileName());
         }
     }
 }
 // insert object
 if ($page_handler->insert($page_obj)) {
     redirect_header('admin.page.php', 3, sprintf(_AM_ABOUT_SAVEDSUCCESS, _AM_ABOUT_PAGE_INSERT));
 }
 echo $page_obj->getHtmlErrors();
コード例 #17
0
ファイル: action.resources.php プロジェクト: yunsite/xoopsdc
 $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());
                     $att_obj->setVar("grate_time", time());
                     $att_obj->setVar("update_time", time());
                     $att_handler->insert($att_obj);
コード例 #18
0
ファイル: action.item.php プロジェクト: RanLee/Xoops_demo
     include_once XOOPS_ROOT_PATH . "/class/uploader.php";
     $dir = XOOPS_ROOT_PATH . "/uploads/gallery/";
     $original_dir = CreateDir($dir);
     $mid_dir = CreateDir($dir);
     $thumb_dir = CreateDir($dir);
     $item_dir = CreateDir($dir);
     $mid_wh = array(240, 240);
     $thumb_wh = array(480, 480);
     $item_wh = array(600, 600);
     $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/jpg', 'image/png');
     $maxfilesize = 5000000000;
     $maxfilewidth = 20000;
     $maxfileheight = 20000;
     $uploader = new XoopsMediaUploader($original_dir, $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
     if ($uploader->fetchMedia($item_image)) {
         $uploader->setPrefix('item_');
         if (!$uploader->upload()) {
             echo $uploader->getErrors();
         } else {
             $item_obj->setVar('item_picture', $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]));
             setImageThumb($original_dir, $uploader->getSavedFileName(), $item_dir, '' . $uploader->getSavedFileName(), array($item_wh[0], $item_wh[1]));
             if (!empty($item_picture)) {
                 unlink(str_replace("\\", "/", realpath($original_dir . $item_picture)));
                 unlink(str_replace("\\", "/", realpath($mid_dir . 'mid_' . $item_picture)));
                 unlink(str_replace("\\", "/", realpath($thumb_dir . 'thumb_' . $item_picture)));
             }
         }
     }
 }
コード例 #19
0
ファイル: main.php プロジェクト: BackupTheBerlios/soopa
         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;
     if (!$db->query($sql)) {
コード例 #20
0
ファイル: action.page.php プロジェクト: yunsite/xoopsdc
     $upload_patch = spotlight_mkdirs(XOOPS_ROOT_PATH . $xoopsModuleConfig['spotlight_images']);
     $sp_obj = $sp_handler->get($sp_id);
     $component = $sp_obj->getVar('component_name');
     include_once dirname(dirname(__FILE__)) . "/components/{$component}/config.php";
     if (!isset($config['image_size'])) {
         $config['image_size'] = '550|280';
     }
     if (!isset($config['thumbs_size'])) {
         $config['thumbs_size'] = '90|56';
     }
     $image_wh = explode('|', $config['image_size']);
     $thumb_wh = explode('|', $config['thumbs_size']);
     $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/jpg', 'image/png');
     $uploader = new XoopsMediaUploader($upload_patch, $allowed_mimetypes, $xoopsModuleConfig['upload_size'], 1200, 1200);
     if ($uploader->fetchMedia('page_image')) {
         $uploader->setPrefix('page_');
         if (!$uploader->upload()) {
             $error = $uploader->getErrors();
             redirect_header('admin.page.php?sp_id=' . $sp_id, 3, _AM_SPOTLIGHT_IMEGES_TYPE_WRONG);
         } else {
             spotlight_setImageThumb($upload_patch, $uploader->getSavedFileName(), $upload_patch, 'image_' . $uploader->getSavedFileName(), array($image_wh[0], $image_wh[1]));
             spotlight_cutphoto($upload_patch . $uploader->getSavedFileName(), $upload_patch . 'thumb_' . $uploader->getSavedFileName(), $thumb_wh[0], $thumb_wh[1]);
             $page_obj->setVar('page_image', $uploader->getSavedFileName());
             if (!empty($page_image)) {
                 unlink($upload_patch . $page_image);
                 unlink($upload_patch . 'image_' . $page_image);
                 unlink($upload_patch . 'thumb_' . $page_image);
             }
         }
     }
 }
コード例 #21
0
ファイル: action.category.php プロジェクト: yunsite/xoopsdc
     }
 }
 $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"));
     $cat_obj->setVar('cat_image', '');
 }
コード例 #22
0
ファイル: action.service.php プロジェクト: yunsite/xoopsdc
 }
 //set submiter
 $service_obj->setVar('service_datetime', time());
 if (Portfoliomkdirs(XOOPS_UPLOAD_PATH . '/' . $xoopsModule->dirname())) {
     $upload_path = XOOPS_UPLOAD_PATH . '/' . $xoopsModule->dirname();
 }
 // upload image
 if (!empty($_FILES['service_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('service_');
         if (!$uploader->upload()) {
             $error_upload = $uploader->getErrors();
         } elseif (file_exists($uploader->getSavedDestination())) {
             if ($service_obj->getVar("service_image")) {
                 @unlink($upload_path . '/' . $service_obj->getVar("service_image"));
             }
             $service_obj->setVar('service_image', $uploader->getSavedFileName());
         }
     }
 }
 // delete iamge
 if (isset($_POST['delete_image']) && empty($_FILES['service_image']['name'])) {
     @unlink($upload_path . '/' . $service_obj->getVar("service_image"));
     $service_obj->setVar('service_image', '');
 }
コード例 #23
0
ファイル: xoopsemotions.php プロジェクト: RanLee/Xoops_demo
$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';
            }
        }
    } else {
コード例 #24
0
ファイル: admin.manual.php プロジェクト: yunsite/xoopsdc
 if (!empty($_POST["xoops_upload_file"])) {
     include_once XOOPS_ROOT_PATH . "/class/uploader.php";
     include_once XOOPS_ROOT_PATH . "/modules/newsletter/include/functions.php";
     $dir = XOOPS_ROOT_PATH . "/uploads/newsletter/";
     $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)) {
コード例 #25
0
ファイル: admin.greenep.php プロジェクト: RanLee/Xoops_demo
 }
 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 {
     redirect_header('admin.greenep.php', 3, _AM_CATALOG_ACTIVEERROR);
 }
コード例 #26
0
ファイル: action.case.php プロジェクト: yunsite/xoopsdc
     }
 }
 if (!empty($_POST["xoops_upload_file"])) {
     if (Portfoliomkdirs(XOOPS_UPLOAD_PATH . '/' . $xoopsModule->dirname() . "/gallery")) {
         $files_dir = XOOPS_UPLOAD_PATH . '/' . $xoopsModule->dirname() . "/gallery";
     }
     $mid_wh = array(360, 360);
     $thumb_wh = array(150, 120);
     $allowed_mimetypes = array('image/gif', 'image/jpeg', 'image/jpg', 'image/png');
     $maxfilesize = 50000000;
     $maxfilewidth = 1200;
     $maxfileheight = 1200;
     $uploader = new XoopsMediaUploader($files_dir, $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
     foreach ($_POST["xoops_upload_file"] as $k => $v) {
         if ($uploader->fetchMedia($v)) {
             $uploader->setPrefix('case_gallery_');
             if (!$uploader->upload()) {
                 echo $uploader->getErrors();
             } else {
                 $image_obj =& $images_handler->create();
                 $image_obj->setVar('case_id', $case_id);
                 $image_obj->setVar('image_title', $_POST["xoops_upload_file_name"][$k - 1]);
                 $image_obj->setVar('image_desc', $_POST["xoops_upload_file_desc"][$k - 1]);
                 $image_obj->setVar('image_file', $uploader->getSavedFileName());
                 $images_handler->insert($image_obj);
                 setImageThumb($files_dir . "/", $uploader->getSavedFileName(), $files_dir . "/", 'mid_' . $uploader->getSavedFileName(), array($mid_wh[0], $mid_wh[1]));
                 setImageThumb($files_dir . "/", $uploader->getSavedFileName(), $files_dir . "/", 'thumb_' . $uploader->getSavedFileName(), array($thumb_wh[0], $thumb_wh[1]));
             }
             unset($pic_obj);
         }
     }
コード例 #27
0
ファイル: main.php プロジェクト: BackupTheBerlios/soopa
         }
     }
     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;
                 $image->setVar('image_display', $image_display);
コード例 #28
0
ファイル: categories.php プロジェクト: mambax7/presenter
     redirect_header('categories.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
 }
 if (isset($_REQUEST['cat_id'])) {
     $obj =& $categoriesHandler->get($_REQUEST['cat_id']);
 } else {
     $obj =& $categoriesHandler->create();
 }
 // Form save fields
 $obj->setVar('cat_pid', $_REQUEST['cat_pid']);
 $obj->setVar('cat_title', $_REQUEST['cat_title']);
 $obj->setVar('cat_desc', $_REQUEST['cat_desc']);
 include_once XOOPS_ROOT_PATH . '/class/uploader.php';
 $uploaddir = XOOPS_UPLOAD_PATH . '/presenter/images/categories/';
 $uploader = new XoopsMediaUploader($uploaddir, $GLOBALS['xoopsModuleConfig']['mimetypes'], $GLOBALS['xoopsModuleConfig']['maxsize'], null, null);
 if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
     $uploader->setPrefix('cat_image_');
     $uploader->fetchMedia($_POST['xoops_upload_file'][0]);
     if (!$uploader->upload()) {
         $errors = $uploader->getErrors();
         redirect_header('javascript:history.go(-1)', 3, $errors);
     } else {
         $obj->setVar('cat_image', $uploader->getSavedFileName());
     }
 } else {
     $obj->setVar('cat_image', $_REQUEST['cat_image']);
 }
 $obj->setVar('cat_weight', $_REQUEST['cat_weight']);
 //      $obj->setVar('cat_color', $_REQUEST['cat_color']);
 if ($categoriesHandler->insert($obj)) {
     redirect_header('categories.php?op=list', 2, _AM_PRESENTER_FORMOK);
 }
コード例 #29
0
ファイル: main.php プロジェクト: BackupTheBerlios/xoops4-svn
             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);
                         $tpl->setVar('tpl_tplset', $tplset);
コード例 #30
0
 function receiveTribe($tribe_title, $tribe_desc, $tribe_img, $path_upload, $maxfilebytes, $maxfilewidth, $maxfileheight, $change_img = 1, $tribe = "")
 {
     global $xoopsUser, $xoopsDB, $_POST, $_FILES;
     //busca id do user logado
     $uid = $xoopsUser->getVar('uid');
     if (!is_a($tribe, "yogurt_tribes")) {
         $tribe = $this->create();
     } else {
         $tribe->unsetNew();
     }
     if ($change_img == 1) {
         // mimetypes and settings put this in admin part later
         $allowed_mimetypes = array('image/jpeg', 'image/pjpeg');
         $maxfilesize = $maxfilebytes;
         // create the object to upload
         $uploader = new XoopsMediaUploader($path_upload, $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight);
         // fetch the media
         if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
             //lets create a name for it
             $uploader->setPrefix('tribe_' . $uid . '_');
             //now let s upload the file
             if (!$uploader->upload()) {
                 // if there are errors lets return them
                 echo "<div style=\"color:#FF0000; background-color:#FFEAF4; border-color:#FF0000; border-width:thick; border-style:solid; text-align:center\"><p>" . $uploader->getErrors() . "</p></div>";
                 return false;
             } else {
                 // now let s create a new object picture and set its variables
                 $url = $uploader->getSavedFileName();
                 $saved_destination = $uploader->getSavedDestination();
                 $image_name = $this->resizeImage2($saved_destination, 125, 80, $path_upload);
                 $tribe->setVar("tribe_img", $image_name);
             }
         } else {
             echo "<div style=\"color:#FF0000; background-color:#FFEAF4; border-color:#FF0000; border-width:thick; border-style:solid; text-align:center\"><p>" . $uploader->getErrors() . "</p></div>";
             return false;
         }
     }
     $tribe->setVar("tribe_title", $tribe_title);
     $tribe->setVar("tribe_desc", $tribe_desc);
     $tribe->setVar("owner_uid", $uid);
     $this->insert($tribe);
     return true;
 }