Skip to content

Commit be99e1c

Browse files
authored
Merge pull request #29 from mambax7/master
2.35.0 Beta.4
2 parents 0d43afe + 1cb43e6 commit be99e1c

129 files changed

Lines changed: 3027 additions & 1702 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: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ build:
1111
# to install a specific release tag or branch instead.
1212
- git clone --depth=1 https://github.com/XOOPS/XoopsCore25
1313
- git clone --depth=1 https://github.com/mambax7/tag
14+
- git clone --depth=1 https://github.com/mambax7/extgallery
15+
- git clone --depth=1 https://github.com/mambax7/myalbum
16+
- git clone --depth=1 https://github.com/mambax7/newbb
17+
- git clone --depth=1 https://github.com/mambax7/publisher
18+
- git clone --depth=1 https://github.com/mambax7/randomquote
19+
- git clone --depth=1 https://github.com/mambax7/smartfaq
20+
- git clone --depth=1 https://github.com/mambax7/tdmdownloads
21+
- git clone --depth=1 https://github.com/mambax7/xfaq
22+
- git clone --depth=1 https://github.com/gregmage/xmnews
1423
project_setup:
1524
override: true
1625
tests:
@@ -20,3 +29,12 @@ filter:
2029
dependency_paths:
2130
- XoopsCore25/*
2231
- tag/*
32+
- extgallery/*
33+
- myalbum/*
34+
- newbb/*
35+
- publisher/*
36+
- randomquote/*
37+
- smartfaq/*
38+
- tdmdownloads/*
39+
- xfaq/*
40+
- xmnews/*

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
![alt XOOPS CMS](https://xoops.org/images/logoXoopsPhp8.png)
1+
![alt XOOPS CMS](https://xoops.org/images/logoXoopsPhp81.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)
44
[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](https://www.gnu.org/licenses/gpl-2.0.html)
55

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

8-
We accept contributions via Pull Requests on [Github](https://github.com/XoopsModules25x/tag).
8+
We accept contributions via Pull Requests on [GitHub](https://github.com/XoopsModules25x/tag).
99

1010
## Pull Requests
1111

12-
- **[PSR-12 Coding Standard](https://www.php-fig.org/psr/psr-12/)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).
12+
- **[PSR-12 Coding Standard](https://www.php-fig.org/psr/psr-12/)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer).
1313
- **Add tests!** - We encourage providing tests for your contributions.
1414
- **Document any change in behavior** - Make sure the `/docs/changelog.txt` and any other relevant documentation are up-to-date.
15-
- **Consider our release cycle** - We try to follow [Semantic Versioning v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
15+
- **Consider our release cycle** - We try to follow [Semantic Versioning v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.
1616
- **Create feature branches** - Don't ask us to pull from your master branch.
1717
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
1818
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.

README.md

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

admin/about.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/*
33
You may not change or alter any portion of this comment or credits
44
of supporting developers from this source code or any supporting source code
@@ -12,9 +12,8 @@
1212
/**
1313
* XOOPS tag management module
1414
*
15-
* @package XoopsModules\Tag
16-
* @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
17-
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
15+
* @copyright {@link https://sourceforge.net/projects/xoops/ The XOOPS Project}
16+
* @license {@link https://www.fsf.org/copyleft/gpl.html GNU public license}
1817
* @author Mage
1918
* @author Mamba
2019
* @since 2.31

admin/admin.tag.php

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/*
33
You may not change or alter any portion of this comment or credits
44
of supporting developers from this source code or any supporting source code
@@ -12,9 +12,8 @@
1212
/**
1313
* XOOPS tag management module
1414
*
15-
* @package XoopsModules\Tag
16-
* @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
17-
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
15+
* @copyright {@link https://sourceforge.net/projects/xoops/ The XOOPS Project}
16+
* @license {@link https://www.fsf.org/copyleft/gpl.html GNU public license}
1817
* @author Taiwen Jiang <phppp@users.sourceforge.net>
1918
* @since 1.00
2019
*/
@@ -70,15 +69,15 @@
7069
}
7170
*/
7271
foreach ($post_tags as $tag => $tag_status) {
73-
$tag_obj = $tagHandler->get($tag);
74-
if (!($tag_obj instanceof Tag\Tag) || !$tag_obj->getVar('tag_id')) {
72+
$tagObj = $tagHandler->get($tag);
73+
if (!($tagObj instanceof Tag\Tag) || !$tagObj->getVar('tag_id')) {
7574
continue;
7675
}
7776
if ($tag_status < Constants::STATUS_ACTIVE) {
78-
$tagHandler->delete($tag_obj);
79-
} elseif ($tag_status != $tag_obj->getVar('tag_status')) {
80-
$tag_obj->setVar('tag_status', $tag_status);
81-
$tagHandler->insert($tag_obj);
77+
$tagHandler->delete($tagObj);
78+
} elseif ($tag_status != $tagObj->getVar('tag_status')) {
79+
$tagObj->setVar('tag_status', $tag_status);
80+
$tagHandler->insert($tagObj);
8281
$msg_db_updated = _AM_TAG_DB_UPDATED;
8382
}
8483
}
@@ -92,9 +91,7 @@
9291
$sql = 'SELECT tag_modid, COUNT(DISTINCT tag_id) AS count_tag' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('tag_link') . ' GROUP BY tag_modid';
9392
$result = $GLOBALS['xoopsDB']->query($sql);
9493

95-
if (false === $result) {
96-
xoops_error($GLOBALS['xoopsDB']->error());
97-
} else {
94+
if ($result instanceof \mysqli_result) {
9895
while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) {
9996
$counts_module[$myrow['tag_modid']] = $myrow['count_tag'];
10097
}
@@ -103,21 +100,23 @@
103100
$moduleHandler = xoops_getHandler('module');
104101
$module_list = $moduleHandler->getList(new \Criteria('mid', '(' . implode(', ', array_keys($counts_module)) . ')', 'IN'));
105102
}
103+
} else {
104+
xoops_error($GLOBALS['xoopsDB']->error());
106105
}
107-
//
106+
108107
$opform = new \XoopsSimpleForm('', 'moduleform', $_SERVER['SCRIPT_NAME'], 'get', true);
109108
//$opform = new \XoopsSimpleForm('', 'moduleform', xoops_getenv('SCRIPT_NAME'), 'post', true);
110109
$tray = new \XoopsFormElementTray('');
111110
$mod_select = new \XoopsFormSelect(_SELECT, 'modid', $modid);
112-
$mod_select->addOption(0, _ALL);
111+
$mod_select->addOption('0', _ALL);
113112
foreach ($module_list as $module => $module_name) {
114113
$mod_select->addOption($module, $module_name . ' (' . $counts_module[$module] . ')');
115114
}
116115
$tray->addElement($mod_select);
117-
$status_select = new \XoopsFormRadio('', 'status', $status);
118-
$status_select->addOption(Constants::STATUS_ALL, _ALL);
119-
$status_select->addOption(Constants::STATUS_ACTIVE, _AM_TAG_ACTIVE);
120-
$status_select->addOption(Constants::STATUS_INACTIVE, _AM_TAG_INACTIVE);
116+
$status_select = new \XoopsFormRadio('', 'status', (string)$status);
117+
$status_select->addOption((string)Constants::STATUS_ALL, _ALL);
118+
$status_select->addOption((string)Constants::STATUS_ACTIVE, _AM_TAG_ACTIVE);
119+
$status_select->addOption((string)Constants::STATUS_INACTIVE, _AM_TAG_INACTIVE);
121120
$tray->addElement($status_select);
122121
$tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
123122
$opform->addElement($tray);
@@ -129,10 +128,10 @@
129128
$criteria->setStart($start);
130129
$criteria->setLimit($limit);
131130
if ($status >= Constants::STATUS_ACTIVE) {
132-
$criteria->add(new \Criteria('o.tag_status', $status));
131+
$criteria->add(new \Criteria('o.tag_status', (string)$status));
133132
}
134133
if (!empty($modid)) {
135-
$criteria->add(new \Criteria('l.tag_modid', $modid));
134+
$criteria->add(new \Criteria('l.tag_modid', (string)$modid));
136135
}
137136
$tags = $tagHandler->getByLimit(0, 0, $criteria, null, false);
138137

