本文整理汇总了PHP中valid_str函数的典型用法代码示例。如果您正苦于以下问题:PHP valid_str函数的具体用法?PHP valid_str怎么用?PHP valid_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了valid_str函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:60,代码来源:addcomment.action.php
示例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);
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:58,代码来源:addeventcomment.action.php
示例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);
}
开发者ID:macall,项目名称:jsd,代码行数:43,代码来源:topicModule.class.php
示例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);
开发者ID:norain2050,项目名称:fanwei_xindai_3.2,代码行数:31,代码来源:upload.php
示例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);
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:18,代码来源:ajaxModule.class.php
示例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));
}
}
}
//.........这里部分代码省略.........
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:101,代码来源:commentModule.class.php
示例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);
}
}
开发者ID:eliu03,项目名称:fanweP2P,代码行数:101,代码来源:debit_dealModule.class.php
示例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);
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:83,代码来源:messageModule.class.php
示例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);
//.........这里部分代码省略.........
开发者ID:neteasy-work,项目名称:fanwei_xindai_3.2,代码行数:101,代码来源:dealModule.class.php
示例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;
}
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:84,代码来源:reviewModule.class.php
示例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) {
//.........这里部分代码省略.........
开发者ID:macall,项目名称:jsd,代码行数:101,代码来源:reviewModule.class.php
示例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'] = "[&
|
请发表评论