function moduleInit($name, $params = array()) { if (empty($name)) { return false; } $site = WeUtility::createModuleSite($name); if (!is_error($site)) { $method = 'shareResult'; if (method_exists($site, $method)) { $site->{$method}($params); exit('success'); } } }
function module_entries($name, $types = array(), $args = null) { $ts = array('rule', 'cover', 'menu', 'home', 'profile', 'shortcut', 'function'); if (empty($types)) { $types = $ts; } else { $types = array_intersect($types, $ts); } $fields = implode("','", $types); $sql = 'SELECT * FROM ' . tablename('modules_bindings') . " WHERE `module`=:module AND `entry` IN ('{$fields}') ORDER BY eid ASC"; $pars = array(); $pars[':module'] = $name; $bindings = pdo_fetchall($sql, $pars); $entries = array(); foreach ($bindings as $bind) { if (!empty($bind['call'])) { $site = WeUtility::createModuleSite($bind['module']); $ret = @$site->{$bind}['call']($args); if (is_array($ret)) { foreach ($ret as $et) { $et['url'] .= '&__title=' . urlencode($et['title']); $entries[$bind['entry']][] = array('title' => $et['title'], 'url' => $et['url'], 'from' => 'call'); } } } else { if ($bind['entry'] == 'cover') { $url = wurl("platform/cover", array('eid' => $bind['eid'])); } if ($bind['entry'] == 'menu') { $url = wurl("site/entry", array('eid' => $bind['eid'])); } if ($bind['entry'] == 'rule') { $url = wurl("site/entry", array('eid' => $bind['eid'], 'id' => '{id}')); } if ($bind['entry'] == 'home') { $url = murl("entry", array('eid' => $bind['eid'])); } if ($bind['entry'] == 'profile') { $url = murl("entry", array('eid' => $bind['eid'])); } if ($bind['entry'] == 'shortcut') { $url = murl("entry", array('eid' => $bind['eid'])); } $entries[$bind['entry']][] = array('title' => $bind['title'], 'url' => $url, 'from' => 'define'); } } return $entries; }
$log = pdo_fetch($sql, $pars); if (!empty($log) && $log['status'] == '0') { if ($log['is_usecard'] == 1 && $log['card_type'] == 1 && !empty($log['encrypt_code']) && $_W['acid']) { load()->classs('coupon'); $acc = new coupon($_W['acid']); $codearr['encrypt_code'] = $log['encrypt_code']; $codearr['module'] = $log['module']; $codearr['card_id'] = $log['card_id']; $acc->PayConsumeCode($codearr); } if ($log['is_usecard'] == 1 && $log['card_type'] == 2) { $now = time(); $log['card_id'] = intval($log['card_id']); pdo_query('UPDATE ' . tablename('activity_coupon_record') . " SET status = 2, usetime = {$now}, usemodule = '{$log['module']}' WHERE uniacid = :aid AND couponid = :cid AND uid = :uid AND status = 1 LIMIT 1", array(':aid' => $_W['uniacid'], ':uid' => $log['openid'], ':cid' => $log['card_id'])); } $site = WeUtility::createModuleSite($log['module']); if (!is_error($site)) { $site->weid = $_W['weid']; $site->uniacid = $_W['uniacid']; $site->inMobile = true; $method = 'payResult'; if (method_exists($site, $method)) { $ret = array(); $ret['result'] = 'failed'; $ret['type'] = $log['type']; $ret['from'] = 'return'; $ret['tid'] = $log['tid']; $ret['user'] = $log['openid']; $ret['fee'] = $log['fee']; $ret['weid'] = $log['weid']; $ret['uniacid'] = $log['uniacid'];
/** * [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'); $moduels = uni_modules(); $params = @json_decode(base64_decode($_GPC['id']), true); $params['m'] = trim($params['m']); $params['id'] = intval($params['id']); if (empty($params) || !array_key_exists($params['m'], $moduels)) { message('访问错误.'); } load()->model('activity'); $check = false; $site = WeUtility::createModuleSite($params['m']); if (!is_error($site)) { $site->weid = $_W['weid']; $site->uniacid = $_W['uniacid']; $site->inMobile = true; $method = 'grantCherk'; if (method_exists($site, $method)) { $ret = array(); $ret['couponid'] = $status['couponid']; $ret['type'] = $status['type']; $ret['uid'] = $_W['member']['uid']; $ret['weid'] = $_W['weid']; $ret['uniacid'] = $_W['uniacid']; $status = $site->{$method}($ret); if (!is_error($status)) { $check = true;
<?php /** * 微站管理 * [WDL] Copyright (c) 2013 B2CTUI.COM */ define('IN_SYS', true); require '../framework/bootstrap.inc.php'; require IA_ROOT . '/web/common/bootstrap.sys.inc.php'; load()->web('common'); load()->web('template'); header('Content-Type: text/html; charset=GBK'); $modulename = 'weisrc_dish'; $site = WeUtility::createModuleSite($modulename); if (!is_error($site)) { $method = 'doWebPrint'; //$site->module = array_merge($_W['modules'][$modulename], $_W['account']['modules'][$_W['modules'][$modulename]['mid']]); $site->weid = $_W['uniacid']; $site->inMobile = false; if (method_exists($site, $method)) { exit($site->{$method}()); } } exit("访问的方法 {$method} 不存在.");
define('FRAME', 'ext'); define('CRUMBS_NAV', 1); $ptr_title = $entry['title']; $module_types = module_types(); define('ACTIVE_FRAME_URL', url('home/welcome/ext', array('m' => $entry['module']))); } $frames = buildframes(array(FRAME), $entry['module']); $frames = $frames[FRAME]; } if (!empty($entry['module'])) { load()->model('extension'); if (ext_module_checkupdate($entry['module'])) { message('系统检测到该模块有更新,请点击“<a href="' . url('extension/module/upgrade', array('m' => $entry['module'])) . '">更新模块</a>”后继续使用!', '', 'error'); } } $_GPC['__entry'] = $entry['title']; $_GPC['__state'] = $entry['state']; if (!empty($_W['modules'][$entry['module']]['handles']) && (count($_W['modules'][$entry['module']]['handles']) > 1 || !in_array('text', $_W['modules'][$entry['module']]['handles']))) { $handlestips = true; } $site = WeUtility::createModuleSite($entry['module']); define('IN_MODULE', $entry['module']); if (!is_error($site)) { $sysmodule = system_modules(); if (in_array($m, $sysmodule)) { $site_urls = $site->getTabUrls(); } $method = 'doWeb' . ucfirst($entry['do']); exit($site->{$method}()); } exit("访问的方法 {$method} 不存在.");
} } else { $row['items'][] = array($opt['title'], create_url("rule/cover", array('eid' => $opt['eid']))); } } } if (!empty($m['rule']) || $mg['isrulefields']) { $row['items'][] = array('关键字触发列表', create_url('rule/display', array('module' => $row['name'])), 'childItems' => array('<i class="icon-plus"></i>', create_url('rule/post', array('module' => $row['name'])))); } if (!empty($m['home']) || !empty($m['profile']) || !empty($m['shortcut'])) { $row['items'][] = array('微站导航设置', create_url('site/nav', array('name' => $row['name']))); } if (!empty($m['menu']) && is_array($m['menu'])) { foreach ($m['menu'] 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']); } } } } else { $row['items'][] = array($opt['title'], create_url("site/entry", array('eid' => $opt['eid']))); } } } if ($mg['settings']) { $row['items'][] = array('参数设置', create_url('member/module/setting', array('mid' => $mg['mid'])));
protected function pay($params = array(), $mine = array()) { global $_W; if (!$this->inMobile) { message('支付功能只能在手机上使用'); } if (empty($_W['member']['uid'])) { checkauth(); } $params['module'] = $this->module['name']; $pars = array(); $pars[':uniacid'] = $_W['uniacid']; $pars[':module'] = $params['module']; $pars[':tid'] = $params['tid']; if ($params['fee'] <= 0) { $pars['from'] = 'return'; $pars['result'] = 'success'; $pars['type'] = 'alipay'; $pars['tid'] = $params['tid']; $site = WeUtility::createModuleSite($pars[':module']); $method = 'payResult'; if (method_exists($site, $method)) { exit($site->{$method}($pars)); } } $sql = 'SELECT * FROM ' . tablename('core_paylog') . ' WHERE `uniacid`=:uniacid AND `module`=:module AND `tid`=:tid'; $log = pdo_fetch($sql, $pars); if (!empty($log) && $log['status'] == '1') { message('这个订单已经支付成功, 不需要重复支付.'); } $setting = uni_setting($_W['uniacid'], array('payment', 'creditbehaviors')); if (!is_array($setting['payment'])) { message('没有有效的支付方式, 请联系网站管理员.'); } $pay = $setting['payment']; if (!empty($pay['credit']['switch'])) { $credtis = mc_credit_fetch($_W['member']['uid']); } $you = 0; if ($pay['card']['switch'] == 2) { if ($_W['card_permission'] == 1 && !empty($params['module'])) { $cards = pdo_fetchall('SELECT a.id,a.card_id,a.cid,b.type,b.title,b.extra,b.is_display,b.status,b.date_info FROM ' . tablename('coupon_modules') . ' AS a LEFT JOIN ' . tablename('coupon') . ' AS b ON a.cid = b.id WHERE a.acid = :acid AND a.module = :modu AND b.is_display = 1 AND b.status = 3 ORDER BY a.id DESC', array(':acid' => $_W['acid'], ':modu' => $params['module'])); $flag = 0; if (!empty($cards)) { foreach ($cards as $temp) { $temp['date_info'] = iunserializer($temp['date_info']); if ($temp['date_info']['time_type'] == 1) { $starttime = strtotime($temp['date_info']['time_limit_start']); $endtime = strtotime($temp['date_info']['time_limit_end']); if (TIMESTAMP < $starttime || TIMESTAMP > $endtime) { continue; } else { $param = array(':acid' => $_W['acid'], ':openid' => $_W['openid'], ':card_id' => $temp['card_id']); $num = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('coupon_record') . ' WHERE acid = :acid AND openid = :openid AND card_id = :card_id AND status = 1', $param); if ($num <= 0) { continue; } else { $flag = 1; $card = $temp; break; } } } else { $deadline = intval($temp['date_info']['deadline']); $limit = intval($temp['date_info']['limit']); $param = array(':acid' => $_W['acid'], ':openid' => $_W['openid'], ':card_id' => $temp['card_id']); $record = pdo_fetchall('SELECT addtime,id,code FROM ' . tablename('coupon_record') . ' WHERE acid = :acid AND openid = :openid AND card_id = :card_id AND status = 1', $param); if (!empty($record)) { foreach ($record as $li) { $time = strtotime(date('Y-m-d', $li['addtime'])); $starttime = $time + $deadline * 86400; $endtime = $time + $deadline * 86400 + $limit * 86400; if (TIMESTAMP < $starttime || TIMESTAMP > $endtime) { continue; } else { $flag = 1; $card = $temp; break; } } } if ($flag) { break; } } } } if ($flag) { if ($card['type'] == 'discount') { $you = 1; $card['fee'] = sprintf("%.2f", $params['fee'] * ($card['extra'] / 100)); } elseif ($card['type'] == 'cash') { $cash = iunserializer($card['extra']); if ($params['fee'] >= $cash['least_cost']) { $you = 1; $card['fee'] = sprintf("%.2f", $params['fee'] - $cash['reduce_cost']); } } load()->classs('coupon'); $acc = new coupon($_W['acid']); $card_id = $card['card_id']; $time = TIMESTAMP; $randstr = random(8); $sign = array($card_id, $time, $randstr, $acc->account['key']); $signature = $acc->SignatureCard($sign); if (is_error($signature)) { $you = 0; } } } } $we_you = 0; if ($pay['card']['switch'] == 3) { if (!empty($params['module'])) { $cards = pdo_fetchall('SELECT a.id,a.couponid,b.type,b.title,b.discount,b.condition,b.starttime,b.endtime FROM ' . tablename('activity_coupon_modules') . ' AS a LEFT JOIN ' . tablename('activity_coupon') . ' AS b ON a.couponid = b.couponid WHERE a.uniacid = :uniacid AND a.module = :modu AND b.starttime <= :time AND b.endtime >= :time ORDER BY a.id DESC', array(':uniacid' => $_W['uniacid'], ':modu' => $params['module'], ':time' => TIMESTAMP)); if (!empty($cards) && $_W['member']['uid']) { foreach ($cards as $card) { $has = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('activity_coupon_record') . ' WHERE uid = :uid AND uniacid = :aid AND couponid = :cid AND status = 1', array(':uid' => $_W['member']['uid'], ':aid' => $_W['uniacid'], ':cid' => $card['couponid'])); if ($has > 0) { if ($card['type'] == '1') { $we_you = 1; $card['fee'] = sprintf("%.2f", $params['fee'] * $card['discount']); break; } elseif ($card['type'] == '2') { if ($params['fee'] >= $cash['condition']) { $we_you = 1; $card['fee'] = sprintf("%.2f", $params['fee'] - $card['discount']); break; } } } } } } } include $this->template('common/paycenter'); }
private function getRedirectInfos() { global $_W, $_GPC; $sql = 'SELECT * FROM ' . tablename('modules_bindings') . " WHERE `entry` IN ('home', 'profile')"; $es = pdo_fetchall($sql); $_W['account']['modules'] = account_module(); cache_load('modules'); $ds = array(); if (is_array($es)) { foreach ($es as $entry) { $mid = $_W['modules'][$entry['module']]['mid']; if (empty($mid) || !isset($_W['account']['modules'][$mid])) { continue; } if (!empty($entry['call'])) { //echo "<p>{$entry['module']}</p>"; // BUGFIX::XXX // sns、exam这两个模块的方法有bug,调用会导致出错。暂时先回避。 if (in_array($entry['module'], array('vote', 'bigwheel', 'exam', 'sns', 'hotel2'))) { continue; } if (true) { continue; } $site = WeUtility::createModuleSite($entry['module']); if (method_exists($site, $entry['call'])) { $ret = $site->{$entry}['call'](); if (is_array($ret)) { foreach ($ret as $et) { $ds[] = array('module' => $entry['module'], 'from' => 'call', 'title' => $et['title'], 'url' => $et['url']); } } } } else { $et = array('title' => $entry['title'], 'url' => create_url("mobile/entry", array('eid' => $entry['eid'], 'weid' => $_W['weid']))); $ds[] = array('module' => $entry['module'], 'from' => 'define', 'title' => $et['title'], 'url' => $et['url']); } } } return $ds; }
function fans_require($user, $fields, $pre = '') { global $_W; if (empty($fields) || !is_array($fields)) { return false; } if (!in_array('weid', $fields)) { $fields[] = 'weid'; } if (!empty($pre)) { $pre .= '<br/>'; } $profile = fans_search($user, $fields); $weid = $profile['weid']; $titles = fans_fields(); $message = ''; $ks = array(); foreach ($profile as $k => $v) { if (empty($v)) { $ks[] = $k; $message .= $titles[$k] . ', '; } } if (!empty($message)) { $redirect = $_W['script_name'] . '?' . $_SERVER['QUERY_STRING'] . '#qq.com#wechat_redirect'; $site = WeUtility::createModuleSite('fans'); $site->module = $_W['account']['modules']['fans']; $site->weid = $_W['weid']; $site->inMobile = true; $site->doMobileRequire($fields, $redirect); } return $profile; }
private function buildCallbackParam($list) { foreach ($list as &$_item) { $canUseInternal = true; $callback = htmlspecialchars_decode($_item['callback']); $module = $_item['module']; if (!empty($callback) and !empty($module)) { $m = WeUtility::createModuleSite($module); if (!empty($m)) { $func = "{$callback}"; if (method_exists($m, $func)) { $_item['callback_str'] = $m->{$func}(); $canUseInternal = false; } } } if ($canUseInternal) { $_item['callback_str'] = htmlspecialchars_decode($_item['callback']); } } return $list; }
public function alipayAction() { $t = I('get.t'); $get = I('get.'); unset($get['t']); Pay::loadSettings(); $setting = C('PAY'); $pay = $setting[Pay::OPT_ALIPAY]; $p = new Pay(); if ($t == 'return') { $plid = $get['out_trade_no']; if (empty($plid)) { $this->error('非法访问'); } $prepares = array(); foreach ($get as $key => $value) { if ($key != 'sign' && $key != 'sign_type') { $prepares[] = "{$key}={$value}"; } } sort($prepares); $string = implode($prepares, '&'); $string .= $pay['secret']; $sign = md5($string); if ($sign == $get['sign'] && $get['result'] == 'success') { $log = $p->fetchLog($plid); if (!empty($log)) { dump($log); exit; $site = WeUtility::createModuleSite($log['module']); if (!is_error($site)) { $method = 'payResult'; if (method_exists($site, $method)) { $ret = array(); $ret['weid'] = $log['weid']; $ret['uniacid'] = $log['uniacid']; $ret['result'] = $log['status'] == '1' ? 'success' : 'failed'; $ret['type'] = $log['type']; $ret['from'] = 'return'; $ret['tid'] = $log['tid']; $ret['user'] = $log['openid']; $ret['fee'] = $log['fee']; exit($site->{$method}($ret)); } } } } } if ($t == 'notify') { $xml = '<?xml version="1.0" encoding="utf-8"?>' . I('post.notify_data'); $dom = new \DOMDocument(); if ($dom->loadXML($xml)) { $xpath = new \DOMXPath($dom); $plid = $xpath->evaluate('string(//notify/out_trade_no)'); $post = I('post.'); $string = "service={$post['service']}&v={$post['v']}&sec_id={$post['sec_id']}¬ify_data={$post['notify_data']}"; $string .= $pay['secret']; $sign = md5($string); if ($sign == $post['sign']) { $log = $p->fetchLog($plid); if (!empty($log) && $log['status'] == Pay::STATUS_CREATED) { $record = array(); $record['status'] = Pay::STATUS_DISBURSED; pdo_update('core_paylog', $record, array('plid' => $log['plid'])); $site = WeUtility::createModuleSite($log['module']); if (!is_error($site)) { $method = 'payResult'; if (method_exists($site, $method)) { $ret = array(); $ret['weid'] = $log['weid']; $ret['uniacid'] = $log['uniacid']; $ret['result'] = 'success'; $ret['type'] = $log['type']; $ret['from'] = 'notify'; $ret['tid'] = $log['tid']; $ret['user'] = $log['openid']; $ret['fee'] = $log['fee']; $site->{$method}($ret); exit('success'); } } } } } } if ($t == 'merchant') { } }
if ($module != 'all') { $bindings = pdo_fetchall('SELECT * FROM ' . tablename('modules_bindings') . ' WHERE `entry`=\'rule\' AND `module`=:module', array(':module' => $module)); } else { $bindings = pdo_fetchall('SELECT * FROM ' . tablename('modules_bindings') . ' WHERE `entry`=\'rule\''); } if (!empty($list)) { foreach ($list as &$item) { $condition = '`rid`=:rid'; $params = array(); $params[':rid'] = $item['id']; $item['keywords'] = rule_keywords_search($condition, $params); $item['options'] = array(); foreach ($bindings as $opt) { if ($opt['module'] == $item['module']) { if (!empty($opt['call'])) { $site = WeUtility::createModuleSite($item['module']); if (method_exists($site, $opt['call'])) { $ret = $site->{$opt}['call'](); if (is_array($ret)) { foreach ($ret as $et) { $et['url'] .= strexists($et['url'], '?') ? "&id={$item['id']}" : "?id={$item['id']}"; $item['options'][] = array('title' => $et['title'], 'link' => $et['url']); } } } } else { $vars = array(); $vars['eid'] = $opt['eid']; $vars['id'] = $item['id']; $link = create_url('site/entry', $vars); $item['options'][] = array('title' => $opt['title'], 'link' => $link);
protected function pay($params = array()) { global $_W; if (!$this->inMobile) { message('支付功能只能在手机上使用'); } if (empty($_W['member']['uid'])) { checkauth(); } $params['module'] = $this->module['name']; $pars = array(); $pars[':uniacid'] = $_W['uniacid']; $pars[':module'] = $params['module']; $pars[':tid'] = $params['tid']; if ($params['fee'] <= 0) { $pars['from'] = 'return'; $pars['result'] = 'success'; $pars['type'] = 'alipay'; $pars['tid'] = $params['tid']; $site = WeUtility::createModuleSite($pars[':module']); $method = 'payResult'; if (method_exists($site, $method)) { exit($site->{$method}($pars)); } } $sql = 'SELECT * FROM ' . tablename('core_paylog') . ' WHERE `uniacid`=:uniacid AND `module`=:module AND `tid`=:tid'; $log = pdo_fetch($sql, $pars); if (!empty($log) && $log['status'] == '1') { message('这个订单已经支付成功, 不需要重复支付.'); } $setting = uni_setting($_W['uniacid'], array('payment', 'creditbehaviors')); if (!is_array($setting['payment'])) { message('没有有效的支付方式, 请联系网站管理员.'); } $pay = $setting['payment']; if (!empty($pay['credit']['switch'])) { $credtis = mc_credit_fetch($_W['member']['uid']); } include $this->template('common/paycenter'); }
} } else { $solutions[] = $module; } } } $m = $_GPC['m']; if (!empty($m)) { load()->model('module'); $error = module_solution_check($m); if (is_error($error)) { message($error['message']); } $solution = module_fetch($m); $title = ' 行业解决方案 - ' . $solution['title']; $site = WeUtility::createModuleSite($m); if (!is_error($site)) { $method = 'doWebWelcome'; $welcome = @$site->{$method}(); } if (empty($welcome)) { $entries = module_entries($m, array('menu', 'home', 'profile', 'shortcut', 'cover')); if ($_W['role'] == 'operator') { foreach ($entries as $index1 => &$entry1) { if ($index1 == 'cover') { continue; } foreach ($entry1 as $index2 => &$entry2) { $url_arr = parse_url($entry2['url']); $url_query = $url_arr['query']; parse_str($url_query, $query_arr);
<?php /** * 打印机配置 */ define('IN_SYS', true); define('IA_ROOT', str_replace("\\", '/', dirname(dirname(__FILE__)))); require IA_ROOT . '/framework/bootstrap.inc.php'; header('Content-Type: text/html; charset=GBK'); $site = WeUtility::createModuleSite('weisrc_dish'); if (!is_error($site)) { $method = 'dowebprint'; $site->uniacid = $_W['uniacid']; $site->inMobile = false; if (method_exists($site, $method)) { exit($site->{$method}()); } } else { echo 'page is error'; } exit("访问的方法 {$method} 不存在.");
<?php /** * WORMWOOD微拍模块微站定义 * * @author WORMWOOD团队 * @url */ define('IN_SYS', true); require '../../bootstrap.inc.php'; $actions = array('getsetting', 'main', 'getdata', 'finished', 'failed', 'batchfinish'); if (in_array($_GPC['act'], $actions)) { $action = $_GPC['act']; } else { exit('Access Denied'); } $_W['attachurl'] = str_replace('source/modules/we7_photomaker/', '', $_W['attachurl']); $site = WeUtility::createModuleSite('we7_photomaker'); $site->inMobile = false; $site->module['name'] = 'we7_photomaker'; if (method_exists($site, 'doWeb' . $action)) { call_user_func(array($site, 'doWeb' . $action)); exit; } else { exit('Access Denied'); }