public function modify($id, $entity, $gifts = array()) { global $_W; $id = intval($id); $rec = array_elements(array('title', 'type', 'start', 'end', 'rules', 'guide', 'banner', 'share', 'limit', 'tag'), $entity); $rec['uniacid'] = $_W['uniacid']; $condition = '`uniacid`=:uniacid AND `title`=:title AND `actid`!=:id'; $pars = array(); $pars[':uniacid'] = $rec['uniacid']; $pars[':title'] = $rec['title']; $pars[':id'] = $id; $sql = 'SELECT * FROM ' . tablename('wwx_fxxt_red_activities') . " WHERE {$condition}"; $exists = pdo_fetch($sql, $pars); if (!empty($exists)) { return error(-1, '这个活动名称已经使用, 请更换'); } $ret = pdo_update('wwx_fxxt_red_activities', $rec, array('actid' => $id, 'uniacid' => $rec['uniacid'])); if ($ret !== false) { $sql = 'DELETE FROM ' . tablename('wwx_fxxt_red_activity_gifts') . " WHERE `activity`='{$id}'"; pdo_query($sql); foreach ($gifts as $gift) { $r = array_elements(array('gift', 'quantity', 'rate'), $gift); $r['activity'] = $id; pdo_insert('wwx_fxxt_red_activity_gifts', $r); } } return $ret !== false; }
public function fieldsFormValidate($rid = 0) { global $_GPC, $_W; $this->replies = @json_decode(htmlspecialchars_decode($_GPC['replies']), true); if (empty($this->replies)) { return '必须填写有效的回复内容.'; } $column = array('id', 'parent_id', 'title', 'author', 'displayorder', 'thumb', 'description', 'content', 'url', 'incontent', 'createtime'); foreach ($this->replies as $i => &$group) { foreach ($group as $k => &$v) { if (empty($v)) { unset($group[$k]); continue; } if (trim($v['title']) == '') { return '必须填写有效的标题.'; } if (trim($v['thumb']) == '') { return '必须填写有效的封面链接地址.'; } $v['thumb'] = str_replace($_W['attachurl'], '', $v['thumb']); $v['content'] = htmlspecialchars_decode($v['content']); $v['createtime'] = TIMESTAMP; $v = array_elements($column, $v); } if (empty($group)) { unset($i); } } if (empty($this->replies)) { return '必须填写有效的回复内容.'; } return ''; }
function buildframes($types = array('platform'), $modulename = '') { global $_W; $ms = (include IA_ROOT . '/web/common/frames.inc.php'); $ms = array_elements($types, $ms); if (in_array('ext', $types)) { load()->model('module'); $frames = array(); $modules = uni_modules(); if (!empty($modules)) { foreach ($modules as $m) { if (in_array($m['name'], array('basic', 'news', 'music', 'userapi'))) { continue; } $frames[$m['type']][] = $m; } } $types = module_types(); if (!empty($frames)) { foreach ($frames as $type => $fs) { $items = array(); if (!empty($fs)) { foreach ($fs as $m) { $items[] = array('title' => $m['title'], 'url' => url('home/welcome/ext', array('m' => $m['name']))); } } $ms['ext'][] = array('title' => $types[$type]['title'], 'items' => $items); } } } if (in_array('solution', $types)) { load()->model('module'); $module = module_fetch($modulename); $entries = module_entries($modulename, array('menu')); if ($_W['role'] == 'operator') { foreach ($entries as &$entry1) { foreach ($entry1 as $index2 => &$entry2) { $url_arr = parse_url($entry2['url']); $url_query = $url_arr['query']; parse_str($url_query, $query_arr); $eid = intval($query_arr['eid']); $data = pdo_fetch('SELECT * FROM ' . tablename('modules_bindings') . ' WHERE eid = :eid', array(':eid' => $eid)); $ixes = pdo_fetchcolumn('SELECT id FROM ' . tablename('solution_acl') . ' WHERE uid = :uid AND module = :module AND do = :do AND state = :state', array('uid' => $_W['uid'], ':module' => $modulename, ':do' => $data['do'], 'state' => $data['state'])); if (empty($ixes)) { unset($entry1[$index2]); } } } } if ($entries['menu']) { $menus = array('title' => $module['title']); foreach ($entries['menu'] as $menu) { $menus['items'][] = array('title' => $menu['title'], 'url' => $menu['url']); } $ms['solution'][] = $menus; } } return $ms; }
public function create($entity) { global $_W; $rec = array_elements(array('activity', 'uid'), $entity); $rec['uniacid'] = $_W['uniacid']; $rec['item'] = 'key'; $rec['status'] = 'created'; $rec['created'] = TIMESTAMP; $rec['completed'] = 0; $ret = pdo_insert('mbrp_trades', $rec); if (!empty($ret)) { return pdo_insertid(); } else { return error(-1, '数据保存失败, 请稍后重试'); } }
public function modify($id, $entity) { global $_W; $id = intval($id); $rec = array_elements(array('title', 'uuid', 'major', 'minor', 'audit_status', 'audit_comment', 'status'), $entity); $rec['uniacid'] = $_W['uniacid']; $condition = '`uniacid`=:uniacid'; $pars = array(); $pars[':uniacid'] = $rec['uniacid']; $sql = ' SELECT * FROM ' . tablename('mbsk_devices') . " WHERE {$condition}"; pdo_fetch($sql, $pars); $ret = pdo_update('mbsk_devices', $rec, array('uniacid' => $rec['uniacid'], 'id' => $id)); if ($ret !== false) { return true; } }
} else { return error(-1, '数据删除失败, 请稍后重试'); } } public function modify($uid, $entity, $isOpenid = false) { global $_W; $rec = array_elements(array('unionid', 'nickname', 'gender', 'state', 'city', 'country', 'avatar'), $entity); $rec['uniacid'] = $_W['uniacid']; $filter = array(); if ($isOpenid) { $filter['openid'] = $uid; } else { $filter['uid'] = intval($uid); } $ret = pdo_update('mbsk_fans', $rec, $filter); if ($ret !== false) { return true;
public function modify($id, $entity) { global $_W; $id = intval($id); $rec = array_elements(array('title', 'type', 'remark', 'tag'), $entity); $rec['uniacid'] = $_W['uniacid']; $condition = '`uniacid`=:uniacid AND `title`=:title AND `id`!=:id'; $pars = array(); $pars[':uniacid'] = $rec['uniacid']; $pars[':title'] = $rec['title']; $pars[':id'] = $id; $sql = 'SELECT * FROM ' . tablename('mbrp_gifts') . " WHERE {$condition}"; $exists = pdo_fetch($sql, $pars); if (!empty($exists)) { return error(-1, '这个礼品名称已经使用, 请更换'); } $ret = pdo_update('mbrp_gifts', $rec, array('id' => $id)); return $ret !== false; }
/** * 增加一次助力记录 * 如果owner, helper 已经存在, 失败 * id uniacid owner helper dateline * * @param $entity 助力结构 owner, helper, dateline * @return int|error */ public function createHelp($entity) { global $_W; $rec = array_elements(array('owner', 'helper', 'dateline'), $entity); $rec['uniacid'] = $_W['uniacid']; $rec['activity'] = $this->activity['actid']; require_once MB_ROOT . '/source/Fans.class.php'; $f = new Fans(); $ownerExists = $f->getOne($entity['owner']); $helperExists = $f->getOne($entity['helper']); if (!empty($ownerExists) && !empty($helperExists)) { $pars = array(); $pars[':uniacid'] = $_W['uniacid']; $pars[':activity'] = $this->activity['actid']; $pars[':helper'] = $rec['helper']; if (!empty($this->activity['tag']['limit'])) { $sql = 'SELECT COUNT(*) FROM ' . tablename('mbrp_helps') . ' WHERE `uniacid`=:uniacid AND `activity`=:activity AND `helper` =:helper'; $count = pdo_fetchcolumn($sql, $pars); if ($this->activity['tag']['limit'] <= $count) { return error(-1, "超过次数限制, 本次活动限制每人帮助好友次数不能超过 {$this->activity['tag']['limit']} 次"); } } $pars[':owner'] = $rec['owner']; $sql = 'SELECT * FROM ' . tablename('mbrp_helps') . ' WHERE `uniacid`=:uniacid AND `activity`=:activity AND `owner`=:owner AND `helper` =:helper'; $exists = pdo_fetch($sql, $pars); if (!empty($exists)) { return error(-3, '已经帮助过这位好友了'); } $ret = pdo_insert('mbrp_helps', $rec); if (!empty($ret)) { return pdo_insertid(); } else { return error(-2, '数据保存失败, 请稍后重试'); } } else { return error(-1, '用户不存在'); } }
$modulepath = IA_ROOT . '/source/modules/' . $id . '/'; $manifest = ext_module_manifest($module['name']); if (empty($manifest)) { message('模块安装配置文件不存在或是格式不正确!', '', 'error'); } manifest_check($id, $manifest); if (version_compare($module['version'], $manifest['application']['version']) != -1) { message('已安装的模块版本不低于要更新的版本, 操作无效.'); } if (!file_exists($modulepath . 'processor.php') && !file_exists($modulepath . 'module.php') && !file_exists($modulepath . 'receiver.php') && !file_exists($modulepath . 'site.php')) { message('模块缺少处理文件!', '', 'error'); } $module = ext_module_convert($manifest); unset($module['name']); unset($module['id']); $bindings = array_elements(array_keys($points), $module, false); foreach ($points as $p => $row) { unset($module[$p]); if (is_array($bindings[$p]) && !empty($bindings[$p])) { foreach ($bindings[$p] as $entry) { $entry['module'] = $manifest['application']['identifie']; $entry['entry'] = $p; if ($entry['title'] && $entry['do']) { //保存xml里面包含的do和title,最后删除数据库中废弃的do和title $delete_do[] = $entry['do']; $delete_title[] = $entry['title']; $sql = 'SELECT * FROM ' . tablename('modules_bindings') . ' WHERE `module`=:module AND `entry`=:entry AND `title`=:title AND `do`=:do'; $pars = array(); $pars[':module'] = $manifest['application']['identifie']; $pars[':entry'] = $p; $pars[':title'] = $entry['title'];
} $rids = implode($keywords, ','); $sql = 'SELECT `id`, `name` FROM ' . tablename('rule') . " WHERE `id` IN ({$rids})"; $rules = pdo_fetchall($sql); exit(@json_encode($rules)); } exit('success'); } $rid = intval($_GPC['rid']); if (!empty($rid)) { $reply = reply_single($rid); if (empty($reply) || $reply['uniacid'] != $_W['uniacid']) { message('抱歉,您操作的规则不在存或是已经被删除!', url('platform/reply', array('m' => $m)), 'error'); } foreach ($reply['keywords'] as &$kw) { $kw = array_elements(array('type', 'content'), $kw); } } if (checksubmit('submit')) { if (empty($_GPC['name'])) { message('必须填写回复规则名称.'); } $keywords = @json_decode(htmlspecialchars_decode($_GPC['keywords']), true); if (empty($keywords)) { message('必须填写有效的触发关键字.'); } $rule = array('uniacid' => $_W['uniacid'], 'name' => $_GPC['name'], 'module' => $m, 'status' => intval($_GPC['status']), 'displayorder' => intval($_GPC['displayorder_rule'])); if (!empty($_GPC['istop'])) { $rule['displayorder'] = 255; } else { $rule['displayorder'] = range_limit($rule['displayorder'], 0, 254);
if (is_error($ret)) { message($ret['message']); } else { message('成功创建设备', $this->createWebUrl('devices')); } } } include $this->template('device-from'); } if ($foo == 'download') { if ($_W['ispost']) { $api = new Api(); $device = $_GPC['device_id']; $entity = $api->queryDevice($device); if (!is_error($entity)) { $r = array_elements(array('device_id', 'major', 'minor', 'status', 'uuid'), $entity); $r['title'] = $entity['comment']; $c = new Device(); $ret = $c->create($r); if (is_error($ret)) { message($ret['message']); } else { message('成功同步设备', $this->createWebUrl('devices')); } } else { exit('设备无效或未激活'); } } include $this->template('device-download'); } if ($foo == 'modify') {
foreach ($types as $k => $v) { $mset[$k] = array('title' => $v, 'menus' => array()); } $ms = array(); if (!empty($_W['account']['modules'])) { $bindings = pdo_fetchall('SELECT * FROM ' . tablename('modules_bindings') . " ORDER BY eid ASC"); foreach ($_W['account']['modules'] as $m) { $row = array('name' => strtolower($m['name'])); $mg = $_W['modules'][$row['name']]; if (in_array($row['name'], array('basic', 'news', 'music', 'userapi'))) { continue; } if (!empty($bindings)) { foreach ($bindings as $entry) { if (strtolower($entry['module']) == $row['name']) { $m[$entry['entry']][] = array_elements(array('eid', 'call', 'title', 'do', 'direct', 'state'), $entry); } } } $row['title'] = $mg['title']; $row['type'] = $mg['type']; $row['type'] = in_array($row['type'], array_keys($types)) ? $row['type'] : 'other'; if (!empty($m['cover']) && is_array($m['cover'])) { foreach ($m['cover'] as $opt) { if (!empty($opt['call'])) { $site = WeUtility::createModuleSite($row['name']); if (method_exists($site, $opt['call'])) { $ret = $site->{$opt}['call'](); if (is_array($ret)) { foreach ($ret as $et) { $row['items'][] = array($et['title'], $et['url']);
public function settingsDisplay($settings) { global $_GPC, $_W; load()->func('tpl'); $theone = pdo_fetch('SELECT * FROM ' . tablename('wwx_fxxt_rules') . " WHERE uniacid = :uniacid", array(':uniacid' => $_W['uniacid'])); $id = $theone['id']; if (checksubmit()) { load()->func('file'); mkdirs('../addons/wwx_fxxt/cert'); $r = true; if (!empty($_GPC['api_cert'])) { $ret = file_put_contents('../addons/wwx_fxxt/cert/apiclient_cert.pem.' . $_W['uniacid'], trim($_GPC['api_cert'])); $r = $r && $ret; } if (!empty($_GPC['api_key'])) { $ret = file_put_contents('../addons/wwx_fxxt/cert/apiclient_key.pem.' . $_W['uniacid'], trim($_GPC['api_key'])); $r = $r && $ret; } if (!empty($_GPC['api_ca'])) { $ret = file_put_contents('../addons/wwx_fxxt/cert/rootca.pem.' . $_W['uniacid'], trim($_GPC['api_ca'])); $r = $r && $ret; } if (!$r) { message('证书保存失败, 请保证 /addons/wwx_fxxt/cert/ 目录可写'); } $input = array_elements(array('api_appid', 'api_secret', 'api_QrCode', 'api_QrKey', 'api_ip'), $_GPC); $input['api_appid'] = trim($input['api_appid']); $input['api_secret'] = trim($input['api_secret']); $input['api_QrCode'] = trim($input['api_QrCode']); $input['api_QrKey'] = trim($input['api_QrKey']); $input['api_ip'] = trim($input['api_ip']); $clickcredit = $_GPC['clickcredit']; if (!is_numeric($clickcredit)) { message('请输入合法数字!'); } if (empty($_GPC['commtime'])) { message('需要设置佣金申请周期'); } if (empty($_GPC['rebacktime'])) { message('需要设置退换货期限'); } if (intval($_GPC['rebacktime']) >= intval($_GPC['commtime'])) { message('退换货期限不能大于货到等于佣金申请周期'); } $settings['shopname'] = $_GPC['shopname']; //商城首页标题 $settings['footer'] = $_GPC['footer']; //底部版权名称 $settings['footerurl'] = $_GPC['footerurl']; //底部版权链接 $settings['agentRegister'] = $_GPC['agentRegister']; //用户注册登录 $settings['Thecharts'] = $_POST['Thecharts']; //开启各项排行榜 $settings['Themessage'] = $_GPC['Themessage']; //开启排行榜聊天系统 $settings['ThechartsSum'] = $_GPC['ThechartsSum']; //排行榜数量 $settings['indexss'] = intval($_GPC['indexss']); //首页限时特卖 $settings['webjs'] = $_GPC['webjs']; //全局JS参数设置 $settings['commtime'] = $_GPC['commtime']; //佣金申请周期 $settings['zhifuCommission'] = $_GPC['zhifuCommission']; //佣金打款限额 $settings['globalPattern'] = $_GPC['globalPattern']; //分佣方式 $settings['globalCommissionLevel'] = $_GPC['globalCommissionLevel']; //分销等级 $settings['globalCommission'] = $_GPC['globalCommission']; //1级整站佣金 $settings['globalCommission2'] = $_GPC['globalCommission2']; //2级整站佣金 $settings['globalCommission3'] = $_GPC['globalCommission3']; //3级整站佣金 $settings['agentupgrade'] = $_GPC['agentupgrade']; //代理自动升级 $settings['dimensionalcode'] = $_GPC['dimensionalcode']; //二维码权限 $settings['fansupgrade'] = $_GPC['fansupgrade']; //会员自动升级 $settings['description'] = $_GPC['description']; //转发话术 $settings['ydyy'] = $_GPC['ydyy']; //未关注引导页面 $settings['huodaoCommission'] = $_GPC['huodaoCommission']; //货到付款保证金 $settings['autofinish'] = $_GPC['autofinish']; //订单自动确认收货天数 $settings['rebacktime'] = $_GPC['rebacktime']; //退换货期限天数 $settings['ordertime'] = $_GPC['ordertime']; //自动取消订单时间,单位分钟 $settings['api'] = $input; //微信现金打款设置 //自动取消订单时间,单位分钟 if (intval($_GPC['ordertime']) >= 30) { $settings['ordertime'] = $_GPC['ordertime']; } else { $settings['ordertime'] = 0; } //排行榜数量 if (empty($_GPC['ThechartsSum']) || $_GPC['ThechartsSum'] > 500) { $settings['ThechartsSum'] = 10; } //转发图片 if (!empty($_GPC['logo'])) { $settings['logo'] = $_GPC['logo']; } $this->saveSettings($settings); //保存设置参数 $clickcredit = $_GPC['clickcredit']; if (!is_numeric($clickcredit)) { message('点击或扫描积分请输入合法数字!'); } if ($_GPC['promotertimes'] == '2') { if (!is_numeric($_GPC['promotercount'])) { message('达到单数请输入合法数字!'); } } if ($_GPC['promotertimes'] == '3') { if (!is_numeric($_GPC['promotermoney'])) { message('达到金额请输入合法数字!'); } } $insert = array('uniacid' => $_W['uniacid'], 'clickcredit' => $clickcredit, 'rule' => htmlspecialchars_decode($_GPC['rule']), 'commtime' => 0, 'promotertimes' => $_GPC['promotertimes'], 'promotermoney' => $_GPC['promotermoney'], 'promotercount' => $_GPC['promotercount'], 'promoterstate' => $_GPC['promoterstate'], 'createtime' => TIMESTAMP); if (empty($id)) { pdo_insert('wwx_fxxt_rules', $insert); } else { pdo_update('wwx_fxxt_rules', $insert, array('id' => $id)); } message('更新成功', 'refresh'); } if (empty($settings['footer'])) { $settings['footer'] = $_W['account']['name']; //底部版权名称 } if (empty($settings['api']['api_ip'])) { $settings['api']['api_ip'] = $_SERVER['SERVER_ADDR']; } include $this->template('setting'); }
function uni_setting($uniacid = 0, $fields = '*') { global $_W; $uniacid = empty($uniacid) ? $_W['uniacid'] : $uniacid; static $unisettings; if (empty($unisettings)) { $unisettings = array(); } if (empty($unisettings[$uniacid])) { $unisetting = pdo_fetch("SELECT * FROM " . tablename('uni_settings') . " WHERE uniacid = :uniacid", array(':uniacid' => $uniacid)); if (!empty($unisetting)) { $serialize = array('site_info', 'menuset', 'stat', 'oauth', 'passport', 'uc', 'notify', 'creditnames', 'default_message', 'creditbehaviors', 'shortcuts', 'quickmenu', 'payment', 'groupdata'); foreach ($unisetting as $key => &$row) { if (in_array($key, $serialize)) { $row = iunserializer($row); } } } $unisettings[$uniacid] = $unisetting; } if (is_array($fields)) { return array_elements($fields, $unisettings[$uniacid]); } return $unisettings[$uniacid]; }
<?php /** * [WEIZAN System] Copyright (c) 2015 012WZ.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'); uni_user_permission_check('platform_menu'); $current['designer'] = ' class="current"'; $acc = account_fetch($_W['acid']); $acc = array_elements(array('name', 'acid', 'level'), $acc); $dos = array('display', 'save', 'remove', 'refresh', 'search_key'); if ($_W['isajax']) { if ($do == 'search_key') { $condition = ''; $key_word = trim($_GPC['key_word']); if (!empty($key_word)) { $condition = " AND content LIKE '%{$key_word}%' "; } $data = pdo_fetchall('SELECT content FROM ' . tablename('rule_keyword') . " WHERE (uniacid = 0 OR uniacid = :uniacid) AND status != 0 " . $condition . ' ORDER BY uniacid DESC,displayorder DESC LIMIT 15', array(':uniacid' => $_W['uniacid'])); $exit_da = array(); if (!empty($data)) { foreach ($data as $da) { $exit_da[] = $da['content']; } } exit(json_encode($exit_da)); } $post = $_GPC['__input']; if (!empty($post['method'])) { $do = $post['method'];
function tpl_form_field_wechat_video($name, $value = '', $options = array()) { global $_W; $account = uni_accounts(); $data = array(); if (!empty($account)) { foreach ($account as $li) { if ($li['level'] < 3) { continue; } $data['item'][] = $li; } $data['total'] = count($data['item']); unset($account); } if (empty($options['acid']) && $data['total'] == 1) { $options['acid'] = $data['item'][0]['acid']; } if (empty($data['total'])) { $options['error'] = 1; } if (!empty($value)) { $media_data = (array) media2local($value, true); $val = $media_data['attachment']; } if (!is_array($options)) { $options = array(); } if (empty($options['tabs'])) { $options['tabs'] = array('video' => 'active', 'browser' => ''); } $options = array_elements(array('tabs', 'global', 'dest_dir', 'acid', 'error'), $options); $options['direct'] = true; $options['multi'] = false; $options['type'] = 'video'; $s = ''; if (!defined('TPL_INIT_WECHAT_VIDEO')) { $s = ' <script type="text/javascript"> function showWechatVideoDialog(elm, options) { require(["util"], function(util){ var btn = $(elm); var ipt = btn.parent().prev(); var val = ipt.val(); util.wechat_audio(val, function(url){ if(url && url.media_id && url.url){ btn.prev().show(); ipt.val(url.media_id); ipt.attr("media_id",url.media_id); ipt.attr("url",url.url); } if(url && url.media_id){ ipt.val(url.media_id); } }, ' . json_encode($options) . '); }); } </script>'; echo $s; define('TPL_INIT_WECHAT_VIDEO', true); } $s .= ' <div class="input-group"> <input type="text" value="' . $value . '" name="' . $name . '" class="form-control" autocomplete="off" ' . ($options['extras']['text'] ? $options['extras']['text'] : '') . '> <span class="input-group-btn"> <button class="btn btn-default" type="button" onclick="showWechatVideoDialog(this,' . str_replace('"', '\'', json_encode($options)) . ');">选择媒体文件</button> </span> </div> <div class="input-group audio-player"> </div>'; if (!empty($media_data) && $media_data['model'] == 'temp' && time() - $media_data['createtime'] > 259200) { $s .= '<span class="help-block"><b class="text-danger">该素材已过期 [有效期为3天],请及时更新素材</b></span>'; } return $s; }
Q0pNyTsu1oyQPJoCaV3qPfpcvatMKYsVxo2Zeogqw2x2L6KE8BODrj6m6Ue1aUMn 9Ch1XbR/dB8M2M+nVtOAVb6DA6kVuNFlMl2uzxD8MQlhos8aT+vCx1v9p21k3+jz AgMBAAGjDzANMAsGA1UdDwQEAwIGwDANBgkqhkiG9w0BAQUFAAOCAQEAhgW/gcDa fqs0oWDH81XnTVvDCp5mwDo+wxgzVRTEtudU6seKcc2kiBe1RqegtUX2le/eAzcD mo7nxHMy73ANdP/wha+P2gp+mo3buhO244pQphMV+Yu8djHTFH8+hRkCbnsrndYc qNiJ/yhsUpaJ4nY+oEoyut0id6QddKiNPYoTFz0fy/VqNP6g+23zFy6sIg+gffVZ 6o3CsZVu9z5umUjzfV384iSWovq+/IdSZ4g/jerdPtje/CKYTmzG5nsCa/s+i7Rf D5scSlfi7iW2Q7Sc/HlrtOAglt7IyjRSsFPPxuBXmSITc2GDKyKI46u8RXpccAUh YspJ5MXOYLZN7A== -----END CERTIFICATE-----'; file_put_contents(IA_ROOT . '/attachment/unionpay/UpopRsaCert.cer', trim($public_rsa)); } $dat = iserializer($pay); if (pdo_update('uni_settings', array('payment' => $dat), array('uniacid' => $_W['uniacid'])) !== false) { message('保存支付信息成功. ', 'refresh'); } else { message('保存支付信息失败, 请稍后重试. '); } exit; } $pay['unionpay']['signcertexists'] = file_exists(IA_ROOT . '/attachment/unionpay/PM_' . $_W['uniacid'] . '_acp.pfx'); $accs = uni_accounts(); $accounts = array(); if (!empty($accs)) { foreach ($accs as $acc) { if ($acc['type'] == '1' && $acc['level'] >= '3') { $accounts[$acc['acid']] = array_elements(array('name', 'acid', 'key', 'secret'), $acc); } } } template('profile/payment');
message('请输入完整的支付宝接口信息.'); } if ($_GPC['alipay']['t'] == 'true') { $params = array(); $params['tid'] = md5(uniqid()); $params['user'] = '******'; $params['fee'] = '0.01'; $params['title'] = '测试支付接口'; require model('payment'); $ret = alipay_build($params, $alipay); if ($ret['url']) { header("location: {$ret['url']}"); } exit; } $wechat = array_elements(array('switch', 'appid', 'secret', 'signkey', 'partner', 'key', 'version', 'mchid'), $_GPC['wechat']); $wechat['switch'] = $wechat['switch'] == 'true'; $wechat['signkey'] = trim($wechat['signkey']); $wechat['partner'] = trim($wechat['partner']); $wechat['key'] = trim($wechat['key']); if ($wechat['switch'] && (empty($wechat['appid']) || empty($wechat['secret']))) { message('请输入完整的微信支付接口信息.'); } $payment = $_W['account']['payment']; if (!is_array($payment)) { $payment = array(); } $payment['credit'] = $credit; $payment['alipay'] = $alipay; $payment['wechat'] = $wechat; $payment['offline'] = $offline;
exit; } if ($do == 'message') { $_W['page']['title'] = '特殊消息类型处理 - 特殊回复 - 高级功能'; $mtypes = array(); $mtypes['image'] = '图片消息'; $mtypes['voice'] = '语音消息'; $mtypes['video'] = '视频消息'; $mtypes['shortvideo'] = '小视频消息'; $mtypes['location'] = '位置消息'; $mtypes['trace'] = '上报地理位置'; $mtypes['link'] = '链接消息'; $mtypes['enter'] = '进入聊天窗口'; $mtypes['merchant_order'] = '微小店消息'; if (checksubmit()) { $s = array_elements(array_keys($mtypes), $_GPC); $ms = array(); foreach ($_W['account']['modules'] as $m) { $ms[] = $m['name']; } foreach ($s as $k => $v) { if ($v != '' && !in_array($v, $ms)) { message($mtypes[$k] . "选择的处理模块无效. "); } } $row = array(); $row['default_message'] = iserializer($s); if (pdo_update('uni_settings', $row, array('uniacid' => $_W['uniacid'])) !== FALSE) { message('保存特殊类型消息处理成功.', 'refresh'); } else { message('保存失败, 请稍后重试. ');
function uni_setting($uniacid = 0, $fields = '*', $force_update = false) { global $_W; $uniacid = empty($uniacid) ? $_W['uniacid'] : $uniacid; $cachekey = "unisetting:{$uniacid}"; $unisetting = array(); if (!$force_update) { $unisetting = cache_load($cachekey); } if (empty($unisetting)) { $unisetting = pdo_fetch("SELECT * FROM " . tablename('uni_settings') . " WHERE uniacid = :uniacid", array(':uniacid' => $uniacid)); if (!empty($unisetting)) { $serialize = array('site_info', 'menuset', 'stat', 'oauth', 'passport', 'uc', 'notify', 'creditnames', 'default_message', 'creditbehaviors', 'shortcuts', 'payment', 'recharge', 'tplnotice'); foreach ($unisetting as $key => &$row) { if (in_array($key, $serialize)) { $row = iunserializer($row); } } } cache_write($cachekey, $unisetting); } if (is_array($fields)) { return array_elements($fields, $unisetting); } return $unisetting; }
public function doWebRedGifts() { global $_W, $_GPC; if (!$_W['ispost']) { $this->doWebAuth(); checklogin(); } $modulePublic = '../addons/wwx_fxxt/style/static/'; $foo = $_GPC['foo']; $foos = array('list', 'create', 'modify', 'delete', 'search'); $foo = in_array($foo, $foos) ? $foo : 'list'; require_once WWX_FXXT_ROOT . '/class/Gift.class.php'; if ($foo == 'search') { $fuzzy = $_GPC['fuzzy']; $filters = array(); $filters['title'] = $fuzzy; $g = new Gift(); $ds = $g->getAll($filters, 1, 20); /**GIFT:2.查询所有活动礼品分类**/ $rs = array(); if (!empty($ds)) { foreach ($ds as $row) { $rs[] = array_elements(array('id', 'type', 'title'), $row); } } exit(json_encode($rs)); } if ($foo == 'create') { if ($_W['ispost']) { $input = array_elements(array('title', 'type', 'remark'), $_GPC); $input['remark'] = htmlspecialchars_decode($input['remark']); if ($input['type'] == 'cash') { $input['tag'] = serialize($_GPC['cash']); } else { $input['tag'] = ''; } $g = new Gift(); $ret = $g->create($input); /**GIFT:3.编辑活动礼品分类**/ if (is_error($ret)) { message($ret['message']); } else { message('成功保存礼品信息', $this->createWebUrl('redgifts')); } } $entity = array(); $entity['type'] = 'cash'; $entity['tag'] = array(); load()->func('tpl'); include $this->template('redgifts_form'); } if ($foo == 'modify') { $id = $_GPC['id']; $g = new Gift(); $entity = $g->getOne($id); /**GIFT:1.根据ID查询活动礼品分类**/ if (empty($entity)) { message('访问错误'); } if ($_W['ispost']) { $input = array_elements(array('title', 'type', 'remark'), $_GPC); $input['remark'] = htmlspecialchars_decode($input['remark']); if ($input['type'] == 'cash') { $input['tag'] = serialize($_GPC['cash']); } else { $input['tag'] = ''; } $g = new Gift(); $ret = $g->modify($id, $input); /**GIFT:4.根据ID编辑活动礼品分类**/ if (is_error($ret)) { message($ret['message']); } else { message('成功保存礼品信息', $this->createWebUrl('redgifts')); } } load()->func('tpl'); include $this->template('redgifts_form'); } if ($foo == 'delete') { $id = $_GPC['id']; $g = new Gift(); $g->remove($id); /**GIFT:5.根据ID删除活动礼品分类**/ message('成功删除礼品信息', $this->createWebUrl('redgifts')); } if ($foo == 'list') { $a = new Gift(); $ds = $a->getAll(array()); /**GIFT:2.查询所有活动礼品分类**/ include $this->template('redgifts_list'); } }
function mc_require($uid, $fields, $pre = '') { global $_W, $_GPC; if (empty($fields) || !is_array($fields)) { return false; } $flipfields = array_flip($fields); if (in_array('birth', $fields) || in_array('birthyear', $fields) || in_array('birthmonth', $fields) || in_array('birthday', $fields)) { unset($flipfields['birthyear'], $flipfields['birthmonth'], $flipfields['birthday'], $flipfields['birth']); $flipfields['birthyear'] = 'birthyear'; $flipfields['birthmonth'] = 'birthmonth'; $flipfields['birthday'] = 'birthday'; } if (in_array('reside', $fields) || in_array('resideprovince', $fields) || in_array('residecity', $fields) || in_array('residedist', $fields)) { unset($flipfields['residedist'], $flipfields['resideprovince'], $flipfields['residecity'], $flipfields['reside']); $flipfields['resideprovince'] = 'resideprovince'; $flipfields['residecity'] = 'residecity'; $flipfields['residedist'] = 'residedist'; } $fields = array_keys($flipfields); if (!in_array('uniacid', $fields)) { $fields[] = 'uniacid'; } if (!empty($pre)) { $pre .= '<br/>'; } $profile = mc_fetch($uid, $fields); $uniacid = $profile['uniacid']; $titles = mc_fields(); $message = ''; $ks = array(); foreach ($profile as $k => $v) { if (empty($v)) { $ks[] = $k; $message .= $titles[$k] . ', '; } } if (!empty($message)) { $title = '完善资料'; if (checksubmit('submit')) { if (in_array('resideprovince', $fields)) { $_GPC['resideprovince'] = $_GPC['reside']['province']; $_GPC['residecity'] = $_GPC['reside']['city']; $_GPC['residedist'] = $_GPC['reside']['district']; } if (in_array('birthyear', $fields)) { $_GPC['birthyear'] = $_GPC['birth']['year']; $_GPC['birthmonth'] = $_GPC['birth']['month']; $_GPC['birthday'] = $_GPC['birth']['day']; } $record = array_elements($fields, $_GPC); if (isset($record['uniacid'])) { unset($record['uniacid']); } foreach ($record as $field => $value) { if ($field == 'gender') { continue; } if (empty($value)) { message('请填写完整所有资料.', referer(), 'error'); } } $condition = " AND uid != {$uid} "; if (in_array('email', $fields)) { $emailexists = pdo_fetchcolumn("SELECT email FROM " . tablename('mc_members') . " WHERE uniacid = :uniacid AND email = :email " . $condition, array(':uniacid' => $_W['uniacid'], ':email' => trim($record['email']))); if (!empty($emailexists)) { message('抱歉,您填写的手机号已经被使用,请更新。', 'refresh', 'error'); } } if (in_array('mobile', $fields)) { $mobilexists = pdo_fetchcolumn("SELECT mobile FROM " . tablename('mc_members') . " WHERE uniacid = :uniacid AND mobile = :mobile " . $condition, array(':uniacid' => $_W['uniacid'], ':mobile' => trim($record['mobile']))); if (!empty($mobilexists)) { message('抱歉,您填写的手机号已经被使用,请更新。', 'refresh', 'error'); } } mc_update($uid, $record); message('资料完善成功.', 'refresh'); } load()->func('tpl'); load()->model('activity'); $filter = array(); $filter['status'] = 1; $coupons = activity_coupon_owned($_W['member']['uid'], $filter); $tokens = activity_token_owned($_W['member']['uid'], $filter); $setting = uni_setting($_W['uniacid'], array('creditnames', 'creditbehaviors', 'uc')); $behavior = $setting['creditbehaviors']; $creditnames = $setting['creditnames']; $credits = mc_credit_fetch($_W['member']['uid'], '*'); include template('mc/require', TEMPLATE_INCLUDEPATH); exit; } return $profile; }
/** * 从erp中的客户数据导入到系统数据表 * 标记来源及状态 * @param $data * @return array */ function import_Customer($data) { //erp原始数据导入,并转化成本地数据返回 $keys = pdo_fetchallfields(tablename('p_customer')); unset($keys['status']); unset($keys['erp']); // $keys = array('CstGUID', 'CstName', 'CardType', 'CardID', 'Gender', 'MobileTel', 'HomeTel', 'OfficeTel', // 'Address', 'PostCode', 'CstType','KhFl', 'HKCountry', 'HKProvince', 'HKRegional', 'CreatedOn', 'CreatedBy'); $info = array_elements($keys, $data); $info['status'] = '0'; $info['erp'] = '1'; $state = pdo_insert('p_customer', $info); return $info; }
function tpl_form_field_audio($name, $value = '', $options = array()) { $s = ''; if (!defined('TPL_INIT_AUDIO')) { $s = ' <script type="text/javascript"> function showAudioDialog(elm, base64options, options) { require(["util"], function(util){ var btn = $(elm); var ipt = btn.parent().prev(); var val = ipt.val(); util.audio(val, function(url){ if(url && url.filename && url.url){ btn.prev().show(); ipt.val(url.filename); ipt.attr("filename",url.filename); ipt.attr("url",url.url); setAudioPlayer(); } if(url && url.media_id){ ipt.val(url.media_id); } }, base64options , options); }); } function setAudioPlayer(){ require(["jquery", "util", "jquery.jplayer"], function($, u){ $(function(){ $(".audio-player").each(function(){ $(this).prev().find("button").eq(0).click(function(){ var src = $(this).parent().prev().val(); if($(this).find("i").hasClass("fa-stop")) { $(this).parent().parent().next().jPlayer("stop"); } else { if(src) { $(this).parent().parent().next().jPlayer("setMedia", {mp3: u.tomedia(src)}).jPlayer("play"); } } }); }); $(".audio-player").jPlayer({ playing: function() { $(this).prev().find("i").removeClass("fa-play").addClass("fa-stop"); }, pause: function (event) { $(this).prev().find("i").removeClass("fa-stop").addClass("fa-play"); }, swfPath: "resource/components/jplayer", supplied: "mp3" }); $(".audio-player-media").each(function(){ $(this).next().find(".audio-player-play").css("display", $(this).val() == "" ? "none" : ""); }); }); }); } setAudioPlayer(); </script>'; define('TPL_INIT_AUDIO', true); } $val = $default; if (!empty($value)) { $val = tomedia($value); } if (empty($options)) { $options['tabs'] = array('browser' => 'active', 'upload' => ''); } $options = array_elements(array('extras', 'tabs'), $options); $s .= ' <div class="input-group"> <input type="text" value="' . $value . '" name="' . $name . '" class="form-control audio-player-media" autocomplete="off" ' . ($options['extras']['text'] ? $options['extras']['text'] : '') . '> <span class="input-group-btn"> <button class="btn btn-default audio-player-play" type="button" style="display:none;"><i class="fa fa-play"></i></button> <button class="btn btn-default" type="button" onclick="showAudioDialog(this, \'' . base64_encode(iserializer($options)) . '\',' . str_replace('"', '\'', json_encode($options)) . ');">选择媒体文件</button> </span> </div> <div class="input-group audio-player"> </div>'; return $s; }
message('您已经购买过此升级版本,系统将直接跳转至升级界面。', url('cloud/process', array('m' => $auth['name'], 'is_upgrade' => 1, 'is_buy' => 1)), 'success'); break; case '1': message('购买模块升级版本成功,系统将直接跳转至升级界面。', url('cloud/process', array('m' => $auth['name'], 'is_upgrade' => 1, 'is_buy' => 1)), 'success'); exit; break; } message($response['message']['message']); } if ($do == 'callback') { $secret = $_GPC['token']; if (strlen($secret) == 32) { $cache = cache_read('cloud:auth:transfer'); cache_delete('cloud:auth:transfer'); if (!empty($cache) && $cache['secret'] == $secret) { $site = array_elements(array('key', 'token'), $cache); setting_save($site, 'site'); $auth['key'] = $site['key']; $auth['password'] = md5($site['key'] . $site['token']); $auth['forward'] = 'profile'; header('location: ' . __to($auth)); exit; } } message('访问错误.'); } template('cloud/frame'); function __to($auth) { global $authurl; $query = base64_encode(json_encode($auth));
} $entity = array(); $entity['type'] = 'cash'; $entity['tag'] = array(); load()->func('tpl'); include $this->template('gifts-form'); } if ($foo == 'modify') { $id = $_GPC['id']; $g = new Gift(); $entity = $g->getOne($id); if (empty($entity)) { message('访问错误'); } if ($_W['ispost']) { $input = array_elements(array('title', 'type', 'remark'), $_GPC); $input['remark'] = htmlspecialchars_decode($input['remark']); if ($input['type'] == 'cash') { $input['tag'] = serialize($_GPC['cash']); } else { $input['tag'] = ''; } $g = new Gift(); $ret = $g->modify($id, $input); if (is_error($ret)) { message($ret['message']); } else { message('成功保存礼品信息', $this->createWebUrl('gifts')); } } load()->func('tpl');
function mc_require($uid, $fields, $pre = '') { global $_W, $_GPC; if (empty($fields) || !is_array($fields)) { return false; } $flipfields = array_flip($fields); if (in_array('birth', $fields) || in_array('birthyear', $fields) || in_array('birthmonth', $fields) || in_array('birthday', $fields)) { unset($flipfields['birthyear'], $flipfields['birthmonth'], $flipfields['birthday'], $flipfields['birth']); $flipfields['birthyear'] = 'birthyear'; $flipfields['birthmonth'] = 'birthmonth'; $flipfields['birthday'] = 'birthday'; } if (in_array('reside', $fields) || in_array('resideprovince', $fields) || in_array('residecity', $fields) || in_array('residedist', $fields)) { unset($flipfields['residedist'], $flipfields['resideprovince'], $flipfields['residecity'], $flipfields['reside']); $flipfields['resideprovince'] = 'resideprovince'; $flipfields['residecity'] = 'residecity'; $flipfields['residedist'] = 'residedist'; } $fields = array_keys($flipfields); if (!in_array('uniacid', $fields)) { $fields[] = 'uniacid'; } if (!empty($pre)) { $pre .= '<br/>'; } if (empty($uid)) { foreach ($fields as $field) { $profile[$field] = ''; } $uniacid = $_W['uniacid']; } else { $profile = mc_fetch($uid, $fields); $uniacid = $profile['uniacid']; } $sql = 'SELECT `f`.`field`, `f`.`id` AS `fid`, `mf`.* FROM ' . tablename('profile_fields') . " AS `f` LEFT JOIN " . tablename('mc_member_fields') . " AS `mf` ON `f`.`id` = `mf`.`fieldid` WHERE `uniacid` = :uniacid ORDER BY\r\n\t\t\t`displayorder` DESC"; $system_fields = pdo_fetchall($sql, array(':uniacid' => $_W['uniacid']), 'field'); if (empty($system_fields)) { $sql = 'SELECT `id`, `field`, `title` FROM ' . tablename('profile_fields'); $system_fields = pdo_fetchall($sql, array(), 'field'); } $titles = array(); foreach ($system_fields as $field) { $titles[$field['field']] = $field['title']; } $message = ''; $ks = array(); foreach ($profile as $k => $v) { if (empty($v)) { $ks[] = $k; $message .= $system_fields[$k]['title'] . ', '; } } if (!empty($message)) { $title = '完善资料'; if (checksubmit('submit')) { if (in_array('resideprovince', $fields)) { $_GPC['resideprovince'] = $_GPC['reside']['province']; $_GPC['residecity'] = $_GPC['reside']['city']; $_GPC['residedist'] = $_GPC['reside']['district']; } if (in_array('birthyear', $fields)) { $_GPC['birthyear'] = $_GPC['birth']['year']; $_GPC['birthmonth'] = $_GPC['birth']['month']; $_GPC['birthday'] = $_GPC['birth']['day']; } $record = array_elements($fields, $_GPC); if (isset($record['uniacid'])) { unset($record['uniacid']); } foreach ($record as $field => $value) { if ($field == 'gender') { continue; } if (empty($value)) { message('请填写完整所有资料.', referer(), 'error'); } } if (empty($record['nickname']) && !empty($_W['fans']['nickname'])) { $record['nickname'] = $_W['fans']['nickname']; } if (empty($record['avatar']) && !empty($_W['fans']['tag']['avatar'])) { $record['avatar'] = $_W['fans']['tag']['avatar']; } $condition = " AND uid != {$uid} "; if (in_array('email', $fields)) { $emailexists = pdo_fetchcolumn("SELECT email FROM " . tablename('mc_members') . " WHERE uniacid = :uniacid AND email = :email " . $condition, array(':uniacid' => $_W['uniacid'], ':email' => trim($record['email']))); if (!empty($emailexists)) { message('抱歉,您填写的手机号已经被使用,请更新。', 'refresh', 'error'); } } if (in_array('mobile', $fields)) { $mobilexists = pdo_fetchcolumn("SELECT mobile FROM " . tablename('mc_members') . " WHERE uniacid = :uniacid AND mobile = :mobile " . $condition, array(':uniacid' => $_W['uniacid'], ':mobile' => trim($record['mobile']))); if (!empty($mobilexists)) { message('抱歉,您填写的手机号已经被使用,请更新。', 'refresh', 'error'); } } $insertuid = mc_update($uid, $record); if (empty($uid)) { pdo_update('mc_oauth_fans', array('uid' => $insertuid), array('oauth_openid' => $_W['openid'])); pdo_update('mc_mapping_fans', array('uid' => $insertuid), array('openid' => $_W['openid'])); } message('资料完善成功.', 'refresh'); } load()->func('tpl'); load()->model('activity'); $filter = array(); $filter['status'] = 1; $coupons = activity_coupon_owned($_W['member']['uid'], $filter); $tokens = activity_token_owned($_W['member']['uid'], $filter); $setting = uni_setting($_W['uniacid'], array('creditnames', 'creditbehaviors', 'uc')); $behavior = $setting['creditbehaviors']; $creditnames = $setting['creditnames']; $credits = mc_credit_fetch($_W['member']['uid'], '*'); include template('mc/require', TEMPLATE_INCLUDEPATH); exit; } return $profile; }
<?php /** * [Weizan System] Copyright (c) 2014 012WZ.COM * Weizan is NOT a free software, it under the license terms, visited http://www.qdaygroup.com/ for more details. */ defined('IN_IA') or exit('Access Denied'); $dos = array('post', 'display', 'qr', 'chat'); $do = !empty($_GPC['do']) && in_array($do, $dos) ? $do : 'display'; $accs = uni_accounts(); $accounts = array(); if (!empty($accs)) { foreach ($accs as $acc) { if ($acc['level'] > 2) { $accounts[$acc['acid']] = array_elements(array('name', 'acid'), $acc); } } } if ($do == 'display') { if (empty($_GPC['acid']) && count($accounts) == 1) { $account = current($accounts); if ($account !== false) { $acid = intval($account['acid']); } } else { $acid = intval($_GPC['acid']); if (!empty($acid) && !empty($accounts[$acid])) { $account = $accounts[$acid]; } } if ($acid > 0) {
if ($script['release'] <= $crelease) { continue; } $fname = "update({$crelease}-{$script['release']}).php"; $crelease = $script['release']; $script['script'] = @base64_decode($script['script']); if (empty($script['script'])) { $script['script'] = <<<DAT <?php load()->model('setting'); setting_upgrade_version('{$packet['family']}', '{$script['version']}', '{$script['release']}'); return true; DAT; } $updatefile = $updatedir . $fname; file_put_contents($updatefile, $script['script']); $updatefiles[] = $updatefile; $s = array_elements(array('message', 'release', 'version'), $script); $s['fname'] = $fname; $scripts[] = $s; } } } } else { if (is_error($packet)) { message($packet['message'], '', 'error'); } else { message('更新已完成. ', url('cloud/upgrade'), 'info'); } } template('cloud/process');
if (!empty($_GPC['cert'])) { $ret = file_put_contents(ROOT_PATH . '/cert/apiclient_cert.pem.' . $_W['uniacid'], trim($_GPC['cert'])); $r = $r && $ret; } if (!empty($_GPC['key'])) { $ret = file_put_contents(ROOT_PATH . '/cert/apiclient_key.pem.' . $_W['uniacid'], trim($_GPC['key'])); $r = $r && $ret; } if (!empty($_GPC['ca'])) { $ret = file_put_contents(ROOT_PATH . '/cert/rootca.pem.' . $_W['uniacid'], trim($_GPC['ca'])); $r = $r && $ret; } if (!$r) { message('证书保存失败, 请保证 /addons/microb_redpack/cert/ 目录可写'); } $input = array_elements(array('appid', 'secret', 'mchid', 'password', 'ip', 'minnum', 'logo'), $_GPC); $input['appid'] = trim($input['appid']); $input['secret'] = trim($input['secret']); $input['mchid'] = trim($input['mchid']); $input['password'] = trim($input['password']); $input['ip'] = trim($input['ip']); $input['minnum'] = trim($input['minnum']); $input['logo'] = trim($input['logo']); // /id set createtiem/ $data = array(); $data['set'] = serialize($input); $data['uniacid'] = $_W['uniacid']; if (empty($settings)) { pdo_insert('meepo_begging_set', $data); } else { pdo_update('meepo_begging_set', $data, array('uniacid' => $_W['uniacid']));