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


PHP XoopsMediaUploader::setPrefix方法代码示例

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


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

示例1: createFile

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

示例2: dispatch

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);
}
开发者ID:nunoluciano,项目名称:uxcl,代码行数:70,代码来源:profile_avatar_up_execAction.php

示例3:

 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);
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:avatar_custom.php

示例4: foreach

 }
 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);
 }
开发者ID:yunsite,项目名称:xoopsdc,代码行数:31,代码来源:action.links.php

示例5: XoopsMediaUploader

    $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));
开发者ID:XoopsModules25x,项目名称:xcl-module-xoonips,代码行数:31,代码来源:edituser.php

示例6: implode

 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
开发者ID:RanLee,项目名称:XoopsCore,代码行数:31,代码来源:userrank.php

示例7: implode

     }
     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);
开发者ID:mambax7,项目名称:xoopseditors,代码行数:31,代码来源:xoopsimagebrowser.php

示例8: array

 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)) {
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:31,代码来源:main.php

示例9: implode

 $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
开发者ID:BackupTheBerlios,项目名称:haxoo-svn,代码行数:31,代码来源:main.php

示例10: receiveAudio

 /**
  * 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;
 }
开发者ID:trabisdementia,项目名称:xuups,代码行数:50,代码来源:yogurt_audio.php

示例11: XoopsMediaUploader

     $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
开发者ID:ggoffy,项目名称:wgteams,代码行数:31,代码来源:teams.php

示例12: RankForumSave

/**
 * 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;
    }
}
开发者ID:amjadtbssm,项目名称:website,代码行数:54,代码来源:userrank.php

示例13: strtotime

 $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);
 }
开发者ID:mambax7,项目名称:presenter,代码行数:31,代码来源:slides.php

示例14: unlink

             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'));
开发者ID:jlm69,项目名称:alumni-26x,代码行数:31,代码来源:category.php

示例15: XoopsMediaUploader

     $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)) {
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:banners.php


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