admin/admin_footer.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/*
33
You may not change or alter any portion of this comment or credits
44
of supporting developers from this source code or any supporting source code
@@ -12,9 +12,8 @@
1212
/**
1313
* XOOPS tag management module
1414
*
15-
* @package XoopsModules\Tag
16-
* @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project}
17-
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
15+
* @copyright {@link https://sourceforge.net/projects/xoops/ The XOOPS Project}
16+
* @license {@link https://www.fsf.org/copyleft/gpl.html GNU public license}
1817
* @author Mamba {@link https://xoops.org}
1918
* @since 2.31
2019
*/

admin/admin_header.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22
/*
33
You may not change or alter any portion of this comment or credits
44
of supporting developers from this source code or any supporting source code
@@ -12,16 +12,17 @@
1212
/**
1313
* XOOPS tag management module
1414
*
15-
* @package XoopsModules\Tag
1615
* @copyright XOOPS Project (https://xoops.org)
17-
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
16+
* @license https://www.fsf.org/copyleft/gpl.html GNU public license
1817
* @since 1.00
1918
* @author Taiwen Jiang <phppp@users.sourceforge.net>
2019
* */
2120

2221
use Xmf\Module\Admin;
2322
use XoopsModules\Tag\Helper;
2423

24+
/** @var Admin $adminObject */
25+
2526
require \dirname(__DIR__) . '/preloads/autoloader.php';
2627

2728
require \dirname(__DIR__, 3) . '/include/cp_header.php';
@@ -30,11 +31,9 @@
3031

3132
/**
3233
* {@internal $helper defined in ./include/common.php }}
33-
*
3434
*/
3535
$helper = Helper::getInstance();
3636

37-
/** @var \Xmf\Module\Admin $adminObject */
3837
$adminObject = Admin::getInstance();
3938

4039
// Load language files

admin/blocksadmin.php

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* You may not change or alter any portion of this comment or credits
7+
* of supporting developers from this source code or any supporting source code
8+
* which is considered copyrighted (c) material of the original comment or credit authors.
9+
*
10+
*
11+
* @category Module
12+
* @author XOOPS Development Team
13+
* @copyright XOOPS Project
14+
* @link https://xoops.org
15+
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
16+
*/
17+
18+
use Xmf\Module\Admin;
19+
use Xmf\Request;
20+
use XoopsModules\Tag\{
21+
Common\Blocksadmin,
22+
Helper
23+
};
24+
25+
/** @var Admin $adminObject */
26+
/** @var Helper $helper */
27+
28+
require __DIR__ . '/admin_header.php';
29+
xoops_cp_header();
30+
31+
$moduleDirName = $helper->getDirname();
32+
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
33+
34+
/** @var \XoopsMySQLDatabase $xoopsDB */
35+
$xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
36+
$blocksadmin = new Blocksadmin($xoopsDB, $helper);
37+
38+
$xoopsModule = XoopsModule::getByDirname($moduleDirName);
39+
40+
if (!is_object($GLOBALS['xoopsUser']) || !is_object($xoopsModule)
41+
|| !$GLOBALS['xoopsUser']->isAdmin($xoopsModule->mid())) {
42+
exit(constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR403'));
43+
}
44+
if ($GLOBALS['xoopsUser']->isAdmin($xoopsModule->mid())) {
45+
require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
46+
47+
$op = Request::getCmd('op', 'list');
48+
if (!empty($_POST)) {
49+
$ok = Request::getInt('ok', 0, 'POST');
50+
$confirm_submit = Request::getCmd('confirm_submit', '', 'POST');
51+
$submit = Request::getString('submit', '', 'POST');
52+
$bside = Request::getString('bside', '0', 'POST');
53+
$bweight = Request::getString('bweight', '0', 'POST');
54+
$bvisible = Request::getString('bvisible', '0', 'POST');
55+
$bmodule = Request::getArray('bmodule', [], 'POST');
56+
$btitle = Request::getString('btitle', '', 'POST');
57+
$bcachetime = Request::getString('bcachetime', '0', 'POST');
58+
$groups = Request::getArray('groups', [], 'POST');
59+
$options = Request::getArray('options', [], 'POST');
60+
$submitblock = Request::getString('submitblock', '', 'POST');
61+
$fct = Request::getString('fct', '', 'POST');
62+
$title = Request::getString('title', '', 'POST');
63+
$side = Request::getString('side', '0', 'POST');
64+
$weight = Request::getString('weight', '0', 'POST');
65+
$visible = Request::getString('visible', '0', 'POST');
66+
}
67+
68+
if ('list' === $op) {
69+
// xoops_cp_header();
70+
$blocksadmin->listBlocks();
71+
require_once __DIR__ . '/admin_footer.php';
72+
exit();
73+
}
74+
75+
if (\in_array($op, ['edit', 'edit_ok', 'delete', 'delete_ok', 'clone', 'clone_ok'])) {
76+
$bid = Request::getInt('bid', 0);
77+
$ok = Request::getInt('ok', 0);
78+
79+
if ('clone' === $op) {
80+
$blocksadmin->cloneBlock($bid);
81+
}
82+
83+
if ('delete' === $op) {
84+
if (1 === $ok) {
85+
// if (!$GLOBALS['xoopsSecurity']->check()) {
86+
// redirect_header($helper->url('admin/blocksadmin.php'), 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
87+
// }
88+
$blocksadmin->deleteBlock($bid);
89+
} else {
90+
// xoops_cp_header();
91+
xoops_confirm(['ok' => 1, 'op' => 'delete', 'bid' => $bid], 'blocksadmin.php', constant('CO_' . $moduleDirNameUpper . '_' . 'DELETE_BLOCK_CONFIRM'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true);
92+
xoops_cp_footer();
93+
}
94+
}
95+
96+
if ('edit' === $op) {
97+
$blocksadmin->editBlock($bid);
98+
}
99+
100+
if ('edit_ok' === $op) {
101+
$blocksadmin->updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups);
102+
}
103+
104+
if ('clone_ok' === $op) {
105+
$blocksadmin->isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups);
106+
}
107+
}
108+
109+
if ('order' === $op) {
110+
$bid = Request::getArray('bid', []);
111+
112+
$title = Request::getArray('title', [], 'POST');
113+
$side = Request::getArray('side', [], 'POST');
114+
$weight = Request::getArray('weight', [], 'POST');
115+
$visible = Request::getArray('visible', [], 'POST');
116+
$bcachetime = Request::getArray('bcachetime', [], 'POST');
117+
$bmodule = Request::getArray('bmodule', [], 'POST');//mb
118+
119+
$oldtitle = Request::getArray('oldtitle', [], 'POST');
120+
$oldside = Request::getArray('oldside', [], 'POST');
121+
$oldweight = Request::getArray('oldweight', [], 'POST');
122+
$oldvisible = Request::getArray('oldvisible', [], 'POST');
123+
$oldgroups = Request::getArray('oldgroups', [], 'POST');
124+
$oldbcachetime = Request::getArray('oldcachetime', [], 'POST');
125+
$oldbmodule = Request::getArray('oldbmodule', [], 'POST');//mb
126+
127+
$blocksadmin->orderBlock(
128+
$bid,
129+
$oldtitle,
130+
$oldside,
131+
$oldweight,
132+
$oldvisible,
133+
$oldgroups,
134+
$oldbcachetime,
135+
$oldbmodule,
136+
$title,
137+
$weight,
138+
$visible,
139+
$side,
140+
$bcachetime,
141+
$groups,
142+
$bmodule
143+
);
144+
}
145+
} else {
146+
echo constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR403');
147+
}
148+
149+
require __DIR__ . '/admin_footer.php';

0 commit comments

Comments
 (0)