Skip to content

Commit 116d837

Browse files
authored
Merge pull request #92 from mambax7/master
1.06 Beta 3
2 parents 96e1315 + 7023977 commit 116d837

109 files changed

Lines changed: 5461 additions & 5018 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.scrutinizer.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
build:
2+
nodes:
3+
analysis:
4+
project_setup:
5+
override: true
6+
tests:
7+
override: [php-scrutinizer-run]
18
checks:
29
php:
310
code_rating: true

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
![alt XOOPS CMS](https://xoops.org/images/logoXoops4GithubRepository.png)
22
# Contributing to [XOOPS CMS](https://xoops.org)
33
[![XOOPS CMS Module](https://img.shields.io/badge/XOOPS%20CMS-Module-blue.svg)](https://xoops.org)
4-
[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](LICENSE)
4+
[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](http://www.gnu.org/licenses/gpl-2.0.html)
55

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
![alt XOOPS CMS](https://xoops.org/images/logoXoops4GithubRepository.png)
22
## Publisher module for [XOOPS CMS 2.5.8+](https://xoops.org)
33
[![XOOPS CMS Module](https://img.shields.io/badge/XOOPS%20CMS-Module-blue.svg)](https://xoops.org)
4-
[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](LICENSE)
4+
[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](http://www.gnu.org/licenses/gpl-2.0.html)
55

66
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/mambax7/publisher.svg?style=flat)](https://scrutinizer-ci.com/g/mambax7/publisher/?branch=master)
77
[![Codacy Badge](https://api.codacy.com/project/badge/grade/2d27c0023ee54f0b9ba2b5d17a68b2a5)](https://www.codacy.com/app/mambax7/publisher)

admin/admin_header.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,19 @@
1919
*/
2020

2121

22-
use Xoopsmodules\publisher;
22+
use XoopsModules\Publisher;
2323

2424
require_once __DIR__ . '/../../../include/cp_header.php';
2525
//require_once $GLOBALS['xoops']->path('www/class/xoopsformloader.php');
2626

27+
include __DIR__ . '/../preloads/autoloader.php';
2728
require_once __DIR__ . '/../include/common.php';
28-
//require_once __DIR__ . '/../class/utility.php';
29-
require_once __DIR__ . '/../include/config.php';
3029

3130
$moduleDirName = basename(dirname(__DIR__));
32-
$helper = publisher\Helper::getInstance();
31+
32+
/** @var Publisher\Helper $helper */
33+
$helper = Publisher\Helper::getInstance();
34+
/** @var Xmf\Module\Admin $adminObject */
3335
$adminObject = \Xmf\Module\Admin::getInstance();
3436

3537
$pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16);
@@ -48,9 +50,9 @@
4850
'offline' => "<img src='" . PUBLISHER_IMAGES_URL . "/off.png' alt='" . _AM_PUBLISHER_ICO_OFFLINE . "' align='middle'>"
4951
];
5052

51-
$myts = MyTextSanitizer::getInstance();
53+
$myts = \MyTextSanitizer::getInstance();
5254

5355
if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) {
5456
require_once $GLOBALS['xoops']->path('class/template.php');
55-
$GLOBALS['xoopsTpl'] = new XoopsTpl();
57+
$GLOBALS['xoopsTpl'] = new \XoopsTpl();
5658
}

admin/category.php

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020

2121
use Xmf\Request;
22-
use Xoopsmodules\publisher;
22+
use XoopsModules\Publisher;
2323

2424
require_once __DIR__ . '/admin_header.php';
2525

@@ -34,11 +34,11 @@
3434

3535
switch ($op) {
3636
case 'del':
37-
$categoryObj = $helper->getHandler('category')->get($categoryid);
37+
$categoryObj = $helper->getHandler('Category')->get($categoryid);
3838
$confirm = Request::getInt('confirm', '', 'POST');
3939
$name = Request::getString('name', '', 'POST');
4040
if ($confirm) {
41-
if (!$helper->getHandler('category')->delete($categoryObj)) {
41+
if (!$helper->getHandler('Category')->delete($categoryObj)) {
4242
redirect_header('category.php', 1, _AM_PUBLISHER_DELETE_CAT_ERROR);
4343
// exit();
4444
}
@@ -57,18 +57,18 @@
5757
$nb_subcats += Request::getInt('nb_sub_yet', 4, 'POST');
5858
//end of fx2024 code
5959

60-
publisher\Utility::cpHeader();
61-
publisher\Utility::editCategory(true, $categoryid, $nb_subcats);
60+
Publisher\Utility::cpHeader();
61+
Publisher\Utility::editCategory(true, $categoryid, $nb_subcats);
6262
break;
6363

6464
case 'addcategory':
6565
global $modify;
6666

6767
$parentid = Request::getInt('parentid');
6868
if (0 != $categoryid) {
69-
$categoryObj = $helper->getHandler('category')->get($categoryid);
69+
$categoryObj = $helper->getHandler('Category')->get($categoryid);
7070
} else {
71-
$categoryObj = $helper->getHandler('category')->create();
71+
$categoryObj = $helper->getHandler('Category')->create();
7272
}
7373

7474
// Uploading the image, if any
@@ -82,14 +82,14 @@
8282
$max_size = $helper->getConfig('maximum_filesize');
8383
$max_imgwidth = $helper->getConfig('maximum_image_width');
8484
$max_imgheight = $helper->getConfig('maximum_image_height');
85-
$allowed_mimetypes = publisher\Utility::getAllowedImagesTypes();
85+
$allowed_mimetypes = Publisher\Utility::getAllowedImagesTypes();
8686
if (('' == $temp['tmp_name']) || !is_readable($temp['tmp_name'])) {
8787
redirect_header('javascript:history.go(-1)', 2, _AM_PUBLISHER_FILEUPLOAD_ERROR);
8888
// exit();
8989
}
9090

9191
xoops_load('XoopsMediaUploader');
92-
$uploader = new XoopsMediaUploader(publisher\Utility::getImageDir('category'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight);
92+
$uploader = new \XoopsMediaUploader(Publisher\Utility::getImageDir('category'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight);
9393
if ($uploader->fetchMedia($filename) && $uploader->upload()) {
9494
$categoryObj->setVar('image', $uploader->getSavedFileName());
9595
} else {
@@ -130,33 +130,33 @@
130130
}
131131

132132
if (!$categoryObj->store()) {
133-
redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_CATEGORY_SAVE_ERROR . publisher\Utility::formatErrors($categoryObj->getErrors()));
133+
redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_CATEGORY_SAVE_ERROR . Publisher\Utility::formatErrors($categoryObj->getErrors()));
134134
// exit;
135135
}
136136
// TODO : put this function in the category class
137-
publisher\Utility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read');
138-
publisher\Utility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit');
139-
publisher\Utility::saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation');
137+
Publisher\Utility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read');
138+
Publisher\Utility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit');
139+
Publisher\Utility::saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation');
140140

141141
//Added by fx2024
142142
$parentCat = $categoryObj->categoryid();
143143
$sizeof = count(Request::getArray('scname', [], 'POST'));
144144
for ($i = 0; $i < $sizeof; ++$i) {
145145
$temp = Request::getArray('scname', [], 'POST');
146146
if ('' != $temp[$i]) {
147-
$categoryObj = $helper->getHandler('category')->create();
147+
$categoryObj = $helper->getHandler('Category')->create();
148148
$temp2 = Request::getArray('scname', [], 'POST');
149149
$categoryObj->setVar('name', $temp2[$i]);
150150
$categoryObj->setVar('parentid', $parentCat);
151151

152152
if (!$categoryObj->store()) {
153-
redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_SUBCATEGORY_SAVE_ERROR . publisher\Utility::formatErrors($categoryObj->getErrors()));
153+
redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_SUBCATEGORY_SAVE_ERROR . Publisher\Utility::formatErrors($categoryObj->getErrors()));
154154
// exit;
155155
}
156156
// TODO : put this function in the category class
157-
publisher\Utility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read');
158-
publisher\Utility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit');
159-
publisher\Utility::saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation');
157+
Publisher\Utility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read');
158+
Publisher\Utility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit');
159+
Publisher\Utility::saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation');
160160
}
161161
}
162162
//end of fx2024 code
@@ -170,16 +170,16 @@
170170
$categoryid = 0;
171171
$nb_subcats = Request::getInt('nb_subcats', 0, 'POST') + Request::getInt('nb_sub_yet', 0, 'POST');
172172

173-
$categoryObj = $helper->getHandler('category')->create();
173+
$categoryObj = $helper->getHandler('Category')->create();
174174
$categoryObj->setVar('name', Request::getString('name', '', 'POST'));
175175
$categoryObj->setVar('description', Request::getString('description', '', 'POST'));
176176
$categoryObj->setVar('weight', Request::getInt('weight', 0, 'POST'));
177177
if (isset($parentCat)) {
178178
$categoryObj->setVar('parentid', $parentCat);
179179
}
180180

181-
publisher\Utility::cpHeader();
182-
publisher\Utility::editCategory(true, $categoryid, $nb_subcats, $categoryObj);
181+
Publisher\Utility::cpHeader();
182+
Publisher\Utility::editCategory(true, $categoryid, $nb_subcats, $categoryObj);
183183
exit();
184184
break;
185185
//end of fx2024 code
@@ -190,7 +190,7 @@
190190
break;
191191
case 'default':
192192
default:
193-
publisher\Utility::cpHeader();
193+
Publisher\Utility::cpHeader();
194194
//publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES);
195195

196196
echo "<br>\n";
@@ -200,9 +200,9 @@
200200
echo '</div></form>';
201201

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

205-
publisher\Utility::openCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC);
205+
Publisher\Utility::openCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC);
206206

207207
echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
208208
echo '<tr>';
@@ -211,10 +211,10 @@
211211
echo "<th width='60' class='bg3' width='65' align='center'><strong>" . _CO_PUBLISHER_WEIGHT . '</strong></td>';
212212
echo "<th width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . '</strong></td>';
213213
echo '</tr>';
214-
$totalCategories = $helper->getHandler('category')->getCategoriesCount(0);
214+
$totalCategories = $helper->getHandler('Category')->getCategoriesCount(0);
215215
if (count($categoriesObj) > 0) {
216216
foreach ($categoriesObj as $key => $thiscat) {
217-
publisher\Utility::displayCategory($thiscat);
217+
Publisher\Utility::displayCategory($thiscat);
218218
}
219219
unset($key, $thiscat);
220220
} else {
@@ -225,10 +225,10 @@
225225
}
226226
echo "</table>\n";
227227
require_once $GLOBALS['xoops']->path('class/pagenav.php');
228-
$pagenav = new XoopsPageNav($totalCategories, $helper->getConfig('idxcat_perpage'), $startcategory, 'startcategory');
228+
$pagenav = new \XoopsPageNav($totalCategories, $helper->getConfig('idxcat_perpage'), $startcategory, 'startcategory');
229229
echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>';
230230
echo '<br>';
231-
publisher\Utility::closeCollapsableBar('createdcategories', 'createdcategoriesicon');
231+
Publisher\Utility::closeCollapsableBar('createdcategories', 'createdcategoriesicon');
232232
echo '<br>';
233233
//editcat(false);
234234
break;

admin/clone.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
*/
1919

2020
use Xmf\Request;
21-
use Xoopsmodules\publisher;
21+
use XoopsModules\Publisher;
2222

2323
require_once __DIR__ . '/admin_header.php';
2424

25-
publisher\Utility::cpHeader();
25+
Publisher\Utility::cpHeader();
2626
//publisher_adminMenu(-1, _AM_PUBLISHER_CLONE);
27-
publisher\Utility::openCollapsableBar('clone', 'cloneicon', _AM_PUBLISHER_CLONE, _AM_PUBLISHER_CLONE_DSC);
27+
Publisher\Utility::openCollapsableBar('clone', 'cloneicon', _AM_PUBLISHER_CLONE, _AM_PUBLISHER_CLONE_DSC);
2828

2929
if ('submit' === Request::getString('op', '', 'POST')) {
3030
if (!$GLOBALS['xoopsSecurity']->check()) {
@@ -69,17 +69,17 @@
6969
echo $msg;
7070
} else {
7171
require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
72-
$form = new XoopsThemeForm(sprintf(_AM_PUBLISHER_CLONE_TITLE, $helper->getModule()->getVar('name', 'E')), 'clone', 'clone.php', 'post', true);
73-
$clone = new XoopsFormText(_AM_PUBLISHER_CLONE_NAME, 'clone', 20, 20, '');
72+
$form = new \XoopsThemeForm(sprintf(_AM_PUBLISHER_CLONE_TITLE, $helper->getModule()->getVar('name', 'E')), 'clone', 'clone.php', 'post', true);
73+
$clone = new \XoopsFormText(_AM_PUBLISHER_CLONE_NAME, 'clone', 20, 20, '');
7474
$clone->setDescription(_AM_PUBLISHER_CLONE_NAME_DSC);
7575
$form->addElement($clone, true);
76-
$form->addElement(new XoopsFormHidden('op', 'submit'));
77-
$form->addElement(new XoopsFormButton('', '', _SUBMIT, 'submit'));
76+
$form->addElement(new \XoopsFormHidden('op', 'submit'));
77+
$form->addElement(new \XoopsFormButton('', '', _SUBMIT, 'submit'));
7878
$form->display();
7979
}
8080

8181
// End of collapsable bar
82-
publisher\Utility::closeCollapsableBar('clone', 'cloneicon');
82+
Publisher\Utility::closeCollapsableBar('clone', 'cloneicon');
8383

8484
require_once __DIR__ . '/admin_footer.php';
8585

0 commit comments

Comments
 (0)