|
1
|
|
|
<?php |
|
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
|
|
|
* @package \XoopsModules\SmallWorld |
|
16
|
|
|
* @copyright The XOOPS Project (https://xoops.org) |
|
17
|
|
|
* @license GNU GPL (https://www.gnu.org/licenses/gpl-2.0.html/) |
|
18
|
|
|
* @copyright 2011 Culex |
|
19
|
|
|
* @author Michael Albertsen (http://culex.dk) <[email protected]> |
|
20
|
|
|
* @link https://github.com/XoopsModules25x/smallworld |
|
21
|
|
|
* @since 1.0 |
|
22
|
|
|
*/ |
|
23
|
|
|
|
|
24
|
|
|
use XoopsModules\Smallworld; |
|
25
|
|
|
use XoopsModules\Smallworld\Constants; |
|
26
|
|
|
|
|
27
|
|
|
require_once __DIR__ . '/header.php'; |
|
28
|
|
|
|
|
29
|
|
|
$page = basename(__FILE__, '.php'); |
|
30
|
|
|
|
|
31
|
|
|
// @ todo - figure out why the test for $page is here... $page will always equal 'publicindex' |
|
32
|
|
|
if ($GLOBALS['xoopsUser'] && ($GLOBALS['xoopsUser'] instanceof \XoopsUser) && 'publicindex' !== $page) { |
|
33
|
|
|
$GLOBALS['xoopsOption']['template_main'] = 'smallworld_index.tpl'; |
|
34
|
|
|
} else { |
|
35
|
|
|
$GLOBALS['xoopsOption']['template_main'] = 'smallworld_publicindex.tpl'; |
|
36
|
|
|
} |
|
37
|
|
|
require_once XOOPS_ROOT_PATH . '/header.php'; |
|
38
|
|
|
|
|
39
|
|
|
/** @var \XoopsModules\Smallworld\Helper $helper */ |
|
40
|
|
|
require_once $helper->path('include/functions.php'); |
|
41
|
|
|
//$GLOBALS['xoopsLogger']->activated = true; |
|
42
|
|
|
//error_reporting(E_ALL); |
|
43
|
|
|
|
|
44
|
|
|
$set = smallworld_checkPrivateOrPublic(); |
|
45
|
|
|
$swDB = new Smallworld\SwDatabase(); |
|
46
|
|
|
$id = Constants::DEFAULT_UID; |
|
47
|
|
|
$username = ''; |
|
48
|
|
|
$profile = Constants::PROFILE_NONE; |
|
49
|
|
|
|
|
50
|
|
View Code Duplication |
if ($GLOBALS['xoopsUser'] instanceof \XoopsUser) { |
|
51
|
|
|
$id = $GLOBALS['xoopsUser']->uid(); |
|
52
|
|
|
$username = $GLOBALS['xoopsUser']->uname(); |
|
53
|
|
|
//$check = new Smallworld\User(); |
|
54
|
|
|
//$profile = $check->checkIfProfile($id); |
|
55
|
|
|
$profile = $helper->getHandler('SwUser')->checkIfProfile($id); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
$pub = smallworld_checkUserPubPostPerm(); |
|
59
|
|
|
$wall = new Smallworld\PublicWallUpdates(); |
|
60
|
|
|
$updates = $wall->Updates(0, $pub); |
|
|
|
|
|
|
61
|
|
|
|
|
62
|
|
|
if ($id > 0) { |
|
63
|
|
|
$GLOBALS['xoopsTpl']->assign('ownerofpage', $id); |
|
64
|
|
|
$GLOBALS['xoopsTpl']->assign('myusername', $username); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
$tplAdmin = $helper->isUserAdmin() ? 'YES' : 'NO'; |
|
68
|
|
|
|
|
69
|
|
|
// Create form for private settings |
|
70
|
|
|
$form = new Smallworld\Form(); |
|
71
|
|
|
$usersettings = $form->usersettings($id, $selected = null); |
|
72
|
|
|
$GLOBALS['xoopsTpl']->assign('usersetting', $usersettings); |
|
73
|
|
|
|
|
74
|
|
|
//$xuser = new Smallworld\Profile(); |
|
75
|
|
|
|
|
76
|
|
|
$menu_home = "<a href='" . $helper->url('/') . "'><img id='menuimg' src='" . $helper->url('assets/images/house.png') . "'>" . _SMALLWORLD_HOME . '</a>'; |
|
77
|
|
|
$menu_register = ($profile < Constants::PROFILE_HAS_BOTH) ? "<a href='" . $helper->url('register.php') . "'><img id='menuimg' src='" . $helper->url('assets/images/join.jpg') . "'>" . _MB_SYSTEM_RNOW . '</a>' : ''; |
|
78
|
|
|
|
|
79
|
|
|
$updatesarray = $wall->Updates(0, $pub); |
|
80
|
|
|
$wall->parsePubArray($updatesarray, $id); |
|
81
|
|
|
|
|
82
|
|
|
$GLOBALS['xoopsTpl']->assign( |
|
83
|
|
|
[ |
|
84
|
|
|
'menu_home' => $menu_home, |
|
85
|
|
|
'menu_register' => $menu_register, |
|
86
|
|
|
'pagename' => 'publicindex', |
|
87
|
|
|
'check' => $profile, |
|
88
|
|
|
'access' => $set['access'], |
|
89
|
|
|
'isadminuser' => $tplAdmin |
|
90
|
|
|
] |
|
91
|
|
|
); |
|
92
|
|
|
|
|
93
|
|
|
require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
94
|
|
|
|
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.