function cloud_prepare() { global $_W; setting_load('site'); if (empty($_W['setting']['site']['key']) || empty($_W['setting']['site']['token'])) { return error('-1', "您的程序需要在微擎云服务平台注册你的站点资料, 来接入云平台服务后才能使用相应功能."); } return true; }
function _login($forward = '') { global $_GPC, $_W; load()->model('user'); $member = array(); $username = trim($_GPC['username']); if (empty($username)) { message('请输入要登录的用户名'); } $member['username'] = $username; $member['password'] = $password = $_GPC['password']; if (empty($member['password'])) { message('请输入密码'); } $record = user_single($member); if (!empty($record)) { /*if($record['status'] == 1) { message('您的账号正在审核或是已经被系统禁止,请联系网站管理员解决!'); }*/ $founders = explode(',', $_W['config']['setting']['founder']); $_W['isfounder'] = in_array($record['uid'], $founders); if ($_W['siteclose'] && !$_W['isfounder']) { $settings = setting_load('copyright'); message('站点已关闭,关闭原因:' . $settings['copyright']['reason']); } $cookie = array(); $cookie['uid'] = $record['uid']; $cookie['lastvisit'] = $record['lastvisit']; $cookie['lastip'] = $record['lastip']; $cookie['hash'] = md5($record['password'] . $record['salt']); $session = base64_encode(json_encode($cookie)); isetcookie('__session', $session, !empty($_GPC['rember']) ? 7 * 86400 : 0); $status = array(); $status['uid'] = $record['uid']; $status['lastvisit'] = TIMESTAMP; $status['lastip'] = CLIENT_IP; user_update($status); if (empty($forward)) { $forward = $_GPC['forward']; } if (empty($forward)) { $forward = './index.php?c=index&a=index'; } $_W['user'] = $record; if (cly_isAdmin()) { message('', url('admin/index')); } else { message('', $forward); } //message("欢迎回来,{$record['username']}。", $forward); } else { message('登录失败,请检查您输入的用户名和密码!'); } }
function setting_module_load($module, $key = '', $default = null) { $setting = setting_load($module); $module = $setting[$module]; if (empty($key)) { return $module; } else { if (isset($module[$key])) { return $module[$key]; } return $default; } }
function __construct($account = array()) { $setting = setting_load('platform'); $this->appid = $setting['platform']['appid']; $this->appsecret = $setting['platform']['appsecret']; $this->token = $setting['platform']['token']; $this->encodingaeskey = $setting['platform']['encodingaeskey']; $this->account = $account; if ($this->account['key'] == 'wx570bc396a51b8ff8') { $this->account['key'] = $this->appid; $this->openPlatformTestCase(); } $this->account['key'] = $this->appid; }
<?php /** * [SxxPro System] Copyright (c) 2014 012WZ.COM * SxxPro is NOT a free software, it under the license terms, visited http://www.qdaygroup.com/ for more details. */ $_W['page']['title'] = '云服务诊断 - 云服务'; if (checksubmit()) { load()->model('setting'); setting_save('', 'site'); message('成功清除站点记录.', 'refresh'); } setting_load('site'); if (empty($_W['setting']['site'])) { $_W['setting']['site'] = array(); } template('cloud/diagnose');
} unset($cplen, $key, $value); $_GPC = array_merge($_GET, $_POST, $_GPC); $_GPC = ihtmlspecialchars($_GPC); if (!$_W['isajax']) { $input = file_get_contents("php://input"); if (!empty($input)) { $__input = @json_decode($input, true); if (!empty($__input)) { $_GPC['__input'] = $__input; $_W['isajax'] = true; } } unset($input, $__input); } setting_load('upload'); if (empty($_W['setting']['upload'])) { $_W['setting']['upload'] = array_merge($_W['config']['upload']); } $_W['attachurl'] = empty($_W['config']['upload']['attachurl']) ? $_W['siteroot'] . $_W['config']['upload']['attachdir'] . '/' : $_W['config']['upload']['attachurl'] . '/'; $_W['os'] = Agent::deviceType(); if ($_W['os'] == Agent::DEVICE_MOBILE) { $_W['os'] = 'mobile'; } elseif ($_W['os'] == Agent::DEVICE_DESKTOP) { $_W['os'] = 'windows'; } else { $_W['os'] = 'unknown'; } $_W['container'] = Agent::browserType(); if (Agent::isMicroMessage() == Agent::MICRO_MESSAGE_YES) { $_W['container'] = 'wechat';
*/ $_W['page']['title'] = '云服务诊断 - 云服务'; $dos = array('display', 'testapi'); $do = in_array($do, $dos) ? $do : 'display'; if ($do == 'testapi') { load()->model('cloud'); $starttime = microtime(true); $response = cloud_request('http://v2.addons.we7.cc'); $endtime = microtime(true); message('请求接口成功,耗时 ' . round($endtime - $starttime, 5) . ' 秒', '', 'ajax'); } else { if (checksubmit()) { load()->model('setting'); setting_save('', 'site'); message('成功清除站点记录.', 'refresh'); } if (checksubmit('updateserverip')) { load()->model('setting'); if (!empty($_GPC['ip'])) { setting_save($_GPC['ip'], 'cloudip'); } else { setting_save('', 'cloudip'); } message('修改云服务ip成功.', 'refresh'); } setting_load(array('site', 'cloudip')); if (empty($_W['setting']['site'])) { $_W['setting']['site'] = array(); } template('cloud/diagnose'); }
if (is_array($user) && $session['hash'] == md5($user['password'] . $user['salt'])) { $_W['uid'] = $user['uid']; $_W['username'] = $user['username']; $user['currentvisit'] = $user['lastvisit']; $user['currentip'] = $user['lastip']; $user['lastvisit'] = $session['lastvisit']; $user['lastip'] = $session['lastip']; $_W['user'] = $user; $founders = explode(',', $_W['config']['setting']['founder']); $_W['isfounder'] = in_array($_W['uid'], $founders); unset($founders); } else { isetcookie('__session', false, -100); } unset($user); } unset($session); if (!empty($_GPC['__uniacid'])) { $_W['uniacid'] = intval($_GPC['__uniacid']); $_W['weid'] = $_W['uniacid']; $_W['uniaccount'] = $_W['account'] = uni_fetch($_W['uniacid']); if (!empty($_W['uid'])) { $_W['role'] = uni_permission($_W['uid'], $_W['uniacid']); } } setting_load('basic'); $_W['template'] = 'default'; if (!empty($_W['setting']['basic']['template'])) { $_W['template'] = $_W['setting']['basic']['template']; } load()->func('compat.biz');
<?php /** * [WeiZan System] Copyright (c) 2014 WeiZan.Com * WeiZan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details. */ defined('IN_IA') or exit('Access Denied'); $dos = array('addons'); $do = in_array($do, $dos) ? $do : 'addons'; load()->model('setting'); load()->func('tpl'); $settings = setting_load('addons'); $settings = $settings['addons']; if (empty($settings) || !is_array($settings)) { $settings = array(); } if ($do == 'addons') { $_W['page']['title'] = '云服务 - 管理应用商城 - 切换应用商城'; if (checksubmit('submit')) { if ($_GPC['addons_site'] == 0) { $addons_url = 'http://addons.weizancms.com'; $c_url = 'http://www.012wz.com'; } elseif ($_GPC['addons_site'] == 1) { $addons_url = 'http://wdl.weizancms.com'; $c_url = 'http://www.wdlcms.com'; } elseif ($_GPC['addons_site'] == 2) { $addons_url = 'http://addons.we7cms.cn'; $c_url = 'http://www.012wz.com'; } else { $addons_url = $_GPC['addons_url']; }
$update = array(); $update['notify'] = iserializer($notify); pdo_update('uni_settings', $update, array('uniacid' => $_W['uniacid'])); if (!empty($_GPC['testsend']) && !empty($_GPC['receiver'])) { $result = ihttp_email($_GPC['receiver'], $_W['setting']['copyright']['sitename'] . '验证邮件' . date('Y-m-d H:i:s'), '如果您收到这封邮件则表示您系统的发送邮件配置成功!'); if (is_error($result)) { message($result['message']); } } message('更新设置成功!', url('system/common')); } if (checksubmit('authmodesubmit')) { $authmode = intval($_GPC['authmode']); setting_save($authmode, 'authmode'); message('更新设置成功!', url('system/common')); } if (checksubmit('sms_submit')) { $sms = $_GPC['sms']; setting_save($sms, 'sms'); if (!empty($_GPC['sms_testsend']) && !empty($_GPC['sms_receiver'])) { load()->func('sms'); $content = "您的验证码是:【{$_W['setting']['copyright']['sitename']}短信测试】。如需帮助请联系客服。"; $result = sms_send($_GPC['sms_receiver'], $content, $_W['setting']['copyright']['sitename'], false); if (is_error($result)) { message($result['message']); } } message('更新设置成功!', url('system/common')); } setting_load(array('authmode', 'mail', 'sms')); template('system/common');
<?php defined('IN_IA') or exit('Access Denied'); $dos = array('copyright', 'close'); $do = in_array($do, $dos) ? $do : 'copyright'; load()->model('setting'); load()->func('tpl'); $settings = setting_load('copyright'); $settings = $settings['copyright']; if (empty($settings) || !is_array($settings)) { $settings = array(); } if ($do == 'copyright') { $_W['page']['title'] = '站点信息设置 - 系统管理'; if (checksubmit('submit')) { $data = array('sitename' => $_GPC['sitename'], 'url' => strexists($_GPC['url'], 'http://') ? $_GPC['url'] : "http://{$_GPC['url']}", 'statcode' => htmlspecialchars_decode($_GPC['statcode']), 'footerleft' => htmlspecialchars_decode($_GPC['footerleft']), 'footerright' => htmlspecialchars_decode($_GPC['footerright']), 'flogo' => $_GPC['flogo'], 'blogo' => $_GPC['flogo'], 'baidumap' => $_GPC['baidumap'], 'address' => $_GPC['address'], 'phone' => $_GPC['phone'], 'qq' => $_GPC['qq'], 'email' => $_GPC['email'], 'keywords' => $_GPC['keywords'], 'description' => $_GPC['description']); setting_save($data, 'copyright'); message('更新设置成功!', url('system/site')); } } if ($do == 'close') { $_W['page']['title'] = '站点信息设置 - 关闭站点'; if (checksubmit('submit')) { $close['status'] = $_GPC['status']; $close['reason'] = $_GPC['reason']; setting_save($close, 'close'); message('站点状态更新成功!', url('system/site/close')); } $settings = setting_load('close'); } template('system/site');
<?php /** * [Weizan System] Copyright (c) 2014 wdlcms.com * Weizan is NOT a free software, it under the license terms, visited http://www.wdlcms.com/ for more details. */ defined('IN_IA') or exit('Access Denied'); $do = in_array($_GPC['do'], array('upload')) ? $_GPC['do'] : 'upload'; $type = in_array($_GPC['type'], array('image', 'audio')) ? $_GPC['type'] : 'image'; $result = array('error' => 1, 'message' => ''); if ($do == 'upload') { if ($type == 'image') { $result = array('jsonrpc' => '2.0', 'id' => 'id', 'error' => array('code' => 1, 'message' => '')); load()->model('setting'); $uploadsetting = setting_load('upload'); $uploadsetting = $uploadsetting['upload']; $thumb = empty($uploadsetting['image']['thumb']) ? 0 : 1; $width = intval($uploadsetting['image']['width']); load()->func('file'); if (!empty($_FILES['file']['name'])) { if ($_FILES['file']['error'] != 0) { $result['error']['message'] = '上传失败,请重试!'; die(json_encode($result)); } $_W['uploadsetting'] = array(); $_W['uploadsetting']['image']['folder'] = 'images/' . $_W['uniacid']; $_W['uploadsetting']['image']['extentions'] = $_W['config']['upload']['image']['extentions']; $_W['uploadsetting']['image']['limit'] = $_W['config']['upload']['image']['limit']; $file = file_upload($_FILES['file']); if (is_error($file)) { $result['error']['message'] = $file['message'];
function sms_send($mobile = '', $content = '', $signature = '', $check = true) { global $_W; $setting = setting_load('sms'); if (empty($setting['sms'])) { return error(1, "未设置短信接口,无法发送短信!"); } if (!empty($setting['sms']) && $setting['sms']['type'] == 'yimei') { if (empty($setting['sms']['url']) || empty($setting['sms']['password']) || empty($setting['sms']['serialNumber']) || empty($setting['sms']['sessionKey'])) { return error(1, "亿美短信接口配置不完整,无法发送短信!"); } } if (!empty($setting['sms']) && $setting['sms']['type'] == 'dxton') { if (empty($setting['sms']['dxton_username']) || empty($setting['sms']['dxton_pwd'])) { return error(1, "短信通接口配置不完整,无法发送短信!"); } } $config = $setting['sms']; $smsconfig = array("balance" => 0, "signature" => $_W['setting']['sitename']); $row = pdo_fetch("SELECT `notify` FROM " . tablename('uni_settings') . " WHERE uniacid = :uniacid", array(':uniacid' => $_W['uniacid'])); $row['notify'] = @iunserializer($row['notify']); if (!empty($row['notify']) && !empty($row['notify']['sms'])) { $smsconfig = $row['notify']['sms']; } if ($check) { if (intval($smsconfig['balance']) <= 0) { return error(1, "短信条数不足,请联系客服人员"); } } if (empty($signature)) { $signature = ""; } if ($config['type'] == 'yimei') { $content = "【" . $signature . "】" . $content; $sms = new SMSUtil($config['url'], $config['serialNumber'], $config['password'], $config['sessionKey'], array("proxyhost" => $config['proxyhost'], "proxyport" => $config['proxyport'], "proxyusername" => $config['proxyusername'], "proxypassword" => $config['proxypassword']), $config['timeout'], $config['response_timeout']); $err = $sms->send($mobile, $content); if (empty($err)) { $row['notify']['sms']['balance'] = intval($row['notify']['sms']['balance']) - 1; pdo_update('uni_settings', array('notify' => iserializer($row['notify'])), array('uniacid' => $_W['uniacid'])); return true; } else { return error(1, $err); } } else { if ($config['type'] == 'dxton') { $username = $config['dxton_username']; $pwd = $config['dxton_pwd']; $target = "http://www.dxton.com/webservice/sms.asmx/Submit"; $post_data = "account=" . $username . "&password="******"&mobile=" . $mobile . "&content=" . rawurlencode($content); $result = ihttp_request($target, $post_data); $xml = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA); $result = (string) $xml->result; $message = (string) $xml->message; if ($result == '100') { $row['notify']['sms']['balance'] = intval($row['notify']['sms']['balance']) - 1; pdo_update('uni_settings', array('notify' => iserializer($row['notify'])), array('uniacid' => $_W['uniacid'])); return true; } return error(1, $message); } } }
function check_shop_auth($url = '', $type = 's') { global $_W, $_GPC; if ($_W['ispost'] && $_GPC['do'] != 'auth') { $auth = get_auth(); load()->func('communication'); $domain = $_SERVER['HTTP_HOST']; $ip = gethostbyname($domain); $setting = setting_load('site'); $id = isset($setting['site']['key']) ? $setting['site']['key'] : '0'; if (empty($type) || $type == 's') { $post_data = array('type' => $type, 'ip' => $ip, 'id' => $id, 'code' => $auth['code'], 'domain' => $domain); } else { $post_data = array('type' => 'm', 'm' => $type, 'ip' => $ip, 'id' => $id, 'code' => $auth['code'], 'domain' => $domain); } $resp = ihttp_post($url, $post_data); $status = $resp['content']; } }
<?php /** * [WeEngine System] Copyright (c) 2014 WE7.CC * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details. */ defined('IN_IA') or exit('Access Denied'); load()->func('communication'); set_time_limit(0); $dos = array('ticket', 'forward', 'test'); $do = in_array($do, $dos) ? $do : 'forward'; load()->classs('weixin.platform'); $account_platform = new WeiXinPlatform(); $setting = setting_load('platform'); if ($do == 'forward') { if (empty($_GPC['auth_code'])) { message('授权登录失败,请重试', url('account/display'), 'error'); } $auth_info = $account_platform->getAuthInfo($_GPC['auth_code']); $auth_refresh_token = $auth_info['authorization_info']['authorizer_refresh_token']; $auth_appid = $auth_info['authorization_info']['authorizer_appid']; $account_info = $account_platform->getAccountInfo($auth_appid); if (is_error($account_info)) { message('授权登录新建公众号失败,请重试', url('account/display'), 'error'); } if (!empty($_GPC['test'])) { echo "此为测试平台接入返回结果:<br/> 公众号名称:{$account_info['authorizer_info']['nick_name']} <br/> 接入状态:成功"; exit; } if ($account_info['authorizer_info']['service_type_info'] = '0' || $account_info['authorizer_info']['service_type_info'] == '1') { if ($account_info['authorizer_info']['verify_type_info'] > -1) {
<?php /** * [Weizan System] Copyright (c) 2013 wdlcms.com * $sn: pro/web/source/account/welcome.ctrl.php : v f2069dc830e0 : 2014/09/23 07:26:50 : yanghf $ */ defined('IN_IA') or exit('Access Denied'); if (!empty($_W['uid'])) { header('Location: ' . url('account/display')); exit; } load()->model('setting'); $settings = setting_load(array('copyright', 'register')); $copyright = $settings['copyright']; if (isset($copyright['showhomepage']) && empty($copyright['showhomepage'])) { header("Location: " . url('user/login')); exit; } template('account/welcome');
function file_image_thumb($srcfile, $desfile = '', $width = 0) { if (!file_exists($srcfile)) { return error('-1', '原图像不存在'); } if (intval($width) == 0) { load()->model('setting'); $uploadsetting = setting_load('upload'); $uploadsetting = $uploadsetting['upload']; $width = intval($uploadsetting['image']['width']); } if (intval($width) < 0) { return error('-1', '缩放宽度无效'); } if (empty($desfile)) { $extention = pathinfo($srcfile, PATHINFO_EXTENSION); $srcdir = dirname($srcfile); do { $desfile = $srcdir . '/' . random(30) . ".{$extention}"; } while (file_exists($desfile)); } $des = dirname($desfile); if (!file_exists($des)) { if (!mkdirs($des)) { return error('-1', '创建目录失败'); } } elseif (!is_writable($des)) { return error('-1', '目录无法写入'); } $org_info = @getimagesize($srcfile); if ($org_info) { if ($width == 0 || $width > $org_info[0]) { copy($srcfile, $desfile); return str_replace(ATTACHMENT_ROOT . '/', '', $desfile); } if ($org_info[2] == 1) { if (function_exists("imagecreatefromgif")) { $img_org = imagecreatefromgif($srcfile); } } elseif ($org_info[2] == 2) { if (function_exists("imagecreatefromjpeg")) { $img_org = imagecreatefromjpeg($srcfile); } } elseif ($org_info[2] == 3) { if (function_exists("imagecreatefrompng")) { $img_org = imagecreatefrompng($srcfile); imagesavealpha($img_org, true); } } } else { return error('-1', '获取原始图像信息失败'); } $scale_org = $org_info[0] / $org_info[1]; $height = $width / $scale_org; if (function_exists("imagecreatetruecolor") && function_exists("imagecopyresampled") && @($img_dst = imagecreatetruecolor($width, $height))) { imagealphablending($img_dst, false); imagesavealpha($img_dst, true); imagecopyresampled($img_dst, $img_org, 0, 0, 0, 0, $width, $height, $org_info[0], $org_info[1]); } else { return error('-1', 'PHP环境不支持图片处理'); } if ($org_info[2] == 2) { if (function_exists('imagejpeg')) { imagejpeg($img_dst, $desfile); } } else { if (function_exists('imagepng')) { imagepng($img_dst, $desfile); } } imagedestroy($img_dst); imagedestroy($img_org); return str_replace(ATTACHMENT_ROOT . '/', '', $desfile); }
if ($dir != '.' && $dir != '..' && strexists($dir, '.ctrl.php')) { $dir = str_replace('.ctrl.php', '', $dir); $actions[] = $dir; } } } if (empty($actions)) { header('location: ?refresh'); } if (!in_array($action, $actions)) { $action = $acl[$controller]['default']; } if (!in_array($action, $actions)) { $action = $actions[0]; } $setting = setting_load('copyright'); $_W['page'] = array(); $_W['page']['copyright'] = $setting['copyright']; unset($setting); if (empty($_W['isfounder']) && !empty($_W['setting']['permurls']) && is_array($_W['setting']['permurls']['menus']) && in_array($_SERVER['QUERY_STRING'], $_W['setting']['permurls']['menus'])) { if (!in_array(rtrim($_SERVER['QUERY_STRING'], '&'), $_W['setting']['permurls']['urls'])) { message('您的账号没有访问此公众号的权限.'); } } if (is_array($acl[$controller]['direct']) && in_array($action, $acl[$controller]['direct'])) { require _forward($controller, $action); exit; } if (is_array($acl[$controller]['founder']) && in_array($action, $acl[$controller]['founder'])) { if (!$_W['isfounder']) { message('不能访问, 需要创始人权限才能访问.');
if ($_W['ispost'] != true) { exit(json_encode(['msg' => '请调用post方法'])); } $_GPC['account'] = trim($_GPC['account']); if (empty($_GPC['account'])) { exit(json_encode(['result' => false, 'msg' => '账号为空'])); } $code = strtolower($_GPC['code']); $hash = md5($code . $_W['config']['setting']['authkey']); if ($_GPC['__code'] != $hash) { exit(json_encode(['result' => false, 'msg' => '你输入的验证码不正确, 请重新输入.'])); } checkQueryLimit(); $reportType = pdo_fetchall("SELECT * FROM " . tablename('report_type'), array(), 'id'); $accountStatus = pdo_fetchall("SELECT * FROM " . tablename('account_status'), array(), 'id'); $setting = setting_load(); load()->model('account'); $account = account($_GPC['account'], true); if ($account) { cly_cash_refresh($account); $status = $account['status_id']; $authTime = empty($account['auth_time']) ? '' : date('Y-m-d', $account['auth_time']); $faker = <<<EOT <tr style="color:red;font-weight:bold;height:40px"> <td colspan="4"> {$_GPC['account']}已被多数用户举报为恶意号码,请用户谨慎合作 </td> </tr> <tr style="color:red;font-weight:bold;height:40px"> <td colspan="2"> 备注:{$account['remark']}
<?php /** * [WeEngine System] Copyright (c) 2014 WE7.CC * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details. */ defined('IN_IA') or exit('Access Denied'); $_W['page']['title'] = '注册选项 - 用户设置 - 用户管理'; load()->model('setting'); if (checksubmit('submit')) { setting_save(array('open' => intval($_GPC['open']), 'verify' => intval($_GPC['verify']), 'code' => intval($_GPC['code']), 'groupid' => intval($_GPC['groupid'])), 'register'); message('更新设置成功!', url('user/registerset')); } $settings = setting_load('register'); $settings = $settings['register']; $groups = pdo_fetchall("SELECT id, name FROM " . tablename('users_group') . " ORDER BY id ASC"); template('user/access');
setting_save($data, 'basic'); message('更新设置成功!', 'refresh'); } $path = IA_ROOT . '/web/themes/'; if (is_dir($path)) { if ($handle = opendir($path)) { while (false !== ($templatepath = readdir($handle))) { if ($templatepath != '.' && $templatepath != '..') { if (is_dir($path . $templatepath)) { $template[] = $templatepath; } } } } } setting_load(); template('extension/web'); } if ($do == 'designer') { if (empty($_W['isfounder'])) { message('您没有设计新模板的权限', '', 'error'); } $_W['page']['title'] = '设计微站风格 - 风格主题 - 扩展'; $available['download'] = class_exists('ZipArchive'); $available['create'] = is_writable(IA_ROOT . '/app/themes'); $versions = array('0.52', '0.6'); $temtypes = ext_template_type(); if (checksubmit('submit') && $available[$_GPC['method']]) { $t['template']['name'] = trim($_GPC['template']['name']); if (empty($t['template']['name']) || preg_match('/\\*\\/|\\/\\*|eval|\\$\\_/i', $t['template']['name'])) { message('请输入有效的模板名称. ');
function cloud_request($url, $post = '', $extra = array(), $timeout = 60) { load()->func('communication'); load()->model('setting'); $setting = setting_load('cloudip'); if (!empty($setting['cloudip'])) { $extra['ip'] = $setting['cloudip']; } return ihttp_request($url, $post, $extra, $timeout); }
$thumbnail = file_image_thumb($fullname, '', $width); @unlink($fullname); if (is_error($thumbnail)) { $result['message'] = $thumbnail['message']; die(json_encode($result)); } else { $filename = pathinfo($thumbnail, PATHINFO_BASENAME); $pathname = $thumbnail; $fullname = ATTACHMENT_ROOT . '/' . $pathname; } } $info = array('name' => $_FILES['file']['name'], 'ext' => $ext, 'filename' => $pathname, 'attachment' => $pathname, 'url' => tomedia($pathname), 'is_image' => 1, 'filesize' => filesize($fullname)); $size = getimagesize($fullname); $info['width'] = $size[0]; $info['height'] = $size[1]; setting_load('remote'); if (!empty($_W['setting']['remote']['type'])) { $remotestatus = file_remote_upload($pathname); if (is_error($remotestatus)) { $result['message'] = '远程附件上传失败,请检查配置并重新上传'; file_delete($pathname); die(json_encode($result)); } else { file_delete($pathname); $info['url'] = tomedia($pathname); } } pdo_insert('core_attachment', array('uniacid' => $uniacid, 'uid' => $_W['uid'], 'filename' => $_FILES['file']['name'], 'attachment' => $pathname, 'type' => $type == 'image' ? 1 : 2, 'createtime' => TIMESTAMP)); die(json_encode($info)); } else { $result['error']['message'] = '请选择要上传的图片!';