• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ftpcmd函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ftpcmd函数的典型用法代码示例。如果您正苦于以下问题:PHP ftpcmd函数的具体用法?PHP ftpcmd怎么用?PHP ftpcmd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: remote_ftp

/**
 * 通过FTP同步图片到远程服务器
 *
 * @param string $path 图片路径(upload/store/goods/4)
 * @param string $file 图片名称(含年月日2012/06/12/03f625d923bfb1ca84355007487ed68b.jpg)
 * @param boolean $ifdel 是否删除本地图片,目前淘宝导入的图片上传到远程时,不会删除本地图片
 * @return string 远程图片路径部分
 */
function remote_ftp($path, $file, $ifdel = true)
{
    $image_full_path = $path . '/' . $file;
    ftpcmd('upload', $image_full_path);
    $_ext = '.' . get_image_type($image_full_path);
    if (!ftpcmd('error')) {
        ftpcmd('upload', $image_full_path . '_max' . $_ext);
    }
    if (!ftpcmd('error')) {
        ftpcmd('upload', $image_full_path . '_mid' . $_ext);
    }
    if (!ftpcmd('error')) {
        ftpcmd('upload', $image_full_path . '_small' . $_ext);
    }
    if (!ftpcmd('error')) {
        ftpcmd('upload', $image_full_path . '_tiny' . $_ext);
    }
    if (!ftpcmd('error')) {
        ftpcmd('upload', $image_full_path . '_240x240' . $_ext);
    }
    if (!ftpcmd('error')) {
        if ($ifdel) {
            @unlink(BASE_PATH . '/' . $image_full_path);
            @unlink(BASE_PATH . '/' . $image_full_path . '_max' . $_ext);
            @unlink(BASE_PATH . '/' . $image_full_path . '_mid' . $_ext);
            @unlink(BASE_PATH . '/' . $image_full_path . '_small' . $_ext);
            @unlink(BASE_PATH . '/' . $image_full_path . '_tiny' . $_ext);
            @unlink(BASE_PATH . '/' . $image_full_path . '_240x240' . $_ext);
        }
        return C('ftp_access_url') . '/' . $path;
    }
    return false;
}
开发者ID:noikiy,项目名称:shopnc-2,代码行数:41,代码来源:ftp.php


示例2: remote_ftp

/**
 * 
 *
 * Framework ºËÐÄ¿ò¼Ü
 * 
 *
 * @copyright  Copyright (c) 2007-2013 ShopNC Inc. (http://www.shopnc.net)
 * @license    http://www.shopnc.net/
 * @link       http://www.shopnc.net/
 * @since      File available since Release v1.1
 */
function remote_ftp($path, $file, $ifdel = TRUE)
{
    $image_full_path = $path . "/" . $file;
    ftpcmd("upload", $image_full_path);
    $_ext = "." . get_image_type($image_full_path);
    if (!ftpcmd("error")) {
        ftpcmd("upload", $image_full_path . "_max" . $_ext);
    }
    if (!ftpcmd("error")) {
        ftpcmd("upload", $image_full_path . "_mid" . $_ext);
    }
    if (!ftpcmd("error")) {
        ftpcmd("upload", $image_full_path . "_small" . $_ext);
    }
    if (!ftpcmd("error")) {
        ftpcmd("upload", $image_full_path . "_tiny" . $_ext);
    }
    if (!ftpcmd("error")) {
        ftpcmd("upload", $image_full_path . "_240x240" . $_ext);
    }
    if (!ftpcmd("error")) {
        if ($ifdel) {
            @unlink(BasePath . "/" . $image_full_path);
            @unlink(BasePath . "/" . $image_full_path . "_max" . $_ext);
            @unlink(BasePath . "/" . $image_full_path . "_mid" . $_ext);
            @unlink(BasePath . "/" . $image_full_path . "_small" . $_ext);
            @unlink(BasePath . "/" . $image_full_path . "_tiny" . $_ext);
            @unlink(BasePath . "/" . $image_full_path . "_240x240" . $_ext);
        }
        return c("ftp_access_url") . "/" . $path;
    }
    return FALSE;
}
开发者ID:my1977,项目名称:shopnc,代码行数:44,代码来源:ftp.php


示例3: dunlink

function dunlink($attach, $havethumb = 0, $remote = 0)
{
    global $_G;
    $filename = $attach['attachment'];
    $havethumb = $attach['thumb'];
    $remote = $attach['remote'];
    $aid = $attach['aid'];
    if ($remote) {
        ftpcmd('delete', $filename);
        $havethumb && ftpcmd('delete', 'forum/' . $filename . '.thumb.jpg');
    } else {
        @unlink($_G['setting']['attachdir'] . '/' . $filename);
        $havethumb && @unlink($_G['setting']['attachdir'] . '/forum/' . $filename . '.thumb.jpg');
        @unlink(DISCUZ_ROOT . './data/attachment/image/' . $aid . '_140_140.jpg');
    }
}
开发者ID:Kingson4Wu,项目名称:php_demo,代码行数:16,代码来源:function_forum.php


示例4: dunlink

function dunlink($attach)
{
    global $_G;
    $filename = $attach['attachment'];
    $havethumb = $attach['thumb'];
    $remote = $attach['remote'];
    $aid = $attach['aid'];
    if ($remote) {
        ftpcmd('delete', $_G['setting']['ftp']['attachdir'] . '/forum/' . $filename);
        $havethumb && ftpcmd('delete', $_G['setting']['ftp']['attachdir'] . '/forum/' . $filename . '.thumb.jpg');
    } else {
        @unlink($_G['setting']['attachdir'] . '/forum/' . $filename);
        $havethumb && @unlink($_G['setting']['attachdir'] . '/forum/' . $filename . '.thumb.jpg');
    }
    @unlink($_G['setting']['attachdir'] . 'image/' . $aid . '_140_140.jpg');
}
开发者ID:v998,项目名称:discuzx-en,代码行数:16,代码来源:function_forum.php


示例5: dunlink

function dunlink($attach) {
	global $_G;
	$filename = $attach['attachment'];
	$havethumb = $attach['thumb'];
	$remote = $attach['remote'];
	if($remote) {
		ftpcmd('delete', 'forum/'.$filename);
		$havethumb && ftpcmd('delete', 'forum/'.getimgthumbname($filename));
	} else {
		@unlink($_G['setting']['attachdir'].'/forum/'.$filename);
		$havethumb && @unlink($_G['setting']['attachdir'].'/forum/'.getimgthumbname($filename));
	}
	if($attach['aid']) {
		@unlink($_G['setting']['attachdir'].'image/'.$attach['aid'].'_100_100.jpg');
	}
}
开发者ID:xDiglett,项目名称:discuzx30,代码行数:16,代码来源:function_forum.php


示例6: remote_ftp

/**
 * 通过FTP同步图片到远程服务器
 *
 * @param string $path 图片路径(upload/store/goods/4)
 * @param string $file 图片名称(含年月日2012/06/12/03f625d923bfb1ca84355007487ed68b.jpg)
 * @param boolean $ifdel 是否删除本地图片,目前淘宝导入的图片上传到远程时,不会删除本地图片
 * @return string 远程图片路径部分
 */
function remote_ftp($path, $file, $ifdel = true){

	ftpcmd('upload', $path.'/'.$file);
	$img_ext = explode(',', GOODS_IMAGES_EXT);
	foreach ($img_ext as $val) {
        if(!ftpcmd('error')) ftpcmd('upload', $path.'/'.str_ireplace('.', $val . '.', $file));
	}

	if(!ftpcmd('error')) {
		if ($ifdel){
			@unlink(BASE_PATH.'/'.$path.'/'.$file);
			foreach ($img_ext as $val) {
                @unlink(BASE_PATH.'/'.$path.'/'.str_ireplace('.', $val . '.', $file));
			}
		}
		return C('ftp_access_url').'/'.$path;
	}
	return false;
}
开发者ID:noikiy,项目名称:ejia,代码行数:27,代码来源:ftp.php


示例7: delPic

 /**
  * 删除图片
  *
  * @param string $id
  * @return bool
  */
 public function delPic($id)
 {
     $pic_list = $this->getPicList(array('in_apic_id' => $id), '', 'apic_cover');
     /**
      * 删除图片
      */
     foreach ($pic_list as $v) {
         @unlink(BasePath . DS . ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $v['apic_cover']);
         @unlink(BasePath . DS . ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $v['apic_cover'] . "_tiny." . get_image_type($v['apic_cover']));
         @unlink(BasePath . DS . ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $v['apic_cover'] . "_small." . get_image_type($v['apic_cover']));
         @unlink(BasePath . DS . ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $v['apic_cover'] . "_mid." . get_image_type($v['apic_cover']));
         @unlink(BasePath . DS . ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $v['apic_cover'] . "_max." . get_image_type($v['apic_cover']));
         @unlink(BasePath . DS . ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $v['apic_cover'] . "_240x240." . get_image_type($v['apic_cover']));
         if (C('ftp_open') && C('thumb.save_type') == 3) {
             import('function.ftp');
             $image_full_path = ATTACH_GOODS . DS . $_SESSION['store_id'] . DS . $v['apic_cover'];
             $_ext = '.' . get_image_type($image_full_path);
             if (!ftpcmd('error')) {
                 ftpcmd('delete', $image_full_path);
             }
             if (!ftpcmd('error')) {
                 ftpcmd('delete', $image_full_path . '_max' . $_ext);
             }
             if (!ftpcmd('error')) {
                 ftpcmd('delete', $image_full_path . '_mid' . $_ext);
             }
             if (!ftpcmd('error')) {
                 ftpcmd('delete', $image_full_path . '_small' . $_ext);
             }
             if (!ftpcmd('error')) {
                 ftpcmd('delete', $image_full_path . '_tiny' . $_ext);
             }
             if (!ftpcmd('error')) {
                 ftpcmd('delete', $image_full_path . '_240x240' . $_ext);
             }
         }
     }
     if (!empty($id)) {
         return Db::delete('album_pic', 'apic_id in(' . $id . ')');
     } else {
         return false;
     }
 }
