本文整理汇总了PHP中WeUtility::logging方法的典型用法代码示例。如果您正苦于以下问题:PHP WeUtility::logging方法的具体用法?PHP WeUtility::logging怎么用?PHP WeUtility::logging使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WeUtility
的用法示例。
在下文中一共展示了WeUtility::logging方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: template
public function template($filename, $flag = TEMPLATE_INCLUDEPATH)
{
global $_W, $_GPC;
$_W['template'] = $_W['account']['template'];
$_W['template']['source'] = $_W['account']['template'];
$source = IA_ROOT . "/addons/quicktemplate/{$this->mn}/{$_W['template']}/{$filename}.html";
$compile = IA_ROOT . "/data/tpl/app/{$_W['template']}/{$this->mn}/{$filename}.tpl.php";
if (!empty($_GPC['__template'])) {
$source = IA_ROOT . "/addons/quicktemplate/{$this->mn}/{$_GPC['__template']}/{$filename}.html";
if (!is_file($source)) {
die('invalid debug template ' . $_GPC['__template']);
}
}
if (!is_file($source)) {
$source = IA_ROOT . "/addons/{$this->mn}/template/mobile/{$filename}.html";
if (!is_file($source)) {
$source = "{$_W['template']['source']}/mobile/default/{$this->mn}/{$filename}.html";
if (!is_file($source)) {
$source = "{$_W['template']['source']}/mobile/{$_W['account']['template']}/{$filename}.html";
if (!is_file($source)) {
$source = "{$_W['template']['source']}/mobile/default/{$filename}.html";
if (!is_file($source)) {
exit("Error: template source '{$filename}' is not exist!");
}
}
}
}
}
WeUtility::logging('compile source', array($source, $compile));
if (DEVELOPMENT || !is_file($compile) || filemtime($source) > filemtime($compile)) {
template_compile($source, $compile, true);
}
return $compile;
}
示例2: start
public function start() {
if(empty($this->token)) {
exit('Access Denied');
}
if(!WeUtility::checkSign($this->token)) {;
exit('Access Denied');
}
if(strtolower($_SERVER['REQUEST_METHOD']) == 'get') {
exit($_GET['echostr']);
}
if(strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
$postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
$this->message = WeUtility::parse($postStr);
if (empty($this->message)) {
WeUtility::logging('waring', 'Request Failed');
exit('Request Failed');
}
WeUtility::logging('trace', $this->message);
$this->before();
$this->response = $this->matcher();
$this->response['content'] = $this->process();
if(empty($this->response['content']) || ($this->response['content']['type'] == 'text' && empty($this->response['content']['content'])) || ($this->response['content']['type'] == 'news' && empty($this->response['content']['items']))) {
$this->response['module'] = 'default';
$this->response['content'] = $this->process();
}
$this->after();
WeUtility::logging('response', $this->response);
exit(WeUtility::response($this->response['content']));
}
WeUtility::logging('waring', 'Request Failed');
exit('Request Failed');
}
示例3: fans_search
private function fans_search($user, $fields = array())
{
global $_W;
$fields_str = self::$select_fields;
$sql = "SELECT {$fields_str} FROM " . tablename(self::$t_sys_fans) . " a, " . tablename(self::$t_sys_member) . " b WHERE a.openid = :openid AND a.uniacid= :uniacid AND a.uid = b.uid";
$fans = pdo_fetch($sql, array(':openid' => $user, ':uniacid' => $_W['uniacid']));
WeUtility::logging('sql', $fans);
return $fans;
}
示例4: tryLink
private function tryLink()
{
global $_GPC, $_W, $_COOKIE;
yload()->classs('quick_link', 'translink');
$_link = new TransLink();
WeUtility::logging("shareby", array('GPC' => $_GPC['shareby'], 'cookie' => $_COOKIE['shareby' . $_W['weid']], 'fans' => $_W['fans']['from_user']));
if ($_GPC['shareby'] != $_W['fans']['from_user']) {
$_link->link($_W['weid'], $_W['fans']);
}
}
示例5: receive
public function receive()
{
if ($this->message['msgtype'] == 'event') {
if ($this->message['event'] == 'subscribe' && !empty($this->message['ticket'])) {
$scene_id = $this->message['eventkey'];
WeUtility::logging("Receiver:SUBSCRIBE", $scene_id);
} elseif ($this->message['event'] == 'SCAN') {
$scene_id = $this->message['eventkey'];
WeUtility::logging("Receiver:SCAN", $scene_id);
}
}
}
示例6: refreshUserInfo
private function refreshUserInfo($from_user)
{
$follower = $from_user;
$qr_mgr = new UserManager('');
$userInfo = $qr_mgr->getUserInfo($follower);
if (empty($userInfo) or empty($userInfo['nickname']) or empty($userInfo['avatar'])) {
$weapi = new WechatAPI();
$userInfo = $weapi->getUserInfo($follower);
$qr_mgr->saveUserInfo($userInfo);
}
WeUtility::logging('refresh', $userInfo);
}
示例7: curl_file_get_contents
public static function curl_file_get_contents($durl)
{
$r = null;
if (function_exists('curl_init') && function_exists('curl_exec')) {
WeUtility::logging("using curl");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $durl);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$r = curl_exec($ch);
curl_close($ch);
}
return $r;
}
示例8: fsock_http_request
public static function fsock_http_request($url, $timeout = 30)
{
$parsed = parse_url($url);
$host = $parsed['host'];
$path = $parsed['path'] . '?' . $parsed['query'];
$cookie = '';
$fp = fsockopen($host, 80, $errno, $errstr, $timeout);
WeUtility::logging('fsockopen', array($url, $errno, $errstr, $fp));
if (!$fp) {
return -1;
}
$out = "GET " . $path . " HTTP/1.1\r\n";
$out .= "Host: " . $host . "\r\n";
$out .= "Connection: Close\r\n";
$out .= "Cookie: " . $cookie . "\r\n\r\n";
fwrite($fp, $out);
fclose($fp);
}
示例9: notifyUpLevel
private function notifyUpLevel($weapi, $this_level_openid)
{
global $_W;
WeUtility::logging('notifyUpLevel begin', $this_level_openid);
$uplevel = pdo_fetch("SELECT * FROM " . tablename(self::$t_follow) . " WHERE weid=:weid AND follower=:follower", array(":weid" => $_W['weid'], ":follower" => $this_level_openid));
WeUtility::logging('notifyUpLevel begin2', $this_level_openid);
if (!empty($uplevel)) {
$fans = WechatUtil::fans_search($this_level_openid, array('nickname'));
WeUtility::logging('notifyUpLevel sendText begin', $uplevel['leader']);
$weapi->sendText($uplevel['leader'], '您的朋友' . $fans['nickname'] . '又获得了一个新的支持者,您也得到了相应积分奖励,请注意查收!');
}
WeUtility::logging('notifyUpLevel', $uplevel);
}
示例10: start
public function start()
{
global $_W;
if (empty($this->account)) {
exit('Miss Account.');
}
if (!$this->account->checkSign()) {
exit('Check Sign Fail.');
}
if (strtolower($_SERVER['REQUEST_METHOD']) == 'get') {
$row = array();
$row['isconnect'] = 1;
pdo_update('account', $row, array('acid' => $_W['acid']));
exit(htmlspecialchars($_GET['echostr']));
}
if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
$postStr = file_get_contents('php://input');
if (!empty($_GET['encrypt_type']) && $_GET['encrypt_type'] == 'aes') {
$postStr = $this->account->decryptMsg($postStr);
}
WeUtility::logging('trace', $postStr);
$message = $this->account->parse($postStr);
$this->message = $message;
if (empty($message)) {
WeUtility::logging('waring', 'Request Failed');
exit('Request Failed');
}
$_W['openid'] = $message['from'];
$_W['fans'] = array('from_user' => $_W['openid']);
$this->booking($message);
if ($message['event'] == 'unsubscribe') {
$this->receive(array(), array(), array());
exit;
}
$sessionid = md5($message['from'] . $message['to'] . $_W['uniacid']);
session_id($sessionid);
WeSession::start($_W['uniacid'], $_W['openid']);
$_SESSION['openid'] = $_W['openid'];
$pars = $this->analyze($message);
$pars[] = array('message' => $message, 'module' => 'default', 'rule' => '-1');
$hitParam['rule'] = -2;
$hitParam['module'] = '';
$hitParam['message'] = $message;
$hitKeyword = array();
$response = array();
foreach ($pars as $par) {
if (empty($par['module'])) {
continue;
}
$par['message'] = $message;
$response = $this->process($par);
if ($this->isValidResponse($response)) {
$hitParam = $par;
if (!empty($par['keyword'])) {
$hitKeyword = $par['keyword'];
}
break;
}
}
$response_debug = $response;
$pars_debug = $pars;
if ($hitParam['module'] == 'default' && is_array($response) && is_array($response['params'])) {
foreach ($response['params'] as $par) {
if (empty($par['module'])) {
continue;
}
$response = $this->process($par);
if ($this->isValidResponse($response)) {
$hitParam = $par;
if (!empty($par['keyword'])) {
$hitKeyword = $par['keyword'];
}
break;
}
}
}
WeUtility::logging('params', $hitParam);
WeUtility::logging('response', $response);
$resp = $this->account->response($response);
if (!empty($_GET['encrypt_type']) && $_GET['encrypt_type'] == 'aes') {
$resp = $this->account->encryptMsg($resp);
$resp = $this->account->xmlDetract($resp);
}
if ($_W['debug']) {
$_W['debug_data'] = array('resp' => $resp, 'is_default' => 0);
if (count($pars_debug) == 1) {
$_W['debug_data']['is_default'] = 1;
$_W['debug_data']['params'] = $response_debug['params'];
} else {
array_pop($pars_debug);
$_W['debug_data']['params'] = $pars_debug;
}
$_W['debug_data']['hitparam'] = $hitParam;
$_W['modules']['cover'] = array('title' => '入口封面', 'name' => 'cover');
load()->web('template');
$process = template('utility/emulator', TEMPLATE_FETCH);
echo json_encode(array('resp' => $resp, 'process' => $process));
exit;
}
ob_start();
//.........这里部分代码省略.........
示例11: array
$notify->saveData($input);
$data = $notify->getData();
$ordersetting = DBUtil::findUnique(DBUtil::$TABLE_ORDER_SETTING, array(":appid" => $data['appid']));
if (empty($data)) {
$notify->setReturnParameter("return_code", "FAIL");
$notify->setReturnParameter("return_msg", "通用订单参数格式校验错误");
WeUtility::logging('info', "通用订单回复参数格式校验错误");
exit($notify->createXml());
}
if ($data['result_code'] != 'SUCCESS' || $data['return_code'] != 'SUCCESS') {
$notify->setReturnParameter("return_code", "FAIL");
$notify->setReturnParameter("return_msg", "通用订单参数格式校验错误");
WeUtility::logging('info', "通用订单回复参数格式校验错误");
exit($notify->createXml());
}
//更新表订单信息
WeUtility::logging('info', "通知订单更新");
if ($notify->checkSign($ordersetting['shkey'])) {
DBUtil::update(DBUtil::$TABLE_ORDER_ORDER, array("status" => 3, 'paytime' => TIMESTAMP), array("outno" => $data['out_trade_no']));
$order = DBUtil::findUnique(DBUtil::$TABLE_ORDER_ORDER, array(":outno" => $data['out_trade_no']));
$notify->setReturnParameter("return_code", "SUCCESS");
$notify->setReturnParameter("return_msg", "OK");
exit($notify->createXml());
} else {
$notify->setReturnParameter("return_code", "FAIL");
$notify->setReturnParameter("return_msg", "通用订单签名校验错误");
WeUtility::logging('info', "通用订单签名校验错误");
exit($notify->createXml());
}
WeUtility::logging('info', "通用订单更新回复数据" . $data);
示例12: trackAccess
private function trackAccess($detail)
{
global $_W, $_GPC;
$credit_cost = 0;
if (!isset($_GPC['shareby'])) {
return;
}
$shareby = $_GPC['shareby'];
$track_type = $_GPC['track_type'];
$track_msg = $_GPC['track_msg'];
$credit = 0;
$clicker_id = $_W['fans']['from_user'];
$fans = $this->fans_search($shareby);
if (empty($fans)) {
return -1;
}
if (true) {
$cookie_name = "xc_article-1-" . $_W['weid'];
if (isset($_COOKIE[$cookie_name])) {
return 0;
} else {
setcookie($cookie_name, 'killed', TIMESTAMP + $this->module['config']['prohibit_site_click_interval']);
}
}
if (true) {
$cookie_name = "xc_article-1-" . $_W['weid'] . "-" . $shareby . "-" . $detail['id'];
if (isset($_COOKIE[$cookie_name])) {
return 0;
} else {
setcookie($cookie_name, 'killed', TIMESTAMP + $this->module['config']['prohibit_single_article_click_interval']);
}
}
$click_history = pdo_fetch("SELECT * FROM " . tablename('xc_article_share_track') . " WHERE weid=:weid AND shareby=:shareby AND detail_id=:detail_id AND track_type=:track_type AND clicker_id=:clicker_id", array(':weid' => $_W['weid'], ':shareby' => $shareby, ':detail_id' => $detail['id'], ':track_type' => 'click', ':clicker_id' => $clicker_id));
if (!empty($click_history)) {
return 0;
}
$per_user_credit = pdo_fetch("SELECT SUM(credit) as total_credit FROM " . tablename('xc_article_share_track') . " WHERE detail_id = :detail_id AND shareby=:shareby", array(':detail_id' => $detail['id'], ':shareby' => $shareby));
if ($track_type == 'click' and $detail['click_credit'] > 0) {
if (0 >= $detail['max_credit'] or $detail['per_user_credit'] > 0 and $per_user_credit['total_credit'] >= $detail['per_user_credit']) {
$credit = 0;
} else {
$credit = $detail['click_credit'];
$credit_cost += $credit;
}
$this->addCredit($shareby, $credit);
pdo_insert('xc_article_share_track', array('weid' => $_W['weid'], 'credit' => $credit, 'shareby' => $shareby, 'track_type' => $track_type, 'track_msg' => $track_msg, 'detail_id' => $detail['id'], 'title' => $detail['title'], 'access_time' => TIMESTAMP, 'ip' => getip(), 'clicker_id' => $clicker_id));
}
if ($track_type == 'click' and $detail['share_credit'] > 0 and !empty($shareby)) {
if ($credit >= $detail['max_credit']) {
$credit = 0;
} else {
$credit = $detail['share_credit'];
$credit_cost += $credit;
}
$share_credit_info = pdo_fetch("SELECT * FROM " . tablename('xc_article_share_track') . " WHERE weid=:weid AND shareby=:shareby AND detail_id=:detail_id AND track_type=:track_type", array(':weid' => $_W['weid'], ':shareby' => $shareby, ':detail_id' => $detail['id'], ':track_type' => 'share'));
if (false == $share_credit_info) {
$this->addCredit($shareby, $credit);
pdo_insert('xc_article_share_track', array('weid' => $_W['weid'], 'credit' => $credit, 'shareby' => $shareby, 'track_type' => 'share', 'track_msg' => $track_msg, 'detail_id' => $detail['id'], 'title' => $detail['title'], 'access_time' => TIMESTAMP, 'ip' => getip(), 'clicker_id' => $clicker_id));
}
}
if ($credit_cost > 0 and !empty($detail['id'])) {
$sql = "UPDATE " . tablename('xc_article_article') . " SET max_credit = max_credit - " . $credit_cost . " WHERE id=:id AND weid=:weid";
pdo_query($sql, array(":weid" => $_W['weid'], ":id" => $detail['id']));
}
WeUtility::logging('byebye ' . $shareby);
}
示例13: start
public function start()
{
global $_W;
if (empty($this->token)) {
exit('Access Denied');
}
if (!WeUtility::checkSign($this->token)) {
exit('Access Denied');
}
if (strtolower($_SERVER['REQUEST_METHOD']) == 'get') {
ob_clean();
ob_start();
exit($_GET['echostr']);
}
if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
$postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
$this->message = WeUtility::parse($postStr);
if (empty($this->message)) {
WeUtility::logging('waring', 'Request Failed');
exit('Request Failed');
}
$sessionid = md5($this->message['from'] . $this->message['to'] . $_W['weid']);
session_id($sessionid);
WeSession::$weid = $_W['weid'];
WeSession::$from = $this->message['from'];
WeSession::$expire = 3600;
WeSession::start();
WeUtility::logging('trace', $this->message);
$pars = $this->matcher();
$pars[] = array('module' => 'default', 'rule' => '-1');
foreach ($pars as $par) {
if (empty($par['module'])) {
continue;
}
$this->params = $par;
$this->response = $this->process();
if (is_array($this->response) && ($this->response['type'] == 'text' && !empty($this->response['content']) || $this->response['type'] == 'news' && !empty($this->response['items']) || !in_array($this->type, array('text', 'news')))) {
if (!empty($par['keyword'])) {
$this->keyword = $par['keyword'];
}
break;
}
}
WeUtility::logging('params', $this->params);
WeUtility::logging('response', $this->response);
$resp = WeUtility::response($this->response);
$mapping = array('[from]' => $this->message['from'], '[to]' => $this->message['to'], '[rule]' => $this->params['rule']);
echo str_replace(array_keys($mapping), array_values($mapping), $resp);
$subscribes = array();
foreach ($_W['account']['modules'] as $m) {
if (in_array($m['name'], $this->modules) && is_array($m['subscribes']) && !empty($m['subscribes'])) {
$subscribes[] = $m;
}
}
if (!empty($subscribes)) {
$this->subscribe($subscribes);
}
exit;
}
WeUtility::logging('waring', 'Request Failed');
exit('Request Failed');
}
示例14: file_get_contents
*/
$input = file_get_contents('php://input');
if (preg_match('/(\\<\\!DOCTYPE|\\<\\!ENTITY)/i', $input)) {
exit('fail');
}
libxml_disable_entity_loader(true);
$obj = simplexml_load_string($input, 'SimpleXMLElement', LIBXML_NOCDATA);
if ($obj instanceof SimpleXMLElement && !empty($obj->FeedBackId)) {
$data = array('openid' => trim($obj->OpenId), 'appid' => trim($obj->AppId), 'timestamp' => trim($obj->TimeStamp), 'msgtype' => trim($obj->MsgType), 'feedbackid' => trim($obj->FeedBackId), 'transid' => trim($obj->TransId), 'reason' => trim($obj->Reason), 'solution' => trim($obj->Solution), 'extinfo' => trim($obj->ExtInfo), 'appsignature' => trim($obj->AppSignature), 'signmethod' => trim($obj->SignMethod));
if (!empty($obj->PicInfo) && !empty($obj->PicInfo->item)) {
foreach ($obj->PicInfo->item as $item) {
$data['picinfo'][] = trim($item->PicUrl);
}
}
require '../../framework/bootstrap.inc.php';
WeUtility::logging('pay-rights', $input);
$_W['uniacid'] = pdo_fetchcolumn("SELECT uniacid FROM " . tablename('account_wechats') . " WHERE `key` = :key", array(':key' => $data['appid']));
$setting = uni_setting($_W['uniacid'], array('payment'));
$_W['weid'] = $_W['uniacid'];
if (empty($setting['payment'])) {
exit('failed');
}
$data['appkey'] = $setting['payment']['wechat']['signkey'];
if (!checkSign($data)) {
exit('failed');
}
if ($data['msgtype'] == 'request') {
$insert = array('weid' => $_W['weid'], 'openid' => $data['openid'], 'feedbackid' => $data['feedbackid'], 'transid' => $data['transid'], 'reason' => $data['reason'], 'solution' => $data['solution'], 'remark' => $data['extinfo'], 'createtime' => $data['timestamp'], 'status' => 0);
pdo_insert('shopping_feedback', $insert);
exit('success');
} elseif ($data['msgtype'] == 'confirm') {
示例15: saveUserInfo
public function saveUserInfo($info)
{
if (!isset($info['subscribe']) || $info['subscribe'] != 1) {
return;
}
WeUtility::logging('saveUserInfo', $info);
$from_user = $info['openid'];
load()->model('mc');
$uid = mc_openid2uid($from_user);
mc_update($uid, array('nickname' => $info['nickname'], 'gender' => $info['sex'], 'nationality' => $info['country'], 'resideprovince' => $info['province'], 'residecity' => $info['city'], 'avatar' => $info['headimgurl']));
}