Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
Signed-off-by: mambax7 <[email protected]>
  • Loading branch information
mambax7 committed Mar 29, 2018
1 parent 9244409 commit 052b9c2
Show file tree
Hide file tree
Showing 51 changed files with 143 additions and 118 deletions.
2 changes: 1 addition & 1 deletion admin/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
// exit();
}
redirect_header('category.php', 1, sprintf(_AM_PUBLISHER_COLISDELETED, $name));
// exit();
// exit();
} else {
xoops_cp_header();
xoops_confirm(['op' => 'del', 'categoryid' => $categoryObj->categoryid(), 'confirm' => 1, 'name' => $categoryObj->name()], 'category.php', _AM_PUBLISHER_DELETECOL . " '" . $categoryObj->name() . "'. <br> <br>" . _AM_PUBLISHER_DELETE_CAT_CONFIRM, _AM_PUBLISHER_DELETE);
Expand Down
2 changes: 1 addition & 1 deletion admin/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)
}

redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid() . '#tab_2', 2, sprintf(_AM_PUBLISHER_FILEISDELETED, $fileObj->name()));
// exit();
// exit();
} else {
// no confirm: show deletion condition
$fileid = Request::getInt('fileid', 0, 'GET');
Expand Down
2 changes: 1 addition & 1 deletion admin/import/ams.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
try {
$imageCategoryHandler->insert($imagecategory);
// exit();
} catch (Exception $e) {
} catch (\Exception $e) {
echo 'Caught exception: could not insert Image Category' . $e->getMessage() . 'n';
}

Expand Down
2 changes: 1 addition & 1 deletion admin/import/fmcontent.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
$module = \XoopsModule::getByDirname($moduleDirName);
if (Publisher\Utility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) {
$catSelBox = $myObjTree->makeSelectElement('parent_category', 'name', '-', 0, true, 0, '', '')->render();
//$form->addElement($catSelBox);
//$form->addElement($catSelBox);
} else {
$catSelBox = $myObjTree->makeSelBox('parent_category', 'name', '-', 0, true);
}
Expand Down
2 changes: 1 addition & 1 deletion admin/import/xnews.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
try {
$imageCategoryHandler->insert($imagecategory);
// exit();
} catch (Exception $e) {
} catch (\Exception $e) {
echo "Caught exception: : couldn't insert Image Category " . $e->getMessage() . 'n';
}

Expand Down
10 changes: 9 additions & 1 deletion admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,20 @@
$adminObject->displayNavigation(basename(__FILE__));

//------------- Test Data ----------------------------

if ($helper->getConfig('displaySampleButton')) {
xoops_loadLanguage('admin/modulesadmin', 'system');
require_once __DIR__ . '/../testdata/index.php';
$adminObject->addItemButton(_AM_SYSTEM_MODULES_INSTALL_TESTDATA, '__DIR__ . /../../testdata/index.php?op=load', 'add');

$adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=load', 'add');

$adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=save', 'add');

// $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA'), '__DIR__ . /../../testdata/index.php?op=exportschema', 'add');

$adminObject->displayButton('left', '');
}

//------------- End Test Data ----------------------------

$adminObject->displayIndex();
Expand Down
2 changes: 1 addition & 1 deletion admin/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
// exit();
}
redirect_header('item.php', 2, sprintf(_AM_PUBLISHER_ITEMISDELETED, $itemObj->getTitle()));
// exit();
// exit();
} else {
xoops_cp_header();
xoops_confirm(['op' => 'del', 'itemid' => $itemObj->itemid(), 'confirm' => 1, 'name' => $itemObj->getTitle()], 'item.php', _AM_PUBLISHER_DELETETHISITEM . " <br>'" . $itemObj->getTitle() . "'. <br> <br>", _AM_PUBLISHER_DELETE);
Expand Down
1 change: 1 addition & 0 deletions admin/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

use XoopsModules\Publisher;

// defined('XOOPS_ROOT_PATH') || die('Restricted access');
include __DIR__ . '/../preloads/autoloader.php';

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
8 changes: 4 additions & 4 deletions backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

$categoryid = Request::getInt('categoryid', -1, 'GET');

if ($categoryid != -1) {
if (-1 != $categoryid) {
$categoryObj = $helper->getHandler('Category')->get($categoryid);
}

Expand All @@ -61,11 +61,11 @@
$tpl->assign('channel_webmaster', $GLOBALS['xoopsConfig']['adminmail']);
$tpl->assign('channel_editor', $GLOBALS['xoopsConfig']['adminmail']);

if ($categoryid != -1) {
if (-1 != $categoryid) {
$channel_category .= ' > ' . $categoryObj->name();
}

$tpl->assign('channel_category', htmlspecialchars($channel_category));
$tpl->assign('channel_category', htmlspecialchars($channel_category, ENT_QUOTES | ENT_HTML5));
$tpl->assign('channel_generator', $helper->getModule()->name());
$tpl->assign('channel_language', _LANGCODE);
$tpl->assign('image_url', XOOPS_URL . '/images/logo.gif');
Expand All @@ -88,7 +88,7 @@
'title' => htmlspecialchars($item->getTitle(), ENT_QUOTES),
'link' => $item->getItemUrl(),
'guid' => $item->getItemUrl(),
//mb 'pubdate' => XoopsLocal::formatTimestamp($item->getVar('datesub'), 'rss'),
//mb 'pubdate' => XoopsLocal::formatTimestamp($item->getVar('datesub'), 'rss'),
'pubdate' => formatTimestamp($item->getVar('datesub'), 'rss'),
'description' => htmlspecialchars($item->getBlockSummary(300, true), ENT_QUOTES)
]);
Expand Down
2 changes: 1 addition & 1 deletion blocks/items_spot.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function publisher_items_spot_show($options)
$i = 1;
$itemsCount = count($itemsObj);
if ($itemsObj) {
if ($optCategoryId != -1 && $optCatImage) {
if (-1 != $optCategoryId && $optCatImage) {
$cat = $helper->getHandler('Category')->get($optCategoryId);
$category['name'] = $cat->name();
$category['categoryurl'] = $cat->getCategoryUrl();
Expand Down
7 changes: 4 additions & 3 deletions class/BaseObjectHandler.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php namespace XoopsModules\Publisher;

/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
Expand Down Expand Up @@ -118,7 +119,7 @@ public function get($id = null, $fields = null)
* @return array array of objects
* @access public
*/
public function &getObjects (\CriteriaElement $criteria = null, $idAsKey = false, $asObject = true) //&getObjects($criteria = null, $idAsKey = false)
public function &getObjects(\CriteriaElement $criteria = null, $idAsKey = false, $asObject = true) //&getObjects($criteria = null, $idAsKey = false)
{
$ret = [];
$limit = $start = 0;
Expand Down Expand Up @@ -224,7 +225,7 @@ private function selectQuery($criteria = null)
* @return int count of objects
* @access public
*/
public function getCount (\CriteriaElement $criteria = null) //getCount($criteria = null)
public function getCount(\CriteriaElement $criteria = null) //getCount($criteria = null)
{
$sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix($this->dbtable);
if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
Expand Down Expand Up @@ -275,7 +276,7 @@ public function delete(\XoopsObject $obj, $force = false) //delete($obj, $force
* @return bool FALSE if deletion failed
* @access public
*/
public function deleteAll (\CriteriaElement $criteria = null, $force = true, $asObject = false) //deleteAll($criteria = null)
public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asObject = false) //deleteAll($criteria = null)
{
$sql = 'DELETE FROM ' . $this->db->prefix($this->dbtable);
if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
Expand Down
1 change: 1 addition & 0 deletions class/BlockForm.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php namespace XoopsModules\Publisher;

/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
Expand Down
6 changes: 3 additions & 3 deletions class/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function __call($method, $args)
*/
public function notLoaded()
{
return ($this->getVar('categoryid') == -1);
return (-1 == $this->getVar('categoryid'));
}

/**
Expand Down Expand Up @@ -157,7 +157,7 @@ public function getCategoryPath($withAllLink = true)
if ($parentObj->notLoaded()) {
throw new RuntimeException(_NOPERM);
}
} catch (Exception $e) {
} catch (\Exception $e) {
$this->helper->addLog($e);
// redirect_header('javascript:history.go(-1)', 1, _NOPERM);
}
Expand Down Expand Up @@ -187,7 +187,7 @@ public function getCategoryPathForMetaTitle()
if ($parentObj->notLoaded()) {
throw new RuntimeException('NOT LOADED');
}
} catch (Exception $e) {
} catch (\Exception $e) {
$this->helper->addLog($e);
// redirect_header('javascript:history.go(-1)', 1, _NOPERM);
}
Expand Down
8 changes: 4 additions & 4 deletions class/CategoryHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function &getCategories($limit = 0, $start = 0, $parentid = 0, $sort = 'w
$criteria = new \CriteriaCompo();
$criteria->setSort($sort);
$criteria->setOrder($order);
if ($parentid != -1) {
if (-1 != $parentid) {
$criteria->add(new \Criteria('parentid', $parentid));
}
if (!$GLOBALS['publisherIsAdmin']) {
Expand Down Expand Up @@ -309,11 +309,11 @@ public function getCategoriesForSearch()
public function getCategoriesCount($parentid = 0)
{
// global $publisherIsAdmin;
if ($parentid == -1) {
if (-1 == $parentid) {
return $this->getCount();
}
$criteria = new \CriteriaCompo();
if (isset($parentid) && ($parentid != -1)) {
if (isset($parentid) && (-1 != $parentid)) {
$criteria->add(new \Criteria('parentid', $parentid));
if (!$GLOBALS['publisherIsAdmin']) {
$categoriesGranted = $this->helper->getHandler('Permission')->getGrantedItems('category_read');
Expand Down Expand Up @@ -374,7 +374,7 @@ public function getSubCats($categories)
* @param bool $asObject
* @return bool FALSE if deletion failed
*/
public function deleteAll (\CriteriaElement $criteria = null, $force = true, $asObject = false) //deleteAll($criteria = null)
public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asObject = false) //deleteAll($criteria = null)
{
$categories =& $this->getObjects($criteria);
foreach ($categories as $category) {
Expand Down
1 change: 1 addition & 0 deletions class/Common/Breadcrumb.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php namespace XoopsModules\Publisher\Common;

/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
Expand Down
21 changes: 10 additions & 11 deletions class/Common/FilesManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ 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(), '<br>';
}
}
Expand All @@ -58,16 +57,16 @@ public static function copyFile($file, $folder)
public static function recurseCopy($src, $dst)
{
$dir = opendir($src);
@mkdir($dst);
while (false !== ($file = readdir($dir))) {
if (('.' !== $file) && ('..' !== $file)) {
if (is_dir($src . '/' . $file)) {
self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
} else {
copy($src . '/' . $file, $dst . '/' . $file);
}
@mkdir($dst);
while (false !== ($file = readdir($dir))) {
if (('.' !== $file) && ('..' !== $file)) {
if (is_dir($src . '/' . $file)) {
self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
} else {
copy($src . '/' . $file, $dst . '/' . $file);
}
}
}
closedir($dir);
}

Expand Down Expand Up @@ -105,7 +104,7 @@ public static function xcopy($source, $dest)
// Skip pointers
if ('.' === $entry || '..' === $entry) {
continue;
}
}
// Deep copy directories
self::xcopy("$source/$entry", "$dest/$entry");
}
Expand Down
2 changes: 1 addition & 1 deletion class/Common/ServerStats.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static function getServerStats()
$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;
if (function_exists('gd_info')) {
if(true === ($gdlib = gd_info())){
if (true === ($gdlib = gd_info())) {
$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
}
}
Expand Down
2 changes: 1 addition & 1 deletion class/Common/VersionChecks.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer =
}
$success = true;

if (version_compare($currentVer, $requiredVer, '<')){
if (version_compare($currentVer, $requiredVer, '<')) {
$success = false;
$module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer));
}
Expand Down
1 change: 1 addition & 0 deletions class/File.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php namespace XoopsModules\Publisher;

/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
Expand Down
3 changes: 2 additions & 1 deletion class/FileHandler.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php namespace XoopsModules\Publisher;

/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
Expand Down Expand Up @@ -128,7 +129,7 @@ public function getAllFiles($itemid = 0, $status = -1, $limit = 0, $start = 0, $
foreach ($status as $v) {
$criteriaStatus->add(new \Criteria('o.status', $v), 'OR');
}
} elseif ($status != -1) {
} elseif (-1 != $status) {
$hasStatusCriteria = true;
$criteriaStatus->add(new \Criteria('o.status', $status), 'OR');
}
Expand Down
1 change: 1 addition & 0 deletions class/Form/CategoryForm.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php namespace XoopsModules\Publisher\Form;

/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
Expand Down
1 change: 1 addition & 0 deletions class/Form/FileForm.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php namespace XoopsModules\Publisher\Form;

/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
Expand Down
2 changes: 1 addition & 1 deletion class/Form/ItemForm.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php namespace XoopsModules\Publisher\Form;

/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
Expand All @@ -24,7 +25,6 @@
use XoopsModules\Publisher;
use XoopsModules\Publisher\Constants;


// defined('XOOPS_ROOT_PATH') || exit("XOOPS root path not defined");

require_once __DIR__ . '/../../include/common.php';
Expand Down
1 change: 1 addition & 0 deletions class/FormDateTime.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php namespace XoopsModules\Publisher;

/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
Expand Down
1 change: 1 addition & 0 deletions class/GrouppermHandler.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php namespace XoopsModules\Publisher;

/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
Expand Down
5 changes: 2 additions & 3 deletions class/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class Helper extends \Xmf\Module\Helper
protected function __construct($debug = false)
{
$this->debug = $debug;
$this->dirname = basename(dirname(__DIR__));
$moduleDirName = basename(dirname(__DIR__));
parent::__construct($moduleDirName);
}

/**
Expand Down Expand Up @@ -97,5 +98,3 @@ public function getHandler($name)
return $ret;
}
}


1 change: 1 addition & 0 deletions class/Highlighter.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php namespace XoopsModules\Publisher;

/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
Expand Down
Loading

0 comments on commit 052b9c2

Please sign in to comment.