-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgalleryshow.php
84 lines (73 loc) · 3.52 KB
/
galleryshow.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
<?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) <culex@culex.dk>
* @link https://github.com/XoopsModules25x/smallworld
* @since 1.0
*/
use Xmf\Request;
use XoopsModules\Smallworld;
use XoopsModules\Smallworld\Constants;
require_once __DIR__ . '/header.php';
$GLOBALS['xoopsOption']['template_main'] = 'smallworld_galleryshow.tpl';
require_once XOOPS_ROOT_PATH . '/header.php';
/** @var \XoopsModules\Smallworld\Helper $helper */
require_once $helper->path('include/functions.php');
$GLOBALS['xoopsLogger']->activated = false;
$admin = $helper->isUserAdmin() ? true: false;
if ($GLOBALS['xoopsUser'] && ($GLOBALS['xoopsUser'] instanceof \XoopsUser)) {
/** @var \XoopsModules\Smallworld\SwUserHandler $swUserHandler */
$swUserHandler = $helper->getHandler('SwUser');
$id = $GLOBALS['xoopsUser']->uid();
$check = new Smallworld\User();
$image = new Smallworld\Images;
$username = Request::getString('username', '', 'GET');
$userId = $swUserHandler->getByName($username); // gets id of user which profile you want to see
//$userId = smallworld_isset_or($_GET['username']); // gets id of user which profile you want to see
$userisfriend = $check->friendcheck($id, $userId);
$tpl_admin = $admin ? 'YES' : 'NO';
$GLOBALS['xoopsTpl']->assign('isadminuser', $tpl_admin);
// Check if inspected userid -> redirect to userprofile and show admin countdown
$inspect = smallworld_isInspected($id);
if ('yes' === $inspect['inspect']) {
$helper->redirect('userprofile.php?username=' . $GLOBALS['xoopsUser']->uname(), Constants::REDIRECT_DELAY_SHORT, _SMALLWORLD_INSPEC_usermsg);
}
$profile = $swUserHandler->checkIfProfile($id);
if ($profile >= Constants::PROFILE_HAS_BOTH || 2 == $userisfriend[0] || true === $admin) {
$myusername = $GLOBALS['xoopsUser']->uname();
$countimages = $image->count($userId);
//$gallery = $image->viewalbum ($id, $user=$GLOBALS['xoopsUser']->getVar('uid'));
$gallery = $image->viewalbum($id, $userId);
$GLOBALS['xoopsTpl']->assign([
'countimages' => $countimages,
'userisfriend' => $userisfriend[0],
'gallery' => $gallery,
'closealbum' => _SMALLWORLD_ALBUMTITLETEXT,
'username' => $username,
'myusername' => $myusername,
'gallerytitleheader' => _SMALLWORLD_TITLEHEADER,
'check' => 1
]);
} elseif (Constants::PROFILE_NONE == $profile) {
$check->chkUser();
} else {
$helper->redirect('userprofile.php?username=' . $GLOBALS['xoopsUser']->uname(), Constants::REDIRECT_DELAY_SHORT, _NOPERM);
}
} else {
redirect_header(XOOPS_URL . '/user.php', Constants::REDIRECT_DELAY_SHORT, _NOPERM);
}
require_once XOOPS_ROOT_PATH . '/footer.php';