Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Aug 1, 2018
1 parent fd264b6 commit 6f22aa9
Show file tree
Hide file tree
Showing 20 changed files with 62 additions and 56 deletions.
16 changes: 8 additions & 8 deletions admin/blocksadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function listBlocks()
require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
$moduleDirName = basename(dirname(__DIR__));
$moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName
$db = \XoopsDatabaseFactory::getDatabaseConnection();
$db = \XoopsDatabaseFactory::getDatabaseConnection();
xoops_loadLanguage('admin', 'system');
xoops_loadLanguage('admin/blocksadmin', 'system');
xoops_loadLanguage('admin/groups', 'system');
Expand Down Expand Up @@ -332,13 +332,13 @@ function cloneBlock($bid)
}

/**
* @param int $bid
* @param string $bside
* @param int $bweight
* @param bool $bvisible
* @param int $bcachetime
* @param array $bmodule
* @param null|array $options
* @param int $bid
* @param string $bside
* @param int $bweight
* @param bool $bvisible
* @param int $bcachetime
* @param array $bmodule
* @param null|array|string $options
*/
function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options = null)
{
Expand Down
2 changes: 1 addition & 1 deletion admin/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
}

$itemid = Request::getInt('itemid', Request::getInt('itemid', 0, 'POST'), 'GET');
$op = ($itemid > 0 || Request::getString('editor', '', 'POST')) ? 'mod' : '';
$op = ($itemid > 0 || Request::getString('editor', '', 'POST')) ? 'mod' : '';
//$op = Request::getString('op', $op, 'GET');

$op = Request::getString('op', Request::getString('op', $op, 'POST'), 'GET');
Expand Down
2 changes: 1 addition & 1 deletion archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@

