Passed
Push — master ( 834a16...1c3825 )
by Goffy
09:06 queued 04:27
created
testdata/mymodule2/preloads/autoloader.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,12 +4,12 @@  discard block
 block discarded – undo
4 4
  * @see http://www.php-fig.org/psr/psr-4/examples/
5 5
  */
6 6
 spl_autoload_register(
7
-    static function ($class) {
7
+    static function($class) {
8 8
         // project-specific namespace prefix
9
-        $prefix = 'XoopsModules\\' . ucfirst(basename(dirname(__DIR__)));
9
+        $prefix = 'XoopsModules\\'.ucfirst(basename(dirname(__DIR__)));
10 10
 
11 11
         // base directory for the namespace prefix
12
-        $baseDir = __DIR__ . '/../class/';
12
+        $baseDir = __DIR__.'/../class/';
13 13
 
14 14
         // does the class use the namespace prefix?
15 15
         $len = mb_strlen($prefix);
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         // replace the namespace prefix with the base directory, replace namespace
25 25
         // separators with directory separators in the relative class name, append
26 26
         // with .php
27
-        $file = $baseDir . str_replace('\\', '/', $relativeClass) . '.php';
27
+        $file = $baseDir.str_replace('\\', '/', $relativeClass).'.php';
28 28
 
29 29
         // if the file exists, require it
30 30
         if (file_exists($file)) {
Please login to merge, or discard this patch.
testdata/mymodule2/xoops_version.php 2 patches
Indentation   +425 added lines, -425 removed lines patch added patch discarded remove patch
@@ -25,94 +25,94 @@  discard block
 block discarded – undo
25 25
 $moduleDirNameUpper = mb_strtoupper($moduleDirName);
26 26
 // ------------------- Informations ------------------- //
27 27
 $modversion = [
28
-	'name'                => _MI_MYMODULE2_NAME,
29
-	'version'             => 1.0,
30
-	'description'         => _MI_MYMODULE2_DESC,
31
-	'author'              => 'TDM XOOPS',
32
-	'author_mail'         => '[email protected]',
33
-	'author_website_url'  => 'http://xoops.org',
34
-	'author_website_name' => 'XOOPS Project',
35
-	'credits'             => 'XOOPS Development Team',
36
-	'license'             => 'GPL 2.0 or later',
37
-	'license_url'         => 'http://www.gnu.org/licenses/gpl-3.0.en.html',
38
-	'help'                => 'page=help',
39
-	'release_info'        => 'release_info',
40
-	'release_file'        => XOOPS_URL . '/modules/mymodule2/docs/release_info file',
41
-	'release_date'        => '2020/04/16',
42
-	'manual'              => 'link to manual file',
43
-	'manual_file'         => XOOPS_URL . '/modules/mymodule2/docs/install.txt',
44
-	'min_php'             => '7.0',
45
-	'min_xoops'           => '2.5.9',
46
-	'min_admin'           => '1.2',
47
-	'min_db'              => array('mysql' => '5.6', 'mysqli' => '5.6'),
48
-	'image'               => 'assets/images/logoModule.png',
49
-	'dirname'             => basename(__DIR__),
50
-	'dirmoduleadmin'      => 'Frameworks/moduleclasses/moduleadmin',
51
-	'sysicons16'          => '../../Frameworks/moduleclasses/icons/16',
52
-	'sysicons32'          => '../../Frameworks/moduleclasses/icons/32',
53
-	'modicons16'          => 'assets/icons/16',
54
-	'modicons32'          => 'assets/icons/32',
55
-	'demo_site_url'       => 'https://xoops.org',
56
-	'demo_site_name'      => 'XOOPS Demo Site',
57
-	'support_url'         => 'https://xoops.org/modules/newbb',
58
-	'support_name'        => 'Support Forum',
59
-	'module_website_url'  => 'www.xoops.org',
60
-	'module_website_name' => 'XOOPS Project',
61
-	'release'             => '2017-12-02',
62
-	'module_status'       => 'Beta 1',
63
-	'system_menu'         => 1,
64
-	'hasAdmin'            => 1,
65
-	'hasMain'             => 1,
66
-	'adminindex'          => 'admin/index.php',
67
-	'adminmenu'           => 'admin/menu.php',
68
-	'onInstall'           => 'include/install.php',
69
-	'onUninstall'         => 'include/uninstall.php',
70
-	'onUpdate'            => 'include/update.php',
28
+    'name'                => _MI_MYMODULE2_NAME,
29
+    'version'             => 1.0,
30
+    'description'         => _MI_MYMODULE2_DESC,
31
+    'author'              => 'TDM XOOPS',
32
+    'author_mail'         => '[email protected]',
33
+    'author_website_url'  => 'http://xoops.org',
34
+    'author_website_name' => 'XOOPS Project',
35
+    'credits'             => 'XOOPS Development Team',
36
+    'license'             => 'GPL 2.0 or later',
37
+    'license_url'         => 'http://www.gnu.org/licenses/gpl-3.0.en.html',
38
+    'help'                => 'page=help',
39
+    'release_info'        => 'release_info',
40
+    'release_file'        => XOOPS_URL . '/modules/mymodule2/docs/release_info file',
41
+    'release_date'        => '2020/04/16',
42
+    'manual'              => 'link to manual file',
43
+    'manual_file'         => XOOPS_URL . '/modules/mymodule2/docs/install.txt',
44
+    'min_php'             => '7.0',
45
+    'min_xoops'           => '2.5.9',
46
+    'min_admin'           => '1.2',
47
+    'min_db'              => array('mysql' => '5.6', 'mysqli' => '5.6'),
48
+    'image'               => 'assets/images/logoModule.png',
49
+    'dirname'             => basename(__DIR__),
50
+    'dirmoduleadmin'      => 'Frameworks/moduleclasses/moduleadmin',
51
+    'sysicons16'          => '../../Frameworks/moduleclasses/icons/16',
52
+    'sysicons32'          => '../../Frameworks/moduleclasses/icons/32',
53
+    'modicons16'          => 'assets/icons/16',
54
+    'modicons32'          => 'assets/icons/32',
55
+    'demo_site_url'       => 'https://xoops.org',
56
+    'demo_site_name'      => 'XOOPS Demo Site',
57
+    'support_url'         => 'https://xoops.org/modules/newbb',
58
+    'support_name'        => 'Support Forum',
59
+    'module_website_url'  => 'www.xoops.org',
60
+    'module_website_name' => 'XOOPS Project',
61
+    'release'             => '2017-12-02',
62
+    'module_status'       => 'Beta 1',
63
+    'system_menu'         => 1,
64
+    'hasAdmin'            => 1,
65
+    'hasMain'             => 1,
66
+    'adminindex'          => 'admin/index.php',
67
+    'adminmenu'           => 'admin/menu.php',
68
+    'onInstall'           => 'include/install.php',
69
+    'onUninstall'         => 'include/uninstall.php',
70
+    'onUpdate'            => 'include/update.php',
71 71
 ];
72 72
 // ------------------- Templates ------------------- //
73 73
 $modversion['templates'] = [
74
-	// Admin templates
75
-	['file' => 'mymodule2_admin_about.tpl', 'description' => '', 'type' => 'admin'],
76
-	['file' => 'mymodule2_admin_header.tpl', 'description' => '', 'type' => 'admin'],
77
-	['file' => 'mymodule2_admin_index.tpl', 'description' => '', 'type' => 'admin'],
78
-	['file' => 'mymodule2_admin_categories.tpl', 'description' => '', 'type' => 'admin'],
79
-	['file' => 'mymodule2_admin_articles.tpl', 'description' => '', 'type' => 'admin'],
80
-	['file' => 'mymodule2_admin_testfields.tpl', 'description' => '', 'type' => 'admin'],
81
-	['file' => 'mymodule2_admin_permissions.tpl', 'description' => '', 'type' => 'admin'],
82
-	['file' => 'mymodule2_admin_footer.tpl', 'description' => '', 'type' => 'admin'],
83
-	// User templates
84
-	['file' => 'mymodule2_header.tpl', 'description' => ''],
85
-	['file' => 'mymodule2_index.tpl', 'description' => ''],
86
-	['file' => 'mymodule2_categories.tpl', 'description' => ''],
87
-	['file' => 'mymodule2_categories_list.tpl', 'description' => ''],
88
-	['file' => 'mymodule2_articles.tpl', 'description' => ''],
89
-	['file' => 'mymodule2_articles_list.tpl', 'description' => ''],
90
-	['file' => 'mymodule2_testfields.tpl', 'description' => ''],
91
-	['file' => 'mymodule2_testfields_list.tpl', 'description' => ''],
92
-	['file' => 'mymodule2_breadcrumbs.tpl', 'description' => ''],
93
-	['file' => 'mymodule2_broken.tpl', 'description' => ''],
94
-	['file' => 'mymodule2_pdf.tpl', 'description' => ''],
95
-	['file' => 'mymodule2_print.tpl', 'description' => ''],
96
-	['file' => 'mymodule2_rate.tpl', 'description' => ''],
97
-	['file' => 'mymodule2_rss.tpl', 'description' => ''],
98
-	['file' => 'mymodule2_search.tpl', 'description' => ''],
99
-	['file' => 'mymodule2_single.tpl', 'description' => ''],
100
-	['file' => 'mymodule2_submit.tpl', 'description' => ''],
101
-	['file' => 'mymodule2_footer.tpl', 'description' => ''],
74
+    // Admin templates
75
+    ['file' => 'mymodule2_admin_about.tpl', 'description' => '', 'type' => 'admin'],
76
+    ['file' => 'mymodule2_admin_header.tpl', 'description' => '', 'type' => 'admin'],
77
+    ['file' => 'mymodule2_admin_index.tpl', 'description' => '', 'type' => 'admin'],
78
+    ['file' => 'mymodule2_admin_categories.tpl', 'description' => '', 'type' => 'admin'],
79
+    ['file' => 'mymodule2_admin_articles.tpl', 'description' => '', 'type' => 'admin'],
80
+    ['file' => 'mymodule2_admin_testfields.tpl', 'description' => '', 'type' => 'admin'],
81
+    ['file' => 'mymodule2_admin_permissions.tpl', 'description' => '', 'type' => 'admin'],
82
+    ['file' => 'mymodule2_admin_footer.tpl', 'description' => '', 'type' => 'admin'],
83
+    // User templates
84
+    ['file' => 'mymodule2_header.tpl', 'description' => ''],
85
+    ['file' => 'mymodule2_index.tpl', 'description' => ''],
86
+    ['file' => 'mymodule2_categories.tpl', 'description' => ''],
87
+    ['file' => 'mymodule2_categories_list.tpl', 'description' => ''],
88
+    ['file' => 'mymodule2_articles.tpl', 'description' => ''],
89
+    ['file' => 'mymodule2_articles_list.tpl', 'description' => ''],
90
+    ['file' => 'mymodule2_testfields.tpl', 'description' => ''],
91
+    ['file' => 'mymodule2_testfields_list.tpl', 'description' => ''],
92
+    ['file' => 'mymodule2_breadcrumbs.tpl', 'description' => ''],
93
+    ['file' => 'mymodule2_broken.tpl', 'description' => ''],
94
+    ['file' => 'mymodule2_pdf.tpl', 'description' => ''],
95
+    ['file' => 'mymodule2_print.tpl', 'description' => ''],
96
+    ['file' => 'mymodule2_rate.tpl', 'description' => ''],
97
+    ['file' => 'mymodule2_rss.tpl', 'description' => ''],
98
+    ['file' => 'mymodule2_search.tpl', 'description' => ''],
99
+    ['file' => 'mymodule2_single.tpl', 'description' => ''],
100
+    ['file' => 'mymodule2_submit.tpl', 'description' => ''],
101
+    ['file' => 'mymodule2_footer.tpl', 'description' => ''],
102 102
 ];
103 103
 // ------------------- Mysql ------------------- //
104 104
 $modversion['sqlfile']['mysql'] = 'sql/mysql.sql';
105 105
 // Tables
106 106
 $modversion['tables'] = [
107
-	'mymodule2_categories',
108
-	'mymodule2_articles',
109
-	'mymodule2_testfields',
107
+    'mymodule2_categories',
108
+    'mymodule2_articles',
109
+    'mymodule2_testfields',
110 110
 ];
111 111
 // ------------------- Search ------------------- //
112 112
 $modversion['hasSearch'] = 1;
113 113
 $modversion['search'] = [
114
-	'file' => 'include/search.inc.php',
115
-	'func' => 'mymodule2_search',
114
+    'file' => 'include/search.inc.php',
115
+    'func' => 'mymodule2_search',
116 116
 ];
117 117
 // ------------------- Comments ------------------- //
118 118
 $modversion['comments']['pageName'] = 'comments.php';
@@ -120,200 +120,200 @@  discard block
 block discarded – undo
120 120
 // Comment callback functions
121 121
 $modversion['comments']['callbackFile'] = 'include/comment_functions.php';
122 122
 $modversion['comments']['callback'] = [
123
-	'approve' => 'mymodule2CommentsApprove',
124
-	'update'  => 'mymodule2CommentsUpdate',
123
+    'approve' => 'mymodule2CommentsApprove',
124
+    'update'  => 'mymodule2CommentsUpdate',
125 125
 ];
126 126
 // ------------------- Menu ------------------- //
127 127
 $currdirname  = isset($GLOBALS['xoopsModule']) && is_object($GLOBALS['xoopsModule']) ? $GLOBALS['xoopsModule']->getVar('dirname') : 'system';
128 128
 if ($moduleDirName == $currdirname) {
129
-	$modversion['sub'][] = [
130
-		'name' => _MI_MYMODULE2_SMNAME1,
131
-		'url'  => 'index.php',
132
-	];
133
-	// Sub articles
134
-	$modversion['sub'][] = [
135
-		'name' => _MI_MYMODULE2_SMNAME2,
136
-		'url'  => 'articles.php',
137
-	];
138
-	// Sub testfields
139
-	$modversion['sub'][] = [
140
-		'name' => _MI_MYMODULE2_SMNAME3,
141
-		'url'  => 'testfields.php',
142
-	];
143
-	// Sub Submit
144
-	$modversion['sub'][] = [
145
-		'name' => _MI_MYMODULE2_SMNAME4,
146
-		'url'  => 'submit.php',
147
-	];
148
-	// Sub Search
149
-	$modversion['sub'][] = [
150
-		'name' => _MI_MYMODULE2_SMNAME5,
151
-		'url'  => 'search.php',
152
-	];
129
+    $modversion['sub'][] = [
130
+        'name' => _MI_MYMODULE2_SMNAME1,
131
+        'url'  => 'index.php',
132
+    ];
133
+    // Sub articles
134
+    $modversion['sub'][] = [
135
+        'name' => _MI_MYMODULE2_SMNAME2,
136
+        'url'  => 'articles.php',
137
+    ];
138
+    // Sub testfields
139
+    $modversion['sub'][] = [
140
+        'name' => _MI_MYMODULE2_SMNAME3,
141
+        'url'  => 'testfields.php',
142
+    ];
143
+    // Sub Submit
144
+    $modversion['sub'][] = [
145
+        'name' => _MI_MYMODULE2_SMNAME4,
146
+        'url'  => 'submit.php',
147
+    ];
148
+    // Sub Search
149
+    $modversion['sub'][] = [
150
+        'name' => _MI_MYMODULE2_SMNAME5,
151
+        'url'  => 'search.php',
152
+    ];
153 153
 }
154 154
 // ------------------- Blocks ------------------- //
155 155
 // Articles last
156 156
 $modversion['blocks'][] = [
157
-	'file'        => 'articles.php',
158
-	'name'        => _MI_MYMODULE2_ARTICLES_BLOCK_LAST,
159
-	'description' => _MI_MYMODULE2_ARTICLES_BLOCK_LAST_DESC,
160
-	'show_func'   => 'b_mymodule2_articles_show',
161
-	'edit_func'   => 'b_mymodule2_articles_edit',
162
-	'template'    => 'mymodule2_block_articles.tpl',
163
-	'options'     => 'last|5|25|0',
157
+    'file'        => 'articles.php',
158
+    'name'        => _MI_MYMODULE2_ARTICLES_BLOCK_LAST,
159
+    'description' => _MI_MYMODULE2_ARTICLES_BLOCK_LAST_DESC,
160
+    'show_func'   => 'b_mymodule2_articles_show',
161
+    'edit_func'   => 'b_mymodule2_articles_edit',
162
+    'template'    => 'mymodule2_block_articles.tpl',
163
+    'options'     => 'last|5|25|0',
164 164
 ];
165 165
 // Articles new
166 166
 $modversion['blocks'][] = [
167
-	'file'        => 'articles.php',
168
-	'name'        => _MI_MYMODULE2_ARTICLES_BLOCK_NEW,
169
-	'description' => _MI_MYMODULE2_ARTICLES_BLOCK_NEW_DESC,
170
-	'show_func'   => 'b_mymodule2_articles_show',
171
-	'edit_func'   => 'b_mymodule2_articles_edit',
172
-	'template'    => 'mymodule2_block_articles.tpl',
173
-	'options'     => 'new|5|25|0',
167
+    'file'        => 'articles.php',
168
+    'name'        => _MI_MYMODULE2_ARTICLES_BLOCK_NEW,
169
+    'description' => _MI_MYMODULE2_ARTICLES_BLOCK_NEW_DESC,
170
+    'show_func'   => 'b_mymodule2_articles_show',
171
+    'edit_func'   => 'b_mymodule2_articles_edit',
172
+    'template'    => 'mymodule2_block_articles.tpl',
173
+    'options'     => 'new|5|25|0',
174 174
 ];
175 175
 // Articles hits
176 176
 $modversion['blocks'][] = [
177
-	'file'        => 'articles.php',
178
-	'name'        => _MI_MYMODULE2_ARTICLES_BLOCK_HITS,
179
-	'description' => _MI_MYMODULE2_ARTICLES_BLOCK_HITS_DESC,
180
-	'show_func'   => 'b_mymodule2_articles_show',
181
-	'edit_func'   => 'b_mymodule2_articles_edit',
182
-	'template'    => 'mymodule2_block_articles.tpl',
183
-	'options'     => 'hits|5|25|0',
177
+    'file'        => 'articles.php',
178
+    'name'        => _MI_MYMODULE2_ARTICLES_BLOCK_HITS,
179
+    'description' => _MI_MYMODULE2_ARTICLES_BLOCK_HITS_DESC,
180
+    'show_func'   => 'b_mymodule2_articles_show',
181
+    'edit_func'   => 'b_mymodule2_articles_edit',
182
+    'template'    => 'mymodule2_block_articles.tpl',
183
+    'options'     => 'hits|5|25|0',
184 184
 ];
185 185
 // Articles top
186 186
 $modversion['blocks'][] = [
187
-	'file'        => 'articles.php',
188
-	'name'        => _MI_MYMODULE2_ARTICLES_BLOCK_TOP,
189
-	'description' => _MI_MYMODULE2_ARTICLES_BLOCK_TOP_DESC,
190
-	'show_func'   => 'b_mymodule2_articles_show',
191
-	'edit_func'   => 'b_mymodule2_articles_edit',
192
-	'template'    => 'mymodule2_block_articles.tpl',
193
-	'options'     => 'top|5|25|0',
187
+    'file'        => 'articles.php',
188
+    'name'        => _MI_MYMODULE2_ARTICLES_BLOCK_TOP,
189
+    'description' => _MI_MYMODULE2_ARTICLES_BLOCK_TOP_DESC,
190
+    'show_func'   => 'b_mymodule2_articles_show',
191
+    'edit_func'   => 'b_mymodule2_articles_edit',
192
+    'template'    => 'mymodule2_block_articles.tpl',
193
+    'options'     => 'top|5|25|0',
194 194
 ];
195 195
 // Articles random
196 196
 $modversion['blocks'][] = [
197
-	'file'        => 'articles.php',
198
-	'name'        => _MI_MYMODULE2_ARTICLES_BLOCK_RANDOM,
199
-	'description' => _MI_MYMODULE2_ARTICLES_BLOCK_RANDOM_DESC,
200
-	'show_func'   => 'b_mymodule2_articles_show',
201
-	'edit_func'   => 'b_mymodule2_articles_edit',
202
-	'template'    => 'mymodule2_block_articles.tpl',
203
-	'options'     => 'random|5|25|0',
197
+    'file'        => 'articles.php',
198
+    'name'        => _MI_MYMODULE2_ARTICLES_BLOCK_RANDOM,
199
+    'description' => _MI_MYMODULE2_ARTICLES_BLOCK_RANDOM_DESC,
200
+    'show_func'   => 'b_mymodule2_articles_show',
201
+    'edit_func'   => 'b_mymodule2_articles_edit',
202
+    'template'    => 'mymodule2_block_articles.tpl',
203
+    'options'     => 'random|5|25|0',
204 204
 ];
205 205
 // Testfields last
206 206
 $modversion['blocks'][] = [
207
-	'file'        => 'testfields.php',
208
-	'name'        => _MI_MYMODULE2_TESTFIELDS_BLOCK_LAST,
209
-	'description' => _MI_MYMODULE2_TESTFIELDS_BLOCK_LAST_DESC,
210
-	'show_func'   => 'b_mymodule2_testfields_show',
211
-	'edit_func'   => 'b_mymodule2_testfields_edit',
212
-	'template'    => 'mymodule2_block_testfields.tpl',
213
-	'options'     => 'last|5|25|0',
207
+    'file'        => 'testfields.php',
208
+    'name'        => _MI_MYMODULE2_TESTFIELDS_BLOCK_LAST,
209
+    'description' => _MI_MYMODULE2_TESTFIELDS_BLOCK_LAST_DESC,
210
+    'show_func'   => 'b_mymodule2_testfields_show',
211
+    'edit_func'   => 'b_mymodule2_testfields_edit',
212
+    'template'    => 'mymodule2_block_testfields.tpl',
213
+    'options'     => 'last|5|25|0',
214 214
 ];
215 215
 // Testfields new
216 216
 $modversion['blocks'][] = [
217
-	'file'        => 'testfields.php',
218
-	'name'        => _MI_MYMODULE2_TESTFIELDS_BLOCK_NEW,
219
-	'description' => _MI_MYMODULE2_TESTFIELDS_BLOCK_NEW_DESC,
220
-	'show_func'   => 'b_mymodule2_testfields_show',
221
-	'edit_func'   => 'b_mymodule2_testfields_edit',
222
-	'template'    => 'mymodule2_block_testfields.tpl',
223
-	'options'     => 'new|5|25|0',
217
+    'file'        => 'testfields.php',
218
+    'name'        => _MI_MYMODULE2_TESTFIELDS_BLOCK_NEW,
219
+    'description' => _MI_MYMODULE2_TESTFIELDS_BLOCK_NEW_DESC,
220
+    'show_func'   => 'b_mymodule2_testfields_show',
221
+    'edit_func'   => 'b_mymodule2_testfields_edit',
222
+    'template'    => 'mymodule2_block_testfields.tpl',
223
+    'options'     => 'new|5|25|0',
224 224
 ];
225 225
 // Testfields hits
226 226
 $modversion['blocks'][] = [
227
-	'file'        => 'testfields.php',
228
-	'name'        => _MI_MYMODULE2_TESTFIELDS_BLOCK_HITS,
229
-	'description' => _MI_MYMODULE2_TESTFIELDS_BLOCK_HITS_DESC,
230
-	'show_func'   => 'b_mymodule2_testfields_show',
231
-	'edit_func'   => 'b_mymodule2_testfields_edit',
232
-	'template'    => 'mymodule2_block_testfields.tpl',
233
-	'options'     => 'hits|5|25|0',
227
+    'file'        => 'testfields.php',
228
+    'name'        => _MI_MYMODULE2_TESTFIELDS_BLOCK_HITS,
229
+    'description' => _MI_MYMODULE2_TESTFIELDS_BLOCK_HITS_DESC,
230
+    'show_func'   => 'b_mymodule2_testfields_show',
231
+    'edit_func'   => 'b_mymodule2_testfields_edit',
232
+    'template'    => 'mymodule2_block_testfields.tpl',
233
+    'options'     => 'hits|5|25|0',
234 234
 ];
235 235
 // Testfields top
236 236
 $modversion['blocks'][] = [
237
-	'file'        => 'testfields.php',
238
-	'name'        => _MI_MYMODULE2_TESTFIELDS_BLOCK_TOP,
239
-	'description' => _MI_MYMODULE2_TESTFIELDS_BLOCK_TOP_DESC,
240
-	'show_func'   => 'b_mymodule2_testfields_show',
241
-	'edit_func'   => 'b_mymodule2_testfields_edit',
242
-	'template'    => 'mymodule2_block_testfields.tpl',
243
-	'options'     => 'top|5|25|0',
237
+    'file'        => 'testfields.php',
238
+    'name'        => _MI_MYMODULE2_TESTFIELDS_BLOCK_TOP,
239
+    'description' => _MI_MYMODULE2_TESTFIELDS_BLOCK_TOP_DESC,
240
+    'show_func'   => 'b_mymodule2_testfields_show',
241
+    'edit_func'   => 'b_mymodule2_testfields_edit',
242
+    'template'    => 'mymodule2_block_testfields.tpl',
243
+    'options'     => 'top|5|25|0',
244 244
 ];
245 245
 // Testfields random
246 246
 $modversion['blocks'][] = [
247
-	'file'        => 'testfields.php',
248
-	'name'        => _MI_MYMODULE2_TESTFIELDS_BLOCK_RANDOM,
249
-	'description' => _MI_MYMODULE2_TESTFIELDS_BLOCK_RANDOM_DESC,
250
-	'show_func'   => 'b_mymodule2_testfields_show',
251
-	'edit_func'   => 'b_mymodule2_testfields_edit',
252
-	'template'    => 'mymodule2_block_testfields.tpl',
253
-	'options'     => 'random|5|25|0',
247
+    'file'        => 'testfields.php',
248
+    'name'        => _MI_MYMODULE2_TESTFIELDS_BLOCK_RANDOM,
249
+    'description' => _MI_MYMODULE2_TESTFIELDS_BLOCK_RANDOM_DESC,
250
+    'show_func'   => 'b_mymodule2_testfields_show',
251
+    'edit_func'   => 'b_mymodule2_testfields_edit',
252
+    'template'    => 'mymodule2_block_testfields.tpl',
253
+    'options'     => 'random|5|25|0',
254 254
 ];
255 255
 // ------------------- Config ------------------- //
256 256
 // Editor descr
257 257
 xoops_load('xoopseditorhandler');
258 258
 $editorHandlerDescr = XoopsEditorHandler::getInstance();
259 259
 $modversion['config'][] = [
260
-	'name'        => 'editor_descr',
261
-	'title'       => '_MI_MYMODULE2_EDITOR_DESCR',
262
-	'description' => '_MI_MYMODULE2_EDITOR_DESCR_DESC',
263
-	'formtype'    => 'select',
264
-	'valuetype'   => 'text',
265
-	'default'     => 'dhtml',
266
-	'options'     => array_flip($editorHandlerDescr->getList()),
260
+    'name'        => 'editor_descr',
261
+    'title'       => '_MI_MYMODULE2_EDITOR_DESCR',
262
+    'description' => '_MI_MYMODULE2_EDITOR_DESCR_DESC',
263
+    'formtype'    => 'select',
264
+    'valuetype'   => 'text',
265
+    'default'     => 'dhtml',
266
+    'options'     => array_flip($editorHandlerDescr->getList()),
267 267
 ];
268 268
 // Editor textarea
269 269
 xoops_load('xoopseditorhandler');
270 270
 $editorHandlerTextarea = XoopsEditorHandler::getInstance();
271 271
 $modversion['config'][] = [
272
-	'name'        => 'editor_textarea',
273
-	'title'       => '_MI_MYMODULE2_EDITOR_TEXTAREA',
274
-	'description' => '_MI_MYMODULE2_EDITOR_TEXTAREA_DESC',
275
-	'formtype'    => 'select',
276
-	'valuetype'   => 'text',
277
-	'default'     => 'dhtml',
278
-	'options'     => array_flip($editorHandlerTextarea->getList()),
272
+    'name'        => 'editor_textarea',
273
+    'title'       => '_MI_MYMODULE2_EDITOR_TEXTAREA',
274
+    'description' => '_MI_MYMODULE2_EDITOR_TEXTAREA_DESC',
275
+    'formtype'    => 'select',
276
+    'valuetype'   => 'text',
277
+    'default'     => 'dhtml',
278
+    'options'     => array_flip($editorHandlerTextarea->getList()),
279 279
 ];
280 280
 // Editor dhtml
281 281
 xoops_load('xoopseditorhandler');
282 282
 $editorHandlerDhtml = XoopsEditorHandler::getInstance();
283 283
 $modversion['config'][] = [
284
-	'name'        => 'editor_dhtml',
285
-	'title'       => '_MI_MYMODULE2_EDITOR_DHTML',
286
-	'description' => '_MI_MYMODULE2_EDITOR_DHTML_DESC',
287
-	'formtype'    => 'select',
288
-	'valuetype'   => 'text',
289
-	'default'     => 'dhtml',
290
-	'options'     => array_flip($editorHandlerDhtml->getList()),
284
+    'name'        => 'editor_dhtml',
285
+    'title'       => '_MI_MYMODULE2_EDITOR_DHTML',
286
+    'description' => '_MI_MYMODULE2_EDITOR_DHTML_DESC',
287
+    'formtype'    => 'select',
288
+    'valuetype'   => 'text',
289
+    'default'     => 'dhtml',
290
+    'options'     => array_flip($editorHandlerDhtml->getList()),
291 291
 ];
292 292
 // Get groups
293 293
 $memberHandler  = xoops_getHandler('member');
294 294
 $xoopsGroups  = $memberHandler->getGroupList();
295 295
 foreach($xoopsGroups as $key => $group) {
296
-	$groups[$group]  = $key;
296
+    $groups[$group]  = $key;
297 297
 }
298 298
 // General access groups
299 299
 $modversion['config'][] = [
300
-	'name'        => 'groups',
301
-	'title'       => '_MI_MYMODULE2_GROUPS',
302
-	'description' => '_MI_MYMODULE2_GROUPS_DESC',
303
-	'formtype'    => 'select_multi',
304
-	'valuetype'   => 'array',
305
-	'default'     => $groups,
306
-	'options'     => $groups,
300
+    'name'        => 'groups',
301
+    'title'       => '_MI_MYMODULE2_GROUPS',
302
+    'description' => '_MI_MYMODULE2_GROUPS_DESC',
303
+    'formtype'    => 'select_multi',
304
+    'valuetype'   => 'array',
305
+    'default'     => $groups,
306
+    'options'     => $groups,
307 307
 ];
308 308
 // Upload groups
309 309
 $modversion['config'][] = [
310
-	'name'        => 'upload_groups',
311
-	'title'       => '_MI_MYMODULE2_UPLOAD_GROUPS',
312
-	'description' => '_MI_MYMODULE2_UPLOAD_GROUPS_DESC',
313
-	'formtype'    => 'select_multi',
314
-	'valuetype'   => 'array',
315
-	'default'     => $groups,
316
-	'options'     => $groups,
310
+    'name'        => 'upload_groups',
311
+    'title'       => '_MI_MYMODULE2_UPLOAD_GROUPS',
312
+    'description' => '_MI_MYMODULE2_UPLOAD_GROUPS_DESC',
313
+    'formtype'    => 'select_multi',
314
+    'valuetype'   => 'array',
315
+    'default'     => $groups,
316
+    'options'     => $groups,
317 317
 ];
318 318
 // Get Admin groups
319 319
 $criteria  = new \CriteriaCompo();
@@ -321,25 +321,25 @@  discard block
 block discarded – undo
321 321
 $memberHandler  = xoops_getHandler('member');
322 322
 $adminXoopsGroups  = $memberHandler->getGroupList($criteria);
323 323
 foreach($adminXoopsGroups as $key => $adminGroup) {
324
-	$adminGroups[$adminGroup]  = $key;
324
+    $adminGroups[$adminGroup]  = $key;
325 325
 }
326 326
 $modversion['config'][] = [
327
-	'name'        => 'admin_groups',
328
-	'title'       => '_MI_MYMODULE2_ADMIN_GROUPS',
329
-	'description' => '_MI_MYMODULE2_ADMIN_GROUPS_DESC',
330
-	'formtype'    => 'select_multi',
331
-	'valuetype'   => 'array',
332
-	'default'     => $adminGroups,
333
-	'options'     => $adminGroups,
327
+    'name'        => 'admin_groups',
328
+    'title'       => '_MI_MYMODULE2_ADMIN_GROUPS',
329
+    'description' => '_MI_MYMODULE2_ADMIN_GROUPS_DESC',
330
+    'formtype'    => 'select_multi',
331
+    'valuetype'   => 'array',
332
+    'default'     => $adminGroups,
333
+    'options'     => $adminGroups,
334 334
 ];
335 335
 // Keywords
336 336
 $modversion['config'][] = [
337
-	'name'        => 'keywords',
338
-	'title'       => '_MI_MYMODULE2_KEYWORDS',
339
-	'description' => '_MI_MYMODULE2_KEYWORDS_DESC',
340
-	'formtype'    => 'textbox',
341
-	'valuetype'   => 'text',
342
-	'default'     => 'mymodule2, categories, articles, testfields',
337
+    'name'        => 'keywords',
338
+    'title'       => '_MI_MYMODULE2_KEYWORDS',
339
+    'description' => '_MI_MYMODULE2_KEYWORDS_DESC',
340
+    'formtype'    => 'textbox',
341
+    'valuetype'   => 'text',
342
+    'default'     => 'mymodule2, categories, articles, testfields',
343 343
 ];
344 344
 // create increment steps for file size
345 345
 include_once __DIR__ . '/include/xoops_version.inc.php';
@@ -347,313 +347,313 @@  discard block
 block discarded – undo
347 347
 $iniUploadMaxFileSize = mymodule2ReturnBytes(ini_get('upload_max_filesize'));
348 348
 $maxSize              = min($iniPostMaxSize, $iniUploadMaxFileSize);
349 349
 if ($maxSize > 10000 * 1048576) {
350
-	$increment = 500;
350
+    $increment = 500;
351 351
 }
352 352
 if ($maxSize <= 10000 * 1048576) {
353
-	$increment = 200;
353
+    $increment = 200;
354 354
 }
355 355
 if ($maxSize <= 5000 * 1048576) {
356
-	$increment = 100;
356
+    $increment = 100;
357 357
 }
358 358
 if ($maxSize <= 2500 * 1048576) {
359
-	$increment = 50;
359
+    $increment = 50;
360 360
 }
361 361
 if ($maxSize <= 1000 * 1048576) {
362
-	$increment = 10;
362
+    $increment = 10;
363 363
 }
364 364
 if ($maxSize <= 500 * 1048576) {
365
-	$increment = 5;
365
+    $increment = 5;
366 366
 }
367 367
 if ($maxSize <= 100 * 1048576) {
368
-	$increment = 2;
368
+    $increment = 2;
369 369
 }
370 370
 if ($maxSize <= 50 * 1048576) {
371
-	$increment = 1;
371
+    $increment = 1;
372 372
 }
373 373
 if ($maxSize <= 25 * 1048576) {
374
-	$increment = 0.5;
374
+    $increment = 0.5;
375 375
 }
376 376
 $optionMaxsize = [];
377 377
 $i = $increment;
378 378
 while ($i * 1048576  <=  $maxSize) {
379
-	$optionMaxsize[$i . ' ' . _MI_MYMODULE2_SIZE_MB] = $i * 1048576;
380
-	$i += $increment;
379
+    $optionMaxsize[$i . ' ' . _MI_MYMODULE2_SIZE_MB] = $i * 1048576;
380
+    $i += $increment;
381 381
 }
382 382
 // Uploads : maxsize of image
383 383
 $modversion['config'][] = [
384
-	'name'        => 'maxsize_image',
385
-	'title'       => '_MI_MYMODULE2_MAXSIZE_IMAGE',
386
-	'description' => '_MI_MYMODULE2_MAXSIZE_IMAGE_DESC',
387
-	'formtype'    => 'select',
388
-	'valuetype'   => 'int',
389
-	'default'     => 3145728,
390
-	'options'     => $optionMaxsize,
384
+    'name'        => 'maxsize_image',
385
+    'title'       => '_MI_MYMODULE2_MAXSIZE_IMAGE',
386
+    'description' => '_MI_MYMODULE2_MAXSIZE_IMAGE_DESC',
387
+    'formtype'    => 'select',
388
+    'valuetype'   => 'int',
389
+    'default'     => 3145728,
390
+    'options'     => $optionMaxsize,
391 391
 ];
392 392
 // Uploads : mimetypes of image
393 393
 $modversion['config'][] = [
394
-	'name'        => 'mimetypes_image',
395
-	'title'       => '_MI_MYMODULE2_MIMETYPES_IMAGE',
396
-	'description' => '_MI_MYMODULE2_MIMETYPES_IMAGE_DESC',
397
-	'formtype'    => 'select_multi',
398
-	'valuetype'   => 'array',
399
-	'default'     => ['image/gif', 'image/jpeg', 'image/png'],
400
-	'options'     => ['bmp' => 'image/bmp','gif' => 'image/gif','pjpeg' => 'image/pjpeg', 'jpeg' => 'image/jpeg','jpg' => 'image/jpg','jpe' => 'image/jpe', 'png' => 'image/png'],
394
+    'name'        => 'mimetypes_image',
395
+    'title'       => '_MI_MYMODULE2_MIMETYPES_IMAGE',
396
+    'description' => '_MI_MYMODULE2_MIMETYPES_IMAGE_DESC',
397
+    'formtype'    => 'select_multi',
398
+    'valuetype'   => 'array',
399
+    'default'     => ['image/gif', 'image/jpeg', 'image/png'],
400
+    'options'     => ['bmp' => 'image/bmp','gif' => 'image/gif','pjpeg' => 'image/pjpeg', 'jpeg' => 'image/jpeg','jpg' => 'image/jpg','jpe' => 'image/jpe', 'png' => 'image/png'],
401 401
 ];
402 402
 $modversion['config'][] = [
403
-	'name'        => 'maxwidth_image',
404
-	'title'       => '_MI_MYMODULE2_MAXWIDTH_IMAGE',
405
-	'description' => '_MI_MYMODULE2_MAXWIDTH_IMAGE_DESC',
406
-	'formtype'    => 'textbox',
407
-	'valuetype'   => 'int',
408
-	'default'     => 8000,
403
+    'name'        => 'maxwidth_image',
404
+    'title'       => '_MI_MYMODULE2_MAXWIDTH_IMAGE',
405
+    'description' => '_MI_MYMODULE2_MAXWIDTH_IMAGE_DESC',
406
+    'formtype'    => 'textbox',
407
+    'valuetype'   => 'int',
408
+    'default'     => 8000,
409 409
 ];
410 410
 $modversion['config'][] = [
411
-	'name'        => 'maxheight_image',
412
-	'title'       => '_MI_MYMODULE2_MAXHEIGHT_IMAGE',
413
-	'description' => '_MI_MYMODULE2_MAXHEIGHT_IMAGE_DESC',
414
-	'formtype'    => 'textbox',
415
-	'valuetype'   => 'int',
416
-	'default'     => 8000,
411
+    'name'        => 'maxheight_image',
412
+    'title'       => '_MI_MYMODULE2_MAXHEIGHT_IMAGE',
413
+    'description' => '_MI_MYMODULE2_MAXHEIGHT_IMAGE_DESC',
414
+    'formtype'    => 'textbox',
415
+    'valuetype'   => 'int',
416
+    'default'     => 8000,
417 417
 ];
418 418
 // Uploads : maxsize of file
419 419
 $modversion['config'][] = [
420
-	'name'        => 'maxsize_file',
421
-	'title'       => '_MI_MYMODULE2_MAXSIZE_FILE',
422
-	'description' => '_MI_MYMODULE2_MAXSIZE_FILE_DESC',
423
-	'formtype'    => 'select',
424
-	'valuetype'   => 'int',
425
-	'default'     => 3145728,
426
-	'options'     => $optionMaxsize,
420
+    'name'        => 'maxsize_file',
421
+    'title'       => '_MI_MYMODULE2_MAXSIZE_FILE',
422
+    'description' => '_MI_MYMODULE2_MAXSIZE_FILE_DESC',
423
+    'formtype'    => 'select',
424
+    'valuetype'   => 'int',
425
+    'default'     => 3145728,
426
+    'options'     => $optionMaxsize,
427 427
 ];
428 428
 // Uploads : mimetypes of file
429 429
 $modversion['config'][] = [
430
-	'name'        => 'mimetypes_file',
431
-	'title'       => '_MI_MYMODULE2_MIMETYPES_FILE',
432
-	'description' => '_MI_MYMODULE2_MIMETYPES_FILE_DESC',
433
-	'formtype'    => 'select_multi',
434
-	'valuetype'   => 'array',
435
-	'default'     => ['application/pdf', 'application/zip', 'text/comma-separated-values', 'text/plain', 'image/gif', 'image/jpeg', 'image/png'],
436
-	'options'     => ['gif' => 'image/gif','pjpeg' => 'image/pjpeg', 'jpeg' => 'image/jpeg','jpg' => 'image/jpg','jpe' => 'image/jpe', 'png' => 'image/png', 'pdf' => 'application/pdf','zip' => 'application/zip','csv' => 'text/comma-separated-values', 'txt' => 'text/plain', 'xml' => 'application/xml', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
430
+    'name'        => 'mimetypes_file',
431
+    'title'       => '_MI_MYMODULE2_MIMETYPES_FILE',
432
+    'description' => '_MI_MYMODULE2_MIMETYPES_FILE_DESC',
433
+    'formtype'    => 'select_multi',
434
+    'valuetype'   => 'array',
435
+    'default'     => ['application/pdf', 'application/zip', 'text/comma-separated-values', 'text/plain', 'image/gif', 'image/jpeg', 'image/png'],
436
+    'options'     => ['gif' => 'image/gif','pjpeg' => 'image/pjpeg', 'jpeg' => 'image/jpeg','jpg' => 'image/jpg','jpe' => 'image/jpe', 'png' => 'image/png', 'pdf' => 'application/pdf','zip' => 'application/zip','csv' => 'text/comma-separated-values', 'txt' => 'text/plain', 'xml' => 'application/xml', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
437 437
 ];
438 438
 // Admin pager
439 439
 $modversion['config'][] = [
440
-	'name'        => 'adminpager',
441
-	'title'       => '_MI_MYMODULE2_ADMIN_PAGER',
442
-	'description' => '_MI_MYMODULE2_ADMIN_PAGER_DESC',
443
-	'formtype'    => 'textbox',
444
-	'valuetype'   => 'int',
445
-	'default'     => 10,
440
+    'name'        => 'adminpager',
441
+    'title'       => '_MI_MYMODULE2_ADMIN_PAGER',
442
+    'description' => '_MI_MYMODULE2_ADMIN_PAGER_DESC',
443
+    'formtype'    => 'textbox',
444
+    'valuetype'   => 'int',
445
+    'default'     => 10,
446 446
 ];
447 447
 // User pager
448 448
 $modversion['config'][] = [
449
-	'name'        => 'userpager',
450
-	'title'       => '_MI_MYMODULE2_USER_PAGER',
451
-	'description' => '_MI_MYMODULE2_USER_PAGER_DESC',
452
-	'formtype'    => 'textbox',
453
-	'valuetype'   => 'int',
454
-	'default'     => 10,
449
+    'name'        => 'userpager',
450
+    'title'       => '_MI_MYMODULE2_USER_PAGER',
451
+    'description' => '_MI_MYMODULE2_USER_PAGER_DESC',
452
+    'formtype'    => 'textbox',
453
+    'valuetype'   => 'int',
454
+    'default'     => 10,
455 455
 ];
456 456
 // Use tag
457 457
 $modversion['config'][] = [
458
-	'name'        => 'usetag',
459
-	'title'       => '_MI_MYMODULE2_USE_TAG',
460
-	'description' => '_MI_MYMODULE2_USE_TAG_DESC',
461
-	'formtype'    => 'yesno',
462
-	'valuetype'   => 'int',
463
-	'default'     => 0,
458
+    'name'        => 'usetag',
459
+    'title'       => '_MI_MYMODULE2_USE_TAG',
460
+    'description' => '_MI_MYMODULE2_USE_TAG_DESC',
461
+    'formtype'    => 'yesno',
462
+    'valuetype'   => 'int',
463
+    'default'     => 0,
464 464
 ];
465 465
 // Number column
466 466
 $modversion['config'][] = [
467
-	'name'        => 'numb_col',
468
-	'title'       => '_MI_MYMODULE2_NUMB_COL',
469
-	'description' => '_MI_MYMODULE2_NUMB_COL_DESC',
470
-	'formtype'    => 'select',
471
-	'valuetype'   => 'int',
472
-	'default'     => 1,
473
-	'options'     => [1 => '1', 2 => '2', 3 => '3', 4 => '4'],
467
+    'name'        => 'numb_col',
468
+    'title'       => '_MI_MYMODULE2_NUMB_COL',
469
+    'description' => '_MI_MYMODULE2_NUMB_COL_DESC',
470
+    'formtype'    => 'select',
471
+    'valuetype'   => 'int',
472
+    'default'     => 1,
473
+    'options'     => [1 => '1', 2 => '2', 3 => '3', 4 => '4'],
474 474
 ];
475 475
 // Divide by
476 476
 $modversion['config'][] = [
477
-	'name'        => 'divideby',
478
-	'title'       => '_MI_MYMODULE2_DIVIDEBY',
479
-	'description' => '_MI_MYMODULE2_DIVIDEBY_DESC',
480
-	'formtype'    => 'select',
481
-	'valuetype'   => 'int',
482
-	'default'     => 1,
483
-	'options'     => [1 => '1', 2 => '2', 3 => '3', 4 => '4'],
477
+    'name'        => 'divideby',
478
+    'title'       => '_MI_MYMODULE2_DIVIDEBY',
479
+    'description' => '_MI_MYMODULE2_DIVIDEBY_DESC',
480
+    'formtype'    => 'select',
481
+    'valuetype'   => 'int',
482
+    'default'     => 1,
483
+    'options'     => [1 => '1', 2 => '2', 3 => '3', 4 => '4'],
484 484
 ];
485 485
 // Table type
486 486
 $modversion['config'][] = [
487
-	'name'        => 'table_type',
488
-	'title'       => '_MI_MYMODULE2_TABLE_TYPE',
489
-	'description' => '_MI_MYMODULE2_DIVIDEBY_DESC',
490
-	'formtype'    => 'select',
491
-	'valuetype'   => 'int',
492
-	'default'     => 'bordered',
493
-	'options'     => ['bordered' => 'bordered', 'striped' => 'striped', 'hover' => 'hover', 'condensed' => 'condensed'],
487
+    'name'        => 'table_type',
488
+    'title'       => '_MI_MYMODULE2_TABLE_TYPE',
489
+    'description' => '_MI_MYMODULE2_DIVIDEBY_DESC',
490
+    'formtype'    => 'select',
491
+    'valuetype'   => 'int',
492
+    'default'     => 'bordered',
493
+    'options'     => ['bordered' => 'bordered', 'striped' => 'striped', 'hover' => 'hover', 'condensed' => 'condensed'],
494 494
 ];
495 495
 // Panel by
496 496
 $modversion['config'][] = [
497
-	'name'        => 'panel_type',
498
-	'title'       => '_MI_MYMODULE2_PANEL_TYPE',
499
-	'description' => '_MI_MYMODULE2_PANEL_TYPE_DESC',
500
-	'formtype'    => 'select',
501
-	'valuetype'   => 'text',
502
-	'default'     => 'default',
503
-	'options'     => ['default' => 'default', 'primary' => 'primary', 'success' => 'success', 'info' => 'info', 'warning' => 'warning', 'danger' => 'danger'],
497
+    'name'        => 'panel_type',
498
+    'title'       => '_MI_MYMODULE2_PANEL_TYPE',
499
+    'description' => '_MI_MYMODULE2_PANEL_TYPE_DESC',
500
+    'formtype'    => 'select',
501
+    'valuetype'   => 'text',
502
+    'default'     => 'default',
503
+    'options'     => ['default' => 'default', 'primary' => 'primary', 'success' => 'success', 'info' => 'info', 'warning' => 'warning', 'danger' => 'danger'],
504 504
 ];
505 505
 // Advertise
506 506
 $modversion['config'][] = [
507
-	'name'        => 'advertise',
508
-	'title'       => '_MI_MYMODULE2_ADVERTISE',
509
-	'description' => '_MI_MYMODULE2_ADVERTISE_DESC',
510
-	'formtype'    => 'textarea',
511
-	'valuetype'   => 'text',
512
-	'default'     => '',
507
+    'name'        => 'advertise',
508
+    'title'       => '_MI_MYMODULE2_ADVERTISE',
509
+    'description' => '_MI_MYMODULE2_ADVERTISE_DESC',
510
+    'formtype'    => 'textarea',
511
+    'valuetype'   => 'text',
512
+    'default'     => '',
513 513
 ];
514 514
 // Bookmarks
515 515
 $modversion['config'][] = [
516
-	'name'        => 'bookmarks',
517
-	'title'       => '_MI_MYMODULE2_BOOKMARKS',
518
-	'description' => '_MI_MYMODULE2_BOOKMARKS_DESC',
519
-	'formtype'    => 'yesno',
520
-	'valuetype'   => 'int',
521
-	'default'     => 0,
516
+    'name'        => 'bookmarks',
517
+    'title'       => '_MI_MYMODULE2_BOOKMARKS',
518
+    'description' => '_MI_MYMODULE2_BOOKMARKS_DESC',
519
+    'formtype'    => 'yesno',
520
+    'valuetype'   => 'int',
521
+    'default'     => 0,
522 522
 ];
523 523
 // Make Sample button visible?
524 524
 $modversion['config'][] = [
525
-	'name'        => 'displaySampleButton',
526
-	'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON',
527
-	'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC',
528
-	'formtype'    => 'yesno',
529
-	'valuetype'   => 'int',
530
-	'default'     => 1,
525
+    'name'        => 'displaySampleButton',
526
+    'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON',
527
+    'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC',
528
+    'formtype'    => 'yesno',
529
+    'valuetype'   => 'int',
530
+    'default'     => 1,
531 531
 ];
532 532
 // Maintained by
533 533
 $modversion['config'][] = [
534
-	'name'        => 'maintainedby',
535
-	'title'       => '_MI_MYMODULE2_MAINTAINEDBY',
536
-	'description' => '_MI_MYMODULE2_MAINTAINEDBY_DESC',
537
-	'formtype'    => 'textbox',
538
-	'valuetype'   => 'text',
539
-	'default'     => 'https://xoops.org/modules/newbb',
534
+    'name'        => 'maintainedby',
535
+    'title'       => '_MI_MYMODULE2_MAINTAINEDBY',
536
+    'description' => '_MI_MYMODULE2_MAINTAINEDBY_DESC',
537
+    'formtype'    => 'textbox',
538
+    'valuetype'   => 'text',
539
+    'default'     => 'https://xoops.org/modules/newbb',
540 540
 ];
541 541
 // ------------------- Notifications ------------------- //
542 542
 $modversion['hasNotification'] = 1;
543 543
 $modversion['notification'] = [
544
-	'lookup_file' => 'include/notification.inc.php',
545
-	'lookup_func' => 'mymodule2_notify_iteminfo',
544
+    'lookup_file' => 'include/notification.inc.php',
545
+    'lookup_func' => 'mymodule2_notify_iteminfo',
546 546
 ];
547 547
 // Global Notify
548 548
 $modversion['notification']['category'][1] = [
549
-	'name'           => 'global',
550
-	'title'          => _MI_MYMODULE2_GLOBAL_NOTIFY,
551
-	'description'    => _MI_MYMODULE2_GLOBAL_NOTIFY_DESC,
552
-	'subscribe_from' => ['index.php', 'articles.php', 'testfields.php'],
549
+    'name'           => 'global',
550
+    'title'          => _MI_MYMODULE2_GLOBAL_NOTIFY,
551
+    'description'    => _MI_MYMODULE2_GLOBAL_NOTIFY_DESC,
552
+    'subscribe_from' => ['index.php', 'articles.php', 'testfields.php'],
553 553
 ];
554 554
 // Category Notify
555 555
 $modversion['notification']['category'][2] = [
556
-	'name'           => 'category',
557
-	'title'          => _MI_MYMODULE2_CATEGORY_NOTIFY,
558
-	'description'    => _MI_MYMODULE2_CATEGORY_NOTIFY_DESC,
559
-	'subscribe_from' => ['articles.php', 'testfields.php'],
560
-	'item_name'      => '',
561
-	'allow_bookmark' => 1,
556
+    'name'           => 'category',
557
+    'title'          => _MI_MYMODULE2_CATEGORY_NOTIFY,
558
+    'description'    => _MI_MYMODULE2_CATEGORY_NOTIFY_DESC,
559
+    'subscribe_from' => ['articles.php', 'testfields.php'],
560
+    'item_name'      => '',
561
+    'allow_bookmark' => 1,
562 562
 ];
563 563
 // Testfield Notify
564 564
 $modversion['notification']['category'][3] = [
565
-	'name'           => 'testfield',
566
-	'title'          => _MI_MYMODULE2_TESTFIELD_NOTIFY,
567
-	'description'    => _MI_MYMODULE2_TESTFIELD_NOTIFY_DESC,
568
-	'subscribe_from' => 'testfields.php',
569
-	'item_name'      => 'tf_id',
570
-	'allow_bookmark' => 1,
565
+    'name'           => 'testfield',
566
+    'title'          => _MI_MYMODULE2_TESTFIELD_NOTIFY,
567
+    'description'    => _MI_MYMODULE2_TESTFIELD_NOTIFY_DESC,
568
+    'subscribe_from' => 'testfields.php',
569
+    'item_name'      => 'tf_id',
570
+    'allow_bookmark' => 1,
571 571
 ];
572 572
 // GLOBAL_NEW_CATEGORY Notify
573 573
 $modversion['notification']['event'][1] = [
574
-	'name'          => 'new_category',
575
-	'category'      => 'global',
576
-	'admin_only'    => 0,
577
-	'title'         => _MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY,
578
-	'caption'       => _MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY_CAPTION,
579
-	'description'   => _MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY_DESC,
580
-	'mail_template' => 'global_newcategory_notify',
581
-	'mail_subject'  => _MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY_SUBJECT,
574
+    'name'          => 'new_category',
575
+    'category'      => 'global',
576
+    'admin_only'    => 0,
577
+    'title'         => _MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY,
578
+    'caption'       => _MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY_CAPTION,
579
+    'description'   => _MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY_DESC,
580
+    'mail_template' => 'global_newcategory_notify',
581
+    'mail_subject'  => _MI_MYMODULE2_GLOBAL_NEW_CATEGORY_NOTIFY_SUBJECT,
582 582
 ];
583 583
 // GLOBAL_MODIFY Notify
584 584
 $modversion['notification']['event'][2] = [
585
-	'name'          => 'modify',
586
-	'category'      => 'global',
587
-	'admin_only'    => 1,
588
-	'title'         => _MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY,
589
-	'caption'       => _MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY_CAPTION,
590
-	'description'   => _MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY_DESC,
591
-	'mail_template' => 'global_modify_notify',
592
-	'mail_subject'  => _MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY_SUBJECT,
585
+    'name'          => 'modify',
586
+    'category'      => 'global',
587
+    'admin_only'    => 1,
588
+    'title'         => _MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY,
589
+    'caption'       => _MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY_CAPTION,
590
+    'description'   => _MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY_DESC,
591
+    'mail_template' => 'global_modify_notify',
592
+    'mail_subject'  => _MI_MYMODULE2_GLOBAL_MODIFY_NOTIFY_SUBJECT,
593 593
 ];
594 594
 // GLOBAL_BROKEN Notify
595 595
 $modversion['notification']['event'][3] = [
596
-	'name'          => 'broken',
597
-	'category'      => 'global',
598
-	'admin_only'    => 1,
599
-	'title'         => _MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY,
600
-	'caption'       => _MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY_CAPTION,
601
-	'description'   => _MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY_DESC,
602
-	'mail_template' => 'global_broken_notify',
603
-	'mail_subject'  => _MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY_SUBJECT,
596
+    'name'          => 'broken',
597
+    'category'      => 'global',
598
+    'admin_only'    => 1,
599
+    'title'         => _MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY,
600
+    'caption'       => _MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY_CAPTION,
601
+    'description'   => _MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY_DESC,
602
+    'mail_template' => 'global_broken_notify',
603
+    'mail_subject'  => _MI_MYMODULE2_GLOBAL_BROKEN_NOTIFY_SUBJECT,
604 604
 ];
605 605
 // GLOBAL_SUBMIT Notify
606 606
 $modversion['notification']['event'][4] = [
607
-	'name'          => 'submit',
608
-	'category'      => 'global',
609
-	'admin_only'    => 1,
610
-	'title'         => _MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY,
611
-	'caption'       => _MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY_CAPTION,
612
-	'description'   => _MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY_DESC,
613
-	'mail_template' => 'global_submit_notify',
614
-	'mail_subject'  => _MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY_SUBJECT,
607
+    'name'          => 'submit',
608
+    'category'      => 'global',
609
+    'admin_only'    => 1,
610
+    'title'         => _MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY,
611
+    'caption'       => _MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY_CAPTION,
612
+    'description'   => _MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY_DESC,
613
+    'mail_template' => 'global_submit_notify',
614
+    'mail_subject'  => _MI_MYMODULE2_GLOBAL_SUBMIT_NOTIFY_SUBJECT,
615 615
 ];
616 616
 // GLOBAL_NEW Notify
617 617
 $modversion['notification']['event'][5] = [
618
-	'name'          => 'new_testfield',
619
-	'category'      => 'global',
620
-	'admin_only'    => 0,
621
-	'title'         => _MI_MYMODULE2_GLOBAL_NEW_NOTIFY,
622
-	'caption'       => _MI_MYMODULE2_GLOBAL_NEW_NOTIFY_CAPTION,
623
-	'description'   => _MI_MYMODULE2_GLOBAL_NEW_NOTIFY_DESC,
624
-	'mail_template' => 'global_newtestfield_notify',
625
-	'mail_subject'  => _MI_MYMODULE2_GLOBAL_NEW_NOTIFY_SUBJECT,
618
+    'name'          => 'new_testfield',
619
+    'category'      => 'global',
620
+    'admin_only'    => 0,
621
+    'title'         => _MI_MYMODULE2_GLOBAL_NEW_NOTIFY,
622
+    'caption'       => _MI_MYMODULE2_GLOBAL_NEW_NOTIFY_CAPTION,
623
+    'description'   => _MI_MYMODULE2_GLOBAL_NEW_NOTIFY_DESC,
624
+    'mail_template' => 'global_newtestfield_notify',
625
+    'mail_subject'  => _MI_MYMODULE2_GLOBAL_NEW_NOTIFY_SUBJECT,
626 626
 ];
627 627
 // CATEGORY_SUBMIT Notify
628 628
 $modversion['notification']['event'][6] = [
629
-	'name'          => 'submit',
630
-	'category'      => 'category',
631
-	'admin_only'    => 1,
632
-	'title'         => _MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY,
633
-	'caption'       => _MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY_CAPTION,
634
-	'description'   => _MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY_DESC,
635
-	'mail_template' => 'category_testfieldsubmit_notify',
636
-	'mail_subject'  => _MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY_SUBJECT,
629
+    'name'          => 'submit',
630
+    'category'      => 'category',
631
+    'admin_only'    => 1,
632
+    'title'         => _MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY,
633
+    'caption'       => _MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY_CAPTION,
634
+    'description'   => _MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY_DESC,
635
+    'mail_template' => 'category_testfieldsubmit_notify',
636
+    'mail_subject'  => _MI_MYMODULE2_CATEGORY_SUBMIT_NOTIFY_SUBJECT,
637 637
 ];
638 638
 // CATEGORY Notify
639 639
 $modversion['notification']['event'][7] = [
640
-	'name'          => 'new_category',
641
-	'category'      => 'category',
642
-	'admin_only'    => 0,
643
-	'title'         => _MI_MYMODULE2_CATEGORY_NOTIFY,
644
-	'caption'       => _MI_MYMODULE2_CATEGORY_NOTIFY_CAPTION,
645
-	'description'   => _MI_MYMODULE2_CATEGORY_NOTIFY_DESC,
646
-	'mail_template' => 'category_newtestfield_notify',
647
-	'mail_subject'  => _MI_MYMODULE2_CATEGORY_NOTIFY_SUBJECT,
640
+    'name'          => 'new_category',
641
+    'category'      => 'category',
642
+    'admin_only'    => 0,
643
+    'title'         => _MI_MYMODULE2_CATEGORY_NOTIFY,
644
+    'caption'       => _MI_MYMODULE2_CATEGORY_NOTIFY_CAPTION,
645
+    'description'   => _MI_MYMODULE2_CATEGORY_NOTIFY_DESC,
646
+    'mail_template' => 'category_newtestfield_notify',
647
+    'mail_subject'  => _MI_MYMODULE2_CATEGORY_NOTIFY_SUBJECT,
648 648
 ];
649 649
 // TESTFIELD Notify
650 650
 $modversion['notification']['event'][8] = [
651
-	'name'          => 'approve',
652
-	'category'      => 'testfield',
653
-	'admin_only'    => 1,
654
-	'title'         => _MI_MYMODULE2_TESTFIELD_NOTIFY,
655
-	'caption'       => _MI_MYMODULE2_TESTFIELD_NOTIFY_CAPTION,
656
-	'description'   => _MI_MYMODULE2_TESTFIELD_NOTIFY_DESC,
657
-	'mail_template' => 'testfield_approve_notify',
658
-	'mail_subject'  => _MI_MYMODULE2_TESTFIELD_NOTIFY_SUBJECT,
651
+    'name'          => 'approve',
652
+    'category'      => 'testfield',
653
+    'admin_only'    => 1,
654
+    'title'         => _MI_MYMODULE2_TESTFIELD_NOTIFY,
655
+    'caption'       => _MI_MYMODULE2_TESTFIELD_NOTIFY_CAPTION,
656
+    'description'   => _MI_MYMODULE2_TESTFIELD_NOTIFY_DESC,
657
+    'mail_template' => 'testfield_approve_notify',
658
+    'mail_subject'  => _MI_MYMODULE2_TESTFIELD_NOTIFY_SUBJECT,
659 659
 ];
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
 	'license_url'         => 'http://www.gnu.org/licenses/gpl-3.0.en.html',
38 38
 	'help'                => 'page=help',
39 39
 	'release_info'        => 'release_info',
40
-	'release_file'        => XOOPS_URL . '/modules/mymodule2/docs/release_info file',
40
+	'release_file'        => XOOPS_URL.'/modules/mymodule2/docs/release_info file',
41 41
 	'release_date'        => '2020/04/16',
42 42
 	'manual'              => 'link to manual file',
43
-	'manual_file'         => XOOPS_URL . '/modules/mymodule2/docs/install.txt',
43
+	'manual_file'         => XOOPS_URL.'/modules/mymodule2/docs/install.txt',
44 44
 	'min_php'             => '7.0',
45 45
 	'min_xoops'           => '2.5.9',
46 46
 	'min_admin'           => '1.2',
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	'update'  => 'mymodule2CommentsUpdate',
125 125
 ];
126 126
 // ------------------- Menu ------------------- //
127
-$currdirname  = isset($GLOBALS['xoopsModule']) && is_object($GLOBALS['xoopsModule']) ? $GLOBALS['xoopsModule']->getVar('dirname') : 'system';
127
+$currdirname = isset($GLOBALS['xoopsModule']) && is_object($GLOBALS['xoopsModule']) ? $GLOBALS['xoopsModule']->getVar('dirname') : 'system';
128 128
 if ($moduleDirName == $currdirname) {
129 129
 	$modversion['sub'][] = [
130 130
 		'name' => _MI_MYMODULE2_SMNAME1,
@@ -290,10 +290,10 @@  discard block
 block discarded – undo
290 290
 	'options'     => array_flip($editorHandlerDhtml->getList()),
291 291
 ];
292 292
 // Get groups
293
-$memberHandler  = xoops_getHandler('member');
294
-$xoopsGroups  = $memberHandler->getGroupList();
295
-foreach($xoopsGroups as $key => $group) {
296
-	$groups[$group]  = $key;
293
+$memberHandler = xoops_getHandler('member');
294
+$xoopsGroups = $memberHandler->getGroupList();
295
+foreach ($xoopsGroups as $key => $group) {
296
+	$groups[$group] = $key;
297 297
 }
298 298
 // General access groups
299 299
 $modversion['config'][] = [
@@ -316,12 +316,12 @@  discard block
 block discarded – undo
316 316
 	'options'     => $groups,
317 317
 ];
318 318
 // Get Admin groups
319
-$criteria  = new \CriteriaCompo();
320
-$criteria->add( new \Criteria( 'group_type', 'Admin' ) );
321
-$memberHandler  = xoops_getHandler('member');
322
-$adminXoopsGroups  = $memberHandler->getGroupList($criteria);
323
-foreach($adminXoopsGroups as $key => $adminGroup) {
324
-	$adminGroups[$adminGroup]  = $key;
319
+$criteria = new \CriteriaCompo();
320
+$criteria->add(new \Criteria('group_type', 'Admin'));
321
+$memberHandler = xoops_getHandler('member');
322
+$adminXoopsGroups = $memberHandler->getGroupList($criteria);
323
+foreach ($adminXoopsGroups as $key => $adminGroup) {
324
+	$adminGroups[$adminGroup] = $key;
325 325
 }
326 326
 $modversion['config'][] = [
327 327
 	'name'        => 'admin_groups',
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 	'default'     => 'mymodule2, categories, articles, testfields',
343 343
 ];
344 344
 // create increment steps for file size
345
-include_once __DIR__ . '/include/xoops_version.inc.php';
345
+include_once __DIR__.'/include/xoops_version.inc.php';
346 346
 $iniPostMaxSize       = mymodule2ReturnBytes(ini_get('post_max_size'));
347 347
 $iniUploadMaxFileSize = mymodule2ReturnBytes(ini_get('upload_max_filesize'));
348 348
 $maxSize              = min($iniPostMaxSize, $iniUploadMaxFileSize);
@@ -375,8 +375,8 @@  discard block
 block discarded – undo
375 375
 }
376 376
 $optionMaxsize = [];
377 377
 $i = $increment;
378
-while ($i * 1048576  <=  $maxSize) {
379
-	$optionMaxsize[$i . ' ' . _MI_MYMODULE2_SIZE_MB] = $i * 1048576;
378
+while ($i * 1048576 <= $maxSize) {
379
+	$optionMaxsize[$i.' '._MI_MYMODULE2_SIZE_MB] = $i * 1048576;
380 380
 	$i += $increment;
381 381
 }
382 382
 // Uploads : maxsize of image
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 	'formtype'    => 'select_multi',
398 398
 	'valuetype'   => 'array',
399 399
 	'default'     => ['image/gif', 'image/jpeg', 'image/png'],
400
-	'options'     => ['bmp' => 'image/bmp','gif' => 'image/gif','pjpeg' => 'image/pjpeg', 'jpeg' => 'image/jpeg','jpg' => 'image/jpg','jpe' => 'image/jpe', 'png' => 'image/png'],
400
+	'options'     => ['bmp' => 'image/bmp', 'gif' => 'image/gif', 'pjpeg' => 'image/pjpeg', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpg', 'jpe' => 'image/jpe', 'png' => 'image/png'],
401 401
 ];
402 402
 $modversion['config'][] = [
403 403
 	'name'        => 'maxwidth_image',
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 	'formtype'    => 'select_multi',
434 434
 	'valuetype'   => 'array',
435 435
 	'default'     => ['application/pdf', 'application/zip', 'text/comma-separated-values', 'text/plain', 'image/gif', 'image/jpeg', 'image/png'],
436
-	'options'     => ['gif' => 'image/gif','pjpeg' => 'image/pjpeg', 'jpeg' => 'image/jpeg','jpg' => 'image/jpg','jpe' => 'image/jpe', 'png' => 'image/png', 'pdf' => 'application/pdf','zip' => 'application/zip','csv' => 'text/comma-separated-values', 'txt' => 'text/plain', 'xml' => 'application/xml', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
436
+	'options'     => ['gif' => 'image/gif', 'pjpeg' => 'image/pjpeg', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpg', 'jpe' => 'image/jpe', 'png' => 'image/png', 'pdf' => 'application/pdf', 'zip' => 'application/zip', 'csv' => 'text/comma-separated-values', 'txt' => 'text/plain', 'xml' => 'application/xml', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
437 437
 ];
438 438
 // Admin pager
439 439
 $modversion['config'][] = [
@@ -523,8 +523,8 @@  discard block
 block discarded – undo
523 523
 // Make Sample button visible?
524 524
 $modversion['config'][] = [
525 525
 	'name'        => 'displaySampleButton',
526
-	'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON',
527
-	'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC',
526
+	'title'       => 'CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLE_BUTTON',
527
+	'description' => 'CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLE_BUTTON_DESC',
528 528
 	'formtype'    => 'yesno',
529 529
 	'valuetype'   => 'int',
530 530
 	'default'     => 1,
Please login to merge, or discard this patch.
testdata/mymodule2/notification_update.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,5 +19,5 @@
 block discarded – undo
19 19
  * @min_xoops      2.5.9
20 20
  * @author         TDM XOOPS - Email:<[email protected]> - Website:<http://xoops.org>
21 21
  */
22
-include dirname(dirname(__DIR__)) . '/mainfile.php';
23
-include XOOPS_ROOT_PATH . '/include/notification_update.php';
22
+include dirname(dirname(__DIR__)).'/mainfile.php';
23
+include XOOPS_ROOT_PATH.'/include/notification_update.php';
Please login to merge, or discard this patch.
testdata/mymodule2/testfields.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -42,23 +42,23 @@
 block discarded – undo
42 42
 $testfieldsAll = $testfieldsHandler->getAllTestfields($start, $limit);
43 43
 $keywords = [];
44 44
 if ($testfieldsCount > 0) {
45
-	$testfields = [];
46
-	// Get All Testfields
47
-	foreach(array_keys($testfieldsAll) as $i) {
48
-		$testfields[] = $testfieldsAll[$i]->getValuesTestfields();
49
-		$keywords[] = $testfieldsAll[$i]->getVar('tf_text');
50
-	}
51
-	$GLOBALS['xoopsTpl']->assign('testfields', $testfields);
52
-	unset($testfields);
53
-	// Display Navigation
54
-	if ($testfieldsCount > $limit) {
55
-		include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
56
-		$pagenav = new \XoopsPageNav($testfieldsCount, $limit, $start, 'start', 'op=list&limit=' . $limit);
57
-		$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
58
-	}
59
-	$GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type'));
60
-	$GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby'));
61
-	$GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col'));
45
+    $testfields = [];
46
+    // Get All Testfields
47
+    foreach(array_keys($testfieldsAll) as $i) {
48
+        $testfields[] = $testfieldsAll[$i]->getValuesTestfields();
49
+        $keywords[] = $testfieldsAll[$i]->getVar('tf_text');
50
+    }
51
+    $GLOBALS['xoopsTpl']->assign('testfields', $testfields);
52
+    unset($testfields);
53
+    // Display Navigation
54
+    if ($testfieldsCount > $limit) {
55
+        include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
56
+        $pagenav = new \XoopsPageNav($testfieldsCount, $limit, $start, 'start', 'op=list&limit=' . $limit);
57
+        $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
58
+    }
59
+    $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type'));
60
+    $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby'));
61
+    $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col'));
62 62
 }
63 63
 
64 64
 // Breadcrumbs
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,15 +24,15 @@  discard block
 block discarded – undo
24 24
 use XoopsModules\Mymodule2;
25 25
 use XoopsModules\Mymodule2\Constants;
26 26
 
27
-require __DIR__ . '/header.php';
27
+require __DIR__.'/header.php';
28 28
 $GLOBALS['xoopsOption']['template_main'] = 'mymodule2_testfields.tpl';
29
-include_once XOOPS_ROOT_PATH . '/header.php';
29
+include_once XOOPS_ROOT_PATH.'/header.php';
30 30
 
31 31
 $start = Request::getInt('start', 0);
32 32
 $limit = Request::getInt('limit', $helper->getConfig('userpager'));
33 33
 
34 34
 // Define Stylesheet
35
-$GLOBALS['xoTheme']->addStylesheet( $style, null );
35
+$GLOBALS['xoTheme']->addStylesheet($style, null);
36 36
 
37 37
 $GLOBALS['xoopsTpl']->assign('xoops_icons32_url', XOOPS_ICONS32_URL);
38 38
 $GLOBALS['xoopsTpl']->assign('mymodule2_url', MYMODULE2_URL);
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 if ($testfieldsCount > 0) {
45 45
 	$testfields = [];
46 46
 	// Get All Testfields
47
-	foreach(array_keys($testfieldsAll) as $i) {
47
+	foreach (array_keys($testfieldsAll) as $i) {
48 48
 		$testfields[] = $testfieldsAll[$i]->getValuesTestfields();
49 49
 		$keywords[] = $testfieldsAll[$i]->getVar('tf_text');
50 50
 	}
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 	unset($testfields);
53 53
 	// Display Navigation
54 54
 	if ($testfieldsCount > $limit) {
55
-		include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
56
-		$pagenav = new \XoopsPageNav($testfieldsCount, $limit, $start, 'start', 'op=list&limit=' . $limit);
55
+		include_once XOOPS_ROOT_PATH.'/class/pagenav.php';
56
+		$pagenav = new \XoopsPageNav($testfieldsCount, $limit, $start, 'start', 'op=list&limit='.$limit);
57 57
 		$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
58 58
 	}
59 59
 	$GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type'));
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 $xoBreadcrumbs[] = ['title' => _MA_MYMODULE2_TESTFIELDS];
66 66
 
67 67
 // Keywords
68
-mymodule2MetaKeywords($helper->getConfig('keywords').', '. implode(',', $keywords));
68
+mymodule2MetaKeywords($helper->getConfig('keywords').', '.implode(',', $keywords));
69 69
 unset($keywords);
70 70
 
71 71
 // Description
72 72
 mymodule2MetaDescription(_MA_MYMODULE2_TESTFIELDS_DESC);
73 73
 $GLOBALS['xoopsTpl']->assign('xoops_mpageurl', MYMODULE2_URL.'/testfields.php');
74 74
 $GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL);
75
-require __DIR__ . '/footer.php';
75
+require __DIR__.'/footer.php';
Please login to merge, or discard this patch.
testdata/mymodule2/admin/testfields.php 2 patches
Indentation   +253 added lines, -253 removed lines patch added patch discarded remove patch
@@ -30,263 +30,263 @@
 block discarded – undo
30 30
 // Request tf_id
31 31
 $tfId = Request::getInt('tf_id');
32 32
 switch($op) {
33
-	case 'list':
34
-	default:
35
-		// Define Stylesheet
36
-		$GLOBALS['xoTheme']->addStylesheet( $style, null );
37
-		$start = Request::getInt('start', 0);
38
-		$limit = Request::getInt('limit', $helper->getConfig('adminpager'));
39
-		$templateMain = 'mymodule2_admin_testfields.tpl';
40
-		$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('testfields.php'));
41
-		$adminObject->addItemButton(_AM_MYMODULE2_ADD_TESTFIELD, 'testfields.php?op=new', 'add');
42
-		$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
43
-		$testfieldsCount = $testfieldsHandler->getCountTestfields();
44
-		$testfieldsAll = $testfieldsHandler->getAllTestfields($start, $limit);
45
-		$GLOBALS['xoopsTpl']->assign('testfields_count', $testfieldsCount);
46
-		$GLOBALS['xoopsTpl']->assign('mymodule2_url', MYMODULE2_URL);
47
-		$GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL);
48
-		// Table view testfields
49
-		if ($testfieldsCount > 0) {
50
-			foreach(array_keys($testfieldsAll) as $i) {
51
-				$testfield = $testfieldsAll[$i]->getValuesTestfields();
52
-				$GLOBALS['xoopsTpl']->append('testfields_list', $testfield);
53
-				unset($testfield);
54
-			}
55
-			// Display Navigation
56
-			if ($testfieldsCount > $limit) {
57
-				include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
58
-				$pagenav = new \XoopsPageNav($testfieldsCount, $limit, $start, 'start', 'op=list&limit=' . $limit);
59
-				$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
60
-			}
61
-		} else {
62
-			$GLOBALS['xoopsTpl']->assign('error', _AM_MYMODULE2_THEREARENT_TESTFIELDS);
63
-		}
33
+    case 'list':
34
+    default:
35
+        // Define Stylesheet
36
+        $GLOBALS['xoTheme']->addStylesheet( $style, null );
37
+        $start = Request::getInt('start', 0);
38
+        $limit = Request::getInt('limit', $helper->getConfig('adminpager'));
39
+        $templateMain = 'mymodule2_admin_testfields.tpl';
40
+        $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('testfields.php'));
41
+        $adminObject->addItemButton(_AM_MYMODULE2_ADD_TESTFIELD, 'testfields.php?op=new', 'add');
42
+        $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
43
+        $testfieldsCount = $testfieldsHandler->getCountTestfields();
44
+        $testfieldsAll = $testfieldsHandler->getAllTestfields($start, $limit);
45
+        $GLOBALS['xoopsTpl']->assign('testfields_count', $testfieldsCount);
46
+        $GLOBALS['xoopsTpl']->assign('mymodule2_url', MYMODULE2_URL);
47
+        $GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL);
48
+        // Table view testfields
49
+        if ($testfieldsCount > 0) {
50
+            foreach(array_keys($testfieldsAll) as $i) {
51
+                $testfield = $testfieldsAll[$i]->getValuesTestfields();
52
+                $GLOBALS['xoopsTpl']->append('testfields_list', $testfield);
53
+                unset($testfield);
54
+            }
55
+            // Display Navigation
56
+            if ($testfieldsCount > $limit) {
57
+                include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
58
+                $pagenav = new \XoopsPageNav($testfieldsCount, $limit, $start, 'start', 'op=list&limit=' . $limit);
59
+                $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
60
+            }
61
+        } else {
62
+            $GLOBALS['xoopsTpl']->assign('error', _AM_MYMODULE2_THEREARENT_TESTFIELDS);
63
+        }
64 64
 
65
-	break;
66
-	case 'new':
67
-		$templateMain = 'mymodule2_admin_testfields.tpl';
68
-		$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('testfields.php'));
69
-		$adminObject->addItemButton(_AM_MYMODULE2_TESTFIELDS_LIST, 'testfields.php', 'list');
70
-		$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
71
-		// Get Form
72
-		$testfieldsObj = $testfieldsHandler->create();
73
-		$form = $testfieldsObj->getFormTestfields();
74
-		$GLOBALS['xoopsTpl']->assign('form', $form->render());
65
+    break;
66
+    case 'new':
67
+        $templateMain = 'mymodule2_admin_testfields.tpl';
68
+        $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('testfields.php'));
69
+        $adminObject->addItemButton(_AM_MYMODULE2_TESTFIELDS_LIST, 'testfields.php', 'list');
70
+        $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
71
+        // Get Form
72
+        $testfieldsObj = $testfieldsHandler->create();
73
+        $form = $testfieldsObj->getFormTestfields();
74
+        $GLOBALS['xoopsTpl']->assign('form', $form->render());
75 75
 
76
-	break;
77
-	case 'save':
78
-		// Security Check
79
-		if (!$GLOBALS['xoopsSecurity']->check()) {
80
-			redirect_header('testfields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
81
-		}
82
-		if (isset($tfId)) {
83
-			$testfieldsObj = $testfieldsHandler->get($tfId);
84
-		} else {
85
-			$testfieldsObj = $testfieldsHandler->create();
86
-		}
87
-		// Set Vars
88
-		$testfieldsObj->setVar('tf_text', Request::getString('tf_text', ''));
89
-		$testfieldsObj->setVar('tf_textarea', Request::getString('tf_textarea', ''));
90
-		$testfieldsObj->setVar('tf_dhtml', Request::getString('tf_dhtml', ''));
91
-		$testfieldsObj->setVar('tf_checkbox', Request::getInt('tf_checkbox', 0));
92
-		$testfieldsObj->setVar('tf_yesno', Request::getInt('tf_yesno', 0));
93
-		$testfieldsObj->setVar('tf_selectbox', Request::getString('tf_selectbox', ''));
94
-		$testfieldsObj->setVar('tf_user', Request::getInt('tf_user', 0));
95
-		$testfieldsObj->setVar('tf_color', Request::getString('tf_color', ''));
96
-		// Set Var tf_imagelist
97
-		include_once XOOPS_ROOT_PATH . '/class/uploader.php';
98
-		$uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32', 
99
-													$helper->getConfig('mimetypes_image'), 
100
-													$helper->getConfig('maxsize_image'), null, null);
101
-		if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
102
-			//$uploader->setPrefix(tf_imagelist_);
103
-			//$uploader->fetchMedia($_POST['xoops_upload_file'][0]);
104
-			if (!$uploader->upload()) {
105
-				$errors = $uploader->getErrors();
106
-				redirect_header('javascript:history.go(-1).php', 3, $errors);
107
-			} else {
108
-				$testfieldsObj->setVar('tf_imagelist', $uploader->getSavedFileName());
109
-			}
110
-		} else {
111
-			$testfieldsObj->setVar('tf_imagelist', Request::getString('tf_imagelist'));
112
-		}
113
-		$testfieldsObj->setVar('tf_urlfile', formatUrl($_REQUEST['tf_urlfile']));
114
-		// Set Var tf_urlfile
115
-		include_once XOOPS_ROOT_PATH . '/class/uploader.php';
116
-		$filename       = $_FILES['tf_urlfile']['name'];
117
-		$imgNameDef     = Request::getString('tf_text');
118
-		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', 
119
-													$helper->getConfig('mimetypes_file'), 
120
-													$helper->getConfig('maxsize_file'), null, null);
121
-		if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) {
122
-			$extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
123
-			$imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
124
-			$uploader->setPrefix($imgName);
125
-			$uploader->fetchMedia($_POST['xoops_upload_file'][1]);
126
-			if (!$uploader->upload()) {
127
-				$errors = $uploader->getErrors();
128
-			} else {
129
-				$testfieldsObj->setVar('tf_urlfile', $uploader->getSavedFileName());
130
-			}
131
-		} else {
132
-			if ($filename > '') {
133
-				$uploaderErrors = $uploader->getErrors();
134
-			}
135
-			$testfieldsObj->setVar('tf_urlfile', Request::getString('tf_urlfile'));
136
-		}
137
-		// Set Var tf_uplimage
138
-		include_once XOOPS_ROOT_PATH . '/class/uploader.php';
139
-		$filename       = $_FILES['tf_uplimage']['name'];
140
-		$imgMimetype    = $_FILES['tf_uplimage']['type'];
141
-		$imgNameDef     = Request::getString('tf_text');
142
-		$uploaderErrors = '';
143
-		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/', 
144
-													$helper->getConfig('mimetypes_image'), 
145
-													$helper->getConfig('maxsize_image'), null, null);
146
-		if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) {
147
-			$extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
148
-			$imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
149
-			$uploader->setPrefix($imgName);
150
-			$uploader->fetchMedia($_POST['xoops_upload_file'][2]);
151
-			if (!$uploader->upload()) {
152
-				$uploaderErrors = $uploader->getErrors();
153
-			} else {
154
-				$savedFilename = $uploader->getSavedFileName();
155
-				$maxwidth  = (int)$helper->getConfig('maxwidth_image');
156
-				$maxheight = (int)$helper->getConfig('maxheight_image');
157
-				if ($maxwidth > 0 && $maxheight > 0) {
158
-					// Resize image
159
-					$imgHandler                = new Mymodule2\Common\Resizer();
160
-					$imgHandler->sourceFile    = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename;
161
-					$imgHandler->endFile       = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename;
162
-					$imgHandler->imageMimetype = $imgMimetype;
163
-					$imgHandler->maxWidth      = $maxwidth;
164
-					$imgHandler->maxHeight     = $maxheight;
165
-					$result                    = $imgHandler->resizeImage();
166
-				}
167
-				$testfieldsObj->setVar('tf_uplimage', $savedFilename);
168
-			}
169
-		} else {
170
-			if ($filename > '') {
171
-				$uploaderErrors = $uploader->getErrors();
172
-			}
173
-			$testfieldsObj->setVar('tf_uplimage', Request::getString('tf_uplimage'));
174
-		}
175
-		// Set Var tf_uplfile
176
-		include_once XOOPS_ROOT_PATH . '/class/uploader.php';
177
-		$filename       = $_FILES['tf_uplfile']['name'];
178
-		$imgNameDef     = Request::getString('tf_text');
179
-		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', 
180
-													$helper->getConfig('mimetypes_file'), 
181
-													$helper->getConfig('maxsize_file'), null, null);
182
-		if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) {
183
-			$extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
184
-			$imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
185
-			$uploader->setPrefix($imgName);
186
-			$uploader->fetchMedia($_POST['xoops_upload_file'][3]);
187
-			if (!$uploader->upload()) {
188
-				$errors = $uploader->getErrors();
189
-			} else {
190
-				$testfieldsObj->setVar('tf_uplfile', $uploader->getSavedFileName());
191
-			}
192
-		} else {
193
-			if ($filename > '') {
194
-				$uploaderErrors = $uploader->getErrors();
195
-			}
196
-			$testfieldsObj->setVar('tf_uplfile', Request::getString('tf_uplfile'));
197
-		}
198
-		$testfieldTextdateselect = date_create_from_format(_SHORTDATESTRING, Request::getString('tf_textdateselect'));
199
-		$testfieldsObj->setVar('tf_textdateselect', $testfieldTextdateselect->getTimestamp());
200
-		// Set Var tf_selectfile
201
-		include_once XOOPS_ROOT_PATH . '/class/uploader.php';
202
-		$filename       = $_FILES['tf_selectfile']['name'];
203
-		$imgNameDef     = Request::getString('tf_text');
204
-		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', 
205
-													$helper->getConfig('mimetypes_file'), 
206
-													$helper->getConfig('maxsize_file'), null, null);
207
-		if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) {
208
-			$extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
209
-			$imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
210
-			$uploader->setPrefix($imgName);
211
-			$uploader->fetchMedia($_POST['xoops_upload_file'][4]);
212
-			if (!$uploader->upload()) {
213
-				$errors = $uploader->getErrors();
214
-			} else {
215
-				$testfieldsObj->setVar('tf_selectfile', $uploader->getSavedFileName());
216
-			}
217
-		} else {
218
-			if ($filename > '') {
219
-				$uploaderErrors = $uploader->getErrors();
220
-			}
221
-			$testfieldsObj->setVar('tf_selectfile', Request::getString('tf_selectfile'));
222
-		}
223
-		$testfieldsObj->setVar('tf_status', Request::getInt('tf_status', 0));
224
-		// Insert Data
225
-		if ($testfieldsHandler->insert($testfieldsObj)) {
226
-			$newTfId = $testfieldsObj->getNewInsertedIdTestfields();
227
-			$permId = isset($_REQUEST['tf_id']) ? $tfId : $newTfId;
228
-			$grouppermHandler = xoops_getHandler('groupperm');
229
-			$mid = $GLOBALS['xoopsModule']->getVar('mid');
230
-			// Permission to view_testfields
231
-			$grouppermHandler->deleteByModule($mid, 'mymodule2_view_testfields', $permId);
232
-			if (isset($_POST['groups_view_testfields'])) {
233
-				foreach($_POST['groups_view_testfields'] as $onegroupId) {
234
-					$grouppermHandler->addRight('mymodule2_view_testfields', $permId, $onegroupId, $mid);
235
-				}
236
-			}
237
-			// Permission to submit_testfields
238
-			$grouppermHandler->deleteByModule($mid, 'mymodule2_submit_testfields', $permId);
239
-			if (isset($_POST['groups_submit_testfields'])) {
240
-				foreach($_POST['groups_submit_testfields'] as $onegroupId) {
241
-					$grouppermHandler->addRight('mymodule2_submit_testfields', $permId, $onegroupId, $mid);
242
-				}
243
-			}
244
-			// Permission to approve_testfields
245
-			$grouppermHandler->deleteByModule($mid, 'mymodule2_approve_testfields', $permId);
246
-			if (isset($_POST['groups_approve_testfields'])) {
247
-				foreach($_POST['groups_approve_testfields'] as $onegroupId) {
248
-					$grouppermHandler->addRight('mymodule2_approve_testfields', $permId, $onegroupId, $mid);
249
-				}
250
-			}
251
-			if ('' !== $uploaderErrors) {
252
-				redirect_header('testfields.php?op=edit&tf_id=' . $tfId, 5, $uploaderErrors);
253
-			} else {
254
-				redirect_header('testfields.php?op=list', 2, _AM_MYMODULE2_FORM_OK);
255
-			}
256
-		}
257
-		// Get Form
258
-		$GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors());
259
-		$form = $testfieldsObj->getFormTestfields();
260
-		$GLOBALS['xoopsTpl']->assign('form', $form->render());
76
+    break;
77
+    case 'save':
78
+        // Security Check
79
+        if (!$GLOBALS['xoopsSecurity']->check()) {
80
+            redirect_header('testfields.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
81
+        }
82
+        if (isset($tfId)) {
83
+            $testfieldsObj = $testfieldsHandler->get($tfId);
84
+        } else {
85
+            $testfieldsObj = $testfieldsHandler->create();
86
+        }
87
+        // Set Vars
88
+        $testfieldsObj->setVar('tf_text', Request::getString('tf_text', ''));
89
+        $testfieldsObj->setVar('tf_textarea', Request::getString('tf_textarea', ''));
90
+        $testfieldsObj->setVar('tf_dhtml', Request::getString('tf_dhtml', ''));
91
+        $testfieldsObj->setVar('tf_checkbox', Request::getInt('tf_checkbox', 0));
92
+        $testfieldsObj->setVar('tf_yesno', Request::getInt('tf_yesno', 0));
93
+        $testfieldsObj->setVar('tf_selectbox', Request::getString('tf_selectbox', ''));
94
+        $testfieldsObj->setVar('tf_user', Request::getInt('tf_user', 0));
95
+        $testfieldsObj->setVar('tf_color', Request::getString('tf_color', ''));
96
+        // Set Var tf_imagelist
97
+        include_once XOOPS_ROOT_PATH . '/class/uploader.php';
98
+        $uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32', 
99
+                                                    $helper->getConfig('mimetypes_image'), 
100
+                                                    $helper->getConfig('maxsize_image'), null, null);
101
+        if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
102
+            //$uploader->setPrefix(tf_imagelist_);
103
+            //$uploader->fetchMedia($_POST['xoops_upload_file'][0]);
104
+            if (!$uploader->upload()) {
105
+                $errors = $uploader->getErrors();
106
+                redirect_header('javascript:history.go(-1).php', 3, $errors);
107
+            } else {
108
+                $testfieldsObj->setVar('tf_imagelist', $uploader->getSavedFileName());
109
+            }
110
+        } else {
111
+            $testfieldsObj->setVar('tf_imagelist', Request::getString('tf_imagelist'));
112
+        }
113
+        $testfieldsObj->setVar('tf_urlfile', formatUrl($_REQUEST['tf_urlfile']));
114
+        // Set Var tf_urlfile
115
+        include_once XOOPS_ROOT_PATH . '/class/uploader.php';
116
+        $filename       = $_FILES['tf_urlfile']['name'];
117
+        $imgNameDef     = Request::getString('tf_text');
118
+        $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', 
119
+                                                    $helper->getConfig('mimetypes_file'), 
120
+                                                    $helper->getConfig('maxsize_file'), null, null);
121
+        if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) {
122
+            $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
123
+            $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
124
+            $uploader->setPrefix($imgName);
125
+            $uploader->fetchMedia($_POST['xoops_upload_file'][1]);
126
+            if (!$uploader->upload()) {
127
+                $errors = $uploader->getErrors();
128
+            } else {
129
+                $testfieldsObj->setVar('tf_urlfile', $uploader->getSavedFileName());
130
+            }
131
+        } else {
132
+            if ($filename > '') {
133
+                $uploaderErrors = $uploader->getErrors();
134
+            }
135
+            $testfieldsObj->setVar('tf_urlfile', Request::getString('tf_urlfile'));
136
+        }
137
+        // Set Var tf_uplimage
138
+        include_once XOOPS_ROOT_PATH . '/class/uploader.php';
139
+        $filename       = $_FILES['tf_uplimage']['name'];
140
+        $imgMimetype    = $_FILES['tf_uplimage']['type'];
141
+        $imgNameDef     = Request::getString('tf_text');
142
+        $uploaderErrors = '';
143
+        $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/', 
144
+                                                    $helper->getConfig('mimetypes_image'), 
145
+                                                    $helper->getConfig('maxsize_image'), null, null);
146
+        if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) {
147
+            $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
148
+            $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
149
+            $uploader->setPrefix($imgName);
150
+            $uploader->fetchMedia($_POST['xoops_upload_file'][2]);
151
+            if (!$uploader->upload()) {
152
+                $uploaderErrors = $uploader->getErrors();
153
+            } else {
154
+                $savedFilename = $uploader->getSavedFileName();
155
+                $maxwidth  = (int)$helper->getConfig('maxwidth_image');
156
+                $maxheight = (int)$helper->getConfig('maxheight_image');
157
+                if ($maxwidth > 0 && $maxheight > 0) {
158
+                    // Resize image
159
+                    $imgHandler                = new Mymodule2\Common\Resizer();
160
+                    $imgHandler->sourceFile    = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename;
161
+                    $imgHandler->endFile       = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename;
162
+                    $imgHandler->imageMimetype = $imgMimetype;
163
+                    $imgHandler->maxWidth      = $maxwidth;
164
+                    $imgHandler->maxHeight     = $maxheight;
165
+                    $result                    = $imgHandler->resizeImage();
166
+                }
167
+                $testfieldsObj->setVar('tf_uplimage', $savedFilename);
168
+            }
169
+        } else {
170
+            if ($filename > '') {
171
+                $uploaderErrors = $uploader->getErrors();
172
+            }
173
+            $testfieldsObj->setVar('tf_uplimage', Request::getString('tf_uplimage'));
174
+        }
175
+        // Set Var tf_uplfile
176
+        include_once XOOPS_ROOT_PATH . '/class/uploader.php';
177
+        $filename       = $_FILES['tf_uplfile']['name'];
178
+        $imgNameDef     = Request::getString('tf_text');
179
+        $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', 
180
+                                                    $helper->getConfig('mimetypes_file'), 
181
+                                                    $helper->getConfig('maxsize_file'), null, null);
182
+        if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) {
183
+            $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
184
+            $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
185
+            $uploader->setPrefix($imgName);
186
+            $uploader->fetchMedia($_POST['xoops_upload_file'][3]);
187
+            if (!$uploader->upload()) {
188
+                $errors = $uploader->getErrors();
189
+            } else {
190
+                $testfieldsObj->setVar('tf_uplfile', $uploader->getSavedFileName());
191
+            }
192
+        } else {
193
+            if ($filename > '') {
194
+                $uploaderErrors = $uploader->getErrors();
195
+            }
196
+            $testfieldsObj->setVar('tf_uplfile', Request::getString('tf_uplfile'));
197
+        }
198
+        $testfieldTextdateselect = date_create_from_format(_SHORTDATESTRING, Request::getString('tf_textdateselect'));
199
+        $testfieldsObj->setVar('tf_textdateselect', $testfieldTextdateselect->getTimestamp());
200
+        // Set Var tf_selectfile
201
+        include_once XOOPS_ROOT_PATH . '/class/uploader.php';
202
+        $filename       = $_FILES['tf_selectfile']['name'];
203
+        $imgNameDef     = Request::getString('tf_text');
204
+        $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', 
205
+                                                    $helper->getConfig('mimetypes_file'), 
206
+                                                    $helper->getConfig('maxsize_file'), null, null);
207
+        if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) {
208
+            $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
209
+            $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
210
+            $uploader->setPrefix($imgName);
211
+            $uploader->fetchMedia($_POST['xoops_upload_file'][4]);
212
+            if (!$uploader->upload()) {
213
+                $errors = $uploader->getErrors();
214
+            } else {
215
+                $testfieldsObj->setVar('tf_selectfile', $uploader->getSavedFileName());
216
+            }
217
+        } else {
218
+            if ($filename > '') {
219
+                $uploaderErrors = $uploader->getErrors();
220
+            }
221
+            $testfieldsObj->setVar('tf_selectfile', Request::getString('tf_selectfile'));
222
+        }
223
+        $testfieldsObj->setVar('tf_status', Request::getInt('tf_status', 0));
224
+        // Insert Data
225
+        if ($testfieldsHandler->insert($testfieldsObj)) {
226
+            $newTfId = $testfieldsObj->getNewInsertedIdTestfields();
227
+            $permId = isset($_REQUEST['tf_id']) ? $tfId : $newTfId;
228
+            $grouppermHandler = xoops_getHandler('groupperm');
229
+            $mid = $GLOBALS['xoopsModule']->getVar('mid');
230
+            // Permission to view_testfields
231
+            $grouppermHandler->deleteByModule($mid, 'mymodule2_view_testfields', $permId);
232
+            if (isset($_POST['groups_view_testfields'])) {
233
+                foreach($_POST['groups_view_testfields'] as $onegroupId) {
234
+                    $grouppermHandler->addRight('mymodule2_view_testfields', $permId, $onegroupId, $mid);
235
+                }
236
+            }
237
+            // Permission to submit_testfields
238
+            $grouppermHandler->deleteByModule($mid, 'mymodule2_submit_testfields', $permId);
239
+            if (isset($_POST['groups_submit_testfields'])) {
240
+                foreach($_POST['groups_submit_testfields'] as $onegroupId) {
241
+                    $grouppermHandler->addRight('mymodule2_submit_testfields', $permId, $onegroupId, $mid);
242
+                }
243
+            }
244
+            // Permission to approve_testfields
245
+            $grouppermHandler->deleteByModule($mid, 'mymodule2_approve_testfields', $permId);
246
+            if (isset($_POST['groups_approve_testfields'])) {
247
+                foreach($_POST['groups_approve_testfields'] as $onegroupId) {
248
+                    $grouppermHandler->addRight('mymodule2_approve_testfields', $permId, $onegroupId, $mid);
249
+                }
250
+            }
251
+            if ('' !== $uploaderErrors) {
252
+                redirect_header('testfields.php?op=edit&tf_id=' . $tfId, 5, $uploaderErrors);
253
+            } else {
254
+                redirect_header('testfields.php?op=list', 2, _AM_MYMODULE2_FORM_OK);
255
+            }
256
+        }
257
+        // Get Form
258
+        $GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors());
259
+        $form = $testfieldsObj->getFormTestfields();
260
+        $GLOBALS['xoopsTpl']->assign('form', $form->render());
261 261
 
262
-	break;
263
-	case 'edit':
264
-		$templateMain = 'mymodule2_admin_testfields.tpl';
265
-		$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('testfields.php'));
266
-		$adminObject->addItemButton(_AM_MYMODULE2_ADD_TESTFIELD, 'testfields.php?op=new', 'add');
267
-		$adminObject->addItemButton(_AM_MYMODULE2_TESTFIELDS_LIST, 'testfields.php', 'list');
268
-		$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
269
-		// Get Form
270
-		$testfieldsObj = $testfieldsHandler->get($tfId);
271
-		$form = $testfieldsObj->getFormTestfields();
272
-		$GLOBALS['xoopsTpl']->assign('form', $form->render());
262
+    break;
263
+    case 'edit':
264
+        $templateMain = 'mymodule2_admin_testfields.tpl';
265
+        $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('testfields.php'));
266
+        $adminObject->addItemButton(_AM_MYMODULE2_ADD_TESTFIELD, 'testfields.php?op=new', 'add');
267
+        $adminObject->addItemButton(_AM_MYMODULE2_TESTFIELDS_LIST, 'testfields.php', 'list');
268
+        $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
269
+        // Get Form
270
+        $testfieldsObj = $testfieldsHandler->get($tfId);
271
+        $form = $testfieldsObj->getFormTestfields();
272
+        $GLOBALS['xoopsTpl']->assign('form', $form->render());
273 273
 
