Skip to content

Commit

Permalink
1.08 Beta 1
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Apr 9, 2018
1 parent c033c6f commit 067f1ff
Show file tree
Hide file tree
Showing 37 changed files with 183 additions and 275 deletions.
9 changes: 2 additions & 7 deletions admin/admin_footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,8 @@
* @since 1.0.6
*/

$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32);
$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32);

echo "<div class='adminfooter'>\n"
." <div style='text-align: center;'>\n"
." <a href='https://xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n"
." </div>\n"
.' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n"
.'</div>';
echo "<div class='adminfooter'>\n" . " <div style='text-align: center;'>\n" . " <a href='https://xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" . " </div>\n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . '</div>';

xoops_cp_footer();
4 changes: 2 additions & 2 deletions admin/admin_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
require_once __DIR__ . '/../include/common.php';

$moduleDirName = basename(dirname(__DIR__));
$helper = Xoopstube\Helper::getInstance();
$adminObject = Xmf\Module\Admin::getInstance();
$helper = Xoopstube\Helper::getInstance();
$adminObject = Xmf\Module\Admin::getInstance();

$pathIcon16 = Xmf\Module\Admin::iconUrl('', 16);
$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32);
Expand Down
2 changes: 1 addition & 1 deletion admin/altcat.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
$lid = Request::getInt('lid', Request::getInt('lid', 0, 'POST'), 'GET'); //cleanRequestVars($_REQUEST, 'lid', 0);

/**
* @param Xoopstube\Tree $xt
* @param Xoopstube\Tree $xt
* @param int $itemid
* @param $title
* @param $checks
Expand Down
2 changes: 1 addition & 1 deletion admin/blocksadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function listBlocks()
xoops_loadLanguage('admin/groups', 'system');

/** @var XoopsModuleHandler $moduleHandler */
$moduleHandler = xoops_getHandler('module');
$moduleHandler = xoops_getHandler('module');
/** @var \XoopsMemberHandler $memberHandler */
$memberHandler = xoops_getHandler('member');
/** @var \XoopsGroupPermHandler $grouppermHandler */
Expand Down
4 changes: 2 additions & 2 deletions admin/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ function createCategory($cid = 0)

/** @var \XoopsMemberHandler $memberHandler */
$memberHandler = xoops_getHandler('member');
$group_list = $memberHandler->getGroupList();
$group_list = $memberHandler->getGroupList();
$memberHandler = xoops_getHandler('member');
/** @var \XoopsGroupPermHandler $grouppermHandler */
$grouppermHandler = xoops_getHandler('groupperm');
$groups = $grouppermHandler->getGroupIds('XTubeCatPerm', $cid, $xoopsModule->getVar('mid'));
$groups = $grouppermHandler->getGroupIds('XTubeCatPerm', $cid, $xoopsModule->getVar('mid'));
} else {
$groups = true;
}
Expand Down
10 changes: 5 additions & 5 deletions admin/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,11 @@ function edit($lid = 0)
$updated = Request::getInt('was_published', time(), 'POST');

//PHP 5.3
// $temp = Request::getArray('published', [], 'POST');
// $published = strtotime($temp['date']) + $temp['time'];
// $temp = Request::getArray('published', [], 'POST');
// $published = strtotime($temp['date']) + $temp['time'];

// PHP 5.4
$published = strtotime(Request::getArray('published', [], 'POST')['date']) + Request::getArray('published', [], 'POST')['time'];
$published = strtotime(Request::getArray('published', [], 'POST')['date']) + Request::getArray('published', [], 'POST')['time'];

if (0 == Request::getInt('up_dated', '', 'POST')) {
$updated = 0;
Expand All @@ -329,7 +329,7 @@ function edit($lid = 0)
$publishdate = time();
}
// if (Request::hasVar('expiredateactivate', 'POST')) {
$expiredate = strtotime(Request::getArray('expired', [], 'POST')['date']) + Request::getArray('expired', [], 'POST')['time'];
$expiredate = strtotime(Request::getArray('expired', [], 'POST')['date']) + Request::getArray('expired', [], 'POST')['time'];
// }

