XoopsModules25x /
songlist
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 | use XoopsModules\Songlist\Form\SelectCategoryForm; |
||
| 4 | use XoopsModules\Songlist\Form\SelectGenreForm; |
||
| 5 | use XoopsModules\Songlist\Form\SelectVoiceForm; |
||
| 6 | use XoopsModules\Songlist\Helper; |
||
| 7 | use XoopsModules\Songlist\CategoryHandler; |
||
| 8 | use XoopsModules\Songlist\SongsHandler; |
||
| 9 | use XoopsModules\Songlist\VotesHandler; |
||
| 10 | use XoopsModules\Songlist\Utf8mapHandler; |
||
|
0 ignored issues
–
show
|
|||
| 11 | |||
| 12 | |||
| 13 | require_once __DIR__ . '/header.php'; |
||
| 14 | |||
| 15 | global $file, $op, $fct, $id, $value, $gid, $cid, $vcid, $start, $limit, $singer; |
||
| 16 | |||
| 17 | /** @var CategoryHandler $categoryHandler */ |
||
| 18 | $categoryHandler = Helper::getInstance()->getHandler('Category'); |
||
| 19 | $criteria_cat = new \CriteriaCompo(); |
||
| 20 | $cids = $categoryHandler->GetCatAndSubCat($_SESSION['cid']); |
||
| 21 | if ($_SESSION['cid'] > 0) { |
||
| 22 | $cids[$_SESSION['cid']] = $_SESSION['cid']; |
||
| 23 | } |
||
| 24 | if (count($cids) > 0 && 0 != $_SESSION['cid']) { |
||
| 25 | $criteria_cat->add(new \Criteria('cid', '(' . implode(',', $cids) . ')', 'IN'), 'OR'); |
||
| 26 | } else { |
||
| 27 | $criteria_cat->add(new \Criteria(''), 'OR'); |
||
| 28 | } |
||
| 29 | $criteria_cat->setSort('created'); |
||
| 30 | $criteria_cat->setOrder('ASC'); |
||
| 31 | |||
| 32 | $criteria = new \Criteria('pid', $_SESSION['cid']); |
||
| 33 | $criteria->setSort('weight'); |
||
| 34 | $criteria->setOrder('ASC'); |
||
| 35 | $categories = $categoryHandler->getObjects($criteria, false); |
||
| 36 | |||
| 37 | $cat = []; |
||
| 38 | $col = 1; |
||
| 39 | $row = 1; |
||
| 40 | foreach ($categories as $category) { |
||
| 41 | $cat[$row][$col] = $category->toArray(true); |
||
| 42 | $cat[$row][$col]['width'] = floor(100 / $GLOBALS['songlistModuleConfig']['cols']) . '%'; |
||
| 43 | ++$col; |
||
| 44 | if ($col > $GLOBALS['songlistModuleConfig']['cols']) { |
||
| 45 | ++$row; |
||
| 46 | $col = 1; |
||
| 47 | } |
||
| 48 | } |
||
| 49 | if (1 != $col) { |
||
| 50 | $col--; |
||
| 51 | for ($j = $col; $j <= $GLOBALS['songlistModuleConfig']['cols']; ++$j) { |
||
| 52 | $cat[$row][$j][$categoryHandler->keyName] = 0; |
||
| 53 | $cat[$row][$j]['width'] = floor(100 / $GLOBALS['songlistModuleConfig']['cols']) . '%'; |
||
| 54 | } |
||
| 55 | } |
||
| 56 | |||
| 57 | $category_element = new SelectCategoryForm('', 'cid', ($_GET['cid'] ?? $cid)); |
||
| 58 | $genre_element = new SelectGenreForm('', 'gid', $gid); |
||
| 59 | $voice_element = new SelectVoiceForm('', 'vcid', $vcid); |
||
| 60 | |||
| 61 | /** @var SongsHandler $songsHandler */ |
||
| 62 | $songsHandler = Helper::getInstance()->getHandler('Songs'); |
||
| 63 | switch ($op) { |
||
| 64 | case 'vote': |
||
| 65 | /** @var VotesHandler $votesHandler */ |
||
| 66 | $votesHandler = Helper::getInstance()->getHandler('Votes'); |
||
| 67 | $votesHandler->addVote($id, $value); |
||
| 68 | redirect_header($_POST['uri'], 10, _MD_SONGLIST_MSG_VOTED_ALREADY); |
||
| 69 | // no break |
||
| 70 | default: |
||
| 71 | case 'item': |
||
| 72 | switch ($fct) { |
||
| 73 | default: |
||
| 74 | case 'list': |
||
| 75 | $pagenav = new \XoopsPageNav($songsHandler->getCount($criteria_cat), $limit, $start, 'start', "op=$op&fct=$fct&id=$id&value=$value&limit=$limit"); |
||
| 76 | |||
| 77 | $criteria_cat->setLimit($limit); |
||
| 78 | $criteria_cat->setStart($start); |
||
| 79 | |||
| 80 | $songs = $songsHandler->getObjects($criteria_cat, false); |
||
| 81 | |||
| 82 | $url = $songsHandler->getURL(); |
||
| 83 | if (!mb_strpos($url, $_SERVER['REQUEST_URI'])) { |
||
| 84 | header('HTTP/1.1 301 Moved Permanently'); |
||
| 85 | header('Location: ' . $url); |
||
| 86 | exit(0); |
||
| 87 | } |
||
| 88 | |||
| 89 | $GLOBALS['xoopsOption']['template_main'] = 'songlist_songs_index.tpl'; |
||
| 90 | require_once $GLOBALS['xoops']->path('/header.php'); |
||
| 91 | if ($GLOBALS['songlistModuleConfig']['force_jquery'] && !isset($GLOBALS['loaded_jquery'])) { |
||
| 92 | $GLOBALS['xoTheme']->addScript(XOOPS_URL . _MI_SONGLIST_JQUERY, ['type' => 'text/javascript']); |
||
| 93 | $GLOBALS['loaded_jquery'] = true; |
||
| 94 | } |
||
| 95 | $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . _MI_SONGLIST_STYLESHEET, ['type' => 'text/css']); |
||
| 96 | $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']); |
||
| 97 | $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
||
| 98 | foreach ($songs as $song) { |
||
| 99 | $GLOBALS['xoopsTpl']->append('results', $song->toArray(true)); |
||
| 100 | } |
||
| 101 | $GLOBALS['xoopsTpl']->assign('songs', true); |
||
| 102 | $GLOBALS['xoopsTpl']->assign('categories', $cat); |
||
| 103 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
||
| 104 | $GLOBALS['xoopsTpl']->assign('category_element', $category_element->render()); |
||
| 105 | $GLOBALS['xoopsTpl']->assign('genre_element', $genre_element->render()); |
||
| 106 | $GLOBALS['xoopsTpl']->assign('voice_element', $voice_element->render()); |
||
| 107 | $GLOBALS['xoopsTpl']->assign('cid', $_SESSION['cid']); |
||
| 108 | if (0 != $_SESSION['cid']) { |
||
| 109 | $category = $categoryHandler->get($_SESSION['cid']); |
||
| 110 | if (is_object($category)) { |
||
| 111 | $GLOBALS['xoopsTpl']->assign('category', $category->toArray(true)); |
||
| 112 | } |
||
| 113 | } |
||
| 114 | $GLOBALS['xoopsTpl']->assign('uri', $_SERVER['REQUEST_URI']); |
||
| 115 | require_once $GLOBALS['xoops']->path('/footer.php'); |
||
| 116 | break; |
||
| 117 | case 'item': |
||
| 118 | $song = $songsHandler->get($id); |
||
| 119 | |||
| 120 | $url = $song->getURL(true); |
||
| 121 | if (!mb_strpos($url, $_SERVER['REQUEST_URI'])) { |
||
| 122 | header('HTTP/1.1 301 Moved Permanently'); |
||
| 123 | header('Location: ' . $url); |
||
| 124 | exit(0); |
||
| 125 | } |
||
| 126 | |||
| 127 | $GLOBALS['xoopsOption']['template_main'] = 'songlist_songs_item.tpl'; |
||
| 128 | require_once $GLOBALS['xoops']->path('/header.php'); |
||
| 129 | if ($GLOBALS['songlistModuleConfig']['force_jquery'] && !isset($GLOBALS['loaded_jquery'])) { |
||
| 130 | $GLOBALS['xoTheme']->addScript(XOOPS_URL . _MI_SONGLIST_JQUERY, ['type' => 'text/javascript']); |
||
| 131 | $GLOBALS['loaded_jquery'] = true; |
||
| 132 | } |
||
| 133 | $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . _MI_SONGLIST_STYLESHEET, ['type' => 'text/css']); |
||
| 134 | $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']); |
||
| 135 | $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
||
| 136 | $GLOBALS['xoopsTpl']->assign('songs', false); |
||
| 137 | $GLOBALS['xoopsTpl']->assign('song', $song->toArray(true)); |
||
| 138 | $GLOBALS['xoopsTpl']->assign('categories', $cat); |
||
| 139 | $GLOBALS['xoopsTpl']->assign('category_element', $category_element->render()); |
||
| 140 | $GLOBALS['xoopsTpl']->assign('genre_element', $genre_element->render()); |
||
| 141 | $GLOBALS['xoopsTpl']->assign('voice_element', $voice_element->render()); |
||
| 142 | $GLOBALS['xoopsTpl']->assign('uri', $_SERVER['REQUEST_URI']); |
||
| 143 | require_once $GLOBALS['xoops']->path('/footer.php'); |
||
| 144 | break; |
||
| 145 | } |
||
| 146 | break; |
||
| 147 | case 'browseby': |
||
| 148 | switch ($fct) { |
||
| 149 | default: |
||
| 150 | case 'title': |
||
| 151 | $browse_criteria = new \CriteriaCompo(); |
||
| 152 | switch ($value) { |
||
| 153 | case '0': |
||
| 154 | for ($u = 0; $u < 10; ++$u) { |
||
| 155 | $browse_criteria->add(new \Criteria('title', $u . '%', 'LIKE'), 'OR'); |
||
| 156 | } |
||
| 157 | break; |
||
| 158 | default: |
||
| 159 | $browse_criteria->add(new \Criteria('title', \mb_strtoupper($value) . '%', 'LIKE'), 'OR'); |
||
| 160 | $browse_criteria->add(new \Criteria('title', \mb_strtolower($value) . '%', 'LIKE'), 'OR'); |
||
| 161 | break; |
||
| 162 | } |
||
| 163 | $criteria = new \CriteriaCompo($criteria_cat, 'AND'); |
||
| 164 | $criteria->add($browse_criteria); |
||
| 165 | break; |
||
| 166 | case 'lyrics': |
||
| 167 | $browse_criteria = new \CriteriaCompo(); |
||
| 168 | switch ($value) { |
||
| 169 | case '0': |
||
| 170 | for ($u = 0; $u < 10; ++$u) { |
||
| 171 | $browse_criteria->add(new \Criteria('lyrics', $u . '%', 'LIKE'), 'OR'); |
||
| 172 | } |
||
| 173 | break; |
||
| 174 | default: |
||
| 175 | $browse_criteria->add(new \Criteria('lyrics', \mb_strtoupper($value) . '%', 'LIKE'), 'OR'); |
||
| 176 | $browse_criteria->add(new \Criteria('lyrics', \mb_strtolower($value) . '%', 'LIKE'), 'OR'); |
||
| 177 | break; |
||
| 178 | } |
||
| 179 | $criteria = new \CriteriaCompo($criteria_cat, 'AND'); |
||
| 180 | $criteria->add($browse_criteria); |
||
| 181 | break; |
||
| 182 | case 'artist': |
||
| 183 | $browse_criteria = new \CriteriaCompo(); |
||
| 184 | switch ($value) { |
||
| 185 | case '0': |
||
| 186 | for ($u = 0; $u < 10; ++$u) { |
||
| 187 | $browse_criteria->add(new \Criteria('name', $u . '%', 'LIKE'), 'OR'); |
||
| 188 | } |
||
| 189 | break; |
||
| 190 | default: |
||
| 191 | $browse_criteria->add(new \Criteria('name', \mb_strtoupper($value) . '%', 'LIKE'), 'OR'); |
||
| 192 | $browse_criteria->add(new \Criteria('name', \mb_strtolower($value) . '%', 'LIKE'), 'OR'); |
||
| 193 | break; |
||
| 194 | } |
||
| 195 | $artistsHandler = Helper::getInstance()->getHandler('Artists'); |
||
| 196 | $browse_criteriab = new \CriteriaCompo(); |
||
| 197 | foreach ($artistsHandler->getObjects($browse_criteria, true) as $aid => $obj) { |
||
| 198 | $browse_criteriab->add(new \Criteria('aids', '%"' . $aid . '"%', 'LIKE'), 'OR'); |
||
| 199 | } |
||
| 200 | $criteria = new \CriteriaCompo($criteria_cat, 'AND'); |
||
| 201 | $criteria->add($browse_criteriab); |
||
| 202 | break; |
||
| 203 | case 'album': |
||
| 204 | $browse_criteria = new \CriteriaCompo(); |
||
| 205 | switch ($value) { |
||
| 206 | case '0': |
||
| 207 | for ($u = 0; $u < 10; ++$u) { |
||
| 208 | $browse_criteria->add(new \Criteria('title', $u . '%', 'LIKE'), 'OR'); |
||
| 209 | } |
||
| 210 | break; |
||
| 211 | default: |
||
| 212 | $browse_criteria->add(new \Criteria('title', \mb_strtoupper($value) . '%', 'LIKE'), 'OR'); |
||
| 213 | $browse_criteria->add(new \Criteria('title', \mb_strtolower($value) . '%', 'LIKE'), 'OR'); |
||
| 214 | break; |
||
| 215 | } |
||
| 216 | $ids = []; |
||
| 217 | $albumsHandler = Helper::getInstance()->getHandler('Albums'); |
||
| 218 | foreach ($albumsHandler->getObjects($browse_criteria, true) as $id => $obj) { |
||
| 219 | $ids[$id] = $id; |
||
| 220 | } |
||
| 221 | $criteria = new \CriteriaCompo($criteria_cat, 'AND'); |
||
| 222 | if (count($ids) > 0) { |
||
| 223 | $criteria->add(new \Criteria('abid', '(' . implode(',', $ids) . ')', 'IN')); |
||
| 224 | } |
||
| 225 | break; |
||
| 226 | } |
||
| 227 | |||
| 228 | $pagenav = new \XoopsPageNav($songsHandler->getCount($criteria), $limit, $start, 'start', "op=$op&fct=$fct&id=$id&value=$value&limit=$limit"); |
||
| 229 | |||
| 230 | $criteria->setLimit($limit); |
||
| 231 | $criteria->setStart($start); |
||
| 232 | |||
| 233 | $songs = $songsHandler->getObjects($criteria, false); |
||
| 234 | |||
| 235 | $url = $songsHandler->getURL(); |
||
| 236 | if (!mb_strpos($url, $_SERVER['REQUEST_URI'])) { |
||
| 237 | header('HTTP/1.1 301 Moved Permanently'); |
||
| 238 | header('Location: ' . $url); |
||
| 239 | exit(0); |
||
| 240 | } |
||
| 241 | |||
| 242 | $GLOBALS['xoopsOption']['template_main'] = 'songlist_songs_index.tpl'; |
||
| 243 | require_once $GLOBALS['xoops']->path('/header.php'); |
||
| 244 | if ($GLOBALS['songlistModuleConfig']['force_jquery'] && !isset($GLOBALS['loaded_jquery'])) { |
||
| 245 | $GLOBALS['xoTheme']->addScript(XOOPS_URL . _MI_SONGLIST_JQUERY, ['type' => 'text/javascript']); |
||
| 246 | $GLOBALS['loaded_jquery'] = true; |
||
| 247 | } |
||
| 248 | $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . _MI_SONGLIST_STYLESHEET, ['type' => 'text/css']); |
||
| 249 | $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']); |
||
| 250 | $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
||
| 251 | foreach ($songs as $song) { |
||
| 252 | $GLOBALS['xoopsTpl']->append('results', $song->toArray(true)); |
||
| 253 | } |
||
| 254 | $GLOBALS['xoopsTpl']->assign('songs', true); |
||
| 255 | $GLOBALS['xoopsTpl']->assign('categories', $cat); |
||
| 256 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
||
| 257 | $GLOBALS['xoopsTpl']->assign('category_element', $category_element->render()); |
||
| 258 | $GLOBALS['xoopsTpl']->assign('genre_element', $genre_element->render()); |
||
| 259 | $GLOBALS['xoopsTpl']->assign('voice_element', $voice_element->render()); |
||
| 260 | $GLOBALS['xoopsTpl']->assign('cid', $_SESSION['cid']); |
||
| 261 | if (0 != $_SESSION['cid']) { |
||
| 262 | $category = $categoryHandler->get($_SESSION['cid']); |
||
| 263 | if (is_object($category)) { |
||
| 264 | $GLOBALS['xoopsTpl']->assign('category', $category->toArray(true)); |
||
| 265 | } |
||
| 266 | } |
||
| 267 | $GLOBALS['xoopsTpl']->assign('uri', $_SERVER['REQUEST_URI']); |
||
| 268 | require_once $GLOBALS['xoops']->path('/footer.php'); |
||
| 269 | break; |
||
| 270 | break; |
||
| 271 | case 'search': |
||
| 272 | /** @var SongsHandler $songsHandler */ |
||
| 273 | $songsHandler = Helper::getInstance()->getHandler('Songs'); |
||
| 274 | $artistsHandler = Helper::getInstance()->getHandler('Artists'); |
||
| 275 | |||
| 276 | /** @var Utf8mapHandler $utf8mapHandler */ |
||
| 277 | $utf8mapHandler = Helper::getInstance()->getHandler('Utf8map'); |
||
| 278 | |||
| 279 | $url = $songsHandler->getSearchURL(); |
||
| 280 | if (!mb_strpos($url, $_SERVER['REQUEST_URI'])) { |
||
| 281 | header('HTTP/1.1 301 Moved Permanently'); |
||
| 282 | header('Location: ' . $url); |
||
| 283 | exit(0); |
||
| 284 | } |
||
| 285 | |||
| 286 | switch ($fct) { |
||
| 287 | default: |
||
| 288 | case 'titleandlyrics': |
||
| 289 | $criteria = new \CriteriaCompo(); |
||
| 290 | foreach (explode(' ', $value) as $keyword) { |
||
| 291 | $criteria->add(new \Criteria('title', '%' . $utf8mapHandler->convert($keyword) . '%', 'LIKE')); |
||
| 292 | $criteria->add(new \Criteria('lyrics', '%' . $utf8mapHandler->convert($keyword) . '%', 'LIKE')); |
||
| 293 | } |
||
| 294 | break; |
||
| 295 | case 'albums': |
||
| 296 | $criteria = new \CriteriaCompo(); |
||
| 297 | foreach (explode(' ', $value) as $keyword) { |
||
| 298 | $criteria->add(new \Criteria('title', '%' . $utf8mapHandler->convert($keyword) . '%', 'LIKE')); |
||
| 299 | } |
||
| 300 | $albums = $albumsHandler->getObjects($criteria, true); |
||
| 301 | $criteria = new \CriteriaCompo(); |
||
| 302 | foreach ($albums as $abid => $album) { |
||
| 303 | $criteria->add(new \Criteria('abid', $abid), 'OR'); |
||
| 304 | } |
||
| 305 | break; |
||
| 306 | case 'artists': |
||
| 307 | $criteria = new \CriteriaCompo(); |
||
| 308 | foreach (explode(' ', $value) as $keyword) { |
||
| 309 | $criteria->add(new \Criteria('name', '%' . $utf8mapHandler->convert($keyword) . '%', 'LIKE')); |
||
| 310 | } |
||
| 311 | $artists = $artistsHandler->getObjects($criteria, true); |
||
| 312 | $criteria = new \CriteriaCompo(); |
||
| 313 | if (is_array($artists)) { |
||
|
0 ignored issues
–
show
|
|||
| 314 | foreach ($artists as $aid => $artist) { |
||
| 315 | $criteria->add(new \Criteria('aids', '%"' . $aid . '"%', 'LIKE'), 'OR'); |
||
| 316 | } |
||
| 317 | } |
||
| 318 | break; |
||
| 319 | case 'lyrics': |
||
| 320 | $criteria = new \CriteriaCompo(); |
||
| 321 | foreach (explode(' ', $value) as $keyword) { |
||
| 322 | $criteria->add(new \Criteria('lyrics', '%' . $utf8mapHandler->convert($keyword) . '%', 'LIKE')); |
||
| 323 | } |
||
| 324 | break; |
||
| 325 | case 'title': |
||
| 326 | $criteria = new \CriteriaCompo(); |
||
| 327 | foreach (explode(' ', $value) as $keyword) { |
||
| 328 | $criteria->add(new \Criteria('title', '%' . $utf8mapHandler->convert($keyword) . '%', 'LIKE')); |
||
| 329 | } |
||
| 330 | break; |
||
| 331 | } |
||
| 332 | |||
| 333 | if (0 != $gid && $GLOBALS['songlistModuleConfig']['genre']) { |
||
| 334 | $criteria->add(new \Criteria('gids', '%"' . $gid . '"%', 'LIKE')); |
||
| 335 | } |
||
| 336 | |||
| 337 | if (0 != $vcid && $GLOBALS['songlistModuleConfig']['voice']) { |
||
| 338 | $criteria->add(new \Criteria('vcid', $vcid)); |
||
| 339 | } |
||
| 340 | |||
| 341 | if (0 != ($_GET['cid'] ?? $cid)) { |
||
| 342 | $criteria->add(new \Criteria('cid', ($_GET['cid'] ?? $cid))); |
||
| 343 | } |
||
| 344 | |||
| 345 | $pagenav = new \XoopsPageNav($songsHandler->getCount($criteria), $limit, $start, 'start', "op=$op&fct=$fct&gid=$gid&vcid=$vcid&value=$value&limit=$limit"); |
||
| 346 | |||
| 347 | $criteria->setLimit($limit); |
||
| 348 | $criteria->setStart($start); |
||
| 349 | |||
| 350 | $songs = $songsHandler->getObjects($criteria, false); |
||
| 351 | |||
| 352 | $GLOBALS['xoopsOption']['template_main'] = 'songlist_search_index.tpl'; |
||
| 353 | require $GLOBALS['xoops']->path('/header.php'); |
||
| 354 | if ($GLOBALS['songlistModuleConfig']['force_jquery'] && !isset($GLOBALS['loaded_jquery'])) { |
||
| 355 | $GLOBALS['xoTheme']->addScript(XOOPS_URL . _MI_SONGLIST_JQUERY, ['type' => 'text/javascript']); |
||
| 356 | $GLOBALS['loaded_jquery'] = true; |
||
| 357 | } |
||
| 358 | $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . _MI_SONGLIST_STYLESHEET, ['type' => 'text/css']); |
||
| 359 | $GLOBALS['xoopsTpl']->assign('xoConfig', $GLOBALS['songlistModuleConfig']); |
||
| 360 | $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['SCRIPT_NAME']); |
||
| 361 | foreach ($songs as $song) { |
||
| 362 | $GLOBALS['xoopsTpl']->append('results', $song->toArray(true)); |
||
| 363 | } |
||
| 364 | $GLOBALS['xoopsTpl']->assign('songs', true); |
||
| 365 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
||
| 366 | $GLOBALS['xoopsTpl']->assign('category_element', $category_element->render()); |
||
| 367 | $GLOBALS['xoopsTpl']->assign('genre_element', $genre_element->render()); |
||
| 368 | $GLOBALS['xoopsTpl']->assign('voice_element', $voice_element->render()); |
||
| 369 | $GLOBALS['xoopsTpl']->assign('cid', $_SESSION['cid']); |
||
| 370 | $GLOBALS['xoopsTpl']->assign('uri', $_SERVER['REQUEST_URI']); |
||
| 371 | require $GLOBALS['xoops']->path('/footer.php'); |
||
| 372 | break; |
||
| 373 | case 'category': |
||
| 374 | switch ($fct) { |
||
| 375 | default: |
||
| 376 | case 'set': |
||
| 377 | $_SESSION['cid'] = $id; |
||
| 378 | break; |
||
| 379 | case 'home': |
||
| 380 | unset($_SESSION['cid']); |
||
| 381 | break; |
||
| 382 | } |
||
| 383 | redirect_header($_SERVER['SCRIPT_NAME'] . "?op=item&fct=list&id=$id&value=$value&start=$start&limit=$limit&cid=" . $_SESSION['cid'], 10, _MD_SONGLIST_MSG_CATEGORYCHANGED); |
||
| 384 | } |
||
| 385 |
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: