Exemplo n.º 1
0
            $image = getimagesizefromstring($response['content']);
            if (!empty($image) && strexists($image['mime'], 'image')) {
                message(error(0, '配置成功'), '', 'ajax');
            } else {
                message(error(-1, '配置失败,FTP远程访问url错误'), '', 'ajax');
            }
        } else {
            message(error(-1, '配置失败,FTP远程访问url错误'), '', 'ajax');
        }
    } else {
        message(error(-1, 'FTP服务器连接失败,请检查配置'), '', 'ajax');
    }
}
if ($do == 'oss') {
    load()->model('attachment');
    $buckets = attachment_alioss_buctkets(trim($_GPC['key']), trim($_GPC['secret']));
    if (is_error($buckets)) {
        message(error(-1, 'OSS-Access Key ID 或 OSS-Access Key Secret错误,请重新填写'), '', 'ajax');
    }
    if (empty($_GPC['bucket'])) {
        $bucket = reset($buckets);
        $bucket = $bucket['name'];
    } else {
        if (strexists($_GPC['bucket'], '@@')) {
            list($bucket, $url) = explode('@@', $_GPC['bucket']);
        } else {
            $bucket = trim($_GPC['bucket']);
        }
        if (empty($buckets[$bucket])) {
            message(error(-1, '填写的bucket错误,请重新填写'), '', 'ajax');
        }
Exemplo n.º 2
0
            if (empty($remote['ftp']['username'])) {
                message('FTP帐号为必填项.');
            }
            if (empty($remote['ftp']['password'])) {
                message('FTP密码为必填项.');
            }
        }
        setting_save($remote, 'remote');
        message('远程附件配置信息更新成功!', url('system/attachment/remote'));
    }
    $remote = $_W['setting']['remote'];
    if (!empty($remote['alioss']['key']) && !empty($remote['alioss']['secret'])) {
        $buckets = attachment_alioss_buctkets($remote['alioss']['key'], $remote['alioss']['secret']);
    }
    $bucket_datacenter = array('oss-cn-hangzhou' => '杭州数据中心', 'oss-cn-qingdao' => '青岛数据中心', 'oss-cn-beijing' => '北京数据中心', 'oss-cn-hongkong' => '香港数据中心', 'oss-cn-shenzhen' => '深圳数据中心', 'oss-cn-shanghai' => '上海数据中心', 'oss-us-west-1' => '美国硅谷数据中心');
} elseif ($do == 'buckets') {
    $key = $_GPC['key'];
    $secret = $_GPC['secret'];
    $buckets = attachment_alioss_buctkets($key, $secret);
    if (is_error($buckets)) {
        message(error(-1), '', 'ajax');
    }
    $bucket_datacenter = array('oss-cn-hangzhou' => '杭州数据中心', 'oss-cn-qingdao' => '青岛数据中心', 'oss-cn-beijing' => '北京数据中心', 'oss-cn-hongkong' => '香港数据中心', 'oss-cn-shenzhen' => '深圳数据中心', 'oss-cn-shanghai' => '上海数据中心', 'oss-us-west-1' => '美国硅谷数据中心');
    $bucket = array();
    foreach ($buckets as $key => $value) {
        $value['loca_name'] = $key . '@@' . $bucket_datacenter[$value['location']];
        $bucket[] = $value;
    }
    message(error(1, $bucket), '', 'ajax');
}
template('system/attachment');