1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
/* |
3
|
|
|
You may not change or alter any portion of this comment or credits |
4
|
|
|
of supporting developers from this source code or any supporting source code |
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
6
|
|
|
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @category Module |
14
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
15
|
|
|
* @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
16
|
|
|
* @author Marcello Brandão aka Suico, Mamba, LioMJ <https://xoops.org> |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
use Xmf\Request; |
|
|
|
|
20
|
|
|
use XoopsModules\Suico\{ |
21
|
|
|
VideoController |
22
|
|
|
}; |
23
|
|
|
|
24
|
|
|
$GLOBALS['xoopsOption']['template_main'] = 'suico_videos.tpl'; |
25
|
|
|
require __DIR__ . '/header.php'; |
26
|
|
|
$controller = new VideoController($xoopsDB, $xoopsUser); |
27
|
|
|
/** |
28
|
|
|
* Fetching numbers of groups friends videos pictures etc... |
29
|
|
|
*/ |
30
|
|
|
$nbSections = $controller->getNumbersSections(); |
31
|
|
|
$start = Request::getInt('start', 0, 'GET'); |
32
|
|
|
/** |
33
|
|
|
* Criteria for Videos |
34
|
|
|
*/ |
35
|
|
|
$criteriaUidVideo = new Criteria('uid_owner', $controller->uidOwner); |
36
|
|
|
$criteriaUidVideo->setStart($start); |
37
|
|
|
$criteriaUidVideo->setLimit($helper->getConfig('videosperpage')); |
38
|
|
|
/** |
39
|
|
|
* Get all videos of this user and assign them to template |
40
|
|
|
*/ |
41
|
|
|
$videos = $controller->getVideos($criteriaUidVideo); |
42
|
|
|
$videosArray = []; |
43
|
|
|
$pageNav = ''; |
44
|
|
|
if (isset($nbSections['countVideos'])) { |
45
|
|
|
$videosArray = $controller->assignVideoContent($nbSections['countVideos'], $videos); |
46
|
|
|
} |
47
|
|
|
if (is_array($videosArray)) { |
48
|
|
|
$xoopsTpl->assign('videos', $videosArray); |
49
|
|
|
} else { |
50
|
|
|
$xoopsTpl->assign('lang_novideoyet', _MD_SUICO_NOVIDEOSYET); |
51
|
|
|
} |
52
|
|
|
$xoopsTpl->assign('lang_selectfeaturedvideo', _MD_SUICO_SELECTFEATUREDVIDEO); |
53
|
|
|
if (isset($nbSections['countVideos']) && $nbSections['countVideos'] > 0) { |
54
|
|
|
$pageNav = $controller->videosNavBar($nbSections['countVideos'], $helper->getConfig('videosperpage'), $start, 2); |
55
|
|
|
} |
56
|
|
|
//form actions |
57
|
|
|
$xoopsTpl->assign('lang_delete', _MD_SUICO_DELETE); |
58
|
|
|
$xoopsTpl->assign('lang_editvideo', _MD_SUICO_EDIT_VIDEO); |
59
|
|
|
$xoopsTpl->assign('lang_featurethisvideo', _MD_SUICO_FEATURETHISVIDEO); |
60
|
|
|
//FORM SUBMIT |
61
|
|
|
$xoopsTpl->assign('lang_addvideos', _MD_SUICO_ADDFAVORITEVIDEOS); |
62
|
|
|
$xoopsTpl->assign('lang_youtubecodeLabel', _MD_SUICO_YOUTUBECODE); |
63
|
|
|
$xoopsTpl->assign('lang_captionLabel', _MD_SUICO_CAPTION); |
64
|
|
|
$xoopsTpl->assign('lang_submitValue', _MD_SUICO_ADDVIDEO); |
65
|
|
|
$xoopsTpl->assign('width', $helper->getConfig('width_tube')); |
66
|
|
|
$xoopsTpl->assign('height', $helper->getConfig('height_tube')); |
67
|
|
|
$xoopsTpl->assign('lang_videohelp', _MD_SUICO_ADDVIDEOSHELP); |
68
|
|
|
$xoopsTpl->assign('lang_mysection', _MD_SUICO_MYVIDEOS); |
69
|
|
|
$xoopsTpl->assign('section_name', _MD_SUICO_VIDEOS); |
70
|
|
|
//Navigation |
71
|
|
|
$xoopsTpl->assign('pageNav', $pageNav); |
72
|
|
|
require __DIR__ . '/footer.php'; |
73
|
|
|
require \dirname(__DIR__, 2) . '/footer.php'; |
74
|
|
|
|
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: