ggoffy /
wgevents
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php declare(strict_types=1); |
||
| 2 | |||
| 3 | /* |
||
| 4 | You may not change or alter any portion of this comment or credits |
||
| 5 | of supporting developers from this source code or any supporting source code |
||
| 6 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 7 | |||
| 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 | |||
| 13 | /** |
||
| 14 | * wgEvents module for xoops |
||
| 15 | * |
||
| 16 | * @copyright 2021 XOOPS Project (https://xoops.org) |
||
| 17 | * @license GPL 2.0 or later |
||
| 18 | * @package wgevents |
||
| 19 | * @author Goffy - Wedega - Email:[email protected] - Website:https://xoops.wedega.com |
||
| 20 | */ |
||
| 21 | |||
| 22 | use Xmf\Request; |
||
|
0 ignored issues
–
show
|
|||
| 23 | use XoopsModules\Wgevents; |
||
| 24 | use XoopsModules\Wgevents\Constants; |
||
| 25 | use XoopsModules\Wgevents\Common; |
||
| 26 | |||
| 27 | require __DIR__ . '/header.php'; |
||
| 28 | // Get all request values |
||
| 29 | $op = Request::getCmd('op', 'list'); |
||
| 30 | $atId = Request::getInt('id'); |
||
| 31 | $start = Request::getInt('start'); |
||
| 32 | $limit = Request::getInt('limit', $helper->getConfig('adminpager')); |
||
| 33 | $GLOBALS['xoopsTpl']->assign('start', $start); |
||
| 34 | $GLOBALS['xoopsTpl']->assign('limit', $limit); |
||
| 35 | |||
| 36 | $moduleDirName = \basename(\dirname(__DIR__)); |
||
| 37 | |||
| 38 | $GLOBALS['xoopsTpl']->assign('mod_url', XOOPS_URL . '/modules/' . $moduleDirName); |
||
| 39 | |||
| 40 | switch ($op) { |
||
| 41 | case 'list': |
||
| 42 | default: |
||
| 43 | $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/jquery.js'); |
||
| 44 | $GLOBALS['xoTheme']->addScript(\WGEVENTS_URL . '/assets/js/jquery-ui.min.js'); |
||
| 45 | $GLOBALS['xoTheme']->addScript(\WGEVENTS_URL . '/assets/js/sortables.js'); |
||
| 46 | // Define Stylesheet |
||
| 47 | $GLOBALS['xoTheme']->addStylesheet($style, null); |
||
| 48 | $templateMain = 'wgevents_admin_field.tpl'; |
||
| 49 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('field.php')); |
||
| 50 | $adminObject->addItemButton(\_AM_WGEVENTS_ADD_FIELD, 'field.php?op=new'); |
||
| 51 | $adminObject->addItemButton(\_AM_WGEVENTS_FIELD_CREATE_DEFAULT, 'field.php?op=default_set'); |
||
| 52 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
||
| 53 | $fieldCount = $fieldHandler->getCountFields(); |
||
| 54 | if (0 === $fieldCount) { |
||
| 55 | // load default set |
||
| 56 | \redirect_header('field.php?op=default_set', 0); |
||
| 57 | } |
||
| 58 | $GLOBALS['xoopsTpl']->assign('fieldCount', $fieldCount); |
||
| 59 | $GLOBALS['xoopsTpl']->assign('wgevents_url', \WGEVENTS_URL); |
||
| 60 | $GLOBALS['xoopsTpl']->assign('wgevents_upload_url', \WGEVENTS_UPLOAD_URL); |
||
| 61 | $GLOBALS['xoopsTpl']->assign('wgevents_icons_url_16', \WGEVENTS_ICONS_URL_16); |
||
| 62 | // Table view fields |
||
| 63 | if ($fieldCount > 0) { |
||
| 64 | $fieldAll = $fieldHandler->getAllFields(); |
||
| 65 | foreach (\array_keys($fieldAll) as $i) { |
||
| 66 | $field = $fieldAll[$i]->getValuesFields(); |
||
| 67 | $GLOBALS['xoopsTpl']->append('fields_list', $field); |
||
| 68 | unset($field); |
||
| 69 | } |
||
| 70 | } else { |
||
| 71 | $GLOBALS['xoopsTpl']->assign('error', \_AM_WGEVENTS_THEREARENT_FIELDS); |
||
| 72 | } |
||
| 73 | break; |
||
| 74 | case 'new': |
||
| 75 | $templateMain = 'wgevents_admin_field.tpl'; |
||
| 76 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('field.php')); |
||
| 77 | $adminObject->addItemButton(\_AM_WGEVENTS_LIST_FIELDS, 'field.php', 'list'); |
||
| 78 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
||
| 79 | // Form Create |
||
| 80 | $fieldObj = $fieldHandler->create(); |
||
| 81 | $form = $fieldObj->getForm(); |
||
| 82 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
| 83 | break; |
||
| 84 | case 'clone': |
||
| 85 | $templateMain = 'wgevents_admin_field.tpl'; |
||
| 86 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('field.php')); |
||
| 87 | $adminObject->addItemButton(\_AM_WGEVENTS_LIST_FIELDS, 'field.php', 'list'); |
||
| 88 | $adminObject->addItemButton(\_AM_WGEVENTS_ADD_FIELD, 'field.php?op=new'); |
||
| 89 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
||
| 90 | // Request source |
||
| 91 | $atIdSource = Request::getInt('id_source'); |
||
| 92 | // Get Form |
||
| 93 | $fieldObjSource = $fieldHandler->get($atIdSource); |
||
| 94 | $fieldObj = $fieldObjSource->xoopsClone(); |
||
| 95 | $form = $fieldObj->getForm(); |
||
| 96 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
| 97 | break; |
||
| 98 | case 'save': |
||
| 99 | // Security Check |
||
| 100 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
| 101 | \redirect_header('field.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||
| 102 | } |
||
| 103 | if ($atId > 0) { |
||
| 104 | $fieldObj = $fieldHandler->get($atId); |
||
| 105 | } else { |
||
| 106 | $fieldObj = $fieldHandler->create(); |
||
| 107 | } |
||
| 108 | // Set Vars |
||
| 109 | $fdType = Request::getInt('type'); |
||
| 110 | $fieldObj->setVar('type', $fdType); |
||
| 111 | $fieldObj->setVar('caption', Request::getString('caption')); |
||
| 112 | $fieldObj->setVar('desc', Request::getText('desc')); |
||
| 113 | $atValuesText = ''; |
||
| 114 | $fdValues = Request::getString('values'); |
||
| 115 | if ('' !== $fdValues) { |
||
| 116 | if (Constants::FIELD_COMBOBOX == $fdType || Constants::FIELD_SELECTBOX == $fdType || Constants::FIELD_RADIO == $fdType) { |
||
| 117 | $atValuesText = \serialize(\preg_split('/\r\n|\r|\n/', $fdValues)); |
||
| 118 | } else { |
||
| 119 | $tmpArr = [$fdValues]; |
||
| 120 | $atValuesText = \serialize($tmpArr); |
||
| 121 | } |
||
| 122 | } |
||
| 123 | $fieldObj->setVar('values', $atValuesText); |
||
| 124 | $fieldObj->setVar('placeholder', Request::getString('placeholder')); |
||
| 125 | $fieldObj->setVar('required', Request::getInt('required')); |
||
| 126 | $fieldObj->setVar('default', Request::getInt('default')); |
||
| 127 | $fieldObj->setVar('custom', Request::getInt('custom')); |
||
| 128 | $fieldObj->setVar('print', Request::getInt('print')); |
||
| 129 | $fieldObj->setVar('display_desc', Request::getInt('display_desc')); |
||
| 130 | $fieldObj->setVar('display_values', Request::getInt('display_values')); |
||
| 131 | $fieldObj->setVar('display_placeholder', Request::getInt('display_placeholder')); |
||
| 132 | $fieldObj->setVar('weight', Request::getInt('weight')); |
||
| 133 | $fieldObj->setVar('status', Request::getInt('status')); |
||
| 134 | $fieldDatecreatedObj = \DateTime::createFromFormat(\_SHORTDATESTRING, Request::getString('datecreated')); |
||
| 135 | $fieldObj->setVar('datecreated', $fieldDatecreatedObj->getTimestamp()); |
||
| 136 | $fieldObj->setVar('submitter', Request::getInt('submitter')); |
||
| 137 | // Insert Data |
||
| 138 | if ($fieldHandler->insert($fieldObj)) { |
||
| 139 | \redirect_header('field.php?op=list&start=' . $start . '&limit=' . $limit, 2, \_MA_WGEVENTS_FORM_OK); |
||
| 140 | } |
||
| 141 | // Get Form |
||
| 142 | $GLOBALS['xoopsTpl']->assign('error', $fieldObj->getHtmlErrors()); |
||
| 143 | $form = $fieldObj->getForm(); |
||
| 144 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
| 145 | break; |
||
| 146 | case 'edit': |
||
| 147 | $templateMain = 'wgevents_admin_field.tpl'; |
||
| 148 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('field.php')); |
||
| 149 | $adminObject->addItemButton(\_AM_WGEVENTS_ADD_FIELD, 'field.php?op=new'); |
||
| 150 | $adminObject->addItemButton(\_AM_WGEVENTS_LIST_FIELDS, 'field.php', 'list'); |
||
| 151 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
||
| 152 | // Get Form |
||
| 153 | $fieldObj = $fieldHandler->get($atId); |
||
| 154 | $fieldObj->start = $start; |
||
| 155 | $fieldObj->limit = $limit; |
||
| 156 | $form = $fieldObj->getForm(); |
||
| 157 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
| 158 | break; |
||
| 159 | case 'delete': |
||
| 160 | $templateMain = 'wgevents_admin_field.tpl'; |
||
| 161 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('field.php')); |
||
| 162 | $fieldObj = $fieldHandler->get($atId); |
||
| 163 | $atName = $fieldObj->getVar('caption'); |
||
| 164 | if (isset($_REQUEST['ok']) && 1 === (int)$_REQUEST['ok']) { |
||
| 165 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
| 166 | \redirect_header('field.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
||
| 167 | } |
||
| 168 | if ($fieldHandler->delete($fieldObj)) { |
||
| 169 | \redirect_header('field.php', 3, \_MA_WGEVENTS_FORM_DELETE_OK); |
||
| 170 | } else { |
||
| 171 | $GLOBALS['xoopsTpl']->assign('error', $fieldObj->getHtmlErrors()); |
||
| 172 | } |
||
| 173 | } else { |
||
| 174 | $customConfirm = new Common\Confirm( |
||
| 175 | ['ok' => 1, 'id' => $atId, 'start' => $start, 'limit' => $limit, 'op' => 'delete'], |
||
| 176 | $_SERVER['REQUEST_URI'], |
||
| 177 | \sprintf(\_MA_WGEVENTS_FORM_SURE_DELETE, $fieldObj->getVar('caption'))); |
||
| 178 | $form = $customConfirm->getFormConfirm(); |
||
| 179 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
| 180 | } |
||
| 181 | break; |
||
| 182 | case 'default_set': |
||
| 183 | $templateMain = 'wgevents_admin_field.tpl'; |
||
| 184 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('field.php')); |
||
| 185 | if (isset($_REQUEST['ok']) && 1 === (int)$_REQUEST['ok']) { |
||
| 186 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
| 187 | \redirect_header('field.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
||
| 188 | } |
||
| 189 | if (($fieldHandler->getCount() > 0) && !$fieldHandler->deleteAll()) { |
||
| 190 | $GLOBALS['xoopsTpl']->assign('error', $fieldHandler->getHtmlErrors()); |
||
| 191 | } |
||
| 192 | $items = BuildDefaultSet(); |
||
| 193 | $uid = $GLOBALS['xoopsUser']->uid(); |
||
| 194 | foreach ($items as $key => $item) { |
||
| 195 | $fieldObj = $fieldHandler->create(); |
||
| 196 | // Set Vars |
||
| 197 | $fieldObj->setVar('id', $key + 1); |
||
| 198 | $fieldObj->setVar('caption', $item['caption']); |
||
| 199 | $fieldObj->setVar('type', $item['type']); |
||
| 200 | $fieldObj->setVar('desc', $item['desc']); |
||
| 201 | $fdValues = (string)$item['values']; |
||
| 202 | $atValuesText = ''; |
||
| 203 | if ('' !== $fdValues) { |
||
| 204 | $tmpArr[] = $fdValues; |
||
| 205 | $atValuesText = \serialize($tmpArr); |
||
| 206 | } |
||
| 207 | $fieldObj->setVar('values', $atValuesText); |
||
| 208 | $fieldObj->setVar('placeholder', $item['placeholder']); |
||
| 209 | $fieldObj->setVar('required', $item['required']); |
||
| 210 | $fieldObj->setVar('default', $item['default']); |
||
| 211 | $fieldObj->setVar('print', $item['print']); |
||
| 212 | $fieldObj->setVar('display_desc', $item['display_desc']); |
||
| 213 | $fieldObj->setVar('display_values', $item['display_values']); |
||
| 214 | $fieldObj->setVar('display_placeholder', $item['display_placeholder']); |
||
| 215 | $fieldObj->setVar('weight', $key + 1); |
||
| 216 | $fieldObj->setVar('custom', $item['custom']); |
||
| 217 | $fieldObj->setVar('status', Constants::STATUS_ONLINE); |
||
| 218 | $fieldObj->setVar('datecreated', \time()); |
||
| 219 | $fieldObj->setVar('submitter', $uid); |
||
| 220 | // Insert Data |
||
| 221 | $fieldHandler->insert($fieldObj); |
||
| 222 | } |
||
| 223 | \redirect_header('field.php', 3, \_MA_WGEVENTS_FORM_OK); |
||
| 224 | } else { |
||
| 225 | $customConfirm = new Common\Confirm( |
||
| 226 | ['ok' => 1, 'op' => 'default_set'], |
||
| 227 | $_SERVER['REQUEST_URI'], |
||
| 228 | \_AM_WGEVENTS_FIELD_SURE_DELETE); |
||
| 229 | $form = $customConfirm->getFormConfirm(); |
||
| 230 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
| 231 | } |
||
| 232 | break; |
||
| 233 | case 'change_yn': |
||
| 234 | if ($atId > 0) { |
||
| 235 | $fieldObj = $fieldHandler->get($atId); |
||
| 236 | $fieldObj->setVar(Request::getString('field'), Request::getInt('value')); |
||
| 237 | // Insert Data |
||
| 238 | if ($fieldHandler->insert($fieldObj, true)) { |
||
| 239 | \redirect_header('field.php?op=list&start=' . $start . '&limit=' . $limit, 2, \_MA_WGEVENTS_FORM_OK); |
||
| 240 | } |
||
| 241 | } |
||
| 242 | break; |
||
| 243 | case 'order': |
||
| 244 | $order = $_POST['order']; |
||
| 245 | for ($i = 0, $iMax = \count($order); $i < $iMax; $i++) { |
||
| 246 | $fieldObj = $fieldHandler->get($order[$i]); |
||
| 247 | $fieldObj->setVar('weight', $i + 1); |
||
| 248 | $fieldHandler->insert($fieldObj); |
||
| 249 | } |
||
| 250 | break; |
||
| 251 | } |
||
| 252 | require __DIR__ . '/footer.php'; |
||
| 253 | |||
| 254 | /** |
||
| 255 | * @return array |
||
| 256 | */ |
||
| 257 | function BuildDefaultSet () { |
||
| 258 | $defaultSet = []; |
||
| 259 | $defaultSet[] = [ |
||
| 260 | 'type' => Constants::FIELD_LABEL, |
||
| 261 | 'caption' => \_MA_WGEVENTS_FIELD_LABEL, |
||
| 262 | 'desc' => '', |
||
| 263 | 'values' => '', |
||
| 264 | 'placeholder' => '', |
||
| 265 | 'required' => 0, |
||
| 266 | 'default' => 0, |
||
| 267 | 'print' => 1, |
||
| 268 | 'display_desc' => 1, |
||
| 269 | 'display_values' => 0, |
||
| 270 | 'display_placeholder' => 0, |
||
| 271 | 'custom' => 0, |
||
| 272 | ]; |
||
| 273 | $defaultSet[] = [ |
||
| 274 | 'type' => Constants::FIELD_TEXTBOX, |
||
| 275 | 'caption' => \_MA_WGEVENTS_FIELD_TEXTBOX, |
||
| 276 | 'desc' => '', |
||
| 277 | 'values' => '', |
||
| 278 | 'placeholder' => '', |
||
| 279 | 'required' => 0, |
||
| 280 | 'default' => 0, |
||
| 281 | 'print' => 1, |
||
| 282 | 'display_desc' => 1, |
||
| 283 | 'display_values' => 0, |
||
| 284 | 'display_placeholder' => 1, |
||
| 285 | 'custom' => 0, |
||
| 286 | ]; |
||
| 287 | $defaultSet[] = [ |
||
| 288 | 'type' => Constants::FIELD_TEXTAREA, |
||
| 289 | 'caption' => \_MA_WGEVENTS_FIELD_TEXTAREA, |
||
| 290 | 'desc' => '', |
||
| 291 | 'values' => '', |
||
| 292 | 'placeholder' => '', |
||
| 293 | 'required' => 0, |
||
| 294 | 'default' => 0, |
||
| 295 | 'print' => 1, |
||
| 296 | 'display_desc' => 1, |
||
| 297 | 'display_values' => 0, |
||
| 298 | 'display_placeholder' => 1, |
||
| 299 | 'custom' => 0, |
||
| 300 | ]; |
||
| 301 | /* |
||
| 302 | $defaultSet[] = [ |
||
| 303 | 'type' => Constants::FIELD_TEXTEDITOR, |
||
| 304 | 'caption' => \_MA_WGEVENTS_FIELD_TEXTEDITOR, |
||
| 305 | 'desc' => '', |
||
| 306 | 'values' => '', |
||
| 307 | 'placeholder' => '', |
||
| 308 | 'required' => 0, |
||
| 309 | 'default' => 0, |
||
| 310 | 'print' => 1, |
||
| 311 | 'display_desc' => 1, |
||
| 312 | 'display_values' => 0, |
||
| 313 | 'display_placeholder' => 1, |
||
| 314 | 'custom' => 0, |
||
| 315 | ]; |
||
| 316 | */ |
||
| 317 | $defaultSet[] = [ |
||
| 318 | 'type' => Constants::FIELD_SELECTBOX, |
||
| 319 | 'caption' => \_MA_WGEVENTS_FIELD_SELECTBOX, |
||
| 320 | 'desc' => '', |
||
| 321 | 'values' => '', |
||
| 322 | 'placeholder' => '', |
||
| 323 | 'required' => 0, |
||
| 324 | 'default' => 0, |
||
| 325 | 'print' => 1, |
||
| 326 | 'display_desc' => 1, |
||
| 327 | 'display_values' => 1, |
||
| 328 | 'display_placeholder' => 0, |
||
| 329 | 'custom' => 0, |
||
| 330 | ]; |
||
| 331 | $defaultSet[] = [ |
||
| 332 | 'type' => Constants::FIELD_COMBOBOX, |
||
| 333 | 'caption' => \_MA_WGEVENTS_FIELD_COMBOBOX, |
||
| 334 | 'desc' => '', |
||
| 335 | 'values' => '', |
||
| 336 | 'placeholder' => '', |
||
| 337 | 'required' => 0, |
||
| 338 | 'default' => 0, |
||
| 339 | 'print' => 1, |
||
| 340 | 'display_desc' => 1, |
||
| 341 | 'display_values' => 1, |
||
| 342 | 'display_placeholder' => 0, |
||
| 343 | 'custom' => 0, |
||
| 344 | ]; |
||
| 345 | $defaultSet[] = [ |
||
| 346 | 'type' => Constants::FIELD_CHECKBOX, |
||
| 347 | 'caption' => \_MA_WGEVENTS_FIELD_CHECKBOX, |
||
| 348 | 'desc' => '', |
||
| 349 | 'values' => '', |
||
| 350 | 'placeholder' => '', |
||
| 351 | 'required' => 0, |
||
| 352 | 'default' => 0, |
||
| 353 | 'print' => 1, |
||
| 354 | 'display_desc' => 1, |
||
| 355 | 'display_values' => 1, |
||
| 356 | 'display_placeholder' => 0, |
||
| 357 | 'custom' => 0, |
||
| 358 | ]; |
||
| 359 | $defaultSet[] = [ |
||
| 360 | 'type' => Constants::FIELD_RADIO, |
||
| 361 | 'caption' => \_MA_WGEVENTS_FIELD_RADIO, |
||
| 362 | 'desc' => '', |
||
| 363 | 'values' => '', |
||
| 364 | 'placeholder' => '', |
||
| 365 | 'required' => 0, |
||
| 366 | 'default' => 0, |
||
| 367 | 'print' => 1, |
||
| 368 | 'display_desc' => 1, |
||
| 369 | 'display_values' => 1, |
||
| 370 | 'display_placeholder' => 0, |
||
| 371 | 'custom' => 0, |
||
| 372 | ]; |
||
| 373 | $defaultSet[] = [ |
||
| 374 | 'type' => Constants::FIELD_RADIOYN, |
||
| 375 | 'caption' => \_MA_WGEVENTS_FIELD_RADIOYN, |
||
| 376 | 'desc' => '', |
||
| 377 | 'values' => '', |
||
| 378 | 'placeholder' => '', |
||
| 379 | 'required' => 0, |
||
| 380 | 'default' => 0, |
||
| 381 | 'print' => 1, |
||
| 382 | 'display_desc' => 1, |
||
| 383 | 'display_values' => 0, |
||
| 384 | 'display_placeholder' => 0, |
||
| 385 | 'custom' => 0, |
||
| 386 | ]; |
||
| 387 | $defaultSet[] = [ |
||
| 388 | 'type' => Constants::FIELD_DATE, |
||
| 389 | 'caption' => \_MA_WGEVENTS_FIELD_DATE, |
||
| 390 | 'desc' => '', |
||
| 391 | 'values' => '', |
||
| 392 | 'placeholder' => '', |
||
| 393 | 'required' => 0, |
||
| 394 | 'default' => 0, |
||
| 395 | 'print' => 1, |
||
| 396 | 'display_desc' => 1, |
||
| 397 | 'display_values' => 0, |
||
| 398 | 'display_placeholder' => 0, |
||
| 399 | 'custom' => 0, |
||
| 400 | ]; |
||
| 401 | /* |
||
| 402 | $defaultSet[] = [ |
||
| 403 | 'type' => Constants::FIELD_DATETIME, |
||
| 404 | 'caption' => \_MA_WGEVENTS_FIELD_DATETIME, |
||
| 405 | 'desc' => '', |
||
| 406 | 'values' => '', |
||
| 407 | 'required' => 0, |
||
| 408 | 'default' => 0, |
||
| 409 | 'print' => 1, |
||
| 410 | 'display_values' => 0, |
||
| 411 | 'display_placeholder' => 0, |
||
| 412 | 'custom' => 0, |
||
| 413 | ]; |
||
| 414 | */ |
||
| 415 | $defaultSet[] = [ |
||
| 416 | 'type' => Constants::FIELD_TEXTBOX, |
||
| 417 | 'caption' => \_AM_WGEVENTS_FIELD_PHONE, |
||
| 418 | 'desc' => '', |
||
| 419 | 'values' => '', |
||
| 420 | 'placeholder' => \_AM_WGEVENTS_FIELD_PHONE_VALUE, |
||
| 421 | 'required' => 0, |
||
| 422 | 'default' => 1, |
||
| 423 | 'print' => 1, |
||
| 424 | 'display_desc' => 1, |
||
| 425 | 'display_values' => 0, |
||
| 426 | 'display_placeholder' => 1, |
||
| 427 | 'custom' => 1, |
||
| 428 | ]; |
||
| 429 | $defaultSet[] = [ |
||
| 430 | 'type' => Constants::FIELD_TEXTBOX, |
||
| 431 | 'caption' => \_AM_WGEVENTS_FIELD_ADDRESS, |
||
| 432 | 'desc' => '', |
||
| 433 | 'values' => '', |
||
| 434 | 'placeholder' => \_AM_WGEVENTS_FIELD_ADDRESS_VALUE, |
||
| 435 | 'required' => 0, |
||
| 436 | 'default' => 0, |
||
| 437 | 'print' => 1, |
||
| 438 | 'display_desc' => 1, |
||
| 439 | 'display_values' => 0, |
||
| 440 | 'display_placeholder' => 1, |
||
| 441 | 'custom' => 1, |
||
| 442 | ]; |
||
| 443 | $defaultSet[] = [ |
||
| 444 | 'type' => Constants::FIELD_TEXTBOX, |
||
| 445 | 'caption' => \_AM_WGEVENTS_FIELD_POSTAL, |
||
| 446 | 'desc' => '', |
||
| 447 | 'values' => '', |
||
| 448 | 'placeholder' => \_AM_WGEVENTS_FIELD_POSTAL_VALUE, |
||
| 449 | 'required' => 0, |
||
| 450 | 'default' => 0, |
||
| 451 | 'print' => 1, |
||
| 452 | 'display_desc' => 1, |
||
| 453 | 'display_values' => 0, |
||
| 454 | 'display_placeholder' => 1, |
||
| 455 | 'custom' => 1, |
||
| 456 | ]; |
||
| 457 | $defaultSet[] = [ |
||
| 458 | 'type' => Constants::FIELD_TEXTBOX, |
||
| 459 | 'caption' => \_AM_WGEVENTS_FIELD_CITY, |
||
| 460 | 'desc' => '', |
||
| 461 | 'values' => '', |
||
| 462 | 'placeholder' => \_AM_WGEVENTS_FIELD_CITY_VALUE, |
||
| 463 | 'required' => 0, |
||
| 464 | 'default' => 0, |
||
| 465 | 'print' => 1, |
||
| 466 | 'display_desc' => 1, |
||
| 467 | 'display_values' => 0, |
||
| 468 | 'display_placeholder' => 1, |
||
| 469 | 'custom' => 1, |
||
| 470 | ]; |
||
| 471 | $defaultSet[] = [ |
||
| 472 | 'type' => Constants::FIELD_COUNTRY, |
||
| 473 | 'caption' => \_AM_WGEVENTS_FIELD_COUNTRY, |
||
| 474 | 'desc' => '', |
||
| 475 | 'values' => '', |
||
| 476 | 'placeholder' => \_AM_WGEVENTS_FIELD_COUNTRY_VALUE, |
||
| 477 | 'required' => 0, |
||
| 478 | 'default' => 0, |
||
| 479 | 'print' => 1, |
||
| 480 | 'display_desc' => 1, |
||
| 481 | 'display_values' => 0, |
||
| 482 | 'display_placeholder' => 0, |
||
| 483 | 'custom' => 1, |
||
| 484 | ]; |
||
| 485 | $defaultSet[] = [ |
||
| 486 | 'type' => Constants::FIELD_DATE, |
||
| 487 | 'caption' => \_AM_WGEVENTS_FIELD_BIRTHDAY, |
||
| 488 | 'desc' => '', |
||
| 489 | 'values' => '', |
||
| 490 | 'placeholder' => \_AM_WGEVENTS_FIELD_BIRTHDAY_VALUE, |
||
| 491 | 'required' => 0, |
||
| 492 | 'default' => 0, |
||
| 493 | 'print' => 1, |
||
| 494 | 'display_desc' => 1, |
||
| 495 | 'display_values' => 0, |
||
| 496 | 'display_placeholder' => 0, |
||
| 497 | 'custom' => 1, |
||
| 498 | ]; |
||
| 499 | $defaultSet[] = [ |
||
| 500 | 'type' => Constants::FIELD_TEXTBOX, |
||
| 501 | 'caption' => \_AM_WGEVENTS_FIELD_AGE, |
||
| 502 | 'desc' => '', |
||
| 503 | 'values' => '', |
||
| 504 | 'placeholder' => \_AM_WGEVENTS_FIELD_AGE_VALUE, |
||
| 505 | 'required' => 0, |
||
| 506 | 'default' => 0, |
||
| 507 | 'print' => 1, |
||
| 508 | 'display_desc' => 1, |
||
| 509 | 'display_values' => 0, |
||
| 510 | 'display_placeholder' => 1, |
||
| 511 | 'custom' => 1, |
||
| 512 | ]; |
||
| 513 | |||
| 514 | return $defaultSet; |
||
| 515 | } |
||
| 516 |
Let?s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let?s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: