本文整理汇总了PHP中insert_topic函数的典型用法代码示例。如果您正苦于以下问题:PHP insert_topic函数的具体用法?PHP insert_topic怎么用?PHP insert_topic使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了insert_topic函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
require_once APP_ROOT_PATH . "system/libs/user.php";
$root = array();
$share_id = intval($GLOBALS['request']['share_id']);
//没有分享ID直接退出
if ($share_id == 0) {
$root['status'] = -2;
output($root);
}
$content = strim($GLOBALS['request']['content']);
$source = strim($GLOBALS['request']['source']);
$source = str_replace("来自", "", $source);
$email = strim($GLOBALS['request']['email']);
$pwd = strim($GLOBALS['request']['pwd']);
$is_relay = intval($GLOBALS['request']['is_relay']);
$parent_id = intval($GLOBALS['request']['parent_id']);
if ($parent_id > 0) {
$parent_reply = $GLOBALS['db']->getRow("select id,user_id,user_name from " . DB_PREFIX . "topic_reply where id = " . $parent_id);
}
$result = do_login_user($email, $pwd);
$GLOBALS['user_info'] = $user_data = es_session::get('user_info');
$user_data['id'] = intval($user_data['id']);
if (intval($user_data['id']) == 0) {
$root['return'] = 0;
$root['user_login_status'] = 0;
$root['info'] = "请先登录";
output($root);
}
$root['user_login_status'] = 1;
$topic = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic where is_effect = 1 and is_delete = 0 and id = " . $share_id);
if (empty($topic)) {
$root['status'] = -3;
output($root);
}
$reply_data = array();
$reply_data['topic_id'] = $share_id;
$reply_data['user_id'] = intval($user_data['id']);
$reply_data['user_name'] = $user_data['user_name'];
$reply_data['reply_id'] = intval($parent_reply['id']);
$reply_data['reply_user_id'] = intval($parent_reply['user_id']);
$reply_data['reply_user_name'] = strim($parent_reply['user_name']);
$reply_data['create_time'] = get_gmtime();
$reply_data['is_effect'] = 1;
$reply_data['is_delete'] = 0;
$reply_data['content'] = valid_str($content);
$GLOBALS['db']->autoExecute(DB_PREFIX . "topic_reply", $reply_data);
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set reply_count = reply_count + 1,last_time = " . get_gmtime() . ",last_user_id=" . $user_data['id'] . " where id = " . $share_id);
increase_user_active($user_data['id'], "转发了一则分享");
if ($is_relay == 1) {
$cnt = $topic['content'] . "@" . $user_data['user_name'] . " 评论:" . valid_str($content);
$id = insert_topic($cnt, $title = "", $type = "", $group = "", $relay_id = $share_id, $fav_id = 0);
if ($id) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '" . $source . "' where id = " . intval($id));
}
}
$root['return'] = 1;
$root['status'] = 1;
output($root);
}
示例2: index
public function index()
{
require_once APP_ROOT_PATH . "system/libs/user.php";
$root = array();
$event_id = intval($GLOBALS['request']['event_id']);
//没有分享ID直接退出
if ($event_id == 0) {
$root['status'] = 0;
$root['info'] = "不存在的活动ID";
output($root);
}
$content = strim($GLOBALS['request']['content']);
$source = strim($GLOBALS['request']['source']);
$source = str_replace("来自", "", $source);
$email = strim($GLOBALS['request']['email']);
$pwd = strim($GLOBALS['request']['pwd']);
$result = do_login_user($email, $pwd);
$GLOBALS['user_info'] = $user_data = es_session::get('user_info');
$user_data['id'] = intval($user_data['id']);
if (intval($user_data['id']) == 0) {
$root['status'] = 0;
$root['user_login_status'] = 0;
$root['info'] = "请先登录";
output($root);
}
$root['user_login_status'] = 1;
$event_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event where is_effect = 1 and id = " . $event_id);
if (empty($event_info)) {
$root['status'] = 0;
$root['info'] = "不存在的活动ID";
output($root);
}
$reply_data = array();
$reply_data['rel_table'] = "event";
$reply_data['rel_id'] = intval($event_id);
$reply_data['content'] = valid_str($content);
if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) {
$message_effect = 0;
} else {
$message_effect = 1;
//$message_type['is_effect'];
}
$reply_data['is_effect'] = $message_effect;
$reply_data['create_time'] = get_gmtime();
$reply_data['user_id'] = intval($user_data['id']);
$GLOBALS['db']->autoExecute(DB_PREFIX . "message", $reply_data);
increase_user_active($user_data['id'], "点评了一个活动");
$title = "对" . $event_info['name'] . "发表了点评";
$url_route = array('rel_app_index' => 'youhui', 'rel_route' => 'edetail', 'rel_param' => 'id=' . $event_info['id']);
$tid = insert_topic($reply_data['content'], $title, "eventcomment", $group = "", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list = array(), $url_route);
if ($tid) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '" . $source . "' where id = " . intval($tid));
}
$GLOBALS['db']->query("update " . DB_PREFIX . "event set reply_count = reply_count+1 where id =" . $event_id);
$root['status'] = 1;
$root['info'] = "感谢您的点评";
output($root);
}
示例3: index
public function index()
{
$root = array();
$email = strim($GLOBALS['request']['email']);
//用户名或邮箱
$pwd = strim($GLOBALS['request']['pwd']);
//密码
$id = intval($GLOBALS['request']['id']);
//检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
if ($user_id > 0) {
$root['user_login_status'] = 1;
$goods_info = $GLOBALS['db']->getRow("select id from " . DB_PREFIX . "deal where id = " . $id . " and is_effect = 1 and is_delete = 0");
if ($goods_info) {
$sql = "INSERT INTO `" . DB_PREFIX . "deal_collect` (`id`,`deal_id`, `user_id`, `create_time`) select '0','" . $id . "','" . $user_id . "','" . TIME_UTC . "' from dual where not exists (select * from `" . DB_PREFIX . "deal_collect` where `deal_id`= '" . $id . "' and `user_id` = " . $user_id . ")";
$GLOBALS['db']->query($sql);
if ($GLOBALS['db']->affected_rows() > 0) {
//添加到动态
insert_topic("deal_collect", $id, $user_id, $GLOBALS['user_info']['user_name']);
$root['show_err'] = $GLOBALS['lang']['COLLECT_SUCCESS'];
} else {
$root['show_err'] = $GLOBALS['lang']['GOODS_COLLECT_EXIST'];
}
$root['response_code'] = 1;
} else {
$root['response_code'] = 0;
$root['show_err'] = $GLOBALS['lang']['INVALID_GOODS'];
}
} else {
$root['response_code'] = 0;
$root['show_err'] = "未登录";
$root['user_login_status'] = 0;
}
output($root);
}
示例4: syn_deal_status
function syn_deal_status($id)
{
$deals_time = TIME_UTC;
$deal_info = $GLOBALS['db']->getRow("select *,(start_time + enddate*24*3600 - " . $deals_time . ") as remain_time,(load_money/borrow_amount*100) as progress_point from " . DB_PREFIX . "deal where id = " . $id);
if ($deal_info['deal_status'] == 5) {
return true;
}
if ($deal_info['deal_status'] != 3) {
if ($deal_info['progress_point'] < 100) {
$data['load_money'] = $GLOBALS['db']->getOne("SELECT sum(money) FROM " . DB_PREFIX . "deal_load WHERE deal_id={$id} ");
$data['progress_point'] = $deal_info['progress_point'] = round($data['load_money'] / $deal_info['borrow_amount'] * 100, 2);
}
if (($deal_info['progress_point'] >= 100 || $data['progress_point'] >= 100) && floatval($deal_info['load_money']) >= floatval($deal_info['borrow_amount'])) {
if ($GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal_inrepay_repay WHERE deal_id={$id}") > 0) {
$data['deal_status'] = 5;
$repay_info = $GLOBALS['db']->getRow("SELECT sum(repay_money) As all_repay_money FROM " . DB_PREFIX . "deal_repay WHERE has_repay = 1 AND deal_id={$id}");
if ($repay_info) {
$data['repay_money'] = $repay_info['all_repay_money'];
}
$data['last_repay_time'] = $GLOBALS['db']->getOne("SELECT true_repay_time FROM " . DB_PREFIX . "deal_inrepay_repay WHERE deal_id={$id}");
} elseif ($deal_info['deal_status'] == 4 && $deal_info['repay_start_time'] > 0 || $deal_info['deal_status'] == 2 && $deal_info['repay_start_time'] > 0 && $deal_info['repay_start_time'] <= $deals_time) {
$repay_info = $GLOBALS['db']->getRow("SELECT sum(repay_money) As all_repay_money ,MAX(repay_time) AS last_repay_time FROM " . DB_PREFIX . "deal_repay WHERE has_repay=1 AND deal_id={$id}");
if (!empty($repay_info['all_repay_money'])) {
$data['repay_money'] = $repay_info['all_repay_money'];
$data['last_repay_time'] = $repay_info['last_repay_time'];
$data['next_repay_time'] = next_replay_month($repay_info['last_repay_time']);
} elseif ($deal_info['deal_status'] == 4) {
if ($deal_info['repay_time_type'] == 0) {
$data['next_repay_time'] = $deal_info['repay_start_time'] + $deal_info['repay_time'] * 24 * 3600;
} else {
if (is_last_repay($deal_info['loantype'])) {
$data['next_repay_time'] = next_replay_month($deal_info['repay_start_time'], $deal_info['repay_time']);
} else {
$data['next_repay_time'] = next_replay_month($deal_info['repay_start_time']);
}
}
}
$deal_rs = deal_repay_money($deal_info);
//判断是否完成还款
$need_repay_money = $deal_rs['remain_repay_money'];
if (floatval(round($data['repay_money'], 2)) >= floatval(round($need_repay_money, 2)) && $need_repay_money > 0) {
$data['deal_status'] = 5;
} else {
$data['deal_status'] = 4;
}
} else {
//获取最后一次的投标记录
if ($deal_info['success_time'] == 0) {
$data['success_time'] = $deal_info['success_time'] = $GLOBALS['db']->getOne("SELECT max(create_time) FROM " . DB_PREFIX . "deal_load WHERE deal_id={$id} ");
}
$data['deal_status'] = 2;
}
} elseif ($deal_info['remain_time'] <= 0 && $deal_info['deal_status'] == 1) {
//投标时间超出 更新为流标
$data['deal_status'] = 3;
//$data['bad_time'] = $deal_info['start_time'] + $deal_info['enddate']*24*3600;
$data['bad_time'] = TIME_UTC;
}
/*elseif($deal_info['remain_time'] > 0 && $deal_info['deal_status']==0){
$data['deal_status'] = 1;
}*/
}
//投标人数
$sdata = $GLOBALS['db']->getRow("SELECT count(*) as buy_count,sum(money) as load_money FROM " . DB_PREFIX . "deal_load WHERE deal_id={$id}");
$data['buy_count'] = $sdata['buy_count'];
$data['load_money'] = floatval($sdata['load_money']);
//流标 移入后台手动操作
/*if($deal_info['deal_status'] ==3 || $data['deal_status']==3){
//流标时返还
require_once APP_ROOT_PATH."system/libs/user.php";
$r_load_list = $GLOBALS['db']->getAll("SELECT id,user_id,money FROM ".DB_PREFIX."deal_load WHERE is_repay=0 AND deal_id=$id");
foreach($r_load_list as $k=>$v){
modify_account(array("money"=>$v['money']),$v['user_id'],"标:".$deal_info['id'].",流标返还");
$GLOBALS['db']->query("UPDATE ".DB_PREFIX."deal_load SET is_repay=1 WHERE id=".$v['id']);
}
//发送流标通知
if($deal_info['is_send_bad_msg']==0){
$data['is_send_bad_msg'] = 1;
//发邮件
send_deal_faild_mail_sms($id,$deal_info,$deal_info['user_id']);
//站内信
send_deal_faild_site_sms($id,$deal_info,$deal_info['user_id']);
//添加到动态
insert_topic("deal_bad",$id,$deal_info['user_id'],get_user_name($deal_info['user_id'],false),0);
}
}*/
//发送流标通知
if (($deal_info['deal_status'] == 3 || $data['deal_status'] == 3) && $deal_info['is_send_bad_msg'] == 0) {
$data['is_send_bad_msg'] = 1;
//发邮件
send_deal_faild_mail_sms($id, $deal_info, $deal_info['user_id']);
//站内信
send_deal_faild_site_sms($id, $deal_info, $deal_info['user_id']);
//添加到动态
insert_topic("deal_bad", $id, $deal_info['user_id'], get_user_name($deal_info['user_id'], false), 0);
}
//放款给用户 移入后台手动操作
/*if($deal_info['is_has_loans']==0 && $data['deal_status']==4){
$data['is_has_loans'] = 1;
//.........这里部分代码省略.........
示例5: do_event_submit
public function do_event_submit()
{
if ($GLOBALS['user_info']) {
$event_id = intval($_REQUEST['event_id']);
$event = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event where id = " . $event_id . " and is_effect = 1");
if ($event) {
if ($event['submit_begin_time'] > get_gmtime()) {
$result['status'] = 1;
$result['info'] = $GLOBALS['lang']['EVENT_NOT_START'];
} elseif ($event['submit_end_time'] < get_gmtime() && $event['submit_end_time'] != 0) {
$result['status'] = 1;
$result['info'] = $GLOBALS['lang']['EVENT_SUBMIT_END'];
} else {
$submit_id = intval($_REQUEST['submit_id']);
$submit_id = intval($GLOBALS['db']->getOne("select id from " . DB_PREFIX . "event_submit where event_id = " . $event_id . " and user_id = " . intval($GLOBALS['user_info']['id'])));
if ($submit_id) {
//已经报名,仅作修改
$GLOBALS['db']->query("delete from " . DB_PREFIX . "event_submit_field where submit_id = " . $submit_id);
$field_ids = $_REQUEST['field_id'];
foreach ($field_ids as $field_id) {
$current_result = addslashes(htmlspecialchars(trim($_REQUEST['result'][$field_id])));
$field_data = array();
$field_data['submit_id'] = $submit_id;
$field_data['field_id'] = $field_id;
$field_data['event_id'] = $event_id;
$field_data['result'] = $current_result;
$GLOBALS['db']->autoExecute(DB_PREFIX . "event_submit_field", $field_data, "INSERT");
}
$result['status'] = 2;
$result['info'] = "报名修改成功";
ajax_return($result);
}
//开始提交报名
$user_id = intval($GLOBALS['user_info']['id']);
$count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "event_submit where event_id = " . $event_id . " and user_id = " . $user_id);
if (intval($count) > 0) {
$result['status'] = 1;
$result['info'] = $GLOBALS['lang']['EVENT_SUBMITTED'];
} else {
$submit_data = array();
$submit_data['user_id'] = $user_id;
$submit_data['event_id'] = $event_id;
$submit_data['create_time'] = get_gmtime();
$GLOBALS['db']->autoExecute(DB_PREFIX . "event_submit", $submit_data, "INSERT");
$submit_id = $GLOBALS['db']->insert_id();
if ($submit_id) {
$field_ids = $_REQUEST['field_id'];
foreach ($field_ids as $field_id) {
$current_result = addslashes(htmlspecialchars(trim($_REQUEST['result'][$field_id])));
$field_data = array();
$field_data['submit_id'] = $submit_id;
$field_data['field_id'] = $field_id;
$field_data['event_id'] = $event_id;
$field_data['result'] = $current_result;
$GLOBALS['db']->autoExecute(DB_PREFIX . "event_submit_field", $field_data, "INSERT");
}
$GLOBALS['db']->query("update " . DB_PREFIX . "event set submit_count = submit_count+1 where id=" . $event_id);
//同步分享
$title = "报名参加了" . $event['name'];
$content = "报名参加了" . $event['name'] . " - " . $event['brief'];
$url_route = array('rel_app_index' => 'youhui', 'rel_route' => 'edetail', 'rel_param' => 'id=' . $event['id']);
$tid = insert_topic($content, $title, $type = "eventsubmit", $group = "", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list = array(), $url_route);
if ($tid) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($tid));
}
$result['status'] = 2;
$result['info'] = $GLOBALS['lang']['EVENT_SUBMIT_SUCCESS'];
} else {
$result['status'] = 1;
$result['info'] = $GLOBALS['lang']['EVENT_SUBMIT_FAILED'];
}
}
}
} else {
$result['status'] = 1;
$result['info'] = $GLOBALS['lang']['EVENT_NOT_EXIST'];
}
} else {
$result['status'] = 0;
}
ajax_return($result);
}
示例6: manage_block_topic
</div>
<br />
<div class="table_main">
<div id="container">
<?php
// blocco topic
if (@$_POST['block'] == 1) {
manage_block_topic($username, $id);
}
// cancello topic
if (@$_POST['delete_topic'] == 1) {
delete_topic($username, $id);
}
// aggiunta nuovo messaggio
if (@$_GET['send'] == 1) {
insert_topic(@$_POST['reply'], $id);
}
// sposto topic
if (@$_GET['move_topic'] == 1) {
move_topic(@$_POST['move_t_id'], @$_POST['to_forum']);
}
// setta topic
if (@$_GET['set_topic'] == 1) {
set_topic(@$_POST['set_topic'], $id);
}
$t_id = check_t_id($id);
$query = "SELECT id, f_id, t_id, author, title, data, replyof, last, ora, date \n\t\t FROM " . __PREFIX__ . "topic \n\t\t WHERE id = '" . $id . "' \n\t\t OR replyof = '" . $id . "' \n\t\t ORDER BY id, last DESC";
$res = mysql_query($query);
while ($row = mysql_fetch_row($res)) {
$query_2 = "SELECT email, web_site, msn, level, id, firma \n\t\t\t\t FROM " . __PREFIX__ . "users \n\t\t\t\t WHERE username = '" . $row[3] . "'";
$row_info = mysql_fetch_row(mysql_query($query_2));
示例7: add
public function add()
{
$ajax = intval($_REQUEST['ajax']);
if (!$GLOBALS['user_info']) {
showErr($GLOBALS['lang']['PLEASE_LOGIN_FIRST'], $ajax);
}
if ($_REQUEST['content'] == '') {
showErr($GLOBALS['lang']['MESSAGE_CONTENT_EMPTY'], $ajax);
}
//验证码
if (app_conf("VERIFY_IMAGE") == 1) {
$verify = md5(trim($_REQUEST['verify']));
$session_verify = es_session::get('verify');
if ($verify != $session_verify) {
showErr($GLOBALS['lang']['VERIFY_CODE_ERROR'], $ajax);
}
}
es_session::delete("verify");
if (!check_ipop_limit(get_client_ip(), "message", intval(app_conf("SUBMIT_DELAY")), 0)) {
showErr($GLOBALS['lang']['MESSAGE_SUBMIT_FAST'], $ajax);
}
$rel_table = $_REQUEST['rel_table'];
// $message_type = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."message_type where type_name='".$rel_table."' and type_name <> 'supplier'");
// if(!$message_type)
// {
// showErr($GLOBALS['lang']['INVALID_MESSAGE_TYPE'],$ajax);
// }
$message_group = $_REQUEST['message_group'];
//添加留言
$message['title'] = $_REQUEST['title'] ? htmlspecialchars(addslashes(valid_str($_REQUEST['title']))) : htmlspecialchars(addslashes(valid_str($_REQUEST['content'])));
$message['content'] = htmlspecialchars(addslashes(valid_str($_REQUEST['content'])));
$message['title'] = valid_str($message['title']);
if ($message_group) {
$message['title'] = "[" . $message_group . "]:" . $message['title'];
$message['content'] = "[" . $message_group . "]:" . $message['content'];
}
$message['create_time'] = get_gmtime();
$message['rel_table'] = $rel_table;
$rel_id = $message['rel_id'] = intval($_REQUEST['rel_id']);
$message['user_id'] = intval($GLOBALS['user_info']['id']);
if (isset($_REQUEST['is_effect'])) {
$message_effect = intval($_REQUEST['is_effect']);
} else {
if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) {
$message_effect = 0;
} else {
$message_effect = $message_type['is_effect'];
}
}
$message['is_effect'] = $message_effect;
$message['is_buy'] = intval($_REQUEST['is_buy']);
$message['contact'] = $_REQUEST['contact'] ? htmlspecialchars(addslashes($_REQUEST['contact'])) : '';
$message['contact_name'] = $_REQUEST['contact_name'] ? htmlspecialchars(addslashes($_REQUEST['contact_name'])) : '';
if ($message['is_buy'] == 1) {
if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_order_item as doi left join " . DB_PREFIX . "deal_order as do on doi.order_id = do.id where doi.deal_id = " . intval($message['rel_id']) . " and do.user_id = " . intval($message['user_id']) . " and do.pay_status = 2") == 0) {
showErr($GLOBALS['lang']['AFTER_BUY_MESSAGE_TIP'], $ajax);
}
}
$message['point'] = intval($_REQUEST['point']);
$GLOBALS['db']->autoExecute(DB_PREFIX . "message", $message);
$message_id = $GLOBALS['db']->insert_id();
if ($message['is_buy'] == 1) {
$deal_info = $GLOBALS['db']->getRow("select id,is_shop,name,sub_name from " . DB_PREFIX . "deal where id = " . $rel_id);
if ($deal_info) {
$attach_list = get_topic_attach_list();
if ($deal_info['is_shop'] == 0) {
$url_route = array('rel_app_index' => 'tuan', 'rel_route' => 'deal', 'rel_param' => 'id=' . $deal_info['id']);
$type = "tuancomment";
$locations = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_location_link where deal_id = " . intval($deal_info['id']));
$dp_title = "对" . $deal_info['sub_name'] . "的消费点评";
foreach ($locations as $location) {
insert_dp($dp_title, $message['content'], $location['location_id'], $message['point'], $is_buy = 1, $from = "tuan", $url_route, $message_id);
}
}
if ($deal_info['is_shop'] == 1) {
$url_route = array('rel_app_index' => 'shop', 'rel_route' => 'goods', 'rel_param' => 'id=' . $deal_info['id']);
$type = "shopcomment";
$locations = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_location_link where deal_id = " . intval($deal_info['id']));
$dp_title = "对" . $deal_info['sub_name'] . "的消费点评";
foreach ($locations as $location) {
insert_dp($dp_title, $message['content'], $location['location_id'], $message['point'], $is_buy = 1, $from = "shop", $url_route, $message_id);
}
}
if ($deal_info['is_shop'] == 2) {
$url_route = array('rel_app_index' => 'youhui', 'rel_route' => 'ydetail', 'rel_param' => 'id=' . $deal_info['id']);
$type = "youhuicomment";
$locations = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_location_link where deal_id = " . intval($deal_info['id']));
$dp_title = "对" . $deal_info['sub_name'] . "的消费点评";
foreach ($locations as $location) {
insert_dp($dp_title, $message['content'], $location['location_id'], $message['point'], $is_buy = 1, $from = "daijin", $url_route, $message_id);
}
}
increase_user_active(intval($GLOBALS['user_info']['id']), "点评了一个商品");
$title = "对" . $deal_info['sub_name'] . "发表了点评";
$tid = insert_topic($message['content'], $title, $type, $group = "", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list = array(), $url_route);
if ($tid) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($tid));
}
}
}
//.........这里部分代码省略.........
示例8: index
//.........这里部分代码省略.........
//file_put_contents(APP_ROOT_PATH. "sjmapi/log/bm_".strftime("%Y%m%d%H%M%S",time()).".txt",print_r($GLOBALS['request'],true));
//$bm = (unserialize($GLOBALS['request']['bm']));
foreach ($bm as $field_id => $bm_result) {
$field_data = array();
$field_data['submit_id'] = $submit_id;
$field_data['field_id'] = $field_id;
$field_data['event_id'] = $event_id;
$field_data['result'] = strim($bm_result);
$GLOBALS['db']->autoExecute(DB_PREFIX . "event_submit_field", $field_data, "INSERT");
}
$GLOBALS['db']->query("update " . DB_PREFIX . "event set submit_count = submit_count+1 where id=" . $event_id);
if ($event['is_auto_verify'] == 1) {
//自动审核,发券
$sn = verify_event_submit($submit_id);
}
//同步分享
// $title = "报名参加了".$event['name'];
// $content = "报名参加了".$event['name']." - ".$event['brief'];
// $url_route = array(
// 'rel_app_index' => 'youhui',
// 'rel_route' => 'edetail',
// 'rel_param' => 'id='.$event['id']
// );
// $tid = insert_topic($content,$title,$type="eventsubmit",$group="", $relay_id = 0, $fav_id = 0,$group_data ="",$attach_list=array(),$url_route);
// if($tid)
// {
// $GLOBALS['db']->query("update ".DB_PREFIX."topic set source_name = '".$GLOBALS['request']['source']."' where id = ".intval($tid));
// }
//同步分享
$title = "报名参加了" . $event['name'];
$content = "报名参加了" . $event['name'] . " - " . $event['brief'];
$url_route = array('rel_app_index' => 'index', 'rel_route' => 'event#' . $event['id'], 'rel_param' => '');
require_once APP_ROOT_PATH . "system/model/topic.php";
$tid = insert_topic($content, $title, $type = "eventsubmit", $group = "", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list = array(), $url_route);
if ($tid) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '" . $GLOBALS['request']['source'] . "' where id = " . intval($tid));
}
require_once APP_ROOT_PATH . "system/model/user.php";
modify_account(array("score" => "-" . $event['score_limit']), $user_id, "活动报名:" . $event['name']);
$root['return'] = 1;
$root['info'] = "报名成功";
if ($sn) {
$root['info'] .= " 验证码:" . $sn;
} else {
$root['info'] .= " 请等待审核";
}
rm_auto_cache("event", array("id" => $event['id']));
} else {
$root['return'] = 0;
$root['info'] = "报名失败";
}
}
}
} else {
$root['return'] = 0;
$root['info'] = "没有该活动数据";
}
} else {
$root['return'] = 0;
$root['user_login_status'] = 0;
$root['info'] = "请先登录";
}
output($root);
//报名
}
//报名结束
示例9: add
public function add()
{
global $user_info;
$ajax = intval($_REQUEST['ajax']);
if (!$user_info) {
showErr($GLOBALS['lang']['PLEASE_LOGIN_FIRST'], $ajax);
}
if ($_REQUEST['content'] == '') {
showErr($GLOBALS['lang']['MESSAGE_CONTENT_EMPTY'], $ajax);
}
if (!check_ipop_limit(get_client_ip(), "message", intval(app_conf("SUBMIT_DELAY")), 0)) {
showErr($GLOBALS['lang']['MESSAGE_SUBMIT_FAST'], $ajax);
}
$rel_table = addslashes(trim($_REQUEST['rel_table']));
$message_type = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message_type where type_name='" . $rel_table . "' and type_name <> 'supplier'");
if (!$message_type) {
showErr($GLOBALS['lang']['INVALID_MESSAGE_TYPE'], $ajax);
}
$message_group = addslashes(trim($_REQUEST['message_group']));
//添加留言
$message['title'] = $_REQUEST['title'] ? htmlspecialchars(addslashes(valid_str($_REQUEST['title']))) : htmlspecialchars(addslashes(valid_str($_REQUEST['content'])));
$message['content'] = htmlspecialchars(addslashes(valid_str($_REQUEST['content'])));
$message['title'] = valid_str($message['title']);
if ($message_group) {
$message['title'] = "[" . $message_group . "]:" . $message['title'];
$message['content'] = "[" . $message_group . "]:" . $message['content'];
}
$message['create_time'] = get_gmtime();
$message['rel_table'] = $rel_table;
$rel_id = $message['rel_id'] = addslashes(trim($_REQUEST['rel_id']));
$message['user_id'] = intval($GLOBALS['user_info']['id']);
if (intval($_REQUEST['city_id']) == 0) {
$message['city_id'] = $GLOBALS['deal_city']['id'];
} else {
$message['city_id'] = intval($_REQUEST['city_id']);
}
if (app_conf("USER_MESSAGE_AUTO_EFFECT") == 0) {
$message_effect = 0;
} else {
$message_effect = $message_type['is_effect'];
}
$message['is_effect'] = $message_effect;
$message['is_buy'] = intval($_REQUEST['is_buy']);
$message['contact'] = $_REQUEST['contact'] ? htmlspecialchars(addslashes($_REQUEST['contact'])) : '';
$message['contact_name'] = $_REQUEST['contact_name'] ? htmlspecialchars(addslashes($_REQUEST['contact_name'])) : '';
if ($message['is_buy'] == 1) {
if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_order_item as doi left join " . DB_PREFIX . "deal_order as do on doi.order_id = do.id where doi.deal_id = " . intval($message['rel_id']) . " and do.user_id = " . intval($message['user_id']) . " and do.pay_status = 2") == 0) {
showErr($GLOBALS['lang']['AFTER_BUY_MESSAGE_TIP'], $ajax);
}
}
$message['point'] = intval($_REQUEST['point']);
$GLOBALS['db']->autoExecute(DB_PREFIX . "message", $message);
$message_id = intval($GLOBALS['db']->insert_id());
if ($message['is_buy'] == 1) {
$message_id = $GLOBALS['db']->insert_id();
$attach_list = get_topic_attach_list();
$deal_info = $GLOBALS['db']->getRow("select id,is_shop,name,sub_name from " . DB_PREFIX . "deal where id = " . $rel_id);
if ($deal_info['is_shop'] == 0) {
$url_route = array('rel_app_index' => 'tuan', 'rel_route' => 'deal', 'rel_param' => 'id=' . $deal_info['id']);
$type = "tuancomment";
$locations = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_location_link where deal_id = " . $deal_info['id']);
$dp_title = "对" . $deal_info['sub_name'] . "的消费点评";
foreach ($locations as $location) {
insert_dp($dp_title, $message['content'], $location['location_id'], $message['point'], $is_buy = 1, $from = "tuan", $url_route, $message_id);
}
}
if ($deal_info['is_shop'] == 1) {
$url_route = array('rel_app_index' => 'shop', 'rel_route' => 'goods', 'rel_param' => 'id=' . $deal_info['id']);
$type = "shopcomment";
}
if ($deal_info['is_shop'] == 2) {
$url_route = array('rel_app_index' => 'youhui', 'rel_route' => 'ydetail', 'rel_param' => 'id=' . $deal_info['id']);
$type = "youhuicomment";
}
increase_user_active(intval($GLOBALS['user_info']['id']), "点评了一个团购");
$title = "对" . $deal_info['sub_name'] . "发表了点评";
$tid = insert_topic($message['content'], $title, $type, "share", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list = array(), $url_route);
if ($tid) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($tid));
}
}
showSuccess($GLOBALS['lang']['MESSAGE_POST_SUCCESS'], $ajax);
}
示例10: savereview
public function savereview()
{
$return["status"] = 0;
if (!$GLOBALS['user_info']) {
$return["status"] = 2;
$return["message"] = $GLOBALS['LANG']["PLEASE_LOGIN_FIRST"];
ajax_return($return);
exit;
}
//验证码
if (app_conf("VERIFY_IMAGE") == 1) {
$verify = md5(trim($_REQUEST['verify']));
$session_verify = es_session::get('verify');
if ($verify != $session_verify) {
$return["message"] = $GLOBALS['lang']['VERIFY_CODE_ERROR'];
ajax_return($return);
exit;
}
}
es_session::delete("verify");
//创建基础点评数据
$dp_data = array();
$dp_data['title'] = addslashes(htmlspecialchars($_REQUEST['dp_title']));
$dp_data['content'] = addslashes(htmlspecialchars($_REQUEST['content']));
$dp_data['create_time'] = get_gmtime();
$dp_data['point'] = intval($_REQUEST['dp_point']);
$dp_data['user_id'] = intval($GLOBALS['user_info']['id']);
$dp_data['supplier_location_id'] = intval($_REQUEST['supplier_location_id']);
$dp_data['status'] = 1;
if (count($_REQUEST['pics']) > 0) {
$dp_data['is_img'] = 1;
}
$dp_data['avg_price'] = floatval($_REQUEST['avg_price']);
$GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_dp", $dp_data, "INSERT");
$dp_id = $GLOBALS['db']->insert_id();
if ($dp_id > 0) {
increase_user_active(intval($GLOBALS['user_info']['id']), "发表了一则商户点评");
$GLOBALS['db']->query("update " . DB_PREFIX . "user set dp_count = dp_count + 1 where id = " . intval($GLOBALS['user_info']['id']));
//创建点评图库
if (isset($_REQUEST['pics']) && is_array($_REQUEST['pics']) && count($_REQUEST['pics']) > 0) {
$photos = $_REQUEST['pics'];
foreach ($photos as $pkey => $photo) {
$c_data = array();
$c_data['image'] = $photo;
$c_data['sort'] = 10;
$c_data['create_time'] = get_gmtime();
$c_data['user_id'] = intval($GLOBALS['user_info']['id']);
$c_data['supplier_location_id'] = intval($_REQUEST['supplier_location_id']);
$c_data['dp_id'] = $dp_id;
$c_data['brief'] = addslashes(htmlspecialchars($_REQUEST['brief'][$pkey]));
$c_data['status'] = 0;
$c_data['image_type'] = intval($_REQUEST['type'][$pkey]);
$GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_images", $c_data, "INSERT");
}
}
//创建点评评分
$point_Group = $_REQUEST['dp_point_group'];
foreach ($point_Group as $group_id => $point) {
$point_data = array();
$point_data['group_id'] = $group_id;
$point_data['dp_id'] = $dp_id;
$point_data['supplier_location_id'] = intval($_REQUEST['supplier_location_id']);
$point_data['point'] = intval($point);
$GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_dp_point_result", $point_data, "INSERT");
}
//创建点评分组的标签
$tag_group = $_REQUEST['dp_tags'];
foreach ($tag_group as $group_id => $tag_row) {
if (trim($tag_row) != '') {
$arr_rer = array(",", ",");
$arr_rep = array(" ", " ");
$tag_row = str_replace($arr_rer, $arr_rep, $tag_row);
$tag_row_data = array();
$tag_row_data['tags'] = $tag_row;
$tag_row_data['dp_id'] = $dp_id;
$tag_row_data['supplier_location_id'] = intval($_REQUEST['supplier_location_id']);
$tag_row_data['group_id'] = $group_id;
$GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_dp_tag_result", $tag_row_data, "INSERT");
review_supplier_location_match(intval($_REQUEST['supplier_location_id']), $tag_row, $group_id);
}
}
//分享
$supplier_info = $GLOBALS['db']->getRow("select name,id,new_dp_count_time from " . DB_PREFIX . "supplier_location where id = " . $dp_data['supplier_location_id']);
$title = "对" . $supplier_info['name'] . "发表了点评";
$url_route = array('rel_app_index' => 'youhui', 'rel_route' => 'store#view', 'rel_param' => 'id=' . $supplier_info['id']);
$tid = insert_topic($dp_data['content'], $title, "slocationcomment", $group = "", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list = array(), $url_route);
if ($tid) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($tid));
}
//更新统计
syn_supplier_locationcount($supplier_info);
cache_store_point($supplier_info['id']);
$cache_id = md5("store" . "view" . $supplier_info['id']);
$GLOBALS['tmpl']->clear_cache('store_view.html', $cache_id);
$return['status'] = 1;
} else {
$return['message'] = "数据库异常,提交失败";
}
ajax_return($return);
exit;
//.........这里部分代码省略.........
示例11: save
//.........这里部分代码省略.........
$info = $imagecls->getImageInfo(APP_ROOT_PATH . $deal_info['icon']);
$image_data['width'] = intval($info[0]);
$image_data['height'] = intval($info[1]);
$image_data['name'] = $deal_info['sub_name'];
$image_data['filesize'] = filesize(APP_ROOT_PATH . $deal_info['icon']);
$image_data['create_time'] = NOW_TIME;
$image_data['user_id'] = intval($GLOBALS['user_info']['id']);
$image_data['user_name'] = strim($GLOBALS['user_info']['user_name']);
$image_data['path'] = $deal_info['icon'];
$image_data['o_path'] = $deal_info['icon'];
$GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
$img_id = intval($GLOBALS['db']->insert_id());
$attach_list[] = array("type" => "image", "id" => intval($img_id));
}
} elseif ($result['youhui_id'] > 0) {
require_once APP_ROOT_PATH . "system/model/youhui.php";
$youhui_info = get_youhui($result['youhui_id']);
$type = "youhuicomment";
$url_route = array('rel_app_index' => 'index', 'rel_route' => 'youhui#' . $result['youhui_id'], 'rel_param' => '');
//同步图片
if ($youhui_info['icon']) {
require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
$imagecls = new es_imagecls();
$info = $imagecls->getImageInfo(APP_ROOT_PATH . $youhui_info['icon']);
$image_data['width'] = intval($info[0]);
$image_data['height'] = intval($info[1]);
$image_data['name'] = $youhui_info['name'];
$image_data['filesize'] = filesize(APP_ROOT_PATH . $youhui_info['icon']);
$image_data['create_time'] = NOW_TIME;
$image_data['user_id'] = intval($GLOBALS['user_info']['id']);
$image_data['user_name'] = strim($GLOBALS['user_info']['user_name']);
$image_data['path'] = $youhui_info['icon'];
$image_data['o_path'] = $youhui_info['icon'];
$GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
$img_id = intval($GLOBALS['db']->insert_id());
$attach_list[] = array("type" => "image", "id" => intval($img_id));
}
} elseif ($result['event_id'] > 0) {
require_once APP_ROOT_PATH . "system/model/event.php";
$event_info = get_event($result['youhui_id']);
$type = "eventcomment";
$url_route = array('rel_app_index' => 'index', 'rel_route' => 'event#' . $result['event_id'], 'rel_param' => '');
//同步图片
if ($event_info['icon']) {
require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
$imagecls = new es_imagecls();
$info = $imagecls->getImageInfo(APP_ROOT_PATH . $event_info['icon']);
$image_data['width'] = intval($info[0]);
$image_data['height'] = intval($info[1]);
$image_data['name'] = $event_info['name'];
$image_data['filesize'] = filesize(APP_ROOT_PATH . $event_info['icon']);
$image_data['create_time'] = NOW_TIME;
$image_data['user_id'] = intval($GLOBALS['user_info']['id']);
$image_data['user_name'] = strim($GLOBALS['user_info']['user_name']);
$image_data['path'] = $event_info['icon'];
$image_data['o_path'] = $event_info['icon'];
$GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
$img_id = intval($GLOBALS['db']->insert_id());
$attach_list[] = array("type" => "image", "id" => intval($img_id));
}
} else {
require_once APP_ROOT_PATH . "system/model/supplier.php";
$location_info = get_location($result['location_id']);
$type = "slocationcomment";
$url_route = array('rel_app_index' => 'index', 'rel_route' => 'store#' . $result['location_id'], 'rel_param' => '');
//同步图片
if ($location_info['preview']) {
require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
$imagecls = new es_imagecls();
$info = $imagecls->getImageInfo(APP_ROOT_PATH . $location_info['preview']);
$image_data['width'] = intval($info[0]);
$image_data['height'] = intval($info[1]);
$image_data['name'] = $location_info['name'];
$image_data['filesize'] = filesize(APP_ROOT_PATH . $location_info['preview']);
$image_data['create_time'] = NOW_TIME;
$image_data['user_id'] = intval($GLOBALS['user_info']['id']);
$image_data['user_name'] = strim($GLOBALS['user_info']['user_name']);
$image_data['path'] = $location_info['preview'];
$image_data['o_path'] = $location_info['preview'];
$GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
$img_id = intval($GLOBALS['db']->insert_id());
$attach_list[] = array("type" => "image", "id" => intval($img_id));
}
}
foreach ($_REQUEST['topic_image_id'] as $att_id) {
if (intval($att_id) > 0) {
$attach_list[] = array("type" => "image", "id" => intval($att_id));
}
}
require_once APP_ROOT_PATH . "system/model/topic.php";
$tid = insert_topic($content, "", $type, $group = "", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list, $url_route);
if ($tid) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($tid));
}
$result['jump'] = url($url_route['rel_app_index'], $url_route['rel_route'], $url_route['rel_param']);
ajax_return($result);
} else {
ajax_return($result);
}
}
示例12: add
public function add()
{
$ajax = intval($_REQUEST['ajax']);
if (!$GLOBALS['user_info']) {
showErr($GLOBALS['lang']['PLEASE_LOGIN_FIRST'], $ajax);
}
if ($_REQUEST['content'] == '') {
showErr($GLOBALS['lang']['MESSAGE_CONTENT_EMPTY'], $ajax);
}
//验证码
if (app_conf("VERIFY_IMAGE") == 1) {
$verify = md5(trim($_REQUEST['verify']));
$session_verify = es_session::get('verify');
if ($verify != $session_verify) {
showErr($GLOBALS['lang']['VERIFY_CODE_ERROR'], $ajax);
}
}
if (!check_ipop_limit(get_client_ip(), "message", intval(app_conf("SUBMIT_DELAY")), 0)) {
showErr($GLOBALS['lang']['MESSAGE_SUBMIT_FAST'], $ajax);
}
$forum_title = htmlspecialchars(addslashes(trim(valid_str($_REQUEST['forum_title']))));
$group_id = intval($_REQUEST['group_id']);
if ($group_id > 0) {
if ($forum_title == '') {
showErr("请输出发表的主题", $ajax);
}
$user_id = intval($GLOBALS['user_info']['id']);
$group_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic_group where id = " . $group_id);
if ($group_info['user_id'] != $user_id) {
if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_topic_group where group_id=" . $group_id . " and user_id = " . $user_id) == 0) {
showErr("不是本组会员, 不能发表主题", $ajax);
}
}
}
$title = htmlspecialchars(addslashes(trim(valid_str($_REQUEST['title']))));
$content = htmlspecialchars(addslashes(trim(valid_str($_REQUEST['content']))));
$group = htmlspecialchars(addslashes(trim($_REQUEST['group'])));
$group_data = addslashes(trim($_REQUEST['group_data']));
$type = addslashes(trim($_REQUEST['type']));
$tags_data = $_REQUEST['tag'];
$tags = array();
foreach ($tags_data as $tag_row) {
$tag_row_arr = explode(" ", $tag_row);
foreach ($tag_row_arr as $tag_item) {
$tag_item = trim($tag_item);
if (!in_array($tag_item, $tags)) {
$tags[] = addslashes(htmlspecialchars(trim($tag_item)));
}
}
}
$attach_list = get_topic_attach_list();
$id = insert_topic($content, $title, $type, $group, $relay_id = 0, $fav_id = 0, $group_data, $attach_list, $url_route = array(), $tags, '', '', $forum_title, $group_id);
if ($id) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($id));
increase_user_active(intval($GLOBALS['user_info']['id']), "发表了一则分享");
}
//验证码
if (app_conf("VERIFY_IMAGE") == 1) {
es_session::delete('verify');
}
if ($ajax == 1) {
$result['info'] = $GLOBALS['lang']['MESSAGE_POST_SUCCESS'];
$result['data'] = intval($id);
$result['status'] = 1;
ajax_return($result);
} else {
if ($group_id > 0) {
$url = url("shop", "group#forum", array("id" => $group_id));
}
showSuccess($GLOBALS['lang']['MESSAGE_POST_SUCCESS'], $ajax, $url);
}
// showSuccess($GLOBALS['lang']['MESSAGE_POST_SUCCESS'],$ajax);
}
示例13: savedebit
//.........这里部分代码省略.........
//推荐人
$work_id = strim($_REQUEST["work_id"]);
if ($work_id) {
$data["admin_id"] = $GLOBALS['db']->getOne("select id from " . DB_PREFIX . "admin where work_id = '" . $work_id . "'");
}
$module = "INSERT";
$jumpurl = url("debit", "debit_uc_center#order");
$condition = "";
$deal_id = $GLOBALS['db']->getOne("SELECT id FROM " . DB_PREFIX . "deal WHERE ((is_delete=2 or is_delete=3) or (is_delete=0 and publish_wait=1)) AND user_id=" . $GLOBALS['user_info']['id']);
if ($deal_id > 0) {
$module = "UPDATE";
if ($t == "save") {
$jumpurl = url("debit", "debit_uc_center#order");
}
$condition = "id = {$deal_id}";
} else {
if ($t == "save") {
$jumpurl = url("debit", "debit_uc_center#order");
}
}
$GLOBALS['db']->autoExecute(DB_PREFIX . "deal", $data, $module, $condition);
if ($module == "INSERT") {
$deal_id = $GLOBALS['db']->insert_id();
}
require_once APP_ROOT_PATH . 'app/Lib/deal.php';
$deal = get_deal($deal_id);
//发送验证通知
if ($t != "save" && trim(app_conf('CUSTOM_SERVICE')) != '' && ($GLOBALS['user_info']['idcardpassed'] == 0 || $GLOBALS['user_info']['incomepassed'] == 0 || $GLOBALS['user_info']['creditpassed'] == 0 || $GLOBALS['user_info']['workpassed'] == 0)) {
$ulist = explode(",", trim(app_conf('CUSTOM_SERVICE')));
$ulist = array_filter($ulist);
if ($ulist) {
$uuid = $ulist[array_rand($ulist)];
if ($uuid > 0) {
$content = app_conf("SHOP_TITLE") . "用户您好,请尽快上传必要信用认证材料(包括身份证认证、工作认证、收入认证、信用报告认证)。另外,多上传一些可选信用认证,有助于您提高借款额度,也有利于出借人更多的了解您的情况,以便让您更快的筹集到所需的资金。请您点击'我要贷款',之后点击相应的审核项目,进入后,可先阅读该项信用认证所需材料及要求,然后按要求上传资料即可。 如果您有任何问题请您拨打客服电话 " . app_conf('SHOP_TEL') . " 或给客服邮箱发邮件 " . app_conf("REPLY_ADDRESS") . " 我们会及时给您回复。";
require_once APP_ROOT_PATH . 'app/Lib/message.php';
//添加留言
$message['title'] = $content;
$message['content'] = htmlspecialchars(addslashes(valid_str($content)));
$message['title'] = valid_str($message['title']);
$message['create_time'] = TIME_UTC;
$message['rel_table'] = "deal";
$message['rel_id'] = $deal_id;
$message['user_id'] = $uuid;
$message['is_effect'] = 1;
$GLOBALS['db']->autoExecute(DB_PREFIX . "message", $message);
//添加到动态
insert_topic("message", $message['rel_id'], $message['user_id'], get_user_name($message['user_id'], false), $GLOBALS['user_info']['id']);
//自己给自己留言不执行操作
if ($deal['user_id'] != $message['user_id']) {
$msg_conf = get_user_msg_conf($deal['user_id']);
//站内信
if ($msg_conf['sms_asked'] == 1) {
$notices['shop_title'] = app_conf("SHOP_TITLE");
$notices['shop_tel'] = app_conf('SHOP_TEL');
$notices['shop_address'] = app_conf("REPLY_ADDRESS");
/*{$notice.shop_title}用户您好,请尽快上传必要信用认证材料(包括身份证认证、工作认证、收入认证、信用报告认证)。另外,多上传一些可选信用认证,有助于您提高借款额度,也有利于出借人更多的了解您的情况,以便让您更快的筹集到所需的资金。请您点击'我要贷款',之后点击相应的审核项目,进入后,可先阅读该项信用认证所需材料及要求,然后按要求上传资料即可。 如果您有任何问题请您拨打客服电话{$notice.shop_tel}或给客服邮箱发邮件{$notice.shop_address}我们会及时给您回复。*/
$notices['url'] = "“<a href=\"" . $deal_info['url'] . "\">" . $deal_info['name'] . "</a>”";
$notices['user_name'] = get_user_name($message['user_id']);
$notices['money'] = $user_load_data['true_repay_money'] + $user_load_data['impose_money'];
$tmpl_content = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_WORDS_MSG'", false);
$GLOBALS['tmpl']->assign("notice", $notices);
$contents = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content['content']);
send_user_msg("", $contents, 0, $deal['user_id'], TIME_UTC, 0, true, 13, $message['rel_id']);
}
//邮件
if ($msg_conf['mail_asked'] == 1 && app_conf('MAIL_ON') == 1) {
$tmpl = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_MAIL_DEAL_MSG'");
$tmpl_content = $tmpl['content'];
$notice['user_name'] = $GLOBALS['user_info']['user_name'];
$notice['msg_user_name'] = get_user_name($message['user_id'], false);
$notice['deal_name'] = $deal['name'];
$notice['deal_url'] = SITE_DOMAIN . url("index", "deal", array("id" => $deal['id']));
$notice['message'] = $message['content'];
$notice['site_name'] = app_conf("SHOP_TITLE");
$notice['site_url'] = SITE_DOMAIN . APP_ROOT;
$notice['help_url'] = SITE_DOMAIN . url("index", "helpcenter");
$GLOBALS['tmpl']->assign("notice", $notice);
$msg = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content);
$msg_data['dest'] = $GLOBALS['user_info']['email'];
$msg_data['send_type'] = 1;
$msg_data['title'] = get_user_name($message['user_id'], false) . "给您的标留言!";
$msg_data['content'] = addslashes($msg);
$msg_data['send_time'] = 0;
$msg_data['is_send'] = 0;
$msg_data['create_time'] = TIME_UTC;
$msg_data['user_id'] = $GLOBALS['user_info']['id'];
$msg_data['is_html'] = $tmpl['is_html'];
$GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data);
//插入
}
}
}
}
}
if ($is_ajax == 1) {
showSuccess("提交成功,请等待管理员审核", $is_ajax, $jumpurl);
} else {
app_redirect($jumpurl);
}
}
示例14: publish_save
/**
* 快捷发布保存
*/
public function publish_save()
{
global_run();
$ajax = intval($_REQUEST['ajax']);
if (check_save_login() == LOGIN_STATUS_NOLOGIN) {
showErr($GLOBALS['lang']['PLEASE_LOGIN_FIRST'], $ajax);
}
if ($_REQUEST['content'] == '') {
showErr($GLOBALS['lang']['MESSAGE_CONTENT_EMPTY'], $ajax);
}
if (!check_ipop_limit(get_client_ip(), "message", intval(app_conf("SUBMIT_DELAY")), 0)) {
showErr($GLOBALS['lang']['MESSAGE_SUBMIT_FAST'], $ajax);
}
$forum_title = strim(valid_str($_REQUEST['forum_title']));
$group_id = intval($_REQUEST['group_id']);
$syn_weibo = intval($_REQUEST['syn_weibo']);
if ($group_id > 0) {
if ($forum_title == '') {
showErr("请输出发表的主题", $ajax);
}
$user_id = intval($GLOBALS['user_info']['id']);
$group_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic_group where id = " . $group_id);
if ($group_info['user_id'] != $user_id) {
if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_topic_group where group_id=" . $group_id . " and user_id = " . $user_id) == 0) {
//不是会员自动加入小组
$ins_user_topic = array('group_id' => $group_id, 'user_id' => $user_id, 'create_time' => NOW_TIME, 'type' => 0);
$GLOBALS['db']->autoExecute(DB_PREFIX . "user_topic_group", $ins_user_topic);
$id = $GLOBALS['db']->insert_id();
if ($id) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic_group set user_count = user_count + 1 where id=" . $group_id);
}
}
}
}
$title = strim(valid_str($_REQUEST['title']));
$content = strim(valid_str($_REQUEST['content']));
$group = strim($_REQUEST['group']);
$group_data = strim($_REQUEST['group_data']);
$type = strim($_REQUEST['type']);
$tags_data = $_REQUEST['tags'];
$tags = array();
if ($tags_data) {
$tag_row_arr = explode(" ", $tags_data);
foreach ($tag_row_arr as $tag_item) {
$tag_item = strim($tag_item);
if (!in_array($tag_item, $tags)) {
$tags[] = strim($tag_item);
}
}
} elseif ($forum_title) {
$tags = div_str($forum_title);
if (count($tags) > 5) {
$tags = array_slice($tags, 0, 4);
}
}
$ungroup_date = unserialize(base64_decode($group_data));
$url_route = array('rel_app_index' => $ungroup_date['url']['app_index'], 'rel_route' => $ungroup_date['url']['route'], 'rel_param' => '');
$attach_list = get_topic_attach_list();
require_once APP_ROOT_PATH . '/system/model/topic.php';
$id = insert_topic($content, $title, $type, $group, $relay_id = 0, $fav_id = 0, $group_data, $attach_list, $url_route, $tags, '', '', $forum_title, $group_id, $syn_weibo);
if ($id) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($id));
increase_user_active(intval($GLOBALS['user_info']['id']), "发表了一则分享");
}
if ($ajax == 1) {
$result['info'] = $GLOBALS['lang']['MESSAGE_POST_SUCCESS'];
$result['data'] = intval($id);
$result['status'] = 1;
ajax_return($result);
} else {
if ($group_id > 0) {
$url = url("index", "group#forum", array("id" => $group_id));
}
showSuccess($GLOBALS['lang']['MESSAGE_POST_SUCCESS'], $ajax, $url);
}
}
示例15: do_submit
//.........这里部分代码省略.........
}
$user_id = intval($GLOBALS['user_info']['id']);
$user_submit = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event_submit where user_id = " . $user_id . " and event_id = " . $event_id);
if ($user_submit) {
if ($user_submit['is_verify'] == 1) {
$data['status'] = 0;
$data['info'] = "您已经报名";
ajax_return($data);
} elseif ($user_submit['is_verify'] == 2) {
$data['status'] = 0;
$data['info'] = "您的报名审核不通过";
ajax_return($data);
} else {
//已经报名,仅作修改
$GLOBALS['db']->query("delete from " . DB_PREFIX . "event_submit_field where submit_id = " . $user_submit['id']);
$field_ids = $_REQUEST['field_id'];
foreach ($field_ids as $field_id) {
$current_result = strim($_REQUEST['result'][$field_id]);
$field_data = array();
$field_data['submit_id'] = $user_submit['id'];
$field_data['field_id'] = $field_id;
$field_data['event_id'] = $event_id;
$field_data['result'] = $current_result;
$GLOBALS['db']->autoExecute(DB_PREFIX . "event_submit_field", $field_data, "INSERT");
}
$result['status'] = 1;
$result['info'] = "报名修改成功";
ajax_return($result);
}
} else {
$GLOBALS['db']->query("update " . DB_PREFIX . "event set submit_count = submit_count+1 where id=" . $event_id . " and submit_count + 1 <= total_count and total_count > 0");
if (!$GLOBALS['db']->affected_rows()) {
$data['status'] = 0;
$data['info'] = "活动名额已满";
ajax_return($data);
}
if ($event['score_limit'] > 0 || $event['point_limit'] > 0) {
$c_user_info = $GLOBALS['user_info'];
if ($c_user_info['score'] < $event['score_limit']) {
$data['status'] = 0;
$data['info'] = "积分不足,不能报名";
ajax_return($data);
}
if ($c_user_info['point'] < $event['point_limit']) {
$data['status'] = 0;
$data['info'] = "经验不足,不能报名";
ajax_return($data);
}
}
$submit_data = array();
$submit_data['user_id'] = $user_id;
$submit_data['event_id'] = $event_id;
$submit_data['create_time'] = NOW_TIME;
$submit_data['event_begin_time'] = $event['event_begin_time'];
$submit_data['event_end_time'] = $event['event_end_time'];
$submit_data['return_money'] = $event['return_money'];
$submit_data['return_score'] = $event['return_score'];
$submit_data['return_point'] = $event['return_point'];
$GLOBALS['db']->autoExecute(DB_PREFIX . "event_submit", $submit_data, "INSERT");
$submit_id = $GLOBALS['db']->insert_id();
if ($submit_id) {
$field_ids = $_REQUEST['field_id'];
foreach ($field_ids as $field_id) {
$current_result = strim($_REQUEST['result'][$field_id]);
$field_data = array();
$field_data['submit_id'] = $submit_id;
$field_data['field_id'] = $field_id;
$field_data['event_id'] = $event_id;
$field_data['result'] = $current_result;
$GLOBALS['db']->autoExecute(DB_PREFIX . "event_submit_field", $field_data, "INSERT");
}
if ($event['is_auto_verify'] == 1) {
//自动审核,发券
$sn = verify_event_submit($submit_id);
}
//同步分享
$title = "报名参加了" . $event['name'];
$content = "报名参加了" . $event['name'] . " - " . $event['brief'];
$url_route = array('rel_app_index' => 'index', 'rel_route' => 'event#' . $event['id'], 'rel_param' => '');
require_once APP_ROOT_PATH . "system/model/topic.php";
$tid = insert_topic($content, $title, $type = "eventsubmit", $group = "", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list = array(), $url_route);
if ($tid) {
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($tid));
}
require_once APP_ROOT_PATH . "system/model/user.php";
modify_account(array("score" => "-" . $event['score_limit']), $user_id, "活动报名:" . $event['name']);
$data['status'] = 1;
$data['info'] = "报名成功";
if ($sn) {
$data['info'] .= ",验证码:" . $sn;
}
rm_auto_cache("event", array("id" => $event['id']));
ajax_return($data);
} else {
$data['status'] = 0;
$data['info'] = "报名失败";
ajax_return($data);
}
}
}