Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Mar 15, 2018
1 parent 5c68486 commit 42c5114
Show file tree
Hide file tree
Showing 98 changed files with 4,461 additions and 4,121 deletions.
7 changes: 7 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
build:
nodes:
analysis:
project_setup:
override: true
tests:
override: [php-scrutinizer-run]
checks:
php:
code_rating: true
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![alt XOOPS CMS](https://xoops.org/images/logoXoops4GithubRepository.png)
# Contributing to [XOOPS CMS](https://xoops.org)
[![XOOPS CMS Module](https://img.shields.io/badge/XOOPS%20CMS-Module-blue.svg)](https://xoops.org)
[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](LICENSE)
[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](http://www.gnu.org/licenses/gpl-2.0.html)

Contributions are **welcome** and will be fully **credited**.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![alt XOOPS CMS](https://xoops.org/images/logoXoops4GithubRepository.png)
## Publisher module for [XOOPS CMS 2.5.8+](https://xoops.org)
[![XOOPS CMS Module](https://img.shields.io/badge/XOOPS%20CMS-Module-blue.svg)](https://xoops.org)
[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](LICENSE)
[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](http://www.gnu.org/licenses/gpl-2.0.html)

[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/mambax7/publisher.svg?style=flat)](https://scrutinizer-ci.com/g/mambax7/publisher/?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/grade/2d27c0023ee54f0b9ba2b5d17a68b2a5)](https://www.codacy.com/app/mambax7/publisher)
Expand Down
2 changes: 1 addition & 1 deletion admin/admin_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
//require_once $GLOBALS['xoops']->path('www/class/xoopsformloader.php');

include __DIR__ . '/../preloads/autoloader.php';

require_once __DIR__ . '/../include/common.php';

$moduleDirName = basename(dirname(__DIR__));

Expand Down
16 changes: 8 additions & 8 deletions admin/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@

switch ($op) {
case 'del':
$categoryObj = $helper->getHandler('category')->get($categoryid);
$categoryObj = $helper->getHandler('Category')->get($categoryid);
$confirm = Request::getInt('confirm', '', 'POST');
$name = Request::getString('name', '', 'POST');
if ($confirm) {
if (!$helper->getHandler('category')->delete($categoryObj)) {
if (!$helper->getHandler('Category')->delete($categoryObj)) {
redirect_header('category.php', 1, _AM_PUBLISHER_DELETE_CAT_ERROR);
// exit();
}
Expand Down Expand Up @@ -66,9 +66,9 @@

$parentid = Request::getInt('parentid');
if (0 != $categoryid) {
$categoryObj = $helper->getHandler('category')->get($categoryid);
$categoryObj = $helper->getHandler('Category')->get($categoryid);
} else {
$categoryObj = $helper->getHandler('category')->create();
$categoryObj = $helper->getHandler('Category')->create();
}

// Uploading the image, if any
Expand Down Expand Up @@ -144,7 +144,7 @@
for ($i = 0; $i < $sizeof; ++$i) {
$temp = Request::getArray('scname', [], 'POST');
if ('' != $temp[$i]) {
$categoryObj = $helper->getHandler('category')->create();
$categoryObj = $helper->getHandler('Category')->create();
$temp2 = Request::getArray('scname', [], 'POST');
$categoryObj->setVar('name', $temp2[$i]);
$categoryObj->setVar('parentid', $parentCat);
Expand All @@ -170,7 +170,7 @@
$categoryid = 0;
$nb_subcats = Request::getInt('nb_subcats', 0, 'POST') + Request::getInt('nb_sub_yet', 0, 'POST');

$categoryObj = $helper->getHandler('category')->create();
$categoryObj = $helper->getHandler('Category')->create();
$categoryObj->setVar('name', Request::getString('name', '', 'POST'));
$categoryObj->setVar('description', Request::getString('description', '', 'POST'));
$categoryObj->setVar('weight', Request::getInt('weight', 0, 'POST'));
Expand Down Expand Up @@ -200,7 +200,7 @@
echo '</div></form>';

// Creating the objects for top categories
$categoriesObj = $helper->getHandler('category')->getCategories($helper->getConfig('idxcat_perpage'), $startcategory, 0);
$categoriesObj = $helper->getHandler('Category')->getCategories($helper->getConfig('idxcat_perpage'), $startcategory, 0);

Publisher\Utility::openCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC);

Expand All @@ -211,7 +211,7 @@
echo "<th width='60' class='bg3' width='65' align='center'><strong>" . _CO_PUBLISHER_WEIGHT . '</strong></td>';
echo "<th width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . '</strong></td>';
echo '</tr>';
$totalCategories = $helper->getHandler('category')->getCategoriesCount(0);
$totalCategories = $helper->getHandler('Category')->getCategoriesCount(0);
if (count($categoriesObj) > 0) {
foreach ($categoriesObj as $key => $thiscat) {
Publisher\Utility::displayCategory($thiscat);
Expand Down
12 changes: 6 additions & 6 deletions admin/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)
// if there is a parameter, and the id exists, retrieve data: we're editing a file
if (0 != $fileid) {
// Creating the File object
$fileObj = $helper->getHandler('file')->get($fileid);
$fileObj = $helper->getHandler('File')->get($fileid);

if ($fileObj->notLoaded()) {
redirect_header('javascript:history.go(-1)', 1, _AM_PUBLISHER_NOFILESELECTED);
Expand All @@ -51,7 +51,7 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)
Publisher\Utility::openCollapsableBar('editfile', 'editfileicon', _AM_PUBLISHER_FILE_INFORMATIONS);
} else {
// there's no parameter, so we're adding an item
$fileObj = $helper->getHandler('file')->create();
$fileObj = $helper->getHandler('File')->create();
$fileObj->setVar('itemid', $itemid);
echo "<span style='color: #2F5376; font-weight: bold; font-size: 16px; margin: 6px 6px 0 0; '>" . _AM_PUBLISHER_FILE_ADDING . '</span>';
echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_PUBLISHER_FILE_ADDING_DSC . '</span>';
Expand Down Expand Up @@ -101,9 +101,9 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)

// Creating the file object
if (0 != $fileid) {
$fileObj = $helper->getHandler('file')->get($fileid);
$fileObj = $helper->getHandler('File')->get($fileid);
} else {
$fileObj = $helper->getHandler('file')->create();
$fileObj = $helper->getHandler('File')->create();
}

// Putting the values in the file object
Expand All @@ -125,13 +125,13 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)
$fileid = Request::getInt('fileid', 0, 'POST');
$fileid = Request::getInt('fileid', $fileid, 'GET');

$fileObj = $helper->getHandler('file')->get($fileid);
$fileObj = $helper->getHandler('File')->get($fileid);

$confirm = Request::getInt('confirm', 0, 'POST');
$title = Request::getString('title', '', 'POST');

if ($confirm) {
if (!$helper->getHandler('file')->delete($fileObj)) {
if (!$helper->getHandler('File')->delete($fileObj)) {
redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid() . '#tab_2', 2, _AM_PUBLISHER_FILE_DELETE_ERROR);
// exit;
}
Expand Down
27 changes: 14 additions & 13 deletions admin/import/ams.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

use Xmf\Request;
use XoopsModules\Publisher;
use XoopsModules\Publisher\Constants;

require_once dirname(__DIR__) . '/admin_header.php';
$myts = \MyTextSanitizer::getInstance();
Expand Down Expand Up @@ -160,7 +161,7 @@
if ('go' === $op) {
Publisher\Utility::cpHeader();
//publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT);
require_once dirname(dirname(__DIR__)) . '/include/common.php';
require_once __DIR__ . '/../../include/common.php';
Publisher\Utility::openCollapsableBar('amsimportgo', 'amsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT);
/* @var $moduleHandler XoopsModuleHandler */
$moduleHandler = xoops_getHandler('module');
Expand Down Expand Up @@ -215,8 +216,8 @@
$newCat = [];
$newCat['oldid'] = $arrCat['topic_id'];
$newCat['oldpid'] = $arrCat['topic_pid'];
/* @var $categoryObj PublisherCategory */
$categoryObj = $helper->getHandler('category')->create();
/* @var $categoryObj Publisher\Category */
$categoryObj = $helper->getHandler('Category')->create();

$categoryObj->setVar('parentid', $arrCat['topic_pid']);
$categoryObj->setVar('image', $arrCat['topic_imgurl']);
Expand Down Expand Up @@ -254,7 +255,7 @@
}
}

if (!$helper->getHandler('category')->insert($categoryObj)) {
if (!$helper->getHandler('Category')->insert($categoryObj)) {
echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['topic_title']) . '<br>';
continue;
}
Expand Down Expand Up @@ -292,8 +293,8 @@
while (false !== ($arrArticle = $GLOBALS['xoopsDB']->fetchArray($resultArticles))) {
// insert article

/** @var XoopsPersistableObjectHandler $itemObj */
$itemObj = $helper->getHandler('item')->create();
/** @var \XoopsPersistableObjectHandler $itemObj */
$itemObj = $helper->getHandler('Item')->create();

$itemObj->setVar('categoryid', $categoryObj->categoryid());
$itemObj->setVar('title', $arrArticle['title']);
Expand All @@ -305,7 +306,7 @@
$itemObj->setVar('dohtml', !$arrArticle['nohtml']);
$itemObj->setVar('dosmiley', !$arrArticle['nosmiley']);
$itemObj->setVar('weight', 0);
$itemObj->setVar('status', PublisherConstants::PUBLISHER_STATUS_PUBLISHED);
$itemObj->setVar('status', Constants::PUBLISHER_STATUS_PUBLISHED);

// $itemObj->setVar('dobr', !$arrArticle['dobr']);
// $itemObj->setVar('item_tag', $arrArticle['tags']);
Expand Down Expand Up @@ -354,11 +355,11 @@
$filename = $GLOBALS['xoops']->path('uploads/AMS/attached/' . $arrFile['downloadname']);
if (file_exists($filename)) {
if (copy($filename, $GLOBALS['xoops']->path('uploads/publisher/' . $arrFile['filerealname']))) {
/** @var PublisherFile $fileObj */
$fileObj = $helper->getHandler('file')->create();
/** @var Publisher\File $fileObj */
$fileObj = $helper->getHandler('File')->create();
$fileObj->setVar('name', $arrFile['filerealname']);
$fileObj->setVar('description', $arrFile['filerealname']);
$fileObj->setVar('status', PublisherConstants::PUBLISHER_STATUS_FILE_ACTIVE);
$fileObj->setVar('status', Constants::PUBLISHER_STATUS_FILE_ACTIVE);
$fileObj->setVar('uid', $arrArticle['uid']);
$fileObj->setVar('itemid', $itemObj->itemid());
$fileObj->setVar('mimetype', $arrFile['mimetype']);
Expand Down Expand Up @@ -406,7 +407,7 @@
} else {
$newpid = $newCatArray[$oldpid]['newid'];
}
$helper->getHandler('category')->updateAll('parentid', $newpid, $criteria);
$helper->getHandler('Category')->updateAll('parentid', $newpid, $criteria);
unset($criteria);
}
unset($oldid, $newCat);
Expand All @@ -416,12 +417,12 @@

$publisher_module_id = $helper->getModule()->mid();

/** @var XoopsCommentHandler $commentHandler */
/** @var \XoopsCommentHandler $commentHandler */
$commentHandler = xoops_getHandler('comment');
$criteria = new \CriteriaCompo();
$criteria->add(new \Criteria('com_modid', $ams_module_id));
$comments = $commentHandler->getObjects($criteria);
/** @var XoopsComment $comment */
/** @var \XoopsComment $comment */
foreach ($comments as $comment) {
$comment->setVar('com_itemid', $newArticleArray[$comment->getVar('com_itemid')]);
$comment->setVar('com_modid', $publisher_module_id);
Expand Down
13 changes: 7 additions & 6 deletions admin/import/cjaycontent.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

use Xmf\Request;
use XoopsModules\Publisher;
use XoopsModules\Publisher\Constants;

require_once dirname(__DIR__) . '/admin_header.php';
$myts = \MyTextSanitizer::getInstance();
Expand Down Expand Up @@ -86,7 +87,7 @@
if ('go' === $op) {
Publisher\Utility::cpHeader();
//publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT);
require_once dirname(dirname(__DIR__)) . '/include/common.php';
require_once __DIR__ . '/../../include/common.php';
Publisher\Utility::openCollapsableBar('cjaycontentimportgo', 'cjaycontentimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT);
/* @var $moduleHandler XoopsModuleHandler */
$moduleHandler = xoops_getHandler('module');
Expand All @@ -105,8 +106,8 @@
$resultArticles = $GLOBALS['xoopsDB']->query($sql);
while (false !== ($arrArticle = $GLOBALS['xoopsDB']->fetchArray($resultArticles))) {
// insert article
/** @var PublisherItem $itemObj */
$itemObj = $helper->getHandler('item')->create();
/** @var Publisher\Item $itemObj */
$itemObj = $helper->getHandler('Item')->create();
$itemObj->setVar('itemid', $arrArticle['id']);
// $itemObj->setVar('categoryid', $categoryObj->categoryid());
$itemObj->setVar('title', $arrArticle['title']);
Expand All @@ -118,7 +119,7 @@
// $itemObj->setVar('dohtml', !$arrArticle['nohtml']);
// $itemObj->setVar('dosmiley', !$arrArticle['nosmiley']);
$itemObj->setVar('weight', $arrArticle['weight']);
$itemObj->setVar('status', PublisherConstants::PUBLISHER_STATUS_PUBLISHED);
$itemObj->setVar('status', Constants::PUBLISHER_STATUS_PUBLISHED);

// $itemObj->setVar('dobr', !$arrArticle['dobr']);
// $itemObj->setVar('item_tag', $arrArticle['tags']);
Expand Down Expand Up @@ -160,11 +161,11 @@
echo _AM_PUBLISHER_IMPORT_COMMENTS . '<br>';

$publisher_module_id = $helper->getModule()->mid();
/** @var XoopsCommentHandler $commentHandler */
/** @var \XoopsCommentHandler $commentHandler */
$commentHandler = xoops_getHandler('comment');
$criteria = new \CriteriaCompo();
$criteria->add(new \Criteria('com_modid', $cjaycontent_module_id));
/** @var XoopsComment $comment */
/** @var \XoopsComment $comment */
$comments = $commentHandler->getObjects($criteria);
foreach ($comments as $comment) {
$comment->setVar('com_itemid', $newArticleArray[$comment->getVar('com_itemid')]);
Expand Down
Loading

0 comments on commit 42c5114

Please sign in to comment.