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


PHP discuz_upload::init方法代码示例

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


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

示例1: uploadFile

function uploadFile($file)
{
    global $_G;
    $upload = new discuz_upload();
    if (!$upload->init($file, 'common', rand(0, 100000), 'bigapp_' . md5_file($file['tmp_name']))) {
        returnData(7, 'init discuz init failed');
    }
    if (!$upload->save()) {
        returnData(8, 'save file as attachment failed');
    }
    $url = $upload->attach['attachment'];
    if (strpos($_G['setting']['attachurl'], 'http') === false) {
        $url = $_G['siteurl'] . $_G['setting']['attachurl'] . 'common/' . $url;
    } else {
        $url = $_G['setting']['attachurl'] . 'common/' . $url;
    }
    return $url;
}
开发者ID:Mushan3420,项目名称:BigApp-PHP7,代码行数:18,代码来源:uploadpic.inc.php

示例2: showsetting

     showsetting('picture', 'pic_file', '', 'file');
     showtagfooter('tbody');
     showtagheader('tbody', 'linktxt', $entity['isupload'] == 0, 'sub');
     showsetting('link', 'pic', $entity['pic'], 'text');
     showtagfooter('tbody');
     showsetting('link', 'link', $entity['link'], 'text');
     showsetting('seq', 'seq', $entity['seq'], 'text');
     showsetting('enabled', 'enabled', $entity['enabled'], 'radio');
     showsubmit('editsubmit', 'submit', '', '<input type="button" class="btn" value="' . $lang['return'] . '" onclick="history.go(-1)"/>');
     showtablefooter();
     showformfooter();
 } else {
     if ($_FILES['pic_file'] and is_uploaded_file($_FILES['pic_file']['tmp_name'])) {
         $upload = new discuz_upload();
         $pic = '';
         if ($upload->init($_FILES['pic_file'], 'common') && $upload->save(1)) {
             $pic = (!strstr($_G['setting']['attachurl'], '://') ? $_G['siteurl'] : '') . $_G['setting']['attachurl'] . 'common/' . $upload->attach['attachment'];
         }
         /*//upload by yourself
         		$pic = '';
         		$dest_dir = DISCUZ_ROOT.'./uploads';
         		if( !is_dir($dest_dir) || !is_writeable($dest_dir) ){
         			cpmsg('wirror_slider:dir_err', '', 'error', array('dir'=>$dest_dir));
         		}
         		
         		$type=array("png","gif","jpg");
         		$upfile = &$_FILES['pic_file'];
         		
         		$filetype = strtolower( pathinfo($upfile['name'], PATHINFO_EXTENSION) );
         		if( !in_array( $filetype,$type) ){
         			$text=implode(",",$type);
开发者ID:wirror800,项目名称:wirror_slider,代码行数:31,代码来源:admincp.inc.php

示例3: libfile

     }
 }
 if ($_FILES) {
     require_once libfile('class/upload');
     $upload = new discuz_upload();
     foreach ($_FILES as $key => $file) {
         if (!isset($_G['cache']['profilesetting'][$key])) {
             continue;
         }
         if (!empty($file) && $file['error'] == 0 || !empty($space[$key]) && empty($_G['gp_deletefile'][$key])) {
             $value = '1';
         } else {
             $value = '';
         }
         if (profile_check($key, $value, $space)) {
             $upload->init($file, 'profile');
             $attach = $upload->attach;
             if (!$upload->error()) {
                 $upload->save();
                 if (!$upload->get_image_info($attach['target'])) {
                     @unlink($attach['target']);
                     continue;
                 }
                 $setarr[$key] = '';
                 $attach['attachment'] = dhtmlspecialchars(trim($attach['attachment']));
                 if ($vid && $verifyconfig['available'] && isset($verifyconfig['field'][$key])) {
                     if (isset($verifyinfo['field'][$key])) {
                         @unlink(getglobal('setting/attachdir') . './profile/' . $verifyinfo['field'][$key]);
                         $verifyarr[$key] = $attach['attachment'];
                     }
                     continue;
开发者ID:v998,项目名称:discuzx-en,代码行数:31,代码来源:spacecp_profile.php

示例4: cpmsg

     cpmsg('adv_title_more', '', 'error');
 } elseif ($advnew['endtime'] && ($advnew['endtime'] <= TIMESTAMP || $advnew['endtime'] <= $advnew['starttime'])) {
     cpmsg('adv_endtime_invalid', '', 'error');
 } elseif ($advnew['style'] == 'code' && !$advnew['code']['html'] || $advnew['style'] == 'text' && (!$advnew['text']['title'] || !$advnew['text']['link']) || $advnew['style'] == 'image' && (!$_FILES['advnewimage'] && !$_G['gp_advnewimage'] || !$advnew['image']['link']) || $advnew['style'] == 'flash' && (!$_FILES['advnewflash'] && !$_G['gp_advnewflash'] || !$advnew['flash']['width'] || !$advnew['flash']['height'])) {
     cpmsg('adv_parameter_invalid', '', 'error');
 }
 if ($operation == 'add') {
     $advid = DB::insert('advertisement', array('available' => 1, 'type' => $type), 1);
 } else {
     $type = DB::result_first("SELECT type FROM " . DB::table('advertisement') . " WHERE advid='{$advid}'");
 }
 if ($advnew['style'] == 'image' || $advnew['style'] == 'flash') {
     if ($_FILES['advnew' . $advnew['style']]) {
         require_once libfile('class/upload');
         $upload = new discuz_upload();
         if ($upload->init($_FILES['advnew' . $advnew['style']], 'common') && $upload->save()) {
             $advnew[$advnew['style']]['url'] = $_G['setting']['attachurl'] . 'common/' . $upload->attach['attachment'];
         }
     } else {
         $advnew[$advnew['style']]['url'] = $_G['gp_advnew' . $advnew['style']];
     }
 }
 foreach ($advnew[$advnew['style']] as $key => $val) {
     $advnew[$advnew['style']][$key] = dstripslashes($val);
 }
 $advnew['displayorder'] = isset($advnew['displayorder']) ? implode("\t", $advnew['displayorder']) : '';
 $advnew['code'] = encodeadvcode($advnew);
 $extra = $type != 'custom' ? '' : '&customid=' . $parameters['extra']['customid'];
 $advnew['parameters'] = addslashes(serialize(array_merge(is_array($parameters) ? $parameters : array(), array('style' => $advnew['style']), $advnew['style'] == 'code' ? array() : $advnew[$advnew['style']], array('html' => $advnew['code']), array('displayorder' => $advnew['displayorder']))));
 $advnew['code'] = addslashes($advnew['code']);
 $query = DB::query("UPDATE " . DB::table('advertisement') . " SET title='{$advnew['title']}', targets='{$advnew['targets']}', parameters='{$advnew['parameters']}', code='{$advnew['code']}', starttime='{$advnew['starttime']}', endtime='{$advnew['endtime']}' WHERE advid='{$advid}'");
开发者ID:pan289091315,项目名称:Discuz,代码行数:31,代码来源:adv.inc.php

示例5: showsetting

    showsetting(lang('plugin/wechat', 'wsq_siteurl'), 'setting[wsq_siteurl]', $setting['wsq_siteurl'], 'text', 0, 0, lang('plugin/wechat', 'wsq_siteurl_comment'));
    showsetting(lang('plugin/wechat', 'wsq_fid'), '', '', $forums, 0, 0, lang('plugin/wechat', 'wsq_fid_comment'));
    if (!empty($_G['setting']['domain']['root']['forum'])) {
        showsetting(lang('plugin/wechat', 'wsq_domain'), '', '', 'http://<input type="text" name="setting[wsq_domain]" class="txt" value="' . $setting['wsq_domain'] . '" style="width:100px; margin-right:0px;" >.' . $_G['setting']['domain']['root']['forum'], !function_exists('domain_create'), 0, lang('plugin/wechat', 'wsq_domain_comment'));
    } else {
        showsetting(lang('plugin/wechat', 'wsq_domain'), 'setting[wsq_domain]', '', 'text', 1, 0, lang('plugin/wechat', 'wsq_domain_comment'));
    }
    showsetting(lang('plugin/wechat', 'wechat_float_qrcode'), 'setting[wechat_float_qrcode]', $setting['wechat_float_qrcode'], 'radio');
    showsetting(lang('plugin/wechat', 'wsq_wapdefault'), 'setting[wsq_wapdefault]', $setting['wsq_wapdefault'], 'radio');
    showsubmit('settingsubmit');
    showtablefooter();
    showformfooter();
} else {
    if ($_FILES['wsq_sitelogo']['tmp_name']) {
        $upload = new discuz_upload();
        if (!$upload->init($_FILES['wsq_sitelogo'], 'common', random(3, 1), random(8)) || !$upload->save()) {
            cpmsg($upload->errormessage(), '', 'error');
        }
        $parsev = parse_url($_G['setting']['attachurl']);
        $_GET['setting']['wsq_sitelogo'] = ($parsev['host'] ? '' : $_G['siteurl']) . $_G['setting']['attachurl'] . 'common/' . $upload->attach['attachment'];
    } else {
        $_GET['setting']['wsq_sitelogo'] = $setting['wsq_sitelogo'];
    }
    if (!$_GET['setting']['wsq_fid']) {
        cpmsg(lang('plugin/wechat', 'wsq_fid_empty'), '', 'error');
    }
    if (!$setting['wsq_sitetoken']) {
        $siteinfo = wsq::register($_GET['setting']['wsq_sitename'], $_GET['setting']['wsq_siteurl'], $_GET['setting']['wsq_sitelogo'], $_GET['setting']['wsq_sitesummary'], $setting['wechat_mtype'], $setting['wechat_qrtype']);
        if (!$siteinfo || $siteinfo->code) {
            cpmsg(lang('plugin/wechat', 'wsq_api_register_error'), '', 'error');
        }
开发者ID:hacktea8,项目名称:d_z_s_t_u_d_e_n_t,代码行数:31,代码来源:wsq_setting.inc.php

示例6: trim

			showtablefooter();
			showformfooter();

		} else {

			$namenew = trim(dhtmlspecialchars($_GET['namenew']));
			$titlenew = trim(dhtmlspecialchars($_GET['titlenew']));
			$urlnew = str_replace(array('&amp;'), array('&'), dhtmlspecialchars($_GET['urlnew']));
			$targetnew = intval($_GET['targetnew']) ? 1 : 0;
			$levelnew = intval($_GET['levelnew']) && $_GET['levelnew'] > 0 && $_GET['levelnew'] < 4 ? intval($_GET['levelnew']) : 0 ;
			$urladd = $nav['type'] != '0' && $urlnew ? ", url='$urlnew'" : '';

			$iconnew = addslashes($nav['icon']);
			if($_FILES['iconnew']) {
				$upload = new discuz_upload();
				if($upload->init($_FILES['iconnew'], 'common') && $upload->save()) {
					$iconnew = $upload->attach['attachment'];
				}
			} else {
				$iconnew = $_GET['iconnew'];
			}
			if($_GET['deleteicon'] && $nav['icon']) {
				$valueparse = parse_url($nav['icon']);
				if(!isset($valueparse['host']) && !strexists($nav['icon'], '{STATICURL}')) {
					@unlink($_G['setting']['attachurl'].'common/'.$nav['icon']);
				}
				$iconnew = '';
			}
			$iconadd = ", icon='$iconnew'";

			$data = array(
开发者ID:xDiglett,项目名称:discuzx30,代码行数:31,代码来源:admincp_nav.php

示例7: dhtmlspecialchars

 $settingname = dhtmlspecialchars(trim($_GET['settingname']));
 $settingtitle = strip_tags(trim($_GET['settingtitle']));
 $status = intval($_GET['status']);
 $createtime = strtotime($_GET['createtime']);
 $description = dhtmlspecialchars(trim($_GET['description']));
 $settingsort = trim($_GET['settingsort']);
 if (!$settingname) {
     cpmsg(lang('plugin/yiqixueba', 'settingname_invalid'), '', 'error');
 }
 if (!ispluginkey($settingname)) {
     cpmsg(lang('plugin/yiqixueba', 'settingname_invalid'), '', 'error');
 }
 $ico = addslashes($_GET['settingimages']);
 if ($_FILES['settingimages']) {
     $upload = new discuz_upload();
     if ($upload->init($_FILES['settingimages'], 'common') && $upload->save()) {
         $ico = $upload->attach['attachment'];
     }
 }
 if ($_POST['delete'] && addslashes($_POST['settingimages'])) {
     $valueparse = parse_url(addslashes($_POST['settingimages']));
     if (!isset($valueparse['host']) && !strexists(addslashes($_POST['settingimages']), '{STATICURL}')) {
         @unlink($_G['setting']['attachurl'] . 'common/' . addslashes($_POST['settingimages']));
     }
     $ico = '';
 }
 $data = array('settingname' => $settingname, 'settingtitle' => $settingtitle, 'description' => $description, 'settingimages' => $ico, 'settingsort' => $settingsort, 'status' => $status, 'createtime' => $createtime);
 if ($settingid) {
     $data['updatetime'] = time();
     C::t(GM('main_setting'))->update($settingid, $data);
 } else {
开发者ID:dalinhuang,项目名称:17xue8,代码行数:31,代码来源:admincp_setting.php

示例8: array

        $_GET['data']['pic'] = $_GET['pic'];
    }
    $data = array('name' => $_GET['name'], 'data' => $_GET['data']);
    C::t('#wechat#mobile_wechat_resource')->insert($data);
    cpmsg('setting_update_succeed', RSELF, 'succeed');
} elseif (submitcheck('editsubmit')) {
    $resource = C::t('#wechat#mobile_wechat_resource')->fetch($_GET['id']);
    if (!$resource) {
        cpmsg(lang('plugin/wechat', 'resource_msg_nofound'), '', 'error');
    }
    if (dstrlen($_GET['data']['desc'], CHARSET) > 120) {
        cpmsg(lang('plugin/wechat', 'resource_msg_desc_toolong'), '', 'error');
    }
    if ($_FILES['pic']['tmp_name']) {
        $upload = new discuz_upload();
        if (!getimagesize($_FILES['pic']['tmp_name']) || !$upload->init($_FILES['pic'], 'common', random(3, 1), random(8)) || !$upload->save()) {
            cpmsg($upload->errormessage(), '', 'error');
        }
        $_GET['data']['pic'] = (preg_match('/^http:/', $_G['setting']['attachurl']) ? '' : $_G['siteurl']) . $_G['setting']['attachurl'] . 'common/' . $upload->attach['attachment'];
        $_GET['data']['local'] = $upload->attach['attachment'];
        @unlink($_G['setting']['attachdir'] . 'common/' . $resource['data']['local']);
    } else {
        $_GET['data']['pic'] = $_GET['pic'];
    }
    $data = array('name' => $_GET['name'], 'data' => $_GET['data']);
    C::t('#wechat#mobile_wechat_resource')->update($_GET['id'], $data);
    cpmsg('setting_update_succeed', RSELF, 'succeed');
} elseif (submitcheck('delsubmit')) {
    $resource = C::t('#wechat#mobile_wechat_resource')->fetch($_GET['id']);
    if (!$resource) {
        cpmsg(lang('plugin/wechat', 'resource_msg_nofound'), '', 'error');
开发者ID:deepziyu,项目名称:JX3PVE,代码行数:31,代码来源:resource_setting.inc.php

示例9: threadsort_insertfile

function threadsort_insertfile($tid, &$files, $sortid, $edit = 0, $modidentifier, $channel)
{
    global $_G;
    $allowtype = 'jpg, jpeg, gif, bmp, png';
    $newfiles = $aid = array();
    if (empty($tid)) {
        return;
    }
    if ($files['categoryimg']) {
        foreach ($files['categoryimg']['name'] as $key => $val) {
            $newfiles[$key]['name'] = $val;
            $newfiles[$key]['type'] = $files['categoryimg']['type'][$key];
            $newfiles[$key]['tmp_name'] = $files['categoryimg']['tmp_name'][$key];
            $newfiles[$key]['error'] = $files['categoryimg']['error'][$key];
            $newfiles[$key]['size'] = $files['categoryimg']['size'][$key];
        }
    } else {
        return;
    }
    require_once libfile('class/upload');
    $upload = new discuz_upload();
    $uploadtype = 'category';
    if ($channel['imageinfo']['watermarkstatus']) {
        require_once libfile('class/house_image');
        $image = new image($channel);
    }
    foreach ($newfiles as $key => $file) {
        if (!$upload->init($file, $uploadtype)) {
            continue;
        }
        if (!$upload->save()) {
            if (count($newfiles) == 1) {
                showmessage($upload->errormessage());
            }
        }
        $newattach[$key] = $upload->attach['attachment'];
        if ($channel['imageinfo']['watermarkstatus']) {
            $image->Watermark($upload->attach['target']);
        }
        DB::query("INSERT INTO " . DB::table('category_' . $modidentifier . '_pic') . " (tid, url, dateline) VALUES ('{$tid}', '" . $upload->attach['attachment'] . "', '" . TIMESTAMP . "')");
        $aid[$key] = DB::insert_id();
    }
    $attachnum = $edit ? intval(DB::result_first("SELECT COUNT(*) FROM " . DB::table('category_' . $modidentifier . '_pic') . " WHERE tid='{$tid}'")) : intval(count($aid));
    if (substr($_G['gp_coverpic'], 0, 4) == 'old_') {
        $newaid = substr($_G['gp_coverpic'], 4);
    } else {
        $_G['gp_coverpic'] = intval($_G['gp_coverpic']);
        if ($aid[$_G['gp_coverpic']]) {
            $newaid = $aid[$_G['gp_coverpic']];
        } else {
            $aid = array_slice($aid, 0, 1);
            $newaid = $aid[0];
        }
    }
    if (!empty($newaid)) {
        DB::query("UPDATE " . DB::table('category_sortvalue') . "{$sortid} SET attachid='{$newaid}', attachnum='{$attachnum}' WHERE tid='{$tid}'");
    }
}
开发者ID:pan289091315,项目名称:Discuz,代码行数:58,代码来源:function_category.php

示例10: dhtmlspecialchars

 $chezhengname = dhtmlspecialchars(trim($_GET['chezhengname']));
 $chezhengtitle = strip_tags(trim($_GET['chezhengtitle']));
 $status = intval($_GET['status']);
 $createtime = strtotime($_GET['createtime']);
 $description = dhtmlspecialchars(trim($_GET['description']));
 $chezhengsort = trim($_GET['chezhengsort']);
 if (!$chezhengname) {
     cpmsg(lang('plugin/yiqixueba', 'chezhengname_invalid'), '', 'error');
 }
 if (!ispluginkey($chezhengname)) {
     cpmsg(lang('plugin/yiqixueba', 'chezhengname_invalid'), '', 'error');
 }
 $ico = addslashes($_GET['chezhengimages']);
 if ($_FILES['chezhengimages']) {
     $upload = new discuz_upload();
     if ($upload->init($_FILES['chezhengimages'], 'common') && $upload->save()) {
         $ico = $upload->attach['attachment'];
     }
 }
 if ($_POST['delete'] && addslashes($_POST['chezhengimages'])) {
     $valueparse = parse_url(addslashes($_POST['chezhengimages']));
     if (!isset($valueparse['host']) && !strexists(addslashes($_POST['chezhengimages']), '{STATICURL}')) {
         @unlink($_G['setting']['attachurl'] . 'common/' . addslashes($_POST['chezhengimages']));
     }
     $ico = '';
 }
 $data = array('chezhengname' => $chezhengname, 'chezhengtitle' => $chezhengtitle, 'description' => $description, 'chezhengimages' => $ico, 'chezhengsort' => $chezhengsort, 'status' => $status, 'createtime' => $createtime);
 if ($chezhengid) {
     $data['updatetime'] = time();
     C::t(GM('cheyouhui_' . $infotype))->update($chezhengid, $data);
 } else {
开发者ID:dalinhuang,项目名称:17xue8,代码行数:31,代码来源:admincp_info.php

示例11: intval

 function sanree_common_upload($bid)
 {
     global $_G, $config;
     $this->uid = $_G['uid'];
     $where = ' AND uid=' . $_G['uid'];
     $maxpiccount = intval($config['maxpiccount']);
     if ($maxpiccount > 0 && $_G['uid'] != 1) {
         $piccount = C::t('#sanree_brand#sanree_brand_attachment')->count_by_where($where);
         if ($piccount > $maxpiccount) {
             $this->uploadmsg(12);
         }
     }
     $swfhash = md5(substr(md5($_G['config']['security']['authkey']), 8) . $this->uid);
     $this->aid = 0;
     $this->simple = 2;
     if ($_GET['hash'] != $swfhash) {
         $this->uploadmsg(10);
     }
     $appVer = $_G['setting']['version'];
     if ($appVer == 'X2') {
         require_once libfile('class/upload');
     }
     $upload = new discuz_upload();
     if (!$config['isbird']) {
         $upload->init($_FILES['Filedata'], 'common');
     } else {
         $file = 'Filedata' . $_G['sr_newbanner'];
         $upload->init($_FILES[$file], 'category');
         $this->newbanner_flag = $_G['sr_newbanner'];
     }
     $this->attach =& $upload->attach;
     if ($upload->error()) {
         $this->uploadmsg(2);
     }
     $allowupload = !$_G['group']['maxattachnum'] || $_G['group']['maxattachnum'] && $_G['group']['maxattachnum'] > getuserprofile('todayattachs');
     if (!$allowupload) {
         $this->uploadmsg(6);
     }
     if ($_G['group']['attachextensions'] && (!preg_match("/(^|\\s|,)" . preg_quote($upload->attach['ext'], '/') . "(\$|\\s|,)/i", $_G['group']['attachextensions']) || !$upload->attach['ext'])) {
         $this->uploadmsg(1);
     }
     if (empty($upload->attach['size'])) {
         $this->uploadmsg(2);
     }
     if ($_G['group']['maxattachsize'] && $upload->attach['size'] > $_G['group']['maxattachsize']) {
         $this->error_sizelimit = $_G['group']['maxattachsize'];
         $this->uploadmsg(3);
     }
     loadcache('attachtype');
     if ($_G['fid'] && isset($_G['cache']['attachtype'][$_G['fid']][$upload->attach['ext']])) {
         $maxsize = $_G['cache']['attachtype'][$_G['fid']][$upload->attach['ext']];
     } elseif (isset($_G['cache']['attachtype'][0][$upload->attach['ext']])) {
         $maxsize = $_G['cache']['attachtype'][0][$upload->attach['ext']];
     }
     if (isset($maxsize)) {
         if (!$maxsize) {
             $this->error_sizelimit = 'ban';
             $this->uploadmsg(4);
         } elseif ($upload->attach['size'] > $maxsize) {
             $this->error_sizelimit = $maxsize;
             $this->uploadmsg(5);
         }
     }
     if ($upload->attach['size'] && $_G['group']['maxsizeperday']) {
         $todaysize = getuserprofile('todayattachsize') + $upload->attach['size'];
         if ($todaysize >= $_G['group']['maxsizeperday']) {
             $this->error_sizelimit = 'perday|' . $_G['group']['maxsizeperday'];
             $this->uploadmsg(11);
         }
     }
     updatemembercount($_G['uid'], array('todayattachs' => 1, 'todayattachsize' => $upload->attach['size']));
     $upload->save();
     if ($upload->error() == -103) {
         $this->uploadmsg(8);
     } elseif ($upload->error()) {
         $this->uploadmsg(9);
     }
     $thumb = $remote = $width = 0;
     if (!$upload->attach['isimage']) {
         $this->uploadmsg(7);
     }
     if ($upload->attach['isimage']) {
         if ($_G['setting']['showexif']) {
             require_once libfile('function/attachment');
             $exif = getattachexif(0, $upload->attach['target']);
         }
         if ($_G['setting']['thumbsource'] || $_G['setting']['thumbstatus']) {
             require_once libfile('class/image');
             $image = new image();
         }
         if ($_G['setting']['thumbsource'] && $_G['setting']['sourcewidth'] && $_G['setting']['sourceheight']) {
             $thumb = $image->Thumb($upload->attach['target'], '', $_G['setting']['sourcewidth'], $_G['setting']['sourceheight'], 1, 1) ? 1 : 0;
             $width = $image->imginfo['width'];
             $upload->attach['size'] = $image->imginfo['size'];
         }
         if ($_G['setting']['thumbstatus']) {
             $thumb = $image->Thumb($upload->attach['target'], '', $_G['setting']['thumbwidth'], $_G['setting']['thumbheight'], $_G['setting']['thumbstatus'], 0) ? 1 : 0;
             $width = $image->imginfo['width'];
         }
         if ($_G['setting']['thumbsource'] || !$_G['setting']['thumbstatus']) {
//.........这里部分代码省略.........
开发者ID:herosrx,项目名称:shops,代码行数:101,代码来源:class_sanree_common_upload.php

示例12: intval

 function forum_upload()
 {
     global $_G;
     $this->uid = intval($_G['gp_uid']);
     $swfhash = md5(substr(md5($_G['config']['security']['authkey']), 8) . $this->uid);
     if (!$_FILES['Filedata']['error'] && $_G['gp_hash'] == $swfhash) {
         $this->aid = 0;
         $this->simple = !empty($_G['gp_simple']) ? $_G['gp_simple'] : 0;
         $_G['groupid'] = intval(DB::result_first("SELECT groupid FROM " . DB::table('common_member') . " WHERE uid='" . $this->uid . "'"));
         loadcache('usergroup_' . $_G['groupid']);
         $_G['group'] = $_G['cache']['usergroup_' . $_G['groupid']];
         require_once libfile('class/upload');
         $upload = new discuz_upload();
         $upload->init($_FILES['Filedata'], 'forum');
         $this->attach =& $upload->attach;
         if ($upload->error()) {
             $this->uploadmsg(2);
         }
         $allowupload = !$_G['group']['maxattachnum'] || $_G['group']['maxattachnum'] && $_G['group']['maxattachnum'] > DB::result_first("SELECT count(*) FROM " . DB::table('forum_attachment') . " WHERE uid='{$_G['uid']}' AND dateline>'{$_G['timestamp']}'-86400");
         if (!$allowupload) {
             $this->uploadmsg(9);
         }
         if ($_G['group']['attachextensions'] && (!preg_match("/(^|\\s|,)" . preg_quote($upload->attach['ext'], '/') . "(\$|\\s|,)/i", $_G['group']['attachextensions']) || !$upload->attach['ext'])) {
             $this->uploadmsg(1);
         }
         if (empty($upload->attach['size'])) {
             $this->uploadmsg(2);
         }
         if ($_G['group']['maxattachsize'] && $upload->attach['size'] > $_G['group']['maxattachsize']) {
             $this->uploadmsg(3);
         }
         if ($type = DB::fetch_first("SELECT maxsize FROM " . DB::table('forum_attachtype') . " WHERE extension='" . addslashes($upload->attach['ext']) . "'")) {
             if ($type['maxsize'] == 0) {
                 $this->uploadmsg(4);
             } elseif ($upload->attach['size'] > $type['maxsize']) {
                 $this->uploadmsg(5);
             }
         }
         if ($upload->attach['size'] && $_G['group']['maxsizeperday']) {
             $todaysize = intval(DB::result_first("SELECT SUM(filesize) FROM " . DB::table('forum_attachment') . " WHERE uid='{$_G['uid']}' AND dateline>'{$_G['timestamp']}'-86400"));
             $todaysize += $upload->attach['size'];
             if ($todaysize >= $_G['group']['maxsizeperday']) {
                 $this->uploadmsg(6);
             }
         }
         $upload->save();
         if ($upload->error() == -103) {
             $this->uploadmsg(8);
         } elseif ($upload->error()) {
             $this->uploadmsg(9);
         }
         $thumb = $remote = $width = 0;
         if ($upload->attach['isimage']) {
             require_once libfile('class/image');
             $image = new image();
             $thumb = $image->Thumb($upload->attach['target'], '', $_G['setting']['thumbwidth'], $_G['setting']['thumbheight'], $_G['setting']['thumbstatus'], $_G['setting']['thumbsource']) ? 1 : 0;
             $image->Watermark($upload->attach['target']);
             $width = $image->imginfo['width'];
         }
         if (!$this->simple) {
             $upload->attach['name'] = diconv($upload->attach['name'], 'utf-8');
         }
         if ($_G['gp_type'] != 'image' && $upload->attach['isimage']) {
             $upload->attach['isimage'] = -1;
         }
         DB::query("INSERT INTO " . DB::table('forum_attachment') . " (tid, pid, dateline, readperm, price, filename, filetype, filesize, attachment, downloads, isimage, uid, thumb, remote, width)\n\t\t\t\tVALUES ('0', '0', '{$_G['timestamp']}', '0', '0', '" . $upload->attach['name'] . "', '" . $upload->attach['type'] . "', '" . $upload->attach['size'] . "', '" . $upload->attach['attachment'] . "', '0', '" . $upload->attach['isimage'] . "', '" . $this->uid . "', '{$thumb}', '{$remote}', '{$width}')");
         $this->aid = DB::insert_id();
         $this->uploadmsg(0);
     }
 }
开发者ID:Kingson4Wu,项目名称:php_demo,代码行数:70,代码来源:class_forumupload.php

示例13: upload_image

function upload_image($file_name, $type = 'space', $_w = 200, $_h = 200, $cut = 1)
{
    global $_G;
    $attachdir = $_G['setting']['attachdir'];
    $attachurl = $_G['setting']['attachurl'];
    $file = $_FILES[$file_name];
    if ($_FILES[$file_name]['size']) {
        $upload = new discuz_upload();
        if (!$upload->init($file, $type)) {
            return false;
        }
        $upload->save();
        require_once libfile('class/image');
        $image = new image();
        $thumbTarget = $type . '/' . date('Ym') . '/' . date('d') . '/' . $upload->attach['attachment'];
        $image->Thumb($upload->attach['target'], $thumbTarget, $_w, $_h, $cut);
        @unlink($image->source);
        if (!empty($_GET['temp_' . $file_name])) {
            $_goods_pic = addslashes($_GET['temp_' . $file_name]);
            @unlink($_goods_pic);
        }
        return $attachurl . $thumbTarget;
    } elseif (isset($_GET['temp_' . $file_name])) {
        return addslashes($_GET['temp_' . $file_name]);
    }
}
开发者ID:edmundwong,项目名称:V604,代码行数:26,代码来源:function.class.php

示例14: intval

 function forum_upload()
 {
     global $_G;
     $_G['uid'] = $this->uid = intval($_GET['uid']);
     $swfhash = md5(substr(md5($_G['config']['security']['authkey']), 8) . $this->uid);
     $this->aid = 0;
     $this->simple = !empty($_GET['simple']) ? $_GET['simple'] : 0;
     if ($_GET['hash'] != $swfhash) {
         $this->uploadmsg(10);
     }
     $upload = new discuz_upload();
     $upload->init($_FILES['Filedata'], 'forum');
     $this->attach =& $upload->attach;
     if ($upload->error()) {
         $this->uploadmsg(2);
     }
     $allowupload = !$_G['group']['maxattachnum'] || $_G['group']['maxattachnum'] && $_G['group']['maxattachnum'] > getuserprofile('todayattachs');
     if (!$allowupload) {
         $this->uploadmsg(6);
     }
     if ($_G['group']['attachextensions'] && (!preg_match("/(^|\\s|,)" . preg_quote($upload->attach['ext'], '/') . "(\$|\\s|,)/i", $_G['group']['attachextensions']) || !$upload->attach['ext'])) {
         $this->uploadmsg(1);
     }
     if (empty($upload->attach['size'])) {
         $this->uploadmsg(2);
     }
     if ($_G['group']['maxattachsize'] && $upload->attach['size'] > $_G['group']['maxattachsize']) {
         $this->error_sizelimit = $_G['group']['maxattachsize'];
         $this->uploadmsg(3);
     }
     loadcache('attachtype');
     if ($_G['fid'] && isset($_G['cache']['attachtype'][$_G['fid']][$upload->attach['ext']])) {
         $maxsize = $_G['cache']['attachtype'][$_G['fid']][$upload->attach['ext']];
     } elseif (isset($_G['cache']['attachtype'][0][$upload->attach['ext']])) {
         $maxsize = $_G['cache']['attachtype'][0][$upload->attach['ext']];
     }
     if (isset($maxsize)) {
         if (!$maxsize) {
             $this->error_sizelimit = 'ban';
             $this->uploadmsg(4);
         } elseif ($upload->attach['size'] > $maxsize) {
             $this->error_sizelimit = $maxsize;
             $this->uploadmsg(5);
         }
     }
     if ($upload->attach['size'] && $_G['group']['maxsizeperday']) {
         $todaysize = getuserprofile('todayattachsize') + $upload->attach['size'];
         if ($todaysize >= $_G['group']['maxsizeperday']) {
             $this->error_sizelimit = 'perday|' . $_G['group']['maxsizeperday'];
             $this->uploadmsg(11);
         }
     }
     updatemembercount($_G['uid'], array('todayattachs' => 1, 'todayattachsize' => $upload->attach['size']));
     $upload->save();
     if ($upload->error() == -103) {
         $this->uploadmsg(8);
     } elseif ($upload->error()) {
         $this->uploadmsg(9);
     }
     $thumb = $remote = $width = 0;
     if ($_GET['type'] == 'image' && !$upload->attach['isimage']) {
         $this->uploadmsg(7);
     }
     if ($upload->attach['isimage']) {
         if ($_G['setting']['showexif']) {
             require_once libfile('function/attachment');
             $exif = getattachexif(0, $upload->attach['target']);
         }
         if ($_G['setting']['thumbsource'] || $_G['setting']['thumbstatus']) {
             require_once libfile('class/image');
             $image = new image();
         }
         if ($_G['setting']['thumbsource'] && $_G['setting']['sourcewidth'] && $_G['setting']['sourceheight']) {
             $thumb = $image->Thumb($upload->attach['target'], '', $_G['setting']['sourcewidth'], $_G['setting']['sourceheight'], 1, 1) ? 1 : 0;
             $width = $image->imginfo['width'];
             $upload->attach['size'] = $image->imginfo['size'];
         }
         if ($_G['setting']['thumbstatus']) {
             $thumb = $image->Thumb($upload->attach['target'], '', $_G['setting']['thumbwidth'], $_G['setting']['thumbheight'], $_G['setting']['thumbstatus'], 0) ? 1 : 0;
             $width = $image->imginfo['width'];
         }
         if ($_G['setting']['thumbsource'] || !$_G['setting']['thumbstatus']) {
             list($width) = @getimagesize($upload->attach['target']);
         }
     }
     if ($_GET['type'] != 'image' && $upload->attach['isimage']) {
         $upload->attach['isimage'] = -1;
     }
     $this->aid = $aid = getattachnewaid($this->uid);
     $insert = array('aid' => $aid, 'dateline' => $_G['timestamp'], 'filename' => censor($upload->attach['name']), 'filesize' => $upload->attach['size'], 'attachment' => $upload->attach['attachment'], 'isimage' => $upload->attach['isimage'], 'uid' => $this->uid, 'thumb' => $thumb, 'remote' => $remote, 'width' => $width);
     C::t('forum_attachment_unused')->insert($insert);
     if ($upload->attach['isimage'] && $_G['setting']['showexif']) {
         C::t('forum_attachment_exif')->insert($aid, $exif);
     }
     $this->uploadmsg(0);
 }
开发者ID:Jaedeok-seol,项目名称:discuz_template,代码行数:96,代码来源:forum_upload.php

示例15: cpmsg

\t\t\t\t});
\t\t\t}
\t\t});
\t\tprettyPrint();
\t});
</script>

EOF;
    } else {
        if (!htmlspecialchars(trim($_GET['shopgroup_info']['shopgroupname']))) {
            cpmsg(lang('plugin/yiqixueba', 'shopgroupname_nonull'));
        }
        $shopgroupico = addslashes($_POST['shopgroupico']);
        if ($_FILES['shopgroupico']) {
            $upload = new discuz_upload();
            if ($upload->init($_FILES['shopgroupico'], 'common') && $upload->save()) {
                $shopgroupico = $upload->attach['attachment'];
            }
        }
        if ($_POST['delete1'] && addslashes($_POST['shopgroupico'])) {
            $valueparse = parse_url(addslashes($_POST['shopgroupico']));
            if (!isset($valueparse['host']) && !strexists(addslashes($_POST['shopgroupico']), '{STATICURL}')) {
                @unlink($_G['setting']['attachurl'] . 'temp/' . addslashes($_POST['shopgroupico']));
            }
            $shopgroupico = '';
        }
        $contractsample = addslashes($_POST['contractsample']);
        if ($contractsample && $_FILES['contractsample']) {
            if ($_FILES['contractsample']['error']) {
                cpmsg('文件错误');
            }
开发者ID:dalinhuang,项目名称:17xue8,代码行数:31,代码来源:admincp_shopgroup.php


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