1 | <?php |
||
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 | * wgSitenotice module for xoops |
||
13 | * |
||
14 | * @copyright XOOPS Project (https://xoops.org) |
||
15 | * @license GPL 2.0 or later |
||
16 | * @package wgsitenotice |
||
17 | * @since 1.0 |
||
18 | * @min_xoops 2.5.11 |
||
19 | * @author Goffy (wedega.com) - Email:<[email protected]> - Website:<https://xoops.wedega.com> |
||
20 | */ |
||
21 | |||
22 | use XoopsModules\Wgsitenotice\Helper; |
||
23 | |||
24 | include_once \XOOPS_ROOT_PATH.'/modules/wgsitenotice/include/common.php'; |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
25 | |||
26 | // Function show block |
||
27 | function b_wgsitenotice_cookie_reg_show($options) |
||
28 | { |
||
29 | |||
30 | $block = []; |
||
31 | |||
32 | $unique_id = $options[0]; |
||
33 | $block['unique_id'] = $unique_id; |
||
34 | $dataprotect_id = $options[1]; |
||
35 | $cookie_reg_id = $options[2]; |
||
36 | $display_type = $options[3]; |
||
37 | $block['opacity'] = $options[4]; |
||
38 | $block['bg_from'] = $options[5]; |
||
39 | $block['bg_to'] = $options[6]; |
||
40 | $block['color'] = $options[7]; |
||
41 | $block['height'] = $options[8]; |
||
42 | $position = $options[9]; |
||
43 | $type_tpl_id = $options[10]; |
||
44 | |||
45 | \array_shift($options); |
||
46 | \array_shift($options); |
||
47 | \array_shift($options); |
||
48 | \array_shift($options); |
||
49 | \array_shift($options); |
||
50 | \array_shift($options); |
||
51 | \array_shift($options); |
||
52 | \array_shift($options); |
||
53 | \array_shift($options); |
||
54 | \array_shift($options); |
||
55 | |||
56 | //get relevant data |
||
57 | $helper = Helper::getInstance(); |
||
58 | $versionsHandler = $helper->getHandler('Versions'); |
||
59 | |||
60 | $block['infotext'] = \_MB_WGSITENOTICE_COOKIE_REG_INFO; |
||
61 | |||
62 | if ("smarty" == $display_type) { |
||
63 | if ('top' == $position) { |
||
64 | $block['position'] = 'top:0px;position:fixed;left:0px;'; |
||
65 | $block['prependToBody'] = '1'; |
||
66 | } else { |
||
67 | $block['position'] = 'bottom:0px;position:fixed;left:0px;'; |
||
68 | $block['prependToBody'] = '1'; |
||
69 | } |
||
70 | } else { |
||
71 | $block['position'] = ''; |
||
72 | } |
||
73 | |||
74 | if ( $dataprotect_id > 0 || $cookie_reg_id > 0 ) { |
||
75 | $dataprotect_obj = $versionsHandler->get($dataprotect_id); |
||
76 | if (\is_object($dataprotect_obj)) { |
||
77 | $block['dataprotect_id'] = $dataprotect_id; |
||
78 | $block['dataprotect_text'] = $dataprotect_obj->getVar('version_name'); |
||
79 | } |
||
80 | $cookie_reg_obj = $versionsHandler->get($cookie_reg_id); |
||
81 | if (\is_object($cookie_reg_obj)) { |
||
82 | $block['cookie_reg_id'] = $cookie_reg_id; |
||
83 | $block['cookie_reg_text'] = $cookie_reg_obj->getVar('version_name'); |
||
84 | } |
||
85 | $block['seperator'] = ""; |
||
86 | if ( $dataprotect_id > 0 && $cookie_reg_id > 0 ) { |
||
87 | $block['seperator'] = "|"; |
||
88 | } |
||
89 | } |
||
90 | $tplSource = \XOOPS_ROOT_PATH.'/modules/wgsitenotice/templates/blocks/wgsitenotice_block_cookie_reg.tpl'; |
||
0 ignored issues
–
show
|
|||
91 | |||
92 | if ("smarty" == $display_type) { |
||
93 | //hide block and show in theme.html defined position |
||
94 | $blockTpl = new \XoopsTpl(); |
||
0 ignored issues
–
show
The type
XoopsTpl 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 ![]() |
|||
95 | $blockTpl->assign('block', $block); |
||
96 | |||
97 | $GLOBALS['xoopsTpl']->assign( $type_tpl_id, $blockTpl->fetch($tplSource) ); |
||
98 | $block = false; |
||
99 | } |
||
100 | return $block; |
||
101 | } |
||
102 | |||
103 | // Function edit block |
||
104 | function b_wgsitenotice_cookie_reg_edit($options) |
||
105 | { |
||
106 | |||
107 | $helper = Helper::getInstance(); |
||
108 | $versionsHandler = $helper->getHandler('Versions'); |
||
109 | |||
110 | $criteria = new \CriteriaCompo(); |
||
0 ignored issues
–
show
The type
CriteriaCompo 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 | $criteria->add(new \Criteria('version_current', 1)); |
||
0 ignored issues
–
show
The type
Criteria 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 ![]() |
|||
112 | $criteria->setSort('version_weight'); |
||
113 | $criteria->setOrder('ASC'); |
||
114 | $versionsAll = $versionsHandler->getAll($criteria); |
||
115 | unset($criteria); |
||
116 | |||
117 | $cookie = $options[0]; |
||
118 | //remove existing cookie in order to see results |
||
119 | \setcookie($cookie,"0"); |
||
120 | |||
121 | $unique_id = new \XoopsFormText('', 'options[0]', 100, 255, $cookie); |
||
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 ![]() |
|||
122 | $form = \_MB_WGSITENOTICE_COOKIE_REG_NAME . ': ' . $unique_id->render() . '<br><br>'; |
||
123 | |||
124 | $data_sel = new \XoopsFormSelect("", 'options[1]', $options[1]); |
||
0 ignored issues
–
show
The type
XoopsFormSelect 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 ![]() |
|||
125 | $data_sel->addOption('no-data', \_MB_WGSITENOTICE_COOKIE_REG_NONE); |
||
126 | foreach (\array_keys($versionsAll) as $i) { |
||
127 | $data_sel->addOption($versionsAll[$i]->getVar('version_id'), $versionsAll[$i]->getVar('version_name')); |
||
128 | } |
||
129 | $form .= \_MB_WGSITENOTICE_COOKIE_REG_DATA . ': ' . $data_sel->render() . '<br>'; |
||
130 | |||
131 | $cookie_reg_sel = new \XoopsFormSelect("", 'options[2]', $options[2]); |
||
132 | $cookie_reg_sel->addOption('no-cookiereg', \_MB_WGSITENOTICE_COOKIE_REG_NONE); |
||
133 | foreach (\array_keys($versionsAll) as $i) { |
||
134 | $cookie_reg_sel->addOption($versionsAll[$i]->getVar('version_id'), $versionsAll[$i]->getVar('version_name')); |
||
135 | } |
||
136 | $form .= \_MB_WGSITENOTICE_COOKIE_REG_BASE . ': ' . $cookie_reg_sel->render() . '<br>'; |
||
137 | |||
138 | $display_sel = new \XoopsFormSelect("", 'options[3]', $options[3]); |
||
139 | $display_sel->addOption('block', \_MB_WGSITENOTICE_COOKIE_REG_DISPLAY_BLOCK); |
||
140 | $display_sel->addOption('smarty', \_MB_WGSITENOTICE_COOKIE_REG_DISPLAY_SMARTY); |
||
141 | $form .= \_MB_WGSITENOTICE_COOKIE_REG_DISPLAY . ': ' . $display_sel->render() . '<br>'; |
||
142 | |||
143 | $form .= '<br>' . \_MB_WGSITENOTICE_COOKIE_REG_OPT_STYLE . ':<br>'; |
||
144 | $form .= \str_repeat( '-' , \strlen(\_MB_WGSITENOTICE_COOKIE_REG_OPT_STYLE) + 5 ) . '<br>'; |
||
145 | |||
146 | $opacity_sel = new \XoopsFormSelect("", 'options[4]', $options[4]); |
||
147 | $opacity_sel->addOption('0.1', '0.1'); |
||
148 | $opacity_sel->addOption('0.2', '0.2'); |
||
149 | $opacity_sel->addOption('0.3', '0.3'); |
||
150 | $opacity_sel->addOption('0.4', '0.4'); |
||
151 | $opacity_sel->addOption('0.5', '0.5'); |
||
152 | $opacity_sel->addOption('0.6', '0.6'); |
||
153 | $opacity_sel->addOption('0.7', '0.7'); |
||
154 | $opacity_sel->addOption('0.8', '0.8'); |
||
155 | $opacity_sel->addOption('0.9', '0.9'); |
||
156 | $opacity_sel->addOption('1.0', '1.0'); |
||
157 | $form .= \_MB_WGSITENOTICE_COOKIE_REG_OPACITY . ': ' . $opacity_sel->render() . '<br><br>'; |
||
158 | |||
159 | $bg_from_sel = new \XoopsFormColorPicker("", 'options[5]', $options[5]); |
||
0 ignored issues
–
show
The type
XoopsFormColorPicker 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 ![]() |
|||
160 | $bg_to_sel = new \XoopsFormColorPicker("", 'options[6]', $options[6]); |
||
161 | $form .= \_MB_WGSITENOTICE_COOKIE_REG_BACKGROUND . ': ' . $bg_from_sel->render() . ' ' . $bg_to_sel->render() . '<br>'; |
||
162 | |||
163 | $color_sel = new \XoopsFormColorPicker("", 'options[7]', $options[7]); |
||
164 | $form .= \_MB_WGSITENOTICE_COOKIE_REG_COLOR . ': ' . $color_sel->render() . '<br><br>'; |
||
165 | |||
166 | $height_sel = new \XoopsFormText('', 'options[8]', 20, 255, $options[8]); |
||
167 | $form .= \_MB_WGSITENOTICE_COOKIE_REG_HEIGHT . ': ' . $height_sel->render() . '<br><br>'; |
||
168 | |||
169 | $form .= '<br>' . \_MB_WGSITENOTICE_COOKIE_REG_OPT_SMARTY . ':<br>'; |
||
170 | $form .= \str_repeat( '-' , \strlen(\_MB_WGSITENOTICE_COOKIE_REG_OPT_SMARTY) + 5 ) . '<br>'; |
||
171 | |||
172 | $position_sel = new \XoopsFormSelect("", 'options[9]', $options[9]); |
||
173 | $position_sel->addOption('top', \_MB_WGSITENOTICE_COOKIE_REG_POSITION_TOP); |
||
174 | $position_sel->addOption('bottom', \_MB_WGSITENOTICE_COOKIE_REG_POSITION_BOTTOM); |
||
175 | $form .= \_MB_WGSITENOTICE_COOKIE_REG_POSITION . ': ' . $position_sel->render() . '<br>'; |
||
176 | |||
177 | $smarty_id = new \XoopsFormText('', 'options[10]', 60, 255, $options[10]); |
||
178 | $form .= \_MB_WGSITENOTICE_COOKIE_REG_DISPLAY_SMARTY_DESC . ':<br><{$' . $smarty_id->render() . '}><br><br>'; |
||
179 | |||
180 | \array_shift($options); |
||
181 | \array_shift($options); |
||
182 | \array_shift($options); |
||
183 | \array_shift($options); |
||
184 | \array_shift($options); |
||
185 | \array_shift($options); |
||
186 | \array_shift($options); |
||
187 | \array_shift($options); |
||
188 | \array_shift($options); |
||
189 | \array_shift($options); |
||
190 | |||
191 | return $form; |
||
192 | } |
||
193 |