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 | |||||||
| 23 | use Xmf\Request; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 24 | use XoopsModules\Wgevents\{ |
||||||
| 25 | Constants, |
||||||
| 26 | Utility, |
||||||
| 27 | Common\Resizer |
||||||
| 28 | }; |
||||||
| 29 | |||||||
| 30 | require __DIR__ . '/header.php'; |
||||||
| 31 | $templateMain = 'wgevents_admin_import.tpl'; |
||||||
| 32 | $moduleDirName = \basename(\dirname(__DIR__)); |
||||||
| 33 | |||||||
| 34 | $adminObject = \Xmf\Module\Admin::getInstance(); |
||||||
| 35 | |||||||
| 36 | // It recovered the value of argument op in URL$ |
||||||
| 37 | $op = Request::getString('op', 'list'); |
||||||
| 38 | $cats = Request::getBool('cats'); |
||||||
| 39 | if (Request::getString('datefrom')) { |
||||||
| 40 | $dateFromObj = \DateTime::createFromFormat(\_SHORTDATESTRING, Request::getString('datefrom')); |
||||||
| 41 | $dateFrom = $dateFromObj->getTimestamp(); |
||||||
| 42 | $dateToObj = \DateTime::createFromFormat(\_SHORTDATESTRING, Request::getString('dateto')); |
||||||
| 43 | $dateTo = $dateToObj->getTimestamp(); |
||||||
| 44 | } |
||||||
| 45 | $uidCurrent = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->uid() : 0; |
||||||
| 46 | |||||||
| 47 | $GLOBALS['xoopsTpl']->assign('wgevents_icons_url_32', \WGEVENTS_ICONS_URL_32); |
||||||
| 48 | |||||||
| 49 | $modulesList = []; |
||||||
| 50 | |||||||
| 51 | switch ($op) { |
||||||
| 52 | case 'list': |
||||||
| 53 | default: |
||||||
| 54 | $module_handler = xoops_getHandler('module'); |
||||||
| 55 | $installed_mods = $module_handler->getObjects(); |
||||||
|
0 ignored issues
–
show
The method
getObjects() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of said class. However, the method does not exist in XoopsRankHandler or XoUserHandler. Are you sure you never get one of those?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 56 | $modsArray = []; |
||||||
| 57 | foreach ($installed_mods as $module) { |
||||||
| 58 | $modsArray[] = $module->getInfo('dirname'); |
||||||
| 59 | unset($module); |
||||||
| 60 | } |
||||||
| 61 | $modulesList[] = ['name' => \_AM_WGEVENTS_IMPORT_APCAL, 'op' => 'apcal', 'installed' => \in_array('apcal', $modsArray)]; |
||||||
| 62 | $modulesList[] = ['name' => \_AM_WGEVENTS_IMPORT_EXTCAL, 'op' => 'extcal', 'installed' => \in_array('extcal', $modsArray)]; |
||||||
| 63 | //TODO: |
||||||
| 64 | //$modulesList[] = ['name' => \_AM_WGEVENTS_IMPORT_EGUIDE, 'op' => 'eguide', 'installed' => in_array('eguide', $modsArray)]]; |
||||||
| 65 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('import.php')); |
||||||
| 66 | $GLOBALS['xoopsTpl']->assign('modules_list', $modulesList); |
||||||
| 67 | break; |
||||||
| 68 | case 'apcal': |
||||||
| 69 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('import.php')); |
||||||
| 70 | // Form Create |
||||||
| 71 | $form = $importHandler->getFormApcal(); |
||||||
| 72 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||||||
| 73 | break; |
||||||
| 74 | case 'apcal_exec': |
||||||
| 75 | // Security Check |
||||||
| 76 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||||||
| 77 | \redirect_header('index.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||||||
| 78 | } |
||||||
| 79 | $catsCount = 0; |
||||||
| 80 | $catsImported = 0; |
||||||
| 81 | if ($cats) { |
||||||
| 82 | // delete all existing data |
||||||
| 83 | $categoryHandler->deleteAll(); |
||||||
| 84 | $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('wgevents_category') . ' AUTO_INCREMENT = 1'); |
||||||
| 85 | // read categories |
||||||
| 86 | $result = $GLOBALS['xoopsDB']->queryF('SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('apcal_cat')); |
||||||
| 87 | while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) { |
||||||
| 88 | $catsCount++; |
||||||
| 89 | $categoryObj = $categoryHandler->create(); |
||||||
| 90 | // Set Vars |
||||||
| 91 | $categoryObj->setVar('id', $row['cid']); |
||||||
| 92 | $categoryObj->setVar('pid', $row['pid']); |
||||||
| 93 | $categoryObj->setVar('name', $row['cat_title']); |
||||||
| 94 | $categoryObj->setVar('desc', $row['cat_desc']); |
||||||
| 95 | $categoryObj->setVar('logo', 'blank.gif'); |
||||||
| 96 | $categoryObj->setVar('color', '#000000'); |
||||||
| 97 | $categoryObj->setVar('bordercolor', $row['color']); |
||||||
| 98 | $categoryObj->setVar('bgcolor', $row['color']); |
||||||
| 99 | $categoryObj->setVar('othercss', $row['cat_style']); |
||||||
| 100 | $categoryObj->setVar('identifier', 'cat' . $row['cid'] . '_'); |
||||||
| 101 | $categoryObj->setVar('status', Constants::STATUS_ONLINE); |
||||||
| 102 | $categoryObj->setVar('weight', $row['weight']); |
||||||
| 103 | $categoryObj->setVar('datecreated', time()); |
||||||
| 104 | $categoryObj->setVar('submitter', $uidCurrent); |
||||||
| 105 | // Insert Data |
||||||
| 106 | if ($categoryHandler->insert($categoryObj)) { |
||||||
| 107 | $catsImported++; |
||||||
| 108 | } |
||||||
| 109 | } |
||||||
| 110 | } |
||||||
| 111 | unset($result); |
||||||
| 112 | |||||||
| 113 | $eventsCount = 0; |
||||||
| 114 | $eventsImported = 0; |
||||||
| 115 | $deleteArr = []; |
||||||
| 116 | $delSource = Request::getBool('del_source'); |
||||||
| 117 | // delete all existing data |
||||||
| 118 | $eventHandler->deleteAll(); |
||||||
| 119 | $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('wgevents_event') . ' AUTO_INCREMENT = 1'); |
||||||
| 120 | // read events |
||||||
| 121 | $result = $GLOBALS['xoopsDB']->queryF('SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('apcal_event') . ' WHERE start<=' . $dateTo . ' AND end>=' . $dateFrom . ' ORDER BY start ASC'); |
||||||
| 122 | while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) { |
||||||
| 123 | $eventsCount++; |
||||||
| 124 | $eventObj = $eventHandler->create(); |
||||||
| 125 | $eventObj->setVar('id', $row['id']); |
||||||
| 126 | $eventObj->setVar('catid', $row['mainCategory']); |
||||||
| 127 | $eventObj->setVar('name', $row['summary']); |
||||||
| 128 | $eventObj->setVar('desc', $row['description']); |
||||||
| 129 | $logo = 'blank.gif'; |
||||||
| 130 | $imgTarget = XOOPS_ROOT_PATH . '/uploads/' . $moduleDirName . '/events/logos/' . (int)$row['uid']; |
||||||
| 131 | if (!\file_exists($imgTarget)) { |
||||||
| 132 | // create folder if not existing |
||||||
| 133 | Utility::createFolder($imgTarget); |
||||||
| 134 | \chmod($imgTarget, 0777); |
||||||
| 135 | $fileBlank = XOOPS_ROOT_PATH . '/uploads/' . $moduleDirName . '/events/logos/blank.gif'; |
||||||
| 136 | $dest = $imgTarget . '/blank.gif'; |
||||||
| 137 | Utility::copyFile($fileBlank, $dest); |
||||||
| 138 | } |
||||||
| 139 | $resultPics = $GLOBALS['xoopsDB']->queryF('SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('apcal_pictures') . ' WHERE event_id=' . $row['id'] . ' AND main_pic=1'); |
||||||
| 140 | while ($rowPic = $GLOBALS['xoopsDB']->fetchArray($resultPics)) { |
||||||
| 141 | // copy image into wgevents upload folder |
||||||
| 142 | $imgSource = XOOPS_ROOT_PATH . '/uploads/apcal/' . $rowPic['picture']; |
||||||
| 143 | $imgTarget .= '/' . $rowPic['picture']; |
||||||
| 144 | if (!\file_exists($imgTarget)) { |
||||||
| 145 | \copy($imgSource, $imgTarget); |
||||||
| 146 | $maxwidth = (int)$helper->getConfig('maxwidth_image'); |
||||||
| 147 | $maxheight = (int)$helper->getConfig('maxheight_image'); |
||||||
| 148 | if ($maxwidth > 0 && $maxheight > 0) { |
||||||
| 149 | // Resize image |
||||||
| 150 | $imgHandler = new Resizer(); |
||||||
| 151 | $imgHandler->sourceFile = $imgTarget; |
||||||
| 152 | $imgHandler->endFile = $imgTarget; |
||||||
| 153 | $imgHandler->imageMimetype = mime_content_type($imgTarget); |
||||||
| 154 | $imgHandler->maxWidth = $maxwidth; |
||||||
| 155 | $imgHandler->maxHeight = $maxheight; |
||||||
| 156 | $result = $imgHandler->resizeImage(); |
||||||
| 157 | } |
||||||
| 158 | } |
||||||
| 159 | $logo = $rowPic['picture']; |
||||||
| 160 | } |
||||||
| 161 | $eventObj->setVar('logo', $logo); |
||||||
| 162 | $eventObj->setVar('datefrom', $row['start']); |
||||||
| 163 | $eventObj->setVar('dateto', $row['end']); |
||||||
| 164 | $eventObj->setVar('contact', $row['contact']); |
||||||
| 165 | $eventObj->setVar('email', $row['email']); |
||||||
| 166 | $eventObj->setVar('location', $row['location']); |
||||||
| 167 | $eventObj->setVar('url', $row['url']); |
||||||
| 168 | $eventObj->setVar('locgmlat', $row['gmlat']); |
||||||
| 169 | $eventObj->setVar('locgmlon', $row['gmlong']); |
||||||
| 170 | $eventObj->setVar('locgmzoom', $row['gmzoom']); |
||||||
| 171 | $eventObj->setVar('fee', 0); |
||||||
| 172 | $eventObj->setVar('paymentinfo', ''); |
||||||
| 173 | $eventObj->setVar('register_use', 0); |
||||||
| 174 | $eventObj->setVar('register_to', 0); |
||||||
| 175 | $eventObj->setVar('register_max', 0); |
||||||
| 176 | $eventObj->setVar('register_listwait', 0); |
||||||
| 177 | $eventObj->setVar('register_autoaccept', 0); |
||||||
| 178 | $eventObj->setVar('register_notify', ''); |
||||||
| 179 | $eventObj->setVar('register_sendermail', ''); |
||||||
| 180 | $eventObj->setVar('register_sendername', ''); |
||||||
| 181 | $eventObj->setVar('register_signature', ''); |
||||||
| 182 | $eventObj->setVar('register_forceverif', 0); |
||||||
| 183 | $eventObj->setVar('status', Constants::STATUS_APPROVED); |
||||||
| 184 | $eventObj->setVar('galid', 0); |
||||||
| 185 | $eventObj->setVar('groups', '0'); |
||||||
| 186 | $eventObj->setVar('identifier', 'cat' . $row['mainCategory'] . '_' . (int)$row['id']); |
||||||
| 187 | $eventObj->setVar('datecreated', time()); |
||||||
| 188 | $eventObj->setVar('submitter', (int)$row['uid']); |
||||||
| 189 | // Insert Data |
||||||
| 190 | if ($eventHandler->insert($eventObj)) { |
||||||
| 191 | if ($delSource) { |
||||||
| 192 | $deleteArr[] = (int)$row['id']; |
||||||
| 193 | } |
||||||
| 194 | $eventsImported++; |
||||||
| 195 | } |
||||||
| 196 | } |
||||||
| 197 | if ($delSource && \count($deleteArr) > 0) { |
||||||
| 198 | foreach ($deleteArr as $idSource) { |
||||||
| 199 | $GLOBALS['xoopsDB']->queryF('DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('apcal_event') . '` WHERE `' . $GLOBALS['xoopsDB']->prefix('apcal_event') . '`.`id` = ' . $idSource); |
||||||
| 200 | } |
||||||
| 201 | } |
||||||
| 202 | $modulesList[] = ['name' => \_AM_WGEVENTS_IMPORT_APCAL, 'catsResult' => \sprintf(_AM_WGEVENTS_IMPORT_RESULT_OF, $catsImported, $catsCount), 'eventsResult'=> \sprintf(_AM_WGEVENTS_IMPORT_RESULT_OF, $eventsImported, $eventsCount)]; |
||||||
| 203 | $GLOBALS['xoopsTpl']->assign('modules_list', $modulesList); |
||||||
| 204 | $GLOBALS['xoopsTpl']->assign('showData', true); |
||||||
| 205 | break; |
||||||
| 206 | case 'extcal': |
||||||
| 207 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('import.php')); |
||||||
| 208 | // Form Create |
||||||
| 209 | $form = $importHandler->getFormExtcal(); |
||||||
| 210 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||||||
| 211 | break; |
||||||
| 212 | case 'extcal_exec': |
||||||
| 213 | // Security Check |
||||||
| 214 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||||||
| 215 | \redirect_header('index.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||||||
| 216 | } |
||||||
| 217 | $catsCount = 0; |
||||||
| 218 | $catsImported = 0; |
||||||
| 219 | if ($cats) { |
||||||
| 220 | // delete all existing data |
||||||
| 221 | $categoryHandler->deleteAll(); |
||||||
| 222 | $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('wgevents_category') . ' AUTO_INCREMENT = 1'); |
||||||
| 223 | // read categories |
||||||
| 224 | $result = $GLOBALS['xoopsDB']->queryF('SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('extcal_cat')); |
||||||
| 225 | while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) { |
||||||
| 226 | $catsCount++; |
||||||
| 227 | $categoryObj = $categoryHandler->create(); |
||||||
| 228 | // Set Vars |
||||||
| 229 | $categoryObj->setVar('id', $row['cat_id']); |
||||||
| 230 | $categoryObj->setVar('pid', 0); |
||||||
| 231 | $categoryObj->setVar('name', $row['cat_name']); |
||||||
| 232 | $categoryObj->setVar('desc', $row['cat_desc']); |
||||||
| 233 | $logo = 'blank.gif'; |
||||||
| 234 | $imgSource = XOOPS_ROOT_PATH . '/modules/extcal/assets/css/images/' . $row['cat_icone']; |
||||||
| 235 | if (\is_file($imgSource)) { |
||||||
| 236 | // copy image into wgevents upload folder, if not existing |
||||||
| 237 | $imgTarget = XOOPS_ROOT_PATH . '/uploads/' . $moduleDirName . '/categories/logos/' . $row['cat_icone']; |
||||||
| 238 | if (!\file_exists($imgTarget)) { |
||||||
| 239 | \copy($imgSource, $imgTarget); |
||||||
| 240 | $maxwidth = (int)$helper->getConfig('maxwidth_image'); |
||||||
| 241 | $maxheight = (int)$helper->getConfig('maxheight_image'); |
||||||
| 242 | if ($maxwidth > 0 && $maxheight > 0) { |
||||||
| 243 | // Resize image |
||||||
| 244 | $imgHandler = new Resizer(); |
||||||
| 245 | $imgHandler->sourceFile = $imgTarget; |
||||||
| 246 | $imgHandler->endFile = $imgTarget; |
||||||
| 247 | $imgHandler->imageMimetype = mime_content_type($imgTarget); |
||||||
| 248 | $imgHandler->maxWidth = $maxwidth; |
||||||
| 249 | $imgHandler->maxHeight = $maxheight; |
||||||
| 250 | $result = $imgHandler->resizeImage(); |
||||||
| 251 | } |
||||||
| 252 | } |
||||||
| 253 | $logo = $row['cat_icone']; |
||||||
| 254 | } |
||||||
| 255 | $categoryObj->setVar('logo', $logo); |
||||||
| 256 | $categoryObj->setVar('color', '#000000'); |
||||||
| 257 | $categoryObj->setVar('bordercolor', '#' . $row['cat_color']); |
||||||
| 258 | $categoryObj->setVar('bgcolor', '#' . $row['cat_color']); |
||||||
| 259 | $categoryObj->setVar('othercss', ''); |
||||||
| 260 | $categoryObj->setVar('identifier', 'cat' . $row['cat_id'] . '_'); |
||||||
| 261 | $categoryObj->setVar('status', Constants::STATUS_ONLINE); |
||||||
| 262 | $categoryObj->setVar('weight', $row['cat_weight']); |
||||||
| 263 | $categoryObj->setVar('datecreated', time()); |
||||||
| 264 | $categoryObj->setVar('submitter', $uidCurrent); |
||||||
| 265 | // Insert Data |
||||||
| 266 | if ($categoryHandler->insert($categoryObj)) { |
||||||
| 267 | $catsImported++; |
||||||
| 268 | } |
||||||
| 269 | } |
||||||
| 270 | } |
||||||
| 271 | unset($result); |
||||||
| 272 | |||||||
| 273 | $eventsCount = 0; |
||||||
| 274 | $eventsImported = 0; |
||||||
| 275 | $deleteArr = []; |
||||||
| 276 | $delSource = Request::getBool('del_source'); |
||||||
| 277 | // delete all existing data |
||||||
| 278 | $eventHandler->deleteAll(); |
||||||
| 279 | $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('wgevents_event') . ' AUTO_INCREMENT = 1'); |
||||||
| 280 | // read events |
||||||
| 281 | $result = $GLOBALS['xoopsDB']->queryF('SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('extcal_event') . ' WHERE event_start<=' . $dateTo . ' AND event_end>=' . $dateFrom . ' ORDER BY event_start ASC'); |
||||||
| 282 | while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) { |
||||||
| 283 | $eventsCount++; |
||||||
| 284 | $eventObj = $eventHandler->create(); |
||||||
| 285 | $eventObj->setVar('id', $row['event_id']); |
||||||
| 286 | $eventObj->setVar('catid', $row['cat_id']); |
||||||
| 287 | $eventObj->setVar('name', $row['event_title']); |
||||||
| 288 | $eventObj->setVar('desc', $row['event_desc']); |
||||||
| 289 | $logo = 'blank.gif'; |
||||||
| 290 | $imgTarget = XOOPS_ROOT_PATH . '/uploads/' . $moduleDirName . '/events/logos/' . (int)$row['event_submitter']; |
||||||
| 291 | if (!\file_exists($imgTarget)) { |
||||||
| 292 | // create folder if not existing |
||||||
| 293 | Utility::createFolder($imgTarget); |
||||||
| 294 | \chmod($imgTarget, 0777); |
||||||
| 295 | $fileBlank = XOOPS_ROOT_PATH . '/uploads/' . $moduleDirName . '/events/logos/blank.gif'; |
||||||
| 296 | $dest = $imgTarget . '/blank.gif'; |
||||||
| 297 | Utility::copyFile($fileBlank, $dest); |
||||||
| 298 | } |
||||||
| 299 | $imgSource = XOOPS_ROOT_PATH . '/modules/extcal/assets/css/images/' . $row['event_icone']; |
||||||
| 300 | if (\is_file($imgSource)) { |
||||||
| 301 | // copy image into wgevents upload folder |
||||||
| 302 | $imgTarget .= '/' . $row['event_icone']; |
||||||
| 303 | if (!\file_exists($imgTarget)) { |
||||||
| 304 | \copy($imgSource, $imgTarget); |
||||||
| 305 | $maxwidth = (int)$helper->getConfig('maxwidth_image'); |
||||||
| 306 | $maxheight = (int)$helper->getConfig('maxheight_image'); |
||||||
| 307 | if ($maxwidth > 0 && $maxheight > 0) { |
||||||
| 308 | // Resize image |
||||||
| 309 | $imgHandler = new Resizer(); |
||||||
| 310 | $imgHandler->sourceFile = $imgTarget; |
||||||
| 311 | $imgHandler->endFile = $imgTarget; |
||||||
| 312 | $imgHandler->imageMimetype = mime_content_type($imgTarget); |
||||||
| 313 | $imgHandler->maxWidth = $maxwidth; |
||||||
| 314 | $imgHandler->maxHeight = $maxheight; |
||||||
| 315 | $result = $imgHandler->resizeImage(); |
||||||
| 316 | } |
||||||
| 317 | } |
||||||
| 318 | $logo = $row['event_icone']; |
||||||
| 319 | } |
||||||
| 320 | $eventObj->setVar('logo', $logo); |
||||||
| 321 | $eventObj->setVar('datefrom', $row['event_start']); |
||||||
| 322 | $eventObj->setVar('dateto', $row['event_end']); |
||||||
| 323 | $eventObj->setVar('contact', $row['event_contact']); |
||||||
| 324 | $eventObj->setVar('email', $row['event_email']); |
||||||
| 325 | //TODO |
||||||
| 326 | $location = ''; |
||||||
| 327 | $resultLoc = $GLOBALS['xoopsDB']->queryF('SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('extcal_location') . ' WHERE id=' . $row['event_location']); |
||||||
| 328 | while ($rowLoc = $GLOBALS['xoopsDB']->fetchArray($resultLoc)) { |
||||||
| 329 | $location .= $rowLoc['nom'] . PHP_EOL; |
||||||
| 330 | if ('' !== (string)$rowLoc['adresse']) { |
||||||
| 331 | $location .= $rowLoc['adresse'] . PHP_EOL; |
||||||
| 332 | } |
||||||
| 333 | if ('' !== (string)$rowLoc['adresse2']) { |
||||||
| 334 | $location .= $rowLoc['adresse2'] . PHP_EOL; |
||||||
| 335 | } |
||||||
| 336 | if ('' !== (string)$rowLoc['cp']) { |
||||||
| 337 | $location .= $rowLoc['cp'] . PHP_EOL; |
||||||
| 338 | } |
||||||
| 339 | if ('' !== (string)$rowLoc['ville']) { |
||||||
| 340 | $location .= $rowLoc['ville'] . PHP_EOL; |
||||||
| 341 | } |
||||||
| 342 | if ('' !== (string)$rowLoc['tel_fixe']) { |
||||||
| 343 | $location .= $rowLoc['tel_fixe'] . PHP_EOL; |
||||||
| 344 | } |
||||||
| 345 | if ('' !== (string)$rowLoc['tel_portable']) { |
||||||
| 346 | $location .= $rowLoc['tel_portable'] . PHP_EOL; |
||||||
| 347 | } |
||||||
| 348 | if ('' !== (string)$rowLoc['mail']) { |
||||||
| 349 | $location .= $rowLoc['mail'] . PHP_EOL; |
||||||
| 350 | } |
||||||
| 351 | if ('' !== (string)$rowLoc['site']) { |
||||||
| 352 | $location .= $rowLoc['site'] . PHP_EOL; |
||||||
| 353 | } |
||||||
| 354 | } |
||||||
| 355 | $eventObj->setVar('location', $location); |
||||||
| 356 | $eventObj->setVar('url', $row['event_url']); |
||||||
| 357 | $eventObj->setVar('locgmlat', 0); |
||||||
| 358 | $eventObj->setVar('locgmlon', 0); |
||||||
| 359 | $eventObj->setVar('locgmzoom', 0); |
||||||
| 360 | $eventObj->setVar('fee', $row['event_price']); |
||||||
| 361 | $eventObj->setVar('paymentinfo', ''); |
||||||
| 362 | $eventObj->setVar('register_use', 0); |
||||||
| 363 | $eventObj->setVar('register_to', 0); |
||||||
| 364 | $eventObj->setVar('register_max', 0); |
||||||
| 365 | $eventObj->setVar('register_listwait', 0); |
||||||
| 366 | $eventObj->setVar('register_autoaccept', 0); |
||||||
| 367 | $eventObj->setVar('register_notify', ''); |
||||||
| 368 | $eventObj->setVar('register_sendermail', ''); |
||||||
| 369 | $eventObj->setVar('register_sendername', ''); |
||||||
| 370 | $eventObj->setVar('register_signature', ''); |
||||||
| 371 | $eventObj->setVar('register_forceverif', 0); |
||||||
| 372 | $eventObj->setVar('status', Constants::STATUS_APPROVED); |
||||||
| 373 | $eventObj->setVar('galid', 0); |
||||||
| 374 | $eventObj->setVar('groups', '0'); |
||||||
| 375 | $eventObj->setVar('identifier', 'cat' . $row['cat_id'] . '_' . (int)$row['event_id']); |
||||||
| 376 | $eventObj->setVar('datecreated', $row['event_submitdate']); |
||||||
| 377 | $eventObj->setVar('submitter', (int)$row['event_submitter']); |
||||||
| 378 | // Insert Data |
||||||
| 379 | if ($eventHandler->insert($eventObj)) { |
||||||
| 380 | if ($delSource) { |
||||||
| 381 | $deleteArr[] = (int)$row['event_id']; |
||||||
| 382 | } |
||||||
| 383 | $eventsImported++; |
||||||
| 384 | } |
||||||
| 385 | } |
||||||
| 386 | if ($delSource && \count($deleteArr) > 0) { |
||||||
| 387 | foreach ($deleteArr as $idSource) { |
||||||
| 388 | $GLOBALS['xoopsDB']->queryF('DELETE FROM `' . $GLOBALS['xoopsDB']->prefix('extcal_event') . '` WHERE `' . $GLOBALS['xoopsDB']->prefix('extcal_event') . '`.`event_id` = ' . $idSource); |
||||||
| 389 | } |
||||||
| 390 | } |
||||||
| 391 | $modulesList[] = ['name' => \_AM_WGEVENTS_IMPORT_EXTCAL, 'catsResult' => \sprintf(_AM_WGEVENTS_IMPORT_RESULT_OF, $catsImported, $catsCount), 'eventsResult'=> \sprintf(_AM_WGEVENTS_IMPORT_RESULT_OF, $eventsImported, $eventsCount)]; |
||||||
| 392 | $GLOBALS['xoopsTpl']->assign('modules_list', $modulesList); |
||||||
| 393 | $GLOBALS['xoopsTpl']->assign('showData', true); |
||||||
| 394 | break; |
||||||
| 395 | } |
||||||
| 396 | require __DIR__ . '/footer.php'; |
||||||
| 397 |
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: