1
|
|
|
<?php |
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
|
|
|
* Module: randomquote |
15
|
|
|
* |
16
|
|
|
* @category Module |
17
|
|
|
* @package randomquote |
18
|
|
|
* @author XOOPS Development Team <[email protected]> - <https://xoops.org> |
19
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
20
|
|
|
* @license GPL 2.0 or later |
21
|
|
|
* @link https://xoops.org/ |
22
|
|
|
* @since 1.0.0 |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
use Xmf\Request; |
26
|
|
|
use Xoopsmodules\randomquote; |
|
|
|
|
27
|
|
|
|
28
|
|
|
$GLOBALS['xoopsOption']['template_main'] = 'randomquote_quotes_list.tpl'; |
29
|
|
|
require_once __DIR__ . '/header.php'; |
30
|
|
|
//require_once __DIR__ . '/include/common.php'; |
31
|
|
|
|
32
|
|
|
$start = Request::getInt('start', 0); |
33
|
|
|
$criteria = new CriteriaCompo(); |
34
|
|
|
|
35
|
|
|
$criteria->setOrder('DESC'); |
36
|
|
|
$criteria->setLimit($quotesPaginationLimit); |
37
|
|
|
$criteria->setStart($start); |
38
|
|
|
|
39
|
|
|
$quotesCount = $quotesHandler->getCount($criteria); |
40
|
|
|
$quotesArray = $quotesHandler->getAll($criteria); |
41
|
|
|
if ($quotesCount > 0) { |
42
|
|
|
foreach (array_keys($quotesArray) as $i) { |
43
|
|
|
$quotes['id'] = $quotesArray[$i]->getVar('id'); |
44
|
|
|
$quotes['quote'] = $quotesArray[$i]->getVar('quote'); |
45
|
|
|
$quotes['author'] = $quotesArray[$i]->getVar('author'); |
46
|
|
|
$quotes['online'] = $quotesArray[$i]->getVar('online'); |
47
|
|
|
$quotes['created'] = date(_SHORTDATESTRING, strtotime($quotesArray[$i]->getVar('created'))); |
48
|
|
|
|
49
|
|
|
$quotes['cid'] = $categoryHandler->get($quotesArray[$i]->getVar('cid'))->getVar('title'); |
50
|
|
|
$GLOBALS['xoopsTpl']->append('quotes', $quotes); |
51
|
|
|
$keywords[] = $quotesArray[$i]->getVar('quote'); |
52
|
|
|
unset($quotes); |
53
|
|
|
} |
54
|
|
|
// Display Navigation |
55
|
|
View Code Duplication |
if ($quotesCount > $quotesPaginationLimit) { |
|
|
|
|
56
|
|
|
require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
57
|
|
|
$pagenav = new \XoopsPageNav($quotesCount, $quotesPaginationLimit, $start, 'start'); |
58
|
|
|
$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
//keywords |
62
|
|
View Code Duplication |
if (isset($keywords)) { |
|
|
|
|
63
|
|
|
$utility::meta_keywords(xoops_getModuleOption('keywords', $moduleDirName) . ', ' . implode(', ', $keywords)); |
64
|
|
|
} |
65
|
|
|
//description |
66
|
|
|
$utility::meta_description(MD_RANDOMQUOTE_QUOTES_DESC); |
67
|
|
|
// |
68
|
|
|
$GLOBALS['xoopsTpl']->assign('xoops_mpageurl', RANDOMQUOTE_URL . '/quotes.php'); |
69
|
|
|
$GLOBALS['xoopsTpl']->assign('randomquote_url', RANDOMQUOTE_URL); |
70
|
|
|
$GLOBALS['xoopsTpl']->assign('adv', xoops_getModuleOption('advertise', $moduleDirName)); |
71
|
|
|
// |
72
|
|
|
$GLOBALS['xoopsTpl']->assign('bookmarks', xoops_getModuleOption('bookmarks', $moduleDirName)); |
73
|
|
|
$GLOBALS['xoopsTpl']->assign('fbcomments', xoops_getModuleOption('fbcomments', $moduleDirName)); |
74
|
|
|
// |
75
|
|
|
$GLOBALS['xoopsTpl']->assign('admin', MD_RANDOMQUOTE_ADMIN); |
76
|
|
|
//$GLOBALS['xoopsTpl']->assign('copyright', $copyright); |
77
|
|
|
// |
78
|
|
|
require_once XOOPS_ROOT_PATH . '/footer.php'; |
79
|
|
|
|
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are 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.php
However, as
OtherDir/Foo.php
does 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: