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


PHP discuz_upload::save方法代码示例

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


在下文中一共展示了discuz_upload::save方法的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

     echo '<tr class="noborder" ><td colspan="2" ><textarea name="shopinformation" style="width:700px;height:200px;visibility:hidden;">' . $shop_info['shopinformation'] . '</textarea></td></tr>';
     //showsetting(lang('plugin/yiqixueba','shoprecommend'),'shop_info[shoprecommend]',$shop_info['shoprecommend'],'text','',0,lang('plugin/yiqixueba','shoprecommend_comment'),'','',true);
     //showsetting(lang('plugin/yiqixueba','shoptemplate'),'shop_info[shoptemplate]',$shop_info['shoptemplate'],'select','',0,lang('plugin/yiqixueba','shoptemplate_comment'),'','',true);
     //showsetting(lang('plugin/yiqixueba','shoplevel'),'shop_info[shoplevel]',$shop_info['shoplevel'],'text','',0,lang('plugin/yiqixueba','shoplevel_comment'),'','',true);
     showsetting(lang('plugin/yiqixueba', 'status'), 'shop_info[status]', $shop_info['status'], 'radio', '', 0, lang('plugin/yiqixueba', 'shopstatus_comment'), '', '', true);
     showsubmit('submit');
     showtablefooter();
     showformfooter();
 } else {
     if (!htmlspecialchars(trim($_GET['shop_info']['shopname']))) {
         cpmsg(lang('plugin/yiqixueba', 'shopname_nonull', 'error'));
     }
     $shoplogo = addslashes($_GET['shoplogo']);
     if ($_FILES['shoplogo']) {
         $upload = new discuz_upload();
         if ($upload->init($_FILES['shoplogo'], 'common') && $upload->save()) {
             $shoplogo = $upload->attach['attachment'];
         }
     }
     if ($_POST['delete'] && addslashes($_POST['shoplogo'])) {
         $valueparse = parse_url(addslashes($_POST['shoplogo']));
         if (!isset($valueparse['host']) && !strexists(addslashes($_POST['shoplogo']), '{STATICURL}')) {
             @unlink($_G['setting']['attachurl'] . 'temp/' . addslashes($_POST['shoplogo']));
         }
         $shoplogo = '';
     }
     $data = array();
     $datas = $_GET['shop_info'];
     $datas['upmokuai'] = intval($_GET['upmokuai']);
     $datas['upshopid'] = intval($_GET['upshopid']);
     $datas['shopsort'] = intval($_GET['shopsort']);
开发者ID:dalinhuang,项目名称:17xue8,代码行数:31,代码来源:admincp_shop.php

示例3: libfile

 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;
             }
             if (isset($setarr[$key]) && $_G['cache']['profilesetting'][$key]['needverify']) {
                 @unlink(getglobal('setting/attachdir') . './profile/' . $verifyinfo['field'][$key]);
开发者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: upload_icon_banner

function upload_icon_banner(&$data, $file, $type)
{
    global $_G;
    $data['extid'] = empty($data['extid']) ? $data['fid'] : $data['extid'];
    if (empty($data['extid'])) {
        return '';
    }
    if ($data['status'] == 3 && $_G['setting']['group_imgsizelimit']) {
        $file['size'] > $_G['setting']['group_imgsizelimit'] * 1024 && showmessage('file_size_overflow', '', array('size' => $_G['setting']['group_imgsizelimit'] * 1024));
    }
    $upload = new discuz_upload();
    $uploadtype = $data['status'] == 3 ? 'group' : 'common';
    if (!$upload->init($file, $uploadtype, $data['extid'], $type)) {
        return false;
    }
    if (!$upload->save()) {
        if (!defined('IN_ADMINCP')) {
            showmessage($upload->errormessage());
        } else {
            cpmsg($upload->errormessage(), '', 'error');
        }
    }
    if ($data['status'] == 3 && $type == 'icon') {
        require_once libfile('class/image');
        $img = new image();
        $img->Thumb($upload->attach['target'], './' . $uploadtype . '/' . $upload->attach['attachment'], 48, 48, 'fixwr');
    }
    return $upload->attach['attachment'];
}
开发者ID:samyex6,项目名称:discuz3.2-lite,代码行数:29,代码来源:function_forum.php

示例6: 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

示例7: 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

示例8: WeChatClient

        require_once DISCUZ_ROOT . './source/plugin/wechat/wechat.lib.class.php';
        $wechat_client = new WeChatClient($_GET['setting']['wechat_appId'], $_GET['setting']['wechat_appsecret']);
        if (!$wechat_client->getAccessToken(1, 1)) {
            cpmsg(lang('plugin/wechat', 'wechat_at_geterror'), '', 'error');
        }
        $option = array('scene_id' => 100000, 'expire' => 30, 'ticketOnly' => 1);
        $ticket = $wechat_client->getQrcodeTicket($option);
        if (!$wechat_client->getQrcodeImgUrlByTicket($ticket)) {
            cpmsg(lang('plugin/wechat', 'wechat_at_qrgeterror'), '', 'error');
        }
    }
    $_GET['setting']['wechat_qrtype'] = !$_GET['setting']['wechat_mtype'] ? 3 : 0;
    $_GET['setting']['wechat_token'] = $_GET['setting']['wechat_token'] ? $_GET['setting']['wechat_token'] : random(16);
    if ($_FILES['wechat_qrcode']['tmp_name']) {
        $upload = new discuz_upload();
        if (!$upload->init($_FILES['wechat_qrcode'], 'common', random(3, 1), random(8)) || !$upload->save()) {
            cpmsg($upload->errormessage(), '', 'error');
        }
        $_GET['setting']['wechat_qrcode'] = $upload->attach['attachment'];
    }
    if ($setting['wsq_siteid']) {
        $siteinfo = wsq::edit($setting['wsq_sitename'], $setting['wsq_siteurl'], $setting['wsq_sitelogo'], $setting['wsq_sitesummary'], $_GET['setting']['wechat_mtype'], $_GET['setting']['wechat_qrtype']);
        if (!$siteinfo || $siteinfo->code) {
            cpmsg(lang('plugin/wechat', 'wsq_api_edit_error'), '', 'error');
        }
    }
    $settings = array('mobilewechat' => serialize($_GET['setting'] + $setting));
    C::t('common_setting')->update_batch($settings);
    updatecache('setting');
    cpmsg('setting_update_succeed', 'action=plugins&operation=config&do=' . $pluginid . '&identifier=wechat&pmod=wechat_setting', 'succeed');
}
开发者ID:MCHacker,项目名称:docker-discuz,代码行数:31,代码来源:wechat_setting.inc.php

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: upload_images

function upload_images($file, $type, $thumbwidth = 176, $thumbheight = 176)
{
    global $_G;
    require_once libfile('class/upload');
    $upload = new discuz_upload();
    if (!$upload->init($file, $type)) {
        return false;
    }
    if (!$upload->save()) {
        if (!defined('IN_ADMINCP')) {
            showmessage($upload->errormessage());
        } else {
            cpmsg($upload->errormessage(), '', 'error');
        }
    }
    if (!empty($_G['cache']['modulelist'][$type]['mid'])) {
        $mid = $_G['cache']['modulelist'][$type]['mid'];
    } else {
        $_G['cache']['modulelist'][$type]['mid'] = $mid = DB::result_first("SELECT mid FROM " . DB::table('common_module') . " WHERE identifier='{$type}' AND available='1'");
    }
    $isimage = $upload->attach['isimage'] ? 1 : 0;
    $data = array('mid' => $mid, 'authorid' => $_G['uid'], 'filesize' => $upload->attach['size'], 'type' => $isimage, 'filename' => $upload->attach['name'], 'url' => $upload->attach['attachment']);
    $return = $upload->attach;
    DB::insert('common_attachment', $data, true);
    $return['aid'] = DB::insert_id();
    if (!$return['aid']) {
        if (!defined('IN_ADMINCP')) {
            showmessage('common_attachment_error');
        } else {
            cpmsg('common_attachment_error', '', 'error');
        }
    }
    require_once libfile('class/image');
    $image = new image();
    $source = $_G['setting']['attachdir'] . $type . '/' . $upload->attach['attachment'];
    $setting_thumbwidth = $thumbwidth > 10 && $thumbwidth < 1000 ? intval($thumbwidth) : 176;
    $setting_thumbheight = $thumbheight > 10 && $thumbheight < 1000 ? intval($thumbheight) : 176;
    $isthumb = $image->Thumb($source, '', $setting_thumbwidth, $setting_thumbheight);
    if (!$isthumb) {
        $thumbtarget = $_G['setting']['attachdir'] . $type . '/' . $upload->attach['attachment'] . '.thumb.jpg';
        $isthumb = @copy($source, $thumbtarget);
    }
    if (!$isthumb) {
        if (!defined('IN_ADMINCP')) {
            showmessage('thumb_error');
        } else {
            cpmsg('thumb_error', '', 'error');
        }
    }
    return $return;
}
开发者ID:pan289091315,项目名称:Discuz,代码行数:51,代码来源:function_core.php

示例14: cpmsg

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

EOF;
    } else {
        if (!htmlspecialchars(trim($_GET['cardcat_info']['cardcatname']))) {
            cpmsg(lang('plugin/yiqixueba', 'cardcatname_nonull'));
        }
        $cardcatico = addslashes($_POST['cardcatico']);
        if ($_FILES['cardcatico']) {
            $upload = new discuz_upload();
            if ($upload->init($_FILES['cardcatico'], 'common') && $upload->save()) {
                $cardcatico = $upload->attach['attachment'];
            }
        }
        if ($_POST['delete1'] && addslashes($_POST['cardcatico'])) {
            $valueparse = parse_url(addslashes($_POST['cardcatico']));
            if (!isset($valueparse['host']) && !strexists(addslashes($_POST['cardcatico']), '{STATICURL}')) {
                @unlink($_G['setting']['attachurl'] . 'temp/' . addslashes($_POST['cardcatico']));
            }
            $cardcatico = '';
        }
        $datas = $_GET['cardcat_info'];
        $datas['cardcatico'] = $cardcatico;
        $datas['cardcatdescription'] = stripslashes($_POST['cardcatdescription']);
        foreach ($datas as $k => $v) {
            $data[$k] = htmlspecialchars(trim($v));
开发者ID:dalinhuang,项目名称:17xue8,代码行数:31,代码来源:admincp_cardmanage.php

示例15: myupload_icon_banner

function myupload_icon_banner($bid, &$data, $file, $uid)
{
    global $_G;
    $data['extid'] = empty($data['extid']) ? $data['fid'] : $data['extid'];
    if (empty($data['extid'])) {
        return '';
    }
    if ($data['status'] == 3 && $_G['setting']['group_imgsizelimit']) {
        $file['size'] > $_G['setting']['group_imgsizelimit'] * 1024 && showmessage('file_size_overflow', '', array('size' => $_G['setting']['group_imgsizelimit'] * 1024));
    }
    $appVer = $_G['setting']['version'];
    if ($appVer == 'X2') {
        require_once libfile('class/upload');
    }
    $upload = new discuz_upload();
    if (!$upload->init($file, 'category')) {
        return false;
    }
    if (!$upload->save()) {
        if (!defined('IN_ADMINCP')) {
            showmessage($upload->errormessage());
        } else {
            cpmsg($upload->errormessage(), '', 'error');
        }
    }
    $aid = getattachnewaid($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' => $uid, 'thumb' => $thumb, 'remote' => $remote, 'width' => $width);
    C::t('#sanree_brand#sanree_brand_attachment')->insert($insert);
    return array($upload->attach['attachment'], $aid);
}
开发者ID:herosrx,项目名称:shops,代码行数:30,代码来源:function_core.php


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