コード例 #1
0
ファイル: function.article.php プロジェクト: edmundwong/V604
function article_reply($arr)
{
    global $_G;
    require_once libfile('function/editor');
    require_once libfile('function/post');
    $time_arr = create_public_time($arr, count($arr['reply']), 1);
    //需传入已经发布的帖子的public_start_time
    $uid_arr = get_rand_uid($arr, 'reply');
    $subject = addslashes($arr['title']);
    $view_num = $arr['view_num'];
    $tid = $arr['tid'];
    $reply_arr = $arr['reply'];
    if ($arr['public_reply_seq'] == 1) {
        shuffle($reply_arr);
    }
    //打乱回帖
    //print_r($reply_arr);exit();
    $replys = count($reply_arr);
    foreach ((array) $reply_arr as $k => $v) {
        $message = dstripslashes($v);
        $message = media_htmlbbcode($message, $arr['page_url']);
        $message = img_htmlbbcode($message, $arr['page_url']);
        $message = htmlspecialchars_decode(html2bbcode($message));
        $bbcodeoff = checkbbcodes($message, !empty($_GET['bbcodeoff']));
        $smileyoff = checksmilies($message, !empty($_GET['smileyoff']));
        $parseurloff = !empty($_GET['parseurloff']);
        $htmlon = $_G['group']['allowhtml'] && !empty($_GET['htmlon']) ? 1 : 0;
        $usesig = !empty($_GET['usesig']) ? 1 : ($_G['uid'] && $_G['group']['maxsigsize'] ? 1 : 0);
        $isanonymous = $_G['group']['allowanonymous'] && !empty($_GET['isanonymous']) ? 1 : 0;
        if (!$message || strlen($message) < 2) {
            continue;
        }
        $post_setarr = array('fid' => $arr['fid'], 'tid' => $tid, 'first' => '0', 'author' => $uid_arr[$k]['username'] ? $uid_arr[$k]['username'] : $_G['username'], 'authorid' => $uid_arr[$k]['uid'] ? $uid_arr[$k]['uid'] : $_G['uid'], 'subject' => '', 'dateline' => $time_arr[$k], 'message' => $message, 'useip' => $_G['clientip'], 'invisible' => 0, 'anonymous' => $isanonymous, 'usesig' => $usesig, 'htmlon' => $htmlon, 'bbcodeoff' => $bbcodeoff, 'smileyoff' => $smileyoff, 'parseurloff' => $parseurloff, 'attachment' => '0', 'tags' => 0, 'replycredit' => 0, 'status' => defined('IN_MOBILE') ? 8 : 0);
        //$new[$k] = $post_setarr;
        if (DISCUZ_VERSION != 'X2') {
            //2.5版本
            $post_setarr = dstripslashes($post_setarr);
        } else {
            $post_setarr = daddslashes($post_setarr);
        }
        $lastpost = $post_setarr['dateline'];
        $lastposter = $post_setarr['author'];
        $reply_pid = insertpost($post_setarr);
        $forum_arr['tid'] = $tid;
        $forum_arr['pid'] = $reply_pid;
        $forum_arr['is_post'] = 1;
        //标识是回复
        $forum_arr['cookie'] = $arr['cookie'];
        $forum_arr['is_water_img'] = $arr['is_water_img'];
        $forum_arr['is_download_img'] = $arr['is_download_img'];
        $forum_arr['is_download_file'] = $arr['is_download_file'];
        $forum_arr['content'] = $v;
        $re_arr = forum_downremotefile($forum_arr);
        DB::query("UPDATE " . DB::table('common_member_count') . " SET posts=posts+1 WHERE uid='{$post_setarr['authorid']}'");
        //更新数
    }
    //今日发帖
    $todayposts = 0;
    foreach ((array) $time_arr as $k => $v) {
        if (date("Yjn", $_G['timestamp']) == date("Yjn", $v)) {
            $todayposts++;
        }
    }
    DB::update('forum_thread', array('replies' => count($reply_arr), 'lastpost' => $lastpost, 'lastposter' => $lastposter), array('tid' => $tid));
    $subject = str_replace("\t", ' ', $subject);
    $replys = $replys ? $replys : 1;
    $forum_lastpost = "{$tid}\t{$subject}\t{$lastpost}\t{$lastposter}";
    DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$forum_lastpost}', posts=posts+{$replys}, todayposts=todayposts+{$todayposts} WHERE fid='{$arr['fid']}'", 'UNBUFFERED');
    //更新今日发帖这些数据
    return TRUE;
}
コード例 #2
0
ファイル: pick.class.php プロジェクト: edmundwong/V604
 function article_public($arr)
 {
     global $_G;
     pload('F:article');
     $timing_public_arr = array();
     $is_timing = $this->plugin_set['is_timing'];
     //if(!VIP) $is_timing = 0;
     $class_arr = $this->p_arr['public_class'];
     $old_arr = $arr;
     $arr['title'] = htmlspecialchars_decode($arr['title'], ENT_QUOTES);
     $arr['content'] = htmlspecialchars_decode($arr['content'], ENT_QUOTES);
     unset($arr['pic']);
     $view_arr = format_wrap($this->p_arr['view_num'], ',');
     $arr['view_num'] = rand($view_arr[0], $view_arr[1]);
     $rand_arr = get_rand_uid($this->p_arr);
     $arr['p_arr'] = $this->p_arr;
     $arr['uid'] = $this->public_info['uid'] = $setarr['uid'] = $rand_arr[0]['uid'] ? $rand_arr[0]['uid'] : $_G['uid'];
     $arr['username'] = $setarr['username'] = $rand_arr[0]['username'] ? $rand_arr[0]['username'] : $_G['username'];
     $arr['portal_cid'] = $arr['forum_fid'] = $arr['blog_big_cid'] = $class_arr[0];
     $arr['forum_typeid'] = $arr['blog_small_cid'] = $class_arr[1];
     $arr['is_download_img'] = $this->p_arr['is_download_img'];
     $arr['is_download_file'] = $this->p_arr['is_download_file'];
     $arr['content_filter_html'] = $this->p_arr['content_filter_html'];
     $arr['is_water_img'] = $this->p_arr['is_water_img'];
     $arr['content'] = clear_ad_html($arr['content']);
     $arr['summary'] = addslashes($arr['summary']);
     $arr['public_start_time'] = $this->p_arr['public_start_time'];
     $arr['public_end_time'] = $this->p_arr['public_end_time'];
     $time_arr = create_public_time($arr, 1);
     $arr['public_time'] = $this->public_info['public_time'] = array_pop($time_arr);
     $arr['public_reply_seq'] = $this->p_arr['public_reply_seq'];
     $arr['is_public_reply'] = $this->p_arr['is_public_reply'];
     $arr['public_uid'] = $this->p_arr['public_uid'];
     $arr['reply_uid'] = $this->p_arr['reply_uid'];
     $arr['is_page_public'] = $this->p_arr['is_page_public'];
     $arr['check'] = 1;
     $arr['page_url'] = $this->now_url;
     $arr['is_bbs'] = $this->p_arr['reply_rules'] || $this->p_arr['reply_is_extend'] ? 1 : 0;
     $this->temp_arr['article_status'] = 2;
     $this->temp_arr['timeing_data_id'] = 0;
     //发布时间大于当前时间,放入定时发布中
     if ($arr['public_time'] > $_G['timestamp'] && $is_timing == 1) {
         if ($this->p_arr['public_type'] == 1) {
             //门户
             $timing_public_arr['portal'] = $class_arr[0];
         } else {
             if ($this->p_arr['public_type'] == 2) {
                 //论坛
                 $timing_public_arr['forums'] = $class_arr[0];
                 $timing_public_arr['threadtypeid'] = $class_arr[1];
             } else {
                 $timing_public_arr['blog'] = $class_arr[0];
                 $timing_public_arr['classid'] = $class_arr[1];
             }
         }
         $this->temp_arr['article_status'] = 4;
         //文章入库时标记文章发布状态为定时发布
         $timing_setarr = array('public_type' => $this->p_arr['public_type'], 'data_id' => 0, 'content_type' => 1, 'public_dateline' => $arr['public_time'], 'pid' => $this->pid, 'public_info' => serialize($timing_public_arr));
         $this->temp_arr['timing_id'] = DB::insert('strayer_timing', $timing_setarr, TRUE);
         return;
     }
     if ($this->p_arr['is_word_replace'] == 1) {
         //同义词替换
         if ($this->p_arr['is_bbs'] != 1 && $arr['contents'] > 0) {
             //有几页的文章
             $arr['content_arr'] = article_words_replace($arr['content_arr'], $this->words);
         }
         $arr['content'] = article_words_replace($arr['content'], $this->words);
         $arr['title'] = article_words_replace($arr['title'], $this->words);
         if ($arr['reply']) {
             $arr['reply'] = article_words_replace($arr['reply'], $this->words);
         }
     }
     unset($arr['url']);
     //跟门户的跳转url重名
     unset($arr['aid']);
     if ($this->p_arr['public_type'] == 2) {
         //论坛
         if ($arr['contents'] > 1 && $arr['is_bbs'] == 0 && $this->p_arr['is_page_public'] != 1) {
             $arr['is_public_reply'] = 1;
             $arr['public_reply_seq'] = 0;
             $arr['is_content_reply'] = 1;
             $arr['is_bbs'] = 1;
             unset($arr['content_arr'][0]);
             $arr['reply'] = $arr['content_arr'];
         } else {
             if ($arr['is_bbs'] != 1) {
                 $arr['reply'] = array();
             }
         }
         $arr = article_move_forums($arr, $old_arr);
         if (!is_array($arr)) {
             if (!$arr) {
                 return -1;
             }
         }
         $insert_aid = $setarr['forum_id'] = $arr['tid'];
     } else {
         if ($this->p_arr['public_type'] == 1) {
             //门户
             $setarr['portal_id'] = $insert_aid = article_move_portal($arr, $old_arr);
         } else {
             //博客
             $setarr['blog_id'] = $insert_aid = article_move_blog($arr, $old_arr);
         }
     }
     if ($insert_aid) {
         $arr['aid'] = $insert_aid;
         if ($this->p_arr['public_type'] == 2) {
             //论坛
             $arr['cookie'] = $this->p_arr['login_cookie'];
             if ($arr['is_download_img'] == 1) {
                 forum_downremotefile($arr, $old_arr);
             }
         } else {
             $type = $this->p_arr['public_type'] == 1 ? 'portal' : 'album';
             $arr['cookie'] = $this->p_arr['login_cookie'];
             downremotefile($arr, $type, $old_arr);
         }
         if ($type == 'portal') {
             article_thumb($insert_aid);
         }
     } else {
         return -1;
     }
     $this->public_info['insert_aid'] = $insert_aid;
     $this->public_info['title'] = $arr['title'];
     return $insert_aid;
 }