if (!($itemsCount > 0)) {
redirect_header(XOOPS_URL, 2, _MD_PUBLISHER_NO_TOP_PERMISSIONS);
//mb exit;
//mb exit;
} else {
$years = [];
$months = [];
Expand Down
4 changes: 2 additions & 2 deletions blocks/date_to_date.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ function publisher_date_to_date_show($options)
$criteria->setOrder('DESC');

// creating the ITEM objects that belong to the selected category
$itemsObj = $helper->getHandler('Item')->getObjects($criteria);
// $totalItems = count($itemsObj);
$itemsObj = $helper->getHandler('Item')->getObjects($criteria);
// $totalItems = count($itemsObj);

if (is_array($itemsObj) && count($itemsObj) > 0) {
foreach ($itemsObj as $iValue) {
Expand Down
8 changes: 4 additions & 4 deletions class/BaseObjectHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public function insert(\XoopsObject $obj, $force = false)// insert($obj, $force
/**
* Create a "select" SQL query
*
* @param \CriteriaElement $criteria {@link \CriteriaElement} to match
* @param \CriteriaElement|\CriteriaCompo $criteria {@link \CriteriaElement} to match
*
* @return string SQL query
*/
Expand All @@ -218,7 +218,7 @@ private function selectQuery(\CriteriaElement $criteria = null)
/**
* count objects matching a criteria
*
* @param \CriteriaElement $criteria {@link CriteriaElement}
* @param \CriteriaElement|\CriteriaCompo $criteria {@link CriteriaElement}
* to match
*
* @return int count of objects
Expand Down Expand Up @@ -267,7 +267,7 @@ public function delete(\XoopsObject $obj, $force = false) //delete($obj, $force
/**
* delete department matching a set of conditions
*
* @param \CriteriaElement $criteria {@link CriteriaElement}
* @param \CriteriaElement|\CriteriaCompo $criteria {@link CriteriaElement}
*
* @param bool $force
* @param bool $asObject
Expand All @@ -291,7 +291,7 @@ public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asO
*
* @param string $fieldname
* @param string $fieldvalue
* @param \CriteriaElement $criteria {@link \CriteriaElement}
* @param \CriteriaElement|\CriteriaCompo $criteria {@link \CriteriaElement}
*
* @param bool $force
* @return bool FALSE if update failed
Expand Down
1 change: 1 addition & 0 deletions class/BlockForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* @since 1.0
* @author trabis <[email protected]>
*/

use XoopsModules\Publisher;

// defined('XOOPS_ROOT_PATH') || die('Restricted access');
Expand Down
4 changes: 3 additions & 1 deletion class/Cloner.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
namespace XoopsModules\Publisher;

use XoopsModules\Publisher;

/**
* Class Cloner
*/
class Cloner {
class Cloner
{
// recursive cloning script
/**
* @param $path
Expand Down
4 changes: 2 additions & 2 deletions class/Common/Breadcrumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/
class Breadcrumb
{
public $dirname;
public $dirname;
private $bread = [];

public function __construct()
Expand All @@ -50,7 +50,7 @@ public function __construct()
public function addLink($title = '', $link = '')
{
$this->bread[] = [
'link' => $link,
'link' => $link,
'title' => $title,
];
}
Expand Down
28 changes: 15 additions & 13 deletions class/Common/Configurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

/**
* Configurator Class
*
Expand All @@ -20,6 +21,7 @@
* @package Publisher
* @since 1.05
*/

use XoopsModules\Publisher;

/**
Expand All @@ -28,13 +30,13 @@
class Configurator
{
public $name;
public $paths = [];
public $uploadFolders = [];
public $copyBlankFiles = [];
public $paths = [];
public $uploadFolders = [];
public $copyBlankFiles = [];
public $copyTestFolders = [];
public $templateFolders = [];
public $oldFiles = [];
public $oldFolders = [];
public $oldFiles = [];
public $oldFolders = [];
public $modCopyright;

/**
Expand All @@ -43,19 +45,19 @@ class Configurator
public function __construct()
{
$moduleDirName = basename(dirname(dirname(__DIR__)));
$capsDirName = mb_strtoupper($moduleDirName);
$capsDirName = mb_strtoupper($moduleDirName);

require dirname(dirname(__DIR__)) . '/include/config.php';
$config = getConfig();

$this->name = $config->name;
$this->paths = $config->paths;
$this->uploadFolders = $config->uploadFolders;
$this->copyBlankFiles = $config->copyBlankFiles;
$this->name = $config->name;
$this->paths = $config->paths;
$this->uploadFolders = $config->uploadFolders;
$this->copyBlankFiles = $config->copyBlankFiles;
$this->copyTestFolders = $config->copyTestFolders;
$this->templateFolders = $config->templateFolders;
$this->oldFiles = $config->oldFiles;
$this->oldFolders = $config->oldFolders;
$this->modCopyright = $config->modCopyright;
$this->oldFiles = $config->oldFiles;
$this->oldFolders = $config->oldFolders;
$this->modCopyright = $config->modCopyright;
}
}
6 changes: 3 additions & 3 deletions class/Common/ServerStats.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ trait ServerStats
public static function getServerStats()
{
//mb $wfdownloads = WfdownloadsWfdownloads::getInstance();
$moduleDirName = basename(dirname(dirname(__DIR__)));
$moduleDirName = basename(dirname(dirname(__DIR__)));
$moduleDirNameUpper = mb_strtoupper($moduleDirName);
xoops_loadLanguage('common', $moduleDirName);
$html = '';
Expand All @@ -50,7 +50,7 @@ public static function getServerStats()
$html .= '<ul>';

$gdlib = function_exists('gd_info') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
if (function_exists('gd_info')) {
if (true === ($gdlib = gd_info())) {
$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
Expand All @@ -64,7 +64,7 @@ public static function getServerStats()
// $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals;

$downloads = ini_get('file_uploads') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>';
$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;
$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;

$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . ini_get('upload_max_filesize') . '</span></b>';
$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . ini_get('post_max_size') . '</span></b>';
Expand Down
10 changes: 5 additions & 5 deletions class/Common/VersionChecks.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ 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)
{
$moduleDirName = basename(dirname(dirname(__DIR__)));
$moduleDirName = basename(dirname(dirname(__DIR__)));
$moduleDirNameUpper = mb_strtoupper($moduleDirName);
if (null === $module) {
$module = \XoopsModule::getByDirname($moduleDirName);
Expand Down Expand Up @@ -60,13 +60,13 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer =
*/
public static function checkVerPhp(\XoopsModule $module)
{
$moduleDirName = basename(dirname(dirname(__DIR__)));
$moduleDirName = basename(dirname(dirname(__DIR__)));
$moduleDirNameUpper = mb_strtoupper($moduleDirName);
xoops_loadLanguage('admin', $module->dirname());
// check for minimum PHP version
$success = true;
$verNum = PHP_VERSION;
$reqVer = $module->getInfo('min_php');
$verNum = PHP_VERSION;
$reqVer = $module->getInfo('min_php');
if (false !== $reqVer && '' !== $reqVer) {
if (version_compare($verNum, $reqVer, '<')) {
$module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum));
Expand Down
6 changes: 3 additions & 3 deletions class/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ public function updateCounter()
*/
public function displayFlash()
{
// if (!defined('MYTEXTSANITIZER_EXTENDED_MEDIA')) {
// require_once PUBLISHER_ROOT_PATH . '/include/media.textsanitizer.php';
// }
// if (!defined('MYTEXTSANITIZER_EXTENDED_MEDIA')) {
// require_once PUBLISHER_ROOT_PATH . '/include/media.textsanitizer.php';
// }
$mediaTs = Publisher\MyTextSanitizerExtension::getInstance();

return $mediaTs->displayFlash($this->getFileUrl());
Expand Down
2 changes: 1 addition & 1 deletion class/FormDateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class FormDateTime extends \XoopsFormElementTray
* @param $caption
* @param $name
* @param int $size
* @param int $value
* @param int|bool $value
* @param bool $showtime
* @param bool $formatTimestamp
*/
Expand Down
2 changes: 1 addition & 1 deletion class/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function getTitle($maxLength = 0, $format = 'S')
if (0 != $maxLength) {
if (!XOOPS_USE_MULTIBYTES) {
if (mb_strlen($ret) >= $maxLength) {
$ret = Publisher\Utility::mb_substr($ret, 0, $maxLength);
$ret = Publisher\Utility::substr($ret, 0, $maxLength);
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions class/ItemHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ public function delete(\XoopsObject $item, $force = false)
/**
* retrieve items from the database
*
* @param \CriteriaElement $criteria {@link CriteriaElement}
* @param \CriteriaElement|\CriteriaCompo $criteria {@link CriteriaElement}
* conditions to be met
* @param bool|string $idKey what shall we use as array key ? none, itemid, categoryid
* @param bool $as_object
* @param string $notNullFields
* @param string|bool $notNullFields
* @return array array of <a href='psi_element://Item'>Item</a> objects
* objects
*/
Expand Down Expand Up @@ -221,7 +221,7 @@ public function &getObjects(\CriteriaElement $criteria = null, $idKey = 'none',
/**
* count items matching a condition
*
* @param \CriteriaElement $criteria {@link CriteriaElement}
* @param \CriteriaElement|\CriteriaCompo $criteria {@link CriteriaElement}
* to match
* @param string $notNullFields
*
Expand Down Expand Up @@ -253,7 +253,7 @@ public function getCount(\CriteriaElement $criteria = null, $notNullFields = '')
}

/**
* @param int $categoryid
* @param int $categoryid
* @param string|array $status
* @param string $notNullFields
* @param $criteriaPermissions
Expand All @@ -274,7 +274,7 @@ private function getItemsCriteria($categoryid = -1, $status = '', $notNullFields
// return $ret;
// }
// }
if (null !== $categoryid && -1 != $categoryid) {
if (isset($categoryid) && -1 != $categoryid) {
$criteriaCategory = new \Criteria('categoryid', $categoryid);
}
$criteriaStatus = new \CriteriaCompo();
Expand Down Expand Up @@ -615,9 +615,9 @@ public function notNullFieldClause($notNullFields = '', $withAnd = false)
* @param string $andor
* @param int $limit
* @param int $offset
* @param int $userid
* @param int|array $userid
* @param array $categories
* @param int $sortby
* @param int|string $sortby
* @param string|array $searchin
* @param string $extra
*
Expand Down
2 changes: 1 addition & 1 deletion class/MimetypeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function getArrayByType()
/**
* Create a "select" SQL query
*
* @param \CriteriaElement $criteria {@link CriteriaElement}
* @param \CriteriaElement|\CriteriaCompo $criteria {@link CriteriaElement}
* to match
* @param bool $join
*
Expand Down
2 changes: 1 addition & 1 deletion class/PermissionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function saveItemPermissions($groups, $itemId, $permName)
{
$result = true;
$moduleId = $this->helper->getModule()->getVar('mid');
/* @var $grouppermHandler XoopsGroupPermHandler */
/* @var $grouppermHandler \XoopsGroupPermHandler */
$grouppermHandler = xoops_getHandler('groupperm');
// First, if the permissions are already there, delete them
$grouppermHandler->deleteByModule($moduleId, $permName, $itemId);
Expand Down
2 changes: 1 addition & 1 deletion class/ThemeTabForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public function &getElements($recurse = false)
if (!$recurse) {
return $this->elements;
}
$ret = [];
$ret = [];
foreach ($this->elements as $i => $iValue) {
if (is_object($this->elements[$i])) {
$ret[] = &$this->elements[$i];
Expand Down
2 changes: 1 addition & 1 deletion class/Utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ public static function getOrderBy($sort)
* @param string $trimMarker
* @return string
*/
public static function mb_substr($str, $start, $length, $trimMarker = '...')
public static function substr($str, $start, $length, $trimMarker = '...')
{
// if the string is empty, let's get out ;-)
if ('' == $str) {
Expand Down
1 change: 1 addition & 0 deletions include/ajax_rating.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
$voted = false;
$ip = getenv('REMOTE_ADDR');

/** @var Publisher\Rating $ratingObj */
foreach ($ratingObjs as $ratingObj) {
$current_rating += $ratingObj->getVar('rate');
if ($ratingObj->getVar('ip') == $ip || ($uid > 0 && $uid == $ratingObj->getVar('uid'))) {
Expand Down

0 comments on commit 6f22aa9

Please sign in to comment.