274
-	break;
275
-	case 'delete':
276
-		$testfieldsObj = $testfieldsHandler->get($tfId);
277
-		if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) {
278
-			if (!$GLOBALS['xoopsSecurity']->check()) {
279
-				redirect_header('testfields.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors()));
280
-			}
281
-			if ($testfieldsHandler->delete($testfieldsObj)) {
282
-				redirect_header('testfields.php', 3, _AM_MYMODULE2_FORM_DELETE_OK);
283
-			} else {
284
-				$GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors());
285
-			}
286
-		} else {
287
-			xoops_confirm(array('ok' => 1, 'tf_id' => $tfId, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_MYMODULE2_FORM_SURE_DELETE, $testfieldsObj->getVar('tf_text')));
288
-		}
274
+    break;
275
+    case 'delete':
276
+        $testfieldsObj = $testfieldsHandler->get($tfId);
277
+        if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) {
278
+            if (!$GLOBALS['xoopsSecurity']->check()) {
279
+                redirect_header('testfields.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors()));
280
+            }
281
+            if ($testfieldsHandler->delete($testfieldsObj)) {
282
+                redirect_header('testfields.php', 3, _AM_MYMODULE2_FORM_DELETE_OK);
283
+            } else {
284
+                $GLOBALS['xoopsTpl']->assign('error', $testfieldsObj->getHtmlErrors());
285
+            }
286
+        } else {
287
+            xoops_confirm(array('ok' => 1, 'tf_id' => $tfId, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_MYMODULE2_FORM_SURE_DELETE, $testfieldsObj->getVar('tf_text')));
288
+        }
289 289
 
290
-	break;
290
+    break;
291 291
 }
