本文整理汇总了PHP中iserializer函数的典型用法代码示例。如果您正苦于以下问题:PHP iserializer函数的具体用法?PHP iserializer怎么用?PHP iserializer使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了iserializer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fieldsFormSubmit
public function fieldsFormSubmit($rid)
{
global $_W, $_GPC;
$id = intval($_GPC['replyid']);
$data = array('rid' => $rid, 'weid' => $_W['weid'], 'sn' => $_GPC['sn'], 'token' => $_GPC['apitoken'], 'maxuse' => intval($_GPC['maxuse']), 'maxtotal' => intval($_GPC['maxtotal']), 'adtype' => intval($_GPC['adtype']), 'adurlv' => $_GPC['adurlv'], 'adurlh' => $_GPC['adurlh'], 'admsg' => $_GPC['admsg'], 'leavemsg' => $_GPC['leavemsg'], 'fontfamily' => $_GPC['fontfamily'], 'fontcolor' => $_GPC['fontcolor'], 'qrcode' => $_GPC['qrcode'], 'mainpic' => $_GPC['mainpic'], 'adpics' => '', 'width' => $_GPC['width'], 'height' => $_GPC['height'], 'size' => intval($_GPC['photosize']), 'status' => intval($_GPC['status']), 'enableauthcode' => intval($_GPC['enableauthcode']), 'enablemsg' => intval($_GPC['enablemsg']), 'content' => $_GPC['content'], 'tipsentry' => $_GPC['tipsentry'], 'tipssuccess' => $_GPC['tipssuccess'], 'tipserror' => $_GPC['tipserror']);
if (!empty($_GPC['sort'])) {
asort($_GPC['sort']);
foreach ($_GPC['sort'] as $key => $value) {
$data['adpics'][] = $_GPC['adpics'][$key];
}
$data['adpics'] = iserializer($data['adpics']);
} else {
$data['adpics'] = iserializer($_GPC['adpics']);
}
if (empty($id)) {
pdo_insert('we7_photomaker', $data);
} else {
if (!empty($_GPC['qrcode'])) {
file_delete($_GPC['qrcode-old']);
}
if (!empty($_GPC['mainpic'])) {
file_delete($_GPC['mainpic-old']);
}
pdo_update('we7_photomaker', $data, array('id' => $id));
}
}
示例2: account_mechat_token
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'];
}
}
示例3: fieldsFormSubmit
public function fieldsFormSubmit($rid)
{
global $_GPC, $_W;
$id = intval($_GPC['reply_id']);
$notawardtext = explode("\n", $_GPC['notawardtext']);
$insert = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'title' => $_GPC['title'], 'ticket_information' => $_GPC['ticket_information'], 'description' => $_GPC['description'], 'repeat_lottery_reply' => $_GPC['repeat_lottery_reply'], 'start_picurl' => $_GPC['start_picurl'], 'end_theme' => $_GPC['end_theme'], 'end_instruction' => $_GPC['end_instruction'], 'end_picurl' => $_GPC['end_picurl'], 'notaward' => $_GPC['notaward'], 'notawardtext' => iserializer($notawardtext), 'notawardpic' => $_GPC['notawardpic'], 'adpic' => $_GPC['adpic'], 'adpicurl' => $_GPC['adpicurl'], 'award_times' => $_GPC['award_times'], 'number_times' => $_GPC['number_times'], 'most_num_times' => $_GPC['most_num_times'], "credit_times" => $_GPC['credit_times'], "credittype" => $_GPC['credittype'], "credit_type" => $_GPC['credit_type'], "credit1" => $_GPC['credit1'], "credit2" => $_GPC['credit2'], 'sn_rename' => $_GPC['sn_rename'], 'awardnum' => $_GPC['awardnum'], 'show_num' => $_GPC['show_num'], 'createtime' => time(), 'share_acid' => $_GPC['share_acid'], 'copyright' => $_GPC['copyright'], 'starttime' => strtotime($_GPC['datelimit']['start']), 'endtime' => strtotime($_GPC['datelimit']['end']), 'xuninumtime' => $_GPC['xuninumtime'], 'xuninuminitial' => $_GPC['xuninuminitial'], 'xuninumending' => $_GPC['xuninumending'], 'xuninum' => $_GPC['xuninum'], 'ticketinfo' => $_GPC['ticketinfo'], 'isrealname' => $_GPC['isrealname'], 'ismobile' => $_GPC['ismobile'], 'isqq' => $_GPC['isqq'], 'isemail' => $_GPC['isemail'], 'isaddress' => $_GPC['isaddress'], 'isgender' => $_GPC['isgender'], 'istelephone' => $_GPC['istelephone'], 'isidcard' => $_GPC['isidcard'], 'iscompany' => $_GPC['iscompany'], 'isoccupation' => $_GPC['isoccupation'], 'isposition' => $_GPC['isposition'], 'isfans' => $_GPC['isfans'], 'isfansname' => $_GPC['isfansname'], 'award_info' => $_GPC['award_info'], 'homepictime' => $_GPC['homepictime'], 'homepic' => $_GPC['homepic'], 'opportunity' => $_GPC['opportunity'], 'opportunity_txt' => $_GPC['opportunity_txt']);
load()->func('communication');
if (empty($id)) {
if ($insert['starttime'] <= time()) {
$insert['isshow'] = 1;
} else {
$insert['isshow'] = 0;
}
pdo_insert('stonefish_scratch_reply', $insert);
$id = pdo_insertid();
} else {
pdo_update('stonefish_scratch_reply', $insert, array('id' => $id));
}
//查询规则
//查询子公众号信息必保存分享设置
$acid_arr = uni_accounts();
$ids = array();
$ids = array_map('array_shift', $acid_arr);
//子公众账号Arr数组
foreach ($ids as $acid => $idlists) {
$insertshare = array('rid' => $rid, 'acid' => $acid, 'uniacid' => $_W['uniacid'], 'share_title' => $_GPC['share_title_' . $acid], 'share_desc' => $_GPC['share_desc_' . $acid], 'share_url' => $_GPC['share_url_' . $acid], 'share_imgurl' => $_GPC['share_imgurl_' . $acid], 'share_picurl' => $_GPC['share_picurl_' . $acid], 'share_pic' => $_GPC['share_pic_' . $acid], 'share_txt' => $_GPC['share_txt_' . $acid], 'sharenumtype' => $_GPC['sharenumtype_' . $acid], 'sharenum' => $_GPC['sharenum_' . $acid], 'sharetype' => $_GPC['sharetype_' . $acid], 'share_confirm' => $_GPC['share_confirm_' . $acid], 'share_fail' => $_GPC['share_fail_' . $acid], 'share_cancel' => $_GPC['share_cancel_' . $acid]);
if (empty($_GPC['acid_' . $acid])) {
pdo_insert('stonefish_scratch_share', $insertshare);
} else {
pdo_update('stonefish_scratch_share', $insertshare, array('id' => $_GPC['acid_' . $acid]));
}
}
//查询子公众号信息必保存分享设置
//奖品配置
if (!empty($_GPC['prizetype'])) {
foreach ($_GPC['prizetype'] as $index => $prizetype) {
if (empty($prizetype)) {
continue;
}
$insertprize = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'prizetype' => $_GPC['prizetype'][$index], 'prizename' => $_GPC['prizename'][$index], 'prizepro' => $_GPC['prizepro'][$index], 'prizetotal' => $_GPC['prizetotal'][$index], 'prizepic' => $_GPC['prizepic'][$index], 'prizetxt' => $_GPC['prizetxt'][$index], 'credit' => $_GPC['credit'][$index], 'credit_type' => $_GPC['prize_type'][$index]);
$updata['total_num'] += $_GPC['prizetotal'][$index];
pdo_update('stonefish_scratch_prize', $insertprize, array('id' => $index));
}
}
if (!empty($_GPC['prizetype_new']) && count($_GPC['prizetype_new']) > 1) {
foreach ($_GPC['prizetype_new'] as $index => $credit_type) {
if (empty($credit_type) || $index == 0) {
continue;
}
$insertprize = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'prizetype' => $_GPC['prizetype_new'][$index], 'prizename' => $_GPC['prizename_new'][$index], 'prizepro' => $_GPC['prizepro_new'][$index], 'prizetotal' => $_GPC['prizetotal_new'][$index], 'prizepic' => $_GPC['prizepic_new'][$index], 'prizetxt' => $_GPC['prizetxt_new'][$index], 'credit' => $_GPC['credit_new'][$index], 'credit_type' => $_GPC['prize_type_new'][$index]);
$updata['total_num'] += $_GPC['prizetotal_new'][$index];
pdo_insert('stonefish_scratch_prize', $insertprize);
}
}
if ($updata['total_num']) {
pdo_update('stonefish_scratch_reply', $updata, array('id' => $id));
}
//奖品配置
return true;
}
示例4: respond
public function respond()
{
global $_W;
$msgtype = $this->message['type'];
$allow = array('text', 'image', 'location', 'link', 'trace');
if (!in_array($msgtype, $allow)) {
return $this->respText('抱歉,系统仅支持 文字,图片,地理位置,链接类型的消息!');
}
$close = 0;
if ($msgtype == 'text') {
$content = $this->message['content'];
if ($content == '关闭') {
$content = '<span class="text-danger">系统消息:粉丝关闭了对话</span>';
$close = 1;
}
} elseif ($msgtype == 'image') {
$content = $this->message['picurl'];
} elseif ($msgtype == 'location') {
$content = iserializer(array('location_x' => $this->message['location_x'], 'location_y' => $this->message['location_y'], 'scale' => $this->message['scale']));
} elseif ($msgtype == 'link') {
$content = $this->message['url'];
}
if (!empty($content)) {
$insert = array('uniacid' => $_W['uniacid'], 'acid' => $_W['acid'], 'openid' => $_W['openid'], 'msgtype' => $msgtype, 'flag' => 2, 'content' => $content, 'createtime' => TIMESTAMP);
pdo_insert('mc_chats_record', $insert);
}
$this->refreshContext(300);
if ($close == 1) {
$this->endContext();
return $this->respText('您成功关闭回话。');
}
return $this->respText('');
}
示例5: calculate
public function calculate($orderid = 0, $update = true)
{
global $_W;
$set = $this->getSet();
$levels = $this->getLevels();
$goods = pdo_fetchall("select og.id,og.realprice,og.total,g.hascommission, g.commission1_rate,g.commission1_pay,g.commission2_rate,g.commission2_pay,g.commission3_rate,g.commission3_pay from " . tablename('ewei_shop_order_goods') . ' og ' . ' left join ' . tablename('ewei_shop_goods') . ' g on g.id = og.goodsid' . ' where og.orderid=:orderid and og.uniacid=:uniacid', array(':orderid' => $orderid, ':uniacid' => $_W['uniacid']));
if ($set['level'] > 0) {
foreach ($goods as &$cinfo) {
$price = $cinfo['realprice'];
if ($cinfo['hascommission'] == 1) {
$cinfo['commission1'] = array('default' => $set['level'] >= 1 ? $cinfo['commission1_rate'] > 0 ? round($cinfo['commission1_rate'] * $price / 100, 2) . "" : round($cinfo['commission1_pay'] * $cinfo['total'], 2) : 0);
$cinfo['commission2'] = array('default' => $set['level'] >= 2 ? $cinfo['commission2_rate'] > 0 ? round($cinfo['commission2_rate'] * $price / 100, 2) . "" : round($cinfo['commission2_pay'] * $cinfo['total'], 2) : 0);
$cinfo['commission3'] = array('default' => $set['level'] >= 3 ? $cinfo['commission3_rate'] > 0 ? round($cinfo['commission3_rate'] * $price / 100, 2) . "" : round($cinfo['commission3_pay'] * $cinfo['total'], 2) : 0);
} else {
$cinfo['commission1'] = array('default' => $set['level'] >= 1 ? round($set['commission1'] * $price / 100, 2) . "" : 0);
$cinfo['commission2'] = array('default' => $set['level'] >= 2 ? round($set['commission2'] * $price / 100, 2) . "" : 0);
$cinfo['commission3'] = array('default' => $set['level'] >= 3 ? round($set['commission3'] * $price / 100, 2) . "" : 0);
foreach ($levels as $level) {
$cinfo['commission1']['level' . $level['id']] = $set['level'] >= 1 ? round($level['commission1'] * $price / 100, 2) . "" : 0;
$cinfo['commission2']['level' . $level['id']] = $set['level'] >= 2 ? round($level['commission2'] * $price / 100, 2) . "" : 0;
$cinfo['commission3']['level' . $level['id']] = $set['level'] >= 3 ? round($level['commission3'] * $price / 100, 2) . "" : 0;
}
}
if ($update) {
pdo_update('ewei_shop_order_goods', array('commission1' => iserializer($cinfo['commission1']), 'commission2' => iserializer($cinfo['commission2']), 'commission3' => iserializer($cinfo['commission3'])), array('id' => $cinfo['id']));
}
}
unset($cinfo);
}
return $goods;
}
示例6: getJsApiTicket
public function getJsApiTicket()
{
if (!empty($_W['account']['jsapi_ticket']) && is_array($_W['account']['jsapi_ticket']) && !empty($_W['account']['jsapi_ticket']['ticket']) && !empty($_W['account']['jsapi_ticket']['expire']) && $_W['account']['jsapi_ticket']['expire'] > TIMESTAMP) {
return $_W['account']['jsapi_ticket']['ticket'];
}
load()->func('communication');
$access_token = $this->getAccessToken();
if (is_error($access_token)) {
return $access_token;
}
$url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={$access_token}&type=jsapi";
$content = ihttp_get($url);
if (is_error($content)) {
return error(-1, '调用接口获取微信公众号 jsapi_ticket 失败, 错误信息: ' . $content['message']);
}
$result = @json_decode($content['content'], true);
if (empty($result) || intval($result['errcode']) != 0 || $result['errmsg'] != 'ok') {
return error(-1, '获取微信公众号 jsapi_ticket 结果错误, 错误信息: ' . $result['errmsg']);
}
$record = array();
$record['ticket'] = $result['ticket'];
$record['expire'] = TIMESTAMP + $result['expires_in'] - 200;
$row = array();
$row['jsapi_ticket'] = iserializer($record);
pdo_update('account_wechats', $row, array('acid' => $_W['account']['acid']));
$_W['account']['jsapi_ticket'] = $record;
return $record['ticket'];
}
示例7: doWebAdd
public function doWebAdd()
{
global $_GPC, $_W;
$id = intval($_GPC['id']);
if (!empty($id)) {
$item = pdo_fetch("SELECT * FROM " . tablename($this->headtable) . " WHERE id = :id", array(':id' => $id));
if (empty($item)) {
message('抱歉,喜帖不存在或是已经删除!', '', 'error');
}
$hslists = unserialize($item['hs_pic']);
if (is_array($hslists)) {
//兼容0.5数据
foreach ($hslists as &$h) {
if (is_array($h) && isset($h['attachment'])) {
$h = $h['attachment'];
}
}
unset($h);
}
}
if (checksubmit('submit')) {
if (empty($_GPC['title'])) {
message('请输入喜帖标题!');
}
$data = array('weid' => $_W['uniacid'], 'title' => $_GPC['title'], 'xl_name' => $_GPC['xl_name'], 'xn_name' => $_GPC['xn_name'], 'is_front' => $_GPC['is_front'], 'tel' => $_GPC['tel'], 'hy_time' => $_GPC['hy_time'], 'hy_addr' => $_GPC['hy_addr'], 'jw_addr' => $_GPC['hy_addr'], 'lng' => $_GPC['baidumap']['lng'], 'lat' => $_GPC['baidumap']['lat'], 'video' => $_GPC['video'], 'music' => $_GPC['music'], 'pwd' => $_GPC['pwd'], 'word' => htmlspecialchars_decode($_GPC['word']), 'province' => $_GPC['district']['province'], 'city' => $_GPC['district']['city'], 'dist' => $_GPC['district']['dist'], 'createtime' => TIMESTAMP, 'sendtitle' => $_GPC['sendtitle'], 'senddescription' => $_GPC['senddescription'], 'copyright' => htmlspecialchars_decode($_GPC['copyright']));
load()->func('file');
//上传图片
if (!empty($_GPC['art_pic']) && $_GPC['art_pic'] != $_GPC['art_pic_old']) {
file_delete($_GPC['art_pic_old']);
$data['art_pic'] = $_GPC['art_pic'];
}
if (!empty($_GPC['bg_pic']) && $_GPC['bg_pic'] != $_GPC['bg_pic_old']) {
file_delete($_GPC['bg_pic_old']);
$data['bg_pic'] = $_GPC['bg_pic'];
}
if (!empty($_GPC['donghua_pic']) && $_GPC['donghua_pic'] != $_GPC['donghua_pic_old']) {
file_delete($_GPC['donghua_pic_old']);
$data['donghua_pic'] = $_GPC['donghua_pic'];
}
if (!empty($_GPC['suolue_pic']) && $_GPC['suolue_pic'] != $_GPC['suolue_pic_old']) {
file_delete($_GPC['suolue_pic_old']);
$data['suolue_pic'] = $_GPC['suolue_pic'];
}
if (!empty($_GPC['music']) && $_GPC['music'] != $_GPC['music_old']) {
file_delete($_GPC['music_old']);
$data['music'] = $_GPC['music'];
}
if (is_array($_GPC['thumbs'])) {
$data['hs_pic'] = iserializer($_GPC['thumbs']);
}
if (empty($id)) {
pdo_insert($this->headtable, $data);
} else {
unset($data['createtime']);
pdo_update($this->headtable, $data, array('id' => $id));
}
message('喜帖信息更新成功!', $this->createWebUrl('manager'), 'success');
}
include $this->template('add');
}
示例8: receive
public function receive()
{
global $_W, $_GPC;
$type = $this->message['type'];
$uniacid = $_W['uniacid'];
$acid = $_W['acid'];
$openid = $this->message['from'];
$event = $this->message['event'];
$cfg = $this->module['config'];
file_put_contents(IA_ROOT . '/addons/fm_photosvote/test/fm_test.txt', iserializer($event));
if ($event == 'unsubscribe') {
$record = array('updatetime' => TIMESTAMP, 'follow' => '0', 'unfollowtime' => TIMESTAMP);
pdo_update('mc_mapping_fans', $record, array('openid' => $openid, 'acid' => $acid, 'uniacid' => $uniacid));
if ($cfg['isopenjsps']) {
$fmvotelog = pdo_fetchall("SELECT tfrom_user FROM " . tablename('fm_photosvote_votelog') . " WHERE from_user = :from_user and uniacid = :uniacid LIMIT 1", array(':from_user' => $openid, ':uniacid' => $uniacid));
foreach ($fmvotelog as $log) {
$fmprovevote = pdo_fetch("SELECT photosnum,hits FROM " . tablename('fm_photosvote_provevote') . " WHERE from_user = :from_user and uniacid = :uniacid LIMIT 1", array(':from_user' => $log['tfrom_user'], ':uniacid' => $uniacid));
pdo_update('fm_photosvote_provevote', array('lasttime' => TIMESTAMP, 'photosnum' => $fmprovevote['photosnum'] - 1, 'hits' => $fmprovevote['hits'] - 1), array('from_user' => $log['tfrom_user'], 'uniacid' => $uniacid));
}
pdo_delete('fm_photosvote_votelog', array('from_user' => $openid));
pdo_delete('fm_photosvote_bbsreply', array('from_user' => $openid));
}
} elseif ($event == 'subscribe') {
if ($cfg['oauthtype'] == 2) {
$wechats = pdo_fetch("SELECT * FROM " . tablename('account_wechats') . " WHERE uniacid = :uniacid ", array(':uniacid' => $_W['uniacid']));
$token = iunserializer($wechats['access_token']);
$arrlog = pdo_fetch("SELECT * FROM " . tablename('mc_mapping_fans') . " WHERE uniacid = :uniacid AND openid = :openid", array(':uniacid' => $_W['uniacid'], ':openid' => $openid));
$access_token = $token['token'];
$expire = $token['expire'];
if (time() >= $expire || empty($access_token)) {
$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" . $wechats['key'] . "&secret=" . $wechats['secret'];
$html = file_get_contents($url);
$arr = json_decode($html, true);
$access_token = $arr['access_token'];
$record = array();
$record['token'] = $access_token;
$record['expire'] = time() + 3600;
$row = array();
$row['access_token'] = iserializer($record);
pdo_update('account_wechats', $row, array('uniacid' => $_W['uniacid']));
}
$url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" . $access_token . "&openid=" . $openid . "&lang=zh_CN";
$html = file_get_contents($url);
$re = @json_decode($html, true);
if (!empty($arrlog)) {
$data = array('nickname' => $re['nickname'], 'unionid' => $re['unionid']);
pdo_update('mc_mapping_fans', $data, array('openid' => $openid));
} else {
$default_groupid = pdo_fetchcolumn('SELECT groupid FROM ' . tablename('mc_groups') . ' WHERE uniacid = :uniacid AND isdefault = 1', array(':uniacid' => $_W['uniacid']));
$nickname = $re['nickname'];
$data = array('uniacid' => $_W['uniacid'], 'nickname' => $re['nickname'], 'avatar' => $re['headimgurl'], 'groupid' => $default_groupid, 'createtime' => TIMESTAMP);
pdo_insert('mc_members', $data);
$id = pdo_insertid();
$data = array('nickname' => $re['nickname'], 'unionid' => $re['unionid'], 'uid' => $id);
pdo_update('mc_mapping_fans', $data, array('openid' => $openid));
}
}
}
}
示例9: cache_write
function cache_write($key, $data)
{
if (empty($key) || !isset($data)) {
return false;
}
$record = array();
$record['key'] = $key;
$record['value'] = iserializer($data);
return pdo_insert('core_cache', $record, true);
}
示例10: post
private function post()
{
global $_W, $engine;
if (!in_array($this->message['msgtype'], array('text', 'image'))) {
return false;
}
$member = $this->getMember();
$wall = pdo_fetch("SELECT * FROM " . tablename('wxwall_reply') . " WHERE rid = :rid LIMIT 1", array(':rid' => $member['rid']));
if (!empty($wall['timeout']) && $wall['timeout'] > 0 && TIMESTAMP - $member['lastupdate'] >= $wall['timeout']) {
$this->endContext();
return $this->respText('由于您长时间未操作,请重新进入微信墙!');
}
$this->refreshContext();
if (empty($wall['quit_command']) && $this->message['content'] == '退出' || !empty($wall['quit_command']) && $this->message['content'] == $wall['quit_command']) {
$this->endContext();
return $this->respText($wall['quit_tips']);
}
if (empty($member['nickname']) || empty($member['avatar'])) {
return $this->respText('发表话题前请完善您的基本信息,<a target="_blank" href="' . $this->createMobileUrl('register') . '">点击完善</a>。');
}
$data = array('rid' => $member['rid'], 'from_user' => $_W['member']['uid'], 'type' => $this->message['type'], 'createtime' => TIMESTAMP);
if (empty($wall['isshow']) && empty($member['isblacklist'])) {
$data['isshow'] = 1;
} else {
$data['isshow'] = 0;
}
if ($this->message['type'] == 'text') {
$data['content'] = $this->message['content'];
}
if ($this->message['type'] == 'image') {
load()->func('communication');
$image = ihttp_request($this->message['picurl']);
$partPath = IA_ROOT . '/' . $_W['config']['upload']['attachdir'] . '/';
do {
$filename = "images/{$_W['uniacid']}/" . date('Y/m/') . random(30) . '.jpg';
} while (file_exists($partPath . $filename));
file_write($filename, $image['content']);
$data['content'] = $filename;
}
if ($this->message['type'] == 'link') {
$data['content'] = iserializer(array('title' => $this->message['title'], 'description' => $this->message['description'], 'link' => $this->message['link']));
}
pdo_insert('wxwall_message', $data);
if (!empty($member['isblacklist'])) {
$content .= '你已被列入黑名单,发送的消息需要管理员审核!';
} elseif (!empty($wall['isshow'])) {
$content = '发送消息成功,请等待管理员审核';
} elseif (!empty($wall['send_tips'])) {
$content = $wall['send_tips'];
} else {
$content = '发送消息成功。';
}
return $this->respText($content);
}
示例11: cache_write
function cache_write($key, $data) {
if (empty($key) || empty($data)) {
return false;
}
$record = array();
$record['key'] = $key;
$record['value'] = iserializer($data);
$tmp = &cache_global($key);
$tmp = $data;
return pdo_insert('cache', $record, true);
}
示例12: doDisplay
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: db_table_serialize
function db_table_serialize($db, $dbname)
{
$tables = $db->fetchall('SHOW TABLES');
if (empty($tables)) {
return '';
}
$struct = array();
foreach ($tables as $value) {
$structs[] = db_table_schema($db, substr($value['Tables_in_' . $dbname], strpos($value['Tables_in_' . $dbname], '_') + 1));
}
return iserializer($structs);
}
示例14: fieldsFormSubmit
public function fieldsFormSubmit($rid = 0)
{
global $_GPC, $_W;
$id = intval($_GPC['reply_id']);
$insert = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'title' => $_GPC['title'], 'picture' => $_GPC['picture'], 'description' => $_GPC['description'], 'periodlottery' => intval($_GPC['periodlottery']), 'maxlottery' => intval($_GPC['maxlottery']), 'rule' => htmlspecialchars_decode($_GPC['rule']), 'default_tips' => $_GPC['default_tips'], 'hitcredit' => intval($_GPC['hitcredit']), 'misscredit' => intval($_GPC['misscredit']), 'starttime' => strtotime($_GPC['time']['start']), 'endtime' => strtotime($_GPC['time']['end']));
if (empty($id)) {
pdo_insert($this->tablename, $insert);
} else {
if (!empty($_GPC['picture']) && $_GPC['picture'] != $_GPC['picture-old']) {
load()->func('file');
file_delete($_GPC['picture-old']);
} else {
unset($insert['picture']);
}
pdo_update($this->tablename, $insert, array('id' => $id));
}
if (!empty($_GPC['award-title'])) {
foreach ($_GPC['award-title'] as $index => $title) {
if (empty($title)) {
continue;
}
$update = array('title' => $title, 'description' => $_GPC['award-description'][$index], 'probalilty' => $_GPC['award-probalilty'][$index], 'total' => $_GPC['award-total'][$index], 'activation_code' => '', 'activation_url' => '');
if (empty($update['inkind']) && !empty($_GPC['award-activation-code'][$index])) {
$activationcode = explode("\n", $_GPC['award-activation-code'][$index]);
$update['activation_code'] = iserializer($activationcode);
// $update['total'] = count($activationcode);
$update['activation_url'] = $_GPC['award-activation-url'][$index];
}
pdo_update('egg_award', $update, array('id' => $index));
}
}
//处理添加
if (!empty($_GPC['award-title-new'])) {
foreach ($_GPC['award-title-new'] as $index => $title) {
if (empty($title)) {
continue;
}
$insert = array('rid' => $rid, 'title' => $title, 'description' => $_GPC['award-description-new'][$index], 'probalilty' => $_GPC['award-probalilty-new'][$index], 'inkind' => intval($_GPC['award-inkind-new'][$index]), 'total' => intval($_GPC['award-total-new'][$index]), 'activation_code' => '', 'activation_url' => '');
if (empty($insert['inkind'])) {
$activationcode = explode("\n", $_GPC['award-activation-code-new'][$index]);
$insert['activation_code'] = iserializer($activationcode);
// $insert['total'] = count($activationcode);
$insert['activation_url'] = $_GPC['award-activation-url-new'][$index];
}
pdo_insert('egg_award', $insert);
}
}
}
示例15: getAll
public function getAll()
{
global $_W;
$path = IA_ROOT . "/addons/ewei_shop/data/perm";
if (!is_dir($path)) {
load()->func('file');
@mkdirs($path);
}
$cachefile = $path . "/plugins";
$plugins = iunserializer(@file_get_contents($cachefile));
if (!is_array($plugins)) {
$plugins = pdo_fetchall('select * from ' . tablename('ewei_shop_plugin') . ' order by displayorder asc');
file_put_contents($cachefile, iserializer($plugins));
}
return $plugins;
}