|
1
|
|
|
<?php declare(strict_types=1); |
|
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
|
|
|
* @category Module |
|
13
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
|
14
|
|
|
* @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
|
15
|
|
|
* @author Marcello Brandão aka Suico, Mamba, LioMJ <https://xoops.org> |
|
16
|
|
|
*/ |
|
17
|
|
|
/** |
|
18
|
|
|
* Protection against inclusion outside the site |
|
19
|
|
|
*/ |
|
20
|
|
|
if (!defined('XOOPS_ROOT_PATH')) { |
|
21
|
|
|
exit('XOOPS root path not defined'); |
|
22
|
|
|
} |
|
23
|
|
|
/** |
|
24
|
|
|
* @param $category |
|
25
|
|
|
* @param $item_id |
|
26
|
|
|
* @return mixed |
|
27
|
|
|
*/ |
|
28
|
|
|
function suico_iteminfo($category, $item_id) |
|
29
|
|
|
{ |
|
30
|
|
|
$moduleHandler = xoops_getHandler('module'); |
|
31
|
|
|
$module = $moduleHandler->getByDirname('suico'); |
|
|
|
|
|
|
32
|
|
|
if ('global' === $category) { |
|
33
|
|
|
$item['name'] = ''; |
|
34
|
|
|
$item['url'] = ''; |
|
35
|
|
|
|
|
36
|
|
|
return $item; |
|
37
|
|
|
} |
|
38
|
|
|
global $xoopsDB; |
|
39
|
|
|
if ('picture' === $category) { |
|
40
|
|
|
$sql = 'SELECT title,uid_owner,filename FROM ' . $xoopsDB->prefix( |
|
41
|
|
|
'suico_images' |
|
42
|
|
|
) . ' WHERE uid_owner = ' . $item_id . ' LIMIT 1'; |
|
43
|
|
|
$result = $xoopsDB->query($sql); |
|
44
|
|
|
$result_array = $xoopsDB->fetchArray($result); |
|
45
|
|
|
/** |
|
46
|
|
|
* Let's get the user name of the owner of the album |
|
47
|
|
|
*/ |
|
48
|
|
|
$owner = new \XoopsUser(); |
|
49
|
|
|
$identifier = $owner::getUnameFromId($result_array['uid_owner']); |
|
50
|
|
|
$item['name'] = $identifier . "'s Album"; |
|
51
|
|
|
$item['url'] = XOOPS_URL . '/modules/' . $module->getVar( |
|
52
|
|
|
'dirname' |
|
53
|
|
|
) . '/album.php?uid=' . $result_array['uid_owner']; |
|
54
|
|
|
|
|
55
|
|
|
return $item; |
|
56
|
|
|
} |
|
57
|
|
|
if ('video' === $category) { |
|
58
|
|
|
$sql = 'SELECT video_id,uid_owner,video_title,video_desc,youtube_code, featuredvideo FROM ' . $xoopsDB->prefix( |
|
59
|
|
|
'suico_images' |
|
60
|
|
|
) . ' WHERE uid_owner = ' . $item_id . ' LIMIT 1'; |
|
61
|
|
|
$result = $xoopsDB->query($sql); |
|
62
|
|
|
$result_array = $xoopsDB->fetchArray($result); |
|
63
|
|
|
/** |
|
64
|
|
|
* Let's get the user name of the owner of the album |
|
65
|
|
|
*/ |
|
66
|
|
|
$owner = new \XoopsUser(); |
|
67
|
|
|
$identifier = $owner::getUnameFromId($result_array['uid_owner']); |
|
68
|
|
|
$item['name'] = $identifier . "'s Videos"; |
|
69
|
|
|
$item['url'] = XOOPS_URL . '/modules/' . $module->getVar( |
|
70
|
|
|
'dirname' |
|
71
|
|
|
) . '/videos.php?uid=' . $result_array['uid_owner']; |
|
72
|
|
|
|
|
73
|
|
|
return $item; |
|
74
|
|
|
} |
|
75
|
|
|
if ('Note' === $category) { |
|
76
|
|
|
$sql = 'SELECT note_id, note_from, note_to, note_text FROM ' . $xoopsDB->prefix( |
|
77
|
|
|
'suico_notes' |
|
78
|
|
|
) . ' WHERE note_from = ' . $item_id . ' LIMIT 1'; |
|
79
|
|
|
$result = $xoopsDB->query($sql); |
|
80
|
|
|
$result_array = $xoopsDB->fetchArray($result); |
|
81
|
|
|
/** |
|
82
|
|
|
* Let's get the user name of the owner of the album |
|
83
|
|
|
*/ |
|
84
|
|
|
$owner = new \XoopsUser(); |
|
85
|
|
|
$identifier = $owner::getUnameFromId($result_array['note_from']); |
|
86
|
|
|
$item['name'] = $identifier . "'s Notes"; |
|
87
|
|
|
$item['url'] = XOOPS_URL . '/modules/' . $module->getVar( |
|
88
|
|
|
'dirname' |
|
89
|
|
|
) . '/notebook.php?uid=' . $result_array['note_from']; |
|
90
|
|
|
|
|
91
|
|
|
return $item; |
|
92
|
|
|
} |
|
93
|
|
|
} |
|
94
|
|
|
|