292 292
 require __DIR__ . '/footer.php';
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -24,16 +24,16 @@  discard block
 block discarded – undo
24 24
 use XoopsModules\Mymodule2;
25 25
 use XoopsModules\Mymodule2\Constants;
26 26
 
27
-require __DIR__ . '/header.php';
27
+require __DIR__.'/header.php';
28 28
 // It recovered the value of argument op in URL$
29 29
 $op = Request::getString('op', 'list');
30 30
 // Request tf_id
31 31
 $tfId = Request::getInt('tf_id');
32
-switch($op) {
32
+switch ($op) {
33 33
 	case 'list':
34 34
 	default:
35 35
 		// Define Stylesheet
36
-		$GLOBALS['xoTheme']->addStylesheet( $style, null );
36
+		$GLOBALS['xoTheme']->addStylesheet($style, null);
37 37
 		$start = Request::getInt('start', 0);
38 38
 		$limit = Request::getInt('limit', $helper->getConfig('adminpager'));
39 39
 		$templateMain = 'mymodule2_admin_testfields.tpl';
@@ -47,15 +47,15 @@  discard block
 block discarded – undo
47 47
 		$GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL);
48 48
 		// Table view testfields
49 49
 		if ($testfieldsCount > 0) {
50
-			foreach(array_keys($testfieldsAll) as $i) {
50
+			foreach (array_keys($testfieldsAll) as $i) {
51 51
 				$testfield = $testfieldsAll[$i]->getValuesTestfields();
52 52
 				$GLOBALS['xoopsTpl']->append('testfields_list', $testfield);
53 53
 				unset($testfield);
54 54
 			}
55 55
 			// Display Navigation
56 56
 			if ($testfieldsCount > $limit) {
57
-				include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
58
-				$pagenav = new \XoopsPageNav($testfieldsCount, $limit, $start, 'start', 'op=list&limit=' . $limit);
57
+				include_once XOOPS_ROOT_PATH.'/class/pagenav.php';
58
+				$pagenav = new \XoopsPageNav($testfieldsCount, $limit, $start, 'start', 'op=list&limit='.$limit);
59 59
 				$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
60 60
 			}
61 61
 		} else {
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 		$testfieldsObj->setVar('tf_user', Request::getInt('tf_user', 0));
95 95
 		$testfieldsObj->setVar('tf_color', Request::getString('tf_color', ''));
96 96
 		// Set Var tf_imagelist
97
-		include_once XOOPS_ROOT_PATH . '/class/uploader.php';
98
-		$uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH . '/Frameworks/moduleclasses/icons/32', 
97
+		include_once XOOPS_ROOT_PATH.'/class/uploader.php';
98
+		$uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH.'/Frameworks/moduleclasses/icons/32', 
99 99
 													$helper->getConfig('mimetypes_image'), 
100 100
 													$helper->getConfig('maxsize_image'), null, null);
101 101
 		if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
@@ -112,15 +112,15 @@  discard block
 block discarded – undo
112 112
 		}
113 113
 		$testfieldsObj->setVar('tf_urlfile', formatUrl($_REQUEST['tf_urlfile']));
114 114
 		// Set Var tf_urlfile
115
-		include_once XOOPS_ROOT_PATH . '/class/uploader.php';
115
+		include_once XOOPS_ROOT_PATH.'/class/uploader.php';
116 116
 		$filename       = $_FILES['tf_urlfile']['name'];
117 117
 		$imgNameDef     = Request::getString('tf_text');
118
-		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', 
118
+		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH.'/testfields/', 
119 119
 													$helper->getConfig('mimetypes_file'), 
120 120
 													$helper->getConfig('maxsize_file'), null, null);
