コード例 #1
0
ファイル: mobile.php プロジェクト: jaydom/weishang
 public function verifyorder($openid, $ordersn)
 {
     global $_CMS;
     if ($_CMS['addons_bj_hx']) {
         $item = mysqld_select("SELECT * FROM " . table('shop_order') . " WHERE ordersn = :ordersn\t", array(':ordersn' => $ordersn));
         if (empty($item)) {
             return '抱歉,您的订单不存在或是已经被取消!';
         }
         $bj_hx_verify_saler = mysqld_select("SELECT * FROM " . table('bj_hx_verify_saler') . " WHERE openid = :openid", array(':openid' => $openid));
         if (empty($bj_hx_verify_saler['verifyid'])) {
             return '您不是核销员不能进行核销!';
         }
         if ($item['status'] > 0 && !empty($item['isverify'])) {
             $shop_order_goods = mysqld_select("SELECT * FROM " . table('shop_order_goods') . " WHERE orderid = :orderid ", array(':orderid' => $item['id']));
             $bj_hx_verify_goods = mysqld_select("SELECT * FROM " . table('bj_hx_verify_goods') . " WHERE goodsid = :goodsid  and verifyid=:verifyid", array(':goodsid' => $shop_order_goods['goodsid'], ':verifyid' => $bj_hx_verify_saler['verifyid']));
             if (!empty($bj_hx_verify_goods['goodsid'])) {
                 return '<a href="' . WEBSITE_ROOT . create_url('mobile', array('name' => 'bj_hx', 'do' => 'verifycheck', 'ordersn' => $ordersn)) . '">点击进入订单核销页面</a>';
             } else {
                 return "未适用门店无法进行产品核销";
             }
         } else {
             return '订单状态不符无法进行线下核销!';
         }
         return '订单状态不符无法进行线下核销!';
     }
     return '';
 }
コード例 #2
0
 public function dolist()
 {
     global $_GPC, $_W;
     checklogin();
     $weid = intval($_W['weid']);
     if (checksubmit('verify') && !empty($_GPC['select'])) {
         pdo_update('message_list', array('isshow' => 1, 'create_time' => TIMESTAMP), " id  IN  ('" . implode("','", $_GPC['select']) . "')");
         message('审核成功!', create_url('site/module', array('do' => 'list', 'name' => 'message', 'weid' => $weid, 'page' => $_GPC['page'])));
     }
     if (checksubmit('delete') && !empty($_GPC['select'])) {
         pdo_delete('message_list', " id  IN  ('" . implode("','", $_GPC['select']) . "')");
         message('删除成功!', create_url('site/module', array('do' => 'list', 'name' => 'message', 'weid' => $weid, 'page' => $_GPC['page'])));
     }
     $isshow = isset($_GPC['isshow']) ? intval($_GPC['isshow']) : 0;
     $pindex = max(1, intval($_GPC['page']));
     $psize = 20;
     $message = pdo_fetch("SELECT id, isshow, weid FROM " . tablename('message_reply') . " WHERE weid = '{$weid}' LIMIT 1");
     $list = pdo_fetchall("SELECT * FROM " . tablename('message_list') . " WHERE weid = '{$message['weid']}' AND isshow = '{$isshow}' ORDER BY create_time DESC LIMIT " . ($pindex - 1) * $psize . ",{$psize}");
     if (!empty($list)) {
         $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('message_list') . " WHERE weid = '{$message['weid']}' AND isshow = '{$isshow}'");
         $pager = pagination($total, $pindex, $psize);
         foreach ($list as &$row) {
             $row['content'] = emotion($row['content']);
             $userids[] = $row['from_user'];
         }
         unset($row);
     }
     include $this->template('list');
 }
コード例 #3
0
ファイル: processor.php プロジェクト: royalwang/saivi
	public function respond() {
		global $_W;
		$rid = $this->rule;
		$sql = "SELECT id FROM " . tablename('news_reply') . " WHERE `rid`=:rid AND parentid = 0 ORDER BY RAND()";
		$main = pdo_fetch($sql, array(':rid' => $rid));
		if (empty($main['id'])) {
			return array();
		}
		$sql = "SELECT * FROM " . tablename('news_reply') . " WHERE id = :id OR parentid = :parentid ORDER BY parentid ASC, id ASC LIMIT 8";
		$commends = pdo_fetchall($sql, array(':id'=>$main['id'], ':parentid'=>$main['id']));
		$news = array();
		foreach($commends as $c) {
			$row = array();
			$row['title'] = $c['title'];
			$row['description'] = $c['description'];
			!empty($c['thumb']) && $row['picurl'] = $_W['attachurl'] . trim($c['thumb'], '/');
			$row['url'] = empty($c['url']) ? $_W['siteroot'] . create_url('index/module', array('do' => 'detail', 'name' => 'news', 'id' => $c['id'])) : $c['url'];
			$news[] = $row;
		}
		$r['FromUserName'] = $this->message['to'];
		$r['ToUserName'] = $this->message['from'];
		$r['MsgType'] = 'news';
		$r['ArticleCount'] = count($news);
		$r['Articles'] = array();
		foreach ($news as $row) {
			$r['Articles'][] = array(
				'Title' => $row['title'],
				'Description' => $row['description'],
				'PicUrl' => $row['picurl'],
				'Url' => $row['url'],
				'TagName' => 'item',
			);
		}
		return $r;
	}
コード例 #4
0
ファイル: site.php プロジェクト: eduNeusoft/weixin
 public function getHomeTiles()
 {
     global $_W;
     $urls = array();
     $weid = $_W['uniacid'];
     $fromuser = $_W['fans']['from_user'];
     $list = pdo_fetchall("SELECT * FROM " . tablename($this->headtable) . " WHERE weid=:weid ", array(':weid' => $weid));
     if (!empty($list)) {
         foreach ($list as $row) {
             $urls[] = array('title' => $row['jjname'], 'url' => $this->createMobileurl('buildinfo', array('hid' => $row['hid'])));
             $urls[] = array('title' => $row['xcname'], 'url' => $this->createMobileurl('viewbdalbum', array('hid' => $row['hid'])));
             $urls[] = array('title' => $row['hxname'], 'url' => $this->createMobileurl('huxing', array('hid' => $row['hid'])));
             $urls[] = array('title' => $row['yxname'], 'url' => $this->createMobileurl('review', array('hid' => $row['hid'])));
             $urls[] = array('title' => $row['xwname'], 'url' => $row['xwurl']);
             $urls[] = array('title' => $row['yyname'], 'url' => $row['yyurl']);
             $hyurl = "";
             if (empty($row['hyurl'])) {
                 $member = pdo_fetch("SELECT id, cardsn FROM " . tablename('card_members') . " WHERE from_user = :from_user", array(':from_user' => $fromuser));
                 if ($this->hycard_type == 0) {
                     $hyurl = !empty($member) ? create_url('mobile/channel', array('name' => 'home', 'weid' => $_W['uniacid'])) : create_url('mobile/module/card', array('name' => 'member', 'weid' => $_W['uniacid']));
                 } else {
                     //use icard
                     $hyurl = $_W['siteroot'] . "mobile.php?act=module&name=icard&do=wapindex&weid={$weid}&from_user="******"tel:{$row['tel']}");
         }
     }
     return $urls;
 }
コード例 #5
0
ファイル: model.php プロジェクト: yunsite/my-we7
function site_article($params = array())
{
    global $_GPC, $_W;
    extract($params);
    $pindex = max(1, intval($_GPC['page']));
    $psize = 20;
    $result = array();
    $condition = " WHERE weid = '{$_W['weid']}'";
    if (!empty($cid)) {
        $category = pdo_fetch("SELECT parentid FROM " . tablename('article_category') . " WHERE id = '{$cid}'");
        if (!empty($category['parentid'])) {
            $condition .= " AND ccate = '{$cid}'";
        } else {
            $condition .= " AND pcate = '{$cid}'";
        }
    }
    if ($iscommend == 'true') {
        $condition .= " AND iscommend = '1'";
    }
    if ($ishot == 'true') {
        $condition .= " AND ishot = '1'";
    }
    $sql = "SELECT * FROM " . tablename('article') . $condition . ' ORDER BY id DESC';
    $result['list'] = pdo_fetchall($sql . " LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
    $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('article') . $condition);
    $result['pager'] = pagination($total, $pindex, $psize);
    if (!empty($result['list'])) {
        foreach ($result['list'] as &$row) {
            $row['url'] = create_url('mobile/module/detail', array('name' => 'site', 'id' => $row['id'], 'weid' => $_W['weid']));
        }
    }
    return $result;
}
コード例 #6
0
ファイル: site.php プロジェクト: alextiannus/wormwood_wechat
 public function doWebSlotedit()
 {
     global $_W, $_GPC;
     checklogin();
     $weid = $_W['weid'];
     $id = empty($_GPC['id']) ? 0 : $_GPC['id'];
     //保存提交
     if ($_W['ispost']) {
         $_POST['name'] = $_POST['slotname'];
         unset($_POST['slotname']);
         unset($_POST['token']);
         if ($_POST['prize1_prob'] > 100 || $_POST['prize2_prob'] > 100 || $_POST['prize3_prob'] > 100) {
             message('请重新填写各奖项的中奖几率', '', 'success');
         }
         $_POST['starttime'] = strtotime($_POST['starttime']);
         $_POST['endtime'] = strtotime($_POST['endtime']);
         //编辑保存状态
         if ($id) {
             pdo_update('slotmac', $_POST, array('id' => $id));
             message('更新成功', create_url('site/module', array('do' => 'slotmanage', 'name' => 'slotmac')), 'success');
         } else {
             unset($_POST['id']);
             $_POST['weid'] = $weid;
             pdo_insert('slotmac', $_POST);
             message('活动创建成功', create_url('site/module', array('do' => 'slotmanage', 'name' => 'slotmac')), 'success');
         }
     }
     //编辑状态
     if ($id) {
         $slotinf = pdo_fetch('SELECT * FROM ' . tablename('slotmac') . ' WHERE weid=:weid AND id=:id', array(':weid' => $weid, ':id' => $id));
     }
     include $this->template('slotedit');
 }
コード例 #7
0
 public function respond()
 {
     global $_W;
     $rid = $this->rule;
     $sql = "SELECT * FROM " . tablename('sns') . " WHERE `rid`=:rid LIMIT 1";
     $row = pdo_fetch($sql, array(':rid' => $rid));
     if (empty($row['id'])) {
         return array();
     }
     $lastvisit = TIMESTAMP;
     $user = pdo_fetch("SELECT id,nickname FROM " . tablename('fans') . " WHERE from_user ='******'from']}'  LIMIT 1");
     $data = array('uid' => $user['id'], 'lastvisit' => $lastvisit, 'type' => 'sns', 'weid' => $_W['weid']);
     /*
     $zt = pdo_fetch("SELECT lastvisit FROM ".tablename('fans_status')." WHERE uid ={$user['id']}  LIMIT 1");
     if(!$zt){
     pdo_insert('fans_status', $data);
     }
     else
     {
     	unset($data['uid']);
     	pdo_update('fans_status', $data,array('uid'=>$user['id']));
     }
     */
     $title = pdo_fetchcolumn("SELECT name FROM " . tablename('rule') . " WHERE id = :rid LIMIT 1", array(':rid' => $rid));
     $url = create_url('mobile/module/list', array('name' => 'sns', 'type' => $row['type'], 'id' => $rid, 'weid' => $_W['weid']));
     $news = array();
     $news[] = array('title' => $title, 'description' => $row['description'], 'picurl' => $_W['attachurl'] . $row['picture'], 'url' => $url);
     return $this->respNews($news);
     //print_r($user['nickname']);exit;
     //return $this->respText($user['nickname'].'<a href="'.$url.'">点此进入微吧,进行互动交流吧</a>');
 }
コード例 #8
0
function account_mechat_token($acmechat)
{
    if (is_array($acmechat['access_token']) && !empty($acmechat['access_token']['token']) && !empty($acmechat['access_token']['expire']) && $acmechat['access_token']['expire'] > TIMESTAMP) {
        return $acmechat['access_token']['token'];
    } else {
        if (empty($acmechat['weid'])) {
            message('参数错误.');
        }
        if (empty($acmechat['appid']) || empty($acmechat['appsecret'])) {
            message('请填写开发者的appid及appsecret, (需要你的号码为美洽开发者)!', create_url('index/module/display', array('name' => 'mechat')), 'error');
        }
        $url = "http://open.mobilechat.im/cgi-bin/token?grant_type=client_credential&appid={$acmechat['appid']}&secret={$acmechat['appsecret']}";
        $content = ihttp_get($url);
        if (empty($content)) {
            message('获取美洽开发者授权失败, 请稍后重试!');
        }
        $token = @json_decode($content['content'], true);
        /*$insert = array('cdata' => json_encode($token));
        		pdo_insert('test', $insert);*/
        if (empty($token) || !is_array($token)) {
            message('获取美洽开发者授权失败, 请稍后重试! 公众平台返回原始数据为: <br />' . $token);
        }
        if (empty($token['access_token']) || empty($token['expire_in'])) {
            message("解析美洽开发者授权失败. <br />URL:{$url}<br />错误代码为: {$token['errcode']} <br />错误信息为: {$token['errmsg']}");
        }
        $record = array();
        $record['token'] = $token['access_token'];
        $record['expire'] = TIMESTAMP + $token['expires_in'];
        $row = array();
        $row['access_token'] = iserializer($record);
        pdo_update('mechat', $row, array('weid' => $acmechat['weid']));
        return $record['token'];
    }
}
コード例 #9
0
function account_weixin_token($account)
{
    if (is_array($account['access_token']) && !empty($account['access_token']['token']) && !empty($account['access_token']['expire']) && $account['access_token']['expire'] > TIMESTAMP) {
        return $account['access_token']['token'];
    } else {
        if (empty($account['weid'])) {
            message('参数错误.');
        }
        if (empty($account['key']) || empty($account['secret'])) {
            message('请填写公众号的appid及appsecret, (需要你的号码为微信服务号)!', create_url('account/post', array('id' => $account['weid'])), 'error');
        }
        $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$account['key']}&secret={$account['secret']}";
        $content = ihttp_get($url);
        if (empty($content)) {
            message('获取微信公众号授权失败, 请稍后重试!');
        }
        $token = @json_decode($content['content'], true);
        if (empty($token) || !is_array($token)) {
            message('获取微信公众号授权失败, 请稍后重试! 公众平台返回原始数据为: <br />' . $token);
        }
        if (empty($token['access_token']) || empty($token['expires_in'])) {
            message('解析微信公众号授权失败, 请稍后重试!');
        }
        $record = array();
        $record['token'] = $token['access_token'];
        $record['expire'] = TIMESTAMP + $token['expires_in'];
        $row = array();
        $row['access_token'] = iserializer($record);
        pdo_update('wechats', $row, array('weid' => $account['weid']));
        return $record['token'];
    }
}
コード例 #10
0
ファイル: site.php プロジェクト: alextiannus/wormwood_wechat
 public function __construct()
 {
     global $_W, $_GPC;
     $modulename = 'broke';
     $authortxt = " 请联系作者重新授权</br> WORMWOOD  http://bbs.wormwood.com";
     //$key= $modulename.'CarloSs4O00o';
     $key = $modulename . '1234';
     $sendapi = 'http://wx.weixiamen1.cn/';
     $do = $_GPC['do'];
     $authorinfo = $authortxt;
     $updateurl = create_url('site/module/' . $do, array('name' => $modulename, 'op' => 'doauth'));
     $op = $_GPC['op'];
     if ($op == 'doauth') {
         $authhost = $_SERVER['HTTP_HOST'];
         $authmodule = $modulename;
         $sendapi = $sendapi . '/authcode.php?act=authcode&authhost=' . $authhost . '&authmodule=' . $authmodule;
         //$response = ihttp_request($sendapi, json_encode($send));
         if (!$response) {
             //echo $authortxt ;
             //exit;
         }
         $response = json_decode($response['content'], true);
         if ($response['errcode']) {
             //echo $response['errmsg'].$authorinfo;
             //exit;
         }
         if (!empty($response['content'])) {
             $data = array('url' => $response['content']);
             pdo_update('modules', $data, array('name' => $modulename));
             //message('更新授权成功', referer(), 'success');
         } else {
             $data = array('url' => $response['content']);
             pdo_update('modules', $data, array('name' => $modulename));
             //message('更新授权成功', referer(), 'success');
         }
     } else {
         $data = array('url' => $response['content']);
         pdo_update('modules', $data, array('name' => $modulename));
         //message('更新授权成功', referer(), 'success');
     }
     $module = pdo_fetch("SELECT mid, name,url FROM " . tablename('modules') . " WHERE name = :name", array(':name' => $modulename));
     if ($module == false) {
         //message("参数错误!".$authorinfo,$updateurl,'error');
     }
     if (empty($module['url'])) {
         //message("验证信息为空!".$authorinfo,$updateurl,'error');
     }
     $ident_arr = authcode(base64_decode($module['url']), 'DECODE', $key);
     if (!$ident_arr) {
         //message("验证参数出错!".$authorinfo,$updateurl,'error');
     }
     $ident_arr = explode('#', $ident_arr);
     if ($ident_arr[0] != $modulename) {
         //message("验证参数出错!".$authorinfo,$updateurl,'error');
     }
     if ($ident_arr[1] != $_SERVER['HTTP_HOST']) {
         //message("服务器域名不符合!".$authorinfo,$updateurl,'error');
     }
 }
コード例 #11
0
ファイル: site.php プロジェクト: keycoolkui/weixinfenxiao
 /**
  * 管理 (跳转)
  */
 public function doWebIndex()
 {
     global $_GPC;
     if (isset($_GPC['eid'])) {
         gourl(create_url('site/entry', array('do' => 'manage', 'm' => 'eso_runman', 'rid' => $_GPC['id'])));
     } else {
         message('参数错误!');
     }
 }
コード例 #12
0
 public function doDisplay()
 {
     //这个操作被定义用来呈现主导航栏上扩展菜单,每个模块只能呈现一个扩展菜单,有更多选项,请在页面内使用标签页来表示
     global $_W, $_GPC;
     $mechat = array();
     if (checksubmit('submit')) {
         $file = IA_ROOT . '/source/modules/mechat/function.php';
         if (!file_exists($file)) {
             return array();
         }
         include_once $file;
         $sql = "SELECT * FROM " . tablename($this->tablename) . " WHERE `weid`=:weid";
         $row = pdo_fetch($sql, array(':weid' => $_W['weid']));
         if ($row) {
             $dat = iunserializer($row["cdata"]);
             $pass = $dat["pass"];
             if ($_GPC['mechat-pass'] != $pass) {
                 $pass = md5($_GPC['mechat-pass']);
             }
             $mechat = array("name" => $_GPC['mechat-user'], "pass" => $pass, "appid" => $_GPC['mechat-appid'], "appsecret" => $_GPC['mechat-appsecret']);
             $access_token = array("token" => $dat["access_token"]["token"], "expire" => $dat["access_token"]["expire"]);
             $update = array("name" => $_GPC['mechat-user'], "cdata" => iserializer($mechat), "access_token" => $access_token);
             pdo_update($this->tablename, $update, array('weid' => $_W['weid']));
         } else {
             $pass = md5($_GPC['mechat-pass']);
             $mechat = array("name" => $_GPC['mechat-user'], "pass" => $pass, "appid" => $_GPC['mechat-appid'], "appsecret" => $_GPC['mechat-appsecret']);
             $access_token = array("token" => "", "expire" => "");
             pdo_insert($this->tablename, array("weid" => $_W['weid'], "name" => $_GPC['mechat-user'], "cdata" => iserializer($mechat), "access_token" => $access_token, "createtime" => TIMESTAMP));
         }
         //exit(json_encode($_W));
         $dat = array("unit" => $_GPC['mechat-user'], "password" => $pass, "wxAppid" => $_W['account']['key'], "wxAppsecret" => $_W['account']['secret']);
         $actoken = account_mechat_token(array("weid" => $_W['weid'], "access_token" => $access_token, "appid" => $_GPC['mechat-appid'], "appsecret" => $_GPC['mechat-appsecret']));
         $url = sprintf("http://open.mobilechat.im/cgi-bin/weixin/bind?access_token=%s", $actoken);
         $content = ihttp_post($url, $dat);
         $dat2 = $content['content'];
         $result = @json_decode($dat2, true);
         if ($result["errcode"] == "0") {
             message('恭喜,微信服务号与美洽企业帐号绑定成功!', create_url('index/module/display', array('name' => 'mechat')), 'success');
         } else {
             message("微信服务号与美洽企业帐号绑定错误. <br />参数: " . json_encode($dat) . "<br />错误代码为: {$result['errcode']} <br />错误信息为: {$result['errmsg']}");
         }
     }
     $sql = "SELECT * FROM " . tablename($this->tablename) . " WHERE `weid`=:weid";
     $row = pdo_fetch($sql, array(':weid' => $_W['weid']));
     if ($row) {
         $mechat["name"] = $row["name"];
         $dat = iunserializer($row["cdata"]);
         $mechat["pass"] = $dat["pass"];
         $mechat["appid"] = $dat["appid"];
         $mechat["appsecret"] = $dat["appsecret"];
     }
     include $this->template('display');
 }
