/** * 更新用户下的公众号缓存 * @param int $uid */ function cache_build_account($uid = 0) { global $_W; isetcookie('wechatloaded', '0'); $uid = empty($uid) ? $_W['uid'] : $uid; cache_build_modules(); cache_load('modules'); $modules = $_W['modules']; $wechats = pdo_fetchall("SELECT * FROM " . tablename('wechats') . " WHERE uid = '{$uid}' ORDER BY `weid` DESC", array(), 'weid'); $sysmodules = pdo_fetchall("SELECT mid, name FROM ".tablename('modules')." WHERE issystem = '1'", array(), 'mid'); foreach ($sysmodules as $mid => &$module) { $module['issystem'] = 1; $module['displayorder'] = -1; $module['enabled'] = 1; } if(!empty($wechats)) { $founder = explode(',', $_W['config']['setting']['founder']); foreach ($wechats as $index => $row) { if (in_array($uid, $founder)) { $membermodules = pdo_fetchall("SELECT mid, name FROM ".tablename('modules') . " ORDER BY issystem DESC, mid ASC", array(), 'mid'); $modulelist = array(); } else { $membermodules = pdo_fetchall("SELECT b.mid, b.name FROM ".tablename('members_modules')." AS a LEFT JOIN ".tablename('modules')." AS b ON a.mid = b.mid WHERE a.uid = :uid AND b.name <> '' ORDER BY issystem DESC, mid ASC", array(':uid' => $uid), 'mid'); $modulelist = $sysmodules; } $mymodules = pdo_fetchall("SELECT mid, enabled, displayorder FROM ".tablename('wechats_modules')." WHERE weid = '{$row['weid']}' AND mid IN (".implode(",", array_keys($membermodules)).") ORDER BY enabled DESC, displayorder ASC, mid ASC", array(), 'mid'); //拼接模块 if (!empty($mymodules)) { foreach ($mymodules as $mid => $row){ if (empty($row['enabled'])) { unset($membermodules[$mid]); continue; } if (!empty($membermodules[$mid])) { $modulelist[$mid] = $membermodules[$mid]; $modulelist[$mid]['enabled'] = $row['enabled']; $modulelist[$mid]['displayorder'] = $row['displayorder']; unset($membermodules[$mid]); } } } if (!empty($membermodules)) { $modulelist = array_merge($modulelist, $membermodules); } elseif (in_array($uid, $founder)) { $modulelist = $membermodules; } unset($row); foreach ($modulelist as $mid => &$row) { if (!isset($row['enabled'])) { $row['enabled'] = 1; $row['displayorder'] = 127; } } unset($row); $wechats[$index]['modules'] = $modulelist; } } cache_write('account:'.$uid, $wechats); }
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('登录失败,请检查您输入的用户名和密码!'); } }
public static function setClientCookieUserInfo($userInfo = array(), $cookieKey) { if (!empty($userInfo) && !empty($userInfo['openid'])) { $cookie = array(); $cookie['openid'] = $userInfo['openid']; $cookie['nickname'] = $userInfo['nickname']; $cookie['headimgurl'] = $userInfo['headimgurl']; $session = base64_encode(json_encode($cookie)); isetcookie($cookieKey, $session, 24 * 3600 * 1); } else { message("获取用户信息错误"); } }
/** * author: codeMonkey QQ:631872807 * @param $openid * @param $accessToken * @return unknown * cookie保存用户信息 */ public static function setClientCookieUserInfo($userInfo = array(), $cookieKey) { if (!empty($userInfo) && !empty($userInfo['openid'])) { $cookie = array(); foreach ($userInfo as $key => $value) { $cookie[$key] = $value; } $session = base64_encode(json_encode($cookie)); isetcookie($cookieKey, $session, 1 * 3600 * 1); } else { message("获取用户信息错误"); } }
function _login($forward = '') { global $_GPC; load()->model('user'); $member = array(); $username = trim($_GPC['username']); if (empty($username)) { message('请输入要登录的用户名'); } $member['username'] = $username; $member['password'] = $_GPC['password']; if (empty($member['password'])) { message('请输入密码'); } if ($_GPC['admin']) { $record = user_single($member); } else { $record = biz_login($username, $member['password']); if (!empty($record)) { $record['username'] = $record['UserName']; $record['uid'] = $record['UserGUID']; $record['password'] = $record['Password']; } } if (!empty($record)) { if ($record['status'] == -1) { message('您的账号正在核合或是已经被系统禁止,请联系网站管理员解决!'); } $cookie = array(); $cookie['uid'] = $record['uid']; $cookie['lastip'] = $record['lastip']; $cookie['token'] = $record['Token']; $cookie['hash'] = md5($record['password'] . $record['salt']); if ($_GPC['admin']) { $cookie['admin'] = 1; } $session = base64_encode(json_encode($cookie)); isetcookie('__session', $session, 86400); if (empty($forward)) { $forward = $_GPC['forward']; } if (empty($forward)) { $forward = './index.php?c=project&a=display'; } message("欢迎回来,{$record['username']}。", $forward); } else { message('登录失败,请检查您输入的用户名和密码!'); } }
function _login($forward = '') { global $_GPC; require_once IA_ROOT . '/source/model/member.mod.php'; hooks('member:login:before'); $member = array(); $username = trim($_GPC['username']); if (empty($username)) { message('请输入要登录的用户名'); } $member['username'] = $username; $member['password'] = $_GPC['password']; if (empty($member['password'])) { message('请输入密码'); } $record = member_single($member); if (!empty($record)) { if ($record['status'] == -1) { message('您的账号正在核合或是已经被系统禁止,请联系网站管理员解决!'); } $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; member_update($status); hooks('member:login:success'); if (empty($forward)) { $forward = $_GPC['forward']; } if (empty($forward)) { $forward = './index.php?refersh'; } message("欢迎回来,{$record['username']}。", $forward); } else { message('登录失败,请检查您输入的用户名和密码!'); } }
<?php /** * [Weizan System] Copyright (c) 2014 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'); error_reporting(0); load()->classs('captcha'); session_start(); $captcha = new Captcha(); $captcha->build(150, 40); $hash = md5(strtolower($captcha->phrase) . $_W['config']['setting']['authkey']); isetcookie('__code', $hash); $_SESSION['__code'] = $hash; $captcha->output();
function checkcaptcha($code) { global $_W, $_GPC; session_start(); $codehash = md5(strtolower($code) . $_W['config']['setting']['authkey']); if (!empty($_GPC['__code']) && $codehash == $_SESSION['__code']) { $return = true; } else { $return = false; } $_SESSION['__code'] = ''; isetcookie('__code', ''); return $return; }
function _mc_login($member) { global $_W; if (!empty($member) && !empty($member['uid'])) { $sql = 'SELECT `uid`,`realname`,`mobile`,`email`,`groupid`,`credit1`,`credit2`,`credit6` FROM ' . tablename('mc_members') . ' WHERE `uid`=:uid AND `uniacid`=:uniacid'; $member = pdo_fetch($sql, array(':uid' => $member['uid'], ':uniacid' => $_W['uniacid'])); if (!empty($member) && (!empty($member['mobile']) || !empty($member['email']))) { $_W['member'] = $member; $_SESSION['uid'] = $member['uid']; mc_group_update(); if (empty($_W['openid'])) { $fan = mc_fansinfo($member['uid']); if (!empty($fan)) { $_SESSION['openid'] = $fan['openid']; $_W['openid'] = $fan['openid']; $_W['fans'] = $fan; $_W['fans']['from_user'] = $_W['openid']; } else { $_W['openid'] = $member['uid']; $_W['fans'] = array('from_user' => $member['uid'], 'follow' => 0); } } isetcookie('logout', '', -60000); return true; } } return false; }
message('正在恢复数据备份, 请不要关闭浏览器, 当前第 1 卷.', url('system/database/restore')); } } } if ($_GPC['__restore']) { $restore = json_decode(base64_decode($_GPC['__restore']), true); if ($ds[$restore['restore_name']]) { if ($ds[$restore['restore_name']]['volume'] < $restore['restore_volume']) { isetcookie('__restore', '', -1000); message('成功恢复数据备份. 可能还需要你更新缓存.', url('system/database/restore')); } else { $sql = file_get_contents($path . $restore['restore_name'] . "/volume-{$restore['restore_prefix']}-{$restore['restore_volume']}.sql"); pdo_run($sql); $volume = $restore['restore_volume']; $restore['restore_volume']++; isetcookie('__restore', base64_encode(json_encode($restore))); message('正在恢复数据备份, 请不要关闭浏览器, 当前第 ' . $volume . ' 卷.', url('system/database/restore')); } } else { message('非法访问', 'error'); } } if ($_GPC['d']) { $d = $_GPC['d']; if ($ds[$d]) { rmdirs($path . $d); message('删除备份成功.', url('system/database/restore')); } } } if ($do == 'trim') {
/** * * @param $openid */ public function setClientUserInfo($openid) { global $_W; if (!empty($openid)) { load()->classs('weixin.account'); $accObj = WeixinAccount::create($_W['account']); $access_token = $accObj->fetch_token(); if (empty($access_token)) { message("获取accessToken失败"); } $userInfo = $this->oauth->getUserInfo($access_token, $openid); if (!empty($userInfo)) { $cookie = array(); $cookie['openid'] = $userInfo['openid']; $cookie['nickname'] = $userInfo['nickname']; $cookie['headimgurl'] = $userInfo['headimgurl']; $session = base64_encode(json_encode($cookie)); isetcookie('__singnuser', $session, 24 * 3600 * 365); } return $userInfo; } }
$row = fans_search($pass['fans'], array('salt')); if (!is_array($row) || empty($row['salt'])) { $row = array('from_user' => $pass['fans'], 'salt' => ''); } $hash = md5("{$pass['fans']}{$pass['time']}{$row['salt']}{$_W['config']['setting']['authkey']}"); if ($pass['hash'] == $hash) { if ($_W['setting']['authmode'] == 2) { $row = array(); $row['salt'] = random(8); fans_update($pass['fans'], $row); } $cookie = array(); $cookie['openid'] = $pass['fans']; $cookie['hash'] = substr(md5("{$pass['fans']}{$row['salt']}{$_W['config']['setting']['authkey']}"), 5, 5); $session = base64_encode(json_encode($cookie)); isetcookie('__msess', $session, 30 * 86400); } } } } $forward = @base64_decode($_GPC['forward']); if (empty($forward)) { $forward = create_url('mobile/channel', array('name' => 'index', 'weid' => $weid)); } else { $forward = strexists($forward, 'http://') ? $forward : $_W['siteroot'] . $forward; } if (strexists($forward, '#')) { $pieces = explode('#', $forward, 2); $forward = $pieces[0]; } $forward .= '&wxref=mp.weixin.qq.com#wechat_redirect';
function print_addTask($chips, $backUrl, $printType) { global $_W, $_GPC; $templates = biz_getPrintTemplates($_W['project']['projguid'], $printType, 'id'); if (empty($templates) || count($templates) == 0) { message('无可用的打印模板,请找管理配置模板!', $backUrl, 'error'); } $templateId = trim($_GPC['template']); if (!isset($templates[$templateId])) { message('无效的打印模板', $backUrl); } $prints = biz_getAllPrinter($_W['project']['projguid']); if (empty($prints) || count($prints) == 0) { message('无可用的打印机,请找管理员确认打印机配置!', $backUrl, 'error'); } $titles = biz_getDictionary('printtype'); $printTitle = $titles[$printType]; if (empty($printTitle)) { message('无效的打印调用!', $backUrl, 'error'); } $template = $templates[$templateId]; $printId = intval($_GPC['printer']); //记录当前使用的打印机 isetcookie('__print', $printId); $print = $prints[$printId]; if (!biz_checkChipsStatus($chips, $printType, 'printstatus')) { db_updateChipsStatus($chips['id'], $printType, false, 'printstatus'); } $copy_max = 9; $copy = intval($_GPC['copy']); if ($copy <= 0) { $copy = 1; } if ($copy > $copy_max) { $copy = $copy_max; } $printdata = biz_Print_getTemplateData($templateId, $chips); $task = array('projguid' => $chips['projguid'], 'title' => $chips['cname'] . '-' . $printTitle, 'printid' => $printId, 'moduleid' => $print['moduleid'], 'templateid' => $templateId, 'templatename' => $template['title'], 'key' => $chips['qrcode'], 'printname' => $print['title'], 'printtype' => $printType, 'printdata' => iserializer($printdata), 'createid' => $_W['uid'], 'creator' => $_W['username'], 'copy' => $copy, 'status' => '等待', 'createtime' => TIMESTAMP); if (pdo_insert('printtask', $task)) { message('数据已进入排队打印中,请稍候...', $backUrl); } else { message('写入打印任务数据出错', $backUrl); } }
<?php /** * [Weizan System] Copyright (c) 2014 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'); load()->model('app'); $multiid = intval($_GPC['t']); $title = $_W['page']['title']; $navs = app_navs('home', $multiid); $share_tmp = pdo_fetch('SELECT title,description,thumb FROM ' . tablename('cover_reply') . ' WHERE uniacid = :aid AND multiid = :id AND module = :m', array(':aid' => $_W['uniacid'], ':id' => $multiid, ':m' => 'site')); $_share['imgUrl'] = tomedia($share_tmp['thumb']); $_share['desc'] = $share_tmp['description']; $_share['title'] = $share_tmp['title']; if (!empty($multiid)) { isetcookie('__multiid', $multiid); } template('home/home');
template('wechat/location_model'); exit; } $accdata = $accounts[$acid]; if (empty($_GPC['__color'])) { load()->classs('coupon'); $acc = new coupon($acid); $status = $acc->GetColors(); if (is_error($status)) { message($status['message'], referer(), 'error'); } foreach ($status['colors'] as $val) { $colors[$val['name']] = $val; } $colors = base64_encode(iserializer($colors)); isetcookie('__color', $colors, 86400 * 7); } $colors = iunserializer(base64_decode($_GPC['__color'])); load()->func('tpl'); load()->model('coupon'); load()->classs('coupon'); $setting = pdo_fetch('SELECT * FROM ' . tablename('coupon_setting') . ' WHERE uniacid = :aid AND acid = :cid', array(':aid' => $_W['uniacid'], ':cid' => $acid)); $setting['logourl_'] = media2local($setting['logourl']); $types = array('discount' => '折扣券', 'cash' => '代金券', 'gift' => '礼品券', 'groupon' => '团购券', 'general_coupon' => '优惠券'); if ($do == 'display') { $condition = ' WHERE uniacid = :aid AND acid = :cid'; $parma[':aid'] = $_W['uniacid']; $parma[':cid'] = $acid; if (!empty($_GPC['type'])) { $condition .= ' AND type = :type'; $parma[':type'] = $_GPC['type'];
public function doMobileLoginout() { global $_W, $_GPC; $rid = intval($_GPC['rid']); isetcookie('__xwz_session_' . $_W['uniacid'] . '_' . $rid, null); header("location: " . $_W['siteroot'] . 'app/' . substr($this->createMobileUrl('login', array('rid' => $rid)), 2)); }
$session = json_decode(base64_decode($_GPC['__session']), true); if (is_array($session)) { $user = user_single(array('uid' => $session['uid'])); 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'])) {
<?php /** * 获取用户公众号信息 * [WeEngine System] Copyright (c) 2013 WE7.CC */ defined('IN_IA') or exit('Access Denied'); $account = pdo_fetchall("SELECT weid, name FROM ".tablename('wechats') . (empty($_W['isfounder']) ? " WHERE uid = '{$_W['uid']}'" : '')); isetcookie('wechatloaded', '1'); message($account, '', 'ajax');
$continue = dump_export(); if (!empty($continue)) { isetcookie('__continue', base64_encode(json_encode($continue))); message('正在导出数据, 请不要关闭浏览器, 当前第 1 卷.', create_url('setting/database/backup')); } else { message('数据已经备份完成', 'refresh'); } } if ($_GPC['__continue']) { $ctu = json_decode(base64_decode($_GPC['__continue']), true); $continue = dump_export($ctu); if (!empty($continue)) { isetcookie('__continue', base64_encode(json_encode($continue))); message('正在导出数据, 请不要关闭浏览器, 当前第 ' . $ctu['series'] . ' 卷.', create_url('setting/database/backup')); } else { isetcookie('__continue', '', -1000); message('数据已经备份完成', 'refresh'); } } } if ($do == 'restore') { $ds = array(); $path = IA_ROOT . '/data/backup/'; if (is_dir($path)) { if ($handle = opendir($path)) { while (false !== ($bakdir = readdir($handle))) { if ($bakdir == '.' || $bakdir == '..') { continue; } if (preg_match('/^(?P<time>\\d{10})_[a-z\\d]{8}$/i', $bakdir, $match)) { $time = $match['time'];
<?php defined('IN_IA') or exit('Access Denied'); $uniacid = intval($_GPC['uniacid']); $role = uni_permission($_W['uid'], $uniacid); if (empty($role)) { message('操作失败, 非法访问.'); } isetcookie('__uniacid', $uniacid, 7 * 46800); header('location: ' . url('home/welcome'));
$acl = array('account' => array('default' => 'welcome', 'direct' => array('welcome'), 'founder' => array('batch', 'permission', 'groups')), 'home' => array('default' => 'welcome', 'founder' => array()), 'cloud' => array('default' => 'touch', 'direct' => array('touch', 'dock', 'download'), 'founder' => array('diagnose', 'redirect', 'upgrade', 'process', 'device')), 'extension' => array('founder' => array('module', 'service', 'theme')), 'site' => array('direct' => array('entry')), 'system' => array('founder' => array('common', 'attachment', 'copyright', 'database', 'tools', 'updatecache', 'sysinfo')), 'user' => array('default' => 'display', 'direct' => array('login', 'register', 'logout'), 'founder' => array('create', 'display', 'edit', 'fields', 'group', 'permission', 'registerset')), 'utility' => array('founder' => array('user'), 'direct' => array('verifycode', 'code', 'file', 'emoji', 'bindcall'))); $settings = setting_load('copyright'); if ($settings['copyright']['status'] == 1 && empty($_W['isfounder'])) { $_W['siteclose'] = true; if ($controller == 'account' && $action == 'welcome') { template('account/welcome'); exit; } if ($controller == 'user' && $action == 'login') { if (checksubmit()) { require _forward($controller, $action); } template('user/login'); exit; } isetcookie('__session', '', -10000); message('站点已关闭,关闭原因:' . $settings['copyright']['reason'], url('account/welcome'), 'info'); } $controllers = array(); $handle = opendir(IA_ROOT . '/web/source/'); if (!empty($handle)) { while ($dir = readdir($handle)) { if ($dir != '.' && $dir != '..') { $controllers[] = $dir; } } } if (!in_array($controller, $controllers)) { $controller = 'account'; } $init = IA_ROOT . "/web/source/{$controller}/__init.php";
<?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'); $uniacid = intval($_GPC['uniacid']); $role = uni_permission($_W['uid'], $uniacid); if (empty($role)) { message('操作失败, 非法访问.'); } isetcookie('__uniacid', $uniacid, 7 * 86400); isetcookie('__uid', $_W['uid'], 7 * 86400); header('location: ' . url('home/welcome'));
$account['account'] = trim($basicinfo['account']); $account['original'] = trim($basicinfo['original']); $account['signature'] = trim($basicinfo['signature']); $account['key'] = trim($basicinfo['key']); $account['secret'] = trim($basicinfo['secret']); $account['type'] = intval($_GPC['type']); $account['level'] = $basicinfo['level']; } else { message('请填写公众平台用户名和密码', url('account/post-step', array('uniacid' => $uniacid, 'step' => 2)), 'error'); } $acid = account_create($uniacid, $account); if (is_error($acid)) { message('添加公众号信息失败', '', url('account/post-step/', array('uniacid' => $uniacid, 'step' => 2), 'error')); } isetcookie('uni_name', '', -10000); isetcookie('uni_description', '', -10000); if (!empty($basicinfo['headimg'])) { file_write('headimg_' . $acid . '.jpg', $basicinfo['headimg']); } if (!empty($basicinfo['qrcode'])) { file_write('qrcode_' . $acid . '.jpg', $basicinfo['qrcode']); } } if (!empty($acid)) { $account = account_fetch($acid); } if (!empty($loginstatus)) { if ($type == 'wechat') { $account['id'] = $acid; $result = account_weixin_interface($account['username'], $account); if (is_error($result)) {
public function doMobileOAuth() { global $_W, $_GPC; $account = $this->getAccount(); $code = trim($_GPC['code']); if (!empty($code)) { $url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={$account['key']}&secret={$account['secret']}&code={$code}&grant_type=authorization_code"; WeUtility::logging('trace', 'url:' . $url); $ret = ihttp_get($url); if (!is_error($ret)) { $auth = @json_decode($ret['content'], true); if (is_array($auth) && !empty($auth['openid'])) { $row = array(); $row['weid'] = $_W['weid']; $row['openid'] = $auth['openid']; $row['from_user'] = $auth['openid']; if ($auth['scope'] == 'snsapi_userinfo') { $user = $this->getFansInfo($auth['access_token'], $auth['openid']); $row['nickname'] = $user['nickname']; $row['avatar'] = $user['headimgurl']; } WeUtility::logging('trace', 'user:'******'query']); header('location: ' . $_W['siteroot'] . 'mobile.php?' . $forward . '&' . $this->cookiename . '=' . $auth['openid'] . '&wxref=mp.weixin.qq.com#wechat_redirect'); exit; } else { message($ret['content']); } } } message('微信授权失败!'); }
$accounts = uni_accounts(); if (!empty($accounts)) { foreach ($accounts as $key => $li) { if ($li['level'] < 3) { unset($accounts[$key]); } } } $acid = intval($_GET['__acid']); if (empty($acid)) { $acid = intval($_GPC['__acid']); } if (!$acid || empty($accounts[$acid])) { message('公众号不存在', url('wechat/account'), 'error'); } else { isetcookie('__acid', $acid, 86400 * 3); } if ($do == 'logo') { load()->func('tpl'); $coupon_setting = pdo_fetch('SELECT * FROM ' . tablename('coupon_setting') . ' WHERE uniacid = :aid AND acid = :acid', array(':aid' => $_W['uniacid'], ':acid' => $acid)); if (checksubmit('submit')) { $_GPC['logo'] = trim($_GPC['logo']); empty($_GPC['logo']) && message('请上传商户logo', referer(), 'info'); $data = array('uniacid' => $_W['uniacid'], 'acid' => $acid, 'logourl' => $_GPC['logo']); if (empty($coupon_setting)) { pdo_insert('coupon_setting', $data); } else { pdo_update('coupon_setting', $data, array('uniacid' => $_W['uniacid'])); } message('上传商户LOGO成功', referer(), 'success'); }
$_W['fans']['card'] = 4; } elseif ($row1['credit1'] > $cardlevel['Lv5'] && $row1['credit1'] <= $cardlevel['Lv52']) { $_W['fans']['card'] = 5; } elseif ($row1['credit1'] > $cardlevel['Lv6'] && $row1['credit1'] <= $cardlevel['Lv62']) { $_W['fans']['card'] = 6; } elseif ($row1['credit1'] > $cardlevel['Lv7'] && $row1['credit1'] <= $cardlevel['Lv72']) { $_W['fans']['card'] = 7; } elseif ($row1['credit1'] > $cardlevel['Lv8'] && $row1['credit1'] <= $cardlevel['Lv82']) { $_W['fans']['card'] = 8; } elseif ($row1['credit1'] > $cardlevel['Lv9'] && $row1['credit1'] <= $cardlevel['Lv92']) { $_W['fans']['card'] = 9; } } } if (empty($_W['fans'])) { isetcookie('__msess', false, -100); } } unset($session); $_W['container'] = 'browser'; if (strexists(strtolower($_SERVER['HTTP_USER_AGENT']), 'micromessenger')) { $_W['container'] = 'wechat'; } if (strexists(strtolower($_SERVER['HTTP_USER_AGENT']), 'yixin')) { $_W['container'] = 'yixin'; } if (!in_array($_GPC['act'], array('auth', 'oauth')) && (empty($_W['fans']) || empty($_W['fans']['from_user']))) { $account = $_W['account']; if ($account['level'] == 2 && $account['type'] == 1 && $_W['container'] == 'wechat') { //高级接口权限 $callback = urlencode($_W['siteroot'] . 'mobile.php?act=oauth&weid=' . $_W['weid']);
$upgrade[] = $k; } } } else { message('从云平台获取模板信息失败,请稍后重试', referer(), 'error'); } if (empty($upgrade)) { message('您的模板已经是最新版本', referer(), 'success'); } $upgrade_str = iserializer($upgrade); cache_write('upgrade:template', $upgrade_str); } if ($batch == 1) { $wait_upgrade = (array) iunserializer(cache_read('upgrade:template')); if (empty($wait_upgrade)) { isetcookie('batch', 0, -10000); message('您的模板已经是最新版本', url('extension/theme'), 'success'); } $id = array_shift($wait_upgrade); } else { $id = $_GPC['templateid']; } $theme = pdo_fetch("SELECT id, name, title FROM " . tablename('site_templates') . " WHERE name = :name", array(':name' => $id)); if (empty($theme)) { if ($batch == 1) { cache_write('upgrade:template', iserializer($wait_upgrade)); message($theme['title'] . ' 模板已经被卸载或是不存在。系统将进入下一个模板的更新。<br>请勿关闭浏览器', url('extension/theme/upgrade', array('batch' => 1)), 'success'); } message('模板已经被卸载或是不存在!', '', 'error'); } $r = cloud_prepare();
function insert_cookie($key, $data) { global $_W, $_GPC; $session = base64_encode(json_encode($data)); isetcookie($key, $session, !empty($_GPC['rember']) ? 7 * 86400 : 0); }
$dat = htmlspecialchars_decode($dat); $menus = @json_decode($dat, true); if (empty($menus) || !is_array($menus)) { $menus = $acc->menuQuery(); if (is_error($menus) && $menus['errno'] != '46003') { message($menus['message'], 'refresh'); } } if (empty($menus) || !is_array($menus)) { message('获取菜单数据失败,请重试!'); } if (is_string($menus['menu'])) { $menus['menu'] = @json_decode($menus['menu'], true); } if (!is_array($menus['menu'])) { $menus['menu'] = array(); } isetcookie($menusetcookie, json_encode($menus), 86400); if (is_array($menus['menu']['button'])) { foreach ($menus['menu']['button'] as &$m) { if (isset($m['key'])) { $m['forward'] = $m['key']; } if (is_array($m['sub_button'])) { foreach ($m['sub_button'] as &$s) { $s['forward'] = $s['key']; } } } } template('menu/designer');
if (empty($creditname['enabled'])) { unset($creditnames[$index]); } } $select_credit = implode(', ', array_keys($creditnames)); } else { $select_credit = ''; } if ($do == 'display') { $where = ' WHERE uniacid = :uniacid '; $params = array(':uniacid' => $_W['uniacid']); $type = intval($_GPC['type']); if (!$type) { $type = intval($_GPC['cookietype']); } else { isetcookie('cookietype', $type, 86400 * 7); } $keyword = trim($_GPC['keyword']); if ($type == 1 || $type == '') { $keyword = intval($_GPC['keyword']); if ($keyword > 0) { $where .= ' AND uid = :uid'; $params[':uid'] = $keyword; } } elseif ($type == 2) { if ($keyword) { $where .= " AND mobile LIKE :mobile"; $params[':mobile'] = "%{$keyword}%"; } } elseif ($type == 4) { if ($keyword) {