121 121
 		if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) {
122 122
 			$extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
123
-			$imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
123
+			$imgName = str_replace(' ', '', $imgNameDef).'.'.$extension;
124 124
 			$uploader->setPrefix($imgName);
125 125
 			$uploader->fetchMedia($_POST['xoops_upload_file'][1]);
126 126
 			if (!$uploader->upload()) {
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
 			$testfieldsObj->setVar('tf_urlfile', Request::getString('tf_urlfile'));
136 136
 		}
137 137
 		// Set Var tf_uplimage
138
-		include_once XOOPS_ROOT_PATH . '/class/uploader.php';
138
+		include_once XOOPS_ROOT_PATH.'/class/uploader.php';
139 139
 		$filename       = $_FILES['tf_uplimage']['name'];
140 140
 		$imgMimetype    = $_FILES['tf_uplimage']['type'];
141 141
 		$imgNameDef     = Request::getString('tf_text');
142 142
 		$uploaderErrors = '';
143
-		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/', 
143
+		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH.'/testfields/', 
144 144
 													$helper->getConfig('mimetypes_image'), 
145 145
 													$helper->getConfig('maxsize_image'), null, null);
146 146
 		if ($uploader->fetchMedia($_POST['xoops_upload_file'][2])) {
147 147
 			$extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
148
-			$imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
148
+			$imgName = str_replace(' ', '', $imgNameDef).'.'.$extension;
149 149
 			$uploader->setPrefix($imgName);
150 150
 			$uploader->fetchMedia($_POST['xoops_upload_file'][2]);
151 151
 			if (!$uploader->upload()) {
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 				if ($maxwidth > 0 && $maxheight > 0) {
158 158
 					// Resize image
159 159
 					$imgHandler                = new Mymodule2\Common\Resizer();
160
-					$imgHandler->sourceFile    = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename;
161
-					$imgHandler->endFile       = MYMODULE2_UPLOAD_IMAGE_PATH . '/testfields/' . $savedFilename;
160
+					$imgHandler->sourceFile    = MYMODULE2_UPLOAD_IMAGE_PATH.'/testfields/'.$savedFilename;
161
+					$imgHandler->endFile       = MYMODULE2_UPLOAD_IMAGE_PATH.'/testfields/'.$savedFilename;
162 162
 					$imgHandler->imageMimetype = $imgMimetype;
163 163
 					$imgHandler->maxWidth      = $maxwidth;
164 164
 					$imgHandler->maxHeight     = $maxheight;
@@ -173,15 +173,15 @@  discard block
 block discarded – undo
173 173
 			$testfieldsObj->setVar('tf_uplimage', Request::getString('tf_uplimage'));
174 174
 		}
175 175
 		// Set Var tf_uplfile
176
-		include_once XOOPS_ROOT_PATH . '/class/uploader.php';
176
+		include_once XOOPS_ROOT_PATH.'/class/uploader.php';
177 177
 		$filename       = $_FILES['tf_uplfile']['name'];
178 178
 		$imgNameDef     = Request::getString('tf_text');
179
-		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', 
179
+		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH.'/testfields/', 
180 180
 													$helper->getConfig('mimetypes_file'), 
181 181
 													$helper->getConfig('maxsize_file'), null, null);
182 182
 		if ($uploader->fetchMedia($_POST['xoops_upload_file'][3])) {
183 183
 			$extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
184
-			$imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
184
+			$imgName = str_replace(' ', '', $imgNameDef).'.'.$extension;
185 185
 			$uploader->setPrefix($imgName);
186 186
 			$uploader->fetchMedia($_POST['xoops_upload_file'][3]);
187 187
 			if (!$uploader->upload()) {
@@ -198,15 +198,15 @@  discard block
 block discarded – undo
198 198
 		$testfieldTextdateselect = date_create_from_format(_SHORTDATESTRING, Request::getString('tf_textdateselect'));
199 199
 		$testfieldsObj->setVar('tf_textdateselect', $testfieldTextdateselect->getTimestamp());
200 200
 		// Set Var tf_selectfile
201
-		include_once XOOPS_ROOT_PATH . '/class/uploader.php';
201
+		include_once XOOPS_ROOT_PATH.'/class/uploader.php';
202 202
 		$filename       = $_FILES['tf_selectfile']['name'];
203 203
 		$imgNameDef     = Request::getString('tf_text');
204
-		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/testfields/', 
204
+		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH.'/testfields/', 
205 205
 													$helper->getConfig('mimetypes_file'), 
206 206
 													$helper->getConfig('maxsize_file'), null, null);
207 207
 		if ($uploader->fetchMedia($_POST['xoops_upload_file'][4])) {
208 208
 			$extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
209
-			$imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
209
+			$imgName = str_replace(' ', '', $imgNameDef).'.'.$extension;
210 210
 			$uploader->setPrefix($imgName);
211 211
 			$uploader->fetchMedia($_POST['xoops_upload_file'][4]);
212 212
 			if (!$uploader->upload()) {
@@ -230,26 +230,26 @@  discard block
 block discarded – undo
230 230
 			// Permission to view_testfields
231 231
 			$grouppermHandler->deleteByModule($mid, 'mymodule2_view_testfields', $permId);
232 232
 			if (isset($_POST['groups_view_testfields'])) {
233
-				foreach($_POST['groups_view_testfields'] as $onegroupId) {
233
+				foreach ($_POST['groups_view_testfields'] as $onegroupId) {
234 234
 					$grouppermHandler->addRight('mymodule2_view_testfields', $permId, $onegroupId, $mid);
235 235
 				}
236 236
 			}
237 237
 			// Permission to submit_testfields
238 238
 			$grouppermHandler->deleteByModule($mid, 'mymodule2_submit_testfields', $permId);
239 239
 			if (isset($_POST['groups_submit_testfields'])) {
240
-				foreach($_POST['groups_submit_testfields'] as $onegroupId) {
240
+				foreach ($_POST['groups_submit_testfields'] as $onegroupId) {
241 241
 					$grouppermHandler->addRight('mymodule2_submit_testfields', $permId, $onegroupId, $mid);
242 242
 				}
243 243
 			}
244 244
 			// Permission to approve_testfields
245 245
 			$grouppermHandler->deleteByModule($mid, 'mymodule2_approve_testfields', $permId);
246 246
 			if (isset($_POST['groups_approve_testfields'])) {
247
-				foreach($_POST['groups_approve_testfields'] as $onegroupId) {
247
+				foreach ($_POST['groups_approve_testfields'] as $onegroupId) {
248 248
 					$grouppermHandler->addRight('mymodule2_approve_testfields', $permId, $onegroupId, $mid);
249 249
 				}
250 250
 			}
251 251
 			if ('' !== $uploaderErrors) {
252
-				redirect_header('testfields.php?op=edit&tf_id=' . $tfId, 5, $uploaderErrors);
252
+				redirect_header('testfields.php?op=edit&tf_id='.$tfId, 5, $uploaderErrors);
253 253
 			} else {
254 254
 				redirect_header('testfields.php?op=list', 2, _AM_MYMODULE2_FORM_OK);
255 255
 			}
@@ -289,4 +289,4 @@  discard block
 block discarded – undo
289 289
 
290 290
 	break;
291 291
 }
292
-require __DIR__ . '/footer.php';
292
+require __DIR__.'/footer.php';
Please login to merge, or discard this patch.
testdata/mymodule2/admin/feedback.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
 use Xmf\Request;
23 23
 
24
-include __DIR__ . '/header.php';
24
+include __DIR__.'/header.php';
25 25
 
26 26
 $adminObject = \Xmf\Module\Admin::getInstance();
27 27
 
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
         $fb_content = Request::getText('fb_content', '');
61 61
         $fb_content = str_replace(["\r\n", "\n", "\r"], '<br>', $fb_content); //clean line break from dhtmltextarea
62 62
 
63
-        $title       = constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_FOR') . $GLOBALS['xoopsModule']->getVar('dirname');
64
-        $body        = constant('CO_' . $moduleDirNameUpper . '_' . 'FB_NAME') . ': ' . $your_name . '<br>';
65
-        $body        .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_MAIL') . ': ' . $your_mail . '<br>';
66
-        $body        .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SITE') . ': ' . $your_site . '<br>';
67
-        $body        .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE') . ': ' . $fb_type . '<br><br>';
68
-        $body        .= constant('CO_' . $moduleDirNameUpper . '_' . 'FB_TYPE_CONTENT') . ':<br>';
63
+        $title       = constant('CO_'.$moduleDirNameUpper.'_'.'FB_SEND_FOR').$GLOBALS['xoopsModule']->getVar('dirname');
64
+        $body        = constant('CO_'.$moduleDirNameUpper.'_'.'FB_NAME').': '.$your_name.'<br>';
65
+        $body        .= constant('CO_'.$moduleDirNameUpper.'_'.'FB_MAIL').': '.$your_mail.'<br>';
66
+        $body        .= constant('CO_'.$moduleDirNameUpper.'_'.'FB_SITE').': '.$your_site.'<br>';
67
+        $body        .= constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE').': '.$fb_type.'<br><br>';
68
+        $body        .= constant('CO_'.$moduleDirNameUpper.'_'.'FB_TYPE_CONTENT').':<br>';
69 69
         $body        .= $fb_content;
70 70
         $xoopsMailer = xoops_getMailer();
71 71
         $xoopsMailer->useMail();
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         $xoopsMailer->setBody($body);
78 78
         $ret = $xoopsMailer->send();
79 79
         if ($ret) {
80
-            redirect_header('index.php', 3, constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_SUCCESS'));
80
+            redirect_header('index.php', 3, constant('CO_'.$moduleDirNameUpper.'_'.'FB_SEND_SUCCESS'));
81 81
         }
82 82
 
83 83
         // show form with content again
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
         $feedback->type    = $fb_type;
88 88
         $feedback->content = $fb_content;
89 89
         echo '<div align="center" style="width: 80%; padding: 10px; border: 2px solid #ff0000; color: #ff0000; margin-right:auto;margin-left:auto;">
90
-            <h3>' . constant('CO_' . $moduleDirNameUpper . '_' . 'FB_SEND_ERROR') . '</h3>
90
+            <h3>' . constant('CO_'.$moduleDirNameUpper.'_'.'FB_SEND_ERROR').'</h3>
91 91
             </div>';
92 92
         $form = $feedback->getFormFeedback();
93 93
         $form->display();
94 94
 
95 95
         break;
96 96
 }
97
-require __DIR__ . '/footer.php';
97
+require __DIR__.'/footer.php';
Please login to merge, or discard this patch.
testdata/mymodule2/admin/articles.php 2 patches
Indentation   +185 added lines, -185 removed lines patch added patch discarded remove patch
@@ -30,195 +30,195 @@
 block discarded – undo
30 30
 // Request art_id
31 31
 $artId = Request::getInt('art_id');
32 32
 switch($op) {
33
-	case 'list':
34
-	default:
35
-		// Define Stylesheet
36
-		$GLOBALS['xoTheme']->addStylesheet( $style, null );
37
-		$start = Request::getInt('start', 0);
38
-		$limit = Request::getInt('limit', $helper->getConfig('adminpager'));
39
-		$templateMain = 'mymodule2_admin_articles.tpl';
40
-		$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('articles.php'));
41
-		$adminObject->addItemButton(_AM_MYMODULE2_ADD_ARTICLE, 'articles.php?op=new', 'add');
42
-		$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
43
-		$articlesCount = $articlesHandler->getCountArticles();
44
-		$articlesAll = $articlesHandler->getAllArticles($start, $limit);
45
-		$GLOBALS['xoopsTpl']->assign('articles_count', $articlesCount);
46
-		$GLOBALS['xoopsTpl']->assign('mymodule2_url', MYMODULE2_URL);
47
-		$GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL);
48
-		// Table view articles
49
-		if ($articlesCount > 0) {
50
-			foreach(array_keys($articlesAll) as $i) {
51
-				$article = $articlesAll[$i]->getValuesArticles();
52
-				$GLOBALS['xoopsTpl']->append('articles_list', $article);
53
-				unset($article);
54
-			}
55
-			// Display Navigation
56
-			if ($articlesCount > $limit) {
57
-				include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
58
-				$pagenav = new \XoopsPageNav($articlesCount, $limit, $start, 'start', 'op=list&limit=' . $limit);
59
-				$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
60
-			}
61
-		} else {
62
-			$GLOBALS['xoopsTpl']->assign('error', _AM_MYMODULE2_THEREARENT_ARTICLES);
63
-		}
33
+    case 'list':
34
+    default:
35
+        // Define Stylesheet
36
+        $GLOBALS['xoTheme']->addStylesheet( $style, null );
37
+        $start = Request::getInt('start', 0);
38
+        $limit = Request::getInt('limit', $helper->getConfig('adminpager'));
39
+        $templateMain = 'mymodule2_admin_articles.tpl';
40
+        $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('articles.php'));
41
+        $adminObject->addItemButton(_AM_MYMODULE2_ADD_ARTICLE, 'articles.php?op=new', 'add');
42
+        $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
43
+        $articlesCount = $articlesHandler->getCountArticles();
44
+        $articlesAll = $articlesHandler->getAllArticles($start, $limit);
45
+        $GLOBALS['xoopsTpl']->assign('articles_count', $articlesCount);
46
+        $GLOBALS['xoopsTpl']->assign('mymodule2_url', MYMODULE2_URL);
47
+        $GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL);
48
+        // Table view articles
49
+        if ($articlesCount > 0) {
50
+            foreach(array_keys($articlesAll) as $i) {
51
+                $article = $articlesAll[$i]->getValuesArticles();
52
+                $GLOBALS['xoopsTpl']->append('articles_list', $article);
53
+                unset($article);
54
+            }
55
+            // Display Navigation
56
+            if ($articlesCount > $limit) {
57
+                include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
58
+                $pagenav = new \XoopsPageNav($articlesCount, $limit, $start, 'start', 'op=list&limit=' . $limit);
59
+                $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
60
+            }
61
+        } else {
62
+            $GLOBALS['xoopsTpl']->assign('error', _AM_MYMODULE2_THEREARENT_ARTICLES);
63
+        }
64 64
 
65
-	break;
66
-	case 'new':
67
-		$templateMain = 'mymodule2_admin_articles.tpl';
68
-		$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('articles.php'));
69
-		$adminObject->addItemButton(_AM_MYMODULE2_ARTICLES_LIST, 'articles.php', 'list');
70
-		$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
71
-		// Get Form
72
-		$articlesObj = $articlesHandler->create();
73
-		$form = $articlesObj->getFormArticles();
74
-		$GLOBALS['xoopsTpl']->assign('form', $form->render());
65
+    break;
66
+    case 'new':
67
+        $templateMain = 'mymodule2_admin_articles.tpl';
68
+        $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('articles.php'));
69
+        $adminObject->addItemButton(_AM_MYMODULE2_ARTICLES_LIST, 'articles.php', 'list');
70
+        $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
71
+        // Get Form
72
+        $articlesObj = $articlesHandler->create();
73
+        $form = $articlesObj->getFormArticles();
74
+        $GLOBALS['xoopsTpl']->assign('form', $form->render());
75 75
 
76
-	break;
77
-	case 'save':
78
-		// Security Check
79
-		if (!$GLOBALS['xoopsSecurity']->check()) {
80
-			redirect_header('articles.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
81
-		}
82
-		if (isset($artId)) {
83
-			$articlesObj = $articlesHandler->get($artId);
84
-		} else {
85
-			$articlesObj = $articlesHandler->create();
86
-		}
87
-		// Set Vars
88
-		$articlesObj->setVar('art_cat', Request::getInt('art_cat', 0));
89
-		$articlesObj->setVar('art_title', Request::getString('art_title', ''));
90
-		$articlesObj->setVar('art_descr', Request::getString('art_descr', ''));
91
-		// Set Var art_img
92
-		include_once XOOPS_ROOT_PATH . '/class/uploader.php';
93
-		$filename       = $_FILES['art_img']['name'];
94
-		$imgMimetype    = $_FILES['art_img']['type'];
95
-		$imgNameDef     = Request::getString('art_title');
96
-		$uploaderErrors = '';
97
-		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/articles/', 
98
-													$helper->getConfig('mimetypes_image'), 
99
-													$helper->getConfig('maxsize_image'), null, null);
100
-		if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
101
-			$extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
102
-			$imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
103
-			$uploader->setPrefix($imgName);
104
-			$uploader->fetchMedia($_POST['xoops_upload_file'][0]);
105
-			if (!$uploader->upload()) {
106
-				$uploaderErrors = $uploader->getErrors();
107
-			} else {
108
-				$savedFilename = $uploader->getSavedFileName();
109
-				$maxwidth  = (int)$helper->getConfig('maxwidth_image');
110
-				$maxheight = (int)$helper->getConfig('maxheight_image');
111
-				if ($maxwidth > 0 && $maxheight > 0) {
112
-					// Resize image
113
-					$imgHandler                = new Mymodule2\Common\Resizer();
114
-					$imgHandler->sourceFile    = MYMODULE2_UPLOAD_IMAGE_PATH . '/articles/' . $savedFilename;
115
-					$imgHandler->endFile       = MYMODULE2_UPLOAD_IMAGE_PATH . '/articles/' . $savedFilename;
116
-					$imgHandler->imageMimetype = $imgMimetype;
117
-					$imgHandler->maxWidth      = $maxwidth;
118
-					$imgHandler->maxHeight     = $maxheight;
119
-					$result                    = $imgHandler->resizeImage();
120
-				}
121
-				$articlesObj->setVar('art_img', $savedFilename);
122
-			}
123
-		} else {
124
-			if ($filename > '') {
125
-				$uploaderErrors = $uploader->getErrors();
126
-			}
127
-			$articlesObj->setVar('art_img', Request::getString('art_img'));
128
-		}
129
-		$articlesObj->setVar('art_status', Request::getInt('art_status', 0));
130
-		// Set Var art_file
131
-		include_once XOOPS_ROOT_PATH . '/class/uploader.php';
132
-		$filename       = $_FILES['art_file']['name'];
133
-		$imgNameDef     = Request::getString('art_title');
134
-		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/articles/', 
135
-													$helper->getConfig('mimetypes_file'), 
136
-													$helper->getConfig('maxsize_file'), null, null);
137
-		if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) {
138
-			$extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
139
-			$imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
140
-			$uploader->setPrefix($imgName);
141
-			$uploader->fetchMedia($_POST['xoops_upload_file'][1]);
142
-			if (!$uploader->upload()) {
143
-				$errors = $uploader->getErrors();
144
-			} else {
145
-				$articlesObj->setVar('art_file', $uploader->getSavedFileName());
146
-			}
147
-		} else {
148
-			if ($filename > '') {
149
-				$uploaderErrors = $uploader->getErrors();
150
-			}
151
-			$articlesObj->setVar('art_file', Request::getString('art_file'));
152
-		}
153
-		$articleCreated = date_create_from_format(_SHORTDATESTRING, Request::getString('art_created'));
154
-		$articlesObj->setVar('art_created', $articleCreated->getTimestamp());
155
-		$articlesObj->setVar('art_submitter', Request::getInt('art_submitter', 0));
156
-		// Insert Data
157
-		if ($articlesHandler->insert($articlesObj)) {
158
-			$newArtId = $articlesObj->getNewInsertedIdArticles();
159
-			$permId = isset($_REQUEST['art_id']) ? $artId : $newArtId;
160
-			$grouppermHandler = xoops_getHandler('groupperm');
161
-			$mid = $GLOBALS['xoopsModule']->getVar('mid');
162
-			// Permission to view_articles
163
-			$grouppermHandler->deleteByModule($mid, 'mymodule2_view_articles', $permId);
164
-			if (isset($_POST['groups_view_articles'])) {
165
-				foreach($_POST['groups_view_articles'] as $onegroupId) {
166
-					$grouppermHandler->addRight('mymodule2_view_articles', $permId, $onegroupId, $mid);
167
-				}
168
-			}
169
-			// Permission to submit_articles
170
-			$grouppermHandler->deleteByModule($mid, 'mymodule2_submit_articles', $permId);
171
-			if (isset($_POST['groups_submit_articles'])) {
172
-				foreach($_POST['groups_submit_articles'] as $onegroupId) {
173
-					$grouppermHandler->addRight('mymodule2_submit_articles', $permId, $onegroupId, $mid);
174
-				}
175
-			}
176
-			// Permission to approve_articles
177
-			$grouppermHandler->deleteByModule($mid, 'mymodule2_approve_articles', $permId);
178
-			if (isset($_POST['groups_approve_articles'])) {
179
-				foreach($_POST['groups_approve_articles'] as $onegroupId) {
180
-					$grouppermHandler->addRight('mymodule2_approve_articles', $permId, $onegroupId, $mid);
181
-				}
182
-			}
183
-			if ('' !== $uploaderErrors) {
184
-				redirect_header('articles.php?op=edit&art_id=' . $artId, 5, $uploaderErrors);
185
-			} else {
186
-				redirect_header('articles.php?op=list', 2, _AM_MYMODULE2_FORM_OK);
187
-			}
188
-		}
189
-		// Get Form
190
-		$GLOBALS['xoopsTpl']->assign('error', $articlesObj->getHtmlErrors());
191
-		$form = $articlesObj->getFormArticles();
192
-		$GLOBALS['xoopsTpl']->assign('form', $form->render());
76
+    break;
77
+    case 'save':
78
+        // Security Check
79
+        if (!$GLOBALS['xoopsSecurity']->check()) {
80
+            redirect_header('articles.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
81
+        }
82
+        if (isset($artId)) {
83
+            $articlesObj = $articlesHandler->get($artId);
84
+        } else {
85
+            $articlesObj = $articlesHandler->create();
86
+        }
87
+        // Set Vars
88
+        $articlesObj->setVar('art_cat', Request::getInt('art_cat', 0));
89
+        $articlesObj->setVar('art_title', Request::getString('art_title', ''));
90
+        $articlesObj->setVar('art_descr', Request::getString('art_descr', ''));
91
+        // Set Var art_img
92
+        include_once XOOPS_ROOT_PATH . '/class/uploader.php';
93
+        $filename       = $_FILES['art_img']['name'];
94
+        $imgMimetype    = $_FILES['art_img']['type'];
95
+        $imgNameDef     = Request::getString('art_title');
96
+        $uploaderErrors = '';
97
+        $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/articles/', 
98
+                                                    $helper->getConfig('mimetypes_image'), 
99
+                                                    $helper->getConfig('maxsize_image'), null, null);
100
+        if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
101
+            $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
102
+            $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
103
+            $uploader->setPrefix($imgName);
104
+            $uploader->fetchMedia($_POST['xoops_upload_file'][0]);
105
+            if (!$uploader->upload()) {
106
+                $uploaderErrors = $uploader->getErrors();
107
+            } else {
108
+                $savedFilename = $uploader->getSavedFileName();
109
+                $maxwidth  = (int)$helper->getConfig('maxwidth_image');
110
+                $maxheight = (int)$helper->getConfig('maxheight_image');
111
+                if ($maxwidth > 0 && $maxheight > 0) {
112
+                    // Resize image
113
+                    $imgHandler                = new Mymodule2\Common\Resizer();
114
+                    $imgHandler->sourceFile    = MYMODULE2_UPLOAD_IMAGE_PATH . '/articles/' . $savedFilename;
115
+                    $imgHandler->endFile       = MYMODULE2_UPLOAD_IMAGE_PATH . '/articles/' . $savedFilename;
116
+                    $imgHandler->imageMimetype = $imgMimetype;
117
+                    $imgHandler->maxWidth      = $maxwidth;
118
+                    $imgHandler->maxHeight     = $maxheight;
119
+                    $result                    = $imgHandler->resizeImage();
120
+                }
121
+                $articlesObj->setVar('art_img', $savedFilename);
122
+            }
123
+        } else {
124
+            if ($filename > '') {
125
+                $uploaderErrors = $uploader->getErrors();
126
+            }
127
+            $articlesObj->setVar('art_img', Request::getString('art_img'));
128
+        }
129
+        $articlesObj->setVar('art_status', Request::getInt('art_status', 0));
130
+        // Set Var art_file
131
+        include_once XOOPS_ROOT_PATH . '/class/uploader.php';
132
+        $filename       = $_FILES['art_file']['name'];
133
+        $imgNameDef     = Request::getString('art_title');
134
+        $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/articles/', 
135
+                                                    $helper->getConfig('mimetypes_file'), 
136
+                                                    $helper->getConfig('maxsize_file'), null, null);
137
+        if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) {
138
+            $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
139
+            $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
140
+            $uploader->setPrefix($imgName);
141
+            $uploader->fetchMedia($_POST['xoops_upload_file'][1]);
142
+            if (!$uploader->upload()) {
143
+                $errors = $uploader->getErrors();
144
+            } else {
145
+                $articlesObj->setVar('art_file', $uploader->getSavedFileName());
146
+            }
147
+        } else {
148
+            if ($filename > '') {
149
+                $uploaderErrors = $uploader->getErrors();
150
+            }
151
+            $articlesObj->setVar('art_file', Request::getString('art_file'));
152
+        }
153
+        $articleCreated = date_create_from_format(_SHORTDATESTRING, Request::getString('art_created'));
154
+        $articlesObj->setVar('art_created', $articleCreated->getTimestamp());
155
+        $articlesObj->setVar('art_submitter', Request::getInt('art_submitter', 0));
156
+        // Insert Data
157
+        if ($articlesHandler->insert($articlesObj)) {
158
+            $newArtId = $articlesObj->getNewInsertedIdArticles();
159
+            $permId = isset($_REQUEST['art_id']) ? $artId : $newArtId;
160
+            $grouppermHandler = xoops_getHandler('groupperm');
161
+            $mid = $GLOBALS['xoopsModule']->getVar('mid');
162
+            // Permission to view_articles
163
+            $grouppermHandler->deleteByModule($mid, 'mymodule2_view_articles', $permId);
164
+            if (isset($_POST['groups_view_articles'])) {
165
+                foreach($_POST['groups_view_articles'] as $onegroupId) {
166
+                    $grouppermHandler->addRight('mymodule2_view_articles', $permId, $onegroupId, $mid);
167
+                }
168
+            }
169
+            // Permission to submit_articles
170
+            $grouppermHandler->deleteByModule($mid, 'mymodule2_submit_articles', $permId);
171
+            if (isset($_POST['groups_submit_articles'])) {
172
+                foreach($_POST['groups_submit_articles'] as $onegroupId) {
173
+                    $grouppermHandler->addRight('mymodule2_submit_articles', $permId, $onegroupId, $mid);
174
+                }
175
+            }
176
+            // Permission to approve_articles
177
+            $grouppermHandler->deleteByModule($mid, 'mymodule2_approve_articles', $permId);
178
+            if (isset($_POST['groups_approve_articles'])) {
179
+                foreach($_POST['groups_approve_articles'] as $onegroupId) {
180
+                    $grouppermHandler->addRight('mymodule2_approve_articles', $permId, $onegroupId, $mid);
181
+                }
182
+            }
183
+            if ('' !== $uploaderErrors) {
184
+                redirect_header('articles.php?op=edit&art_id=' . $artId, 5, $uploaderErrors);
185
+            } else {
186
+                redirect_header('articles.php?op=list', 2, _AM_MYMODULE2_FORM_OK);
187
+            }
188
+        }
189
+        // Get Form
190
+        $GLOBALS['xoopsTpl']->assign('error', $articlesObj->getHtmlErrors());
191
+        $form = $articlesObj->getFormArticles();
192
+        $GLOBALS['xoopsTpl']->assign('form', $form->render());
193 193
 
194
-	break;
195
-	case 'edit':
196
-		$templateMain = 'mymodule2_admin_articles.tpl';
197
-		$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('articles.php'));
198
-		$adminObject->addItemButton(_AM_MYMODULE2_ADD_ARTICLE, 'articles.php?op=new', 'add');
199
-		$adminObject->addItemButton(_AM_MYMODULE2_ARTICLES_LIST, 'articles.php', 'list');
200
-		$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
201
-		// Get Form
202
-		$articlesObj = $articlesHandler->get($artId);
203
-		$form = $articlesObj->getFormArticles();
204
-		$GLOBALS['xoopsTpl']->assign('form', $form->render());
194
+    break;
195
+    case 'edit':
196
+        $templateMain = 'mymodule2_admin_articles.tpl';
197
+        $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('articles.php'));
198
+        $adminObject->addItemButton(_AM_MYMODULE2_ADD_ARTICLE, 'articles.php?op=new', 'add');
199
+        $adminObject->addItemButton(_AM_MYMODULE2_ARTICLES_LIST, 'articles.php', 'list');
200
+        $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
201
+        // Get Form
202
+        $articlesObj = $articlesHandler->get($artId);
203
+        $form = $articlesObj->getFormArticles();
204
+        $GLOBALS['xoopsTpl']->assign('form', $form->render());
205 205
 
206
-	break;
207
-	case 'delete':
208
-		$articlesObj = $articlesHandler->get($artId);
209
-		if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) {
210
-			if (!$GLOBALS['xoopsSecurity']->check()) {
211
-				redirect_header('articles.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors()));
212
-			}
213
-			if ($articlesHandler->delete($articlesObj)) {
214
-				redirect_header('articles.php', 3, _AM_MYMODULE2_FORM_DELETE_OK);
215
-			} else {
216
-				$GLOBALS['xoopsTpl']->assign('error', $articlesObj->getHtmlErrors());
217
-			}
218
-		} else {
219
-			xoops_confirm(array('ok' => 1, 'art_id' => $artId, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_MYMODULE2_FORM_SURE_DELETE, $articlesObj->getVar('art_title')));
220
-		}
206
+    break;
207
+    case 'delete':
208
+        $articlesObj = $articlesHandler->get($artId);
209
+        if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) {
210
+            if (!$GLOBALS['xoopsSecurity']->check()) {
211
+                redirect_header('articles.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors()));
212
+            }
213
+            if ($articlesHandler->delete($articlesObj)) {
214
+                redirect_header('articles.php', 3, _AM_MYMODULE2_FORM_DELETE_OK);
215
+            } else {
216
+                $GLOBALS['xoopsTpl']->assign('error', $articlesObj->getHtmlErrors());
217
+            }
218
+        } else {
219
+            xoops_confirm(array('ok' => 1, 'art_id' => $artId, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_MYMODULE2_FORM_SURE_DELETE, $articlesObj->getVar('art_title')));
220
+        }
221 221
 
222
-	break;
222
+    break;
223 223
 }
224 224
 require __DIR__ . '/footer.php';
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -24,16 +24,16 @@  discard block
 block discarded – undo
24 24
 use XoopsModules\Mymodule2;
25 25
 use XoopsModules\Mymodule2\Constants;
26 26
 
27
-require __DIR__ . '/header.php';
27
+require __DIR__.'/header.php';
28 28
 // It recovered the value of argument op in URL$
29 29
 $op = Request::getString('op', 'list');
30 30
 // Request art_id
31 31
 $artId = Request::getInt('art_id');
32
-switch($op) {
32
+switch ($op) {
33 33
 	case 'list':
34 34
 	default:
35 35
 		// Define Stylesheet
36
-		$GLOBALS['xoTheme']->addStylesheet( $style, null );
36
+		$GLOBALS['xoTheme']->addStylesheet($style, null);
37 37
 		$start = Request::getInt('start', 0);
38 38
 		$limit = Request::getInt('limit', $helper->getConfig('adminpager'));
39 39
 		$templateMain = 'mymodule2_admin_articles.tpl';
@@ -47,15 +47,15 @@  discard block
 block discarded – undo
47 47
 		$GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL);
48 48
 		// Table view articles
49 49
 		if ($articlesCount > 0) {
50
-			foreach(array_keys($articlesAll) as $i) {
50
+			foreach (array_keys($articlesAll) as $i) {
51 51
 				$article = $articlesAll[$i]->getValuesArticles();
52 52
 				$GLOBALS['xoopsTpl']->append('articles_list', $article);
53 53
 				unset($article);
54 54
 			}
55 55
 			// Display Navigation
56 56
 			if ($articlesCount > $limit) {
57
-				include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
58
-				$pagenav = new \XoopsPageNav($articlesCount, $limit, $start, 'start', 'op=list&limit=' . $limit);
57
+				include_once XOOPS_ROOT_PATH.'/class/pagenav.php';
58
+				$pagenav = new \XoopsPageNav($articlesCount, $limit, $start, 'start', 'op=list&limit='.$limit);
59 59
 				$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
60 60
 			}
61 61
 		} else {
@@ -89,17 +89,17 @@  discard block
 block discarded – undo
89 89
 		$articlesObj->setVar('art_title', Request::getString('art_title', ''));
90 90
 		$articlesObj->setVar('art_descr', Request::getString('art_descr', ''));
91 91
 		// Set Var art_img
92
-		include_once XOOPS_ROOT_PATH . '/class/uploader.php';
92
+		include_once XOOPS_ROOT_PATH.'/class/uploader.php';
93 93
 		$filename       = $_FILES['art_img']['name'];
94 94
 		$imgMimetype    = $_FILES['art_img']['type'];
95 95
 		$imgNameDef     = Request::getString('art_title');
96 96
 		$uploaderErrors = '';
97
-		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/articles/', 
97
+		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH.'/articles/', 
98 98
 													$helper->getConfig('mimetypes_image'), 
99 99
 													$helper->getConfig('maxsize_image'), null, null);
100 100
 		if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
101 101
 			$extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
102
-			$imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
102
+			$imgName = str_replace(' ', '', $imgNameDef).'.'.$extension;
103 103
 			$uploader->setPrefix($imgName);
104 104
 			$uploader->fetchMedia($_POST['xoops_upload_file'][0]);
105 105
 			if (!$uploader->upload()) {
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 				if ($maxwidth > 0 && $maxheight > 0) {
112 112
 					// Resize image
113 113
 					$imgHandler                = new Mymodule2\Common\Resizer();
114
-					$imgHandler->sourceFile    = MYMODULE2_UPLOAD_IMAGE_PATH . '/articles/' . $savedFilename;
115
-					$imgHandler->endFile       = MYMODULE2_UPLOAD_IMAGE_PATH . '/articles/' . $savedFilename;
114
+					$imgHandler->sourceFile    = MYMODULE2_UPLOAD_IMAGE_PATH.'/articles/'.$savedFilename;
115
+					$imgHandler->endFile       = MYMODULE2_UPLOAD_IMAGE_PATH.'/articles/'.$savedFilename;
116 116
 					$imgHandler->imageMimetype = $imgMimetype;
117 117
 					$imgHandler->maxWidth      = $maxwidth;
118 118
 					$imgHandler->maxHeight     = $maxheight;
@@ -128,15 +128,15 @@  discard block
 block discarded – undo
128 128
 		}
129 129
 		$articlesObj->setVar('art_status', Request::getInt('art_status', 0));
130 130
 		// Set Var art_file
131
-		include_once XOOPS_ROOT_PATH . '/class/uploader.php';
131
+		include_once XOOPS_ROOT_PATH.'/class/uploader.php';
132 132
 		$filename       = $_FILES['art_file']['name'];
133 133
 		$imgNameDef     = Request::getString('art_title');
134
-		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH . '/articles/', 
134
+		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_FILES_PATH.'/articles/', 
135 135
 													$helper->getConfig('mimetypes_file'), 
136 136
 													$helper->getConfig('maxsize_file'), null, null);
137 137
 		if ($uploader->fetchMedia($_POST['xoops_upload_file'][1])) {
138 138
 			$extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
139
-			$imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
139
+			$imgName = str_replace(' ', '', $imgNameDef).'.'.$extension;
140 140
 			$uploader->setPrefix($imgName);
141 141
 			$uploader->fetchMedia($_POST['xoops_upload_file'][1]);
142 142
 			if (!$uploader->upload()) {
@@ -162,26 +162,26 @@  discard block
 block discarded – undo
162 162
 			// Permission to view_articles
163 163
 			$grouppermHandler->deleteByModule($mid, 'mymodule2_view_articles', $permId);
164 164
 			if (isset($_POST['groups_view_articles'])) {
165
-				foreach($_POST['groups_view_articles'] as $onegroupId) {
165
+				foreach ($_POST['groups_view_articles'] as $onegroupId) {
166 166
 					$grouppermHandler->addRight('mymodule2_view_articles', $permId, $onegroupId, $mid);
167 167
 				}
168 168
 			}
169 169
 			// Permission to submit_articles
170 170
 			$grouppermHandler->deleteByModule($mid, 'mymodule2_submit_articles', $permId);
171 171
 			if (isset($_POST['groups_submit_articles'])) {
172
-				foreach($_POST['groups_submit_articles'] as $onegroupId) {
172
+				foreach ($_POST['groups_submit_articles'] as $onegroupId) {
173 173
 					$grouppermHandler->addRight('mymodule2_submit_articles', $permId, $onegroupId, $mid);
174 174
 				}
175 175
 			}
176 176
 			// Permission to approve_articles
177 177
 			$grouppermHandler->deleteByModule($mid, 'mymodule2_approve_articles', $permId);
178 178
 			if (isset($_POST['groups_approve_articles'])) {
179
-				foreach($_POST['groups_approve_articles'] as $onegroupId) {
179
+				foreach ($_POST['groups_approve_articles'] as $onegroupId) {
180 180
 					$grouppermHandler->addRight('mymodule2_approve_articles', $permId, $onegroupId, $mid);
181 181
 				}
182 182
 			}
183 183
 			if ('' !== $uploaderErrors) {
184
-				redirect_header('articles.php?op=edit&art_id=' . $artId, 5, $uploaderErrors);
184
+				redirect_header('articles.php?op=edit&art_id='.$artId, 5, $uploaderErrors);
185 185
 			} else {
186 186
 				redirect_header('articles.php?op=list', 2, _AM_MYMODULE2_FORM_OK);
187 187
 			}
@@ -221,4 +221,4 @@  discard block
 block discarded – undo
221 221
 
222 222
 	break;
223 223
 }
224
-require __DIR__ . '/footer.php';
224
+require __DIR__.'/footer.php';
Please login to merge, or discard this patch.
testdata/mymodule2/admin/categories.php 2 patches
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -30,144 +30,144 @@
 block discarded – undo
30 30
 // Request cat_id
31 31
 $catId = Request::getInt('cat_id');
32 32
 switch($op) {
33
-	case 'list':
34
-	default:
35
-		// Define Stylesheet
36
-		$GLOBALS['xoTheme']->addStylesheet( $style, null );
37
-		$start = Request::getInt('start', 0);
38
-		$limit = Request::getInt('limit', $helper->getConfig('adminpager'));
39
-		$templateMain = 'mymodule2_admin_categories.tpl';
40
-		$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('categories.php'));
41
-		$adminObject->addItemButton(_AM_MYMODULE2_ADD_CATEGORY, 'categories.php?op=new', 'add');
42
-		$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
43
-		$categoriesCount = $categoriesHandler->getCountCategories();
44
-		$categoriesAll = $categoriesHandler->getAllCategories($start, $limit);
45
-		$GLOBALS['xoopsTpl']->assign('categories_count', $categoriesCount);
46
-		$GLOBALS['xoopsTpl']->assign('mymodule2_url', MYMODULE2_URL);
47
-		$GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL);
48
-		// Table view categories
49
-		if ($categoriesCount > 0) {
50
-			foreach(array_keys($categoriesAll) as $i) {
51
-				$category = $categoriesAll[$i]->getValuesCategories();
52
-				$GLOBALS['xoopsTpl']->append('categories_list', $category);
53
-				unset($category);
54
-			}
55
-			// Display Navigation
56
-			if ($categoriesCount > $limit) {
57
-				include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
58
-				$pagenav = new \XoopsPageNav($categoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit);
59
-				$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
60
-			}
61
-		} else {
62
-			$GLOBALS['xoopsTpl']->assign('error', _AM_MYMODULE2_THEREARENT_CATEGORIES);
63
-		}
33
+    case 'list':
34
+    default:
35
+        // Define Stylesheet
36
+        $GLOBALS['xoTheme']->addStylesheet( $style, null );
37
+        $start = Request::getInt('start', 0);
38
+        $limit = Request::getInt('limit', $helper->getConfig('adminpager'));
39
+        $templateMain = 'mymodule2_admin_categories.tpl';
40
+        $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('categories.php'));
41
+        $adminObject->addItemButton(_AM_MYMODULE2_ADD_CATEGORY, 'categories.php?op=new', 'add');
42
+        $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
43
+        $categoriesCount = $categoriesHandler->getCountCategories();
44
+        $categoriesAll = $categoriesHandler->getAllCategories($start, $limit);
45
+        $GLOBALS['xoopsTpl']->assign('categories_count', $categoriesCount);
46
+        $GLOBALS['xoopsTpl']->assign('mymodule2_url', MYMODULE2_URL);
47
+        $GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL);
48
+        // Table view categories
49
+        if ($categoriesCount > 0) {
50
+            foreach(array_keys($categoriesAll) as $i) {
51
+                $category = $categoriesAll[$i]->getValuesCategories();
52
+                $GLOBALS['xoopsTpl']->append('categories_list', $category);
53
+                unset($category);
54
+            }
55
+            // Display Navigation
56
+            if ($categoriesCount > $limit) {
57
+                include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
58
+                $pagenav = new \XoopsPageNav($categoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit);
59
+                $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
60
+            }
61
+        } else {
62
+            $GLOBALS['xoopsTpl']->assign('error', _AM_MYMODULE2_THEREARENT_CATEGORIES);
63
+        }
64 64
 
65
-	break;
66
-	case 'new':
67
-		$templateMain = 'mymodule2_admin_categories.tpl';
68
-		$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('categories.php'));
69
-		$adminObject->addItemButton(_AM_MYMODULE2_CATEGORIES_LIST, 'categories.php', 'list');
70
-		$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
71
-		// Get Form
72
-		$categoriesObj = $categoriesHandler->create();
73
-		$form = $categoriesObj->getFormCategories();
74
-		$GLOBALS['xoopsTpl']->assign('form', $form->render());
65
+    break;
66
+    case 'new':
67
+        $templateMain = 'mymodule2_admin_categories.tpl';
68
+        $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('categories.php'));
69
+        $adminObject->addItemButton(_AM_MYMODULE2_CATEGORIES_LIST, 'categories.php', 'list');
70
+        $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
71
+        // Get Form
72
+        $categoriesObj = $categoriesHandler->create();
73
+        $form = $categoriesObj->getFormCategories();
74
+        $GLOBALS['xoopsTpl']->assign('form', $form->render());
75 75
 
76
-	break;
77
-	case 'save':
78
-		// Security Check
79
-		if (!$GLOBALS['xoopsSecurity']->check()) {
80
-			redirect_header('categories.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
81
-		}
82
-		if (isset($catId)) {
83
-			$categoriesObj = $categoriesHandler->get($catId);
84
-		} else {
85
-			$categoriesObj = $categoriesHandler->create();
86
-		}
87
-		// Set Vars
88
-		$categoriesObj->setVar('cat_name', Request::getString('cat_name', ''));
89
-		// Set Var cat_logo
90
-		include_once XOOPS_ROOT_PATH . '/class/uploader.php';
91
-		$filename       = $_FILES['cat_logo']['name'];
92
-		$imgMimetype    = $_FILES['cat_logo']['type'];
93
-		$imgNameDef     = Request::getString('cat_name');
94
-		$uploaderErrors = '';
95
-		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/categories/', 
96
-													$helper->getConfig('mimetypes_image'), 
97
-													$helper->getConfig('maxsize_image'), null, null);
98
-		if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
99
-			$extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
100
-			$imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
101
-			$uploader->setPrefix($imgName);
102
-			$uploader->fetchMedia($_POST['xoops_upload_file'][0]);
103
-			if (!$uploader->upload()) {
104
-				$uploaderErrors = $uploader->getErrors();
105
-			} else {
106
-				$savedFilename = $uploader->getSavedFileName();
107
-				$maxwidth  = (int)$helper->getConfig('maxwidth_image');
108
-				$maxheight = (int)$helper->getConfig('maxheight_image');
109
-				if ($maxwidth > 0 && $maxheight > 0) {
110
-					// Resize image
111
-					$imgHandler                = new Mymodule2\Common\Resizer();
112
-					$imgHandler->sourceFile    = MYMODULE2_UPLOAD_IMAGE_PATH . '/categories/' . $savedFilename;
113
-					$imgHandler->endFile       = MYMODULE2_UPLOAD_IMAGE_PATH . '/categories/' . $savedFilename;
114
-					$imgHandler->imageMimetype = $imgMimetype;
115
-					$imgHandler->maxWidth      = $maxwidth;
116
-					$imgHandler->maxHeight     = $maxheight;
117
-					$result                    = $imgHandler->resizeImage();
118
-				}
119
-				$categoriesObj->setVar('cat_logo', $savedFilename);
120
-			}
121
-		} else {
122
-			if ($filename > '') {
123
-				$uploaderErrors = $uploader->getErrors();
124
-			}
125
-			$categoriesObj->setVar('cat_logo', Request::getString('cat_logo'));
126
-		}
127
-		$categoryCreated = date_create_from_format(_SHORTDATESTRING, Request::getString('cat_created'));
128
-		$categoriesObj->setVar('cat_created', $categoryCreated->getTimestamp());
129
-		$categoriesObj->setVar('cat_submitter', Request::getInt('cat_submitter', 0));
130
-		// Insert Data
131
-		if ($categoriesHandler->insert($categoriesObj)) {
132
-			if ('' !== $uploaderErrors) {
133
-				redirect_header('categories.php?op=edit&cat_id=' . $catId, 5, $uploaderErrors);
134
-			} else {
135
-				redirect_header('categories.php?op=list', 2, _AM_MYMODULE2_FORM_OK);
136
-			}
137
-		}
138
-		// Get Form
139
-		$GLOBALS['xoopsTpl']->assign('error', $categoriesObj->getHtmlErrors());
140
-		$form = $categoriesObj->getFormCategories();
141
-		$GLOBALS['xoopsTpl']->assign('form', $form->render());
76
+    break;
77
+    case 'save':
78
+        // Security Check
79
+        if (!$GLOBALS['xoopsSecurity']->check()) {
80
+            redirect_header('categories.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
81
+        }
82
+        if (isset($catId)) {
83
+            $categoriesObj = $categoriesHandler->get($catId);
84
+        } else {
85
+            $categoriesObj = $categoriesHandler->create();
86
+        }
87
+        // Set Vars
88
+        $categoriesObj->setVar('cat_name', Request::getString('cat_name', ''));
89
+        // Set Var cat_logo
90
+        include_once XOOPS_ROOT_PATH . '/class/uploader.php';
91
+        $filename       = $_FILES['cat_logo']['name'];
92
+        $imgMimetype    = $_FILES['cat_logo']['type'];
93
+        $imgNameDef     = Request::getString('cat_name');
94
+        $uploaderErrors = '';
95
+        $uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/categories/', 
96
+                                                    $helper->getConfig('mimetypes_image'), 
97
+                                                    $helper->getConfig('maxsize_image'), null, null);
98
+        if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
99
+            $extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
100
+            $imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
101
+            $uploader->setPrefix($imgName);
102
+            $uploader->fetchMedia($_POST['xoops_upload_file'][0]);
103
+            if (!$uploader->upload()) {
104
+                $uploaderErrors = $uploader->getErrors();
105
+            } else {
106
+                $savedFilename = $uploader->getSavedFileName();
107
+                $maxwidth  = (int)$helper->getConfig('maxwidth_image');
108
+                $maxheight = (int)$helper->getConfig('maxheight_image');
109
+                if ($maxwidth > 0 && $maxheight > 0) {
110
+                    // Resize image
111
+                    $imgHandler                = new Mymodule2\Common\Resizer();
112
+                    $imgHandler->sourceFile    = MYMODULE2_UPLOAD_IMAGE_PATH . '/categories/' . $savedFilename;
113
+                    $imgHandler->endFile       = MYMODULE2_UPLOAD_IMAGE_PATH . '/categories/' . $savedFilename;
114
+                    $imgHandler->imageMimetype = $imgMimetype;
115
+                    $imgHandler->maxWidth      = $maxwidth;
116
+                    $imgHandler->maxHeight     = $maxheight;
117
+                    $result                    = $imgHandler->resizeImage();
118
+                }
119
+                $categoriesObj->setVar('cat_logo', $savedFilename);
120
+            }
121
+        } else {
122
+            if ($filename > '') {
123
+                $uploaderErrors = $uploader->getErrors();
124
+            }
125
+            $categoriesObj->setVar('cat_logo', Request::getString('cat_logo'));
126
+        }
127
+        $categoryCreated = date_create_from_format(_SHORTDATESTRING, Request::getString('cat_created'));
128
+        $categoriesObj->setVar('cat_created', $categoryCreated->getTimestamp());
129
+        $categoriesObj->setVar('cat_submitter', Request::getInt('cat_submitter', 0));
130
+        // Insert Data
131
+        if ($categoriesHandler->insert($categoriesObj)) {
132
+            if ('' !== $uploaderErrors) {
133
+                redirect_header('categories.php?op=edit&cat_id=' . $catId, 5, $uploaderErrors);
134
+            } else {
135
+                redirect_header('categories.php?op=list', 2, _AM_MYMODULE2_FORM_OK);
136
+            }
137
+        }
138
+        // Get Form
139
+        $GLOBALS['xoopsTpl']->assign('error', $categoriesObj->getHtmlErrors());
140
+        $form = $categoriesObj->getFormCategories();
141
+        $GLOBALS['xoopsTpl']->assign('form', $form->render());
142 142
 
143
-	break;
144
-	case 'edit':
145
-		$templateMain = 'mymodule2_admin_categories.tpl';
146
-		$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('categories.php'));
147
-		$adminObject->addItemButton(_AM_MYMODULE2_ADD_CATEGORY, 'categories.php?op=new', 'add');
148
-		$adminObject->addItemButton(_AM_MYMODULE2_CATEGORIES_LIST, 'categories.php', 'list');
149
-		$GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
150
-		// Get Form
151
-		$categoriesObj = $categoriesHandler->get($catId);
152
-		$form = $categoriesObj->getFormCategories();
153
-		$GLOBALS['xoopsTpl']->assign('form', $form->render());
143
+    break;
144
+    case 'edit':
145
+        $templateMain = 'mymodule2_admin_categories.tpl';
146
+        $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('categories.php'));
147
+        $adminObject->addItemButton(_AM_MYMODULE2_ADD_CATEGORY, 'categories.php?op=new', 'add');
148
+        $adminObject->addItemButton(_AM_MYMODULE2_CATEGORIES_LIST, 'categories.php', 'list');
149
+        $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left'));
150
+        // Get Form
151
+        $categoriesObj = $categoriesHandler->get($catId);
152
+        $form = $categoriesObj->getFormCategories();
153
+        $GLOBALS['xoopsTpl']->assign('form', $form->render());
154 154
 
155
-	break;
156
-	case 'delete':
157
-		$categoriesObj = $categoriesHandler->get($catId);
158
-		if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) {
159
-			if (!$GLOBALS['xoopsSecurity']->check()) {
160
-				redirect_header('categories.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors()));
161
-			}
162
-			if ($categoriesHandler->delete($categoriesObj)) {
163
-				redirect_header('categories.php', 3, _AM_MYMODULE2_FORM_DELETE_OK);
164
-			} else {
165
-				$GLOBALS['xoopsTpl']->assign('error', $categoriesObj->getHtmlErrors());
166
-			}
167
-		} else {
168
-			xoops_confirm(array('ok' => 1, 'cat_id' => $catId, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_MYMODULE2_FORM_SURE_DELETE, $categoriesObj->getVar('cat_name')));
169
-		}
155
+    break;
156
+    case 'delete':
157
+        $categoriesObj = $categoriesHandler->get($catId);
158
+        if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) {
159
+            if (!$GLOBALS['xoopsSecurity']->check()) {
160
+                redirect_header('categories.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors()));
161
+            }
162
+            if ($categoriesHandler->delete($categoriesObj)) {
163
+                redirect_header('categories.php', 3, _AM_MYMODULE2_FORM_DELETE_OK);
164
+            } else {
165
+                $GLOBALS['xoopsTpl']->assign('error', $categoriesObj->getHtmlErrors());
166
+            }
167
+        } else {
168
+            xoops_confirm(array('ok' => 1, 'cat_id' => $catId, 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_MYMODULE2_FORM_SURE_DELETE, $categoriesObj->getVar('cat_name')));
169
+        }
170 170
 
171
-	break;
171
+    break;
172 172
 }
173 173
 require __DIR__ . '/footer.php';
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -24,16 +24,16 @@  discard block
 block discarded – undo
24 24
 use XoopsModules\Mymodule2;
25 25
 use XoopsModules\Mymodule2\Constants;
26 26
 
27
-require __DIR__ . '/header.php';
27
+require __DIR__.'/header.php';
28 28
 // It recovered the value of argument op in URL$
29 29
 $op = Request::getString('op', 'list');
30 30
 // Request cat_id
31 31
 $catId = Request::getInt('cat_id');
32
-switch($op) {
32
+switch ($op) {
33 33
 	case 'list':
34 34
 	default:
35 35
 		// Define Stylesheet
36
-		$GLOBALS['xoTheme']->addStylesheet( $style, null );
36
+		$GLOBALS['xoTheme']->addStylesheet($style, null);
37 37
 		$start = Request::getInt('start', 0);
38 38
 		$limit = Request::getInt('limit', $helper->getConfig('adminpager'));
39 39
 		$templateMain = 'mymodule2_admin_categories.tpl';
@@ -47,15 +47,15 @@  discard block
 block discarded – undo
47 47
 		$GLOBALS['xoopsTpl']->assign('mymodule2_upload_url', MYMODULE2_UPLOAD_URL);
48 48
 		// Table view categories
49 49
 		if ($categoriesCount > 0) {
50
-			foreach(array_keys($categoriesAll) as $i) {
50
+			foreach (array_keys($categoriesAll) as $i) {
51 51
 				$category = $categoriesAll[$i]->getValuesCategories();
52 52
 				$GLOBALS['xoopsTpl']->append('categories_list', $category);
53 53
 				unset($category);
54 54
 			}
55 55
 			// Display Navigation
56 56
 			if ($categoriesCount > $limit) {
57
-				include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
58
-				$pagenav = new \XoopsPageNav($categoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit);
57
+				include_once XOOPS_ROOT_PATH.'/class/pagenav.php';
58
+				$pagenav = new \XoopsPageNav($categoriesCount, $limit, $start, 'start', 'op=list&limit='.$limit);
59 59
 				$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4));
60 60
 			}
61 61
 		} else {
@@ -87,17 +87,17 @@  discard block
 block discarded – undo
87 87
 		// Set Vars
88 88
 		$categoriesObj->setVar('cat_name', Request::getString('cat_name', ''));
89 89
 		// Set Var cat_logo
90
-		include_once XOOPS_ROOT_PATH . '/class/uploader.php';
90
+		include_once XOOPS_ROOT_PATH.'/class/uploader.php';
91 91
 		$filename       = $_FILES['cat_logo']['name'];
92 92
 		$imgMimetype    = $_FILES['cat_logo']['type'];
93 93
 		$imgNameDef     = Request::getString('cat_name');
94 94
 		$uploaderErrors = '';
95
-		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH . '/categories/', 
95
+		$uploader = new \XoopsMediaUploader(MYMODULE2_UPLOAD_IMAGE_PATH.'/categories/', 
96 96
 													$helper->getConfig('mimetypes_image'), 
97 97
 													$helper->getConfig('maxsize_image'), null, null);
98 98
 		if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
99 99
 			$extension = preg_replace('/^.+\.([^.]+)$/sU', '', $filename);
100
-			$imgName = str_replace(' ', '', $imgNameDef) . '.' . $extension;
100
+			$imgName = str_replace(' ', '', $imgNameDef).'.'.$extension;
101 101
 			$uploader->setPrefix($imgName);
102 102
 			$uploader->fetchMedia($_POST['xoops_upload_file'][0]);
103 103
 			if (!$uploader->upload()) {
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 				if ($maxwidth > 0 && $maxheight > 0) {
110 110
 					// Resize image
111 111
 					$imgHandler                = new Mymodule2\Common\Resizer();
112
-					$imgHandler->sourceFile    = MYMODULE2_UPLOAD_IMAGE_PATH . '/categories/' . $savedFilename;
113
-					$imgHandler->endFile       = MYMODULE2_UPLOAD_IMAGE_PATH . '/categories/' . $savedFilename;
112
+					$imgHandler->sourceFile    = MYMODULE2_UPLOAD_IMAGE_PATH.'/categories/'.$savedFilename;
113
+					$imgHandler->endFile       = MYMODULE2_UPLOAD_IMAGE_PATH.'/categories/'.$savedFilename;
114 114
 					$imgHandler->imageMimetype = $imgMimetype;
115 115
 					$imgHandler->maxWidth      = $maxwidth;
116 116
 					$imgHandler->maxHeight     = $maxheight;
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		// Insert Data
131 131
 		if ($categoriesHandler->insert($categoriesObj)) {
132 132
 			if ('' !== $uploaderErrors) {
133
-				redirect_header('categories.php?op=edit&cat_id=' . $catId, 5, $uploaderErrors);
133
+				redirect_header('categories.php?op=edit&cat_id='.$catId, 5, $uploaderErrors);
134 134
 			} else {
135 135
 				redirect_header('categories.php?op=list', 2, _AM_MYMODULE2_FORM_OK);
136 136
 			}
@@ -170,4 +170,4 @@  discard block
 block discarded – undo
170 170
 
171 171
 	break;
172 172
 }
173
-require __DIR__ . '/footer.php';
173
+require __DIR__.'/footer.php';
Please login to merge, or discard this patch.
testdata/mymodule2/admin/menu.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -27,37 +27,37 @@
 block discarded – undo
27 27
 $sysPathIcon32 = $moduleInfo->getInfo('sysicons32');
28 28
 
29 29
 $adminmenu[] = [
30
-	'title' => _MI_MYMODULE2_ADMENU1,
31
-	'link' => 'admin/index.php',
32
-	'icon' => $sysPathIcon32.'/dashboard.png',
30
+    'title' => _MI_MYMODULE2_ADMENU1,
31
+    'link' => 'admin/index.php',
32
+    'icon' => $sysPathIcon32.'/dashboard.png',
33 33
 ];
34 34
 $adminmenu[] = [
35
-	'title' => _MI_MYMODULE2_ADMENU2,
36
-	'link' => 'admin/categories.php',
37
-	'icon' => 'assets/icons/32/category.png',
35
+    'title' => _MI_MYMODULE2_ADMENU2,
36
+    'link' => 'admin/categories.php',
37
+    'icon' => 'assets/icons/32/category.png',
38 38
 ];
39 39
 $adminmenu[] = [
40
-	'title' => _MI_MYMODULE2_ADMENU3,
41
-	'link' => 'admin/articles.php',
42
-	'icon' => 'assets/icons/32/penguin.png',
40
+    'title' => _MI_MYMODULE2_ADMENU3,
41
+    'link' => 'admin/articles.php',
42
+    'icon' => 'assets/icons/32/penguin.png',
43 43
 ];
44 44
 $adminmenu[] = [
45
-	'title' => _MI_MYMODULE2_ADMENU4,
46
-	'link' => 'admin/testfields.php',
47
-	'icon' => 'assets/icons/32/alert.png',
45
+    'title' => _MI_MYMODULE2_ADMENU4,
46
+    'link' => 'admin/testfields.php',
47
+    'icon' => 'assets/icons/32/alert.png',
48 48
 ];
49 49
 $adminmenu[] = [
50
-	'title' => _MI_MYMODULE2_ADMENU5,
51
-	'link' => 'admin/permissions.php',
52
-	'icon' => $sysPathIcon32.'/permissions.png',
50
+    'title' => _MI_MYMODULE2_ADMENU5,
51
+    'link' => 'admin/permissions.php',
52
+    'icon' => $sysPathIcon32.'/permissions.png',
53 53
 ];
54 54
 $adminmenu[] = [
55
-	'title' => _MI_MYMODULE2_ADMENU6,
56
-	'link' => 'admin/feedback.php',
57
-	'icon' => $sysPathIcon32.'/mail_foward.png',
55
+    'title' => _MI_MYMODULE2_ADMENU6,
56
+    'link' => 'admin/feedback.php',
57
+    'icon' => $sysPathIcon32.'/mail_foward.png',
58 58
 ];
59 59
 $adminmenu[] = [
60
-	'title' => _MI_MYMODULE2_ABOUT,
61
-	'link' => 'admin/about.php',
62
-	'icon' => $sysPathIcon32.'/about.png',
60
+    'title' => _MI_MYMODULE2_ABOUT,
61
+    'link' => 'admin/about.php',
62
+    'icon' => $sysPathIcon32.'/about.png',
63 63
 ];
Please login to merge, or discard this patch.