public function index()
 {
     $root = array();
     $ajax = intval($_REQUEST['ajax']);
     $root['ajax'] = $ajax;
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     //检查用户,用户密码
     $user = user_check($email, $pwd);
     $user_id = intval($user['id']);
     if ($user_id > 0) {
         $comment['deal_id'] = intval($_REQUEST['id']);
         $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $comment['deal_id'] . " and is_delete = 0 and is_effect = 1 ");
         if (!$deal_info) {
             $root['info'] = "该项目暂时不能评论";
             output($root);
         }
         if (!check_ipop_limit(get_client_ip(), "deal_savedealcomment", 3)) {
             $root['info'] = "提交太快";
         }
         output($root);
         $comment['content'] = strim($_REQUEST['content']);
         $comment['user_id'] = intval($GLOBALS['user_info']['id']);
         $comment['create_time'] = NOW_TIME;
         $comment['user_name'] = $GLOBALS['user_info']['user_name'];
         $comment['pid'] = intval($_REQUEST['pid']);
         $comment['deal_user_id'] = intval($GLOBALS['db']->getOne("select user_id from " . DB_PREFIX . "deal where id = " . $comment['deal_id']));
         $comment['reply_user_id'] = intval($GLOBALS['db']->getOne("select user_id from " . DB_PREFIX . "deal_comment where id = " . $comment['pid']));
         $comment['deal_user_name'] = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . intval($comment['deal_user_id']));
         $comment['reply_user_name'] = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . intval($comment['reply_user_id']));
         $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_comment", $comment);
         $comment['id'] = $GLOBALS['db']->insert_id();
         $GLOBALS['db']->query("update " . DB_PREFIX . "deal set comment_count = comment_count+1 where id = " . $comment['deal_id']);
         if (intval($_REQUEST['syn_weibo']) == 1) {
             $weibo_info = array();
             $weibo_info['content'] = $comment['content'] . " " . get_domain() . url("deal#show", array("id" => $comment['deal_id']));
             $img = $GLOBALS['db']->getOne("select image from " . DB_PREFIX . "deal where id = " . intval($comment['deal_id']));
             if ($img) {
                 $weibo_info['img'] = APP_ROOT_PATH . "/" . $img;
             }
             syn_weibo($weibo_info);
         }
         if ($ajax == 1) {
             $data['status'] = 1;
             ajax_return($data);
         } else {
             showSuccess("发表成功");
         }
     } else {
         $root['user_login_status'] = 0;
         output($root);
     }
 }
Beispiel #2
0
 public function savedealcomment()
 {
     $ajax = intval($_REQUEST['ajax']);
     if (!$GLOBALS['user_info']) {
         showErr("", $ajax, url("user#login"));
     }
     $comment['deal_id'] = intval($_REQUEST['id']);
     $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $comment['deal_id'] . " and is_delete = 0 and is_effect = 1 ");
     if (!$deal_info) {
         showErr("该项目暂时不能评论", $ajax);
     }
     if (!check_ipop_limit(get_client_ip(), "deal_savedealcomment", 3)) {
         showErr("提交太快", $ajax);
     }
     $comment['content'] = strim($_REQUEST['content']);
     $comment['user_id'] = intval($GLOBALS['user_info']['id']);
     $comment['create_time'] = NOW_TIME;
     $comment['user_name'] = $GLOBALS['user_info']['user_name'];
     $comment['pid'] = intval($_REQUEST['pid']);
     $comment['deal_user_id'] = intval($GLOBALS['db']->getOne("select user_id from " . DB_PREFIX . "deal where id = " . $comment['deal_id']));
     $comment['reply_user_id'] = intval($GLOBALS['db']->getOne("select user_id from " . DB_PREFIX . "deal_comment where id = " . $comment['pid']));
     $comment['deal_user_name'] = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . intval($comment['deal_user_id']));
     $comment['reply_user_name'] = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . intval($comment['reply_user_id']));
     $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_comment", $comment);
     $comment['id'] = $GLOBALS['db']->insert_id();
     $GLOBALS['db']->query("update " . DB_PREFIX . "deal set comment_count = comment_count+1 where id = " . $comment['deal_id']);
     if (intval($_REQUEST['syn_weibo']) == 1) {
         $weibo_info = array();
         $weibo_info['content'] = $comment['content'] . " " . get_domain() . url("deal#show", array("id" => $comment['deal_id']));
         $img = $GLOBALS['db']->getOne("select image from " . DB_PREFIX . "deal where id = " . intval($comment['deal_id']));
         if ($img) {
             $weibo_info['img'] = APP_ROOT_PATH . "/" . $img;
         }
         syn_weibo($weibo_info);
     }
     if ($ajax == 1) {
         $data['status'] = 1;
         ajax_return($data);
     } else {
         showSuccess("发表成功");
     }
 }
Beispiel #3
0
    exit;
}
if (isset($_REQUEST['unbind'])) {
    $class_name = addslashes(trim($_REQUEST['unbind']));
    checkClass($class_name);
    require FANWE_ROOT . "login/" . $class_name . ".php";
    if (class_exists($class_name)) {
        $module = new $class_name();
        $module->unBind();
    }
    exit;
}
//同步微博
if (isset($_REQUEST['loop'])) {
    $uid = intval($_REQUEST['uid']);
    echo syn_weibo($uid);
}
function syn_weibo($uid)
{
    global $_FANWE;
    static $mods = array();
    $_FANWE['uid'] = $uid;
    $weibos = FDB::fetchAll("select * from " . FDB::table("pub_schedule") . " where uid = " . $uid . " order by type");
    FDB::query("delete from " . FDB::table("pub_schedule") . " where uid = " . $uid);
    foreach ($weibos as $weibo) {
        if (file_exists(FANWE_ROOT . "login/" . $weibo['type'] . ".php")) {
            if (!isset($mods[$weibo['type']])) {
                require_once FANWE_ROOT . "login/" . $weibo['type'] . ".php";
                $class = $weibo['type'];
                $mods[$weibo['type']] = new $class();
            }