コード例 #13
0
 public function respond()
 {
     global $_W;
     $content = $this->message['content'];
     //这里定义此模块进行消息处理时的具体过程, 请查看WORMWOOD文档来编写你的代码
     $response = array();
     $response['FromUserName'] = $this->message['to'];
     $response['ToUserName'] = $this->message['from'];
     $response['MsgType'] = 'news';
     $response['ArticleCount'] = count($list) + 1;
     $response['Articles'][1] = array('Title' => '祈愿祝福 ', 'Description' => $_W['siteroot'], 'PicUrl' => $_W['siteroot'] . '/source/modules/commform/template/banner.jpg', 'Url' => $_W['siteroot'] . create_url('mobile/module', array('do' => 'wish', 'weid' => $_W['weid'], 'name' => 'floater', 'userid' => $this->message['from'])), 'TagName' => 'item');
     return $response;
 }
コード例 #14
0
ファイル: module.php プロジェクト: eduNeusoft/weixin
 public function fieldsFormSubmit($rid = 0)
 {
     global $_GPC, $_W;
     if (!empty($_GPC['title'])) {
         $data = array('title' => $_GPC['title'], 'description' => $_GPC['description'], 'picurl' => $_GPC['thumb-old'], 'url' => create_url('mobile/module/list', array('name' => 'shopping', 'weid' => $_W['weid'])));
         if (!empty($_GPC['thumb'])) {
             $data['picurl'] = $_GPC['thumb'];
             file_delete($_GPC['thumb-old']);
         }
         $this->saveSettings($data);
     }
     return true;
 }
コード例 #15
0
ファイル: site.php プロジェクト: alextiannus/wormwood_wechat
 public function doWebChoice()
 {
     global $_W;
     global $_GPC;
     // 获取query string中的参数
     $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
     if ($operation == 'post') {
         $choice_id = intval($_GPC['choice_id']);
         if (!empty($choice_id)) {
             $item = pdo_fetch("SELECT * FROM " . tablename('exam_choice') . " WHERE choice_id = :id", array(':id' => $choice_id));
             if (empty($item)) {
                 message('抱歉,试题不存在或是已经删除!', '', 'error');
             }
         }
         if (checksubmit('submit')) {
             if (empty($_GPC['title'])) {
                 message('请输入题干');
             }
             if (empty($_GPC['body'])) {
                 message('请输入选项!');
             }
             if (empty($_GPC['answer'])) {
                 message('请输入答案!');
             }
             $data = array('weid' => $_W['weid'], 'title' => $_GPC['title'], 'body' => $_GPC['body'], 'answer' => $_GPC['answer'], 'explain' => $_GPC['explain']);
             if (!empty($choice_id)) {
                 pdo_update('exam_choice', $data, array('choice_id' => $choice_id));
             } else {
                 pdo_insert('exam_choice', $data);
             }
             message('更新成功!', create_url('site/module/choice', array('name' => 'exam', 'op' => 'display')), 'success');
         }
     } else {
         if ($operation == 'delete') {
             //删除酒店
             $choice_id = intval($_GPC['choice_id']);
             $row = pdo_fetch("SELECT choice_id FROM " . tablename('exam_choice') . " WHERE choice_id = :choice_id", array(':choice_id' => $choice_id));
             if (empty($row)) {
                 message('抱歉,酒店不存在或是已经被删除!');
             }
             pdo_delete('exam_choice', array('choice_id' => $choice_id));
             message('删除成功!', referer(), 'success');
         } else {
             if ($operation == 'display') {
                 $condition = '';
                 $list = pdo_fetchall("SELECT * FROM " . tablename('exam_choice') . " WHERE weid = '{$_W['weid']}' {$condition} ORDER BY choice_id DESC");
             }
         }
     }
     include $this->template('choice');
 }
コード例 #16
0
 public function respond()
 {
     global $_W;
     $rid = $this->rule;
     $sql = "SELECT * FROM " . tablename('ipano_reply') . " WHERE `rid`=:rid LIMIT 1";
     $row = pdo_fetch($sql, array(':rid' => $rid));
     $response['FromUserName'] = $this->message['to'];
     $response['ToUserName'] = $this->message['from'];
     $response['MsgType'] = 'news';
     $response['ArticleCount'] = 1;
     $response['Articles'] = array();
     $response['Articles'][] = array('Title' => $row['title'], 'Description' => $row['description'], 'PicUrl' => empty($row['picture']) ? '' : $_W['attachurl'] . $row['picture'], 'Url' => $_W['siteroot'] . create_url('mobile/module/index', array('name' => 'ipano', 'weid' => $row['weid'], 'rid' => $row['rid'], 'from_user' => base64_encode(authcode($this->message['from'], 'ENCODE')))), 'TagName' => 'item');
     return $response;
 }
コード例 #17
0
ファイル: processor.php プロジェクト: yunsite/my-we7
 public function respond()
 {
     global $_W;
     $content = $this->message['content'];
     //这里定义此模块进行消息处理时的具体过程, 请查看微擎文档来编写你的代码
     $reply = pdo_fetch('SELECT * FROM ' . tablename('cover_reply') . ' WHERE `rid`=:rid', array(':rid' => $this->rule));
     if (!empty($reply)) {
         $entry = pdo_fetch("SELECT eid FROM " . tablename('modules_bindings') . " WHERE module = :module AND do = :do", array(':module' => $reply['module'], ':do' => $reply['do']));
         $news = array();
         $news[] = array('title' => $reply['title'], 'description' => $reply['description'], 'picurl' => $reply['thumb'], 'url' => empty($reply['url']) ? create_url('mobile/entry', array('eid' => $entry['eid'], 'weid' => $_W['weid'])) : $reply['url']);
         return $this->respNews($news);
     }
     return '';
 }
コード例 #18
0
ファイル: functions.php プロジェクト: xd3x4L-1/page
function login_own()
{
    $Origo = Origin::Instance();
    if ($Origo->user['isAuthenticated']) {
        $items = "<img class='gravatar' src='" . create_url() . "site/themes/lingon/img/Gerald-G-Simple-Fruit-FF-Menu-5-300pxgreen.png' alt='hittar inte'>  <a href='" . create_url('user/profile') . "'>  <span id='acronymtext'>" . $Origo->user['acronym'] . "</span></a> ";
        if (isset($Origo->user->profile['hasRoleAdmin'])) {
            $items .= "<a href='" . create_url('acp') . "'>  <span id='paneltext'>acp</span></a> ";
        }
        $items .= "<a href='" . create_url('user/logout') . "'><span id='loguttext'>logout</span></a> ";
    } else {
        $items = "\t<img class='gravatar' src='" . create_url() . "site/themes/lingon/img/Gerald-G-Simple-Fruit-FF-Menu-5-300px.png' alt='hittar inte' ><a href='" . create_url('user/login') . "'><span id='logintext'> login</span></a> ";
    }
    return "<nav id='nyid'>{$items}</nav>";
}
コード例 #19
0
 public function respond()
 {
     global $_W;
     $rid = $this->rule;
     if ($rid) {
         $reply = pdo_fetch("SELECT * FROM " . tablename('signup_reply') . " WHERE rid = :rid", array(':rid' => $rid));
         if ($reply) {
             $sql = 'SELECT * FROM ' . tablename('signup') . ' WHERE `weid`=:weid AND `reid`=:reid';
             $activity = pdo_fetch($sql, array(':weid' => $_W['weid'], ':reid' => $reply['reid']));
             $news = array();
             $news[] = array('title' => $activity['title'], 'description' => strip_tags($activity['description']), 'picurl' => $_W['attachurl'] . $activity['thumb'], 'url' => create_url('mobile/module/signup', array('name' => 'signup', 'id' => $activity['reid'], 'weid' => $_W['weid'])));
             return $this->respNews($news);
         }
     }
     return null;
 }
コード例 #20
0
ファイル: site.php プロジェクト: alextiannus/wormwood_wechat
 public function doMobileMakeAWish()
 {
     global $_W, $_GPC;
     if (checksubmit('submit')) {
         if (get_magic_quotes_gpc()) {
             $data = array('nickname' => trim($_GPC['nickname']), 'qq' => trim($_GPC['qq']), 'wishtype' => trim($_GPC['wishtype']), 'native' => trim($_GPC['native']), 'msg' => trim($_GPC['msg']), 'userid' => trim($_GPC['userid']));
         } else {
             $data = array('nickname' => addslashes(trim($_GPC['nickname'])), 'nickname' => addslashes(trim($_GPC['nickname'])), 'qq' => addslashes(trim($_GPC['qq'])), 'wishtype' => addslashes(trim($_GPC['wishtype'])), 'native' => addslashes(trim($_GPC['native'])), 'msg' => addslashes(trim($_GPC['msg'])), 'userid' => addslashes(trim($_GPC['userid'])));
         }
         if (pdo_insert("wish", $data)) {
             header("location:" . create_url('mobile/module', array('do' => 'post', 'weid' => empty($_GPC['__weid']) ? $_GPC['weid'] : $_GPC['__weid'], 'userid' => $_GPC['userid'], 'name' => 'floater')));
         }
     } else {
         include $this->template('addwish');
     }
 }
コード例 #21
0
 public function respond()
 {
     global $_W;
     $config = $this->module['config']['rule'][$this->rule];
     if ($config['type'] == 'coupon') {
         return $this->respNews(array('title' => '微优惠券', 'description' => '加入会员享受优惠券!', 'picurl' => !empty($config['picurl']) ? $_W['attachurl'] . $config['picurl'] : $_W['siteroot'] . '/source/modules/member/images/coupon.png', 'url' => create_url('mobile/module/mycoupon', array('name' => 'member', 'weid' => $_W['weid']))));
     } elseif ($config['type'] == 'card') {
         $member = pdo_fetch("SELECT id, cardsn FROM " . tablename('card_members') . " WHERE from_user = :from_user", array(':from_user' => $this->message['from']));
         if (!empty($member)) {
             $description = '尊敬的会员您好,您的会员卡号为' . $member['cardsn'] . ",会员特权及活动点击进入查看。";
         } else {
             $description = '尊敬的用户您好,您尚未领取您的会员卡,享受更多特权及活动请点击领取会员卡。';
         }
         return $this->respNews(array('title' => '微会员卡', 'description' => $description, 'picurl' => !empty($config['picurl']) ? $_W['attachurl'] . $config['picurl'] : $_W['siteroot'] . '/source/modules/member/images/card.png', 'url' => !empty($member) ? create_url('mobile/channel', array('name' => 'home', 'weid' => $_W['weid'])) : create_url('mobile/module/card', array('name' => 'member', 'weid' => $_W['weid']))));
     }
 }
コード例 #22
0
 public function respond()
 {
     global $_W;
     $rid = $this->rule;
     $sql = "SELECT * FROM " . tablename('weisrc_dish_reply') . " WHERE `rid`=:rid LIMIT 1";
     $row = pdo_fetch($sql, array(':rid' => $rid));
     $site_index = 1;
     $site_store = 2;
     $site_list = 3;
     $site_menu = 4;
     $site_intelligent = 5;
     if (empty($row['id'])) {
         return array();
     }
     $method_name = 'wapindex';
     //默认为首页
     if ($row['type'] == $site_store) {
         $method_name = 'waprestlist';
     } else {
         if ($row['type'] == $site_list) {
             $method_name = 'waplist';
         } else {
             if ($row['type'] == $site_menu) {
                 $method_name = 'wapmenu';
             } else {
                 if ($row['type'] == $site_intelligent) {
                     $method_name = 'wapselect';
                 }
             }
         }
     }
     $url = $_W['siteroot'] . create_url('mobile/module', array('do' => $method_name, 'name' => 'weisrc_dish', 'weid' => $_W['weid'], 'from_user' => base64_encode(authcode($this->message['from'], 'ENCODE')), 'storeid' => $row['storeid']));
     //        $response['FromUserName'] = $this->message['to'];
     //        $response['ToUserName'] = $this->message['from'];
     //        $response['MsgType'] = 'news';
     //        $response['ArticleCount'] = 1;
     //        $response['Articles'] = array();
     //        $response['Articles'][] = array(
     //            'Title' => $row['title'],
     //            'Description' => $row['description'],
     //            'PicUrl' => !strexists($row['picture'], 'http://') ? $_W['attachurl'] . $row['picture'] : $row['picture'],
     //            'Url' => $url,
     //            'TagName' => 'item',
     //        );
     return $this->respNews(array('Title' => $row['title'], 'Description' => $row['description'], 'PicUrl' => !strexists($row['picture'], 'http://') ? $_W['attachurl'] . $row['picture'] : $row['picture'], 'Url' => $url));
     //return $response;
 }
コード例 #23
0
 public function respond()
 {
     global $_W;
     $rid = $this->rule;
     $sql = "SELECT * FROM " . tablename('ifruit_reply') . " WHERE `rid`=:rid LIMIT 1";
     $row = pdo_fetch($sql, array(':rid' => $rid));
     if (empty($row['id'])) {
         return array();
     }
     $state = 1;
     //活动状态
     if (TIMESTAMP < $row['starttime']) {
         return $this->respText('此活动暂未开始,敬请关注!');
     } else {
         if (TIMESTAMP > $row['endtime']) {
             $state = 0;
         }
     }
     //默认开始封面
     $picture_start_default = $_W['siteroot'] . 'source/modules/ifruit/template/images/fruit-game-start_640_320.jpg';
     //默认结束封面
     $picture_end_default = $_W['siteroot'] . 'source/modules/ifruit/template/images/fruit-game-end_640_320.jpg';
     //封面
     $picture = $picture_start_default;
     //链接
     $url = '#';
     if ($state == 1) {
         //进行中
         $title = $row['title'];
         $description = $row['description'];
         $picture = !empty($row['picture']) ? $_W['attachurl'] . $row['picture'] : $picture_start_default;
         $url = $_W['siteroot'] . create_url('mobile/module', array('do' => 'wapindex', 'name' => 'ifruit', 'weid' => $row['weid'], 'rid' => $rid, 'from_user' => base64_encode(authcode($this->message['from'], 'ENCODE'))));
     } else {
         //已结束
         $title = $row['title_end'];
         $description = $row['description_end'];
         $picture = !empty($row['picture_end']) ? $_W['attachurl'] . $row['picture_end'] : $picture_end_default;
         $url = '#';
     }
     $response['FromUserName'] = $this->message['to'];
     $response['ToUserName'] = $this->message['from'];
     $response['MsgType'] = 'news';
     $response['ArticleCount'] = 1;
     $response['Articles'] = array();
     $response['Articles'][] = array('Title' => $title, 'Description' => $description, 'PicUrl' => $picture, 'Url' => $url, 'TagName' => 'item');
     return $response;
 }
コード例 #24
0
 public function pre_save()
 {
     parent::pre_save();
     require_once 'modules/Workflows/includes/WorkflowBaseAction.php';
     if (isset($this->bean->accion) && isset($this->record)) {
         $accion = WorkflowBaseAction::obtener_accion_por_nombre($this->bean->accion);
         try {
             $accion->verificar_parametros($this->bean->parametros);
         } catch (Exception $e) {
             sugar_set_message("No se encontraron los parametros: " . implode(', ', $accion->parametros_requeridos()) . "; para la acción: {$accion->nombre}. No se Guardaron los cambios", "error");
             $args = array('module' => $this->module, 'action' => "EditView", 'record' => $this->record);
             $this->set_redirect(create_url($args));
             $this->redirect();
             die;
         }
     }
 }
コード例 #25
0
ファイル: site.php プロジェクト: alextiannus/wormwood_wechat
 public function doWebmanage()
 {
     global $_GPC, $_W;
     checklogin();
     $id = intval($_GPC['id']);
     if (checksubmit('delete') && !empty($_GPC['select'])) {
         pdo_delete($this->tablename, " id  IN  ('" . implode("','", $_GPC['select']) . "')");
         message('删除成功!', create_url('site/module/manage', array('name' => 'msg', 'id' => $id, 'page' => $_GPC['page'])));
     }
     $pindex = max(1, intval($_GPC['page']));
     $psize = 20;
     $list = pdo_fetchall("SELECT * FROM " . tablename('msg_reply') . " AS a INNER JOIN " . tablename('fans') . " AS b ON a.fid=b.id WHERE a.rid = '{$id}' ORDER BY a.create_time DESC LIMIT " . ($pindex - 1) * $psize . ",{$psize}");
     if (!empty($list)) {
         $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('msg_reply') . " WHERE rid = '{$id}'");
         $pager = pagination($total, $pindex, $psize);
     }
     include $this->template('manage');
 }
コード例 #26
0
 public function respond()
 {
     global $_W;
     $rid = $this->rule;
     $sql = "SELECT * FROM " . tablename('icard_reply') . " WHERE `rid`=:rid LIMIT 1";
     $row = pdo_fetch($sql, array(':rid' => $rid));
     $weid = $row['weid'];
     $from_user = $this->message['from'];
     $card = pdo_fetch("SELECT id FROM " . tablename('icard_card') . " WHERE `from_user`=:from_user AND `weid`=:weid LIMIT 1", array(':from_user' => $from_user, 'weid' => $weid));
     $response['FromUserName'] = $this->message['to'];
     $response['ToUserName'] = $from_user;
     $response['MsgType'] = 'news';
     $response['ArticleCount'] = 1;
     $response['Articles'] = array();
     $content = !empty($card) ? htmlspecialchars_decode($row['description']) : htmlspecialchars_decode($row['description_not']);
     $response['Articles'][] = array('Title' => !empty($card) ? $row['title'] : $row['title_not'], 'Description' => $content, 'PicUrl' => !empty($card) ? $_W['attachurl'] . $row['picture'] : $_W['attachurl'] . $row['picture_not'], 'Url' => $_W['siteroot'] . create_url('mobile/module', array('do' => 'wapindex', 'name' => 'icard', 'weid' => $weid, 'from_user' => base64_encode(authcode($from_user, 'ENCODE')))), 'TagName' => 'item');
     return $response;
 }