开发者ID:dw250100785,项目名称:shopnc,代码行数:49,代码来源:album.model.php


示例8: getremotefile

function getremotefile($file)
{
    global $_G;
    @set_time_limit(0);
    if (!@readfile($_G['setting']['ftp']['attachurl'] . 'forum/' . $file)) {
        $ftp = ftpcmd('object');
        $tmpfile = @tempnam($_G['setting']['attachdir'], '');
        if ($ftp->ftp_get($tmpfile, 'forum/' . $file, FTP_BINARY)) {
            @readfile($tmpfile);
            @unlink($tmpfile);
        } else {
            @unlink($tmpfile);
            return FALSE;
        }
    }
    return TRUE;
}
开发者ID:dalinhuang,项目名称:hlwbbsvincent,代码行数:17,代码来源:forum_attachment.php


示例9: setthreadcover

function setthreadcover($pid, $tid = 0, $aid = 0)
{
    global $_G;
    $cover = 0;
    if (empty($_G['uid']) || !intval($_G['setting']['forumpicstyle']['thumbwidth']) || !intval($_G['setting']['forumpicstyle']['thumbwidth'])) {
        return false;
    }
    if (($pid || $aid) && empty($tid)) {
        if ($aid) {
            $attachtable = getattachtablebyaid($aid);
            $wheresql = "aid='{$aid}' AND isimage IN ('1', '-1')";
        } else {
            $attachtable = getattachtablebypid($pid);
            $wheresql = "pid='{$pid}' AND isimage IN ('1', '-1') ORDER BY width DESC LIMIT 1";
        }
        $query = DB::query("SELECT * FROM " . DB::table($attachtable) . " WHERE {$wheresql}");
        if (!($attach = DB::fetch($query))) {
            return false;
        }
        if (empty($_G['forum']['ismoderator']) && $_G['uid'] != $attach['uid']) {
            return false;
        }
        $pid = empty($pid) ? $attach['pid'] : $pid;
        $tid = empty($tid) ? $attach['tid'] : $tid;
        $basedir = !$_G['setting']['attachdir'] ? DISCUZ_ROOT . './data/attachment/' : $_G['setting']['attachdir'];
        $coverdir = 'threadcover/' . substr(md5($tid), 0, 2) . '/' . substr(md5($tid), 2, 2) . '/';
        dmkdir($basedir . './forum/' . $coverdir);
        $picsource = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'forum/' . $attach['attachment'];
        require_once libfile('class/image');
        $image = new image();
        if ($image->Thumb($picsource, 'forum/' . $coverdir . $tid . '.jpg', $_G['setting']['forumpicstyle']['thumbwidth'], $_G['setting']['forumpicstyle']['thumbheight'], 2)) {
            $remote = '';
            if (getglobal('setting/ftp/on')) {
                if (ftpcmd('upload', 'forum/' . $coverdir . $tid . '.jpg')) {
                    $remote = '-';
                }
            }
            $cover = DB::result_first("SELECT COUNT(*) FROM " . DB::table($attachtable) . " WHERE pid='{$pid}' AND isimage IN ('1', '-1')");
            $cover = $remote . $cover;
        } else {
            return false;
        }
    }
    if ($tid || $cover) {
        if (empty($cover)) {
            $oldcover = DB::result_first("SELECT cover FROM " . DB::table('forum_thread') . " WHERE tid='{$tid}'");
            $cover = DB::result_first("SELECT COUNT(*) FROM " . DB::table(getattachtablebytid($tid)) . " WHERE pid='{$pid}' AND isimage IN ('1', '-1')");
            $cover = $cover && $oldcover < 0 ? '-' . $cover : $cover;
        }
        DB::update('forum_thread', array('cover' => $cover), array('tid' => $tid));
    }
    return true;
}
开发者ID:v998,项目名称:discuzx-en,代码行数:53,代码来源:function_post.php


示例10: setthreadcover