if (Request::hasVar('clearexpire', 'POST')) {
Expand All @@ -345,7 +345,7 @@ function edit($lid = 0)
. $GLOBALS['xoopsDB']->prefix('xoopstube_videos')
. ' (lid, cid, title, vidid, screenshot, submitter, publisher, status, date, hits, rating, votes, comments, vidsource, published, expired, updated, offline, description, ipaddress, notifypub, vidrating, time, keywords, item_tag, picurl )';
$sql .= " VALUES (NULL, $cid, '$title', '$vidid', '', '$submitter', '$publisher', '$status', '$date', 0, 0, 0, 0, '$vidsource', '$published', '$expiredate', '$updated', '$offline', '$descriptionb', '$ipaddress', '0', '$vidrating', '$time', '$keywords', '$item_tag', '$picurl')";
// $newid = $GLOBALS['xoopsDB'] -> getInsertId();
// $newid = $GLOBALS['xoopsDB'] -> getInsertId();
} else {
$sql = 'UPDATE '
. $GLOBALS['xoopsDB']->prefix('xoopstube_videos')
Expand Down
3 changes: 1 addition & 2 deletions admin/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@
//require_once __DIR__ . '/../include/common.php';
$helper = Xoopstube\Helper::getInstance();

$pathIcon32 = \Xmf\Module\Admin::menuIconPath('');
$pathIcon32 = \Xmf\Module\Admin::menuIconPath('');
$pathModIcon32 = $helper->getModule()->getInfo('modicons32');


$adminmenu[] = [
'title' => _MI_XOOPSTUBE_HOME,
'link' => 'admin/index.php',
Expand Down
8 changes: 4 additions & 4 deletions blocks/xoopstube_block_tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
function xtubeShowTagBlockCloud($options)
{
$moduleDirName = basename(dirname(__DIR__));
// require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/class/Utility.php';
// require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/class/Utility.php';
if (Xoopstube\Utility::isModuleTagInstalled()) {
require_once XOOPS_ROOT_PATH . '/modules/tag/blocks/block.php';

Expand All @@ -48,7 +48,7 @@ function xtubeShowTagBlockCloud($options)
function xtubeEditTagBlockCloud($options)
{
$moduleDirName = basename(dirname(__DIR__));
// require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/class/Utility.php';
// require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/class/Utility.php';
if (Xoopstube\Utility::isModuleTagInstalled()) {
require_once XOOPS_ROOT_PATH . '/modules/tag/blocks/block.php';

Expand All @@ -66,7 +66,7 @@ function xtubeEditTagBlockCloud($options)
function xtubeShowTagBlockTop($options)
{
$moduleDirName = basename(dirname(__DIR__));
// require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/class/Utility.php';
// require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/class/Utility.php';
if (Xoopstube\Utility::isModuleTagInstalled()) {
require_once XOOPS_ROOT_PATH . '/modules/tag/blocks/block.php';

Expand All @@ -84,7 +84,7 @@ function xtubeShowTagBlockTop($options)
function xtubeEditTagBlockTop($options)
{
$moduleDirName = basename(dirname(__DIR__));
// require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/class/Utility.php';
// require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/class/Utility.php';
if (Xoopstube\Utility::isModuleTagInstalled()) {
require_once XOOPS_ROOT_PATH . '/modules/tag/blocks/block.php';

Expand Down
20 changes: 10 additions & 10 deletions blocks/xoopstube_top.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
*/
function checkBlockGroups($cid = 0, $permType = 'XTubeCatPerm', $redirect = false)
{
$moduleDirName = basename(dirname(__DIR__));
$groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
$grouppermHandler = xoops_getHandler('groupperm');
$moduleDirName = basename(dirname(__DIR__));
$groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
$grouppermHandler = xoops_getHandler('groupperm');
/** @var XoopsModuleHandler $moduleHandler */
$moduleHandler = xoops_getHandler('module');
$module = $moduleHandler->getByDirname($moduleDirName);
Expand Down Expand Up @@ -58,9 +58,9 @@ function xtubeCheckBlockGroups($cid = 0, $permType = 'XTubeCatPerm', $redirect =
$moduleDirName = basename(dirname(__DIR__));
$groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
/** @var XoopsModuleHandler $moduleHandler */
$moduleHandler = xoops_getHandler('module');
$xtubeModule = $moduleHandler->getByDirname($moduleDirName);
$grouppermHandler = xoops_getHandler('groupperm');
$moduleHandler = xoops_getHandler('module');
$xtubeModule = $moduleHandler->getByDirname($moduleDirName);
$grouppermHandler = xoops_getHandler('groupperm');
if (!$grouppermHandler->checkRight($permType, $cid, $groups, $xtubeModule->getVar('mid'))) {
if (false === $redirect) {
return false;
Expand Down Expand Up @@ -262,7 +262,7 @@ function showTopVideoBlock($options)
}

require_once XOOPS_ROOT_PATH . '/modules/' . $xtubeModule->getVar('dirname') . '/include/video.php';
// require_once XOOPS_ROOT_PATH . '/modules/' . $xtubeModule->getVar('dirname') . '/class/Utility.php';
// require_once XOOPS_ROOT_PATH . '/modules/' . $xtubeModule->getVar('dirname') . '/class/Utility.php';

while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) {
if (false === checkBlockGroups($myrow['cid']) || 0 == $myrow['cid']) {
Expand Down Expand Up @@ -309,7 +309,7 @@ function showTopVideoBlock($options)
function getRandomVideo($options)
{
global $xtubemyts;
$utility = new Xoopstube\Utility();
$utility = new Xoopstube\Utility();
$moduleDirName = basename(dirname(__DIR__));
$block = [];
/** @var XoopsModuleHandler $moduleHandler */
Expand All @@ -335,7 +335,7 @@ function getRandomVideo($options)
}

require_once XOOPS_ROOT_PATH . '/modules/' . $xtubeModule->getVar('dirname') . '/include/video.php';
// require_once XOOPS_ROOT_PATH . '/modules/' . $xtubeModule->getVar('dirname') . '/class/Utility.php';
// require_once XOOPS_ROOT_PATH . '/modules/' . $xtubeModule->getVar('dirname') . '/class/Utility.php';

while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result2))) {
if (false === checkBlockGroups($myrow['cid']) || 0 == $myrow['cid']) {
Expand Down Expand Up @@ -399,7 +399,7 @@ function getRandomVideoForHorizontalBlock($options)
}

require_once XOOPS_ROOT_PATH . '/modules/' . $xtubeModule->getVar('dirname') . '/include/video.php';
// require_once XOOPS_ROOT_PATH . '/modules/' . $xtubeModule->getVar('dirname') . '/class/Utility.php';
// require_once XOOPS_ROOT_PATH . '/modules/' . $xtubeModule->getVar('dirname') . '/class/Utility.php';

while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result2))) {
if (false === checkBlockGroups($myrow['cid']) || 0 == $myrow['cid']) {
Expand Down
14 changes: 2 additions & 12 deletions brokenvideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,8 @@
redirect_header('singlevideo.php?cid=' . (int)$cid . '&amp;lid=' . $lid, 2, $ratemessage);
} else {
$reportid = 0;
$sql = sprintf(
'INSERT INTO `%s` (reportid, lid, sender, ip, date, confirmed, acknowledged, title ) VALUES ( %u, %u, %u, %s, %u, %u, %u, %s)',
$GLOBALS['xoopsDB']->prefix('xoopstube_broken'),
$reportid,
$lid,
$sender,
$GLOBALS['xoopsDB']->quoteString($ip),
$time,
0,
0,
$GLOBALS['xoopsDB']->quoteString($title)
);
$sql = sprintf('INSERT INTO `%s` (reportid, lid, sender, ip, date, confirmed, acknowledged, title ) VALUES ( %u, %u, %u, %s, %u, %u, %u, %s)', $GLOBALS['xoopsDB']->prefix('xoopstube_broken'), $reportid, $lid, $sender, $GLOBALS['xoopsDB']->quoteString($ip), $time, 0, 0,
$GLOBALS['xoopsDB']->quoteString($title));
if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
$error[] = _MD_XOOPSTUBE_ERROR;
}
Expand Down
2 changes: 1 addition & 1 deletion class/Common/Breadcrumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
class Breadcrumb
{
public $dirname;
public $dirname;
private $bread = [];

/**
Expand Down
3 changes: 2 additions & 1 deletion class/Common/FilesManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public static function createFolder($folder)

file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
}
} catch (\Exception $e) {
}
catch (\Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
}
}
Expand Down
49 changes: 23 additions & 26 deletions class/Common/LetterChoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ class LetterChoice
*
* @param \XoopsPersistableObjectHandler $objHandler {@link XoopsPersistableObjectHandler}
* @param \CriteriaElement $criteria {@link CriteriaElement}
* @param string $field_name search by field
* @param array $alphabet array of alphabet letters
* @param string $arg_name item on the current page
* @param string $url
* @param string $extra_arg Additional arguments to pass in the URL
* @param boolean $caseSensitive
* @param string $field_name search by field
* @param array $alphabet array of alphabet letters
* @param string $arg_name item on the current page
* @param string $url
* @param string $extra_arg Additional arguments to pass in the URL
* @param boolean $caseSensitive
*/
public function __construct(
$objHandler,
Expand All @@ -77,17 +77,17 @@ public function __construct(
$arg_name = 'letter',
$url = null,
$extra_arg = '',
$caseSensitive = false
) {
$this->helper = Xoopstube\Helper::getInstance();
$this->objHandler = $objHandler;
$this->criteria = null === $criteria ? new \CriteriaCompo() : $criteria;
$this->field_name = null === $field_name ? $this->objHandler->identifierName : $field_name;
// $this->alphabet = (count($alphabet) > 0) ? $alphabet : range('a', 'z'); // is there a way to get locale alphabet?
// $this->alphabet = getLocalAlphabet();
$this->alphabet = include __DIR__ . '/../../language/'.$GLOBALS['xoopsConfig']['language'] .'/alphabet.php';
$this->arg_name = $arg_name;
$this->url = null === $url ? $_SERVER['PHP_SELF'] : $url;
$caseSensitive = false)
{
$this->helper = Xoopstube\Helper::getInstance();
$this->objHandler = $objHandler;
$this->criteria = null === $criteria ? new \CriteriaCompo() : $criteria;
$this->field_name = null === $field_name ? $this->objHandler->identifierName : $field_name;
// $this->alphabet = (count($alphabet) > 0) ? $alphabet : range('a', 'z'); // is there a way to get locale alphabet?
// $this->alphabet = getLocalAlphabet();
$this->alphabet = include __DIR__ . '/../../language/' . $GLOBALS['xoopsConfig']['language'] . '/alphabet.php';
$this->arg_name = $arg_name;
$this->url = null === $url ? $_SERVER['PHP_SELF'] : $url;
if ('' !== $extra_arg && ('&amp;' !== substr($extra_arg, -5) || '&' !== substr($extra_arg, -1))) {
$this->extra = '&amp;' . $extra_arg;
}
Expand All @@ -103,14 +103,13 @@ public function __construct(
*/
public function render($alphaCount = null, $howmanyother = null)
{
$moduleDirName = basename(dirname(dirname(__DIR__)));
$moduleDirName = basename(dirname(dirname(__DIR__)));
$moduleDirNameUpper = strtoupper($moduleDirName);
xoops_loadLanguage('common', $moduleDirName);
xoops_loadLanguage('alphabet', $moduleDirName);
$all = constant('CO_' . $moduleDirNameUpper . '_ALL');
$all = constant('CO_' . $moduleDirNameUpper . '_ALL');
$other = constant('CO_' . $moduleDirNameUpper . '_OTHER');


$ret = '';
//
if (!$this->caseSensitive) {
Expand All @@ -121,15 +120,14 @@ public function render($alphaCount = null, $howmanyother = null)
$countsByLetters = $this->objHandler->getCounts($this->criteria);
// fill alphabet array
$alphabetArray = [];
$letter_array = [];
$letter_array = [];

$letter = 'All';
$letter = 'All';
$letter_array['letter'] = $all;
$letter_array['count'] = $alphaCount;
$letter_array['url'] = $this->url ;
$letter_array['url'] = $this->url;
$alphabetArray[$letter] = $letter_array;


foreach ($this->alphabet as $letter) {
$letter_array = [];
if (!$this->caseSensitive) {
Expand Down Expand Up @@ -157,10 +155,9 @@ public function render($alphaCount = null, $howmanyother = null)
unset($letter_array);
}


$letter_array['letter'] = $other;
$letter_array['count'] = $howmanyother;
$letter_array['url'] = $this->url. '?init=Other' ;
$letter_array['url'] = $this->url . '?init=Other';
$alphabetArray[$letter] = $letter_array;

// render output
Expand Down
6 changes: 3 additions & 3 deletions class/Common/VersionChecks.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ trait VersionChecks
* @static
* @param \XoopsModule $module
*
* @param null|string $requiredVer
* @param null|string $requiredVer
* @return bool true if meets requirements, false if not
*/
public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null)
Expand All @@ -39,10 +39,10 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer =
if (null === $requiredVer) {
$requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
}
$success = true;
$success = true;

if (version_compare($currentVer, $requiredVer, '<')) {
$success = false;
$success = false;
$module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer));
}

Expand Down
8 changes: 4 additions & 4 deletions class/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @package
* @since
* @author XOOPS Development Team
* @author XOOPS Development Team
*/

defined('XOOPS_ROOT_PATH') || die('Restricted access');
Expand All @@ -28,14 +28,14 @@ class Helper extends \Xmf\Module\Helper
public $debug;

/**
*
*
* @param bool $debug
*/
public function __construct($debug = false)
{
$this->debug = $debug;
$moduleDirName = basename(dirname(__DIR__));
parent::__construct($moduleDirName);
$moduleDirName = basename(dirname(__DIR__));
parent::__construct($moduleDirName);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions class/Lists.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public function __construct(
$emptyselect = 0,
$type = 0,
$prefix = '',
$suffix = ''
) {
$suffix = '')
{
$this->value = $value;
$this->selection = $selected;
$this->path = $path;
Expand Down
Loading

0 comments on commit 067f1ff

Please sign in to comment.