-
Notifications
You must be signed in to change notification settings - Fork 5
/
recentactivities.php
93 lines (82 loc) · 3.73 KB
/
recentactivities.php
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/*
* You may not change or alter any portion of this comment or credits
* of supporting developers from this source code or any supporting source code
* which is considered copyrighted (c) material of the original comment or credit authors.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
* SmallWorld
*
* @package \XoopsModules\SmallWorld
* @license GNU GPL (https://www.gnu.org/licenses/gpl-2.0.html/)
* @copyright The XOOPS Project (https://xoops.org)
* @copyright 2011 Culex
* @author Michael Albertsen (http://culex.dk) <[email protected]>
* @link https://github.com/XoopsModules25x/smallworld
* @since 1.0
*/
use Xmf\Request;
use XoopsModules\Smallworld;
use XoopsModules\Smallworld\Constants;
require_once __DIR__ . '/header.php';
/** @var \XoopsModules\Smallworld\Helper $helper
* @var \MyTextSanitizer $myts
*/
require_once $helper->path('include/functions.php');
require_once XOOPS_ROOT_PATH . '/class/template.php';
$GLOBALS['xoopsLogger']->activated = false;
$tpl = new \XoopsTpl();
$helper->loadLanguage('user');
$username = Request::getString('username', '', 'GET');
$id = $helper->getHandler('SwUser')->getByName($username); // get id of user which profile you want to see
//$id = smallworld_isset_or(Request::getString('username', '', 'GET')); // get id of user which profile you want to see
//$id = (int)$id; // smallworld_isset_or doesn't always return an integer
$thisUser = new \XoopsUser($id);
/** @todo refactor using Smallworld\Helper permissions helper */
$moduleHandler = xoops_getHandler('module');
$gpermHandler = xoops_getHandler('groupperm');
$groups = ($GLOBALS['xoopsUser'] instanceof \XoopsUser) ? $GLOBALS['xoopsUser']->getGroups() : 0;
$criteria = new \CriteriaCompo(new \Criteria('hassearch', 1));
$criteria->add(new \Criteria('isactive', 1));
$mids = array_keys($moduleHandler->getList($criteria));
foreach ($mids as $mid) {
if ($gpermHandler->checkRight('module_read', $mid, $groups)) {
$module = $moduleHandler->get($mid);
$results = $module->search('', '', 5, 0, $id);
$count = count($results);
if (is_array($results) && $count > 0) {
for ($i = 0; $i < $count; ++$i) {
if (isset($results[$i]['image']) && '' !== $results[$i]['image']) {
$results[$i]['image'] = $helper->url($results[$i]['image']);
} else {
$results[$i]['image'] = XOOPS_URL . '/images/icons/posticon2.gif';
}
if (!preg_match("/^http[s]*:\/\//i", $results[$i]['link'])) {
$results[$i]['link'] = $helper->url($results[$i]['link']);
}
$results[$i]['title'] = $myts->htmlSpecialChars($results[$i]['title']);
$results[$i]['time'] = $results[$i]['time'] ? formatTimestamp($results[$i]['time']) : '';
}
if (5 == $count) {
$showall_link = '<a href="' . XOOPS_URL . '/search.php?action=showallbyuser&mid=' . $mid . '&uid=' . $id . '">' . _US_SHOWALL . '</a>';
} else {
$showall_link = '';
}
$tpl->assign('lang_allaboutuser', sprintf(_US_ALLABOUT, $thisUser->getVar('uname')));
$tpl->append(
'modules',
[
'name' => $module->getVar('name'),
'results' => $results,
'showall_link' => $showall_link,
]
);
}
unset($module);
}
}
$tpl->display($helper->path('templates/smallworld_userinfo.tpl'));