function setthreadcover($pid, $tid = 0, $aid = 0, $countimg = 0, $imgurl = '')
{
    global $_G;
    $cover = 0;
    if (empty($_G['uid']) || !intval($_G['setting']['forumpicstyle']['thumbheight']) || !intval($_G['setting']['forumpicstyle']['thumbwidth'])) {
        return false;
    }
    if (($pid || $aid) && empty($countimg)) {
        if (empty($imgurl)) {
            if ($aid) {
                $attachtable = 'aid:' . $aid;
                $attach = C::t('forum_attachment_n')->fetch('aid:' . $aid, $aid, array(1, -1));
            } else {
                $attachtable = 'pid:' . $pid;
                $attach = C::t('forum_attachment_n')->fetch_max_image('pid:' . $pid, 'pid', $pid);
            }
            if (!$attach) {
                return false;
            }
            if (empty($_G['forum']['ismoderator']) && $_G['uid'] != $attach['uid']) {
                return false;
            }
            $pid = empty($pid) ? $attach['pid'] : $pid;
            $tid = empty($tid) ? $attach['tid'] : $tid;
            $picsource = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'forum/' . $attach['attachment'];
        } else {
            $attachtable = 'pid:' . $pid;
            $picsource = $imgurl;
        }
        $basedir = !$_G['setting']['attachdir'] ? DISCUZ_ROOT . './data/attachment/' : $_G['setting']['attachdir'];
        $coverdir = 'threadcover/' . substr(md5($tid), 0, 2) . '/' . substr(md5($tid), 2, 2) . '/';
        dmkdir($basedir . './forum/' . $coverdir);
        require_once libfile('class/image');
        $image = new image();
        if ($image->Thumb($picsource, 'forum/' . $coverdir . $tid . '.jpg', $_G['setting']['forumpicstyle']['thumbwidth'], $_G['setting']['forumpicstyle']['thumbheight'], 2)) {
            $remote = '';
            if (getglobal('setting/ftp/on')) {
                if (ftpcmd('upload', 'forum/' . $coverdir . $tid . '.jpg')) {
                    $remote = '-';
                }
            }
            $cover = C::t('forum_attachment_n')->count_image_by_id($attachtable, 'pid', $pid);
            if ($imgurl && empty($cover)) {
                $cover = 1;
            }
            $cover = $remote . $cover;
        } else {
            return false;
        }
    }
    if ($countimg) {
        if (empty($cover)) {
            $thread = C::t('forum_thread')->fetch($tid);
            $oldcover = $thread['cover'];
            $cover = C::t('forum_attachment_n')->count_image_by_id('tid:' . $tid, 'pid', $pid);
            if ($cover) {
                $cover = $oldcover < 0 ? '-' . $cover : $cover;
            }
        }
    }
    if ($cover) {
        C::t('forum_thread')->update($tid, array('cover' => $cover));
        return true;
    }
}
开发者ID:samyex6,项目名称:discuz3.2-lite,代码行数:65,代码来源:function_post.php


示例11: block_delete_pic

function block_delete_pic($bid, $itemid = array())
{
    global $_G;
    if (!empty($bid)) {
        if (!is_array($bid)) {
            $bid = array($bid);
        }
        $where = ' bid IN (' . dimplode($bid) . ')';
        if ($itemid && !is_array($itemid)) {
            $itemid = array($itemid);
        }
        $where .= !empty($itemid) ? ' AND itemid IN (' . dimplode($itemid) . ')' : '';
        $picids = array();
        $query = DB::query('SELECT picid, pic, picflag FROM ' . DB::table('common_block_pic') . " WHERE {$where}");
        while ($value = DB::fetch($query)) {
            $picids[$value['picid']] = $value['picid'];
            if ($value['picflag']) {
                ftpcmd('delete', $value['pic']);
            } else {
                @unlink($_G['setting']['attachdir'] . '/' . $value['pic']);
            }
        }
        if (!empty($picids)) {
            DB::delete('common_block_pic', 'picid IN(' . dimplode($picids) . ')');
        }
    }
}
开发者ID:v998,项目名称:discuzx-en,代码行数:27,代码来源:function_block.php


