Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Feb 8, 2019
1 parent c143bd4 commit 4efd2ec
Show file tree
Hide file tree
Showing 85 changed files with 383 additions and 337 deletions.
1 change: 0 additions & 1 deletion admin/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
* @since 1.0
* @author Mage, Mamba
*/

require_once __DIR__ . '/admin_header.php';
xoops_cp_header();

Expand Down
1 change: 0 additions & 1 deletion admin/admin_footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* @since
* @author XOOPS Development Team
*/

$pathIcon32 = \Xmf\Module\Admin::iconUrl('', 32);

echo "<div class='adminfooter'>\n" . " <div style='text-align: center;'>\n" . " <a href='https://xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" . " </div>\n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . '</div>';
Expand Down
21 changes: 10 additions & 11 deletions admin/blockform.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* @link https://www.xoops.org
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
*/

require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';

$moduleDirName = basename(dirname(__DIR__));
Expand All @@ -32,13 +31,13 @@
5 => _AM_SYSTEM_BLOCKS_CBCENTER,
7 => _AM_SYSTEM_BLOCKS_CBBOTTOMLEFT,
8 => _AM_SYSTEM_BLOCKS_CBBOTTOMRIGHT,
9 => _AM_SYSTEM_BLOCKS_CBBOTTOM
9 => _AM_SYSTEM_BLOCKS_CBBOTTOM,
]);
$form->addElement($side_select);
$form->addElement(new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT'), 'bweight', 2, 5, $block['weight']));
$form->addElement(new \XoopsFormRadioYN(constant('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE'), 'bvisible', $block['visible']));
$mod_select = new \XoopsFormSelect(constant('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN'), 'bmodule', $block['modules'], 5, true);
/** @var XoopsModuleHandler $moduleHandler */
/** @var \XoopsModuleHandler $moduleHandler */
$moduleHandler = xoops_getHandler('module');
$criteria = new \CriteriaCompo(new \Criteria('hasmain', 1));
$criteria->add(new \Criteria('isactive', 1));
Expand All @@ -58,7 +57,7 @@
'H' => _AM_SYSTEM_BLOCKS_HTML,
'P' => _AM_SYSTEM_BLOCKS_PHP,
'S' => _AM_SYSTEM_BLOCKS_AFWSMILE,
'T' => _AM_SYSTEM_BLOCKS_AFNOSMILE
'T' => _AM_SYSTEM_BLOCKS_AFNOSMILE,
]);
$form->addElement($ctype_select);
} else {
Expand Down Expand Up @@ -91,7 +90,7 @@
'86400' => _DAY,
'259200' => sprintf(_DAYS, 3),
'604800' => _WEEK,
'2592000' => _MONTH
'2592000' => _MONTH,
]);
$form->addElement($cache_select);

Expand All @@ -106,18 +105,18 @@
}
$form->addElement(new \XoopsFormHidden('op', $block['op']));
$form->addElement(new \XoopsFormHidden('fct', 'blocksadmin'));
$button_tray = new \XoopsFormElementTray('', '&nbsp;');
$buttonTray = new \XoopsFormElementTray('', '&nbsp;');
if ($block['is_custom']) {
$button_tray->addElement(new \XoopsFormButton('', 'previewblock', _PREVIEW, 'submit'));
$buttonTray->addElement(new \XoopsFormButton('', 'previewblock', _PREVIEW, 'submit'));
}

//Submit buttons
$button_tray = new \XoopsFormElementTray('', '');
$buttonTray = new \XoopsFormElementTray('', '');
$submit_button = new \XoopsFormButton('', 'submitblock', _SUBMIT, 'submit');
$button_tray->addElement($submit_button);
$buttonTray->addElement($submit_button);

$cancel_button = new \XoopsFormButton('', '', _CANCEL, 'button');
$cancel_button->setExtra('onclick="history.go(-1)"');
$button_tray->addElement($cancel_button);
$buttonTray->addElement($cancel_button);

$form->addElement($button_tray);
$form->addElement($buttonTray);
25 changes: 14 additions & 11 deletions admin/blocksadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
*/

$op = Request::getString('op', $op);
if (in_array($op, ['edit', 'delete', 'delete_ok', 'clone'])) {
if (in_array($op, ['edit', 'delete', 'delete_ok', 'clone'], true)) {
$bid = Request::getInt('bid', 0, 'GET');
}

Expand All @@ -54,12 +54,12 @@ 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');

/** @var XoopsModuleHandler $moduleHandler */
/** @var \XoopsModuleHandler $moduleHandler */
$moduleHandler = xoops_getHandler('module');
/** @var \XoopsMemberHandler $memberHandler */
$memberHandler = xoops_getHandler('member');
Expand Down Expand Up @@ -89,7 +89,10 @@ function listBlocks()
. '-'
. _RIGHT
. "</th><th align='center'>"
. constant('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT')
. constant('CO_'
. $moduleDirNameUpper
. '_'
. 'WEIGHT')
. "</th><th align='center'>"
. constant('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE')
. "</th><th align='center'>"
Expand Down Expand Up @@ -232,13 +235,13 @@ function listBlocks()

echo "<td class='$class' align='center'><select size='5' name='bmodule[" . $i->getVar('bid') . "][]' id='bmodule[" . $i->getVar('bid') . "][]' multiple='multiple'>";
foreach ($module_list as $k => $v) {
echo "<option value='$k'" . (in_array($k, $modules) ? " selected='selected'" : '') . ">$v</option>";
echo "<option value='$k'" . (in_array($k, $modules, true) ? " selected='selected'" : '') . ">$v</option>";
}
echo '</select></td>';

echo "<td class='$class' align='center'><select size='5' name='groups[" . $i->getVar('bid') . "][]' id='groups[" . $i->getVar('bid') . "][]' multiple='multiple'>";
foreach ($groups as $grp) {
echo "<option value='" . $grp->getVar('groupid') . "' " . (in_array($grp->getVar('groupid'), $groups_perms) ? " selected='selected'" : '') . '>' . $grp->getVar('name') . '</option>';
echo "<option value='" . $grp->getVar('groupid') . "' " . (in_array($grp->getVar('groupid'), $groups_perms, true) ? " selected='selected'" : '') . '>' . $grp->getVar('name') . '</option>';
}
echo '</select></td>';

Expand Down Expand Up @@ -267,7 +270,7 @@ function listBlocks()
";
$class = ('even' === $class) ? 'odd' : 'even';
}
echo "<tr><td class='foot' align='center' colspan='7'>
echo "<tr><td class='foot' align='center' colspan='8'>
<input type='hidden' name='op' value='order'>
" . $GLOBALS['xoopsSecurity']->getTokenHTML() . "
<input type='submit' name='submit' value='" . _SUBMIT . "'>
Expand Down Expand Up @@ -361,7 +364,7 @@ function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule,
//$clone->setVar('content', $_POST['bcontent']);
$clone->setVar('title', Request::getString('btitle', '', 'POST'));
$clone->setVar('bcachetime', $bcachetime);
if (null !== $options && (count($options) > 0)) {
if (null !== $options && is_array($options) && count($options) > 0) {
$options = implode('|', $options);
$clone->setVar('options', $options);
}
Expand Down Expand Up @@ -394,7 +397,7 @@ function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule,
$sql = 'INSERT INTO ' . $db->prefix('block_module_link') . ' (block_id, module_id) VALUES (' . $newid . ', ' . $bmid . ')';
$db->query($sql);
}
$groups =& $GLOBALS['xoopsUser']->getGroups();
$groups = &$GLOBALS['xoopsUser']->getGroups();
$count = count($groups);
for ($i = 0; $i < $count; ++$i) {
$sql = 'INSERT INTO ' . $db->prefix('group_permission') . ' (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES (' . $groups[$i] . ', ' . $newid . ", 1, 'block_read')";
Expand Down Expand Up @@ -498,7 +501,7 @@ function xtubeUpdateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetim
if (!empty($bmodule) && count($bmodule) > 0) {
$sql = sprintf('DELETE FROM `%s` WHERE block_id = %u', $GLOBALS['xoopsDB']->prefix('block_module_link'), $bid);
$GLOBALS['xoopsDB']->query($sql);
if (in_array(0, $bmodule)) {
if (in_array(0, $bmodule, true)) {
$sql = sprintf('INSERT INTO `%s` (block_id, module_id) VALUES (%u, %d)', $GLOBALS['xoopsDB']->prefix('block_module_link'), $bid, 0);
$GLOBALS['xoopsDB']->query($sql);
} else {
Expand Down Expand Up @@ -540,7 +543,7 @@ function xtubeUpdateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetim
if (!empty($bmodule[$i]) && count($bmodule[$i]) > 0) {
$sql = sprintf('DELETE FROM `%s` WHERE block_id = %u', $GLOBALS['xoopsDB']->prefix('block_module_link'), $bid[$i]);
$GLOBALS['xoopsDB']->query($sql);
if (in_array(0, $bmodule[$i])) {
if (in_array(0, $bmodule[$i], true)) {
$sql = sprintf('INSERT INTO `%s` (block_id, module_id) VALUES (%u, %d)', $GLOBALS['xoopsDB']->prefix('block_module_link'), $bid[$i], 0);
$GLOBALS['xoopsDB']->query($sql);
} else {
Expand Down
3 changes: 0 additions & 3 deletions admin/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
xoops_cp_footer();
}
break;

case 'mod':
//Added by fx2024
$nb_subcats = Request::getInt('nb_subcats', 0, 'POST');
Expand All @@ -58,7 +57,6 @@
Publisher\Utility::cpHeader();
Publisher\Utility::editCategory(true, $categoryid, $nb_subcats);
break;

case 'addcategory':
global $modify;

Expand Down Expand Up @@ -156,7 +154,6 @@
//end of fx2024 code
redirect_header($redirect_to, 2, $redirect_msg);
break;

//Added by fx2024

case 'addsubcats':
Expand Down
5 changes: 0 additions & 5 deletions admin/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,10 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)
Publisher\Utility::uploadFile(false, true, $false);
exit;
break;

case 'uploadanother':
Publisher\Utility::uploadFile(true, true, $false);
exit;
break;

case 'mod':
$fileid = Request::getInt('fileid', 0, 'GET');
$itemid = Request::getInt('itemid', 0, 'GET');
Expand All @@ -96,7 +94,6 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)

publisher_editFile(true, $fileid, $itemid);
break;

case 'modify':
$fileid = Request::getInt('fileid', 0, 'POST');

Expand All @@ -119,7 +116,6 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)

redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid() . '#tab_2', 2, _AM_PUBLISHER_FILE_EDITING_SUCCESS);
break;

case 'del':
$fileid = Request::getInt('fileid', 0, 'POST');
$fileid = Request::getInt('fileid', $fileid, 'GET');
Expand All @@ -146,7 +142,6 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)

exit();
break;

case 'default':
default:
Publisher\Utility::cpHeader();
Expand Down
13 changes: 6 additions & 7 deletions admin/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
$importfile_path = $GLOBALS['xoops']->path('modules/' . $helper->getModule()->dirname() . '/admin/import/' . $importfile . '.php');
require_once $importfile_path;
break;

case 'default':
default:
$importfile = 'none';
Expand Down Expand Up @@ -146,19 +145,19 @@
$sform->addElement($importfile_tray);

// Buttons
$button_tray = new \XoopsFormElementTray('', '');
$hidden = new \XoopsFormHidden('op', 'importExecute');
$button_tray->addElement($hidden);
$buttonTray = new \XoopsFormElementTray('', '');
$hidden = new \XoopsFormHidden('op', 'importExecute');
$buttonTray->addElement($hidden);

$butt_import = new \XoopsFormButton('', '', _AM_PUBLISHER_IMPORT, 'submit');
$butt_import->setExtra('onclick="this.form.elements.op.value=\'importExecute\'"');
$button_tray->addElement($butt_import);
$buttonTray->addElement($butt_import);

$butt_cancel = new \XoopsFormButton('', '', _AM_PUBLISHER_CANCEL, 'button');
$butt_cancel->setExtra('onclick="history.go(-1)"');
$button_tray->addElement($butt_cancel);
$buttonTray->addElement($butt_cancel);

$sform->addElement($button_tray);
$sform->addElement($buttonTray);
/*$sform->addElement(new \XoopsFormHidden('xfs_version', $xfs_version));
$sform->addElement(new \XoopsFormHidden('wfs_version', $wfs_version));*/
$sform->addElement(new \XoopsFormHidden('news_version', $news_version));
Expand Down
5 changes: 3 additions & 2 deletions admin/import/ams.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
$imagecategory->setVar('imgcat_weight', 0); //$imgcat_weight);
$imagecategory->setVar('imgcat_storetype', 'file'); //$imgcat_storetype);
$imagecategory->setVar('imgcat_type', 'C');

try {
$imageCategoryHandler->insert($imagecategory);
}
Expand All @@ -88,7 +89,7 @@
if (!isset($readgroup)) {
$readgroup = [];
}
if (!in_array(XOOPS_GROUP_ADMIN, $readgroup)) {
if (!in_array(XOOPS_GROUP_ADMIN, $readgroup, true)) {
$readgroup[] = XOOPS_GROUP_ADMIN;
}
foreach ($readgroup as $rgroup) {
Expand All @@ -104,7 +105,7 @@
if (!isset($writegroup)) {
$writegroup = [];
}
if (!in_array(XOOPS_GROUP_ADMIN, $writegroup)) {
if (!in_array(XOOPS_GROUP_ADMIN, $writegroup, true)) {
$writegroup[] = XOOPS_GROUP_ADMIN;
}
foreach ($writegroup as $wgroup) {
Expand Down
2 changes: 1 addition & 1 deletion admin/import/cjaycontent.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
$resultArticles = $GLOBALS['xoopsDB']->query($sql);
while (false !== ($arrArticle = $GLOBALS['xoopsDB']->fetchArray($resultArticles))) {
// insert article
/** @var Publisher\Item $itemObj */
/** @var Publisher\Item $itemObj */
$itemObj = $helper->getHandler('Item')->create();
$itemObj->setVar('itemid', $arrArticle['id']);
// $itemObj->setVar('categoryid', $categoryObj->categoryid());
Expand Down
12 changes: 6 additions & 6 deletions admin/import/fmcontent.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
'weight' => 1,
'created' => time(),
'moderator',
$GLOBALS['xoopsUser']->getVar('uid')
$GLOBALS['xoopsUser']->getVar('uid'),
]);
$categoryObj->store();

Expand Down Expand Up @@ -199,13 +199,13 @@
'votes' => 0,
'comments' => $thisFmContentObj->getVar('content_comments'),
'meta_keywords' => $thisFmContentObj->getVar('content_words'),
'meta_description' => $thisFmContentObj->getVar('content_desc')
'meta_description' => $thisFmContentObj->getVar('content_desc'),
]);
$contentImg = $thisFmContentObj->getVar('content_img');
if (!empty($contentImg)) {
$itemObj->setVars([
'images' => 1,
'image' => $thisFmContentObj->getVar('content_img')
'image' => $thisFmContentObj->getVar('content_img'),
]);
}

Expand Down Expand Up @@ -239,7 +239,7 @@
foreach ($fmTopicObjs as $thisFmTopicObj) {
$CatIds = [
'oldid' => $thisFmTopicObj->getVar('topic_id'),
'oldpid' => $thisFmTopicObj->getVar('topic_pid')
'oldpid' => $thisFmTopicObj->getVar('topic_pid'),
];

$categoryObj = $helper->getHandler('Category')->create();
Expand All @@ -248,7 +248,7 @@
'parentid' => $thisFmTopicObj->getVar('topic_pid'),
'weight' => $thisFmTopicObj->getVar('topic_weight'),
'name' => $thisFmTopicObj->getVar('topic_title'),
'description' => $thisFmTopicObj->getVar('topic_desc')
'description' => $thisFmTopicObj->getVar('topic_desc'),
]);

// Category image
Expand Down Expand Up @@ -296,7 +296,7 @@
'votes' => 0,
'comments' => $thisFmContentObj->getVar('content_comments'),
'meta_keywords' => $thisFmContentObj->getVar('content_words'),
'meta_description' => $thisFmContentObj->getVar('content_desc')
'meta_description' => $thisFmContentObj->getVar('content_desc'),
]);
$contentImg = $thisFmContentObj->getVar('content_img');
if (!empty($contentImg)) {
Expand Down
2 changes: 1 addition & 1 deletion admin/import/news.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
$resultArticles = $GLOBALS['xoopsDB']->query($sql);
while (false !== ($arrArticle = $GLOBALS['xoopsDB']->fetchArray($resultArticles))) {
// insert article
/** @var Publisher\Item $itemObj */
/** @var Publisher\Item $itemObj */
$itemObj = $helper->getHandler('Item')->create();

$itemObj->setVar('categoryid', $categoryObj->categoryid());
Expand Down
4 changes: 2 additions & 2 deletions admin/import/smartsection.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@

while (false !== ($arrArticle = $GLOBALS['xoopsDB']->fetchArray($resultArticles))) {
// insert article
/** @var Publisher\Item $itemObj */
/** @var Publisher\Item $itemObj */
$itemObj = $helper->getHandler('Item')->create();

$itemObj->setVars($arrArticle);
Expand Down Expand Up @@ -183,7 +183,7 @@
$filename = $GLOBALS['xoops']->path('uploads/smartsection/' . $arrFile['filename']);
if (file_exists($filename)) {
if (copy($filename, $GLOBALS['xoops']->path('uploads/publisher/' . $arrFile['filename']))) {
/** @var Publisher\File $fileObj */
/** @var Publisher\File $fileObj */
$fileObj = $helper->getHandler('File')->create();
$fileObj->setVars($arrFile);
$fileObj->setVar('fileid', 0);
Expand Down
Loading

0 comments on commit 4efd2ec

Please sign in to comment.