Skip to content

Commit

Permalink
fix for blocks, change $icons to arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Aug 16, 2021
1 parent 62cbc0f commit 223e412
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 59 deletions.
12 changes: 5 additions & 7 deletions admin/blocksadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
};

require __DIR__ . '/admin_header.php';
//include_once $GLOBALS['xoops']->path('class/xoopsblock.php');
require_once XOOPS_ROOT_PATH . '/kernel/block.php';

include_once $GLOBALS['xoops']->path('class/xoopsblock.php');
$moduleDirName = \basename(\dirname(__DIR__));
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);

Expand All @@ -34,7 +32,7 @@
exit(constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR403'));
}
if ($GLOBALS['xoopsUser']->isAdmin($xoopsModule->mid())) {
// require_once XOOPS_ROOT_PATH . '/kernel/block.php';
require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
$op = 'list';
if (isset($_POST)) {
foreach ($_POST as $k => $v) {
Expand All @@ -60,7 +58,7 @@ function listBlocks()
global $xoopsModule, $pathIcon16;
// require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
xoops_load('xoopslist');
//require_once XOOPS_ROOT_PATH . '/kernel/block.php';
//require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
$moduleDirName = \basename(\dirname(__DIR__));
$moduleDirNameUpper = \mb_strtoupper($moduleDirName);
/** @var \XoopsMySQLDatabase $db */
Expand Down Expand Up @@ -264,10 +262,10 @@ function listBlocks()

// Actions

echo "<td class='$class' align='center'><a href='blocksadmin.php?op=edit&amp;bid=" . $i->getVar('bid') . "'>" . $icons->edit . "</a> <a href='blocksadmin.php?op=clone&amp;bid=" . $i->getVar('bid') . "'><img src=" . $pathIcon16 . '/editcopy.png' . " alt='" . _CLONE . "' title='" . _CLONE . "'>
echo "<td class='$class' align='center'><a href='blocksadmin.php?op=edit&amp;bid=" . $i->getVar('bid') . "'>" . $icons['edit'] . "</a> <a href='blocksadmin.php?op=clone&amp;bid=" . $i->getVar('bid') . "'><img src=" . $pathIcon16 . '/editcopy.png' . " alt='" . _CLONE . "' title='" . _CLONE . "'>
</a>";
if (!in_array($i->getVar('block_type'), ['S', 'M'])) {
echo "&nbsp;<a href='" . XOOPS_URL . '/modules/system/admin.php?fct=blocksadmin&amp;op=delete&amp;bid=' . $i->getVar('bid') . "'>" . $icons->delete . '</a>';
echo "&nbsp;<a href='" . XOOPS_URL . '/modules/system/admin.php?fct=blocksadmin&amp;op=delete&amp;bid=' . $i->getVar('bid') . "'>" . $icons['delete'] . '</a>';
}
echo "
<input type='hidden' name='oldtitle[" . $i->getVar('bid') . "]' value='" . $i->getVar('title') . "'>
Expand Down
22 changes: 11 additions & 11 deletions admin/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@
for ($i = 0; $i < $totalItemsOnPage; ++$i) {
$categoryObj = $itemsObj[$i]->getCategory();

$approve = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->moderate . '</a>&nbsp;';
$approve = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['moderate'] . '</a>&nbsp;';
$clone = '';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->delete . '</a>';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['delete'] . '</a>';
$modify = '';

echo '<tr>';
Expand Down Expand Up @@ -247,9 +247,9 @@
for ($i = 0; $i < $totalItemsOnPage; ++$i) {
$categoryObj = $itemsObj[$i]->getCategory();

$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->edit . '</a>';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->delete . '</a>';
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->clone . '</a>';
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['edit'] . '</a>';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['delete'] . '</a>';
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['clone'] . '</a>';

echo '<tr>';
echo "<td class='head' align='center'>" . $itemsObj[$i]->itemid() . '</td>';
Expand Down Expand Up @@ -301,9 +301,9 @@
for ($i = 0; $i < $totalItemsOnPage; ++$i) {
$categoryObj = $itemsObj[$i]->getCategory();

$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->edit . '</a>';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->delete . '</a>';
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->clone . '</a>';
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['edit'] . '</a>';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['delete'] . '</a>';
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['clone'] . '</a>';

echo '<tr>';
echo "<td class='head' align='center'>" . $itemsObj[$i]->itemid() . '</td>';
Expand Down Expand Up @@ -354,9 +354,9 @@
for ($i = 0; $i < $totalItemsOnPage; ++$i) {
$categoryObj = $itemsObj[$i]->getCategory();

$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->edit . '</a>';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->delete . '</a>';
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->clone . '</a>';
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['edit'] . '</a>';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['delete'] . '</a>';
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['clone'] . '</a>';

echo '<tr>';
echo "<td class='head' align='center'>" . $itemsObj[$i]->itemid() . '</td>';
Expand Down
26 changes: 13 additions & 13 deletions admin/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,40 +245,40 @@
switch ($itemsObj[$i]->status()) {
case Constants::PUBLISHER_STATUS_SUBMITTED:
$statustxt = _CO_PUBLISHER_SUBMITTED;
$approve = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->moderate . '</a>&nbsp;';
$approve = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['moderate'] . '</a>&nbsp;';
$clone = '';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->delete . '</a>';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['delete'] . '</a>';
$modify = '';
break;
case Constants::PUBLISHER_STATUS_PUBLISHED:
$statustxt = _CO_PUBLISHER_PUBLISHED;
$approve = '';
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->edit . '</a>&nbsp;';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->delete . '</a>&nbsp;';
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->clone . '</a>&nbsp;';
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['edit'] . '</a>&nbsp;';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['delete'] . '</a>&nbsp;';
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['clone'] . '</a>&nbsp;';
break;
case Constants::PUBLISHER_STATUS_OFFLINE:
$statustxt = _CO_PUBLISHER_OFFLINE;
$approve = '';
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->edit . '</a>&nbsp;';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->delete . '</a>&nbsp;';
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['edit'] . '</a>&nbsp;';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['delete'] . '</a>&nbsp;';
$clone = /** @lang text */
"<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->clone . '</a>&nbsp;';
"<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['clone'] . '</a>&nbsp;';
break;
case Constants::PUBLISHER_STATUS_REJECTED:
$statustxt = _CO_PUBLISHER_REJECTED;
$approve = '';
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->rejectededit . '</a>&nbsp;';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->delete . '</a>&nbsp;';
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->clone . '</a>&nbsp;';
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['rejectededit'] . '</a>&nbsp;';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['delete'] . '</a>&nbsp;';
$clone = "<a href='item.php?op=clone&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['clone'] . '</a>&nbsp;';
break;
case 'default':
default:
$statustxt = _AM_PUBLISHER_STATUS0;
$approve = '';
$clone = '';
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->rejectededit . '</a>&nbsp;';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons->delete . '</a>';
$modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['rejectededit'] . '</a>&nbsp;';
$delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'>" . $icons['delete'] . '</a>';
break;
}

Expand Down
10 changes: 5 additions & 5 deletions blocks/latest_news.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ function publisher_latest_news_show($options)
}

if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin(-1)) {
$item['admin'] = "<a href='" . PUBLISHER_URL . '/submit.php?itemid=' . $itemObj->itemid() . "'" . $icons->edit . '</a>&nbsp;';
$item['admin'] .= "<a href='" . PUBLISHER_URL . '/admin/item.php?op=del&amp;itemid=' . $itemObj->itemid() . "'>" . $icons->delete . '</a>';
$item['admin'] = "<a href='" . PUBLISHER_URL . '/submit.php?itemid=' . $itemObj->itemid() . "'" . $icons['edit'] . '</a>&nbsp;';
$item['admin'] .= "<a href='" . PUBLISHER_URL . '/admin/item.php?op=del&amp;itemid=' . $itemObj->itemid() . "'>" . $icons['delete'] . '</a>';
} else {
$item['admin'] = '';
}
Expand Down Expand Up @@ -223,19 +223,19 @@ function publisher_latest_news_show($options)

$item['print'] = '';
if (1 == $options[24]) {
$item['print'] = '<a href="' . Seo::generateUrl('print', $itemObj->itemid(), $itemObj->short_url()) . '" rel="nofollow">" . $icons->print . "</a>&nbsp;';
$item['print'] = '<a href="' . Seo::generateUrl('print', $itemObj->itemid(), $itemObj->short_url()) . '" rel="nofollow">" . $icons['print'] . "</a>&nbsp;';
}

$item['pdf'] = '';

if (1 == $options[25]) {
$item['pdf'] = "<a href='" . PUBLISHER_URL . '/makepdf.php?itemid=' . $itemObj->itemid() . "' rel='nofollow'>" . $icons->pdf . '</a>&nbsp;';
$item['pdf'] = "<a href='" . PUBLISHER_URL . '/makepdf.php?itemid=' . $itemObj->itemid() . "' rel='nofollow'>" . $icons['pdf'] . '</a>&nbsp;';
}

$item['email'] = '';
if (1 == $options[26]) {
$maillink = 'mailto:?subject=' . sprintf(_CO_PUBLISHER_INTITEM, $GLOBALS['xoopsConfig']['sitename']) . '&amp;body=' . sprintf(_CO_PUBLISHER_INTITEMFOUND, $GLOBALS['xoopsConfig']['sitename']) . ': ' . $itemObj->getItemUrl();
$item['email'] = '<a href="' . $maillink . '">' . $icons->mail . '</a>&nbsp;';
$item['email'] = '<a href="' . $maillink . '">' . $icons['mail'] . '</a>&nbsp;';
}

$block['morelink'] = '';
Expand Down
2 changes: 1 addition & 1 deletion class/Common/ServerStats.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static function getServerStats()
$gdlib = \function_exists('gd_info') ? '<span style="color: #008000;">' . \constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: #ff0000;">' . \constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
$html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
if (\function_exists('gd_info')) {
if (true === ($gdlib = gd_info())) {
if (true == ($gdlib = gd_info())) {
$html .= '<li>' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
}
}
Expand Down
4 changes: 2 additions & 2 deletions class/Form/ItemForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,8 @@ public function createElements($obj)
$table .= '</tr>';

foreach ($filesObj as $fileObj) {
$modify = "<a href='file.php?op=mod&fileid=" . $fileObj->fileid() . "'>" . $icons->edit . '</a>';
$delete = "<a href='file.php?op=del&fileid=" . $fileObj->fileid() . "'>" . $icons->delete . '</a>';
$modify = "<a href='file.php?op=mod&fileid=" . $fileObj->fileid() . "'>" . $icons['edit'] . '</a>';
$delete = "<a href='file.php?op=del&fileid=" . $fileObj->fileid() . "'>" . $icons['delete'] . '</a>';
$not_visible = '';
if (0 == $fileObj->status()) {
$not_visible = "<img src='" . PUBLISHER_URL . "/assets/images/no.gif'>";
Expand Down
10 changes: 5 additions & 5 deletions class/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,18 +473,18 @@ public function getAdminLinks($icons)
if (Utility::userIsAdmin() || Utility::userIsAuthor($this) || Utility::userIsModerator($this)) {
if ($this->helper->getConfig('perm_edit') || Utility::userIsModerator($this) || Utility::userIsAdmin()) {
// Edit button
$adminLinks .= "<a href='" . PUBLISHER_URL . '/submit.php?itemid=' . $this->itemid() . "'>" . $icons->edit . '</a>';
$adminLinks .= "<a href='" . PUBLISHER_URL . '/submit.php?itemid=' . $this->itemid() . "'>" . $icons['edit'] . '</a>';
$adminLinks .= ' ';
}
if ($this->helper->getConfig('perm_delete') || Utility::userIsModerator($this) || Utility::userIsAdmin()) {
// Delete button
$adminLinks .= "<a href='" . PUBLISHER_URL . '/submit.php?op=del&amp;itemid=' . $this->itemid() . "'>" . $icons->delete . '</a>';
$adminLinks .= "<a href='" . PUBLISHER_URL . '/submit.php?op=del&amp;itemid=' . $this->itemid() . "'>" . $icons['delete'] . '</a>';
$adminLinks .= ' ';
}
}
if ($this->helper->getConfig('perm_clone') || Utility::userIsModerator($this) || Utility::userIsAdmin()) {
// Duplicate button
$adminLinks .= "<a href='" . PUBLISHER_URL . '/submit.php?op=clone&amp;itemid=' . $this->itemid() . "'>" . $icons->clone . '</a>';
$adminLinks .= "<a href='" . PUBLISHER_URL . '/submit.php?op=clone&amp;itemid=' . $this->itemid() . "'>" . $icons['clone'] . '</a>';
$adminLinks .= ' ';
}
}
Expand All @@ -501,7 +501,7 @@ public function getPdfButton($icons)
$pdfButton = '';
// PDF button
if (\is_file(XOOPS_ROOT_PATH . '/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php')) {
$pdfButton .= "<a href='" . PUBLISHER_URL . '/makepdf.php?itemid=' . $this->itemid() . "' rel='nofollow' target='_blank'>" . $icons->pdf . '</a>&nbsp;';
$pdfButton .= "<a href='" . PUBLISHER_URL . '/makepdf.php?itemid=' . $this->itemid() . "' rel='nofollow' target='_blank'>" . $icons['pdf'] . '</a>&nbsp;';
$pdfButton .= ' ';
} else {
// if (is_object($GLOBALS['xoopsUser']) && Utility::userIsAdmin()) {
Expand All @@ -527,7 +527,7 @@ public function getPrintLinks($icons)
{
$printLinks = '';
// Print button
$printLinks .= "<a href='" . Seo::generateUrl('print', $this->itemid(), $this->short_url()) . "' rel='nofollow' target='_blank'>" . $icons->print . '</a>&nbsp;';
$printLinks .= "<a href='" . Seo::generateUrl('print', $this->itemid(), $this->short_url()) . "' rel='nofollow' target='_blank'>" . $icons['print'] . '</a>&nbsp;';
$printLinks .= ' ';

return $printLinks;
Expand Down
Loading

0 comments on commit 223e412

Please sign in to comment.