-
Notifications
You must be signed in to change notification settings - Fork 5
/
publicindex.php
93 lines (76 loc) · 3.29 KB
/
publicindex.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
* @copyright The XOOPS Project (https://xoops.org)
* @license GNU GPL (https://www.gnu.org/licenses/gpl-2.0.html/)
* @copyright 2011 Culex
* @author Michael Albertsen (http://culex.dk) <[email protected]>
* @link https://github.com/XoopsModules25x/smallworld
* @since 1.0
*/
use XoopsModules\Smallworld;
use XoopsModules\Smallworld\Constants;
require_once __DIR__ . '/header.php';
$page = basename(__FILE__, '.php');
// @ todo - figure out why the test for $page is here... $page will always equal 'publicindex'
if ($GLOBALS['xoopsUser'] && ($GLOBALS['xoopsUser'] instanceof \XoopsUser) && 'publicindex' !== $page) {
$GLOBALS['xoopsOption']['template_main'] = 'smallworld_index.tpl';
} else {
$GLOBALS['xoopsOption']['template_main'] = 'smallworld_publicindex.tpl';
}
require_once XOOPS_ROOT_PATH . '/header.php';
/** @var \XoopsModules\Smallworld\Helper $helper */
require_once $helper->path('include/functions.php');
//$GLOBALS['xoopsLogger']->activated = true;
//error_reporting(E_ALL);
$set = smallworld_checkPrivateOrPublic();
$swDB = new Smallworld\SwDatabase();
$id = Constants::DEFAULT_UID;
$username = '';
$profile = Constants::PROFILE_NONE;
if ($GLOBALS['xoopsUser'] instanceof \XoopsUser) {
$id = $GLOBALS['xoopsUser']->uid();
$username = $GLOBALS['xoopsUser']->uname();
//$check = new Smallworld\User();
//$profile = $check->checkIfProfile($id);
$profile = $helper->getHandler('SwUser')->checkIfProfile($id);
}
$pub = smallworld_checkUserPubPostPerm();
$wall = new Smallworld\PublicWallUpdates();
$updates = $wall->Updates(0, $pub);
if ($id > 0) {
$GLOBALS['xoopsTpl']->assign('ownerofpage', $id);
$GLOBALS['xoopsTpl']->assign('myusername', $username);
}
$tplAdmin = $helper->isUserAdmin() ? 'YES' : 'NO';
// Create form for private settings
$form = new Smallworld\Form();
$usersettings = $form->usersettings($id, $selected = null);
$GLOBALS['xoopsTpl']->assign('usersetting', $usersettings);
//$xuser = new Smallworld\Profile();
$menu_home = "<a href='" . $helper->url('/') . "'><img id='menuimg' src='" . $helper->url('assets/images/house.png') . "'>" . _SMALLWORLD_HOME . '</a>';
$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>' : '';
$updatesarray = $wall->Updates(0, $pub);
$wall->parsePubArray($updatesarray, $id);
$GLOBALS['xoopsTpl']->assign(
[
'menu_home' => $menu_home,
'menu_register' => $menu_register,
'pagename' => 'publicindex',
'check' => $profile,
'access' => $set['access'],
'isadminuser' => $tplAdmin
]
);
require_once XOOPS_ROOT_PATH . '/footer.php';