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 Zoullou (http://www.zoullou.net) |
||||||
15 | * @package ExtGallery |
||||||
16 | */ |
||||||
17 | |||||||
18 | use XoopsModules\Extgallery; |
||||||
19 | |||||||
20 | include __DIR__ . '/header.php'; |
||||||
21 | //require_once XOOPS_ROOT_PATH . '/modules/extgallery/class/publicPerm.php'; |
||||||
22 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
23 | |||||||
24 | if (isset($_GET['id'])) { |
||||||
25 | $photoId = (int)$_GET['id']; |
||||||
26 | } elseif (isset($_POST['photo_id'])) { |
||||||
27 | $photoId = (int)$_POST['photo_id']; |
||||||
28 | } else { |
||||||
29 | $photoId = 0; |
||||||
30 | } |
||||||
31 | if (isset($_POST['step'])) { |
||||||
32 | $step = $_POST['step']; |
||||||
33 | } else { |
||||||
34 | $step = 'default'; |
||||||
35 | } |
||||||
36 | /** @var Extgallery\PublicPhotoHandler $photoHandler */ |
||||||
37 | $photoHandler = Extgallery\Helper::getInstance()->getHandler('PublicPhoto'); |
||||||
38 | $photo = $photoHandler->getPhoto($photoId); |
||||||
39 | |||||||
40 | $permHandler = Extgallery\PublicPermHandler::getInstance(); |
||||||
41 | |||||||
42 | if (!$permHandler->isAllowed($GLOBALS['xoopsUser'], 'public_ecard', $photo->getVar('cat_id'))) { |
||||||
43 | redirect_header('index.php', 3, _MD_EXTGALLERY_NOPERM); |
||||||
0 ignored issues
–
show
The function
redirect_header was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
44 | } |
||||||
45 | /** @var xos_opal_Theme $xoTheme */ |
||||||
46 | switch ($step) { |
||||||
47 | |||||||
48 | case 'send': |
||||||
49 | |||||||
50 | // require_once XOOPS_ROOT_PATH . '/modules/extgallery/class/php-captcha.inc.php'; |
||||||
51 | |||||||
52 | // Enable captcha only if GD is Used |
||||||
53 | if ('gd' === $xoopsModuleConfig['graphic_lib']) { |
||||||
54 | if (!Extgallery\PhpCaptcha::Validate($_POST['captcha'])) { |
||||||
55 | redirect_header('public-photo.php?photoId=' . $photoId . '#photoNav', 3, _MD_EXTGALLERY_CAPTCHA_ERROR); |
||||||
56 | } |
||||||
57 | } |
||||||
58 | /** @var Extgallery\PublicEcardHandler $ecardHandler */ |
||||||
59 | $ecardHandler = Extgallery\Helper::getInstance()->getHandler('PublicEcard'); |
||||||
60 | /** @var Extgallery\PublicPhotoHandler $photoHandler */ |
||||||
61 | $photoHandler = Extgallery\Helper::getInstance()->getHandler('PublicPhoto'); |
||||||
62 | |||||||
63 | if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
||||||
64 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
||||||
65 | } elseif (isset($_SERVER['HTTP_CLIENT_IP'])) { |
||||||
66 | $ip = $_SERVER['HTTP_CLIENT_IP']; |
||||||
67 | } else { |
||||||
68 | $ip = $_SERVER['REMOTE_ADDR']; |
||||||
69 | } |
||||||
70 | |||||||
71 | $data = [ |
||||||
72 | 'ecard_fromname' => $_POST['ecard_fromname'], |
||||||
73 | 'ecard_fromemail' => $_POST['ecard_fromemail'], |
||||||
74 | 'ecard_toname' => $_POST['ecard_toname'], |
||||||
75 | 'ecard_toemail' => $_POST['ecard_toemail'], |
||||||
76 | 'ecard_greetings' => $_POST['ecard_greetings'], |
||||||
77 | 'ecard_desc' => $_POST['ecard_desc'], |
||||||
78 | 'ecard_ip' => $ip, |
||||||
79 | 'photo_id' => $photoId |
||||||
80 | ]; |
||||||
81 | |||||||
82 | $ecardHandler->createEcard($data); |
||||||
83 | $photoHandler->updateEcard($photoId); |
||||||
84 | |||||||
85 | redirect_header('public-photo.php?photoId=' . $photoId . '#photoNav', 3, _MD_EXTGALLERY_ECARD_SENT); |
||||||
86 | |||||||
87 | break; |
||||||
88 | |||||||
89 | case 'default': |
||||||
90 | default: |
||||||
91 | |||||||
92 | $GLOBALS['xoopsOption']['template_main'] = 'extgallery_public-sendecard.tpl'; |
||||||
93 | include XOOPS_ROOT_PATH . '/header.php'; |
||||||
94 | |||||||
95 | if ('' != $photo->getVar('photo_serveur')) { |
||||||
96 | $photoUrl = $photo->getVar('photo_serveur') . 'thumb_' . $photo->getVar('photo_name'); |
||||||
97 | } else { |
||||||
98 | $photoUrl = XOOPS_URL . '/uploads/extgallery/public-photo/thumb/thumb_' . $photo->getVar('photo_name'); |
||||||
0 ignored issues
–
show
|
|||||||
99 | } |
||||||
100 | |||||||
101 | $fromName = is_a($GLOBALS['xoopsUser'], 'XoopsUser') ? $GLOBALS['xoopsUser']->getVar('uname') : ''; |
||||||
102 | $fromEmail = is_a($GLOBALS['xoopsUser'], 'XoopsUser') ? $GLOBALS['xoopsUser']->getVar('email') : ''; |
||||||
103 | |||||||
104 | $form = new \XoopsThemeForm(_MD_EXTGALLERY_SEND_ECARD, 'send_ecard', 'public-sendecard.php', 'post', true); |
||||||
0 ignored issues
–
show
The type
XoopsThemeForm was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
105 | $form->addElement(new \XoopsFormText(_MD_EXTGALLERY_FROM_NAME, 'ecard_fromname', '70', '255', $fromName), false); |
||||||
0 ignored issues
–
show
The type
XoopsFormText was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
106 | $form->addElement(new \XoopsFormText(_MD_EXTGALLERY_FROM_EMAIL, 'ecard_fromemail', '70', '255', $fromEmail), false); |
||||||
107 | $form->addElement(new \XoopsFormText(_MD_EXTGALLERY_TO_NAME, 'ecard_toname', '70', '255', ''), false); |
||||||
108 | $form->addElement(new \XoopsFormText(_MD_EXTGALLERY_TO_EMAIL, 'ecard_toemail', '70', '255', ''), false); |
||||||
109 | $form->addElement(new \XoopsFormText(_MD_EXTGALLERY_GREETINGS, 'ecard_greetings', '110', '255', ''), false); |
||||||
110 | $form->addElement(new \XoopsFormTextArea(_MD_EXTGALLERY_DESC, 'ecard_desc', ''), false); |
||||||
0 ignored issues
–
show
The type
XoopsFormTextArea was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
111 | // Enable captcha only if GD is Used |
||||||
112 | if ('gd' === $xoopsModuleConfig['graphic_lib']) { |
||||||
113 | $form->addElement(new \XoopsFormText(_MD_EXTGALLERY_SECURITY, 'captcha', '10', '5', ''), false); |
||||||
114 | } |
||||||
115 | $form->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
||||||
0 ignored issues
–
show
The type
XoopsFormButton was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
116 | $form->addElement(new \XoopsFormHidden('photo_id', $photoId)); |
||||||
0 ignored issues
–
show
The type
XoopsFormHidden was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
117 | $form->addElement(new \XoopsFormHidden('step', 'send')); |
||||||
118 | $form->assign($xoopsTpl); |
||||||
119 | |||||||
120 | $xoopsTpl->assign('photo', $photoUrl); |
||||||
121 | $xoopsTpl->assign('xoops_pagetitle', 'Send ' . $photo->getVar('photo_desc') . ' to eCard'); |
||||||
122 | $xoTheme->addMeta('meta', 'description', $photo->getVar('photo_desc')); |
||||||
123 | |||||||
124 | $rel = 'alternate'; |
||||||
125 | $attributes['rel'] = $rel; |
||||||
126 | $attributes['type'] = 'application/rss+xml'; |
||||||
127 | $attributes['title'] = _MD_EXTGALLERY_RSS; |
||||||
128 | $attributes['href'] = XOOPS_URL . '/modules/extgallery/public-rss.php'; |
||||||
129 | $xoTheme->addMeta('link', $rel, $attributes); |
||||||
130 | $xoTheme->addStylesheet('modules/extgallery/assets/css/style.css'); |
||||||
131 | |||||||
132 | $lang = [ |
||||||
133 | 'to' => _MD_EXTGALLERY_TO, |
||||||
134 | 'from' => _MD_EXTGALLERY_FROM |
||||||
135 | ]; |
||||||
136 | $xoopsTpl->assign('lang', $lang); |
||||||
137 | |||||||
138 | include XOOPS_ROOT_PATH . '/footer.php'; |
||||||
139 | |||||||
140 | break; |
||||||
141 | |||||||
142 | } |
||||||
143 |