1
|
|
|
<?php namespace Xoopsmodules\smallworld; |
2
|
|
|
/** |
3
|
|
|
* You may not change or alter any portion of this comment or credits |
4
|
|
|
* of supporting developers from this source code or any supporting source code |
5
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
6
|
|
|
* |
7
|
|
|
* This program is distributed in the hope that it will be useful, |
8
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
9
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* SmallWorld |
14
|
|
|
* |
15
|
|
|
* @copyright The XOOPS Project (https://xoops.org) |
16
|
|
|
* @copyright 2011 Culex |
17
|
|
|
* @license GNU GPL (http://www.gnu.org/licenses/gpl-2.0.html/) |
18
|
|
|
* @package SmallWorld |
19
|
|
|
* @since 1.0 |
20
|
|
|
* @author Michael Albertsen (http://culex.dk) <[email protected]> |
21
|
|
|
*/ |
22
|
|
|
// Moderated and fitted from the tutorial by Srinivas Tamada http://9lessons.info |
23
|
|
|
|
24
|
|
|
class PublicWallUpdates |
25
|
|
|
{ |
26
|
|
|
private function getAdminModerators() |
|
|
|
|
27
|
|
|
{ |
28
|
|
|
global $xoopsDB, $xoopsUser; |
29
|
|
|
$sql = 'SELECT userid |
30
|
|
|
FROM ' . $xoopsDB->prefix('smallworld_user') . ' su |
31
|
|
|
LEFT JOIN ' . $xoopsDB->prefix('groups_users_link') . ' xu ON su.userid = xu.uid |
32
|
|
|
WHERE xu.uid IN (1)'; |
33
|
|
|
$result = $xoopsDB->queryF($sql); |
34
|
|
|
while ($row = $xoopsDB->fetchArray($result)) { |
35
|
|
|
$data[] = $row; |
|
|
|
|
36
|
|
|
} |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Get arry of users being inspected |
41
|
|
|
* |
42
|
|
|
* |
43
|
|
|
*/ |
44
|
|
|
|
45
|
|
View Code Duplication |
public function inspected() |
|
|
|
|
46
|
|
|
{ |
47
|
|
|
global $xoopsDB; |
48
|
|
|
$sql = 'SELECT userid FROM ' . $xoopsDB->prefix('smallworld_admin') . ' WHERE (inspect_start+inspect_stop) > ' . time() . ''; |
49
|
|
|
$result = $xoopsDB->queryF($sql); |
50
|
|
|
$data = []; |
51
|
|
|
while ($row = $xoopsDB->fetchArray($result)) { |
52
|
|
|
$data[] = $row; |
53
|
|
|
} |
54
|
|
|
if (!empty($data)) { |
55
|
|
|
$sub = implode(',', Smallworld_array_flatten(array_unique($data), 0)); |
56
|
|
|
} else { |
57
|
|
|
$sub = 0; |
58
|
|
|
} |
59
|
|
|
return $sub; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @Get array of updates |
64
|
|
|
* @param int $last |
65
|
|
|
* @param array $moderators |
66
|
|
|
* @return array|bool |
|
|
|
|
67
|
|
|
*/ |
68
|
|
View Code Duplication |
public function Updates($last, $moderators) |
|
|
|
|
69
|
|
|
{ |
70
|
|
|
global $xoopsUser, $xoopsDB, $moduleConfig, $xoopsLogger; |
71
|
|
|
$moderators = is_array($moderators) ? $moderators : [$moderators]; |
72
|
|
|
$hm = smallworld_GetModuleOption('msgtoshow'); |
73
|
|
|
$set = smallworld_checkPrivateOrPublic(); |
|
|
|
|
74
|
|
|
$mods = implode(',', Smallworld_array_flatten(array_unique($moderators), 0)); |
75
|
|
|
$inspected = $this->inspected(); |
76
|
|
|
$perm = smallworld_GetModuleOption('smallworldshowPoPubPage'); |
|
|
|
|
77
|
|
|
$i = 0; |
|
|
|
|
78
|
|
|
|
79
|
|
|
if (0 == $last) { |
80
|
|
|
$query = 'SELECT M.msg_id, M.uid_fk, M.priv, M.message, M.created, U.username FROM ' |
81
|
|
|
. $xoopsDB->prefix('smallworld_messages') |
82
|
|
|
. ' M, ' |
83
|
|
|
. $xoopsDB->prefix('smallworld_user') |
84
|
|
|
. ' U WHERE M.uid_fk=U.userid AND M.uid_fk IN (' |
85
|
|
|
. $mods |
86
|
|
|
. ') AND M.uid_fk NOT IN (' |
87
|
|
|
. $inspected |
88
|
|
|
. ") AND M.priv = '0'"; |
89
|
|
|
} elseif ($last > 0) { |
90
|
|
|
$query = 'SELECT M.msg_id, M.uid_fk, M.priv, M.message, M.created, U.username FROM ' |
91
|
|
|
. $xoopsDB->prefix('smallworld_messages') |
92
|
|
|
. ' M, ' |
93
|
|
|
. $xoopsDB->prefix('smallworld_user') |
94
|
|
|
. ' U WHERE M.uid_fk=U.userid AND M.uid_fk IN (' |
95
|
|
|
. $mods |
96
|
|
|
. ') AND M.uid_fk NOT IN (' |
97
|
|
|
. $inspected |
98
|
|
|
. ") AND M.priv = '0' AND M.msg_id < '" |
99
|
|
|
. $last |
100
|
|
|
. "'"; |
101
|
|
|
} elseif ('a' == $last) { |
102
|
|
|
$query = 'SELECT M.msg_id, M.uid_fk, M.priv, M.message, M.created, U.username FROM ' |
103
|
|
|
. $xoopsDB->prefix('smallworld_messages') |
104
|
|
|
. ' M, ' |
105
|
|
|
. $xoopsDB->prefix('smallworld_user') |
106
|
|
|
. ' U WHERE M.uid_fk=U.userid AND M.uid_fk IN (' |
107
|
|
|
. $mods |
108
|
|
|
. ') AND M.uid_fk NOT IN (' |
109
|
|
|
. $inspected |
110
|
|
|
. ") AND M.priv = '0'"; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
if ($last > 0) { |
114
|
|
|
$query .= ' order by created DESC LIMIT ' . $hm; |
|
|
|
|
115
|
|
|
} elseif ('a' == $last) { |
116
|
|
|
$query .= ' order by M.msg_id DESC LIMIT ' . $hm; |
117
|
|
|
} else { |
118
|
|
|
$query .= ' order by created DESC LIMIT ' . $hm; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
$result = $xoopsDB->queryF($query); |
122
|
|
|
$count = $xoopsDB->getRowsNum($result); |
123
|
|
|
if (0 == $count) { |
124
|
|
|
return false; |
125
|
|
|
} else { |
126
|
|
|
while ($row = $xoopsDB->fetchArray($result)) { |
127
|
|
|
$data[] = $row; |
|
|
|
|
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
if (!empty($data)) { |
131
|
|
|
return $data; |
132
|
|
|
} |
133
|
|
|
} |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @Get comments based on msg id |
138
|
|
|
* @param int $msg_id |
139
|
|
|
* @return array |
|
|
|
|
140
|
|
|
*/ |
141
|
|
View Code Duplication |
public function Comments($msg_id) |
|
|
|
|
142
|
|
|
{ |
143
|
|
|
global $xoopsUser, $xoopsDB; |
144
|
|
|
$inspected = $this->inspected(); |
145
|
|
|
$query = 'SELECT C.msg_id_fk, C.com_id, C.uid_fk, C.comment, C.created, U.username FROM ' |
146
|
|
|
. $xoopsDB->prefix('smallworld_comments') |
147
|
|
|
. ' C, ' |
148
|
|
|
. $xoopsDB->prefix('smallworld_user') |
149
|
|
|
. " U WHERE C.uid_fk=U.userid AND C.msg_id_fk='" |
150
|
|
|
. $msg_id |
151
|
|
|
. "' AND C.uid_fk NOT IN (" |
152
|
|
|
. $inspected |
153
|
|
|
. ') ORDER BY C.com_id ASC '; |
154
|
|
|
$result = $xoopsDB->queryF($query); |
155
|
|
|
$i = $xoopsDB->getRowsNum($result); |
|
|
|
|
156
|
|
|
while ($row = $xoopsDB->fetchArray($result)) { |
157
|
|
|
$data[] = $row; |
|
|
|
|
158
|
|
|
} |
159
|
|
|
if (!empty($data)) { |
160
|
|
|
return $data; |
161
|
|
|
} |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @Get user image based on uid |
166
|
|
|
* @param int $uid |
167
|
|
|
* @return string |
168
|
|
|
*/ |
169
|
|
|
public function Gravatar($uid) |
170
|
|
|
{ |
171
|
|
|
global $xoopsUser, $xoopsDB; |
172
|
|
|
$image = ''; |
173
|
|
|
$sql = 'SELECT userimage FROM ' . $xoopsDB->prefix('smallworld_user') . " WHERE userid = '" . $uid . "'"; |
174
|
|
|
$result = $xoopsDB->queryF($sql); |
175
|
|
|
while ($r = $xoopsDB->fetchArray($result)) { |
176
|
|
|
$image = $r['userimage']; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
if ('blank.gif' === $image) { |
180
|
|
|
$image = smallworld_getAvatarLink($uid, $image); |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
//$image = ($image == '' || $image == 'blank.gif') ? smallworld_getAvatarLink($uid, $image) : $image; |
184
|
|
|
|
185
|
|
|
$type = [ |
186
|
|
|
1 => 'jpg', |
187
|
|
|
2 => 'jpeg', |
188
|
|
|
3 => 'png', |
189
|
|
|
4 => 'gif' |
190
|
|
|
]; |
191
|
|
|
|
192
|
|
|
$ext = explode('.', $image); |
193
|
|
|
|
194
|
|
|
if (@!in_array(strtolower($ext[1]), $type) || '' == $image) { |
195
|
|
|
$avatar = ''; |
196
|
|
|
} else { |
197
|
|
|
$avatar = $image; |
198
|
|
|
} |
199
|
|
|
return $avatar; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* @count all votes |
204
|
|
|
* @param int $type |
205
|
|
|
* @param int $val |
206
|
|
|
* @param int $msgid |
207
|
|
|
* @return int |
208
|
|
|
*/ |
209
|
|
View Code Duplication |
public function countVotes($type, $val, $msgid) |
|
|
|
|
210
|
|
|
{ |
211
|
|
|
global $xoopsUser, $xoopsDB; |
212
|
|
|
$sum = 0; |
213
|
|
|
$query = 'Select SUM(' . $val . ') as sum from ' . $xoopsDB->prefix('smallworld_vote') . " where msg_id = '" . $msgid . "' and com_id = '0'"; |
214
|
|
|
$result = $xoopsDB->queryF($query); |
215
|
|
|
while ($row = $xoopsDB->fetchArray($result)) { |
216
|
|
|
$sum = $row['sum']; |
217
|
|
|
} |
218
|
|
|
if ('' == $sum) { |
219
|
|
|
$sum = 0; |
220
|
|
|
} |
221
|
|
|
return $sum; |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
/** |
225
|
|
|
* @Count comments votes |
226
|
|
|
* @param int $type |
227
|
|
|
* @param int $val |
228
|
|
|
* @param int $comid |
229
|
|
|
* @param int $msgid |
230
|
|
|
* @returns int |
231
|
|
|
*/ |
232
|
|
View Code Duplication |
public function countVotesCom($type, $val, $comid, $msgid) |
|
|
|
|
233
|
|
|
{ |
234
|
|
|
global $xoopsUser, $xoopsDB; |
235
|
|
|
$sum = 0; |
236
|
|
|
$query = 'Select SUM(' . $val . ') as sum from ' . $xoopsDB->prefix('smallworld_vote') . " where com_id = '" . $comid . "' AND msg_id = '" . $msgid . "'"; |
237
|
|
|
$result = $xoopsDB->queryF($query); |
238
|
|
|
while ($row = $xoopsDB->fetchArray($result)) { |
239
|
|
|
$sum = $row['sum']; |
240
|
|
|
} |
241
|
|
|
if ('' == $sum) { |
242
|
|
|
$sum = 0; |
243
|
|
|
} |
244
|
|
|
return $sum; |
245
|
|
|
} |
246
|
|
|
|
247
|
|
|
/** |
248
|
|
|
* @Check is user is friend |
249
|
|
|
* @param int $userid |
250
|
|
|
* @param string $type |
251
|
|
|
* @param int $comid |
252
|
|
|
* @param int $msgid |
253
|
|
|
* @return int |
254
|
|
|
*/ |
255
|
|
View Code Duplication |
public function HasVoted($userid, $type, $comid, $msgid) |
|
|
|
|
256
|
|
|
{ |
257
|
|
|
global $xoopsUser, $xoopsDB; |
258
|
|
|
if ('msg' === $type) { |
259
|
|
|
$sql = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_vote') . " WHERE com_id = '0' AND msg_id = '" . $msgid . "' AND user_id = '" . $userid . "'"; |
260
|
|
|
$result = $xoopsDB->queryF($sql); |
261
|
|
|
$i = $xoopsDB->getRowsNum($result); |
262
|
|
|
} else { |
263
|
|
|
$sql = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_vote') . " WHERE com_id = '" . $comid . "' AND msg_id = '" . $msgid . "' AND user_id = '" . $userid . "'"; |
264
|
|
|
$result = $xoopsDB->queryF($sql); |
265
|
|
|
$i = $xoopsDB->getRowsNum($result); |
266
|
|
|
} |
267
|
|
|
return $i; |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
/** |
271
|
|
|
* @count messages per user |
272
|
|
|
* @param int $userid |
273
|
|
|
* @return int |
274
|
|
|
*/ |
275
|
|
|
public function CountMsges($userid) |
276
|
|
|
{ |
277
|
|
|
global $xoopsDB; |
278
|
|
|
$sql = 'SELECT (SELECT COUNT(*) FROM ' . $xoopsDB->prefix('smallworld_comments') . " WHERE uid_fk = '" . $userid . "') + (SELECT COUNT(*) FROM " . $xoopsDB->prefix('smallworld_messages') . " WHERE uid_fk = '" . $userid . "')"; |
279
|
|
|
$result = $xoopsDB->queryF($sql); |
280
|
|
|
$sum = $xoopsDB->fetchRow($result); |
281
|
|
|
return $sum[0]; |
282
|
|
|
} |
283
|
|
|
|
284
|
|
|
/** |
285
|
|
|
* @Show permaling updates |
286
|
|
|
* @param int $updid |
287
|
|
|
* @param int $uid |
288
|
|
|
* @param int $ownerID |
289
|
|
|
* @return array|bool |
|
|
|
|
290
|
|
|
*/ |
291
|
|
|
public function UpdatesPermalink($updid, $uid, $ownerID) |
|
|
|
|
292
|
|
|
{ |
293
|
|
|
global $xoopsUser, $xoopsDB, $moduleConfig; |
294
|
|
|
$query = 'SELECT M.msg_id, M.uid_fk, M.message, M.created, M.priv, U.username FROM ' . $xoopsDB->prefix('smallworld_messages') . ' M, ' . $xoopsDB->prefix('smallworld_user') . " U WHERE M.uid_fk=U.userid AND M.uid_fk='" . $ownerID . "'"; |
295
|
|
|
$query .= " AND M.msg_id = '" . $updid . "'"; |
296
|
|
|
$query .= ' order by M.created DESC LIMIT 1'; |
297
|
|
|
$result = $xoopsDB->queryF($query); |
298
|
|
|
$count = $xoopsDB->getRowsNum($result); |
299
|
|
|
if ($count < 1) { |
300
|
|
|
return false; |
301
|
|
|
} else { |
302
|
|
|
while ($row = $xoopsDB->fetchArray($result)) { |
303
|
|
|
$data[] = $row; |
|
|
|
|
304
|
|
|
} |
305
|
|
|
if (!empty($data)) { |
306
|
|
|
return $data; |
307
|
|
|
} |
308
|
|
|
} |
309
|
|
|
} |
310
|
|
|
|
311
|
|
|
/** |
312
|
|
|
* @Get share link |
313
|
|
|
* @param int $updid |
314
|
|
|
* @param int $ownerID |
315
|
|
|
* @return array|bool |
|
|
|
|
316
|
|
|
*/ |
317
|
|
|
public function UpdatesSharelink($updid, $ownerID) |
318
|
|
|
{ |
319
|
|
|
global $xoopsUser, $xoopsDB, $moduleConfig; |
320
|
|
|
$query = 'SELECT M.msg_id, M.uid_fk, M.message, M.created, M.priv, U.username FROM ' . $xoopsDB->prefix('smallworld_messages') . ' M, ' . $xoopsDB->prefix('smallworld_user') . " U WHERE M.uid_fk=U.userid AND M.uid_fk='" . $ownerID . "' AND M.priv = 0"; |
321
|
|
|
$query .= " AND M.msg_id = '" . $updid . "'"; |
322
|
|
|
$query .= ' order by created DESC LIMIT 1'; |
323
|
|
|
$result = $xoopsDB->queryF($query); |
324
|
|
|
$count = $xoopsDB->getRowsNum($result); |
325
|
|
|
if ($count < 1) { |
326
|
|
|
return false; |
327
|
|
|
} else { |
328
|
|
|
while ($row = $xoopsDB->fetchArray($result)) { |
329
|
|
|
$data[] = $row; |
|
|
|
|
330
|
|
|
} |
331
|
|
|
if (!empty($data)) { |
332
|
|
|
return $data; |
333
|
|
|
} |
334
|
|
|
} |
335
|
|
|
} |
336
|
|
|
|
337
|
|
|
/** |
338
|
|
|
* @Get sharing link |
339
|
|
|
* @param int $id |
340
|
|
|
* @param int $priv |
341
|
|
|
* @return string |
342
|
|
|
*/ |
343
|
|
View Code Duplication |
public function GetSharing($id, $priv) |
|
|
|
|
344
|
|
|
{ |
345
|
|
|
if (1 != $priv) { |
346
|
|
|
$text = " | <span class='smallworld_share' id='smallworld_share'>"; |
347
|
|
|
$text .= "<a class='share' id='share-page" . $id . "' href='javascript:void(0);'>" . _SMALLWORLD_SHARELINK . '</a></span>'; |
348
|
|
|
} else { |
349
|
|
|
$text = ''; |
350
|
|
|
} |
351
|
|
|
return $text; |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
/** |
355
|
|
|
* @Get content for sharing div |
356
|
|
|
* @param int $id |
357
|
|
|
* @param int $priv |
358
|
|
|
* @param string $permalink |
359
|
|
|
* @param string $desc |
360
|
|
|
* @param string $username |
361
|
|
|
* @return string |
362
|
|
|
*/ |
363
|
|
View Code Duplication |
public function GetSharingDiv($id, $priv, $permalink, $desc, $username) |
|
|
|
|
364
|
|
|
{ |
365
|
|
|
if (1 != $priv) { |
366
|
|
|
$text = "<div style='display: none;' class='smallworld_bookmarks' id='share-page' name='share-page" . $id . "'>"; |
367
|
|
|
$text .= "<span name='share-page" . $id . "' rel1='" . $desc . "' rel2= '" . $username . "' rel=" . $permalink . " id='basicBookmark' title='" . _SMALLWORLD_SHAREBOX_TITLE . "'>"; |
368
|
|
|
$text .= '</span></div>'; |
369
|
|
|
} else { |
370
|
|
|
$text = ''; |
371
|
|
|
} |
372
|
|
|
return $text; |
373
|
|
|
} |
374
|
|
|
|
375
|
|
|
/** |
376
|
|
|
* @Parse update and comments array to template for public updates |
377
|
|
|
* @param array $updatesarray |
378
|
|
|
* @param int $id |
379
|
|
|
* @return void |
380
|
|
|
*/ |
381
|
|
View Code Duplication |
public function ParsePubArray($updatesarray, $id) |
|
|
|
|
382
|
|
|
{ |
383
|
|
|
global $xoopsUser, $xoopsTpl, $tpl, $xoopsModule, $xoopsTpl, $xoopsConfig; |
384
|
|
|
$wm = []; |
385
|
|
|
$check = new SmallWorldUser; |
386
|
|
|
$dBase = new SmallWorldDB; |
387
|
|
|
$profile = $xoopsUser ? $check->checkIfProfile($id) : 0; |
388
|
|
|
$moduleHandler = xoops_getHandler('module'); |
389
|
|
|
$module = $moduleHandler->getByDirname('smallworld'); |
390
|
|
|
$configHandler = xoops_getHandler('config'); |
391
|
|
|
$moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
|
|
|
|
392
|
|
|
|
393
|
|
|
$myavatar = $this->Gravatar($id); |
394
|
|
|
$myavatarlink = smallworld_getAvatarLink($id, $myavatar); |
395
|
|
|
$myavatar_size = smallworld_getImageSize(80, 100, $myavatarlink); |
|
|
|
|
396
|
|
|
$myavatar_highwide = smallworld_imageResize($myavatar_size[0], $myavatar_size[1], 100); |
397
|
|
|
$user_img = "<img src='" . smallworld_getAvatarLink($id, $myavatar) . "' id='smallworld_user_img' " . $myavatar_highwide . '>'; |
398
|
|
|
|
399
|
|
|
$xoopsTpl->assign('myavatar', $myavatar); |
400
|
|
|
$xoopsTpl->assign('myavatarlink', $myavatarlink); |
401
|
|
|
$xoopsTpl->assign('myavatar_highwide', $myavatar_highwide); |
402
|
|
|
$xoopsTpl->assign('avatar', $user_img); |
403
|
|
|
|
404
|
|
|
if (!empty($updatesarray)) { |
405
|
|
|
foreach ($updatesarray as $data) { |
406
|
|
|
|
407
|
|
|
// Is update's user a friend ? |
408
|
|
|
$frU = $check->friendcheck($id, $data['uid_fk']); |
409
|
|
|
|
410
|
|
|
$USW = []; |
411
|
|
|
$USW['posts'] = 0; |
412
|
|
|
$USW['comments'] = 0; |
413
|
|
|
|
414
|
|
|
if ($xoopsUser) { |
415
|
|
|
if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) || $data['uid_fk'] == $id) { |
416
|
|
|
$USW['posts'] = 1; |
417
|
|
|
$USW['comments'] = 1; |
418
|
|
|
$frU[0] = 2; |
419
|
|
|
} else { |
420
|
|
|
$USW = json_decode($dBase->GetSettings($data['uid_fk']), true); |
421
|
|
|
} |
422
|
|
|
} |
423
|
|
|
|
424
|
|
|
if (!$xoopsUser) { |
425
|
|
|
$USW = json_decode($dBase->GetSettings($data['uid_fk']), true); |
426
|
|
|
} |
427
|
|
|
|
428
|
|
|
$wm['msg_id'] = $data['msg_id']; |
429
|
|
|
$wm['orimessage'] = (1 == $USW['posts'] || $profile >= 2) ? str_replace(["\r", "\n"], '', Smallworld_stripWordsKeepUrl($data['message'])) : ''; |
430
|
|
|
$wm['message'] = (1 == $USW['posts'] || $profile >= 2) ? smallworld_tolink(htmlspecialchars_decode($data['message']), $data['uid_fk']) : _SMALLWORLD_MESSAGE_PRIVSETPOSTS; |
431
|
|
|
$wm['message'] = Smallworld_cleanup($wm['message']); |
432
|
|
|
$wm['created'] = smallworld_time_stamp($data['created']); |
433
|
|
|
$wm['username'] = $data['username']; |
434
|
|
|
$wm['uid_fk'] = $data['uid_fk']; |
435
|
|
|
$wm['priv'] = $data['priv']; |
436
|
|
|
$wm['avatar'] = $this->Gravatar($data['uid_fk']); |
437
|
|
|
$wm['avatar_link'] = smallworld_getAvatarLink($data['uid_fk'], $wm['avatar']); |
438
|
|
|
$wm['avatar_size'] = smallworld_getImageSize(80, 100, $wm['avatar_link']); |
|
|
|
|
439
|
|
|
$wm['avatar_highwide'] = smallworld_imageResize($wm['avatar_size'][0], $wm['avatar_size'][1], 50); |
440
|
|
|
$wm['vote_up'] = $this->countVotes('msg', 'up', $data['msg_id']); |
441
|
|
|
$wm['vote_down'] = $this->countVotes('msg', 'down', $data['msg_id']); |
442
|
|
|
$wm['sharelinkurl'] = XOOPS_URL . '/modules/smallworld/smallworldshare.php?ownerid=' . $data['uid_fk']; |
443
|
|
|
$wm['sharelinkurl'] .= '&updid=' . $data['msg_id'] . ''; |
444
|
|
|
$wm['usernameTitle'] = $wm['username'] . _SMALLWORLD_UPDATEONSITEMETA . $xoopsConfig['sitename']; |
445
|
|
|
if (1 == $USW['posts'] || $profile >= 2) { |
446
|
|
|
$wm['sharelink'] = $this->GetSharing($wm['msg_id'], $wm['priv']); |
447
|
|
|
} else { |
448
|
|
|
$wm['sharelink'] = $this->GetSharing($wm['msg_id'], 1); |
449
|
|
|
} |
450
|
|
|
|
451
|
|
|
if (1 == $USW['posts'] || $profile >= 2) { |
452
|
|
|
$wm['sharediv'] = $this->GetSharingDiv($wm['msg_id'], $wm['priv'], $wm['sharelinkurl'], $wm['orimessage'], $wm['usernameTitle']); |
453
|
|
|
} else { |
454
|
|
|
$wm['sharediv'] = $this->GetSharingDiv($wm['msg_id'], 1, $wm['sharelinkurl'], $wm['orimessage'], $wm['usernameTitle']); |
455
|
|
|
} |
456
|
|
|
$wm['linkimage'] = XOOPS_URL . '/modules/smallworld/assets/images/link.png'; |
457
|
|
|
$wm['permalink'] = XOOPS_URL . '/modules/smallworld/permalink.php?ownerid=' . $data['uid_fk'] . '&updid=' . $data['msg_id']; |
458
|
|
|
$wm['commentsarray'] = $this->Comments($data['msg_id']); |
459
|
|
|
|
460
|
|
|
if (2 == $frU[0] || 1 == $USW['posts']) { |
461
|
|
|
$xoopsTpl->append('walldata', $wm); |
462
|
|
|
} |
463
|
|
|
|
464
|
|
|
if (!empty($wm['commentsarray'])) { |
465
|
|
|
foreach ($wm['commentsarray'] as $cdata) { |
466
|
|
|
// Is commentuser a friend ? |
467
|
|
|
$frC = $check->friendcheck($id, $cdata['uid_fk']); |
468
|
|
|
|
469
|
|
|
$USC = []; |
470
|
|
|
$USC['posts'] = 0; |
471
|
|
|
$USC['comments'] = 0; |
472
|
|
|
|
473
|
|
|
if ($xoopsUser) { |
474
|
|
|
if ($xoopsUser->isAdmin($xoopsModule->getVar('mid')) || $cdata['uid_fk'] == $id) { |
475
|
|
|
$USC['posts'] = 1; |
476
|
|
|
$USC['comments'] = 1; |
477
|
|
|
$frC[0] = 2; |
478
|
|
|
} else { |
479
|
|
|
$USC = json_decode($dBase->GetSettings($cdata['uid_fk']), true); |
480
|
|
|
} |
481
|
|
|
} |
482
|
|
|
|
483
|
|
|
if (!$xoopsUser) { |
484
|
|
|
$USC = json_decode($dBase->GetSettings($cdata['uid_fk']), true); |
485
|
|
|
} |
486
|
|
|
|
487
|
|
|
$wc['msg_id_fk'] = $cdata['msg_id_fk']; |
|
|
|
|
488
|
|
|
$wc['com_id'] = $cdata['com_id']; |
489
|
|
|
$wc['comment'] = (1 == $USC['comments'] || $profile >= 2) ? smallworld_tolink(htmlspecialchars_decode($cdata['comment']), $cdata['uid_fk']) : _SMALLWORLD_MESSAGE_PRIVSETCOMMENTS; |
490
|
|
|
$wc['comment'] = Smallworld_cleanup($wc['comment']); |
491
|
|
|
$wc['time'] = smallworld_time_stamp($cdata['created']); |
492
|
|
|
$wc['username'] = $cdata['username']; |
493
|
|
|
$wc['uid'] = $cdata['uid_fk']; |
494
|
|
|
$wc['myavatar'] = $this->Gravatar($id); |
495
|
|
|
$wc['myavatar_link'] = $myavatarlink; |
496
|
|
|
$wc['avatar_size'] = smallworld_getImageSize(80, 100, $wc['myavatar_link']); |
|
|
|
|
497
|
|
|
$wc['avatar_highwide'] = smallworld_imageResize($wc['avatar_size'][0], $wc['avatar_size'][1], 35); |
498
|
|
|
$wc['cface'] = $this->Gravatar($cdata['uid_fk']); |
499
|
|
|
$wc['avatar_link'] = smallworld_getAvatarLink($cdata['uid_fk'], $wc['cface']); |
500
|
|
|
$wc['vote_up'] = $this->countVotesCom('com', 'up', $cdata['msg_id_fk'], $cdata['com_id']); |
501
|
|
|
$wc['vote_down'] = $this->countVotesCom('com', 'down', $cdata['msg_id_fk'], $cdata['com_id']); |
502
|
|
|
|
503
|
|
|
if (2 == $frC[0] || 1 == $USC['comments']) { |
504
|
|
|
$xoopsTpl->append('comm', $wc); |
505
|
|
|
} |
506
|
|
|
} |
507
|
|
|
} |
508
|
|
|
} |
509
|
|
|
} |
510
|
|
|
} |
511
|
|
|
} |
512
|
|
|
|