@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | use Xmf\Module\Admin; |
| 17 | 17 | use Xmf\Request; |
| 18 | 18 | use XoopsModules\Myiframe\{ |
| 19 | - Common\Blocksadmin, |
|
| 20 | - Helper |
|
| 19 | + Common\Blocksadmin, |
|
| 20 | + Helper |
|
| 21 | 21 | }; |
| 22 | 22 | |
| 23 | 23 | /** @var Admin $adminObject */ |
@@ -36,112 +36,112 @@ discard block |
||
| 36 | 36 | $xoopsModule = XoopsModule::getByDirname($moduleDirName); |
| 37 | 37 | |
| 38 | 38 | if (!is_object($GLOBALS['xoopsUser']) || !is_object($xoopsModule) |
| 39 | - || !$GLOBALS['xoopsUser']->isAdmin($xoopsModule->mid())) { |
|
| 40 | - exit(constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR403')); |
|
| 39 | + || !$GLOBALS['xoopsUser']->isAdmin($xoopsModule->mid())) { |
|
| 40 | + exit(constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR403')); |
|
| 41 | 41 | } |
| 42 | 42 | if ($GLOBALS['xoopsUser']->isAdmin($xoopsModule->mid())) { |
| 43 | - require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php'; |
|
| 44 | - |
|
| 45 | - $op = Request::getCmd('op', 'list'); |
|
| 46 | - if (!empty($_POST)) { |
|
| 47 | - $ok = Request::getInt('ok', 0, 'POST'); |
|
| 48 | - $confirm_submit = Request::getCmd('confirm_submit', '', 'POST'); |
|
| 49 | - $submit = Request::getString('submit', '', 'POST'); |
|
| 50 | - $bside = Request::getString('bside', '0', 'POST'); |
|
| 51 | - $bweight = Request::getString('bweight', '0', 'POST'); |
|
| 52 | - $bvisible = Request::getString('bvisible', '0', 'POST'); |
|
| 53 | - $bmodule = Request::getArray('bmodule', [], 'POST'); |
|
| 54 | - $btitle = Request::getString('btitle', '', 'POST'); |
|
| 55 | - $bcachetime = Request::getString('bcachetime', '0', 'POST'); |
|
| 56 | - $groups = Request::getArray('groups', [], 'POST'); |
|
| 57 | - $options = Request::getArray('options', [], 'POST'); |
|
| 58 | - $submitblock = Request::getString('submitblock', '', 'POST'); |
|
| 59 | - $fct = Request::getString('fct', '', 'POST'); |
|
| 60 | - $title = Request::getString('title', '', 'POST'); |
|
| 61 | - $side = Request::getString('side', '0', 'POST'); |
|
| 62 | - $weight = Request::getString('weight', '0', 'POST'); |
|
| 63 | - $visible = Request::getString('visible', '0', 'POST'); |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - if ('list' === $op) { |
|
| 67 | - // xoops_cp_header(); |
|
| 68 | - $blocksadmin->listBlocks(); |
|
| 69 | - require_once __DIR__ . '/admin_footer.php'; |
|
| 70 | - exit(); |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - if (\in_array($op, ['edit', 'edit_ok', 'delete', 'delete_ok', 'clone', 'clone_ok'])) { |
|
| 74 | - $bid = Request::getInt('bid', 0); |
|
| 75 | - $ok = Request::getInt('ok', 0); |
|
| 76 | - |
|
| 77 | - if ('clone' === $op) { |
|
| 78 | - $blocksadmin->cloneBlock($bid); |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - if ('delete' === $op) { |
|
| 82 | - if (1 === $ok) { |
|
| 83 | - // if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 84 | - // redirect_header($helper->url('admin/blocksadmin.php'), 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 85 | - // } |
|
| 86 | - $blocksadmin->deleteBlock($bid); |
|
| 87 | - } else { |
|
| 88 | - // xoops_cp_header(); |
|
| 89 | - xoops_confirm(['ok' => 1, 'op' => 'delete', 'bid' => $bid], 'blocksadmin.php', constant('CO_' . $moduleDirNameUpper . '_' . 'DELETE_BLOCK_CONFIRM'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); |
|
| 90 | - xoops_cp_footer(); |
|
| 91 | - } |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - if ('edit' === $op) { |
|
| 95 | - $blocksadmin->editBlock($bid); |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - if ('edit_ok' === $op) { |
|
| 99 | - $blocksadmin->updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - if ('clone_ok' === $op) { |
|
| 103 | - $blocksadmin->isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups); |
|
| 104 | - } |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - if ('order' === $op) { |
|
| 108 | - $bid = Request::getArray('bid', []); |
|
| 109 | - |
|
| 110 | - $title = Request::getArray('title', [], 'POST'); |
|
| 111 | - $side = Request::getArray('side', [], 'POST'); |
|
| 112 | - $weight = Request::getArray('weight', [], 'POST'); |
|
| 113 | - $visible = Request::getArray('visible', [], 'POST'); |
|
| 114 | - $bcachetime = Request::getArray('bcachetime', [], 'POST'); |
|
| 115 | - $bmodule = Request::getArray('bmodule', [], 'POST');//mb |
|
| 116 | - |
|
| 117 | - $oldtitle = Request::getArray('oldtitle', [], 'POST'); |
|
| 118 | - $oldside = Request::getArray('oldside', [], 'POST'); |
|
| 119 | - $oldweight = Request::getArray('oldweight', [], 'POST'); |
|
| 120 | - $oldvisible = Request::getArray('oldvisible', [], 'POST'); |
|
| 121 | - $oldgroups = Request::getArray('oldgroups', [], 'POST'); |
|
| 122 | - $oldbcachetime = Request::getArray('oldcachetime', [], 'POST'); |
|
| 123 | - $oldbmodule = Request::getArray('oldbmodule', [], 'POST');//mb |
|
| 124 | - |
|
| 125 | - $blocksadmin->orderBlock( |
|
| 126 | - $bid, |
|
| 127 | - $oldtitle, |
|
| 128 | - $oldside, |
|
| 129 | - $oldweight, |
|
| 130 | - $oldvisible, |
|
| 131 | - $oldgroups, |
|
| 132 | - $oldbcachetime, |
|
| 133 | - $oldbmodule, |
|
| 134 | - $title, |
|
| 135 | - $weight, |
|
| 136 | - $visible, |
|
| 137 | - $side, |
|
| 138 | - $bcachetime, |
|
| 139 | - $groups, |
|
| 140 | - $bmodule |
|
| 141 | - ); |
|
| 142 | - } |
|
| 43 | + require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php'; |
|
| 44 | + |
|
| 45 | + $op = Request::getCmd('op', 'list'); |
|
| 46 | + if (!empty($_POST)) { |
|
| 47 | + $ok = Request::getInt('ok', 0, 'POST'); |
|
| 48 | + $confirm_submit = Request::getCmd('confirm_submit', '', 'POST'); |
|
| 49 | + $submit = Request::getString('submit', '', 'POST'); |
|
| 50 | + $bside = Request::getString('bside', '0', 'POST'); |
|
| 51 | + $bweight = Request::getString('bweight', '0', 'POST'); |
|
| 52 | + $bvisible = Request::getString('bvisible', '0', 'POST'); |
|
| 53 | + $bmodule = Request::getArray('bmodule', [], 'POST'); |
|
| 54 | + $btitle = Request::getString('btitle', '', 'POST'); |
|
| 55 | + $bcachetime = Request::getString('bcachetime', '0', 'POST'); |
|
| 56 | + $groups = Request::getArray('groups', [], 'POST'); |
|
| 57 | + $options = Request::getArray('options', [], 'POST'); |
|
| 58 | + $submitblock = Request::getString('submitblock', '', 'POST'); |
|
| 59 | + $fct = Request::getString('fct', '', 'POST'); |
|
| 60 | + $title = Request::getString('title', '', 'POST'); |
|
| 61 | + $side = Request::getString('side', '0', 'POST'); |
|
| 62 | + $weight = Request::getString('weight', '0', 'POST'); |
|
| 63 | + $visible = Request::getString('visible', '0', 'POST'); |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + if ('list' === $op) { |
|
| 67 | + // xoops_cp_header(); |
|
| 68 | + $blocksadmin->listBlocks(); |
|
| 69 | + require_once __DIR__ . '/admin_footer.php'; |
|
| 70 | + exit(); |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + if (\in_array($op, ['edit', 'edit_ok', 'delete', 'delete_ok', 'clone', 'clone_ok'])) { |
|
| 74 | + $bid = Request::getInt('bid', 0); |
|
| 75 | + $ok = Request::getInt('ok', 0); |
|
| 76 | + |
|
| 77 | + if ('clone' === $op) { |
|
| 78 | + $blocksadmin->cloneBlock($bid); |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + if ('delete' === $op) { |
|
| 82 | + if (1 === $ok) { |
|
| 83 | + // if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 84 | + // redirect_header($helper->url('admin/blocksadmin.php'), 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 85 | + // } |
|
| 86 | + $blocksadmin->deleteBlock($bid); |
|
| 87 | + } else { |
|
| 88 | + // xoops_cp_header(); |
|
| 89 | + xoops_confirm(['ok' => 1, 'op' => 'delete', 'bid' => $bid], 'blocksadmin.php', constant('CO_' . $moduleDirNameUpper . '_' . 'DELETE_BLOCK_CONFIRM'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); |
|
| 90 | + xoops_cp_footer(); |
|
| 91 | + } |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + if ('edit' === $op) { |
|
| 95 | + $blocksadmin->editBlock($bid); |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + if ('edit_ok' === $op) { |
|
| 99 | + $blocksadmin->updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + if ('clone_ok' === $op) { |
|
| 103 | + $blocksadmin->isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups); |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + if ('order' === $op) { |
|
| 108 | + $bid = Request::getArray('bid', []); |
|
| 109 | + |
|
| 110 | + $title = Request::getArray('title', [], 'POST'); |
|
| 111 | + $side = Request::getArray('side', [], 'POST'); |
|
| 112 | + $weight = Request::getArray('weight', [], 'POST'); |
|
| 113 | + $visible = Request::getArray('visible', [], 'POST'); |
|
| 114 | + $bcachetime = Request::getArray('bcachetime', [], 'POST'); |
|
| 115 | + $bmodule = Request::getArray('bmodule', [], 'POST');//mb |
|
| 116 | + |
|
| 117 | + $oldtitle = Request::getArray('oldtitle', [], 'POST'); |
|
| 118 | + $oldside = Request::getArray('oldside', [], 'POST'); |
|
| 119 | + $oldweight = Request::getArray('oldweight', [], 'POST'); |
|
| 120 | + $oldvisible = Request::getArray('oldvisible', [], 'POST'); |
|
| 121 | + $oldgroups = Request::getArray('oldgroups', [], 'POST'); |
|
| 122 | + $oldbcachetime = Request::getArray('oldcachetime', [], 'POST'); |
|
| 123 | + $oldbmodule = Request::getArray('oldbmodule', [], 'POST');//mb |
|
| 124 | + |
|
| 125 | + $blocksadmin->orderBlock( |
|
| 126 | + $bid, |
|
| 127 | + $oldtitle, |
|
| 128 | + $oldside, |
|
| 129 | + $oldweight, |
|
| 130 | + $oldvisible, |
|
| 131 | + $oldgroups, |
|
| 132 | + $oldbcachetime, |
|
| 133 | + $oldbmodule, |
|
| 134 | + $title, |
|
| 135 | + $weight, |
|
| 136 | + $visible, |
|
| 137 | + $side, |
|
| 138 | + $bcachetime, |
|
| 139 | + $groups, |
|
| 140 | + $bmodule |
|
| 141 | + ); |
|
| 142 | + } |
|
| 143 | 143 | } else { |
| 144 | - echo constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR403'); |
|
| 144 | + echo constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR403'); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | require __DIR__ . '/admin_footer.php'; |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | use Xmf\Module\Admin; |
| 19 | 19 | use Xmf\Request; |
| 20 | 20 | use XoopsModules\Myiframe\{ |
| 21 | - Common, |
|
| 22 | - Common\TestdataButtons, |
|
| 23 | - Helper, |
|
| 24 | - Utility |
|
| 21 | + Common, |
|
| 22 | + Common\TestdataButtons, |
|
| 23 | + Helper, |
|
| 24 | + Utility |
|
| 25 | 25 | }; |
| 26 | 26 | |
| 27 | 27 | require_once __DIR__ . '/admin_header.php'; |
@@ -32,17 +32,17 @@ discard block |
||
| 32 | 32 | $adminObject->displayNavigation(basename(__FILE__)); |
| 33 | 33 | //------------- Test Data Buttons ---------------------------- |
| 34 | 34 | if ($helper->getConfig('displaySampleButton')) { |
| 35 | - TestdataButtons::loadButtonConfig($adminObject); |
|
| 36 | - $adminObject->displayButton('left', ''); |
|
| 35 | + TestdataButtons::loadButtonConfig($adminObject); |
|
| 36 | + $adminObject->displayButton('left', ''); |
|
| 37 | 37 | } |
| 38 | 38 | $op = Request::getString('op', 0, 'GET'); |
| 39 | 39 | switch ($op) { |
| 40 | - case 'hide_buttons': |
|
| 41 | - TestdataButtons::hideButtons(); |
|
| 42 | - break; |
|
| 43 | - case 'show_buttons': |
|
| 44 | - TestdataButtons::showButtons(); |
|
| 45 | - break; |
|
| 40 | + case 'hide_buttons': |
|
| 41 | + TestdataButtons::hideButtons(); |
|
| 42 | + break; |
|
| 43 | + case 'show_buttons': |
|
| 44 | + TestdataButtons::showButtons(); |
|
| 45 | + break; |
|
| 46 | 46 | } |
| 47 | 47 | //------------- End Test Data Buttons ---------------------------- |
| 48 | 48 | |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | |
| 21 | 21 | use Xmf\Module\Admin; |
| 22 | 22 | use XoopsModules\Myiframe\{ |
| 23 | - Helper |
|
| 23 | + Helper |
|
| 24 | 24 | }; |
| 25 | 25 | /** @var Admin $adminObject */ |
| 26 | 26 | /** @var Helper $helper */ |
@@ -15,20 +15,20 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | // Verify if the table is up to date |
| 17 | 17 | if (!myiframe_FieldExists('frame_frameid', $GLOBALS['xoopsDB']->prefix('myiframe'))) { |
| 18 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `frameid` `frame_frameid` INT( 8 ) NOT NULL AUTO_INCREMENT'); |
|
| 19 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `created` `frame_created` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); |
|
| 20 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `uid` `frame_uid` MEDIUMINT( 8 ) UNSIGNED NOT NULL DEFAULT '0'"); |
|
| 21 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `longdesc` `frame_description` VARCHAR( 255 ) NOT NULL'); |
|
| 22 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `width` `frame_width` VARCHAR( 15 ) NOT NULL'); |
|
| 23 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `height` `frame_height` VARCHAR( 15 ) NOT NULL'); |
|
| 24 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `align` `frame_align` SMALLINT( 2 ) NOT NULL DEFAULT '0'"); |
|
| 25 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `frameborder` `frame_frameborder` SMALLINT( 3 ) NOT NULL DEFAULT '0'"); |
|
| 26 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `marginwidth` `frame_marginwidth` SMALLINT( 3 ) NOT NULL DEFAULT '0'"); |
|
| 27 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `marginheight` `frame_marginheight` SMALLINT( 3 ) NOT NULL DEFAULT '0'"); |
|
| 28 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `scrolling` `frame_scrolling` SMALLINT( 1 ) NOT NULL DEFAULT '0'"); |
|
| 29 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `hits` `frame_hits` INT( 8 ) UNSIGNED NOT NULL DEFAULT '0'"); |
|
| 30 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `url` `frame_url` VARCHAR( 255 ) NOT NULL'); |
|
| 31 | - header('Location : ' . XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=update&module=myiframe'); |
|
| 18 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `frameid` `frame_frameid` INT( 8 ) NOT NULL AUTO_INCREMENT'); |
|
| 19 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `created` `frame_created` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); |
|
| 20 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `uid` `frame_uid` MEDIUMINT( 8 ) UNSIGNED NOT NULL DEFAULT '0'"); |
|
| 21 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `longdesc` `frame_description` VARCHAR( 255 ) NOT NULL'); |
|
| 22 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `width` `frame_width` VARCHAR( 15 ) NOT NULL'); |
|
| 23 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `height` `frame_height` VARCHAR( 15 ) NOT NULL'); |
|
| 24 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `align` `frame_align` SMALLINT( 2 ) NOT NULL DEFAULT '0'"); |
|
| 25 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `frameborder` `frame_frameborder` SMALLINT( 3 ) NOT NULL DEFAULT '0'"); |
|
| 26 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `marginwidth` `frame_marginwidth` SMALLINT( 3 ) NOT NULL DEFAULT '0'"); |
|
| 27 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `marginheight` `frame_marginheight` SMALLINT( 3 ) NOT NULL DEFAULT '0'"); |
|
| 28 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `scrolling` `frame_scrolling` SMALLINT( 1 ) NOT NULL DEFAULT '0'"); |
|
| 29 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `hits` `frame_hits` INT( 8 ) UNSIGNED NOT NULL DEFAULT '0'"); |
|
| 30 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `url` `frame_url` VARCHAR( 255 ) NOT NULL'); |
|
| 31 | + header('Location : ' . XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=update&module=myiframe'); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | $module_id = $xoopsModule->getVar('mid'); |
@@ -53,48 +53,48 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | function addEditForm($frameid, $Action, $FormTitle, $longdesc, $width, $height, $align, $frameborder, $marginwidth, $marginheight, $scrolling, $url, $LabelSubmitButton): void |
| 55 | 55 | { |
| 56 | - require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
| 57 | - global $xoopsModule; |
|
| 56 | + require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
| 57 | + global $xoopsModule; |
|
| 58 | 58 | |
| 59 | - $sform = new \XoopsThemeForm($FormTitle, 'indexform', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/manage.php'); |
|
| 60 | - $sform->addElement(new \XoopsFormText(_AM_MYIFRAME_DESC, 'longdesc', 50, 255, $longdesc), false); |
|
| 61 | - $sform->addElement(new \XoopsFormText(_AM_MYIFRAME_WIDTH, 'width', 10, 15, $width), false); |
|
| 62 | - $sform->addElement(new \XoopsFormText(_AM_MYIFRAME_HEIGHT, 'height', 10, 15, $height), false); |
|
| 59 | + $sform = new \XoopsThemeForm($FormTitle, 'indexform', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/manage.php'); |
|
| 60 | + $sform->addElement(new \XoopsFormText(_AM_MYIFRAME_DESC, 'longdesc', 50, 255, $longdesc), false); |
|
| 61 | + $sform->addElement(new \XoopsFormText(_AM_MYIFRAME_WIDTH, 'width', 10, 15, $width), false); |
|
| 62 | + $sform->addElement(new \XoopsFormText(_AM_MYIFRAME_HEIGHT, 'height', 10, 15, $height), false); |
|
| 63 | 63 | |
| 64 | - $selalign = new \XoopsFormSelect(_AM_MYIFRAME_ALIGN, 'align', $align); |
|
| 65 | - $selalign->addOption(1, _AM_MYIFRAME_ALIGN_TOP); |
|
| 66 | - $selalign->addOption(2, _AM_MYIFRAME_ALIGN_MIDDLE); |
|
| 67 | - $selalign->addOption(3, _AM_MYIFRAME_ALIGN_BOTTOM); |
|
| 68 | - $selalign->addOption(4, _AM_MYIFRAME_ALIGN_LEFT); |
|
| 69 | - $selalign->addOption(5, _AM_MYIFRAME_ALIGN_RIGHT); |
|
| 70 | - $selalign->setValue($align); |
|
| 71 | - $sform->addElement($selalign); |
|
| 64 | + $selalign = new \XoopsFormSelect(_AM_MYIFRAME_ALIGN, 'align', $align); |
|
| 65 | + $selalign->addOption(1, _AM_MYIFRAME_ALIGN_TOP); |
|
| 66 | + $selalign->addOption(2, _AM_MYIFRAME_ALIGN_MIDDLE); |
|
| 67 | + $selalign->addOption(3, _AM_MYIFRAME_ALIGN_BOTTOM); |
|
| 68 | + $selalign->addOption(4, _AM_MYIFRAME_ALIGN_LEFT); |
|
| 69 | + $selalign->addOption(5, _AM_MYIFRAME_ALIGN_RIGHT); |
|
| 70 | + $selalign->setValue($align); |
|
| 71 | + $sform->addElement($selalign); |
|
| 72 | 72 | |
| 73 | - $sform->addElement(new \XoopsFormText(_AM_MYIFRAME_FRAMEBORDER, 'frameborder', 3, 3, $frameborder), false); |
|
| 74 | - $sform->addElement(new \XoopsFormText(_AM_MYIFRAME_MARGINWIDTH, 'marginwidth', 3, 3, $marginwidth), false); |
|
| 75 | - $sform->addElement(new \XoopsFormText(_AM_MYIFRAME_MARGINHEIGHT, 'marginheight', 3, 3, $marginheight), false); |
|
| 73 | + $sform->addElement(new \XoopsFormText(_AM_MYIFRAME_FRAMEBORDER, 'frameborder', 3, 3, $frameborder), false); |
|
| 74 | + $sform->addElement(new \XoopsFormText(_AM_MYIFRAME_MARGINWIDTH, 'marginwidth', 3, 3, $marginwidth), false); |
|
| 75 | + $sform->addElement(new \XoopsFormText(_AM_MYIFRAME_MARGINHEIGHT, 'marginheight', 3, 3, $marginheight), false); |
|
| 76 | 76 | |
| 77 | - $selscroll = new \XoopsFormSelect(_AM_MYIFRAME_SCROLLING, 'scrolling', $scrolling); |
|
| 78 | - $selscroll->addOption(1, _YES); |
|
| 79 | - $selscroll->addOption(2, _NO); |
|
| 80 | - $selscroll->addOption(3, _AM_MYIFRAME_AUTO); |
|
| 81 | - $selscroll->setValue($scrolling); |
|
| 82 | - $sform->addElement($selscroll); |
|
| 77 | + $selscroll = new \XoopsFormSelect(_AM_MYIFRAME_SCROLLING, 'scrolling', $scrolling); |
|
| 78 | + $selscroll->addOption(1, _YES); |
|
| 79 | + $selscroll->addOption(2, _NO); |
|
| 80 | + $selscroll->addOption(3, _AM_MYIFRAME_AUTO); |
|
| 81 | + $selscroll->setValue($scrolling); |
|
| 82 | + $sform->addElement($selscroll); |
|
| 83 | 83 | |
| 84 | - $sform->addElement(new \XoopsFormText(_AM_MYIFRAME_URL, 'url', 50, 255, $url), true); |
|
| 85 | - $sform->addElement(new \XoopsFormHidden('op', $Action), false); |
|
| 86 | - if (!empty($frameid)) { |
|
| 87 | - $sform->addElement(new \XoopsFormHidden('frameid', $frameid), false); |
|
| 88 | - } |
|
| 84 | + $sform->addElement(new \XoopsFormText(_AM_MYIFRAME_URL, 'url', 50, 255, $url), true); |
|
| 85 | + $sform->addElement(new \XoopsFormHidden('op', $Action), false); |
|
| 86 | + if (!empty($frameid)) { |
|
| 87 | + $sform->addElement(new \XoopsFormHidden('frameid', $frameid), false); |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - $buttonTray = new \XoopsFormElementTray('', ''); |
|
| 91 | - $submit_btn = new \XoopsFormButton('', 'submit', $LabelSubmitButton, 'submit'); |
|
| 92 | - $buttonTray->addElement($submit_btn); |
|
| 93 | - $cancel_btn = new \XoopsFormButton('', 'reset', _AM_MYIFRAME_RESETBUTTON, 'reset'); |
|
| 94 | - $buttonTray->addElement($cancel_btn); |
|
| 95 | - $sform->addElement($buttonTray); |
|
| 96 | - $sform->display(); |
|
| 97 | - require_once __DIR__ . '/admin_footer.php'; |
|
| 90 | + $buttonTray = new \XoopsFormElementTray('', ''); |
|
| 91 | + $submit_btn = new \XoopsFormButton('', 'submit', $LabelSubmitButton, 'submit'); |
|
| 92 | + $buttonTray->addElement($submit_btn); |
|
| 93 | + $cancel_btn = new \XoopsFormButton('', 'reset', _AM_MYIFRAME_RESETBUTTON, 'reset'); |
|
| 94 | + $buttonTray->addElement($cancel_btn); |
|
| 95 | + $sform->addElement($buttonTray); |
|
| 96 | + $sform->display(); |
|
| 97 | + require_once __DIR__ . '/admin_footer.php'; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // ****************************************************************************************************************************************** |
@@ -104,191 +104,191 @@ discard block |
||
| 104 | 104 | $op = Request::getCmd('op', ''); |
| 105 | 105 | |
| 106 | 106 | switch ($op) { |
| 107 | - case 'verifybeforeedit': |
|
| 108 | - if (Request::hasVar('submit', 'POST') && '' !== $_POST['submit']) { |
|
| 109 | - if ('' === $_POST['longdesc']) { |
|
| 110 | - xoops_cp_header(); |
|
| 111 | - $adminObject = Admin::getInstance(); |
|
| 112 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
| 113 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>\n"; |
|
| 114 | - echo '<tr><td class="odd">'; |
|
| 115 | - echo "<a href='manage.php'><h4>" . _AM_MYIFRAME_CONFIG . '</h4></a>'; |
|
| 116 | - echo _AM_MYIFRAME_ERROR_ADD_INDEX . ' 1'; |
|
| 117 | - echo '</td></tr></table>'; |
|
| 118 | - require_once __DIR__ . '/admin_footer.php'; |
|
| 119 | - xoops_cp_footer(); |
|
| 120 | - exit(); |
|
| 121 | - } |
|
| 107 | + case 'verifybeforeedit': |
|
| 108 | + if (Request::hasVar('submit', 'POST') && '' !== $_POST['submit']) { |
|
| 109 | + if ('' === $_POST['longdesc']) { |
|
| 110 | + xoops_cp_header(); |
|
| 111 | + $adminObject = Admin::getInstance(); |
|
| 112 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
| 113 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>\n"; |
|
| 114 | + echo '<tr><td class="odd">'; |
|
| 115 | + echo "<a href='manage.php'><h4>" . _AM_MYIFRAME_CONFIG . '</h4></a>'; |
|
| 116 | + echo _AM_MYIFRAME_ERROR_ADD_INDEX . ' 1'; |
|
| 117 | + echo '</td></tr></table>'; |
|
| 118 | + require_once __DIR__ . '/admin_footer.php'; |
|
| 119 | + xoops_cp_footer(); |
|
| 120 | + exit(); |
|
| 121 | + } |
|
| 122 | 122 | |
| 123 | - $frameid = $_POST['frameid']; |
|
| 124 | - $frame = $iframeHandler->get($frameid); |
|
| 125 | - $frame->unsetNew(); |
|
| 126 | - $frame->setVar('frame_description', $_POST['longdesc']); |
|
| 127 | - $frame->setVar('frame_width', $_POST['width']); |
|
| 128 | - $frame->setVar('frame_height', $_POST['height']); |
|
| 129 | - $frame->setVar('frame_align', $_POST['align']); |
|
| 130 | - $frame->setVar('frame_frameborder', $_POST['frameborder']); |
|
| 131 | - $frame->setVar('frame_marginwidth', $_POST['marginwidth']); |
|
| 132 | - $frame->setVar('frame_marginheight', $_POST['marginheight']); |
|
| 133 | - $frame->setVar('frame_scrolling', $_POST['scrolling']); |
|
| 134 | - $frame->setVar('frame_url', $_POST['url']); |
|
| 135 | - $frame->setVar('frame_uid', $xoopsUser->getVar('uid')); |
|
| 136 | - $res = $iframeHandler->insert($frame); |
|
| 137 | - if (!$res) { |
|
| 138 | - redirect_header('manage.php', 1, _AM_MYIFRAME_ERROR_MODIFY_DB); |
|
| 139 | - } |
|
| 140 | - redirect_header('manage.php', 1, _AM_MYIFRAME_DBUPDATED); |
|
| 141 | - } |
|
| 142 | - break; |
|
| 143 | - case 'edit': |
|
| 144 | - xoops_cp_header(); |
|
| 145 | - $adminObject = Admin::getInstance(); |
|
| 146 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
| 147 | - if (Request::hasVar('frameid', 'GET')) { |
|
| 148 | - $frameid = Request::getInt('frameid', 0, 'GET'); |
|
| 149 | - $frame = $iframeHandler->get($frameid); |
|
| 150 | - addEditForm( |
|
| 151 | - $frameid, |
|
| 152 | - 'verifybeforeedit', |
|
| 153 | - _AM_MYIFRAME_CONFIG, |
|
| 154 | - $frame->getVar('frame_description', 'e'), |
|
| 155 | - $frame->getVar('frame_width', 'e'), |
|
| 156 | - $frame->getVar('frame_height', 'e'), |
|
| 157 | - $frame->getVar('frame_align', 'e'), |
|
| 158 | - $frame->getVar('frame_frameborder', 'e'), |
|
| 159 | - $frame->getVar('frame_marginwidth', 'e'), |
|
| 160 | - $frame->getVar('frame_marginheight', 'e'), |
|
| 161 | - $frame->getVar('frame_scrolling', 'e'), |
|
| 162 | - $frame->getVar('frame_url', 'e'), |
|
| 163 | - _AM_MYIFRAME_UPDATE |
|
| 164 | - ); |
|
| 165 | - } else { |
|
| 166 | - xoops_cp_header(); |
|
| 167 | - $adminObject = Admin::getInstance(); |
|
| 168 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
| 169 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>\n"; |
|
| 170 | - echo '<tr><td class="odd">'; |
|
| 171 | - echo "<a href='manage.php'><h4>" . _AM_MYIFRAME_CONFIG . '</h4></a>'; |
|
| 172 | - echo _AM_MYIFRAME_ERROR_ADD_INDEX. ' 2'; |
|
| 173 | - echo "</td></tr></table>\n"; |
|
| 174 | - require_once __DIR__ . '/admin_footer.php'; |
|
| 175 | - xoops_cp_footer(); |
|
| 176 | - exit(); |
|
| 177 | - } |
|
| 178 | - break; |
|
| 179 | - case 'delete': |
|
| 180 | - if (!isset($_POST['ok'])) { |
|
| 181 | - xoops_cp_header(); |
|
| 182 | - $adminObject = Admin::getInstance(); |
|
| 183 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
| 184 | - echo '<h4>' . _AM_MYIFRAME_CONFIG . '</h4>'; |
|
| 185 | - xoops_confirm( |
|
| 186 | - [ |
|
| 187 | - 'op' => 'delete', |
|
| 188 | - 'frameid' => Request::getInt('frameid', 0, 'GET'), |
|
| 189 | - 'ok' => 1, |
|
| 190 | - ], |
|
| 191 | - 'manage.php', |
|
| 192 | - _AM_MYIFRAME_RUSUREDEL |
|
| 193 | - ); |
|
| 194 | - require_once __DIR__ . '/admin_footer.php'; |
|
| 195 | - } else { |
|
| 196 | - if (empty($_POST['frameid'])) { |
|
| 197 | - redirect_header('manage.php', 2, _AM_MYIFRAME_ERROR_ADD_INDEX. ' 3'); |
|
| 198 | - } |
|
| 199 | - $frameid = Request::getInt('frameid', 0, 'POST'); |
|
| 200 | - $critere = new \Criteria('frame_frameid', $frameid, '='); |
|
| 201 | - $iframeHandler->deleteAll($critere); |
|
| 202 | - redirect_header('manage.php', 1, _AM_MYIFRAME_DBUPDATED); |
|
| 203 | - } |
|
| 204 | - break; |
|
| 205 | - case 'verifytoadd': |
|
| 206 | - if (Request::hasVar('submit', 'POST') && '' !== $_POST['submit']) { |
|
| 207 | - if ('' === $_POST['url']) { |
|
| 208 | - xoops_cp_header(); |
|
| 209 | - $adminObject = Admin::getInstance(); |
|
| 210 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
| 211 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>\n"; |
|
| 212 | - echo '<tr><td class="odd">'; |
|
| 213 | - echo "<a href='manage.php'><h4>" . _AM_MYIFRAME_CONFIG . '</h4></a>'; |
|
| 214 | - echo _AM_MYIFRAME_ERROR_ADD_INDEX. ' 4'; |
|
| 215 | - echo "</td></tr></table>\n"; |
|
| 216 | - require_once __DIR__ . '/admin_footer.php'; |
|
| 217 | - xoops_cp_footer(); |
|
| 218 | - $adminObject = Admin::getInstance(); |
|
| 219 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
| 220 | - exit(); |
|
| 221 | - } |
|
| 222 | - $frame = $iframeHandler->create(true); |
|
| 223 | - $frame->setVar('frame_description', $_POST['longdesc']); |
|
| 224 | - $frame->setVar('frame_width', $_POST['width']); |
|
| 225 | - $frame->setVar('frame_height', $_POST['height']); |
|
| 226 | - $frame->setVar('frame_align', $_POST['align']); |
|
| 227 | - $frame->setVar('frame_frameborder', $_POST['frameborder']); |
|
| 228 | - $frame->setVar('frame_marginwidth', $_POST['marginwidth']); |
|
| 229 | - $frame->setVar('frame_marginheight', $_POST['marginheight']); |
|
| 230 | - $frame->setVar('frame_scrolling', $_POST['scrolling']); |
|
| 231 | - $frame->setVar('frame_url', $_POST['url']); |
|
| 232 | - $frame->setVar('frame_created', time()); |
|
| 233 | - $frame->setVar('frame_uid', $xoopsUser->getVar('uid')); |
|
| 234 | - $res = $iframeHandler->insert($frame); |
|
| 235 | - if (!$res) { |
|
| 236 | - redirect_header('manage.php', 1, _AM_MYIFRAME_ERROR_ADD_INDEX. ' 5'); |
|
| 237 | - } |
|
| 238 | - redirect_header('manage.php', 1, _AM_MYIFRAME_ADDED_OK); |
|
| 239 | - } |
|
| 240 | - break; |
|
| 241 | - case 'addframe': |
|
| 242 | - xoops_cp_header(); |
|
| 243 | - $adminObject = Admin::getInstance(); |
|
| 244 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
| 245 | - addEditForm(0, 'verifytoadd', _AM_MYIFRAME_CONFIG, '', '100%', '', '', '0', '0', '0', 1, '', _AM_MYIFRAME_ADDBUTTON); |
|
| 246 | - break; |
|
| 247 | - case 'default': |
|
| 248 | - default: |
|
| 249 | - xoops_cp_header(); |
|
| 250 | - $adminObject = Admin::getInstance(); |
|
| 251 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
| 252 | - echo '<h4>' . _AM_MYIFRAME_CONFIG . "</h4><br>\n"; |
|
| 253 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>\n"; |
|
| 254 | - echo "<tr><th align='center'>" . _AM_MYIFRAME_ID . "</th><th align='center'>" . _AM_MYIFRAME_DESC . "</th><th align='center'>" . _AM_MYIFRAME_CREATED . "</th><th align='center'>" . _AM_MYIFRAME_HITS . "</th><th align='center'>" . _AM_MYIFRAME_ACTION . "</th></tr>\n"; |
|
| 255 | - $critere = new \Criteria('1', '1', '='); |
|
| 256 | - $critere->setSort('frame_description'); |
|
| 257 | - $frarray = $iframeHandler->getObjects($critere); |
|
| 258 | - $class = 'even'; |
|
| 259 | - $baseurl = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/manage.php'; |
|
| 260 | - if (count($frarray) > 0) { |
|
| 261 | - /** @var Myiframe $frame */ |
|
| 262 | - foreach ($frarray as $frame) { |
|
| 263 | - $action_edit = "<a href='" . $baseurl . '?op=edit&frameid=' . $frame->getVar('frame_frameid') . "'><img src='../assets/images/edit.png' alt='" . _AM_MYIFRAME_EDIT . "'></a>"; |
|
| 264 | - $action_delete = "<a href='" . $baseurl . '?op=delete&frameid=' . $frame->getVar('frame_frameid') . "'><img src='../assets/images/delete.png' alt='" . _AM_MYIFRAME_DELETE . "'></a>"; |
|
| 265 | - if ('' === xoops_trim($frame->getVar('frame_description'))) { |
|
| 266 | - $liendesc = $frame->getVar('frame_url'); |
|
| 267 | - } else { |
|
| 268 | - $liendesc = "<a href='" . XOOPS_URL . '/modules/myiframe/index.php?iframeid=' . $frame->getVar('frame_frameid') . "'>" . $frame->getVar('frame_description') . '</a>'; |
|
| 269 | - } |
|
| 270 | - echo "<tr class='" |
|
| 271 | - . $class |
|
| 272 | - . "'><td align='center'>" |
|
| 273 | - . $frame->getVar('frame_frameid') |
|
| 274 | - . "</td><td align='center'>" |
|
| 275 | - . $liendesc |
|
| 276 | - . "</td><td align='center'>" |
|
| 277 | - . formatTimestamp($frame->getVar('frame_created')) |
|
| 278 | - . "</td><td align='center'>" |
|
| 279 | - . $frame->getVar('frame_hits') |
|
| 280 | - . "</td><td align='center'>" |
|
| 281 | - . $action_edit |
|
| 282 | - . ' - ' |
|
| 283 | - . $action_delete |
|
| 284 | - . "</td></tr>\n"; |
|
| 285 | - $class = ('even' === $class) ? 'odd' : 'even'; |
|
| 286 | - } |
|
| 287 | - } |
|
| 288 | - echo "<tr class='" . $class . "'><td colspan='5' align='center'><form name='faddframe' method='post' action='manage.php'><input type='hidden' name='op' value='addframe'><input type='submit' name='submit' value='" . _AM_MYIFRAME_ADD . "'></td></tr>"; |
|
| 289 | - echo '</table>'; |
|
| 290 | - require_once __DIR__ . '/admin_footer.php'; |
|
| 291 | - break; |
|
| 123 | + $frameid = $_POST['frameid']; |
|
| 124 | + $frame = $iframeHandler->get($frameid); |
|
| 125 | + $frame->unsetNew(); |
|
| 126 | + $frame->setVar('frame_description', $_POST['longdesc']); |
|
| 127 | + $frame->setVar('frame_width', $_POST['width']); |
|
| 128 | + $frame->setVar('frame_height', $_POST['height']); |
|
| 129 | + $frame->setVar('frame_align', $_POST['align']); |
|
| 130 | + $frame->setVar('frame_frameborder', $_POST['frameborder']); |
|
| 131 | + $frame->setVar('frame_marginwidth', $_POST['marginwidth']); |
|
| 132 | + $frame->setVar('frame_marginheight', $_POST['marginheight']); |
|
| 133 | + $frame->setVar('frame_scrolling', $_POST['scrolling']); |
|
| 134 | + $frame->setVar('frame_url', $_POST['url']); |
|
| 135 | + $frame->setVar('frame_uid', $xoopsUser->getVar('uid')); |
|
| 136 | + $res = $iframeHandler->insert($frame); |
|
| 137 | + if (!$res) { |
|
| 138 | + redirect_header('manage.php', 1, _AM_MYIFRAME_ERROR_MODIFY_DB); |
|
| 139 | + } |
|
| 140 | + redirect_header('manage.php', 1, _AM_MYIFRAME_DBUPDATED); |
|
| 141 | + } |
|
| 142 | + break; |
|
| 143 | + case 'edit': |
|
| 144 | + xoops_cp_header(); |
|
| 145 | + $adminObject = Admin::getInstance(); |
|
| 146 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
| 147 | + if (Request::hasVar('frameid', 'GET')) { |
|
| 148 | + $frameid = Request::getInt('frameid', 0, 'GET'); |
|
| 149 | + $frame = $iframeHandler->get($frameid); |
|
| 150 | + addEditForm( |
|
| 151 | + $frameid, |
|
| 152 | + 'verifybeforeedit', |
|
| 153 | + _AM_MYIFRAME_CONFIG, |
|
| 154 | + $frame->getVar('frame_description', 'e'), |
|
| 155 | + $frame->getVar('frame_width', 'e'), |
|
| 156 | + $frame->getVar('frame_height', 'e'), |
|
| 157 | + $frame->getVar('frame_align', 'e'), |
|
| 158 | + $frame->getVar('frame_frameborder', 'e'), |
|
| 159 | + $frame->getVar('frame_marginwidth', 'e'), |
|
| 160 | + $frame->getVar('frame_marginheight', 'e'), |
|
| 161 | + $frame->getVar('frame_scrolling', 'e'), |
|
| 162 | + $frame->getVar('frame_url', 'e'), |
|
| 163 | + _AM_MYIFRAME_UPDATE |
|
| 164 | + ); |
|
| 165 | + } else { |
|
| 166 | + xoops_cp_header(); |
|
| 167 | + $adminObject = Admin::getInstance(); |
|
| 168 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
| 169 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>\n"; |
|
| 170 | + echo '<tr><td class="odd">'; |
|
| 171 | + echo "<a href='manage.php'><h4>" . _AM_MYIFRAME_CONFIG . '</h4></a>'; |
|
| 172 | + echo _AM_MYIFRAME_ERROR_ADD_INDEX. ' 2'; |
|
| 173 | + echo "</td></tr></table>\n"; |
|
| 174 | + require_once __DIR__ . '/admin_footer.php'; |
|
| 175 | + xoops_cp_footer(); |
|
| 176 | + exit(); |
|
| 177 | + } |
|
| 178 | + break; |
|
| 179 | + case 'delete': |
|
| 180 | + if (!isset($_POST['ok'])) { |
|
| 181 | + xoops_cp_header(); |
|
| 182 | + $adminObject = Admin::getInstance(); |
|
| 183 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
| 184 | + echo '<h4>' . _AM_MYIFRAME_CONFIG . '</h4>'; |
|
| 185 | + xoops_confirm( |
|
| 186 | + [ |
|
| 187 | + 'op' => 'delete', |
|
| 188 | + 'frameid' => Request::getInt('frameid', 0, 'GET'), |
|
| 189 | + 'ok' => 1, |
|
| 190 | + ], |
|
| 191 | + 'manage.php', |
|
| 192 | + _AM_MYIFRAME_RUSUREDEL |
|
| 193 | + ); |
|
| 194 | + require_once __DIR__ . '/admin_footer.php'; |
|
| 195 | + } else { |
|
| 196 | + if (empty($_POST['frameid'])) { |
|
| 197 | + redirect_header('manage.php', 2, _AM_MYIFRAME_ERROR_ADD_INDEX. ' 3'); |
|
| 198 | + } |
|
| 199 | + $frameid = Request::getInt('frameid', 0, 'POST'); |
|
| 200 | + $critere = new \Criteria('frame_frameid', $frameid, '='); |
|
| 201 | + $iframeHandler->deleteAll($critere); |
|
| 202 | + redirect_header('manage.php', 1, _AM_MYIFRAME_DBUPDATED); |
|
| 203 | + } |
|
| 204 | + break; |
|
| 205 | + case 'verifytoadd': |
|
| 206 | + if (Request::hasVar('submit', 'POST') && '' !== $_POST['submit']) { |
|
| 207 | + if ('' === $_POST['url']) { |
|
| 208 | + xoops_cp_header(); |
|
| 209 | + $adminObject = Admin::getInstance(); |
|
| 210 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
| 211 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>\n"; |
|
| 212 | + echo '<tr><td class="odd">'; |
|
| 213 | + echo "<a href='manage.php'><h4>" . _AM_MYIFRAME_CONFIG . '</h4></a>'; |
|
| 214 | + echo _AM_MYIFRAME_ERROR_ADD_INDEX. ' 4'; |
|
| 215 | + echo "</td></tr></table>\n"; |
|
| 216 | + require_once __DIR__ . '/admin_footer.php'; |
|
| 217 | + xoops_cp_footer(); |
|
| 218 | + $adminObject = Admin::getInstance(); |
|
| 219 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
| 220 | + exit(); |
|
| 221 | + } |
|
| 222 | + $frame = $iframeHandler->create(true); |
|
| 223 | + $frame->setVar('frame_description', $_POST['longdesc']); |
|
| 224 | + $frame->setVar('frame_width', $_POST['width']); |
|
| 225 | + $frame->setVar('frame_height', $_POST['height']); |
|
| 226 | + $frame->setVar('frame_align', $_POST['align']); |
|
| 227 | + $frame->setVar('frame_frameborder', $_POST['frameborder']); |
|
| 228 | + $frame->setVar('frame_marginwidth', $_POST['marginwidth']); |
|
| 229 | + $frame->setVar('frame_marginheight', $_POST['marginheight']); |
|
| 230 | + $frame->setVar('frame_scrolling', $_POST['scrolling']); |
|
| 231 | + $frame->setVar('frame_url', $_POST['url']); |
|
| 232 | + $frame->setVar('frame_created', time()); |
|
| 233 | + $frame->setVar('frame_uid', $xoopsUser->getVar('uid')); |
|
| 234 | + $res = $iframeHandler->insert($frame); |
|
| 235 | + if (!$res) { |
|
| 236 | + redirect_header('manage.php', 1, _AM_MYIFRAME_ERROR_ADD_INDEX. ' 5'); |
|
| 237 | + } |
|
| 238 | + redirect_header('manage.php', 1, _AM_MYIFRAME_ADDED_OK); |
|
| 239 | + } |
|
| 240 | + break; |
|
| 241 | + case 'addframe': |
|
| 242 | + xoops_cp_header(); |
|
| 243 | + $adminObject = Admin::getInstance(); |
|
| 244 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
| 245 | + addEditForm(0, 'verifytoadd', _AM_MYIFRAME_CONFIG, '', '100%', '', '', '0', '0', '0', 1, '', _AM_MYIFRAME_ADDBUTTON); |
|
| 246 | + break; |
|
| 247 | + case 'default': |
|
| 248 | + default: |
|
| 249 | + xoops_cp_header(); |
|
| 250 | + $adminObject = Admin::getInstance(); |
|
| 251 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
| 252 | + echo '<h4>' . _AM_MYIFRAME_CONFIG . "</h4><br>\n"; |
|
| 253 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>\n"; |
|
| 254 | + echo "<tr><th align='center'>" . _AM_MYIFRAME_ID . "</th><th align='center'>" . _AM_MYIFRAME_DESC . "</th><th align='center'>" . _AM_MYIFRAME_CREATED . "</th><th align='center'>" . _AM_MYIFRAME_HITS . "</th><th align='center'>" . _AM_MYIFRAME_ACTION . "</th></tr>\n"; |
|
| 255 | + $critere = new \Criteria('1', '1', '='); |
|
| 256 | + $critere->setSort('frame_description'); |
|
| 257 | + $frarray = $iframeHandler->getObjects($critere); |
|
| 258 | + $class = 'even'; |
|
| 259 | + $baseurl = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/manage.php'; |
|
| 260 | + if (count($frarray) > 0) { |
|
| 261 | + /** @var Myiframe $frame */ |
|
| 262 | + foreach ($frarray as $frame) { |
|
| 263 | + $action_edit = "<a href='" . $baseurl . '?op=edit&frameid=' . $frame->getVar('frame_frameid') . "'><img src='../assets/images/edit.png' alt='" . _AM_MYIFRAME_EDIT . "'></a>"; |
|
| 264 | + $action_delete = "<a href='" . $baseurl . '?op=delete&frameid=' . $frame->getVar('frame_frameid') . "'><img src='../assets/images/delete.png' alt='" . _AM_MYIFRAME_DELETE . "'></a>"; |
|
| 265 | + if ('' === xoops_trim($frame->getVar('frame_description'))) { |
|
| 266 | + $liendesc = $frame->getVar('frame_url'); |
|
| 267 | + } else { |
|
| 268 | + $liendesc = "<a href='" . XOOPS_URL . '/modules/myiframe/index.php?iframeid=' . $frame->getVar('frame_frameid') . "'>" . $frame->getVar('frame_description') . '</a>'; |
|
| 269 | + } |
|
| 270 | + echo "<tr class='" |
|
| 271 | + . $class |
|
| 272 | + . "'><td align='center'>" |
|
| 273 | + . $frame->getVar('frame_frameid') |
|
| 274 | + . "</td><td align='center'>" |
|
| 275 | + . $liendesc |
|
| 276 | + . "</td><td align='center'>" |
|
| 277 | + . formatTimestamp($frame->getVar('frame_created')) |
|
| 278 | + . "</td><td align='center'>" |
|
| 279 | + . $frame->getVar('frame_hits') |
|
| 280 | + . "</td><td align='center'>" |
|
| 281 | + . $action_edit |
|
| 282 | + . ' - ' |
|
| 283 | + . $action_delete |
|
| 284 | + . "</td></tr>\n"; |
|
| 285 | + $class = ('even' === $class) ? 'odd' : 'even'; |
|
| 286 | + } |
|
| 287 | + } |
|
| 288 | + echo "<tr class='" . $class . "'><td colspan='5' align='center'><form name='faddframe' method='post' action='manage.php'><input type='hidden' name='op' value='addframe'><input type='submit' name='submit' value='" . _AM_MYIFRAME_ADD . "'></td></tr>"; |
|
| 289 | + echo '</table>'; |
|
| 290 | + require_once __DIR__ . '/admin_footer.php'; |
|
| 291 | + break; |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | xoops_cp_footer(); |
@@ -18,10 +18,10 @@ |
||
| 18 | 18 | $pathIcon32 = Xmf\Module\Admin::iconUrl('', 32); |
| 19 | 19 | |
| 20 | 20 | echo "<div class='adminfooter'>\n" |
| 21 | - . " <div style='text-align: center;'>\n" |
|
| 22 | - . " <a href='https://xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" |
|
| 23 | - . " </div>\n" |
|
| 24 | - . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" |
|
| 25 | - . '</div>'; |
|
| 21 | + . " <div style='text-align: center;'>\n" |
|
| 22 | + . " <a href='https://xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" |
|
| 23 | + . " </div>\n" |
|
| 24 | + . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" |
|
| 25 | + . '</div>'; |
|
| 26 | 26 | |
| 27 | 27 | xoops_cp_footer(); |
@@ -21,45 +21,45 @@ |
||
| 21 | 21 | $pathIcon32 = Admin::menuIconPath(''); |
| 22 | 22 | $pathModIcon32 = XOOPS_URL . '/modules/' . $moduleDirName . '/assets/images/icons/32/'; |
| 23 | 23 | if (is_object($helper->getModule()) |
| 24 | - && false !== $helper->getModule() |
|
| 25 | - ->getInfo('modicons32')) { |
|
| 26 | - $pathModIcon32 = $helper->url( |
|
| 27 | - $helper->getModule() |
|
| 28 | - ->getInfo('modicons32') |
|
| 29 | - ); |
|
| 24 | + && false !== $helper->getModule() |
|
| 25 | + ->getInfo('modicons32')) { |
|
| 26 | + $pathModIcon32 = $helper->url( |
|
| 27 | + $helper->getModule() |
|
| 28 | + ->getInfo('modicons32') |
|
| 29 | + ); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | $adminmenu[] = [ |
| 33 | - 'title' => _MI_MYIFRAME_NAME, |
|
| 34 | - 'link' => 'admin/index.php', |
|
| 35 | - 'icon' => $pathIcon32 . '/home.png', |
|
| 33 | + 'title' => _MI_MYIFRAME_NAME, |
|
| 34 | + 'link' => 'admin/index.php', |
|
| 35 | + 'icon' => $pathIcon32 . '/home.png', |
|
| 36 | 36 | ]; |
| 37 | 37 | |
| 38 | 38 | $adminmenu[] = [ |
| 39 | - 'title' => _MI_MYIFRAME_ADMENU1, |
|
| 40 | - 'link' => 'admin/manage.php', |
|
| 41 | - 'icon' => $pathIcon32 . '/manage.png', |
|
| 39 | + 'title' => _MI_MYIFRAME_ADMENU1, |
|
| 40 | + 'link' => 'admin/manage.php', |
|
| 41 | + 'icon' => $pathIcon32 . '/manage.png', |
|
| 42 | 42 | ]; |
| 43 | 43 | |
| 44 | 44 | // Blocks Admin |
| 45 | 45 | $adminmenu[] = [ |
| 46 | - 'title' => constant('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS'), |
|
| 47 | - 'link' => 'admin/blocksadmin.php', |
|
| 48 | - 'icon' => $pathIcon32 . '/block.png', |
|
| 46 | + 'title' => constant('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS'), |
|
| 47 | + 'link' => 'admin/blocksadmin.php', |
|
| 48 | + 'icon' => $pathIcon32 . '/block.png', |
|
| 49 | 49 | ]; |
| 50 | 50 | |
| 51 | 51 | if (is_object($helper->getModule()) && $helper->getConfig('displayDeveloperTools')) { |
| 52 | - $adminmenu[] = [ |
|
| 53 | - 'title' => constant('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE'), |
|
| 54 | - 'link' => 'admin/migrate.php', |
|
| 55 | - 'icon' => $pathIcon32 . '/database_go.png', |
|
| 56 | - ]; |
|
| 52 | + $adminmenu[] = [ |
|
| 53 | + 'title' => constant('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE'), |
|
| 54 | + 'link' => 'admin/migrate.php', |
|
| 55 | + 'icon' => $pathIcon32 . '/database_go.png', |
|
| 56 | + ]; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // Category |
| 60 | 60 | $adminmenu[] = [ |
| 61 | - 'title' => _MI_MYIFRAME_ADMENU2, |
|
| 62 | - 'link' => 'admin/about.php', |
|
| 63 | - 'icon' => $pathIcon32 . '/about.png', |
|
| 61 | + 'title' => _MI_MYIFRAME_ADMENU2, |
|
| 62 | + 'link' => 'admin/about.php', |
|
| 63 | + 'icon' => $pathIcon32 . '/about.png', |
|
| 64 | 64 | |
| 65 | 65 | ]; |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | use Xmf\Request; |
| 22 | 22 | use Xmf\Yaml; |
| 23 | 23 | use XoopsModules\Myiframe\{ |
| 24 | - Helper, |
|
| 25 | - Common\Configurator, |
|
| 26 | - Utility |
|
| 24 | + Helper, |
|
| 25 | + Common\Configurator, |
|
| 26 | + Utility |
|
| 27 | 27 | }; |
| 28 | 28 | /** @var Helper $helper */ |
| 29 | 29 | /** @var Utility $utility */ |
@@ -42,122 +42,122 @@ discard block |
||
| 42 | 42 | $helper->loadLanguage('common'); |
| 43 | 43 | |
| 44 | 44 | switch ($op) { |
| 45 | - case 'load': |
|
| 46 | - if (Request::hasVar('ok', 'REQUEST') && 1 === Request::getInt('ok', 0)) { |
|
| 47 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 48 | - \redirect_header($helper->url('admin/index.php'), 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 49 | - } |
|
| 50 | - loadSampleData(); |
|
| 51 | - } else { |
|
| 52 | - xoops_cp_header(); |
|
| 53 | - xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_CONFIRM')), \constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); |
|
| 54 | - xoops_cp_footer(); |
|
| 55 | - } |
|
| 56 | - break; |
|
| 57 | - case 'save': |
|
| 58 | - saveSampleData(); |
|
| 59 | - break; |
|
| 60 | - case 'clear': |
|
| 61 | - if (Request::hasVar('ok', 'REQUEST') && 1 === Request::getInt('ok', 0)) { |
|
| 62 | - if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 63 | - redirect_header($helper->url('admin/index.php'), 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 64 | - } |
|
| 65 | - clearSampleData(); |
|
| 66 | - } else { |
|
| 67 | - xoops_cp_header(); |
|
| 68 | - xoops_confirm(['ok' => 1, 'op' => 'clear'], 'index.php', sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA')), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); |
|
| 69 | - xoops_cp_footer(); |
|
| 70 | - } |
|
| 71 | - break; |
|
| 45 | + case 'load': |
|
| 46 | + if (Request::hasVar('ok', 'REQUEST') && 1 === Request::getInt('ok', 0)) { |
|
| 47 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 48 | + \redirect_header($helper->url('admin/index.php'), 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 49 | + } |
|
| 50 | + loadSampleData(); |
|
| 51 | + } else { |
|
| 52 | + xoops_cp_header(); |
|
| 53 | + xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_CONFIRM')), \constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); |
|
| 54 | + xoops_cp_footer(); |
|
| 55 | + } |
|
| 56 | + break; |
|
| 57 | + case 'save': |
|
| 58 | + saveSampleData(); |
|
| 59 | + break; |
|
| 60 | + case 'clear': |
|
| 61 | + if (Request::hasVar('ok', 'REQUEST') && 1 === Request::getInt('ok', 0)) { |
|
| 62 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
| 63 | + redirect_header($helper->url('admin/index.php'), 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 64 | + } |
|
| 65 | + clearSampleData(); |
|
| 66 | + } else { |
|
| 67 | + xoops_cp_header(); |
|
| 68 | + xoops_confirm(['ok' => 1, 'op' => 'clear'], 'index.php', sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA')), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); |
|
| 69 | + xoops_cp_footer(); |
|
| 70 | + } |
|
| 71 | + break; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // XMF TableLoad for SAMPLE data |
| 75 | 75 | |
| 76 | 76 | function loadSampleData() |
| 77 | 77 | { |
| 78 | - global $xoopsConfig; |
|
| 79 | - $moduleDirName = \basename(\dirname(__DIR__)); |
|
| 80 | - $moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
|
| 81 | - |
|
| 82 | - $utility = new Utility(); |
|
| 83 | - $configurator = new Configurator(); |
|
| 84 | - |
|
| 85 | - $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); |
|
| 86 | - |
|
| 87 | - $language = 'english/'; |
|
| 88 | - if (\is_dir(__DIR__ . '/' . $xoopsConfig['language'])) { |
|
| 89 | - $language = $xoopsConfig['language'] . '/'; |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - // load module tables |
|
| 93 | - foreach ($tables as $table) { |
|
| 94 | - $tabledata = Yaml::readWrapped($language . $table . '.yml'); |
|
| 95 | - TableLoad::truncateTable($table); |
|
| 96 | - TableLoad::loadTableFromArray($table, $tabledata); |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - // load permissions |
|
| 100 | - $table = 'group_permission'; |
|
| 101 | - $tabledata = Yaml::readWrapped($language . $table . '.yml'); |
|
| 102 | - $mid = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getVar('mid'); |
|
| 103 | - loadTableFromArrayWithReplace($table, $tabledata, 'gperm_modid', $mid); |
|
| 104 | - |
|
| 105 | - // --- COPY test folder files --------------- |
|
| 106 | - if (\is_array($configurator->copyTestFolders) && \count($configurator->copyTestFolders) > 0) { |
|
| 107 | - // $file = dirname(__DIR__) . '/testdata/images/'; |
|
| 108 | - foreach (\array_keys($configurator->copyTestFolders) as $i) { |
|
| 109 | - $src = $configurator->copyTestFolders[$i][0]; |
|
| 110 | - $dest = $configurator->copyTestFolders[$i][1]; |
|
| 111 | - $utility::rcopy($src, $dest); |
|
| 112 | - } |
|
| 113 | - } |
|
| 114 | - \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_SUCCESS')); |
|
| 78 | + global $xoopsConfig; |
|
| 79 | + $moduleDirName = \basename(\dirname(__DIR__)); |
|
| 80 | + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
|
| 81 | + |
|
| 82 | + $utility = new Utility(); |
|
| 83 | + $configurator = new Configurator(); |
|
| 84 | + |
|
| 85 | + $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); |
|
| 86 | + |
|
| 87 | + $language = 'english/'; |
|
| 88 | + if (\is_dir(__DIR__ . '/' . $xoopsConfig['language'])) { |
|
| 89 | + $language = $xoopsConfig['language'] . '/'; |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + // load module tables |
|
| 93 | + foreach ($tables as $table) { |
|
| 94 | + $tabledata = Yaml::readWrapped($language . $table . '.yml'); |
|
| 95 | + TableLoad::truncateTable($table); |
|
| 96 | + TableLoad::loadTableFromArray($table, $tabledata); |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + // load permissions |
|
| 100 | + $table = 'group_permission'; |
|
| 101 | + $tabledata = Yaml::readWrapped($language . $table . '.yml'); |
|
| 102 | + $mid = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getVar('mid'); |
|
| 103 | + loadTableFromArrayWithReplace($table, $tabledata, 'gperm_modid', $mid); |
|
| 104 | + |
|
| 105 | + // --- COPY test folder files --------------- |
|
| 106 | + if (\is_array($configurator->copyTestFolders) && \count($configurator->copyTestFolders) > 0) { |
|
| 107 | + // $file = dirname(__DIR__) . '/testdata/images/'; |
|
| 108 | + foreach (\array_keys($configurator->copyTestFolders) as $i) { |
|
| 109 | + $src = $configurator->copyTestFolders[$i][0]; |
|
| 110 | + $dest = $configurator->copyTestFolders[$i][1]; |
|
| 111 | + $utility::rcopy($src, $dest); |
|
| 112 | + } |
|
| 113 | + } |
|
| 114 | + \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_SUCCESS')); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | function saveSampleData() |
| 118 | 118 | { |
| 119 | - global $xoopsConfig; |
|
| 120 | - $moduleDirName = \basename(\dirname(__DIR__)); |
|
| 121 | - $moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
|
| 122 | - $helper = Helper::getInstance(); |
|
| 123 | - $tables = $helper->getModule()->getInfo('tables'); |
|
| 124 | - |
|
| 125 | - $languageFolder = __DIR__ . '/' . $xoopsConfig['language']; |
|
| 126 | - if (!\file_exists($languageFolder . '/')) { |
|
| 127 | - Utility::createFolder($languageFolder . '/'); |
|
| 128 | - } |
|
| 129 | - $exportFolder = $languageFolder . '/Exports-' . date('Y-m-d-H-i-s') . '/'; |
|
| 130 | - Utility::createFolder($exportFolder); |
|
| 131 | - |
|
| 132 | - // save module tables |
|
| 133 | - foreach ($tables as $table) { |
|
| 134 | - TableLoad::saveTableToYamlFile($table, $exportFolder . $table . '.yml'); |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - // save permissions |
|
| 138 | - $criteria = new \CriteriaCompo(); |
|
| 139 | - $criteria->add(new \Criteria('gperm_modid', $helper->getModule()->getVar('mid'))); |
|
| 140 | - $skipColumns[] = 'gperm_id'; |
|
| 141 | - TableLoad::saveTableToYamlFile('group_permission', $exportFolder . 'group_permission.yml', $criteria, $skipColumns); |
|
| 142 | - unset($criteria); |
|
| 143 | - |
|
| 144 | - \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_SUCCESS')); |
|
| 119 | + global $xoopsConfig; |
|
| 120 | + $moduleDirName = \basename(\dirname(__DIR__)); |
|
| 121 | + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
|
| 122 | + $helper = Helper::getInstance(); |
|
| 123 | + $tables = $helper->getModule()->getInfo('tables'); |
|
| 124 | + |
|
| 125 | + $languageFolder = __DIR__ . '/' . $xoopsConfig['language']; |
|
| 126 | + if (!\file_exists($languageFolder . '/')) { |
|
| 127 | + Utility::createFolder($languageFolder . '/'); |
|
| 128 | + } |
|
| 129 | + $exportFolder = $languageFolder . '/Exports-' . date('Y-m-d-H-i-s') . '/'; |
|
| 130 | + Utility::createFolder($exportFolder); |
|
| 131 | + |
|
| 132 | + // save module tables |
|
| 133 | + foreach ($tables as $table) { |
|
| 134 | + TableLoad::saveTableToYamlFile($table, $exportFolder . $table . '.yml'); |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + // save permissions |
|
| 138 | + $criteria = new \CriteriaCompo(); |
|
| 139 | + $criteria->add(new \Criteria('gperm_modid', $helper->getModule()->getVar('mid'))); |
|
| 140 | + $skipColumns[] = 'gperm_id'; |
|
| 141 | + TableLoad::saveTableToYamlFile('group_permission', $exportFolder . 'group_permission.yml', $criteria, $skipColumns); |
|
| 142 | + unset($criteria); |
|
| 143 | + |
|
| 144 | + \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_SUCCESS')); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | function exportSchema() |
| 148 | 148 | { |
| 149 | - $moduleDirName = \basename(\dirname(__DIR__)); |
|
| 150 | - $moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
|
| 151 | - |
|
| 152 | - try { |
|
| 153 | - // TODO set exportSchema |
|
| 154 | - // $migrate = new Migrate($moduleDirName); |
|
| 155 | - // $migrate->saveCurrentSchema(); |
|
| 156 | - // |
|
| 157 | - // redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS')); |
|
| 158 | - } catch (\Throwable $e) { |
|
| 159 | - exit(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR')); |
|
| 160 | - } |
|
| 149 | + $moduleDirName = \basename(\dirname(__DIR__)); |
|
| 150 | + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
|
| 151 | + |
|
| 152 | + try { |
|
| 153 | + // TODO set exportSchema |
|
| 154 | + // $migrate = new Migrate($moduleDirName); |
|
| 155 | + // $migrate->saveCurrentSchema(); |
|
| 156 | + // |
|
| 157 | + // redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS')); |
|
| 158 | + } catch (\Throwable $e) { |
|
| 159 | + exit(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR')); |
|
| 160 | + } |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -174,59 +174,59 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | function loadTableFromArrayWithReplace($table, $data, $search, $replace) |
| 176 | 176 | { |
| 177 | - /** @var \XoopsMySQLDatabase $db */ |
|
| 178 | - $db = \XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 179 | - |
|
| 180 | - $prefixedTable = $db->prefix($table); |
|
| 181 | - $count = 0; |
|
| 182 | - |
|
| 183 | - $sql = 'DELETE FROM ' . $prefixedTable . ' WHERE `' . $search . '`=' . $db->quote($replace); |
|
| 184 | - |
|
| 185 | - $result = $db->queryF($sql); |
|
| 186 | - |
|
| 187 | - if ($result) { |
|
| 188 | - foreach ($data as $row) { |
|
| 189 | - $insertInto = 'INSERT INTO ' . $prefixedTable . ' ('; |
|
| 190 | - $valueClause = ' VALUES ('; |
|
| 191 | - $first = true; |
|
| 192 | - foreach ($row as $column => $value) { |
|
| 193 | - if ($first) { |
|
| 194 | - $first = false; |
|
| 195 | - } else { |
|
| 196 | - $insertInto .= ', '; |
|
| 197 | - $valueClause .= ', '; |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - $insertInto .= $column; |
|
| 201 | - if ($search === $column) { |
|
| 202 | - $valueClause .= $db->quote($replace); |
|
| 203 | - } else { |
|
| 204 | - $valueClause .= $db->quote($value); |
|
| 205 | - } |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - $sql = $insertInto . ') ' . $valueClause . ')'; |
|
| 209 | - |
|
| 210 | - $result = $db->queryF($sql); |
|
| 211 | - if (false !== $result) { |
|
| 212 | - ++$count; |
|
| 213 | - } |
|
| 214 | - } |
|
| 215 | - } |
|
| 216 | - return $count; |
|
| 177 | + /** @var \XoopsMySQLDatabase $db */ |
|
| 178 | + $db = \XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 179 | + |
|
| 180 | + $prefixedTable = $db->prefix($table); |
|
| 181 | + $count = 0; |
|
| 182 | + |
|
| 183 | + $sql = 'DELETE FROM ' . $prefixedTable . ' WHERE `' . $search . '`=' . $db->quote($replace); |
|
| 184 | + |
|
| 185 | + $result = $db->queryF($sql); |
|
| 186 | + |
|
| 187 | + if ($result) { |
|
| 188 | + foreach ($data as $row) { |
|
| 189 | + $insertInto = 'INSERT INTO ' . $prefixedTable . ' ('; |
|
| 190 | + $valueClause = ' VALUES ('; |
|
| 191 | + $first = true; |
|
| 192 | + foreach ($row as $column => $value) { |
|
| 193 | + if ($first) { |
|
| 194 | + $first = false; |
|
| 195 | + } else { |
|
| 196 | + $insertInto .= ', '; |
|
| 197 | + $valueClause .= ', '; |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + $insertInto .= $column; |
|
| 201 | + if ($search === $column) { |
|
| 202 | + $valueClause .= $db->quote($replace); |
|
| 203 | + } else { |
|
| 204 | + $valueClause .= $db->quote($value); |
|
| 205 | + } |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + $sql = $insertInto . ') ' . $valueClause . ')'; |
|
| 209 | + |
|
| 210 | + $result = $db->queryF($sql); |
|
| 211 | + if (false !== $result) { |
|
| 212 | + ++$count; |
|
| 213 | + } |
|
| 214 | + } |
|
| 215 | + } |
|
| 216 | + return $count; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | function clearSampleData() |
| 220 | 220 | { |
| 221 | - $moduleDirName = \basename(\dirname(__DIR__)); |
|
| 222 | - $moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
|
| 223 | - $helper = Helper::getInstance(); |
|
| 224 | - // Load language files |
|
| 225 | - $helper->loadLanguage('common'); |
|
| 226 | - $tables = $helper->getModule()->getInfo('tables'); |
|
| 227 | - // truncate module tables |
|
| 228 | - foreach ($tables as $table) { |
|
| 229 | - \Xmf\Database\TableLoad::truncateTable($table); |
|
| 230 | - } |
|
| 231 | - redirect_header($helper->url('admin/index.php'), 1, constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA_OK')); |
|
| 221 | + $moduleDirName = \basename(\dirname(__DIR__)); |
|
| 222 | + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
|
| 223 | + $helper = Helper::getInstance(); |
|
| 224 | + // Load language files |
|
| 225 | + $helper->loadLanguage('common'); |
|
| 226 | + $tables = $helper->getModule()->getInfo('tables'); |
|
| 227 | + // truncate module tables |
|
| 228 | + foreach ($tables as $table) { |
|
| 229 | + \Xmf\Database\TableLoad::truncateTable($table); |
|
| 230 | + } |
|
| 231 | + redirect_header($helper->url('admin/index.php'), 1, constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA_OK')); |
|
| 232 | 232 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | 21 | use XoopsModules\Myiframe\{ |
| 22 | - Helper |
|
| 22 | + Helper |
|
| 23 | 23 | }; |
| 24 | 24 | /** @var Helper $helper */ |
| 25 | 25 | |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | $myts = \MyTextSanitizer::getInstance(); |
| 38 | 38 | |
| 39 | 39 | if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { |
| 40 | - require $GLOBALS['xoops']->path('class/theme.php'); |
|
| 41 | - $GLOBALS['xoTheme'] = new \xos_opal_Theme(); |
|
| 40 | + require $GLOBALS['xoops']->path('class/theme.php'); |
|
| 41 | + $GLOBALS['xoTheme'] = new \xos_opal_Theme(); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) { |
| 45 | - require $GLOBALS['xoops']->path('class/template.php'); |
|
| 46 | - $xoopsTpl = new XoopsTpl(); |
|
| 45 | + require $GLOBALS['xoops']->path('class/template.php'); |
|
| 46 | + $xoopsTpl = new XoopsTpl(); |
|
| 47 | 47 | } |
| 48 | 48 | |
@@ -21,69 +21,69 @@ |
||
| 21 | 21 | $moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
| 22 | 22 | |
| 23 | 23 | return (object)[ |
| 24 | - 'name' => $moduleDirNameUpper . ' Module Configurator', |
|
| 25 | - 'paths' => [ |
|
| 26 | - 'dirname' => $moduleDirName, |
|
| 27 | - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', |
|
| 28 | - 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, |
|
| 29 | - 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, |
|
| 30 | - 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
|
| 31 | - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, |
|
| 32 | - ], |
|
| 33 | - 'uploadFolders' => [ |
|
| 34 | - XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
|
| 35 | - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', |
|
| 36 | - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', |
|
| 37 | - //XOOPS_UPLOAD_PATH . '/flags' |
|
| 38 | - ], |
|
| 39 | - 'copyBlankFiles' => [ |
|
| 40 | - XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
|
| 41 | - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', |
|
| 42 | - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', |
|
| 43 | - //XOOPS_UPLOAD_PATH . '/flags' |
|
| 44 | - ], |
|
| 24 | + 'name' => $moduleDirNameUpper . ' Module Configurator', |
|
| 25 | + 'paths' => [ |
|
| 26 | + 'dirname' => $moduleDirName, |
|
| 27 | + 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', |
|
| 28 | + 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, |
|
| 29 | + 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, |
|
| 30 | + 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
|
| 31 | + 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, |
|
| 32 | + ], |
|
| 33 | + 'uploadFolders' => [ |
|
| 34 | + XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
|
| 35 | + XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', |
|
| 36 | + XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', |
|
| 37 | + //XOOPS_UPLOAD_PATH . '/flags' |
|
| 38 | + ], |
|
| 39 | + 'copyBlankFiles' => [ |
|
| 40 | + XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
|
| 41 | + XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', |
|
| 42 | + XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', |
|
| 43 | + //XOOPS_UPLOAD_PATH . '/flags' |
|
| 44 | + ], |
|
| 45 | 45 | |
| 46 | - 'copyTestFolders' => [ |
|
| 47 | - [ |
|
| 48 | - XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/testdata/uploads', |
|
| 49 | - XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
|
| 50 | - ], |
|
| 51 | - // [ |
|
| 52 | - // XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/testdata/thumbs', |
|
| 53 | - // XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/thumbs', |
|
| 54 | - // ], |
|
| 55 | - ], |
|
| 46 | + 'copyTestFolders' => [ |
|
| 47 | + [ |
|
| 48 | + XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/testdata/uploads', |
|
| 49 | + XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
|
| 50 | + ], |
|
| 51 | + // [ |
|
| 52 | + // XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/testdata/thumbs', |
|
| 53 | + // XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/thumbs', |
|
| 54 | + // ], |
|
| 55 | + ], |
|
| 56 | 56 | |
| 57 | - 'templateFolders' => [ |
|
| 58 | - '/templates/', |
|
| 59 | - // '/templates/blocks/', |
|
| 60 | - // '/templates/admin/' |
|
| 61 | - ], |
|
| 62 | - 'oldFiles' => [ |
|
| 63 | - '/class/request.php', |
|
| 64 | - '/class/registry.php', |
|
| 65 | - '/class/utilities.php', |
|
| 66 | - '/class/util.php', |
|
| 67 | - // '/include/constants.php', |
|
| 68 | - // '/include/functions.php', |
|
| 69 | - '/ajaxrating.txt', |
|
| 70 | - ], |
|
| 71 | - 'oldFolders' => [ |
|
| 72 | - '/images', |
|
| 73 | - '/css', |
|
| 74 | - '/js', |
|
| 75 | - '/tcpdf', |
|
| 76 | - ], |
|
| 57 | + 'templateFolders' => [ |
|
| 58 | + '/templates/', |
|
| 59 | + // '/templates/blocks/', |
|
| 60 | + // '/templates/admin/' |
|
| 61 | + ], |
|
| 62 | + 'oldFiles' => [ |
|
| 63 | + '/class/request.php', |
|
| 64 | + '/class/registry.php', |
|
| 65 | + '/class/utilities.php', |
|
| 66 | + '/class/util.php', |
|
| 67 | + // '/include/constants.php', |
|
| 68 | + // '/include/functions.php', |
|
| 69 | + '/ajaxrating.txt', |
|
| 70 | + ], |
|
| 71 | + 'oldFolders' => [ |
|
| 72 | + '/images', |
|
| 73 | + '/css', |
|
| 74 | + '/js', |
|
| 75 | + '/tcpdf', |
|
| 76 | + ], |
|
| 77 | 77 | |
| 78 | - 'renameTables' => [// 'XX_archive' => 'ZZZZ_archive', |
|
| 79 | - ], |
|
| 80 | - 'renameColumns' => [// 'extcal_event' => ['from' => 'event_etablissement', 'to' => 'event_location'], |
|
| 81 | - ], |
|
| 82 | - 'moduleStats' => [ |
|
| 83 | - // 'totalcategories' => $helper->getHandler('Category')->getCategoriesCount(-1), |
|
| 84 | - // 'totalitems' => $helper->getHandler('Item')->getItemsCount(), |
|
| 85 | - // 'totalsubmitted' => $helper->getHandler('Item')->getItemsCount(-1, [Constants::PUBLISHER_STATUS_SUBMITTED]), |
|
| 86 | - ], |
|
| 87 | - 'modCopyright' => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'> |
|
| 78 | + 'renameTables' => [// 'XX_archive' => 'ZZZZ_archive', |
|
| 79 | + ], |
|
| 80 | + 'renameColumns' => [// 'extcal_event' => ['from' => 'event_etablissement', 'to' => 'event_location'], |
|
| 81 | + ], |
|
| 82 | + 'moduleStats' => [ |
|
| 83 | + // 'totalcategories' => $helper->getHandler('Category')->getCategoriesCount(-1), |
|
| 84 | + // 'totalitems' => $helper->getHandler('Item')->getItemsCount(), |
|
| 85 | + // 'totalsubmitted' => $helper->getHandler('Item')->getItemsCount(-1, [Constants::PUBLISHER_STATUS_SUBMITTED]), |
|
| 86 | + ], |
|
| 87 | + 'modCopyright' => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'> |
|
| 88 | 88 | <img src='" . Admin::iconUrl('xoopsmicrobutton.gif') . "' alt='XOOPS Project'></a>", |
| 89 | 89 | ]; |