sub_sendreply.php
2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: sub_sendreply.php 35127 2014-12-02 08:17:18Z nemohou $
*/
if (!defined('IN_DISCUZ')) {
exit('Access Denied');
}
global $pid, $thread, $_G;
$newmessage = preg_replace('/<\/*.*?>| |\r\n|\[attachimg\].*?\[\/attachimg\]|\[quote\].*?\[\/quote\]|\[\/*.*?\]/ms', '', $GLOBALS['message']);
$newmessage = messagecutstr($newmessage, 100);
$key = C::t('#mobile#mobile_wsq_threadlist')->fetch($_G['tid']);
$posts = dunserialize($key['svalue']);
if (trim($newmessage) != '' && !getstatus($thread['status'], 2)) {
if (!$posts) {
$posts = array();
}
if (count($posts) > 2) {
array_shift($posts);
}
$post = array(
'pid' => $pid,
'author' => empty($_GET['isanonymous']) ? $_G['username'] : $_G['setting']['anonymoustext'],
'authorid' => empty($_GET['isanonymous']) ? $_G['uid'] : 0,
'message' => $newmessage,
);
array_push($posts, $post);
}
if (count($posts) < 3 && ($thread['replies'] >= count($posts)) && !getstatus($thread['status'], 2)) {
$posts = array();
foreach (C::t('forum_post')->fetch_all_by_tid($thread['posttableid'], $thread['tid'], true, 'DESC', 0, 10, 0, 0) as $p) {
$p['message'] = preg_replace('/<\/*.*?>| |\r\n|\[attachimg\].*?\[\/attachimg\]|\[quote\].*?\[\/quote\]|\[\/*.*?\]/ms', '', $p['message']);
$p['message'] = trim(messagecutstr($p['message'], 100));
if($p['anonymous']) {
$p['author'] = $_G['setting']['anonymoustext'];
$p['authorid'] = 0;
}
$post = array(
'pid' => $p['pid'],
'author' => $p['author'],
'authorid' => $p['authorid'],
'message' => $p['message'],
'avatar' => avatar($p['authorid'], 'small', true),
);
if ($post['message'] != '') {
array_push($posts, $post);
}
if (count($posts) > 2) {
break;
}
}
$posts = array_reverse($posts);
}
$data = array(
'skey' => $_G['tid'],
'svalue' => serialize($posts)
);
if($message != 'post_reply_mod_succeed') {
C::t('#mobile#mobile_wsq_threadlist')->insert($_G['tid'], $data, false, true);
}
?>