本文整理汇总了PHP中valid_str函数的典型用法代码示例。如果您正苦于以下问题:PHP valid_str函数的具体用法?PHP valid_str怎么用?PHP valid_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了valid_str函数的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: reply
public function reply()
{
$ajax = 1;
global_run();
if (!$GLOBALS['user_info']) {
$result['status'] = -1000;
$result['info'] = "未登录";
ajax_return($result);
}
if ($_REQUEST['content'] == '') {
showErr($GLOBALS['lang']['MESSAGE_CONTENT_EMPTY'], $ajax);
}
/*验证每天只允许评论5次*/
$day_send_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic_reply where create_time>" . to_timespan(to_date(NOW_TIME, "Y-m-d"), "Y-m-d") . " and create_time<" . NOW_TIME);
if ($day_send_count >= 8) {
showErr('今天你已经发很多了哦~', $ajax);
}
if (!check_ipop_limit(get_client_ip(), "message", intval(app_conf("SUBMIT_DELAY")), 0)) {
showErr($GLOBALS['lang']['MESSAGE_SUBMIT_FAST'], $ajax);
}
$topic_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic where id = " . intval($_REQUEST['topic_id']));
if (!$topic_info) {
showErr("主题不存在", $ajax);
}
$reply_data = array();
$reply_data['topic_id'] = intval($_REQUEST['topic_id']);
$reply_data['user_id'] = intval($GLOBALS['user_info']['id']);
$reply_data['user_name'] = $GLOBALS['user_info']['user_name'];
$reply_data['reply_id'] = intval($_REQUEST['reply_id']);
$reply_data['create_time'] = NOW_TIME;
$reply_data['is_effect'] = 1;
$reply_data['is_delete'] = 0;
$reply_data['content'] = strim(valid_str(addslashes($_REQUEST['content'])));
require_once APP_ROOT_PATH . 'system/model/topic.php';
$reply_id = insert_topic_reply($reply_data);
//返回页面的数据
$reply_data['reply_id'] = $reply_id;
$reply_data['create_time'] = to_date(NOW_TIME, "Y-m-d H:i");
$reply_data['avatar'] = show_avatar($reply_data['user_id'], "small");
$reply_data['user_url'] = url("index", "uc_home#index", array("id" => $reply_data['user_id']));
$reply_data['status'] = 1;
ajax_return($reply_data);
}
示例4: ajax_return
}
if (intval($img_result['error']) != 0) {
ajax_return($img_result);
} else {
if (app_conf("PUBLIC_DOMAIN_ROOT") != '') {
$paths = pathinfo($img_result['topic_image']['url']);
$path = str_replace("./", "", $paths['dirname']);
$filename = $paths['basename'];
$pathwithoupublic = str_replace("public/", "", $path);
$syn_url = app_conf("PUBLIC_DOMAIN_ROOT") . "/es_file.php?username=" . app_conf("IMAGE_USERNAME") . "&password=" . app_conf("IMAGE_PASSWORD") . "&file=" . SITE_DOMAIN . APP_ROOT . "/" . $path . "/" . $filename . "&path=" . $pathwithoupublic . "/&name=" . $filename . "&act=0";
@file_get_contents($syn_url);
}
}
$data['error'] = 0;
$data['message'] = $img_result['topic_image']['thumb']['thumb']['url'];
$data['name'] = valid_str($_FILES['topic_image']['name']);
require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
$image = new es_imagecls();
$info = $image->getImageInfo($img_result['topic_image']['path']);
$image_data['width'] = intval($info[0]);
$image_data['height'] = intval($info[1]);
$image_data['name'] = valid_str($_FILES['topic_image']['name']);
$image_data['filesize'] = filesize($img_result['topic_image']['path']);
$image_data['create_time'] = TIME_UTC;
$image_data['user_id'] = intval($GLOBALS['user_info']['id']);
$image_data['user_name'] = addslashes($GLOBALS['user_info']['user_name']);
$image_data['path'] = $img_result['topic_image']['thumb']['thumb']['url'];
$image_data['o_path'] = $img_result['topic_image']['url'];
$GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
$data['id'] = intval($GLOBALS['db']->insert_id());
ajax_return($data);
示例5: do_relay_topic
public function do_relay_topic()
{
if (intval($GLOBALS['user_info']['id']) == 0) {
$result['status'] = 0;
$result['info'] = $GLOBALS['lang']['PLEASE_LOGIN_FIRST'];
} else {
$result['status'] = 1;
$content = addslashes(htmlspecialchars(trim(valid_str($_REQUEST['content']))));
$id = intval($_REQUEST['id']);
$tid = insert_topic($content, $title = "", $type = "", $group = "", $id, $fav_id = 0);
if ($tid) {
increase_user_active(intval($GLOBALS['user_info']['id']), "转发了一则分享");
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($tid));
}
$result['info'] = $GLOBALS['lang']['RELAY_SUCCESS'];
}
ajax_return($result);
}
示例6: 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));
}
}
}
//.........这里部分代码省略.........
示例7: 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);
}
}
示例8: 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);
}
示例9: preview
function preview()
{
$deal['id'] = 'XXX';
$deal_loan_type_list = load_auto_cache("deal_loan_type_list");
if (intval($_REQUEST['quota']) == 1) {
$deal = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "deal_quota_submit WHERE status=1 and user_id = " . $GLOBALS['user_info']['id'] . " ORDER BY id DESC");
$type_id = intval($deal['type_id']);
$deal['rate_foramt'] = number_format($deal['rate'], 2);
$data['view_info'] = unserialize($deal['view_info']);
if ($deal['cate_id'] > 0) {
$deal['cate_info'] = $GLOBALS['db']->getRowCached("select id,name,brief,uname,icon from " . DB_PREFIX . "deal_cate where id = " . $deal['cate_id'] . " and is_effect = 1 and is_delete = 0");
}
$deal['repay_time'] = strim($_REQUEST['repay_time']);
$deal['repay_time_type'] = 1;
} else {
$deal['name'] = strim($_REQUEST['borrowtitle']);
$type_id = intval($_REQUEST['borrowtype']);
$deal['repay_time_type'] = intval($_REQUEST['repaytime_type']);
$deal['rate_foramt'] = number_format(strim($_REQUEST['apr']), 2);
$deal['repay_time'] = strim($_REQUEST['repaytime']);
$icon_type = strim($_REQUEST['imgtype']);
$icon_type_arr = array('upload' => 1, 'userImg' => 2, 'systemImg' => 3);
$data['icon_type'] = $icon_type_arr[$icon_type];
switch ($data['icon_type']) {
case 1:
$deal['icon'] = replace_public(strim($_REQUEST['icon']));
break;
case 2:
$deal['icon'] = replace_public(get_user_avatar($GLOBALS['user_info']['id'], 'big'));
break;
case 3:
$deal['icon'] = $GLOBALS['db']->getOneCached("SELECT icon FROM " . DB_PREFIX . "deal_loan_type WHERE id=" . intval($_REQUEST['systemimgpath']));
}
$deal['description'] = replace_public(valid_str(bstrim($_REQUEST['borrowdesc'])));
$user_view_info = $GLOBALS['user_info']['view_info'];
$user_view_info = unserialize($user_view_info);
$new_view_info_arr = array();
for ($i = 1; $i <= intval($_REQUEST['file_upload_count']); $i++) {
$img_info = array();
$img = replace_public(strim($_REQUEST['file_' . $i]));
if ($img != "") {
$img_info['name'] = strim($_REQUEST['file_name_' . $i]);
$img_info['img'] = $img;
$img_info['is_user'] = 1;
$user_view_info[] = $img_info;
$ss = $user_view_info;
end($ss);
$key = key($ss);
$new_view_info_arr[$key] = $img_info;
}
}
$data['view_info'] = array();
foreach ($_REQUEST['file_key'] as $k => $v) {
if (isset($user_view_info[$v])) {
$data['view_info'][$v] = $user_view_info[$v];
}
}
foreach ($new_view_info_arr as $k => $v) {
$data['view_info'][$k] = $v;
}
if ($deal['cate_id'] > 0) {
$deal['cate_info']['name'] = "借款预览标";
}
}
$deal['borrow_amount'] = strim($_REQUEST['borrowamount']);
$deal['borrow_amount_format'] = format_price($deal['borrow_amount'] / 10000) . "万";
$GLOBALS['tmpl']->assign('view_info_list', $data['view_info']);
unset($data['view_info']);
foreach ($deal_loan_type_list as $k => $v) {
if ($v['id'] == $type_id) {
$deal['type_info'] = $v;
}
}
$deal['min_loan_money'] = 50;
$deal['need_money'] = $deal['borrow_amount_format'];
//本息还款金额
$deal['month_repay_money'] = format_price(pl_it_formula($deal['borrow_amount'], strim($deal['rate']) / 12 / 100, $deal['repay_time']));
if ($deal['agency_id'] > 0) {
$deal['agency_info'] = $GLOBALS['db']->getRowCached("select * from " . DB_PREFIX . "deal_agency where id = " . $deal['agency_id'] . " and is_effect = 1");
}
$deal['progress_point'] = 0;
$deal['buy_count'] = 0;
$deal['voffice'] = 1;
$deal['vjobtype'] = 1;
$deal['is_delete'] = 2;
$u_info = get_user("*", $GLOBALS['user_info']['id']);
$GLOBALS['tmpl']->assign("u_info", $u_info);
$can_use_quota = get_can_use_quota($GLOBALS['user_info']['id']);
$GLOBALS['tmpl']->assign('can_use_quota', $can_use_quota);
$credit_file = get_user_credit_file($GLOBALS['user_info']['id'], $u_info);
$GLOBALS['tmpl']->assign("credit_file", $credit_file);
$user_statics = sys_user_status($GLOBALS['user_info']['id'], true);
$GLOBALS['tmpl']->assign("user_statics", $user_statics);
$seo_title = $deal['seo_title'] != '' ? $deal['seo_title'] : $deal['type_match_row'] . " - " . $deal['name'];
$GLOBALS['tmpl']->assign("page_title", $seo_title);
$seo_keyword = $deal['seo_keyword'] != '' ? $deal['seo_keyword'] : $deal['type_match_row'] . "," . $deal['name'];
$GLOBALS['tmpl']->assign("page_keyword", $seo_keyword . ",");
$seo_description = $deal['seo_description'] != '' ? $deal['seo_description'] : $deal['name'];
$GLOBALS['tmpl']->assign("seo_description", $seo_description . ",");
$GLOBALS['tmpl']->assign("deal", $deal);
//.........这里部分代码省略.........
示例10: reply
public function reply()
{
$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;
}
}
$content = htmlspecialchars(addslashes(valid_str($_REQUEST['content'])));
$uid = intval($GLOBALS["user_info"]['id']);
$pid = intval($_REQUEST['pid']);
$dp_id = intval($_REQUEST['dp_id']);
$page = intval($_REQUEST['page']);
if (!check_ipop_limit(get_client_ip(), "dpsign", 10, $dp_id)) {
$return['message'] = '请勿频繁回应';
ajax_return($return);
exit;
}
es_session::delete("verify");
$dp_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location_dp where id = " . $dp_id);
$merchant_info = $GLOBALS['db']->getRow("select name,id from " . DB_PREFIX . "supplier_location where id = " . $dp_info['supplier_location_id']);
$reply_data = array();
$reply_data['dp_id'] = $dp_id;
$reply_data['content'] = $content;
$reply_data['user_id'] = $uid;
$reply_data['parent_id'] = $pid;
$reply_data['create_time'] = get_gmtime();
$GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_dp_reply", $reply_data, "INSERT");
$rid = $GLOBALS['db']->insert_id();
if ($rid > 0) {
$syn_reply = intval($_REQUEST['syn_reply']);
if ($syn_reply == 1) {
$s_account_info = es_session::get("account_info");
if (in_array($dp_info['supplier_location_id'], $s_account_info['location_ids']) && $dp_info['from_data'] != "") {
//验证通过
$message_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message where id = " . intval($dp_info['message_id']));
if ($message_info) {
$message_info['admin_reply'] = $content;
$message_info['update_time'] = get_gmtime();
$GLOBALS['db']->autoExecute(DB_PREFIX . "message", $message_info, "UPDATE", "id=" . $message_info['id']);
send_user_msg("商户回复了你的点评", "商户回复了你的点评 [<a href='" . url("youhui", "review#detail", array("id" => $dp_info['id'])) . "' target='_blank'>" . $dp_info['title'] . "</a>]", 0, $dp_info['user_id'], get_gmtime(), 0, 1, 1);
}
}
}
increase_user_active(intval($GLOBALS['user_info']['id']), "回应了一则商户点评");
$GLOBALS['db']->query("update " . DB_PREFIX . "supplier_location_dp set reply_count = reply_count + 1 where id = " . $dp_id);
}
//输出回应列表
$sql_count = "select count(*) from " . DB_PREFIX . "supplier_location_dp_reply where dp_id = " . $dp_id;
$count = $GLOBALS['db']->getOne($sql_count);
$page_size = app_conf("PAGE_SIZE");
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
$sql = "select * from " . DB_PREFIX . "supplier_location_dp_reply where dp_id = " . $dp_id . " order by create_time desc limit " . $limit;
$reply_list = $GLOBALS['db']->getAll($sql);
foreach ($reply_list as $k => $v) {
$reply_list[$k]['user_name'] = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . $v['user_id']);
$reply_list[$k]['create_time_format'] = pass_date($v['create_time']);
}
$GLOBALS['current_url'] = $_SERVER['REQUEST_URI'] = url("youhui", "review#detail", array("id" => $dp_id));
$page = new Page($count, $page_size);
//初始化分页对象
$p = $page->show();
$GLOBALS['tmpl']->assign('pages', $p);
$GLOBALS['tmpl']->assign("reply_list", $reply_list);
$GLOBALS['tmpl']->assign('user_auth', get_user_auth());
$html = decode_topic($GLOBALS['tmpl']->fetch("inc/review/reply_list.html"));
$return = array("status" => 1, "message" => $html);
ajax_return($return);
exit;
}
示例11: save
public function save()
{
global_run();
if (empty($GLOBALS['user_info'])) {
$data['status'] = -1;
$data['info'] = "";
ajax_return($data);
}
require_once APP_ROOT_PATH . "system/model/review.php";
$deal_id = intval($_REQUEST['deal_id']);
$youhui_id = intval($_REQUEST['youhui_id']);
$event_id = intval($_REQUEST['event_id']);
$location_id = intval($_REQUEST['location_id']);
$order_item_id = intval($_REQUEST['order_item_id']);
$youhui_log_id = intval($_REQUEST['youhui_log_id']);
$event_submit_id = intval($_REQUEST['event_submit_id']);
$param = array("deal_id" => $deal_id, "youhui_id" => $youhui_id, "event_id" => $event_id, "location_id" => $location_id, "order_item_id" => $order_item_id, "youhui_log_id" => $youhui_log_id, "event_submit_id" => $event_submit_id);
$checker = check_dp_status($GLOBALS['user_info']['id'], $param);
if (!$checker['status']) {
showErr($checker['info'], 1);
}
$content = strim(valid_str($_REQUEST['content']));
//点评内容
$dp_point = intval($_REQUEST['dp_point']);
//总评分
if ($dp_point <= 0) {
$data['status'] = 0;
$data['info'] = "请为总评打分";
ajax_return($data);
}
$dp_image = array();
//点评图片
foreach ($_REQUEST['dp_image'] as $k => $v) {
if (strim($v) != "") {
$dp_image[] = strim($v);
}
}
$tag_group = array();
//标签分组
foreach ($_REQUEST['dp_tags'] as $k => $tags_arr) {
foreach ($tags_arr as $v) {
if (strim($v) != "") {
$v_array = preg_split("/[ ,]/", $v);
foreach ($v_array as $kk => $vv) {
if (strim($vv) != "") {
$tag_group[$k][] = strim(valid_str($vv));
}
}
}
}
}
$point_group = array();
//评分分组
foreach ($_REQUEST['dp_point_group'] as $k => $v) {
if (intval($v) > 0) {
$point_group[$k] = intval($v);
} else {
$name = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "point_group where id = " . intval($k));
$info = "请打分";
if ($name) {
$info = "请为" . $name . "打分";
}
$data['status'] = 0;
$data['info'] = $info;
ajax_return($data);
}
}
$result = save_review($GLOBALS['user_info']['id'], $param, $content, $dp_point, $dp_image, $tag_group, $point_group);
if ($result['status']) {
//分享
$attach_list = array();
if ($result['deal_id'] > 0) {
require_once APP_ROOT_PATH . "system/model/deal.php";
$deal_info = get_deal($result['deal_id']);
if ($deal_info['uname'] != "") {
$url_key = $deal_info['uname'];
} else {
$url_key = $deal_info['id'];
}
$type = "dealcomment";
$url_route = array('rel_app_index' => 'index', 'rel_route' => 'deal#' . $url_key, 'rel_param' => '');
//同步图片
if ($deal_info['icon']) {
require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
$imagecls = new es_imagecls();
$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) {
//.........这里部分代码省略.........
示例12: add
public function add()
{
$user_info = $GLOBALS['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 (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);
}
$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($_REQUEST['title'])) : htmlspecialchars(addslashes($_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;
$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'] = $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'] = 0;
$message['contact'] = $_REQUEST['contact'] ? htmlspecialchars(addslashes($_REQUEST['contact'])) : '';
$message['contact_name'] = $_REQUEST['contact_name'] ? htmlspecialchars(addslashes($_REQUEST['contact_name'])) : '';
$GLOBALS['db']->autoExecute(DB_PREFIX . "message", $message);
if ($message_group == '退款' && $rel_table == 'deal_order') {
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set refund_status = 1 where id = " . intval($message['rel_id']));
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_coupon set refund_status = 1 where order_id = " . intval($message['rel_id']) . " and confirm_time = 0 and is_valid = 1 and balance_time = 0 and (any_refund = 1 or (expire_refund = 1 and end_time > 0 and end_time < " . get_gmtime() . "))");
}
if ($message_group == '退货' && $rel_table == 'deal_order') {
$GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set retake_status = 1 where id = " . intval($message['rel_id']));
}
showSuccess($GLOBALS['lang']['MESSAGE_POST_SUCCESS'], $ajax);
}
示例13: reply
public function reply()
{
$no_verify = intval($_REQUEST['no_verify']);
$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 && $no_verify == 0) {
$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);
}
$topic_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic where id = " . intval($_REQUEST['topic_id']));
if (!$topic_info) {
showErr("主题不存在", $ajax);
}
$reply_data = array();
$reply_data['topic_id'] = intval($_REQUEST['topic_id']);
$reply_data['user_id'] = intval($GLOBALS['user_info']['id']);
$reply_data['user_name'] = $GLOBALS['user_info']['user_name'];
$reply_data['reply_id'] = intval($_REQUEST['reply_id']);
if ($reply_data['reply_id'] > 0) {
$reply_reply_data = $GLOBALS['db']->getRow("select id,user_id,user_name from " . DB_PREFIX . "topic_reply where id = " . $reply_data['reply_id']);
$reply_data['reply_user_id'] = $reply_reply_data['user_id'];
$reply_data['reply_user_name'] = $reply_reply_data['user_name'];
}
$reply_data['create_time'] = get_gmtime();
$reply_data['is_effect'] = 1;
$reply_data['is_delete'] = 0;
$reply_data['content'] = htmlspecialchars(valid_str(addslashes($_REQUEST['content'])));
$GLOBALS['db']->autoExecute(DB_PREFIX . "topic_reply", $reply_data);
$id = $GLOBALS['db']->insert_id();
if ($id > 0) {
increase_user_active(intval($GLOBALS['user_info']['id']), "回应了一则分享");
$attach_list = get_topic_attach_list();
foreach ($attach_list as $attach) {
if ($attach['type'] == 'image') {
//插入图片
$GLOBALS['db']->query("update " . DB_PREFIX . "topic_image set topic_id = " . $id . ",topic_table='topic_reply' where id = " . $attach['id']);
}
}
}
//删除所有创建超过一小时,且未被使用过的图片
$del_list = $GLOBALS['db']->getAll("select id,path from " . DB_PREFIX . "topic_image where topic_id = 0 and " . get_gmtime() . " - create_time > 3600");
$GLOBALS['db']->query("delete from " . DB_PREFIX . "topic_image where topic_id = 0 and " . get_gmtime() . " - create_time > 3600");
foreach ($del_list as $k => $v) {
@unlink(APP_ROOT_PATH . $v['path']);
@unlink(APP_ROOT_PATH . $v['o_path']);
}
$GLOBALS['db']->query("update " . DB_PREFIX . "topic set reply_count = reply_count + 1,last_time = " . get_gmtime() . ",last_user_id = " . intval($GLOBALS['user_info']['id']) . " where id = " . $reply_data['topic_id']);
showSuccess($GLOBALS['lang']['MESSAGE_POST_SUCCESS'], $ajax);
}
示例14: 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);
}
示例15: upload_topic
/**
* 分享点评的上传,上传到comment目录,按日期划分
* 错误返回 error!=0,message错误消息, error=1000表示未登录
* 正确时返回 error=0, url: ./public格式的文件相对路径 path:物理路径 name:文件名
* thumb->preview 100x100的小图 url,path
*/
public function upload_topic()
{
global_run();
if (empty($GLOBALS['user_info'])) {
$data['error'] = 1000;
//未登录
$data['msg'] = $GLOBALS['lang']['PLEASE_LOGIN_FIRST'];
ajax_return($data);
}
//上传处理
//创建comment目录
if (!is_dir(APP_ROOT_PATH . "public/comment")) {
@mkdir(APP_ROOT_PATH . "public/comment");
@chmod(APP_ROOT_PATH . "public/comment", 0777);
}
$dir = to_date(NOW_TIME, "Ym");
if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) {
@mkdir(APP_ROOT_PATH . "public/comment/" . $dir);
@chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
}
$dir = $dir . "/" . to_date(NOW_TIME, "d");
if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) {
@mkdir(APP_ROOT_PATH . "public/comment/" . $dir);
@chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
}
$dir = $dir . "/" . to_date(NOW_TIME, "H");
if (!is_dir(APP_ROOT_PATH . "public/comment/" . $dir)) {
@mkdir(APP_ROOT_PATH . "public/comment/" . $dir);
@chmod(APP_ROOT_PATH . "public/comment/" . $dir, 0777);
}
if (app_conf("IS_WATER_MARK") == 1) {
$img_result = save_image_upload($_FILES, "file", "comment/" . $dir, $whs = array('preview' => array(50, 50, 1, 0)), 1, 1);
} else {
$img_result = save_image_upload($_FILES, "file", "comment/" . $dir, $whs = array('preview' => array(50, 50, 1, 0)), 0, 1);
}
if (intval($img_result['error']) != 0) {
ajax_return($img_result);
} else {
if ($GLOBALS['distribution_cfg']['OSS_TYPE'] && $GLOBALS['distribution_cfg']['OSS_TYPE'] != "NONE") {
syn_to_remote_image_server($img_result['file']['url']);
syn_to_remote_image_server($img_result['file']['thumb']['preview']['url']);
}
}
$data_result['error'] = 0;
$data_result['url'] = $img_result['file']['url'];
$data_result['path'] = $img_result['file']['path'];
$data_result['name'] = $img_result['file']['name'];
$data_result['thumb'] = $img_result['file']['thumb'];
require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
$image = new es_imagecls();
$info = $image->getImageInfo($img_result['file']['path']);
$image_data['width'] = intval($info[0]);
$image_data['height'] = intval($info[1]);
$image_data['name'] = valid_str($_FILES['file']['name']);
$image_data['filesize'] = filesize($img_result['file']['path']);
$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'] = $img_result['file']['thumb']['preview']['url'];
$image_data['o_path'] = $img_result['file']['url'];
$GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
$data_result['id'] = intval($GLOBALS['db']->insert_id());
ajax_return($data_result);
}