本文整理汇总了PHP中getreward函数的典型用法代码示例。如果您正苦于以下问题:PHP getreward函数的具体用法?PHP getreward怎么用?PHP getreward使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getreward函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: auth
function auth($uId, $picData, $picExt = 'jpg', $isReward = false)
{
global $_SGLOBAL;
$pic = base64_decode($picData);
if (!$pic || strlen($pic) == strlen($picData)) {
$errCode = '200';
$errMessage = 'Error argument';
return new APIErrorResponse($errCode, $errMessage);
}
$secret = md5($_SGLOBAL['timestamp'] . "\t" . $_SGLOBAL['supe_uid']);
$picDir = S_ROOT . './data/avatar/' . substr($secret, 0, 1);
if (!is_dir($picDir)) {
if (!mkdir($picDir, 0777)) {
$errCode = '300';
$errMessage = 'Cannot create directory';
return new APIErrorResponse($errCode, $errMessage);
}
}
$picDir .= '/' . substr($secret, 1, 1);
if (!is_dir($picDir)) {
if (!@mkdir($picDir, 0777)) {
$errCode = '300';
$errMessage = 'Cannot create directory';
return new APIErrorResponse($errCode, $errMessage);
}
}
$picPath = $picDir . '/' . $secret . '.' . $picExt;
$fp = @fopen($picPath, 'wb');
if ($fp) {
if (fwrite($fp, $pic) !== FALSE) {
fclose($fp);
//The main table
updatetable('space', array('videostatus' => 1), array('uid' => $uId));
//Attached table
$fields = array('videopic' => $secret);
updatetable('spacefield', $fields, array('uid' => $uId));
$result = $_SGLOBAL['db']->affected_rows();
if ($isReward) {
// Bonus Points
getreward('videophoto', 1, $uId, '', 0);
}
return new APIResponse($result);
}
}
$errCode = '300';
$errMessage = 'Video Auth Error';
return new APIErrorResponse($errCode, $errMessage);
}
开发者ID:v998,项目名称:discuzx-en,代码行数:48,代码来源:VideoAuth.php
示例2: add
function add($uId, $appId, $appName, $privacy, $allowSideNav, $allowFeed, $allowProfileLink, $defaultBoxType, $defaultMYML, $defaultProfileLink, $version, $displayMethod, $displayOrder = null)
{
global $_SGLOBAL;
$sql = sprintf('SELECT appid FROM %s WHERE uid = %d AND appid = %d', tname('userapp'), $uId, $appId);
$query = $_SGLOBAL['db']->query($sql);
$row = $_SGLOBAL['db']->fetch_array($query);
if ($row['appid']) {
$errCode = '170';
$errMessage = 'Application has been already added';
return new APIErrorResponse($errCode, $errMessage);
}
switch ($privacy) {
case 'public':
$privacy = 0;
break;
case 'friends':
$privacy = 1;
break;
case 'me':
$privacy = 3;
break;
case 'none':
$privacy = 5;
break;
default:
$privacy = 0;
}
$narrow = $defaultBoxType == 'narrow' ? 1 : 0;
$setarr = array('uid' => $uId, 'appid' => $appId, 'appname' => $appName, 'privacy' => $privacy, 'allowsidenav' => $allowSideNav, 'allowfeed' => $allowFeed, 'allowprofilelink' => $allowProfileLink, 'narrow' => $narrow);
if ($displayOrder !== null) {
$setarr['displayorder'] = $displayOrder;
}
inserttable('userapp', $setarr);
$fields = array('uid' => $uId, 'appid' => $appId, 'profilelink' => $defaultProfileLink, 'myml' => $defaultMYML);
$result = inserttable('userappfield', $fields, 1);
$reward = getreward('installapp', 0, $uId, $appId, 0);
// update user
$_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET updatetime='{$_SGLOBAL['timestamp']}', credit=credit+{$reward['credit']}, experience=experience+{$reward['experience']} WHERE uid='{$uId}'");
$displayMethod = $displayMethod == 'iframe' ? 1 : 0;
$this->refreshApplication($appId, $appName, $version, $displayMethod, $narrow, null, null);
return new APIResponse($result);
}
开发者ID:v998,项目名称:discuzx-en,代码行数:42,代码来源:UserApplication.php
示例3: updatetable
//更新状态
updatetable('session', array('lastactivity' => $_SGLOBAL['timestamp']), array('uid' => $_SGLOBAL['supe_uid']));
}
$app = array();
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('myapp') . " WHERE appid='{$appid}' LIMIT 1");
if ($app = $_SGLOBAL['db']->fetch_array($query)) {
if ($app['flag'] < 0) {
showmessage('no_privilege_myapp');
}
}
//漫游
$my_appId = $appid;
$my_suffix = base64_decode(urldecode($_GET['my_suffix']));
$my_prefix = getsiteurl();
//奖励积分
getreward('useapp', 1, 0, $appid);
if (!$my_suffix) {
header('Location: userapp.php?id=' . $my_appId . '&my_suffix=' . urlencode(base64_encode('/')));
exit;
}
if (preg_match('/^\\//', $my_suffix)) {
$url = 'http://apps.manyou.com/' . $my_appId . $my_suffix;
} else {
if ($my_suffix) {
$url = 'http://apps.manyou.com/' . $my_appId . '/' . $my_suffix;
} else {
$url = 'http://apps.manyou.com/' . $my_appId;
}
}
if (strpos($my_suffix, '?')) {
$url = $url . '&my_uchId=' . $_SGLOBAL['supe_uid'] . '&my_sId=' . $_SCONFIG['my_siteid'];
开发者ID:shiyake,项目名称:php-ihome,代码行数:31,代码来源:userapp.php
示例4: inserttable
inserttable('poke', $setarr, 0, true);
//更新统计
if (!$oldpoke) {
$_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET pokenum=pokenum+1 WHERE uid='{$uid}'");
}
//更新我的好友关系热度
addfriendnum($tospace['uid'], $tospace['username']);
//发送邮件通知
smail($uid, '', cplang('poke_subject', array($_SN[$space['uid']], getsiteurl() . 'cp.php?ac=poke')), '', 'poke');
if ($op == 'reply') {
//删除招呼
$_SGLOBAL['db']->query("DELETE FROM " . tname('poke') . " WHERE uid='{$_SGLOBAL['supe_uid']}' AND fromuid='{$uid}'");
$_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET pokenum=pokenum-1 WHERE uid='{$_SGLOBAL['supe_uid']}' AND pokenum>0");
}
//奖励
getreward('poke', 1, 0, $uid);
//统计
updatestat('poke');
showmessage('poke_success', $_POST['refer'], 1, array($_SN[$tospace['uid']]));
}
} elseif ($op == 'ignore') {
$where = empty($uid) ? '' : "AND fromuid='{$uid}'";
$_SGLOBAL['db']->query("DELETE FROM " . tname('poke') . " WHERE uid='{$_SGLOBAL['supe_uid']}' {$where}");
//统计更新
$pokenum = getcount('poke', array('uid' => $space['uid']));
if ($pokenum != $space['pokenum']) {
updatetable('space', array('pokenum' => $pokenum), array('uid' => $space['uid']));
}
showmessage('has_been_hailed_overlooked');
} else {
$perpage = 20;
开发者ID:NaturalWill,项目名称:UCQA,代码行数:31,代码来源:cp_poke.php
示例5: cplang
case 'picid':
$fs['title_template'] = cplang('feed_click_pic');
$fs['title_data'] = array('touser' => "<a href=\"space.php?uid={$item['uid']}\">{$_SN[$item['uid']]}</a>", 'click' => $click['name']);
$fs['images'] = array(pic_get($item['filepath'], $item['thumb'], $item['remote']));
$fs['image_links'] = array("space.php?uid={$item['uid']}&do=album&picid={$item['picid']}");
$fs['body_general'] = $item['title'];
$note_type = 'clickpic';
$q_note = cplang('note_click_pic', array("space.php?uid={$item['uid']}&do=album&picid={$item['picid']}"));
break;
}
//Event Publishing
if (empty($item['friend']) && ckprivacy('click', 1)) {
feed_add('click', $fs['title_template'], $fs['title_data'], '', array(), $fs['body_general'], $fs['images'], $fs['image_links']);
}
//Reward visitors
getreward('click', 1, 0, $idtype . $id);
//Statistics
updatestat('click');
//Notice
notification_add($item['uid'], $note_type, $q_note);
showmessage('click_success', $_SGLOBAL['refer']);
} elseif ($_GET['op'] == 'show') {
foreach ($clicks as $key => $value) {
$value['clicknum'] = $item["click_{$key}"];
$value['classid'] = mt_rand(1, 4);
if ($value['clicknum'] > $maxclicknum) {
$maxclicknum = $value['clicknum'];
}
$clicks[$key] = $value;
}
$start = intval($_GET['start']);
开发者ID:v998,项目名称:discuzx-en,代码行数:31,代码来源:cp_click.php
示例6: exit
/*
[UCenter Home] (C) 2007-2008 Comsenz Inc.
$Id: do_login.php 8543 2008-08-21 05:51:48Z liguode $
*/
if (!defined('IN_UCHOME')) {
exit('Access Denied');
}
$uid = 0;
$email = '';
$_GET['hash'] = empty($_GET['hash']) ? '' : trim($_GET['hash']);
if ($_GET['hash']) {
list($uid, $email) = explode("\t", authcode($_GET['hash'], 'DECODE'));
$uid = intval($uid);
}
if ($uid && isemail($email)) {
//检查邮箱唯一性
if ($_SCONFIG['uniqueemail']) {
if (getcount('spacefield', array('email' => $email, 'emailcheck' => 1))) {
showmessage('uniqueemail_recheck');
}
}
// Bonus Points
getreward('realemail', 1, $uid);
//修改资料
updatetable('spacefield', array('email' => addslashes($email), 'emailcheck' => '1', 'newemail' => ''), array('uid' => $uid));
//跳转页面
showmessage('email_check_sucess', '', 1, array($email));
} else {
showmessage('email_check_error');
}
开发者ID:v998,项目名称:discuzx-en,代码行数:30,代码来源:do_emailcheck.php
示例7: empty
} else {
if (!empty($_SGET['op']) && $_SGET['op'] == 'digest') {
$cid = empty($_SGET['cid']) ? 0 : intval($_SGET['cid']);
if (empty($cid)) {
showmessage('not_found', S_URL);
}
$itemid = empty($_SGET['itemid']) ? 0 : intval($_SGET['itemid']);
if (empty($itemid)) {
showmessage('not_found', S_URL);
}
if ($cid && $itemid && $_SGLOBAL['supe_uid']) {
$query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('spacecomments') . ' WHERE cid=\'' . $cid . '\'');
if ($comment = $_SGLOBAL['db']->fetch_array($query)) {
if (intval($comment['digest']) == 0) {
//积分经验,奖励精华评论者
getreward('comment_digest', 1, $comment['authorid']);
$msg = addslashes($comment['message']) . "<br/><div class=\"old\">" . $lang['digest'] . "</div>";
$_SGLOBAL['db']->query("UPDATE " . tname('spacecomments') . " SET message='" . $msg . "' WHERE cid='" . $cid . "'");
}
$_SGLOBAL['db']->query('UPDATE ' . tname('spacecomments') . ' SET digest=1 WHERE cid=\'' . $cid . '\'');
}
}
}
}
$perpage = empty($_SCONFIG['commviewnum']) ? 50 : intval($_SCONFIG['commviewnum']);
//显示条数
$page = empty($_SGET['page']) ? 0 : intval($_SGET['page']);
$order = !empty($_SGET['order']) && in_array($_SGET['order'], array('1', '2', '3', '4')) ? intval($_SGET['order']) : 0;
$page = $page < 1 ? 1 : $page;
$start = ($page - 1) * $perpage;
$itemid = empty($_SGET['itemid']) ? 0 : intval($_SGET['itemid']);
开发者ID:superman1982,项目名称:ng-cms,代码行数:31,代码来源:viewcomment.php
示例8: modelpost
//.........这里部分代码省略.........
}
@unlink(A_DIR . '/' . $defaultmessage[$value['fieldname']]);
}
}
}
}
}
//内容
$setsqlarr = $uploadfilearr = $ids = array();
$setsqlarr = getsetsqlarr($resultmessage);
$uploadfilearr = $feedcolum = uploadfile($resultmessage, $_POST['mid'], $itemid, 0);
$setsqlarr['message'] = trim($_POST['message']);
$setsqlarr['postip'] = $_SGLOBAL['onlineip'];
if (!empty($uploadfilearr)) {
foreach ($uploadfilearr as $tmpkey => $tmpvalue) {
if (empty($tmpvalue['error'])) {
$setsqlarr[$tmpkey] = $tmpvalue['filepath'];
}
if (!empty($tmpvalue['aid'])) {
$ids[] = $tmpvalue['aid'];
}
}
}
//添加内容
if (!empty($modelsinfoarr['allowfilter'])) {
$setsqlarr = scensor($setsqlarr, 1);
}
if (!checkperm('allowdirectpost') || checkperm('managemodpost') || checkperm('allowdirectpost') && $op == 'update') {
//不需要审核时入message表
if ($op == 'add') {
$setsqlarr['itemid'] = $itemid;
//添加内容
inserttable($modelsinfoarr['modelname'] . 'message', $setsqlarr);
getreward('postinfo');
if (allowfeed() && !empty($_POST['addfeed']) && !empty($_SGLOBAL['supe_uid'])) {
$feed['icon'] = 'comment';
$feed['title_template'] = 'feed_model_title';
$murl = geturl('action/model/name/' . $modelsinfoarr['modelname'] . '/itemid/' . $itemid);
$aurl = A_URL;
if (empty($_SCONFIG['siteurl'])) {
$siteurl = getsiteurl();
$murl = $siteurl . $murl;
$aurl = $siteurl . $aurl;
} else {
$siteurl = S_URL_ALL;
}
$feed['title_data'] = array('modelname' => '<a href="' . $siteurl . '/m.php?name=' . $modelsinfoarr['modelname'] . '">' . $modelsinfoarr['modelalias'] . '</a>');
$feed['body_template'] = 'feed_model_message';
$feed['body_data'] = array('subject' => '<a href="' . $murl . '">' . $_POST['subject'] . '</a>', 'message' => cutstr(strip_tags(preg_replace("/\\[.+?\\]/is", '', $_POST['message'])), 150));
if (!empty($feedsubjectimg)) {
$feed['images'][] = array('url' => $aurl . '/' . $feedsubjectimg['subjectimage']['filepath'], 'link' => $murl);
} else {
foreach ($feedcolum as $feedimgvalue) {
if ($feedimgvalue['filepath']) {
$feed['images'][] = array('url' => $aurl . '/' . $feedimgvalue['filepath'], 'link' => $murl);
break;
}
}
if (empty($feed['images'])) {
$picurl = getmessagepic(stripslashes($_POST['message']));
if ($picurl && strpos($picurl, '://') === false) {
$picurl = $siteurl . '/' . $picurl;
}
if (!empty($picurl)) {
$feed['images'][] = array('url' => $picurl, 'link' => $murl);
}
开发者ID:superman1982,项目名称:ng-cms,代码行数:67,代码来源:model.func.php
示例9: cksearch
function cksearch($theurl)
{
global $_SGLOBAL, $_SCONFIG, $space;
$theurl = stripslashes($theurl) . "&page=" . $_GET['page'];
if ($searchinterval = checkperm('searchinterval')) {
$waittime = $searchinterval - ($_SGLOBAL['timestamp'] - $space['lastsearch']);
if ($waittime > 0) {
showmessage('search_short_interval', '', 1, array($waittime, $theurl));
}
}
if (!checkperm('searchignore')) {
$reward = getreward('search', 0);
if ($reward['credit'] || $reward['experience']) {
if (empty($_GET['confirm'])) {
$theurl .= '&confirm=yes';
showmessage('points_deducted_yes_or_no', '', 1, array($reward['credit'], $reward['experience'], $theurl));
} else {
if ($space['credit'] < $reward['credit'] || $space['experience'] < $reward['experience']) {
showmessage('points_search_error');
} else {
//扣分
$_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET lastsearch='{$_SGLOBAL['timestamp']}', credit=credit-{$reward['credit']}, experience=experience-{$reward['experience']} WHERE uid='{$_SGLOBAL['supe_uid']}'");
}
}
}
}
}
开发者ID:NaturalWill,项目名称:UCQA,代码行数:27,代码来源:function_common.php
示例10: foreach
}
$pollnum = 0;
foreach ($votekeys as $votekey) {
if (isset($options[$votekey]['num'])) {
$options[$votekey]['num']++;
$pollnum++;
} else {
showmessage('no_votekey');
}
}
$options = addslashes(serialize($options));
$voters[] = $ip;
$voters = addslashes(serialize($voters));
$_SGLOBAL['db']->query('UPDATE ' . tname('polls') . ' SET pollnum=pollnum+' . $pollnum . ', updatetime=' . $_SGLOBAL['timestamp'] . ', options=\'' . $options . '\', voters=\'' . $voters . '\' WHERE pollid=\'' . $pollid . '\'');
//积分 和 经验
getreward('postvote');
showmessage('do_success', geturl('action/poll/pollid/' . $pollid));
}
$poll['options'] = unserialize($poll['options']);
if (empty($poll['voters'])) {
$poll['voters'] = array();
} else {
$poll['voters'] = unserialize($poll['voters']);
}
//投票人数
$poll['votersnum'] = count($poll['voters']);
$poll['dateline'] = sgmdate($poll['dateline'], 'Y-m-d H:i:s');
$poll['updatetime'] = sgmdate($poll['updatetime'], 'Y-m-d H:i:s');
foreach ($poll['options'] as $key => $options) {
$options['percent'] = @sprintf("%01.2f", $options['num'] * 100 / $poll['pollnum']);
$poll['options'][$key] = $options;
开发者ID:hongz1125,项目名称:devil,代码行数:31,代码来源:poll.php
示例11: array
$psetarr = array('tagid' => $tagid, 'tid' => $tid, 'uid' => $_SGLOBAL['supe_uid'], 'username' => $_SGLOBAL['supe_username'], 'ip' => getonlineip(), 'dateline' => $_SGLOBAL['timestamp'], 'message' => $msg, 'isthread' => 1);
//添加
inserttable('post', $psetarr);
//更新群组统计
$_SGLOBAL['db']->query("UPDATE " . tname("mtag") . " SET threadnum=threadnum+1 WHERE tagid='{$tagid}'");
//统计
updatestat('thread');
//更新用户统计
if (empty($space['threadnum'])) {
$space['threadnum'] = getcount('thread', array('uid' => $space['uid']));
$threadnumsql = "threadnum=" . $space['threadnum'];
} else {
$threadnumsql = 'threadnum=threadnum+1';
}
//积分
$reward = getreward('publishthread', 0);
$_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET {$threadnumsql}, lastpost='{$_SGLOBAL['timestamp']}', updatetime='{$_SGLOBAL['timestamp']}', credit=credit+{$reward['credit']}, experience=experience+{$reward['experience']} WHERE uid='{$_SGLOBAL['supe_uid']}'");
$returnarr = array("tagid" => $tagid, "tid" => $tid);
echo json_encode($returnarr);
return;
}
if ($_GET['sync'] == 'false') {
if ($_POST['remember'] == "true") {
$_SGLOBAL['db']->query("UPDATE " . tname("space") . " SET overseas_tip='never' WHERE uid='" . $_SGLOBAL['supe_uid'] . "'");
$_SGLOBAL['db']->query("UPDATE " . tname("spaceforeign") . " SET sync='no' WHERE uid='" . $_SGLOBAL['supe_uid'] . "'");
}
return;
}
include template('cp_doing');
//ɸѡ
function ckicon_uid($feed)
开发者ID:shiyake,项目名称:php-ihome,代码行数:31,代码来源:cp_doing.php
示例12: exit
<?php
/*
[UCenter Home] (C) 2007-2008 Comsenz Inc.
$Id: cp_invite.php 12971 2009-07-31 07:04:02Z liguode $
*/
if (!defined('IN_UCHOME')) {
exit('Access Denied');
}
$siteurl = getsiteurl();
$maxcount = 50;
//最多好友邀请
$reward = getreward('invitecode', 0);
$appid = empty($_GET['app']) ? 0 : intval($_GET['app']);
$inviteapp = $invite_code = '';
if (empty($reward['credit']) || $appid) {
$reward['credit'] = 0;
$invite_code = space_key($space, $appid);
}
$siteurl = getsiteurl();
$spaceurl = $siteurl . 'space.php?uid=' . $_SGLOBAL['supe_uid'];
$mailvar = array("<a href=\"{$spaceurl}\">" . avatar($space['uid'], 'middle') . "</a><br>" . $_SN[$space['uid']], $_SN[$space['uid']], $_SCONFIG['sitename'], '', '', $spaceurl, '');
//取出相应的应用
$appinfo = array();
if ($appid) {
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('myapp') . " WHERE appid='{$appid}'");
$appinfo = $_SGLOBAL['db']->fetch_array($query);
if ($appinfo) {
$inviteapp = "&app={$appid}";
$mailvar[6] = $appinfo['appname'];
} else {
开发者ID:AlexChien,项目名称:ey_uhome,代码行数:31,代码来源:cp_invite.php
示例13: showmessage
//不能小于4个字符
showmessage('realname_too_short');
}
if ($setarr['name'] != $space['name'] || $setarr['namestatus']) {
//第一次填写实名
if ($_SCONFIG['realname'] && empty($space['name']) && $setarr['name'] != $space['name'] && $setarr['namestatus']) {
$reward = getreward('realname', 0);
if ($reward['credit']) {
$setarr['credit'] = $space['credit'] + $reward['credit'];
}
if ($reward['experience']) {
$setarr['experience'] = $space['experience'] + $reward['experience'];
}
} elseif ($_SCONFIG['realname'] && $space['namestatus'] && !checkperm('managename')) {
//扣减积分
$reward = getreward('editrealname', 0);
//积分
if ($space['name'] && $setarr['name'] != $space['name'] && ($reward['credit'] || $reward['experience'])) {
//验证经验值
if ($space['experience'] >= $reward['experience']) {
$setarr['experience'] = $space['experience'] - $reward['experience'];
} else {
showmessage('experience_inadequate', '', 1, array($space['experience'], $reward['experience']));
}
if ($space['credit'] >= $reward['credit']) {
$setarr['credit'] = $space['credit'] - $reward['credit'];
} else {
showmessage('integral_inadequate', '', 1, array($space['credit'], $reward['credit']));
}
}
}
开发者ID:AlexChien,项目名称:ey_uhome,代码行数:31,代码来源:cp_profile.php
示例14: empty
$Id: batch.download.php 13342 2009-09-16 05:43:20Z zhaofei $
*/
include_once './common.php';
$aid = empty($_GET['aid']) ? 0 : intval($_GET['aid']);
if (empty($aid)) {
exit('Access Denied');
}
$query = $_SGLOBAL['db']->query('SELECT a.*, i.* FROM ' . tname('attachments') . ' a LEFT JOIN ' . tname('spaceitems') . ' i ON i.itemid=a.itemid WHERE a.aid=\'' . $aid . '\'');
if ($item = $_SGLOBAL['db']->fetch_array($query)) {
//权限
$channel = $item['type'];
if (!checkperm('allowgetattach')) {
showmessage('no_permission');
}
//积分、经验
if (!getreward('download')) {
showmessage('credit_not_enough');
}
} else {
showmessage('not_found');
}
$_SGLOBAL['db']->query('UPDATE ' . tname('attachments') . ' SET downloads=downloads+1 WHERE aid=\'' . $aid . '\'');
$filename = A_DIR . '/' . $item['filepath'];
if (is_readable($filename)) {
if (!empty($item['isimage'])) {
echo '<img src="' . A_URL . '/' . $item['filepath'] . '" />';
} else {
header('Cache-control: max-age=31536000');
header('Expires: ' . gmdate('D, d M Y H:i:s', $_SGLOBAL['timestamp'] + 31536000) . ' GMT');
header('Content-Encoding: none');
$item['filename'] = strtolower($_SCONFIG['charset']) == 'utf-8' && strexists($_SERVER['HTTP_USER_AGENT'], 'MSIE') ? urlencode($item['filename']) : $item['filename'];
开发者ID:hongz1125,项目名称:devil,代码行数:31,代码来源:batch.download.php
示例15: addslashes
$message = addslashes("<div class=\"quote\"><span class=\"q\"><b>" . $_SN[$post['uid']] . "</b>: " . getstr($post['message'], 150, 0, 0, 0, 2, 1) . '</span></div>') . $message;
}
$anonymous = empty($_POST['anonymous']) ? 0 : intval($_POST['anonymous']);
$setarr = array('tagid' => intval($thread['tagid']), 'anonymous' => $anonymous, 'tid' => $tid, 'uid' => $_SGLOBAL['supe_uid'], 'username' => $_SGLOBAL['supe_username'], 'ip' => getonlineip(), 'dateline' => $_SGLOBAL['timestamp'], 'message' => $message);
$pid = inserttable('post', $setarr, 1);
//邮件通知
smail($thread['uid'], '', cplang('mtag_reply', array($_SN[$space['uid']], shtmlspecialchars(getsiteurl() . "space.php?uid={$thread['uid']}&do=thread&id={$thread['tid']}"))), '', 'mtag_reply');
//更新统计数据
$last_author_name = $anonymous ? 'null' : $_SGLOBAL[supe_username];
$_SGLOBAL['db']->query("UPDATE " . tname('thread') . "\r\n\t\tSET replynum=replynum+1, lastpost='{$_SGLOBAL['timestamp']}', lastauthor='{$last_author_name}', lastauthorid='{$_SGLOBAL['supe_uid']}'\r\n\t\tWHERE tid='{$tid}'");
//更新群组统计
$_SGLOBAL['db']->query("UPDATE " . tname("mtag") . " SET postnum=postnum+1 WHERE tagid='{$thread['tagid']}'");
//普通回复
if (empty($post) && $thread['uid'] != $_SGLOBAL['supe_uid']) {
//积分
getreward('replythread', 1, 0, $thread['tid']);
realname_set($thread['uid'], $thread['username']);
realname_get();
if (empty($mtag['viewperm'])) {
$fs = array();
$fs['icon'] = 'post';
$fs['body_template'] = '';
$fs['body_data'] = array();
$fs['body_general'] = '';
$fs['title_template'] = cplang('feed_thread_reply');
$fs['title_data'] = array('touser' => "<a href=\"space.php?uid={$thread['uid']}\">" . $_SN[$thread['uid']] . "</a>", 'thread' => "<a href=\"space.php?uid={$thread['uid']}&do=thread&id={$thread['tid']}\">{$thread['subject']}</a>");
if (ckprivacy('post', 1)) {
feed_add($fs['icon'], $fs['title_template'], $fs['title_data'], $fs['body_template'], $fs['body_data'], $fs['body_general']);
}
}
//通知
开发者ID:shiyake,项目名称:php-ihome,代码行数:31,代码来源:cp_thread.php
示例16: verifyevents
function verifyevents($eventids, $grade)
{
global $_SGLOBAL;
$allowmanage = checkperm('manageevent');
$managebatch = checkperm('managebatch');
$opnum = 0;
$eventarr = array();
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname("event") . " WHERE eventid IN (" . simplode($eventids) . ")");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
if ($allowmanage && !$managebatch) {
$opnum++;
}
}
if (!$allowmanage || !$managebatch && $opnum > 1) {
return array();
}
$grade = intval($grade);
if (!in_array($grade, array(-2, -1, 1, 2))) {
cpmessage('bad_event_grade');
// 错误的活动状态
}
$newids = $events = $actions = array();
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('event') . " WHERE eventid IN (" . simplode($eventids) . ")");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
if ($grade == $value['grade']) {
continue;
}
$newids[] = $value['eventid'];
$events[$value['eventid']] = $value;
if ($grade == -1) {
$actions[$value['eventid']] = "unverify";
//未通过审核
} elseif ($grade == 1) {
if ($value['grade'] == -2) {
$actions[$value['eventid']] = "open";
// 开启
} elseif ($value['grade'] < 1) {
$actions[$value['eventid']] = "verify";
// 通过审核
} elseif ($value['grade'] == 2) {
$actions[$value['eventid']] = "unrecommend";
// 取消推荐
}
} elseif ($grade == 2) {
//推荐奖励积分
getreward('recommendevent', 1, $value['uid'], '', 0);
$actions[$value['eventid']] = "recommend";
//推荐
} elseif ($grade == -2) {
$actions[$value['eventid']] = "close";
//关闭
}
}
if (empty($newids)) {
return array();
}
@(include_once S_ROOT . './data/data_eventclass.php');
$noteids = $note_inserts = array();
$feed_inserts = array();
foreach ($newids as $id) {
$event = $events[$id];
if ($grade >= 1 && $events[$id]['grade'] < 1 && $events[$id]['grade'] >= -1) {
// feed:发布活动
$poster = "";
if (empty($event['poster'])) {
$poster = $_SGLOBAL['eventclass'][$event['classid']]['poster'];
} else {
$poster = pic_get($event['poster'], $event['thumb'], $event['remote']);
}
$feedarr = array('appid' => UC_APPID, 'icon' => 'event', 'uid' => $event['uid'], 'username' => $event['username'], 'dateline' => $_SGLOBAL['timestamp'], 'title_template' => cplang('event_add'), 'title_data' => array('eventid' => $id, 'title' => $event['title']), 'body_template' => cplang('event_feed_info'), 'body_data' => array("eventid" => $id, "title" => $event['title'], "username" => $event['username'], 'starttime' => sgmdate('m-d H:i', $event['starttime']), 'endtime' => sgmdate('m-d H:i', $event['endtime']), 'province' => $event['province'], 'city' => $event['city'], 'location' => $event['location']), 'body_general' => '', 'image_1' => $poster, 'image_1_link' => 'space.php?do=event&id=' . $id, 'image_2' => '', 'image_2_link' => '', 'image_3' => '', 'image_3_link' => '', 'image_4' => '', 'image_4_link' => '', 'target_ids' => '', 'friend' => '');
$feedarr = sstripslashes($feedarr);
//去掉转义
$feedarr['title_data'] = serialize(sstripslashes($feedarr['title_data']));
//数组转化
$feedarr['body_data'] = serialize(sstripslashes($feedarr['body_data']));
//数组转化
$feedarr['hash_template'] = md5($feedarr['title_template'] . "\t" . $feedarr['body_template']);
//喜好hash
$feedarr['hash_data'] = md5($feedarr['title_template'] . "\t" . $feedarr['title_data'] . "\t" . $feedarr['body_template'] . "\t" . $feedarr['body_data']);
//合并hash
$feedarr = saddslashes($feedarr);
//增加转义
$feed_inserts[] = "('{$feedarr['appid']}', 'event', '{$feedarr['uid']}', '{$feedarr['username']}', '{$feedarr['dateline']}', '0', '{$feedarr['hash_template']}', '{$feedarr['hash_data']}', '{$feedarr['title_template']}', '{$feedarr['title_data']}', '{$feedarr['body_template']}', '{$feedarr['body_data']}', '{$feedarr['body_general']}', '{$feedarr['image_1']}', '{$feedarr['image_1_link']}', '{$feedarr['image_2']}', '{$feedarr['image_2_link']}', '{$feedarr['image_3']}', '{$feedarr['image_3_link']}', '{$feedarr['image_4']}', '{$feedarr['image_4_link']}', '', '{$id}', 'eventid')";
}
if ($event['uid'] != $_SGLOBAL['supe_uid']) {
// 自己的不发送通知
$noteids[] = $event[uid];
$note_msg = cplang('event_set_' . $actions[$id], array("space.php?do=event&id=" . $event['eventid'], $event['title']));
$note_inserts[] = "('{$event['uid']}', 'system', '1', '0', '', '" . addslashes($note_msg) . "', '{$_SGLOBAL['timestamp']}')";
}
}
unset($events);
//修改状态
if ($grade == 2) {
// 需要同时修改推荐时间
$_SGLOBAL['db']->query("UPDATE " . tname("event") . " SET grade='{$grade}', recommendtime='{$_SGLOBAL['timestamp']}' WHERE eventid IN (" . simplode($newids) . ")");
} else {
$_SGLOBAL['db']->query("UPDATE " . tname("event") . " SET grade='{$grade}' WHERE eventid IN (" . simplode($newids) . ")");
}
//通知
//.........这里部分代码省略.........
开发者ID:NaturalWill,项目名称:UCQA,代码行数:101,代码来源:admincp_event.php
示例17: inserttable
$newdoid = inserttable('doing', $arr, 1);
//事件feed
$feedarr = array('appid' => UC_APPID, 'icon' => 'doing', 'uid' => $userid, 'username' => $username, 'dateline' => $_SGLOBAL['timestamp'], 'title_template' => cplang('feed_doing_title'), 'title_data' => saddslashes(serialize(sstripslashes(array('message' => $Message)))), 'body_template' => '', 'body_data' => '', 'id' => $newdoid, 'idtype' => 'doid');
$feedarr['hash_template'] = md5($feedarr['title_template'] . "\t" . $feedarr['body_template']);
//喜好hash
$feedarr['hash_data'] = md5($feedarr['title_template'] . "\t" . $feedarr['title_data'] . "\t" . $feedarr['body_template'] . "\t" . $feedarr['body_data']);
//合并hash
inserttable('feed', $feedarr, 1);
updatestat('doing');
//更新空间note
$setarr = array('note' => $Message);
if (!empty($_POST['spacenote'])) {
$reward = getreward('updatemood', 0);
$setarr['spacenote'] = $Message;
} else {
$reward = getreward('doing', 0);
}
updatetable('spacefield', $setarr, array('uid' => $userid));
$setarr = array('updatetime' => "updatetime='{$_SGLOBAL['timestamp']}'", 'lastpost' => "lastpost='{$_SGLOBAL['timestamp']}'");
$_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET " . implode(',', $setarr) . " WHERE uid='{$userid}'");
//返回flag
if ($newdoid) {
$arrs = array('flag' => 'success');
} else {
$arrs = array('flag' => 'fail');
}
}
}
$result = json_encode($arrs);
$result = preg_replace("#\\\\u([0-9a-f]+)#ie", "iconv('UCS-2BE', 'UTF-8', pack('H4', '\\1'))", $result);
echo $result;
开发者ID:shiyake,项目名称:php-ihome,代码行数:31,代码来源:do_addnews.php
示例18: updatestat
//Statistics
updatestat('share');
// share notice
if ($note_uid && $note_uid != $_SGLOBAL['supe_uid']) {
notification_add($note_uid, 'sharenotice', $note_message);
}
// update user Statistics
if (empty($space['sharenum'])) {
$space['sharenum'] = getcount('share', array('uid' => $space['uid']));
$sharenumsql = "sharenum=" . $space['sharenum'];
} else {
$sharenumsql = 'sharenum=sharenum+1';
}
// points
$needle = $id ? $type . $id : '';
$reward = getreward('createshare', 0, 0, $needle);
$_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET {$sharenumsql}, lastpost='{$_SGLOBAL['timestamp']}', updatetime='{$_SGLOBAL['timestamp']}', credit=credit+{$reward['credit']}, experience=experience+{$reward['experience']} WHERE uid='{$_SGLOBAL['supe_uid']}'");
//̬
if (ckprivacy('share', 1)) {
include_once S_ROOT . './source/function_feed.php';
feed_publish($sid, 'sid', 1);
}
if ($_POST['topicid']) {
topic_join($_POST['topicid'], $_SGLOBAL['supe_uid'], $_SGLOBAL['supe_username']);
$url = 'space.php?do=topic&topicid=' . $_POST['topicid'] . '&view=share';
} else {
$url = $_POST['refer'];
}
showmessage('do_success', $url, 0);
}
//ʾ
开发者ID:v998,项目名称:discuzx-en,代码行数:31,代码来源:cp_share.php
示例19: deleteevents
function deleteevents($eventids)
{
global $_SGLOBAL;
$allowmanage = checkperm('manageevent');
$managebatch = checkperm('managebatch');
$delnum = 0;
$eventarr = $neweventids = $note_ids = $note_inserts = array();
//获取积分
$reward = getreward('delevent', 0);
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname("event") . " WHERE eventid IN (" . simplode($eventids) . ")");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
if ($allowmanage || $value['uid'] == $_SGLOBAL['supe_uid']) {
$eventarr[] = $value;
if (!$managebatch && $value['uid'] != $_SGLOBAL['supe_uid']) {
$delnum++;
}
}
}
if (empty($eventarr) || !$managebatch && $delnum > 1) {
return array();
}
foreach ($eventarr as $key => $value) {
$neweventids[] = $value['eventid'];
// [to do: 给活动参加者发通知。操作量太大,所以优先级:低]
if ($value['uid'] != $_SGLOBAL['supe_uid']) {
if ($allowmanage) {
//扣除积分
$_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET credit=credit-{$reward['credit']}, experience=experience-{$reward['experience']} WHERE uid='{$value['uid']}'");
}
$note_ids[] = $value['uid'];
$note_msg = cplang('event_set_delete', array($value['title']));
$note_inserts[] = "('{$value['uid']}', 'event', '1', '{$_SGLOBAL['supe_uid']}', '{$_SGLOBAL['supe_username']}', '" . addslashes($note_msg) . "', '{$_SGLOBAL['timestamp']}')";
}
}
//数据删除
$_SGLOBAL['db']->query("DELETE FROM " . tname('event') . " WHERE eventid IN (" . simplode($neweventids) . ")");
$_SGLOBAL['db']->query("DELETE FROM " . tname('eventpic') . " WHERE eventid IN (" . simplode($neweventids) . ")");
$_SGLOBAL['db']->query("DELETE FROM " . tname('eventinvite') . " WHERE eventid IN (" . simplode($neweventids) . ")");
//活动用户
$_SGLOBAL['db']->query("DELETE FROM " . tname('userevent') . " WHERE eventid IN (" . simplode($neweventids) . ")");
//评论
$_SGLOBAL['db']->query("DELETE FROM " . tname('comment') . " WHERE id IN (" . simplode($neweventids) . ") AND idtype='eventid'");
$_SGLOBAL['db']->query("DELETE FROM " . tname('feed') . " WHERE id IN (" . simplode($neweventids) . ") AND idtype='eventid'");
//删除举报
$_SGLOBAL['db']->query("DELETE FROM " . tname('report') . " WHERE id IN (" . simplode($neweventids) . ") AND idtype='eventid'");
//发送通知
if ($note_inserts) {
$_SGLOBAL['db']->query("INSERT INTO " . tname('notification') . " (`uid`, `type`, `new`, `authorid`, `author`, `note`, `dateline`) VALUES " . implode(',', $note_inserts));
$_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET notenum=notenum+1 WHERE uid IN (" . simplode($note_ids) . ")");
}
return $eventarr;
}
开发者ID:NaturalWill,项目名称:UCQA,代 |
请发表评论