示例12: DoAddADV

 function DoAddADV()
 {
     $html = '';
     $location = jget('location', 'trim');
     $adid = jget('adid', 'int');
     if ($adid) {
         $sql = " select * from `" . TABLE_PREFIX . "ad` where `adid` = '{$adid}' ";
         $ad_info = DB::fetch_first($sql);
         $ad_info || $this->Messager("您要修改的广告不存在或已删除。", -1);
     }
     $location || $ad_info['location'] || $this->Messager("这个是哪里的广告位?", 'admin.php?mod=income');
     $title = jget('title', 'trim');
     if (!$title) {
         $this->Messager("请输入广告标题", -1);
     }
     $hcode = jget('hcode');
     if (count($hcode['page']) < 1) {
         $this->Messager("广告投放范围必须要有哦", -1);
     }
     $ftime = jget('ftime', 'trim');
     if ($ftime) {
         $ftime = strtotime($ftime);
     }
     $ttime = jget('ttime', 'trim');
     if ($ttime) {
         $ttime = strtotime($ttime);
     }
     $type = jget('type', 'int');
     switch ($type) {
         case 1:
             #代码
             if (!$hcode['html']) {
                 $this->Messager("广告HTML代码必须要有哦", -1);
             }
             $html = $hcode['html'];
             break;
         case 2:
             #文字
             if (!$hcode['word']) {
                 $this->Messager("文字内容必须要有哦", -1);
             }
             if (!$hcode['word_url']) {
                 $this->Messager("文字链接必须要有哦", -1);
             }
             if ($hcode['word_size']) {
                 $word_size = 'style="font-size:' . $hcode['word_size'] . 'px"';
             }
             $html = '<a href="' . $hcode['word_url'] . '" target="_blank"><span ' . $word_size . '>' . $hcode['word'] . '</span></a>';
             break;
         case 3:
             #图片
             if ($_FILES['image']['name']) {
                 $name = time() . MEMBER_ID;
                 $image_name = $name . ".jpg";
                 $image_path = RELATIVE_ROOT_PATH . 'images/ad/';
                 $image_file = $image_path . $image_name;
                 if (!is_dir($image_path)) {
                     jio()->MakeDir($image_path);
                 }
                 jupload()->init($image_path, 'image', true);
                 jupload()->setNewName($image_name);
                 $result = jupload()->doUpload();
                 if ($result) {
                     $result = is_image($image_file);
                 }
                 if (!$result) {
                     unlink($image_file);
                     $this->Messager("图片上传失败。", -1);
                 }
                 if ($this->Config['ftp_on']) {
                     $ftp_key = randgetftp();
                     $get_ftps = jconf::get('ftp');
                     $site_url = $get_ftps[$ftp_key]['attachurl'];
                     $ftp_result = ftpcmd('upload', $image_file, '', $ftp_key);
                     if ($ftp_result > 0) {
                         jio()->DeleteFile($image_file);
                         $image_file = $site_url . '/' . str_replace('./', '', $image_file);
                     }
                 }
                 $hcode['image'] = $image_file;
             } else {
                 if (!$adid) {
                     $this->Messager("图片必须要有哦", -1);
                 } else {
                     $un_hcode = unserialize(base64_decode($ad_info['hcode']));
                     $hcode['image'] = $un_hcode['image'];
                 }
             }
             $hcode['pic_url'] || $this->Messager("图片链接必须要有哦", -1);
             $image_width_html = $hcode['pic_width'] ? ' width=' . $hcode['pic_width'] : '';
             $image_height_html = $hcode['pic_height'] ? ' height= ' . $hcode['pic_height'] : '';
             $html = '<a href="' . $hcode[pic_url] . '" target="_blank" title="' . $hcode['pic_title'] . '"><img src="' . $hcode['image'] . '" ' . $image_width_html . $image_height_html . '></a>';
             break;
         default:
             $this->Messager("展现方式必须要有哦", -1);
             break;
     }
     $ser_hcode = base64_encode(serialize($hcode));
     #保存到数据库
     $data = array('location' => $location, 'title' => $title, 'type' => $type, 'ftime' => $ftime, 'ttime' => $ttime, 'hcode' => $ser_hcode);
//.........这里部分代码省略.........
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:101,代码来源:income.mod.php


示例13: onloadPic

 function onloadPic()
 {
     if (!$this->MemberHandler->HasPermission($this->Module, 'create')) {
         js_alert_showmsg($this->MemberHandler->GetError());
     }
     if ('admin' != MEMBER_ROLE_TYPE) {
         $is_allowed = jlogic('event')->allowedCreate(MEMBER_ID, $this->Member);
         if ($is_allowed) {
             js_alert_showmsg($is_allowed);
         }
     }
     if ($_FILES['pic']['name']) {
         $name = time() . MEMBER_ID;
         $image_name = $name . "_b.jpg";
         $image_path = RELATIVE_ROOT_PATH . 'images/event/';
         $image_file = $image_path . $image_name;
         $image_name_show = $name . "_s.jpg";
         $image_file_min = $image_path . $image_name_show;
         if (!is_dir($image_path)) {
             jio()->MakeDir($image_path);
         }
         jupload()->init($image_path, 'pic', true);
         jupload()->setNewName($image_name);
         $result = jupload()->doUpload();
         if ($result) {
             $result = is_image($image_file);
         }
         if (!$result) {
             unlink($image_file);
             unlink($image_file_min);
             echo "<script language='Javascript'>";
             echo "parent.document.getElementById('message').style.display='block';";
             echo "parent.document.getElementById('uploading').style.display='none';";
             if ($this->Post['top'] == 'top') {
                 echo "parent.document.getElementById('back1').style.display='block';";
                 echo "parent.document.getElementById('next3').style.display='block';";
             }
             echo "parent.document.getElementById('message').innerHTML='图片上载失败'";
             echo "</script>";
             exit;
         }
         makethumb($image_file, $image_file_min, 60, 60, 0, 0, 0, 0, 0, 0);
         image_thumb($image_file, $image_file, 100, 128, 1, 0, 0);
         if ($this->Config['watermark_enable']) {
             jlogic('image')->watermark($image_file);
         }
         if ($this->Config['ftp_on']) {
             $ftp_key = randgetftp();
             $get_ftps = jconf::get('ftp');
             $site_url = $get_ftps[$ftp_key]['attachurl'];
             $ftp_result = ftpcmd('upload', $image_file, '', $ftp_key);
             if ($ftp_result > 0) {
                 ftpcmd('upload', $image_file_min, '', $ftp_key);
                 jio()->DeleteFile($image_file);
                 jio()->DeleteFile($image_file_min);
                 $image_file = $site_url . '/' . str_replace('./', '', $image_file);
             }
         }
         $hid_pic = $this->Post['hid_pic'];
         $eid = (int) $this->Post['id'];
         $this->doUnlink($hid_pic, $eid);
         echo "<script language='Javascript'>";
         echo "parent.document.getElementById('uploading').style.display='none';";
         if ($this->Post['top'] == 'top') {
             echo "parent.document.getElementById('back1').style.display='block';";
             echo "parent.document.getElementById('next3').style.display='block';";
         }
         echo "parent.document.getElementById('message').style.display='none';";
         echo "parent.document.getElementById('img').style.display='block';";
         echo "parent.document.getElementById('showimg').src='{$image_file}';";
         echo "parent.document.getElementById('hid_pic').value='{$image_file}';";
         echo "</script>";
         exit;
     }
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:75,代码来源:event.mod.php


示例14: Upload

 function Upload()
 {
     $image_id = 0;
     $field = 'topic';
     if (empty($_FILES) || !$_FILES[$field]['name']) {
         return 0;
     } else {
         $timestamp = time();
         $uid = $this->Post['touid'] ? $this->Post['touid'] : MEMBER_ID;
         $username = $this->Post['tousername'] ? $this->Post['tousername'] : MEMBER_NAME;
         $image_id = jlogic('image')->add($uid, $username);
         if ($image_id < 1) {
             return 0;
         }
         $sub_path = './images/' . $field . '/' . face_path($image_id);
         $image_path = RELATIVE_ROOT_PATH . $sub_path;
         $image_path_abs = ROOT_PATH . $sub_path;
         $image_path2 = './images/' . $field . '/' . face_path($image_id);
         $image_name = $image_id . "_o.jpg";
         $image_file = $image_path . $image_name;
         $image_file_abs = $image_path_abs . $image_name;
         $image_file2 = $image_path2 . $image_name;
         $image_file_small = $image_path . $image_id . "_s.jpg";
         $image_file_small_abs = $image_path_abs . $image_id . "_s.jpg";
         if (!is_dir($image_path_abs)) {
             jio()->MakeDir($image_path_abs);
         }
         jupload()->init($image_path_abs, $field, true);
         jupload()->setNewName($image_name);
         $result = jupload()->doUpload();
         if ($result) {
             $result = is_image($image_file_abs);
         }
         if (false == $result) {
             jio()->DeleteFile($image_file_abs);
             jlogic('image')->delete($image_id);
             $error_msg = implode(" ", (array) jupload()->getError());
         } else {
             $this->_removeTopicImage($image_id);
             list($image_width, $image_height, $image_type, $image_attr) = getimagesize($image_file_abs);
             $result = makethumb($image_file_abs, $image_file_small_abs, min($this->Config['thumbwidth'], $image_width), min($this->Config['thumbwidth'], $image_height), $this->Config['maxthumbwidth'], $this->Config['maxthumbheight']);
             if (!$result && !is_file($image_file_small_abs)) {
                 @copy($image_file_abs, $image_file_small_abs);
             }
             if ($this->Config['watermark_enable']) {
                 jlogic('image')->watermark($image_file_abs);
             }
             $image_size = filesize($image_file_abs);
             $name = addslashes($_FILES[$field]['name']);
             $site_url = '';
             if ($this->Config['ftp_on']) {
                 $ftp_key = randgetftp();
                 $get_ftps = jconf::get('ftp');
                 $site_url = $get_ftps[$ftp_key]['attachurl'];
                 $ftp_result = ftpcmd('upload', $image_file_abs, '', $ftp_key);
                 if ($ftp_result > 0) {
                     ftpcmd('upload', $image_file_small_abs, '', $ftp_key);
                     jio()->DeleteFile($image_file_abs);
                     jio()->DeleteFile($image_file_small_abs);
                     $image_file_small = $site_url . '/' . $image_file_small;
                 }
             }
             jlogic('image')->modify(array('id' => $image_id, 'site_url' => $site_url, 'photo' => $image_file2, 'name' => $name, 'filesize' => $image_size, 'width' => $image_width, 'height' => $image_height));
         }
     }
     return $image_id;
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:67,代码来源:topic.mod.php


示例15: _parse_url_attach

 function _parse_url_attach($data, $attach_url)
 {
     $__is_attach = false;
     $uid = $data['uid'];
     $username = $data['username'];
     $attach_id = jlogic('attach')->add($uid, $username);
     $p = array('id' => $attach_id, 'tid' => $data['tid'], 'file_url' => $attach_url);
     jlogic('attach')->modify($p);
     $attach_path = RELATIVE_ROOT_PATH . 'data/attachs/topic/' . face_path($attach_id) . '/';
     $attach_type = strtolower(end(explode('.', $attach_url)));
     $attach_name = $attach_id . '.' . $attach_type;
     $attach_file = $attach_path . $attach_name;
     if (!is_file($attach_file)) {
         if (!is_dir($attach_path)) {
             jio()->MakeDir($attach_path);
         }
         if (($temp_attach = dfopen($attach_url)) && jio()->WriteFile($attach_file, $temp_attach) && is_attach($attach_file)) {
             $attach_size = filesize($attach_file);
             $site_url = '';
             if ($GLOBALS['_J']['config']['ftp_on']) {
                 $ftp_key = randgetftp();
                 $get_ftps = jconf::get('ftp');
                 $site_url = $get_ftps[$ftp_key]['attachurl'];
                 $ftp_result = ftpcmd('upload', $attach_file, '', $ftp_key);
             }
             $p = array('id' => $attach_id, 'vtid' => $data['id'], 'site_url' => $site_url, 'file' => $attach_file, 'name' => basename($attach_url), 'filesize' => $attach_size, 'filetype' => $attach_type);
             jlogic('attach')->modify($p);
             $__is_attach = true;
         }
     }
     if (false === $__is_attach && $attach_id > 0) {
         jlogic('attach')->delete($attach_id);
         $attach_id = 0;
     }
     return $attach_id;
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:36,代码来源:topic.logic.php


示例16: substr

        $settingnew['ftp']['attachurl'] .= substr($settingnew['ftp']['attachurl'], -1, 1) != '/' ? '/' : '';
        $_G['setting']['ftp'] = $settingnew['ftp'];
        ftpcmd('upload', $testfile);
        $ftp = ftpcmd('object');
        if (ftpcmd('error')) {
            $alertmsg = cplang('setting_attach_remote_' . ftpcmd('error'));
        }
        if (!$alertmsg) {
            $str = getremotefile($_G['setting']['ftp']['attachurl'] . $testfile);
            if ($str !== $testcontent) {
                $alertmsg = cplang('setting_attach_remote_geterr');
            }
        }
        if (!$alertmsg) {
            ftpcmd('delete', $testfile);
            ftpcmd('delete', 'test/index.htm');
            $ftp->ftp_rmdir('test');
            $str = getremotefile($_G['setting']['ftp']['attachurl'] . $testfile);
            if ($str === $testcontent) {
                $alertmsg = cplang('setting_attach_remote_delerr');
            }
            @unlink($attach_dir . '/' . $testfile);
            @rmdir($attach_dir . 'test');
        }
    }
    if (!$alertmsg) {
        $alertmsg = cplang('setting_attach_remote_ok');
    }
    echo '<script language="javascript">alert(\'' . str_replace('\'', '\\\'', $alertmsg) . '\');parent.$(\'cpform\').action=\'' . ADMINSCRIPT . '?action=setting&edit=yes\';parent.$(\'cpform\').target=\'_self\'</script>';
} elseif ($operation == 'mailcheck') {
    $oldmail = dunserialize($_G['setting']['mail']);
开发者ID:lemonstory,项目名称:bbs,代码行数:31,代码来源:admincp_checktools.php


示例17: libfile

     $upload->save();
 }
 if ($upload->error()) {
     $errorcode = 4;
 }
 if (!$errorcode) {
     if ($attach['isimage'] && empty($_G['setting']['portalarticleimgthumbclosed'])) {
         require_once libfile('class/image');
         $image = new image();
         $thumbimgwidth = $_G['setting']['portalarticleimgthumbwidth'] ? $_G['setting']['portalarticleimgthumbwidth'] : 300;
         $thumbimgheight = $_G['setting']['portalarticleimgthumbheight'] ? $_G['setting']['portalarticleimgthumbheight'] : 300;
         $attach['thumb'] = $image->Thumb($attach['target'], '', $thumbimgwidth, $thumbimgheight, 2);
         $image->Watermark($attach['target'], '', 'portal');
     }
     if (getglobal('setting/ftp/on') && (!$_G['setting']['ftp']['allowedexts'] && !$_G['setting']['ftp']['disallowedexts'] || $_G['setting']['ftp']['allowedexts'] && in_array($attach['ext'], $_G['setting']['ftp']['allowedexts']) || $_G['setting']['ftp']['disallowedexts'] && !in_array($attach['ext'], $_G['setting']['ftp']['disallowedexts'])) && (!$_G['setting']['ftp']['minsize'] || $attach['size'] >= $_G['setting']['ftp']['minsize'] * 1024)) {
         if (ftpcmd('upload', 'portal/' . $attach['attachment']) && (!$attach['thumb'] || ftpcmd('upload', 'portal/' . getimgthumbname($attach['attachment'])))) {
             @unlink($_G['setting']['attachdir'] . '/portal/' . $attach['attachment']);
             @unlink($_G['setting']['attachdir'] . '/portal/' . getimgthumbname($attach['attachment']));
             $attach['remote'] = 1;
         } else {
             if (getglobal('setting/ftp/mirror')) {
                 @unlink($attach['target']);
                 @unlink(getimgthumbname($attach['target']));
                 $errorcode = 5;
             }
         }
     }
     $setarr = array('uid' => $_G['uid'], 'filename' => $attach['name'], 'attachment' => $attach['attachment'], 'filesize' => $attach['size'], 'isimage' => $attach['isimage'], 'thumb' => $attach['thumb'], 'remote' => $attach['remote'], 'filetype' => $attach['extension'], 'dateline' => $_G['timestamp'], 'aid' => $aid);
     $setarr['attachid'] = C::t('portal_attachment')->insert($setarr, true);
     if ($attach['isimage']) {
         require_once libfile('function/home');
开发者ID:renning,项目名称:html,代码行数:31,代码来源:misc_swfupload.php


示例18: ModAttach

 function ModAttach()
 {
     if ($this->MemberHandler->HasPermission($this->Module, 'attach') == false) {
         $this->_mod_attach_error('您没有上传文件的权限,无法继续操作!');
     }
     $id = max(0, (int) $this->Post['id']);
     if ($id < 1) {
         $this->_mod_attach_error('附件ID 错误');
     }
     $attach_info = $this->AttachLogic->get_info($id);
     if (!$attach_info) {
         $this->_mod_attach_error('您要更新的附件已经不存在了');
     }
     if (MEMBER_ROLE_TYPE != 'admin') {
         if (MEMBER_ID != $attach_info['uid']) {
             $this->_mod_attach_error('您没有权限更新该附件');
         }
     }
     if (empty($_FILES) || !$_FILES['mafile']['name']) {
         $this->_mod_attach_error('没有文件上传');
     }
     $attach_size = min(is_numeric($this->Config['attach_size_limit']) ? $this->Config['attach_size_limit'] : 1024, 51200);
     $attach_path = str_replace($id . '.' . $attach_info['filetype'], '', $attach_info['file']);
     $attach_type = strtolower(end(explode('.', $_FILES['mafile']['name'])));
     $attach_name = $id . '.' . $attach_type;
     $attach_file = $attach_path . $attach_name;
     if (!is_dir($attach_path)) {
         jio()->MakeDir($attach_path);
     }
     jupload()->init($attach_path, 'mafile', false, true);
     jupload()->setMaxSize($attach_size);
     jupload()->setNewName($attach_name);
     $ret = jupload()->doUpload();
     if ($ret) {
         $ret = true;
     }
     if (!$ret) {
         jio()->DeleteFile($attach_file);
         $rets = jupload()->getError();
         $ret = $rets ? implode(" ", (array) $rets) : 'attach file is invalid';
         $this->_mod_attach_error($ret);
     }
     $site_url = '';
     if ($this->Config['ftp_on']) {
         $ftp_key = randgetftp();
         $get_ftps = jconf::get('ftp');
         $site_url = $get_ftps[$ftp_key]['attachurl'];
         $ftp_result = ftpcmd('upload', $attach_file, '', $ftp_key);
         if ($ftp_result > 0) {
             jio()->DeleteFile($attach_file);
         }
     }
     $attach_size = filesize($attach_file);
     $name = addslashes($_FILES['mafile']['name']);
     $p = array('id' => $id, 'site_url' => $site_url, 'file' => $attach_file, 'name' => $name, 'filetype' => $attach_type, 'filesize' => $attach_size);
     $this->AttachLogic->modify($p);
     $retval = array('src' => 'images/filetype/' . $attach_type . '.gif', 'name' => $name, 'size' => $attach_size > 1024 * 1024 ? round($attach_size / (1024 * 1024), 2) . 'MB' : ($attach_size == 0 ? '未知' : round($attach_size / 1024, 1) . 'KB'));
     echo "<script type='text/javascript'>window.parent.aupcomplete({$id},'{$retval['src']}','{$retval['name']}','{$retval['size']}');</script>";
 }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:59,代码来源:uploadattach.mod.php


示例19: block_delete_pic

function block_delete_pic($bid, $itemid = array())
{
    global $_G;
    if (!empty($bid)) {
        $picids = array();
        foreach (C::t('common_block_pic')->fetch_all_by_bid_itemid($bid, $itemid) as $value) {
            $picids[$value['picid']] = $value['picid'];
            if ($value['picflag']) {
                ftpcmd('delete', $value['pic']);
            } else {
                @unlink($_G['setting']['attachdir'] . '/' . $value['pic']);
            }
        }
        if (!empty($picids)) {
            C::t('common_block_pic')->delete($picids);
        }
    }
}
开发者ID:vanloswang,项目名称:discuzx-1,代码行数:18,代码来源:function_block.php


示例20: upload

 function upload($p)
 {
     $sys_config = jconf::get();
     if (!$_FILES[$p['field']] || !$_FILES[$p['field']]['name']) {
         return array('error' => 'attach is empty', 'code' => -1);
     }
     $itemid = is_numeric($p['itemid']) ? $p['itemid'] : 0;
     $item = '';
     if ($itemid > 0) {
         $item = $p['item'];
     }
     $uid = (int) ($p['uid'] ? $p['uid'] : MEMBER_ID);
     if ($uid < 1 || false == ($member_info = jsg_member_info($uid))) {
         return ar 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ftruncate函数代码示例发布时间:2022-05-15
下一篇:
PHP ftp_systype函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap