Passed
Pull Request — master (#8)
by Michael
11:33
created
config/paths.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -5,17 +5,17 @@
 block discarded – undo
5 5
 $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
6 6
 
7 7
 return [
8
-    'name'          => \mb_strtoupper($moduleDirName) . ' PathConfigurator',
9
-    'dirname'       => $moduleDirName,
10
-    'admin'         => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin',
11
-    'modPath'       => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName,
12
-    'modUrl'        => XOOPS_URL . '/modules/' . $moduleDirName,
13
-    'uploadPath'    => XOOPS_UPLOAD_PATH . '/' . $moduleDirName,
14
-    'uploadUrl'     => XOOPS_UPLOAD_URL . '/' . $moduleDirName,
15
-    'uploadFolders' => [
16
-        XOOPS_UPLOAD_PATH . '/' . $moduleDirName,
17
-        XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category',
18
-        XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots',
19
-        //XOOPS_UPLOAD_PATH . '/flags'
20
-    ],
8
+	'name'          => \mb_strtoupper($moduleDirName) . ' PathConfigurator',
9
+	'dirname'       => $moduleDirName,
10
+	'admin'         => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin',
11
+	'modPath'       => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName,
12
+	'modUrl'        => XOOPS_URL . '/modules/' . $moduleDirName,
13
+	'uploadPath'    => XOOPS_UPLOAD_PATH . '/' . $moduleDirName,
14
+	'uploadUrl'     => XOOPS_UPLOAD_URL . '/' . $moduleDirName,
15
+	'uploadFolders' => [
16
+		XOOPS_UPLOAD_PATH . '/' . $moduleDirName,
17
+		XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category',
18
+		XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots',
19
+		//XOOPS_UPLOAD_PATH . '/flags'
20
+	],
21 21
 ];
Please login to merge, or discard this patch.
config/imageconfig.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -5,37 +5,37 @@
 block discarded – undo
5 5
 
6 6
 // extra module configs
7 7
 $modversion['config'][] = [
8
-    'name'        => 'imageConfigs',
9
-    'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG',
10
-    'description' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC',
11
-    'formtype'    => 'line_break',
12
-    'valuetype'   => 'textbox',
13
-    'default'     => 'head',
8
+	'name'        => 'imageConfigs',
9
+	'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG',
10
+	'description' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC',
11
+	'formtype'    => 'line_break',
12
+	'valuetype'   => 'textbox',
13
+	'default'     => 'head',
14 14
 ];
15 15
 
16 16
 $modversion['config'][] = [
17
-    'name'        => 'imageWidth',
18
-    'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH',
19
-    'description' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC',
20
-    'formtype'    => 'textbox',
21
-    'valuetype'   => 'int',
22
-    'default'     => 1200,
17
+	'name'        => 'imageWidth',
18
+	'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH',
19
+	'description' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC',
20
+	'formtype'    => 'textbox',
21
+	'valuetype'   => 'int',
22
+	'default'     => 1200,
23 23
 ]; // =1024/16
24 24
 
25 25
 $modversion['config'][] = [
26
-    'name'        => 'imageHeight',
27
-    'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT',
28
-    'description' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC',
29
-    'formtype'    => 'textbox',
30
-    'valuetype'   => 'int',
31
-    'default'     => 800,
26
+	'name'        => 'imageHeight',
27
+	'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT',
28
+	'description' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC',
29
+	'formtype'    => 'textbox',
30
+	'valuetype'   => 'int',
31
+	'default'     => 800,
32 32
 ]; // =768/16
33 33
 
34 34
 $modversion['config'][] = [
35
-    'name'        => 'imageUploadPath',
36
-    'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH',
37
-    'description' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC',
38
-    'formtype'    => 'textbox',
39
-    'valuetype'   => 'text',
40
-    'default'     => 'uploads/' . $modversion['dirname'] . '/images',
35
+	'name'        => 'imageUploadPath',
36
+	'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH',
37
+	'description' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC',
38
+	'formtype'    => 'textbox',
39
+	'valuetype'   => 'text',
40
+	'default'     => 'uploads/' . $modversion['dirname'] . '/images',
41 41
 ];
Please login to merge, or discard this patch.
preloads/autoloader.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -4,31 +4,31 @@
 block discarded – undo
4 4
  * @see https://www.php-fig.org/psr/psr-4/examples/
5 5
  */
6 6
 spl_autoload_register(
7
-    static function ($class): void {
8
-        // project-specific namespace prefix
9
-        $prefix = 'XoopsModules\\' . ucfirst(basename(dirname(__DIR__)));
7
+	static function ($class): void {
8
+		// project-specific namespace prefix
9
+		$prefix = 'XoopsModules\\' . ucfirst(basename(dirname(__DIR__)));
10 10
 
11
-        // base directory for the namespace prefix
12
-        $baseDir = \dirname(__DIR__) . '/class/';
11
+		// base directory for the namespace prefix
12
+		$baseDir = \dirname(__DIR__) . '/class/';
13 13
 
14
-        // does the class use the namespace prefix?
15
-        $len = mb_strlen($prefix);
14
+		// does the class use the namespace prefix?
15
+		$len = mb_strlen($prefix);
16 16
 
17
-        if (0 !== strncmp($prefix, $class, $len)) {
18
-            return;
19
-        }
17
+		if (0 !== strncmp($prefix, $class, $len)) {
18
+			return;
19
+		}
20 20
 
21
-        // get the relative class name
22
-        $relativeClass = mb_substr($class, $len);
21
+		// get the relative class name
22
+		$relativeClass = mb_substr($class, $len);
23 23
 
24
-        // replace the namespace prefix with the base directory, replace namespace
25
-        // separators with directory separators in the relative class name, append
26
-        // with .php
27
-        $file = $baseDir . str_replace('\\', '/', $relativeClass) . '.php';
24
+		// replace the namespace prefix with the base directory, replace namespace
25
+		// separators with directory separators in the relative class name, append
26
+		// with .php
27
+		$file = $baseDir . str_replace('\\', '/', $relativeClass) . '.php';
28 28
 
29
-        // if the file exists, require it
30
-        if (is_file($file)) {
31
-            require_once $file;
32
-        }
33
-    }
29
+		// if the file exists, require it
30
+		if (is_file($file)) {
31
+			require_once $file;
32
+		}
33
+	}
34 34
 );
Please login to merge, or discard this patch.
preloads/core.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
include/config.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -21,63 +21,63 @@
 block discarded – undo
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
 ];
Please login to merge, or discard this patch.
include/common.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -38,19 +38,19 @@  discard block
 block discarded – undo
38 38
 //$downloadHandler     = new Myiframe\DownloadHandler($db);
39 39
 
40 40
 if (!defined($moduleDirNameUpper . '_CONSTANTS_DEFINED')) {
41
-    define($moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__)));
42
-    define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/');
43
-    define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/');
44
-    define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName . '/');
45
-    define($moduleDirNameUpper . '_IMAGE_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images/');
46
-    define($moduleDirNameUpper . '_IMAGE_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images');
47
-    define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/');
48
-    define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/');
49
-    define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php');
50
-    define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png');
51
-    define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash
52
-    define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash
53
-    define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1);
41
+	define($moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__)));
42
+	define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/');
43
+	define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/');
44
+	define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName . '/');
45
+	define($moduleDirNameUpper . '_IMAGE_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images/');
46
+	define($moduleDirNameUpper . '_IMAGE_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images');
47
+	define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/');
48
+	define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/');
49
+	define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php');
50
+	define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png');
51
+	define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash
52
+	define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash
53
+	define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1);
54 54
 }
55 55
 
56 56
 $pathIcon16 = Admin::iconUrl('', '16');
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
 //$pathModIcon32 = $helper->getModule()->getInfo('modicons32');
60 60
 
61 61
 $icons = [
62
-    'edit'    => "<img src='" . $pathIcon16 . "/edit.png'  alt=" . _EDIT . "' align='middle'>",
63
-    'delete'  => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>",
64
-    'clone'   => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>",
65
-    'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>",
66
-    'print'   => "<img src='" . $pathIcon16 . "/printer.png' alt='" . _CLONE . "' align='middle'>",
67
-    'pdf'     => "<img src='" . $pathIcon16 . "/pdf.png' alt='" . _CLONE . "' align='middle'>",
68
-    'add'     => "<img src='" . $pathIcon16 . "/add.png' alt='" . _ADD . "' align='middle'>",
69
-    '0'       => "<img src='" . $pathIcon16 . "/0.png' alt='" . 0 . "' align='middle'>",
70
-    '1'       => "<img src='" . $pathIcon16 . "/1.png' alt='" . 1 . "' align='middle'>",
62
+	'edit'    => "<img src='" . $pathIcon16 . "/edit.png'  alt=" . _EDIT . "' align='middle'>",
63
+	'delete'  => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>",
64
+	'clone'   => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>",
65
+	'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>",
66
+	'print'   => "<img src='" . $pathIcon16 . "/printer.png' alt='" . _CLONE . "' align='middle'>",
67
+	'pdf'     => "<img src='" . $pathIcon16 . "/pdf.png' alt='" . _CLONE . "' align='middle'>",
68
+	'add'     => "<img src='" . $pathIcon16 . "/add.png' alt='" . _ADD . "' align='middle'>",
69
+	'0'       => "<img src='" . $pathIcon16 . "/0.png' alt='" . 0 . "' align='middle'>",
70
+	'1'       => "<img src='" . $pathIcon16 . "/1.png' alt='" . 1 . "' align='middle'>",
71 71
 ];
72 72
 
73 73
 $debug = false;
@@ -76,16 +76,16 @@  discard block
 block discarded – undo
76 76
 $myts = \MyTextSanitizer::getInstance();
77 77
 
78 78
 if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) {
79
-    require_once $GLOBALS['xoops']->path('class/template.php');
80
-    $GLOBALS['xoopsTpl'] = new \XoopsTpl();
79
+	require_once $GLOBALS['xoops']->path('class/template.php');
80
+	$GLOBALS['xoopsTpl'] = new \XoopsTpl();
81 81
 }
82 82
 
83 83
 $GLOBALS['xoopsTpl']->assign('mod_url', $helper->url());
84 84
 // Local icons path
85 85
 if (is_object($helper->getModule())) {
86
-    $pathModIcon16 = $helper->getModule()->getInfo('modicons16');
87
-    $pathModIcon32 = $helper->getModule()->getInfo('modicons32');
86
+	$pathModIcon16 = $helper->getModule()->getInfo('modicons16');
87
+	$pathModIcon32 = $helper->getModule()->getInfo('modicons32');
88 88
 
89
-    $GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16);
90
-    $GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32);
89
+	$GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16);
90
+	$GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32);
91 91
 }
Please login to merge, or discard this patch.
include/onupdate.php 1 patch
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
include/functions.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -21,33 +21,33 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
include/oninstall.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -28,20 +28,20 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.