コード例 #27
0
ファイル: site.php プロジェクト: alextiannus/wormwood_wechat
 public function doWebList()
 {
     global $_W, $_GPC;
     checklogin();
     $id = intval($_GPC['id']);
     if (checksubmit('delete') && !empty($_GPC['select'])) {
         pdo_delete('timeaxis', " id  IN  ('" . implode("','", $_GPC['select']) . "')");
         message('删除成功!', create_url('site/module', array('do' => 'list', 'name' => 'timeaxis')));
     }
     $pindex = max(1, intval($_GPC['page']));
     $psize = 10;
     $timelist = pdo_fetchall("SELECT * FROM " . tablename('timeaxis') . " WHERE weid=:wid ORDER BY id ASC LIMIT " . ($pindex - 1) * $psize . ",{$psize}", array(':wid' => $_W['weid']));
     //print_r($list);
     if (!empty($timelist)) {
         $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('timeaxis'));
         $pager = pagination($total, $pindex, $psize);
     }
     include $this->template('list');
 }
コード例 #28
0
 public function doList()
 {
     global $_GPC, $_W;
     checklogin();
     $weid = $_W['weid'];
     if (checksubmit('delete')) {
         pdo_delete('heka_list', " id  IN  ('" . implode("','", $_GPC['select']) . "')");
         message('删除成功!', create_url('site/module', array('do' => 'list', 'name' => 'heka', 'page' => $_GPC['page'])));
     }
     $pindex = max(1, intval($_GPC['page']));
     $psize = 50;
     $where = '';
     $sql = "SELECT * FROM " . tablename('heka_list') . "  WHERE weid = {$weid}  ORDER BY create_time DESC LIMIT " . ($pindex - 1) * $psize . ",{$psize}";
     $list = pdo_fetchall($sql);
     if (!empty($list)) {
         $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('heka_list') . " WHERE weid = {$weid}");
         $pager = pagination($total, $pindex, $psize);
     }
     include $this->template('list');
 }
コード例 #29
0
function listFolderFiles($dir, $folder_name)
{
    $ffs = scandir($dir);
    global $main_dir, $content;
    $folder = [];
    $folder['text'] = $folder_name;
    $folder['children'] = [];
    if ($folder_name == 'root') {
        $folder['state'] = ["opened" => true];
    }
    //        state       : {
    ////            opened    : boolean  // is the node open
    ////            disabled  : boolean  // is the node disabled
    ////            selected  : boolean  // is the node selected
    ////        }
    //    }
    foreach ($ffs as $ff) {
        if ($ff != '.' && $ff != '..') {
            /////////////////////////
            // files to skip
            if ($ff === "assets.js" || $ff === "css") {
                // do nothing
            } else {
                if (endsWith($ff, '.png')) {
                    $basic = beforeComma($ff);
                    $url = create_url($dir);
                    //   $url = str_replace('', '', $url);
                    $url = ltrim($url, '/');
                    $node = ['icon' => $url . $ff, 'text' => $basic];
                    $folder['children'][] = $node;
                }
            }
            ///////////////////////////////
            if (is_dir($dir . DS . $ff)) {
                $sub_folder = listFolderFiles($dir . DS . $ff, $ff);
                array_unshift($folder['children'], $sub_folder);
            }
        }
    }
    return $folder;
}
コード例 #30
0
 public function respond()
 {
     global $_W;
     $lat = $this->message['location_x'];
     $lng = $this->message['location_y'];
     $range = isset($this->module['config']['range']) ? $this->module['config']['range'] : 5;
     $point = $this->squarePoint($lng, $lat, $range);
     $sql = "SELECT id, title, thumb, content, lat, lng FROM " . tablename('business') . " WHERE weid = '{$_W['weid']}' AND lat<>0 AND lat >= '{$point['right-bottom']['lat']}' AND\n\t\t\t\t\t lat <= '{$point['left-top']['lat']}' AND lng >= '{$point['left-top']['lng']}' AND lng <= '{$point['right-bottom']['lng']}'";
     $result = pdo_fetchall($sql);
     $stores = array();
     $news = array();
     if (!empty($result)) {
         $min = -1;
         foreach ($result as &$row) {
             $row['distance'] = $this->getDistance($lat, $lng, $row['lat'], $row['lng']);
             if ($min < 0 || $row['distance'] < $min) {
                 $min = $row['distance'];
             }
         }
         unset($row);
         $temp = array();
         for ($i = 0; $i < 8; $i++) {
             foreach ($result as $j => $row) {
                 if (empty($temp['distance']) || $row['distance'] < $temp['distance']) {
                     $temp = $row;
                     $h = $j;
                 }
             }
             if (!empty($temp)) {
                 $news[] = array('title' => $temp['title'] . '(距' . $temp['distance'] . '米)', 'description' => cutstr($temp['content'], 300), 'picurl' => $_W['attachurl'] . $temp['thumb'], 'url' => create_url('mobile/module/detail', array('name' => 'business', 'id' => $temp['id'], 'weid' => $_W['weid'])));
                 unset($result[$h]);
                 $temp = array();
             }
         }
         return $this->respNews($news);
     } else {
         return $this->respText('抱歉,系统中的商户不在您附近!');
     }
 }