Skip to content

Commit

Permalink
revert for blocks in 2.5.10
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Aug 29, 2021
1 parent c1019b7 commit fea27b0
Showing 1 changed file with 30 additions and 31 deletions.
61 changes: 30 additions & 31 deletions admin/blocksadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function listBlocks()
xoops_loadLanguage('admin/groups', 'system');

$configurator = new Configurator();
$icons = $configurator->icons;
$icons = $configurator->icons;

/** @var \XoopsModuleHandler $moduleHandler */
$moduleHandler = xoops_getHandler('module');
Expand Down Expand Up @@ -120,16 +120,16 @@ function listBlocks()
$blockCount = count($blockArray);
$class = 'even';
$cachetimes = [
0 => _NOCACHE,
30 => sprintf(_SECONDS, 30),
60 => _MINUTE,
300 => sprintf(_MINUTES, 5),
1800 => sprintf(_MINUTES, 30),
3600 => _HOUR,
18000 => sprintf(_HOURS, 5),
86400 => _DAY,
259200 => sprintf(_DAYS, 3),
604800 => _WEEK,
0 => _NOCACHE,
30 => sprintf(_SECONDS, 30),
60 => _MINUTE,
300 => sprintf(_MINUTES, 5),
1800 => sprintf(_MINUTES, 30),
3600 => _HOUR,
18000 => sprintf(_HOURS, 5),
86400 => _DAY,
259200 => sprintf(_DAYS, 3),
604800 => _WEEK,
2592000 => _MONTH,
];
foreach ($blockArray as $i) {
Expand Down Expand Up @@ -293,7 +293,6 @@ function listBlocks()
*/
function cloneBlock($bid)
{

xoops_cp_header();

$adminObject = Admin::getInstance();
Expand All @@ -313,7 +312,7 @@ function cloneBlock($bid)
while (false !== ($row = $db->fetchArray($result))) {
$modules[] = (int)$row['module_id'];
}
$isCustom = (in_array($myblock->getVar('block_type'), ['C', 'E']));
$isCustom = (in_array($myblock->getVar('block_type'), ['C', 'E']));
$block = [
'title' => $myblock->getVar('title') . ' Clone',
'form_title' => constant('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK'),
Expand Down Expand Up @@ -358,8 +357,8 @@ function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule,

$moduleDirName = \basename(\dirname(__DIR__));
$moduleDirNameUpper = mb_strtoupper($moduleDirName);
$block = new \XoopsBlock($bid);
$clone = $block->xoopsClone();
$block = new \XoopsBlock($bid);
$clone = $block->xoopsClone();
if (empty($bmodule)) {
xoops_cp_header();
xoops_error(sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'NOTSELNG'), constant('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN')));
Expand Down Expand Up @@ -430,10 +429,10 @@ function setOrder($bid, $title, $weight, $visible, $side, $bcachetime, $bmodule
$myblock->setVar('visible', $visible);
$myblock->setVar('side', $side);
$myblock->setVar('bcachetime', $bcachetime);
// $myblock->store();
/** @var \XoopsBlockHandler $blockHandler */
$blockHandler = xoops_getHandler('block');
return $blockHandler->insert($myblock);
$myblock->store();
// /** @var \XoopsBlockHandler $blockHandler */
// $blockHandler = xoops_getHandler('block');
// return $blockHandler->insert($myblock);
}

/**
Expand All @@ -460,7 +459,7 @@ function editBlock($bid)
while (false !== ($row = $db->fetchArray($result))) {
$modules[] = (int)$row['module_id'];
}
$isCustom = (in_array($myblock->getVar('block_type'), ['C', 'E']));
$isCustom = (in_array($myblock->getVar('block_type'), ['C', 'E']));
$block = [
'title' => $myblock->getVar('title'),
'form_title' => constant('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK'),
Expand Down Expand Up @@ -514,19 +513,19 @@ function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $b
$helper->loadLanguage('common');
//update block options
if (is_array($options) && count($options) > 0) {
//Convert array values to comma-separated
foreach ($options as $i => $iValue) {
if (is_array($iValue)) {
$options[$i] = implode(',', $iValue);
}
//Convert array values to comma-separated
foreach ($options as $i => $iValue) {
if (is_array($iValue)) {
$options[$i] = implode(',', $iValue);
}
$options = implode('|', $options);
$myblock->setVar('options', $options);
}
// $myblock->store();
/** @var \XoopsBlockHandler $blockHandler */
$blockHandler = xoops_getHandler('block');
$blockHandler->insert($myblock);
$options = implode('|', $options);
$myblock->setVar('options', $options);
}
$myblock->store();
// /** @var \XoopsBlockHandler $blockHandler */
// $blockHandler = xoops_getHandler('block');
// $blockHandler->insert($myblock);

global $xoopsDB;

Expand Down

0 comments on commit fea27b0

Please sign in to comment.