1
|
|
|
<?php
|
2
|
|
|
|
3
|
|
|
declare(strict_types=1);
|
4
|
|
|
|
5
|
|
|
/*
|
6
|
|
|
You may not change or alter any portion of this comment or credits
|
7
|
|
|
of supporting developers from this source code or any supporting source code
|
8
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors.
|
9
|
|
|
|
10
|
|
|
This program is distributed in the hope that it will be useful,
|
11
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
13
|
|
|
*/
|
14
|
|
|
|
15
|
|
|
/**
|
16
|
|
|
* wgFileManager module for xoops
|
17
|
|
|
*
|
18
|
|
|
* @copyright 2021 XOOPS Project (https://xoops.org)
|
19
|
|
|
* @license GPL 2.0 or later
|
20
|
|
|
* @package wgfilemanager
|
21
|
|
|
* @author Goffy - Wedega - Email:[email protected] - Website:https://xoops.wedega.com
|
22
|
|
|
*/
|
23
|
|
|
|
24
|
|
|
use Xmf\Request;
|
|
|
|
|
25
|
|
|
use XoopsModules\Wgfilemanager;
|
26
|
|
|
use XoopsModules\Wgfilemanager\Constants;
|
27
|
|
|
|
28
|
|
|
require __DIR__ . '/header.php';
|
29
|
|
|
|
30
|
|
|
// Define Stylesheet
|
31
|
|
|
$GLOBALS['xoTheme']->addStylesheet($style, null);
|
32
|
|
|
$templateMain = 'wgfilemanager_admin_broken.tpl';
|
33
|
|
|
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('broken.php'));
|
34
|
|
|
|
35
|
|
|
// Check table file
|
36
|
|
|
$start = Request::getInt('startFile');
|
37
|
|
|
$limit = Request::getInt('limitFile', $helper->getConfig('adminpager'));
|
38
|
|
|
$crFile = new \CriteriaCompo();
|
39
|
|
|
$crFile->add(new \Criteria('status', Constants::STATUS_BROKEN));
|
40
|
|
|
$fileCount = $fileHandler->getCount($crFile);
|
41
|
|
|
$GLOBALS['xoopsTpl']->assign('file_count', $fileCount);
|
42
|
|
|
$GLOBALS['xoopsTpl']->assign('file_result', \sprintf(\_AM_WGFILEMANAGER_BROKEN_RESULT, 'File'));
|
43
|
|
|
$crFile->setStart($start);
|
44
|
|
|
$crFile->setLimit($limit);
|
45
|
|
|
if ($fileCount > 0) {
|
46
|
|
|
$fileAll = $fileHandler->getAll($crFile);
|
47
|
|
|
foreach (\array_keys($fileAll) as $i) {
|
48
|
|
|
$file = [];
|
49
|
|
|
$file['table'] = 'File';
|
50
|
|
|
$file['key'] = 'id';
|
51
|
|
|
$file['keyval'] = $fileAll[$i]->getVar('id');
|
52
|
|
|
$file['main'] = $fileAll[$i]->getVar('name');
|
53
|
|
|
$GLOBALS['xoopsTpl']->append('file_list', $file);
|
54
|
|
|
unset($file);
|
55
|
|
|
}
|
56
|
|
|
// Display Navigation
|
57
|
|
|
if ($fileCount > $limit) {
|
58
|
|
|
require_once \XOOPS_ROOT_PATH . '/class/pagenav.php';
|
59
|
|
|
$pagenav = new \XoopsPageNav($fileCount, $limit, $start, 'startFile', 'op=list&limitFile=' . $limit);
|
60
|
|
|
$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
|
61
|
|
|
}
|
62
|
|
|
} else {
|
63
|
|
|
$GLOBALS['xoopsTpl']->assign('nodataFile', \sprintf(\_AM_WGFILEMANAGER_BROKEN_NODATA, 'File'));
|
64
|
|
|
}
|
65
|
|
|
unset($crFile);
|
66
|
|
|
|
67
|
|
|
require __DIR__ . '/footer.php';
|
68
|
|
|
|
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: