@@ -20,12 +20,12 @@ |
||
20 | 20 | */ |
21 | 21 | class MyiframeCorePreload extends \XoopsPreloadItem |
22 | 22 | { |
23 | - // to add PSR-4 autoloader |
|
24 | - /** |
|
25 | - * @param $args |
|
26 | - */ |
|
27 | - public static function eventCoreIncludeCommonEnd($args): void |
|
28 | - { |
|
29 | - require_once __DIR__ . '/autoloader.php'; |
|
30 | - } |
|
23 | + // to add PSR-4 autoloader |
|
24 | + /** |
|
25 | + * @param $args |
|
26 | + */ |
|
27 | + public static function eventCoreIncludeCommonEnd($args): void |
|
28 | + { |
|
29 | + require_once __DIR__ . '/autoloader.php'; |
|
30 | + } |
|
31 | 31 | } |
@@ -21,63 +21,63 @@ |
||
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 | - // constant($moduleDirNameUpper . '_PATH') . '/testdata/images', |
|
49 | - // XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images', |
|
50 | - //] |
|
51 | - ], |
|
46 | + 'copyTestFolders' => [ |
|
47 | + //[ |
|
48 | + // constant($moduleDirNameUpper . '_PATH') . '/testdata/images', |
|
49 | + // XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images', |
|
50 | + //] |
|
51 | + ], |
|
52 | 52 | |
53 | - 'templateFolders' => [ |
|
54 | - '/templates/', |
|
55 | - '/templates/blocks/', |
|
56 | - '/templates/admin/', |
|
57 | - ], |
|
58 | - 'oldFiles' => [ |
|
59 | - '/class/request.php', |
|
60 | - '/class/registry.php', |
|
61 | - '/class/utilities.php', |
|
62 | - '/class/util.php', |
|
63 | - // '/include/constants.php', |
|
64 | - // '/include/functions.php', |
|
65 | - '/ajaxrating.txt', |
|
66 | - ], |
|
67 | - 'oldFolders' => [ |
|
68 | - '/images', |
|
69 | - '/css', |
|
70 | - '/js', |
|
71 | - '/tcpdf', |
|
72 | - '/images', |
|
73 | - ], |
|
74 | - 'renameTables' => [// 'XX_archive' => 'ZZZZ_archive', |
|
75 | - ], |
|
76 | - 'moduleStats' => [ |
|
77 | - // 'totalcategories' => $helper->getHandler('Category')->getCategoriesCount(-1), |
|
78 | - // 'totalitems' => $helper->getHandler('Item')->getItemsCount(), |
|
79 | - // 'totalsubmitted' => $helper->getHandler('Item')->getItemsCount(-1, [Constants::PUBLISHER_STATUS_SUBMITTED]), |
|
80 | - ], |
|
81 | - 'modCopyright' => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'> |
|
53 | + 'templateFolders' => [ |
|
54 | + '/templates/', |
|
55 | + '/templates/blocks/', |
|
56 | + '/templates/admin/', |
|
57 | + ], |
|
58 | + 'oldFiles' => [ |
|
59 | + '/class/request.php', |
|
60 | + '/class/registry.php', |
|
61 | + '/class/utilities.php', |
|
62 | + '/class/util.php', |
|
63 | + // '/include/constants.php', |
|
64 | + // '/include/functions.php', |
|
65 | + '/ajaxrating.txt', |
|
66 | + ], |
|
67 | + 'oldFolders' => [ |
|
68 | + '/images', |
|
69 | + '/css', |
|
70 | + '/js', |
|
71 | + '/tcpdf', |
|
72 | + '/images', |
|
73 | + ], |
|
74 | + 'renameTables' => [// 'XX_archive' => 'ZZZZ_archive', |
|
75 | + ], |
|
76 | + 'moduleStats' => [ |
|
77 | + // 'totalcategories' => $helper->getHandler('Category')->getCategoriesCount(-1), |
|
78 | + // 'totalitems' => $helper->getHandler('Item')->getItemsCount(), |
|
79 | + // 'totalsubmitted' => $helper->getHandler('Item')->getItemsCount(-1, [Constants::PUBLISHER_STATUS_SUBMITTED]), |
|
80 | + ], |
|
81 | + 'modCopyright' => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'> |
|
82 | 82 | <img src='" . Admin::iconUrl('xoopsmicrobutton.gif') . "' alt='XOOPS Project'></a>", |
83 | 83 | ]; |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | use XoopsModules\Myiframe; |
20 | 20 | |
21 | 21 | if ((!defined('XOOPS_ROOT_PATH')) || !($GLOBALS['xoopsUser'] instanceof \XoopsUser) |
22 | - || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
23 | - exit('Restricted access' . PHP_EOL); |
|
22 | + || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
23 | + exit('Restricted access' . PHP_EOL); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -31,16 +31,16 @@ discard block |
||
31 | 31 | */ |
32 | 32 | function xoops_module_pre_update_myiframe(\XoopsModule $module) |
33 | 33 | { |
34 | - $moduleDirName = \basename(\dirname(__DIR__)); |
|
35 | - /** @var Myiframe\Helper $helper */ |
|
36 | - /** @var Myiframe\Utility $utility */ |
|
37 | - $helper = Myiframe\Helper::getInstance(); |
|
38 | - $utility = new Myiframe\Utility(); |
|
34 | + $moduleDirName = \basename(\dirname(__DIR__)); |
|
35 | + /** @var Myiframe\Helper $helper */ |
|
36 | + /** @var Myiframe\Utility $utility */ |
|
37 | + $helper = Myiframe\Helper::getInstance(); |
|
38 | + $utility = new Myiframe\Utility(); |
|
39 | 39 | |
40 | - $xoopsSuccess = $utility::checkVerXoops($module); |
|
41 | - $phpSuccess = $utility::checkVerPhp($module); |
|
40 | + $xoopsSuccess = $utility::checkVerXoops($module); |
|
41 | + $phpSuccess = $utility::checkVerPhp($module); |
|
42 | 42 | |
43 | - return $xoopsSuccess && $phpSuccess; |
|
43 | + return $xoopsSuccess && $phpSuccess; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -52,96 +52,96 @@ discard block |
||
52 | 52 | */ |
53 | 53 | function xoops_module_update_myiframe(\XoopsModule $module, $previousVersion = null) |
54 | 54 | { |
55 | - $moduleDirName = \basename(\dirname(__DIR__)); |
|
56 | - $moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
|
57 | - |
|
58 | - /** @var Myiframe\Helper $helper */ /** @var Myiframe\Utility $utility */ |
|
59 | - /** @var Myiframe\Common\Configurator $configurator */ |
|
60 | - $helper = Myiframe\Helper::getInstance(); |
|
61 | - $utility = new Myiframe\Utility(); |
|
62 | - $configurator = new Myiframe\Common\Configurator(); |
|
63 | - |
|
64 | - if ($previousVersion < 240) { |
|
65 | - //rename column EXAMPLE |
|
66 | - $tables = new Tables(); |
|
67 | - $table = 'myiframex_categories'; |
|
68 | - $column = 'ordre'; |
|
69 | - $newName = 'order'; |
|
70 | - $attributes = "INT(5) NOT NULL DEFAULT '0'"; |
|
71 | - if ($tables->useTable($table)) { |
|
72 | - $tables->alterColumn($table, $column, $attributes, $newName); |
|
73 | - if (!$tables->executeQueue()) { |
|
74 | - echo '<br>' . _AM_MYIFRAME_UPGRADEFAILED0 . ' ' . $tables->getLastError(); |
|
75 | - } |
|
76 | - } |
|
77 | - |
|
78 | - //delete old HTML templates |
|
79 | - if (count($configurator->templateFolders) > 0) { |
|
80 | - foreach ($configurator->templateFolders as $folder) { |
|
81 | - $templateFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $folder); |
|
82 | - if (is_dir($templateFolder)) { |
|
83 | - $templateList = array_diff(scandir($templateFolder, SCANDIR_SORT_NONE), ['..', '.']); |
|
84 | - foreach ($templateList as $k => $v) { |
|
85 | - $fileInfo = new \SplFileInfo($templateFolder . $v); |
|
86 | - if ('html' === $fileInfo->getExtension() && 'index.html' !== $fileInfo->getFilename()) { |
|
87 | - if (is_file($templateFolder . $v)) { |
|
88 | - unlink($templateFolder . $v); |
|
89 | - } |
|
90 | - } |
|
91 | - } |
|
92 | - } |
|
93 | - } |
|
94 | - } |
|
95 | - |
|
96 | - // --- DELETE OLD FILES --------------- |
|
97 | - if (count($configurator->oldFiles) > 0) { |
|
98 | - // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
|
99 | - foreach (array_keys($configurator->oldFiles) as $i) { |
|
100 | - $tempFile = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFiles[$i]); |
|
101 | - if (is_file($tempFile)) { |
|
102 | - unlink($tempFile); |
|
103 | - } |
|
104 | - } |
|
105 | - } |
|
106 | - |
|
107 | - // --- DELETE OLD FOLDERS --------------- |
|
108 | - xoops_load('XoopsFile'); |
|
109 | - if (count($configurator->oldFolders) > 0) { |
|
110 | - // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
|
111 | - foreach (array_keys($configurator->oldFolders) as $i) { |
|
112 | - $tempFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFolders[$i]); |
|
113 | - /** @var XoopsObjectHandler $folderHandler */ |
|
114 | - $folderHandler = XoopsFile::getHandler('folder', $tempFolder); |
|
115 | - $folderHandler->delete($tempFolder); |
|
116 | - } |
|
117 | - } |
|
118 | - |
|
119 | - // --- CREATE FOLDERS --------------- |
|
120 | - if (count($configurator->uploadFolders) > 0) { |
|
121 | - // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
|
122 | - foreach (array_keys($configurator->uploadFolders) as $i) { |
|
123 | - $utility::createFolder($configurator->uploadFolders[$i]); |
|
124 | - } |
|
125 | - } |
|
126 | - |
|
127 | - // --- COPY blank.png FILES --------------- |
|
128 | - if (count($configurator->copyBlankFiles) > 0) { |
|
129 | - $file = \dirname(__DIR__) . '/assets/images/blank.png'; |
|
130 | - foreach (array_keys($configurator->copyBlankFiles) as $i) { |
|
131 | - $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; |
|
132 | - $utility::copyFile($file, $dest); |
|
133 | - } |
|
134 | - } |
|
135 | - |
|
136 | - //delete .html entries from the tpl table |
|
137 | - $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . '\' AND `tpl_file` LIKE \'%.html%\''; |
|
138 | - $GLOBALS['xoopsDB']->queryF($sql); |
|
139 | - |
|
140 | - /** @var \XoopsGroupPermHandler $grouppermHandler */ |
|
141 | - $grouppermHandler = xoops_getHandler('groupperm'); |
|
142 | - |
|
143 | - return $grouppermHandler->deleteByModule($module->getVar('mid'), 'item_read'); |
|
144 | - } |
|
145 | - |
|
146 | - return true; |
|
55 | + $moduleDirName = \basename(\dirname(__DIR__)); |
|
56 | + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); |
|
57 | + |
|
58 | + /** @var Myiframe\Helper $helper */ /** @var Myiframe\Utility $utility */ |
|
59 | + /** @var Myiframe\Common\Configurator $configurator */ |
|
60 | + $helper = Myiframe\Helper::getInstance(); |
|
61 | + $utility = new Myiframe\Utility(); |
|
62 | + $configurator = new Myiframe\Common\Configurator(); |
|
63 | + |
|
64 | + if ($previousVersion < 240) { |
|
65 | + //rename column EXAMPLE |
|
66 | + $tables = new Tables(); |
|
67 | + $table = 'myiframex_categories'; |
|
68 | + $column = 'ordre'; |
|
69 | + $newName = 'order'; |
|
70 | + $attributes = "INT(5) NOT NULL DEFAULT '0'"; |
|
71 | + if ($tables->useTable($table)) { |
|
72 | + $tables->alterColumn($table, $column, $attributes, $newName); |
|
73 | + if (!$tables->executeQueue()) { |
|
74 | + echo '<br>' . _AM_MYIFRAME_UPGRADEFAILED0 . ' ' . $tables->getLastError(); |
|
75 | + } |
|
76 | + } |
|
77 | + |
|
78 | + //delete old HTML templates |
|
79 | + if (count($configurator->templateFolders) > 0) { |
|
80 | + foreach ($configurator->templateFolders as $folder) { |
|
81 | + $templateFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $folder); |
|
82 | + if (is_dir($templateFolder)) { |
|
83 | + $templateList = array_diff(scandir($templateFolder, SCANDIR_SORT_NONE), ['..', '.']); |
|
84 | + foreach ($templateList as $k => $v) { |
|
85 | + $fileInfo = new \SplFileInfo($templateFolder . $v); |
|
86 | + if ('html' === $fileInfo->getExtension() && 'index.html' !== $fileInfo->getFilename()) { |
|
87 | + if (is_file($templateFolder . $v)) { |
|
88 | + unlink($templateFolder . $v); |
|
89 | + } |
|
90 | + } |
|
91 | + } |
|
92 | + } |
|
93 | + } |
|
94 | + } |
|
95 | + |
|
96 | + // --- DELETE OLD FILES --------------- |
|
97 | + if (count($configurator->oldFiles) > 0) { |
|
98 | + // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
|
99 | + foreach (array_keys($configurator->oldFiles) as $i) { |
|
100 | + $tempFile = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFiles[$i]); |
|
101 | + if (is_file($tempFile)) { |
|
102 | + unlink($tempFile); |
|
103 | + } |
|
104 | + } |
|
105 | + } |
|
106 | + |
|
107 | + // --- DELETE OLD FOLDERS --------------- |
|
108 | + xoops_load('XoopsFile'); |
|
109 | + if (count($configurator->oldFolders) > 0) { |
|
110 | + // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
|
111 | + foreach (array_keys($configurator->oldFolders) as $i) { |
|
112 | + $tempFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFolders[$i]); |
|
113 | + /** @var XoopsObjectHandler $folderHandler */ |
|
114 | + $folderHandler = XoopsFile::getHandler('folder', $tempFolder); |
|
115 | + $folderHandler->delete($tempFolder); |
|
116 | + } |
|
117 | + } |
|
118 | + |
|
119 | + // --- CREATE FOLDERS --------------- |
|
120 | + if (count($configurator->uploadFolders) > 0) { |
|
121 | + // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
|
122 | + foreach (array_keys($configurator->uploadFolders) as $i) { |
|
123 | + $utility::createFolder($configurator->uploadFolders[$i]); |
|
124 | + } |
|
125 | + } |
|
126 | + |
|
127 | + // --- COPY blank.png FILES --------------- |
|
128 | + if (count($configurator->copyBlankFiles) > 0) { |
|
129 | + $file = \dirname(__DIR__) . '/assets/images/blank.png'; |
|
130 | + foreach (array_keys($configurator->copyBlankFiles) as $i) { |
|
131 | + $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; |
|
132 | + $utility::copyFile($file, $dest); |
|
133 | + } |
|
134 | + } |
|
135 | + |
|
136 | + //delete .html entries from the tpl table |
|
137 | + $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . '\' AND `tpl_file` LIKE \'%.html%\''; |
|
138 | + $GLOBALS['xoopsDB']->queryF($sql); |
|
139 | + |
|
140 | + /** @var \XoopsGroupPermHandler $grouppermHandler */ |
|
141 | + $grouppermHandler = xoops_getHandler('groupperm'); |
|
142 | + |
|
143 | + return $grouppermHandler->deleteByModule($module->getVar('mid'), 'item_read'); |
|
144 | + } |
|
145 | + |
|
146 | + return true; |
|
147 | 147 | } |
@@ -21,33 +21,33 @@ discard block |
||
21 | 21 | */ |
22 | 22 | function myiframe_getmoduleoption($option, $repmodule = 'myiframe') |
23 | 23 | { |
24 | - global $xoopsModuleConfig, $xoopsModule; |
|
25 | - static $tbloptions = []; |
|
26 | - if (is_array($tbloptions) && array_key_exists($option, $tbloptions)) { |
|
27 | - return $tbloptions[$option]; |
|
28 | - } |
|
24 | + global $xoopsModuleConfig, $xoopsModule; |
|
25 | + static $tbloptions = []; |
|
26 | + if (is_array($tbloptions) && array_key_exists($option, $tbloptions)) { |
|
27 | + return $tbloptions[$option]; |
|
28 | + } |
|
29 | 29 | |
30 | - $retval = false; |
|
31 | - if (isset($xoopsModuleConfig) && (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $repmodule && $xoopsModule->getVar('isactive'))) { |
|
32 | - if (isset($xoopsModuleConfig[$option])) { |
|
33 | - $retval = $xoopsModuleConfig[$option]; |
|
34 | - } |
|
35 | - } else { |
|
36 | - /** @var \XoopsModuleHandler $moduleHandler */ |
|
37 | - $moduleHandler = xoops_getHandler('module'); |
|
38 | - $module = $moduleHandler->getByDirname($repmodule); |
|
39 | - /** @var \XoopsConfigHandler $configHandler */ |
|
40 | - $configHandler = xoops_getHandler('config'); |
|
41 | - if ($module) { |
|
42 | - $moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
|
43 | - if (isset($moduleConfig[$option])) { |
|
44 | - $retval = $moduleConfig[$option]; |
|
45 | - } |
|
46 | - } |
|
47 | - } |
|
48 | - $tbloptions[$option] = $retval; |
|
30 | + $retval = false; |
|
31 | + if (isset($xoopsModuleConfig) && (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $repmodule && $xoopsModule->getVar('isactive'))) { |
|
32 | + if (isset($xoopsModuleConfig[$option])) { |
|
33 | + $retval = $xoopsModuleConfig[$option]; |
|
34 | + } |
|
35 | + } else { |
|
36 | + /** @var \XoopsModuleHandler $moduleHandler */ |
|
37 | + $moduleHandler = xoops_getHandler('module'); |
|
38 | + $module = $moduleHandler->getByDirname($repmodule); |
|
39 | + /** @var \XoopsConfigHandler $configHandler */ |
|
40 | + $configHandler = xoops_getHandler('config'); |
|
41 | + if ($module) { |
|
42 | + $moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
|
43 | + if (isset($moduleConfig[$option])) { |
|
44 | + $retval = $moduleConfig[$option]; |
|
45 | + } |
|
46 | + } |
|
47 | + } |
|
48 | + $tbloptions[$option] = $retval; |
|
49 | 49 | |
50 | - return $retval; |
|
50 | + return $retval; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | */ |
62 | 62 | function myiframe_FieldExists($fieldname, $table) |
63 | 63 | { |
64 | - $result = $GLOBALS['xoopsDB']->queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); |
|
64 | + $result = $GLOBALS['xoopsDB']->queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); |
|
65 | 65 | |
66 | - return ($GLOBALS['xoopsDB']->getRowsNum($result) > 0); |
|
66 | + return ($GLOBALS['xoopsDB']->getRowsNum($result) > 0); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -78,21 +78,21 @@ discard block |
||
78 | 78 | */ |
79 | 79 | function myiframe_set_metas($page_title = '', $meta_description = '', $meta_keywords = ''): void |
80 | 80 | { |
81 | - global $xoTheme, $xoTheme, $xoopsTpl; |
|
82 | - $xoopsTpl->assign('xoops_pagetitle', $page_title); |
|
83 | - if (isset($xoTheme) && is_object($xoTheme)) { |
|
84 | - if (!empty($meta_keywords)) { |
|
85 | - $xoTheme->addMeta('meta', 'keywords', $meta_keywords); |
|
86 | - } |
|
87 | - if (!empty($meta_description)) { |
|
88 | - $xoTheme->addMeta('meta', 'description', $meta_description); |
|
89 | - } |
|
90 | - } elseif (isset($xoopsTpl) && is_object($xoopsTpl)) { // Compatibility for old Xoops versions |
|
91 | - if (!empty($meta_keywords)) { |
|
92 | - $xoopsTpl->assign('xoops_meta_keywords', $meta_keywords); |
|
93 | - } |
|
94 | - if (!empty($meta_description)) { |
|
95 | - $xoopsTpl->assign('xoops_meta_description', $meta_description); |
|
96 | - } |
|
97 | - } |
|
81 | + global $xoTheme, $xoTheme, $xoopsTpl; |
|
82 | + $xoopsTpl->assign('xoops_pagetitle', $page_title); |
|
83 | + if (isset($xoTheme) && is_object($xoTheme)) { |
|
84 | + if (!empty($meta_keywords)) { |
|
85 | + $xoTheme->addMeta('meta', 'keywords', $meta_keywords); |
|
86 | + } |
|
87 | + if (!empty($meta_description)) { |
|
88 | + $xoTheme->addMeta('meta', 'description', $meta_description); |
|
89 | + } |
|
90 | + } elseif (isset($xoopsTpl) && is_object($xoopsTpl)) { // Compatibility for old Xoops versions |
|
91 | + if (!empty($meta_keywords)) { |
|
92 | + $xoopsTpl->assign('xoops_meta_keywords', $meta_keywords); |
|
93 | + } |
|
94 | + if (!empty($meta_description)) { |
|
95 | + $xoopsTpl->assign('xoops_meta_description', $meta_description); |
|
96 | + } |
|
97 | + } |
|
98 | 98 | } |
@@ -28,20 +28,20 @@ discard block |
||
28 | 28 | */ |
29 | 29 | function xoops_module_pre_install_myiframe(\XoopsModule $module) |
30 | 30 | { |
31 | - require_once \dirname(__DIR__) . '/preloads/autoloader.php'; |
|
32 | - /** @var \Utility $utility */ |
|
33 | - $utility = new Utility(); |
|
34 | - $xoopsSuccess = $utility::checkVerXoops($module); |
|
35 | - $phpSuccess = $utility::checkVerPhp($module); |
|
31 | + require_once \dirname(__DIR__) . '/preloads/autoloader.php'; |
|
32 | + /** @var \Utility $utility */ |
|
33 | + $utility = new Utility(); |
|
34 | + $xoopsSuccess = $utility::checkVerXoops($module); |
|
35 | + $phpSuccess = $utility::checkVerPhp($module); |
|
36 | 36 | |
37 | - if (false !== $xoopsSuccess && false !== $phpSuccess) { |
|
38 | - $moduleTables = &$module->getInfo('tables'); |
|
39 | - foreach ($moduleTables as $table) { |
|
40 | - $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); |
|
41 | - } |
|
42 | - } |
|
37 | + if (false !== $xoopsSuccess && false !== $phpSuccess) { |
|
38 | + $moduleTables = &$module->getInfo('tables'); |
|
39 | + foreach ($moduleTables as $table) { |
|
40 | + $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); |
|
41 | + } |
|
42 | + } |
|
43 | 43 | |
44 | - return $xoopsSuccess && $phpSuccess; |
|
44 | + return $xoopsSuccess && $phpSuccess; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -52,52 +52,52 @@ discard block |
||
52 | 52 | */ |
53 | 53 | function xoops_module_install_myiframe(\XoopsModule $module) |
54 | 54 | { |
55 | - require \dirname(__DIR__, 3) . '/mainfile.php'; |
|
55 | + require \dirname(__DIR__, 3) . '/mainfile.php'; |
|
56 | 56 | |
57 | - $moduleDirName = \basename(\dirname(__DIR__)); |
|
57 | + $moduleDirName = \basename(\dirname(__DIR__)); |
|
58 | 58 | |
59 | - /** @var Myiframe\Helper $helper */ |
|
60 | - $helper = Myiframe\Helper::getInstance(); |
|
61 | - /** @var Myiframe\Utility $helper */ |
|
62 | - $utility = new Utility(); |
|
63 | - /** @var Myiframe\Common\Configurator $helper */ |
|
64 | - $configurator = new Myiframe\Common\Configurator(); |
|
65 | - // Load language files |
|
66 | - $helper->loadLanguage('admin'); |
|
67 | - $helper->loadLanguage('modinfo'); |
|
59 | + /** @var Myiframe\Helper $helper */ |
|
60 | + $helper = Myiframe\Helper::getInstance(); |
|
61 | + /** @var Myiframe\Utility $helper */ |
|
62 | + $utility = new Utility(); |
|
63 | + /** @var Myiframe\Common\Configurator $helper */ |
|
64 | + $configurator = new Myiframe\Common\Configurator(); |
|
65 | + // Load language files |
|
66 | + $helper->loadLanguage('admin'); |
|
67 | + $helper->loadLanguage('modinfo'); |
|
68 | 68 | |
69 | - // default Permission Settings ---------------------- |
|
70 | - global $xoopsModule; |
|
71 | - $moduleId = $xoopsModule->getVar('mid'); |
|
72 | - // $moduleId2 = $helper->getModule()->mid(); |
|
73 | - /** @var \XoopsGroupPermHandler $grouppermHandler */ |
|
74 | - $grouppermHandler = xoops_getHandler('groupperm'); |
|
75 | - // access rights ------------------------------------------ |
|
76 | - $grouppermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId); |
|
77 | - $grouppermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId); |
|
78 | - $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId); |
|
79 | - $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId); |
|
80 | - $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId); |
|
69 | + // default Permission Settings ---------------------- |
|
70 | + global $xoopsModule; |
|
71 | + $moduleId = $xoopsModule->getVar('mid'); |
|
72 | + // $moduleId2 = $helper->getModule()->mid(); |
|
73 | + /** @var \XoopsGroupPermHandler $grouppermHandler */ |
|
74 | + $grouppermHandler = xoops_getHandler('groupperm'); |
|
75 | + // access rights ------------------------------------------ |
|
76 | + $grouppermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId); |
|
77 | + $grouppermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId); |
|
78 | + $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId); |
|
79 | + $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId); |
|
80 | + $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId); |
|
81 | 81 | |
82 | - // --- CREATE FOLDERS --------------- |
|
83 | - if (count($configurator->uploadFolders) > 0) { |
|
84 | - // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
|
85 | - foreach (array_keys($configurator->uploadFolders) as $i) { |
|
86 | - $utility::createFolder($configurator->uploadFolders[$i]); |
|
87 | - } |
|
88 | - } |
|
82 | + // --- CREATE FOLDERS --------------- |
|
83 | + if (count($configurator->uploadFolders) > 0) { |
|
84 | + // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
|
85 | + foreach (array_keys($configurator->uploadFolders) as $i) { |
|
86 | + $utility::createFolder($configurator->uploadFolders[$i]); |
|
87 | + } |
|
88 | + } |
|
89 | 89 | |
90 | - // --- COPY blank.png FILES --------------- |
|
91 | - if (count($configurator->copyBlankFiles) > 0) { |
|
92 | - $file = \dirname(__DIR__) . '/assets/images/blank.png'; |
|
93 | - foreach (array_keys($configurator->copyBlankFiles) as $i) { |
|
94 | - $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; |
|
95 | - $utility::copyFile($file, $dest); |
|
96 | - } |
|
97 | - } |
|
98 | - //delete .html entries from the tpl table |
|
99 | - $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $xoopsModule->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'"; |
|
100 | - $GLOBALS['xoopsDB']->queryF($sql); |
|
90 | + // --- COPY blank.png FILES --------------- |
|
91 | + if (count($configurator->copyBlankFiles) > 0) { |
|
92 | + $file = \dirname(__DIR__) . '/assets/images/blank.png'; |
|
93 | + foreach (array_keys($configurator->copyBlankFiles) as $i) { |
|
94 | + $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; |
|
95 | + $utility::copyFile($file, $dest); |
|
96 | + } |
|
97 | + } |
|
98 | + //delete .html entries from the tpl table |
|
99 | + $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $xoopsModule->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'"; |
|
100 | + $GLOBALS['xoopsDB']->queryF($sql); |
|
101 | 101 | |
102 | - return true; |
|
102 | + return true; |
|
103 | 103 | } |
@@ -30,5 +30,5 @@ |
||
30 | 30 | */ |
31 | 31 | class Utility extends Common\SysUtility |
32 | 32 | { |
33 | - //--------------- Custom module methods ----------------------------- |
|
33 | + //--------------- Custom module methods ----------------------------- |
|
34 | 34 | } |
@@ -25,39 +25,39 @@ discard block |
||
25 | 25 | */ |
26 | 26 | class Breadcrumb |
27 | 27 | { |
28 | - public $dirname; |
|
29 | - private $bread = []; |
|
28 | + public $dirname; |
|
29 | + private $bread = []; |
|
30 | 30 | |
31 | - public function __construct() |
|
32 | - { |
|
33 | - $this->dirname = \basename(\dirname(__DIR__, 2)); |
|
34 | - } |
|
31 | + public function __construct() |
|
32 | + { |
|
33 | + $this->dirname = \basename(\dirname(__DIR__, 2)); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * Add link to breadcrumb |
|
38 | - * |
|
39 | - * @param string $title |
|
40 | - * @param string $link |
|
41 | - */ |
|
42 | - public function addLink($title = '', $link = ''): void |
|
43 | - { |
|
44 | - $this->bread[] = [ |
|
45 | - 'link' => $link, |
|
46 | - 'title' => $title, |
|
47 | - ]; |
|
48 | - } |
|
36 | + /** |
|
37 | + * Add link to breadcrumb |
|
38 | + * |
|
39 | + * @param string $title |
|
40 | + * @param string $link |
|
41 | + */ |
|
42 | + public function addLink($title = '', $link = ''): void |
|
43 | + { |
|
44 | + $this->bread[] = [ |
|
45 | + 'link' => $link, |
|
46 | + 'title' => $title, |
|
47 | + ]; |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * Render BreadCrumb |
|
52 | - */ |
|
53 | - public function render(): void |
|
54 | - { |
|
55 | - /* |
|
50 | + /** |
|
51 | + * Render BreadCrumb |
|
52 | + */ |
|
53 | + public function render(): void |
|
54 | + { |
|
55 | + /* |
|
56 | 56 | TODO if you want to use the render code below, |
57 | 57 | 1) create ./templates/chess_common_breadcrumb.tpl) |
58 | 58 | 2) add declaration to xoops_version.php |
59 | 59 | */ |
60 | - /* |
|
60 | + /* |
|
61 | 61 | if (!isset($GLOBALS['xoTheme']) || !\is_object($GLOBALS['xoTheme'])) { |
62 | 62 | require $GLOBALS['xoops']->path('class/theme.php'); |
63 | 63 | |
@@ -76,5 +76,5 @@ discard block |
||
76 | 76 | |
77 | 77 | return $html; |
78 | 78 | */ |
79 | - } |
|
79 | + } |
|
80 | 80 | } |
@@ -24,41 +24,41 @@ |
||
24 | 24 | */ |
25 | 25 | class Configurator |
26 | 26 | { |
27 | - public $name; |
|
28 | - public $paths = []; |
|
29 | - public $uploadFolders = []; |
|
30 | - public $copyBlankFiles = []; |
|
31 | - public $copyTestFolders = []; |
|
32 | - public $templateFolders = []; |
|
33 | - public $oldFiles = []; |
|
34 | - public $oldFolders = []; |
|
35 | - public $renameTables = []; |
|
36 | - public $renameColumns = []; |
|
37 | - public $moduleStats = []; |
|
38 | - public $modCopyright; |
|
39 | - public $icons; |
|
27 | + public $name; |
|
28 | + public $paths = []; |
|
29 | + public $uploadFolders = []; |
|
30 | + public $copyBlankFiles = []; |
|
31 | + public $copyTestFolders = []; |
|
32 | + public $templateFolders = []; |
|
33 | + public $oldFiles = []; |
|
34 | + public $oldFolders = []; |
|
35 | + public $renameTables = []; |
|
36 | + public $renameColumns = []; |
|
37 | + public $moduleStats = []; |
|
38 | + public $modCopyright; |
|
39 | + public $icons; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Configurator constructor. |
|
43 | - */ |
|
44 | - public function __construct() |
|
45 | - { |
|
46 | - $config = require \dirname(__DIR__, 2) . '/config/config.php'; |
|
41 | + /** |
|
42 | + * Configurator constructor. |
|
43 | + */ |
|
44 | + public function __construct() |
|
45 | + { |
|
46 | + $config = require \dirname(__DIR__, 2) . '/config/config.php'; |
|
47 | 47 | |
48 | - $this->name = $config->name; |
|
49 | - $this->paths = $config->paths; |
|
50 | - $this->uploadFolders = $config->uploadFolders; |
|
51 | - $this->copyBlankFiles = $config->copyBlankFiles; |
|
52 | - $this->copyTestFolders = $config->copyTestFolders; |
|
53 | - $this->templateFolders = $config->templateFolders; |
|
54 | - $this->oldFiles = $config->oldFiles; |
|
55 | - $this->oldFolders = $config->oldFolders; |
|
56 | - $this->renameTables = $config->renameTables; |
|
57 | - $this->renameColumns = $config->renameColumns; |
|
58 | - $this->moduleStats = $config->moduleStats; |
|
59 | - $this->modCopyright = $config->modCopyright; |
|
48 | + $this->name = $config->name; |
|
49 | + $this->paths = $config->paths; |
|
50 | + $this->uploadFolders = $config->uploadFolders; |
|
51 | + $this->copyBlankFiles = $config->copyBlankFiles; |
|
52 | + $this->copyTestFolders = $config->copyTestFolders; |
|
53 | + $this->templateFolders = $config->templateFolders; |
|
54 | + $this->oldFiles = $config->oldFiles; |
|
55 | + $this->oldFolders = $config->oldFolders; |
|
56 | + $this->renameTables = $config->renameTables; |
|
57 | + $this->renameColumns = $config->renameColumns; |
|
58 | + $this->moduleStats = $config->moduleStats; |
|
59 | + $this->modCopyright = $config->modCopyright; |
|
60 | 60 | |
61 | - $this->icons = require \dirname(__DIR__, 2) . '/config/icons.php'; |
|
62 | - $this->paths = require \dirname(__DIR__, 2) . '/config/paths.php'; |
|
63 | - } |
|
61 | + $this->icons = require \dirname(__DIR__, 2) . '/config/icons.php'; |
|
62 | + $this->paths = require \dirname(__DIR__, 2) . '/config/paths.php'; |
|
63 | + } |
|
64 | 64 | } |
@@ -15,50 +15,50 @@ |
||
15 | 15 | */ |
16 | 16 | class MyiframeBase extends \XoopsObject |
17 | 17 | { |
18 | - // /** @var \XoopsMySQLDatabase */ |
|
19 | - public $db; |
|
18 | + // /** @var \XoopsMySQLDatabase */ |
|
19 | + public $db; |
|
20 | 20 | |
21 | - /** |
|
22 | - * myiframe constructor. |
|
23 | - * @param null $id |
|
24 | - */ |
|
25 | - public function __construct($id = null) |
|
26 | - { |
|
27 | - $this->db = \XoopsDatabaseFactory::getDatabaseConnection(); |
|
28 | - $this->initVar('frame_frameid', \XOBJ_DTYPE_INT, null, false, 10); |
|
29 | - $this->initVar('frame_created', \XOBJ_DTYPE_INT, null, false, 10); |
|
30 | - $this->initVar('frame_uid', \XOBJ_DTYPE_INT, null, false, 10); |
|
31 | - $this->initVar('frame_description', \XOBJ_DTYPE_TXTBOX, null, false, 255); |
|
32 | - $this->initVar('frame_width', \XOBJ_DTYPE_TXTBOX, null, false, 15); |
|
33 | - $this->initVar('frame_height', \XOBJ_DTYPE_TXTBOX, null, false, 15); |
|
34 | - $this->initVar('frame_align', \XOBJ_DTYPE_INT, null, false, 10); |
|
35 | - $this->initVar('frame_frameborder', \XOBJ_DTYPE_INT, null, false, 10); |
|
36 | - $this->initVar('frame_marginwidth', \XOBJ_DTYPE_INT, null, false, 10); |
|
37 | - $this->initVar('frame_marginheight', \XOBJ_DTYPE_INT, null, false, 10); |
|
38 | - $this->initVar('frame_scrolling', \XOBJ_DTYPE_INT, null, false, 10); |
|
39 | - $this->initVar('frame_hits', \XOBJ_DTYPE_INT, null, false, 10); |
|
40 | - $this->initVar('frame_url', \XOBJ_DTYPE_TXTBOX, null, false, 255); |
|
41 | - if (!empty($id)) { |
|
42 | - if (\is_array($id)) { |
|
43 | - $this->assignVars($id); |
|
44 | - } else { |
|
45 | - $this->load((int)$id); |
|
46 | - } |
|
47 | - } else { |
|
48 | - $this->setNew(); |
|
49 | - } |
|
50 | - } |
|
21 | + /** |
|
22 | + * myiframe constructor. |
|
23 | + * @param null $id |
|
24 | + */ |
|
25 | + public function __construct($id = null) |
|
26 | + { |
|
27 | + $this->db = \XoopsDatabaseFactory::getDatabaseConnection(); |
|
28 | + $this->initVar('frame_frameid', \XOBJ_DTYPE_INT, null, false, 10); |
|
29 | + $this->initVar('frame_created', \XOBJ_DTYPE_INT, null, false, 10); |
|
30 | + $this->initVar('frame_uid', \XOBJ_DTYPE_INT, null, false, 10); |
|
31 | + $this->initVar('frame_description', \XOBJ_DTYPE_TXTBOX, null, false, 255); |
|
32 | + $this->initVar('frame_width', \XOBJ_DTYPE_TXTBOX, null, false, 15); |
|
33 | + $this->initVar('frame_height', \XOBJ_DTYPE_TXTBOX, null, false, 15); |
|
34 | + $this->initVar('frame_align', \XOBJ_DTYPE_INT, null, false, 10); |
|
35 | + $this->initVar('frame_frameborder', \XOBJ_DTYPE_INT, null, false, 10); |
|
36 | + $this->initVar('frame_marginwidth', \XOBJ_DTYPE_INT, null, false, 10); |
|
37 | + $this->initVar('frame_marginheight', \XOBJ_DTYPE_INT, null, false, 10); |
|
38 | + $this->initVar('frame_scrolling', \XOBJ_DTYPE_INT, null, false, 10); |
|
39 | + $this->initVar('frame_hits', \XOBJ_DTYPE_INT, null, false, 10); |
|
40 | + $this->initVar('frame_url', \XOBJ_DTYPE_TXTBOX, null, false, 255); |
|
41 | + if (!empty($id)) { |
|
42 | + if (\is_array($id)) { |
|
43 | + $this->assignVars($id); |
|
44 | + } else { |
|
45 | + $this->load((int)$id); |
|
46 | + } |
|
47 | + } else { |
|
48 | + $this->setNew(); |
|
49 | + } |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * @param $id |
|
54 | - */ |
|
55 | - public function load($id): void |
|
56 | - { |
|
57 | - $sql = 'SELECT * FROM ' . $this->db->prefix('myiframe') . ' WHERE frame_frameid=' . (int)$id; |
|
58 | - $myrow = $this->db->fetchArray($this->db->query($sql)); |
|
59 | - $this->assignVars($myrow); |
|
60 | - if (!$myrow) { |
|
61 | - $this->setNew(); |
|
62 | - } |
|
63 | - } |
|
52 | + /** |
|
53 | + * @param $id |
|
54 | + */ |
|
55 | + public function load($id): void |
|
56 | + { |
|
57 | + $sql = 'SELECT * FROM ' . $this->db->prefix('myiframe') . ' WHERE frame_frameid=' . (int)$id; |
|
58 | + $myrow = $this->db->fetchArray($this->db->query($sql)); |
|
59 | + $this->assignVars($myrow); |
|
60 | + if (!$myrow) { |
|
61 | + $this->setNew(); |
|
62 | + } |
|
63 | + } |
|
64 | 64 | } |