1 | <?php |
||
2 | /** |
||
3 | * ExtGallery User area |
||
4 | * |
||
5 | * You may not change or alter any portion of this comment or credits |
||
6 | * of supporting developers from this source code or any supporting source code |
||
7 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||
8 | * This program is distributed in the hope that it will be useful, |
||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
11 | * |
||
12 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
13 | * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
||
14 | * @author Voltan ([email protected]) |
||
15 | * @package ExtGallery |
||
16 | */ |
||
17 | |||
18 | use XoopsModules\Extgallery; |
||
19 | |||
20 | require_once __DIR__ . '/header.php'; |
||
21 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
22 | //require_once XOOPS_ROOT_PATH . '/modules/extgallery/class/publicPerm.php'; |
||
23 | |||
24 | error_reporting(0); |
||
25 | $GLOBALS['xoopsLogger']->activated = false; |
||
26 | |||
27 | require_once XOOPS_ROOT_PATH . '/class/template.php'; |
||
28 | if (function_exists('mb_http_output')) { |
||
29 | mb_http_output('pass'); |
||
30 | } |
||
31 | |||
32 | $catId = \Xmf\Request::getInt('id', 0, 'GET'); |
||
33 | /** @var Extgallery\PublicCategoryHandler $catHandler */ |
||
34 | $catHandler = Extgallery\Helper::getInstance()->getHandler('PublicCategory'); |
||
35 | /** @var Extgallery\PublicPhotoHandler $photoHandler */ |
||
36 | $photoHandler = Extgallery\Helper::getInstance()->getHandler('PublicPhoto'); |
||
37 | $catObj = $catHandler->getCat($catId); |
||
38 | |||
39 | if (0 != $catId) { |
||
40 | $permHandler = Extgallery\PublicPermHandler::getInstance(); |
||
41 | if ($permHandler->isAllowed($GLOBALS['xoopsUser'], 'public_access', $catId)) { |
||
42 | $catObj = $catHandler->getCat($catId); |
||
43 | $cat = $catHandler->objectToArray($catObj); |
||
44 | } |
||
45 | } |
||
46 | |||
47 | header('Content-Type:text/xml; charset=' . _CHARSET); |
||
48 | $xoopsTpl = new \XoopsTpl(); |
||
49 | $xoopsTpl->caching = 2; |
||
50 | $xoopsTpl->xoops_setCacheTime($helper->getConfig('timecache_rss') * 60); |
||
51 | $myts = \MyTextSanitizer::getInstance(); |
||
52 | if (!$xoopsTpl->is_cached('db:extgallery_public-rss.tpl')) { |
||
53 | $channel_category = $xoopsModule->getVar('dirname'); |
||
54 | // Check if ML Hack is installed, and if yes, parse the $content in formatForML |
||
55 | if (method_exists($myts, 'formatForML')) { |
||
56 | $xoopsConfig['sitename'] = $myts->formatForML($xoopsConfig['sitename']); |
||
57 | $xoopsConfig['slogan'] = $myts->formatForML($xoopsConfig['slogan']); |
||
58 | $channel_category = $myts->formatForML($channel_category); |
||
59 | } |
||
60 | |||
61 | $xoopsTpl->assign('channel_charset', _CHARSET); |
||
62 | $xoopsTpl->assign('channel_title', htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)); |
||
63 | $xoopsTpl->assign('channel_link', EXTGALLERY_URL); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
64 | $xoopsTpl->assign('channel_desc', htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)); |
||
65 | $xoopsTpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss')); |
||
66 | $xoopsTpl->assign('channel_webmaster', $xoopsConfig['adminmail']); |
||
67 | $xoopsTpl->assign('channel_editor', $xoopsConfig['adminmail']); |
||
68 | |||
69 | if (0 != $catId) { |
||
70 | $channel_category .= ' > ' . $catObj->getVar('cat_name'); |
||
71 | $categories = $catId; |
||
72 | } else { |
||
73 | $categories = []; |
||
74 | } |
||
75 | |||
76 | $xoopsTpl->assign('channel_category', htmlspecialchars($channel_category, ENT_QUOTES)); |
||
77 | $xoopsTpl->assign('channel_generator', $xoopsModule->getVar('dirname')); |
||
78 | $xoopsTpl->assign('channel_language', _LANGCODE); |
||
79 | $xoopsTpl->assign('image_url', XOOPS_URL . $helper->getConfig('logo_rss')); |
||
80 | $dimention = getimagesize(XOOPS_ROOT_PATH . $helper->getConfig('logo_rss')); |
||
81 | |||
82 | if (empty($dimention[0])) { |
||
83 | $width = 140; |
||
84 | $height = 140; |
||
85 | } else { |
||
86 | $width = ($dimention[0] > 140) ? 140 : $dimention[0]; |
||
87 | $dimention[1] = $dimention[1] * $width / $dimention[0]; |
||
88 | $height = ($dimention[1] > 140) ? $dimention[1] * $dimention[0] / 140 : $dimention[1]; |
||
89 | } |
||
90 | |||
91 | $xoopsTpl->assign('image_width', $width); |
||
92 | $xoopsTpl->assign('image_height', $height); |
||
93 | |||
94 | $param = [ |
||
95 | 'limit' => $helper->getConfig('perpage_rss'), |
||
96 | 'cat' => $categories, |
||
97 | ]; |
||
98 | |||
99 | $photos = $photoHandler->objectToArray($photoHandler->getLastPhoto($param)); |
||
100 | $xoopsTpl->assign('photos', $photos); |
||
101 | } |
||
102 | $xoopsTpl->display('db:extgallery_public-rss.tpl'); |
||
103 |