|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace XoopsModules\Modulebuilder\Files\User; |
|
4
|
|
|
|
|
5
|
|
|
use XoopsModules\Modulebuilder; |
|
6
|
|
|
use XoopsModules\Modulebuilder\Files; |
|
7
|
|
|
|
|
8
|
|
|
/* |
|
9
|
|
|
You may not change or alter any portion of this comment or credits |
|
10
|
|
|
of supporting developers from this source code or any supporting source code |
|
11
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
12
|
|
|
|
|
13
|
|
|
This program is distributed in the hope that it will be useful, |
|
14
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
16
|
|
|
*/ |
|
17
|
|
|
/** |
|
18
|
|
|
* modulebuilder module. |
|
19
|
|
|
* |
|
20
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
|
21
|
|
|
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
|
22
|
|
|
* |
|
23
|
|
|
* @since 2.5.0 |
|
24
|
|
|
* |
|
25
|
|
|
* @author Txmod Xoops http://www.txmodxoops.org |
|
26
|
|
|
* |
|
27
|
|
|
*/ |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Class UserXoopsVersion. |
|
31
|
|
|
*/ |
|
32
|
|
|
class UserXoopsVersion extends Files\CreateFile |
|
33
|
|
|
{ |
|
34
|
|
|
/** |
|
35
|
|
|
* @var array |
|
36
|
|
|
*/ |
|
37
|
|
|
private $kw = []; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @var mixed |
|
41
|
|
|
*/ |
|
42
|
|
|
private $uxc = null; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @var mixed |
|
46
|
|
|
*/ |
|
47
|
|
|
private $xc = null; |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @var mixed |
|
51
|
|
|
*/ |
|
52
|
|
|
private $pc = null; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @public function constructor |
|
56
|
|
|
* @param null |
|
57
|
|
|
*/ |
|
58
|
|
|
public function __construct() |
|
59
|
|
|
{ |
|
60
|
|
|
parent::__construct(); |
|
61
|
|
|
$this->xc = Modulebuilder\Files\CreateXoopsCode::getInstance(); |
|
62
|
|
|
$this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); |
|
63
|
|
|
$this->uxc = Modulebuilder\Files\User\UserXoopsCode::getInstance(); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @static function getInstance |
|
68
|
|
|
* @param null |
|
69
|
|
|
* @return UserXoopsVersion |
|
70
|
|
|
*/ |
|
71
|
|
|
public static function getInstance() |
|
72
|
|
|
{ |
|
73
|
|
|
static $instance = false; |
|
74
|
|
|
if (!$instance) { |
|
75
|
|
|
$instance = new self(); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
return $instance; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* @public function write |
|
83
|
|
|
* @param $module |
|
84
|
|
|
* @param mixed $table |
|
85
|
|
|
* @param mixed $tables |
|
86
|
|
|
* @param $filename |
|
87
|
|
|
*/ |
|
88
|
|
|
public function write($module, $table, $tables, $filename) |
|
89
|
|
|
{ |
|
90
|
|
|
$this->setModule($module); |
|
91
|
|
|
$this->setTable($table); |
|
92
|
|
|
$this->setTables($tables); |
|
93
|
|
|
$this->setFileName($filename); |
|
94
|
|
|
foreach (array_keys($tables) as $t) { |
|
95
|
|
|
$tableName = $tables[$t]->getVar('table_name'); |
|
96
|
|
|
$this->setKeywords($tableName); |
|
97
|
|
|
} |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* @public function setKeywords |
|
102
|
|
|
* @param mixed $keywords |
|
103
|
|
|
*/ |
|
104
|
|
|
public function setKeywords($keywords) |
|
105
|
|
|
{ |
|
106
|
|
|
if (is_array($keywords)) { |
|
107
|
|
|
$this->kw = $keywords; |
|
108
|
|
|
} else { |
|
109
|
|
|
$this->kw[] = $keywords; |
|
110
|
|
|
} |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
/** |
|
114
|
|
|
* @public function getKeywords |
|
115
|
|
|
* @param null |
|
116
|
|
|
* @return array |
|
117
|
|
|
*/ |
|
118
|
|
|
public function getKeywords() |
|
119
|
|
|
{ |
|
120
|
|
|
return $this->kw; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* @private function getXoopsVersionHeader |
|
125
|
|
|
* @param $module |
|
126
|
|
|
* @param $language |
|
127
|
|
|
* |
|
128
|
|
|
* @return string |
|
129
|
|
|
*/ |
|
130
|
|
|
private function getXoopsVersionHeader($module, $language) |
|
131
|
|
|
{ |
|
132
|
|
|
$date = date('Y/m/d'); |
|
133
|
|
|
$ret = $this->getSimpleString(''); |
|
134
|
|
|
$ret .= Modulebuilder\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine(); |
|
135
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$moduleDirName ', 'basename(__DIR__)'); |
|
136
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$moduleDirNameUpper', 'mb_strtoupper($moduleDirName)'); |
|
137
|
|
|
$ret .= $this->getDashComment('Informations'); |
|
138
|
|
|
$ha = (1 == $module->getVar('mod_admin')) ? 1 : 0; |
|
139
|
|
|
$hm = (1 == $module->getVar('mod_user')) ? 1 : 0; |
|
140
|
|
|
|
|
141
|
|
|
$descriptions = [ |
|
142
|
|
|
'name' => "{$language}NAME", |
|
143
|
|
|
'version' => (string)$module->getVar('mod_version'), |
|
144
|
|
|
'description' => "{$language}DESC", |
|
145
|
|
|
'author' => "'{$module->getVar('mod_author')}'", |
|
146
|
|
|
'author_mail' => "'{$module->getVar('mod_author_mail')}'", |
|
147
|
|
|
'author_website_url' => "'{$module->getVar('mod_author_website_url')}'", |
|
148
|
|
|
'author_website_name' => "'{$module->getVar('mod_author_website_name')}'", |
|
149
|
|
|
'credits' => "'{$module->getVar('mod_credits')}'", |
|
150
|
|
|
'license' => "'{$module->getVar('mod_license')}'", |
|
151
|
|
|
'license_url' => "'http://www.gnu.org/licenses/gpl-3.0.en.html'", |
|
152
|
|
|
'help' => "'page=help'", |
|
153
|
|
|
'release_info' => "'{$module->getVar('mod_release_info')}'", |
|
154
|
|
|
'release_file' => "XOOPS_URL . '/modules/{$module->getVar('mod_dirname')}/docs/{$module->getVar('mod_release_file')}'", |
|
155
|
|
|
'release_date' => "'{$date}'", |
|
156
|
|
|
'manual' => "'{$module->getVar('mod_manual')}'", |
|
157
|
|
|
'manual_file' => "XOOPS_URL . '/modules/{$module->getVar('mod_dirname')}/docs/{$module->getVar('mod_manual_file')}'", |
|
158
|
|
|
'min_php' => "'{$module->getVar('mod_min_php')}'", |
|
159
|
|
|
'min_xoops' => "'{$module->getVar('mod_min_xoops')}'", |
|
160
|
|
|
'min_admin' => "'{$module->getVar('mod_min_admin')}'", |
|
161
|
|
|
'min_db' => "['mysql' => '{$module->getVar('mod_min_mysql')}', 'mysqli' => '{$module->getVar('mod_min_mysql')}']", |
|
162
|
|
|
'image' => "'assets/images/logoModule.png'", |
|
163
|
|
|
'dirname' => 'basename(__DIR__)', |
|
164
|
|
|
'dirmoduleadmin' => "'Frameworks/moduleclasses/moduleadmin'", |
|
165
|
|
|
'sysicons16' => "'../../Frameworks/moduleclasses/icons/16'", |
|
166
|
|
|
'sysicons32' => "'../../Frameworks/moduleclasses/icons/32'", |
|
167
|
|
|
'modicons16' => "'assets/icons/16'", |
|
168
|
|
|
'modicons32' => "'assets/icons/32'", |
|
169
|
|
|
'demo_site_url' => "'{$module->getVar('mod_demo_site_url')}'", |
|
170
|
|
|
'demo_site_name' => "'{$module->getVar('mod_demo_site_name')}'", |
|
171
|
|
|
'support_url' => "'{$module->getVar('mod_support_url')}'", |
|
172
|
|
|
'support_name' => "'{$module->getVar('mod_support_name')}'", |
|
173
|
|
|
'module_website_url' => "'{$module->getVar('mod_website_url')}'", |
|
174
|
|
|
'module_website_name' => "'{$module->getVar('mod_website_name')}'", |
|
175
|
|
|
'release' => "'{$module->getVar('mod_release')}'", |
|
176
|
|
|
'module_status' => "'{$module->getVar('mod_status')}'", |
|
177
|
|
|
'system_menu' => '1', |
|
178
|
|
|
'hasAdmin' => $ha, |
|
179
|
|
|
'hasMain' => $hm, |
|
180
|
|
|
'adminindex' => "'admin/index.php'", |
|
181
|
|
|
'adminmenu' => "'admin/menu.php'", |
|
182
|
|
|
'onInstall' => "'include/install.php'", |
|
183
|
|
|
'onUninstall' => "'include/uninstall.php'", |
|
184
|
|
|
'onUpdate' => "'include/update.php'", |
|
185
|
|
|
]; |
|
186
|
|
|
|
|
187
|
|
|
$ret .= $this->uxc->getUserModVersionArray(0, $descriptions); |
|
188
|
|
|
|
|
189
|
|
|
return $ret; |
|
190
|
|
|
} |
|
191
|
|
|
|
|
192
|
|
|
/** |
|
193
|
|
|
* @private function getXoopsVersionMySQL |
|
194
|
|
|
* @param $moduleDirname |
|
195
|
|
|
* @param $table |
|
196
|
|
|
* @param $tables |
|
197
|
|
|
* @return string |
|
198
|
|
|
*/ |
|
199
|
|
|
private function getXoopsVersionMySQL($moduleDirname, $table, $tables) |
|
200
|
|
|
{ |
|
201
|
|
|
$tableName = $table->getVar('table_name'); |
|
202
|
|
|
$n = 1; |
|
203
|
|
|
$ret = ''; |
|
204
|
|
|
$items = []; |
|
205
|
|
|
$tableRate = 0; |
|
206
|
|
|
if (!empty($tableName)) { |
|
207
|
|
|
$ret .= $this->getDashComment('Mysql'); |
|
208
|
|
|
$description = "'sql/mysql.sql'"; |
|
209
|
|
|
$ret .= $this->uxc->getUserModVersionText(2, $description, 'sqlfile', "'mysql'"); |
|
210
|
|
|
$ret .= Modulebuilder\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine('Tables'); |
|
211
|
|
|
|
|
212
|
|
|
foreach (array_keys($tables) as $t) { |
|
213
|
|
|
$items[] = "'{$moduleDirname}_{$tables[$t]->getVar('table_name')}'"; |
|
214
|
|
|
if (1 === (int)$tables[$t]->getVar('table_rate')) { |
|
215
|
|
|
$tableRate = 1; |
|
216
|
|
|
} |
|
217
|
|
|
++$n; |
|
218
|
|
|
} |
|
219
|
|
|
if (1 === $tableRate) { |
|
220
|
|
|
$items[] = "'{$moduleDirname}_ratings'"; |
|
221
|
|
|
++$n; |
|
222
|
|
|
} |
|
223
|
|
|
$ret .= $this->uxc->getUserModVersionArray(11, $items, 'tables', $n); |
|
224
|
|
|
unset($n); |
|
225
|
|
|
} |
|
226
|
|
|
|
|
227
|
|
|
return $ret; |
|
228
|
|
|
} |
|
229
|
|
|
|
|
230
|
|
|
/** |
|
231
|
|
|
* @private function getXoopsVersionSearch |
|
232
|
|
|
* @param $moduleDirname |
|
233
|
|
|
* |
|
234
|
|
|
* @return string |
|
235
|
|
|
*/ |
|
236
|
|
|
private function getXoopsVersionSearch($moduleDirname) |
|
237
|
|
|
{ |
|
238
|
|
|
$ret = $this->getDashComment('Search'); |
|
239
|
|
|
$ret .= $this->uxc->getUserModVersionText(1, 1, 'hasSearch'); |
|
240
|
|
|
$items = ['file' => "'include/search.inc.php'", 'func' => "'{$moduleDirname}_search'"]; |
|
241
|
|
|
$ret .= $this->uxc->getUserModVersionArray(1, $items, 'search'); |
|
242
|
|
|
|
|
243
|
|
|
return $ret; |
|
244
|
|
|
} |
|
245
|
|
|
|
|
246
|
|
|
/** |
|
247
|
|
|
* @private function getXoopsVersionComments |
|
248
|
|
|
* @param $moduleDirname |
|
249
|
|
|
* |
|
250
|
|
|
* @param $tables |
|
251
|
|
|
* @return string |
|
252
|
|
|
*/ |
|
253
|
|
|
private function getXoopsVersionComments($moduleDirname, $tables) |
|
254
|
|
|
{ |
|
255
|
|
|
$tableName = ''; |
|
256
|
|
|
$fieldId = ''; |
|
257
|
|
|
foreach (array_keys($tables) as $t) { |
|
258
|
|
|
if (1 == $tables[$t]->getVar('table_comments')) { |
|
259
|
|
|
$tableName = $tables[$t]->getVar('table_name'); |
|
260
|
|
|
$fields = $this->getTableFields($tables[$t]->getVar('table_mid'), $tables[$t]->getVar('table_id')); |
|
261
|
|
|
foreach (array_keys($fields) as $f) { |
|
262
|
|
|
$fieldName = $fields[$f]->getVar('field_name'); |
|
263
|
|
|
if (0 == $f) { |
|
264
|
|
|
$fieldId = $fieldName; |
|
265
|
|
|
} |
|
266
|
|
|
} |
|
267
|
|
|
} |
|
268
|
|
|
} |
|
269
|
|
|
$ret = $this->getDashComment('Comments'); |
|
270
|
|
|
$ret .= $this->uxc->getUserModVersionText(1, "1", 'hasComments'); |
|
271
|
|
|
$ret .= $this->uxc->getUserModVersionText(2, "'{$tableName}.php'", 'comments', "'pageName'"); |
|
272
|
|
|
$ret .= $this->uxc->getUserModVersionText(2, "'{$fieldId}'", 'comments', "'itemName'"); |
|
273
|
|
|
$ret .= Modulebuilder\Files\CreatePhpCode::getInstance()->getPhpCodeCommentLine('Comment callback functions'); |
|
274
|
|
|
$ret .= $this->uxc->getUserModVersionText(2, "'include/comment_functions.php'", 'comments', "'callbackFile'"); |
|
275
|
|
|
$descriptions = ['approve' => "'{$moduleDirname}CommentsApprove'", 'update' => "'{$moduleDirname}CommentsUpdate'"]; |
|
276
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $descriptions, 'comments', "'callback'"); |
|
277
|
|
|
|
|
278
|
|
|
return $ret; |
|
279
|
|
|
} |
|
280
|
|
|
|
|
281
|
|
|
/** |
|
282
|
|
|
* @private function getXoopsVersionTemplatesAdminUser |
|
283
|
|
|
* @param $moduleDirname |
|
284
|
|
|
* @param $tables |
|
285
|
|
|
* |
|
286
|
|
|
* @param $admin |
|
287
|
|
|
* @param $user |
|
288
|
|
|
* @return string |
|
289
|
|
|
*/ |
|
290
|
|
|
private function getXoopsVersionTemplatesAdminUser($moduleDirname, $tables, $admin, $user) |
|
291
|
|
|
{ |
|
292
|
|
|
$ret = $this->getDashComment('Templates'); |
|
293
|
|
|
$item = []; |
|
294
|
|
|
if ($admin) { |
|
295
|
|
|
$item[] = $this->pc->getPhpCodeCommentLine('Admin templates'); |
|
296
|
|
|
$item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'about', '', true); |
|
297
|
|
|
$item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'header', '', true); |
|
298
|
|
|
$item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'index', '', true); |
|
299
|
|
|
$tablePermissions = []; |
|
300
|
|
|
$tableBroken = []; |
|
301
|
|
|
foreach (array_keys($tables) as $t) { |
|
302
|
|
|
$tableName = $tables[$t]->getVar('table_name'); |
|
303
|
|
|
$tablePermissions[] = $tables[$t]->getVar('table_permissions'); |
|
304
|
|
|
$tableBroken[] = $tables[$t]->getVar('table_broken'); |
|
305
|
|
|
$item[] .= $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName, '', true); |
|
306
|
|
|
} |
|
307
|
|
|
if (in_array(1, $tableBroken)) { |
|
308
|
|
|
$item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'broken', '', true); |
|
309
|
|
|
} |
|
310
|
|
|
if (in_array(1, $tablePermissions)) { |
|
311
|
|
|
$item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'permissions', '', true); |
|
312
|
|
|
} |
|
313
|
|
|
$item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'footer', '', true); |
|
314
|
|
|
} |
|
315
|
|
|
|
|
316
|
|
|
if ($user) { |
|
317
|
|
|
$item[] = $this->pc->getPhpCodeCommentLine('User templates'); |
|
318
|
|
|
$item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'header', ''); |
|
319
|
|
|
$item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'index', ''); |
|
320
|
|
|
$tableBroken = []; |
|
321
|
|
|
$tablePdf = []; |
|
322
|
|
|
$tablePrint = []; |
|
323
|
|
|
$tableRate = []; |
|
324
|
|
|
$tableRss = []; |
|
325
|
|
|
$tableSearch = []; |
|
326
|
|
|
$tableSingle = []; |
|
327
|
|
|
$tableSubmit = []; |
|
328
|
|
|
foreach (array_keys($tables) as $t) { |
|
329
|
|
|
if (1 == $tables[$t]->getVar('table_user')) { |
|
330
|
|
|
$tableName = $tables[$t]->getVar('table_name'); |
|
331
|
|
|
$tableBroken[] = $tables[$t]->getVar('table_broken'); |
|
332
|
|
|
$tablePdf[] = $tables[$t]->getVar('table_pdf'); |
|
333
|
|
|
$tablePrint[] = $tables[$t]->getVar('table_print'); |
|
334
|
|
|
$tableRate[] = $tables[$t]->getVar('table_rate'); |
|
335
|
|
|
$tableRss[] = $tables[$t]->getVar('table_rss'); |
|
336
|
|
|
$tableSearch[] = $tables[$t]->getVar('table_search'); |
|
337
|
|
|
$tableSingle[] = $tables[$t]->getVar('table_single'); |
|
338
|
|
|
$tableSubmit[] = $tables[$t]->getVar('table_submit'); |
|
339
|
|
|
$tableRate[] = $tables[$t]->getVar('table_rate'); |
|
340
|
|
|
$item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName, ''); |
|
341
|
|
|
$item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName, 'list'); |
|
342
|
|
|
$item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName, 'item'); |
|
343
|
|
|
} |
|
344
|
|
|
} |
|
345
|
|
|
$item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'breadcrumbs', ''); |
|
346
|
|
|
if (in_array(1, $tablePdf)) { |
|
347
|
|
|
$item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'pdf', ''); |
|
348
|
|
|
} |
|
349
|
|
|
if (in_array(1, $tablePrint)) { |
|
350
|
|
|
$item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'print', ''); |
|
351
|
|
|
} |
|
352
|
|
|
if (in_array(1, $tableRate)) { |
|
353
|
|
|
$item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'rate', ''); |
|
354
|
|
|
} |
|
355
|
|
|
if (in_array(1, $tableRss)) { |
|
356
|
|
|
$item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'rss', ''); |
|
357
|
|
|
} |
|
358
|
|
|
if (in_array(1, $tableSearch)) { |
|
359
|
|
|
$item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'search', ''); |
|
360
|
|
|
} |
|
361
|
|
|
if (in_array(1, $tableSingle)) { |
|
362
|
|
|
$item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'single', ''); |
|
363
|
|
|
} |
|
364
|
|
|
$item[] = $this->getXoopsVersionTemplatesLine($moduleDirname, 'footer', ''); |
|
365
|
|
|
} |
|
366
|
|
|
|
|
367
|
|
|
$ret .= $this->uxc->getUserModVersionArray(11, $item, "templates"); |
|
368
|
|
|
|
|
369
|
|
|
return $ret; |
|
370
|
|
|
} |
|
371
|
|
|
|
|
372
|
|
|
/** |
|
373
|
|
|
* @private function getXoopsVersionTemplatesLine |
|
374
|
|
|
* @param $moduleDirname |
|
375
|
|
|
* @param $type |
|
376
|
|
|
* @param string $extra |
|
377
|
|
|
* @param bool $isAdmin |
|
378
|
|
|
* @return string |
|
379
|
|
|
*/ |
|
380
|
|
|
private function getXoopsVersionTemplatesLine($moduleDirname, $type, $extra = '', $isAdmin = false) |
|
381
|
|
|
{ |
|
382
|
|
|
$ret = ''; |
|
383
|
|
|
$desc = "'description' => ''"; |
|
384
|
|
|
$arrayFile = "['file' =>"; |
|
385
|
|
|
if ($isAdmin) { |
|
386
|
|
|
$ret .= "{$arrayFile} '{$moduleDirname}_admin_{$type}.tpl', {$desc}, 'type' => 'admin']"; |
|
387
|
|
|
} else { |
|
388
|
|
|
if ('' !== $extra) { |
|
389
|
|
|
$ret .= "{$arrayFile} '{$moduleDirname}_{$type}_{$extra}.tpl', {$desc}]"; |
|
390
|
|
|
} else { |
|
391
|
|
|
$ret .= "{$arrayFile} '{$moduleDirname}_{$type}.tpl', {$desc}]"; |
|
392
|
|
|
} |
|
393
|
|
|
} |
|
394
|
|
|
|
|
395
|
|
|
return $ret; |
|
396
|
|
|
} |
|
397
|
|
|
|
|
398
|
|
|
/** |
|
399
|
|
|
* @private function getXoopsVersionSubmenu |
|
400
|
|
|
* @param $language |
|
401
|
|
|
* @param $tables |
|
402
|
|
|
* @return string |
|
403
|
|
|
*/ |
|
404
|
|
|
private function getXoopsVersionSubmenu($language, $tables) |
|
405
|
|
|
{ |
|
406
|
|
|
$ret = $this->getDashComment('Menu'); |
|
407
|
|
|
$xModule = $this->pc->getPhpCodeGlobals('xoopsModule'); |
|
408
|
|
|
$cond = 'isset(' . $xModule . ') && is_object(' . $xModule . ')'; |
|
409
|
|
|
$one = $this->pc->getPhpCodeGlobals('xoopsModule') . "->getVar('dirname')"; |
|
410
|
|
|
$ret .= $this->pc->getPhpCodeTernaryOperator('currdirname ', $cond, $one, "'system'"); |
|
411
|
|
|
|
|
412
|
|
|
$i = 1; |
|
413
|
|
|
$descriptions = [ |
|
414
|
|
|
'name' => "{$language}SMNAME{$i}", |
|
415
|
|
|
'url' => "'index.php'", |
|
416
|
|
|
]; |
|
417
|
|
|
$contentIf = $this->uxc->getUserModVersionArray(2, $descriptions, 'sub', '','', "\t"); |
|
418
|
|
|
|
|
419
|
|
|
$tableSearch = []; |
|
420
|
|
|
foreach (array_keys($tables) as $t) { |
|
421
|
|
|
$tableName = $tables[$t]->getVar('table_name'); |
|
422
|
|
|
$tableSearch[] = $tables[$t]->getVar('table_search'); |
|
423
|
|
|
if (1 == $tables[$t]->getVar('table_submenu')) { |
|
424
|
|
|
$contentIf .= $this->pc->getPhpCodeCommentLine('Sub', $tableName, "\t"); |
|
425
|
|
|
$descriptions = [ |
|
426
|
|
|
'name' => "{$language}SMNAME{$i}", |
|
427
|
|
|
'url' => "'{$tableName}.php'", |
|
428
|
|
|
]; |
|
429
|
|
|
$contentIf .= $this->uxc->getUserModVersionArray(2, $descriptions, 'sub', '','', "\t"); |
|
430
|
|
|
unset($item); |
|
|
|
|
|
|
431
|
|
|
} |
|
432
|
|
|
++$i; |
|
433
|
|
|
if (1 == $tables[$t]->getVar('table_submit')) { |
|
434
|
|
|
$contentIf .= $this->pc->getPhpCodeCommentLine('Sub', 'Submit', "\t"); |
|
435
|
|
|
$descriptions = [ |
|
436
|
|
|
'name' => "{$language}SMNAME{$i}", |
|
437
|
|
|
'url' => "'{$tableName}.php?op=new'", |
|
438
|
|
|
]; |
|
439
|
|
|
$contentIf .= $this->uxc->getUserModVersionArray(2, $descriptions, 'sub', '','', "\t"); |
|
440
|
|
|
++$i; |
|
441
|
|
|
} |
|
442
|
|
|
} |
|
443
|
|
|
|
|
444
|
|
|
//TODO: after finalizing creation of search.php by User/UserSearch.php this sub menu item can be activated |
|
445
|
|
|
/* |
|
446
|
|
|
if (in_array(1, $tableSearch)) { |
|
447
|
|
|
$contentIf .= $cpc->getPhpCodeCommentLine('Sub', 'Search', "\t"); |
|
448
|
|
|
$descriptions = [ |
|
449
|
|
|
'name' => "{$language}SMNAME{$i}", |
|
450
|
|
|
'url' => "'search.php'", |
|
451
|
|
|
]; |
|
452
|
|
|
$contentIf .= $this->uxc->getUserModVersionArray(2, $descriptions, 'sub', '','', "\t"); |
|
453
|
|
|
} |
|
454
|
|
|
*/ |
|
455
|
|
|
unset($i); |
|
456
|
|
|
|
|
457
|
|
|
$ret .= $this->pc->getPhpCodeConditions('$moduleDirName', ' == ', '$currdirname', $contentIf); |
|
458
|
|
|
|
|
459
|
|
|
return $ret; |
|
460
|
|
|
} |
|
461
|
|
|
|
|
462
|
|
|
/** |
|
463
|
|
|
* @private function getXoopsVersionBlocks |
|
464
|
|
|
* @param $moduleDirname |
|
465
|
|
|
* @param $tables |
|
466
|
|
|
* @param $language |
|
467
|
|
|
* @return string |
|
468
|
|
|
*/ |
|
469
|
|
|
private function getXoopsVersionBlocks($moduleDirname, $tables, $language) |
|
470
|
|
|
{ |
|
471
|
|
|
$ret = $this->getDashComment('Blocks'); |
|
472
|
|
|
foreach (array_keys($tables) as $i) { |
|
473
|
|
|
$tableName = $tables[$i]->getVar('table_name'); |
|
474
|
|
|
if (0 == $tables[$i]->getVar('table_category') && 1 == $tables[$i]->getVar('table_blocks')) { |
|
475
|
|
|
$ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, 'LAST', $language, 'last'); |
|
476
|
|
|
$ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, 'NEW', $language, 'new'); |
|
477
|
|
|
$ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, 'HITS', $language, 'hits'); |
|
478
|
|
|
$ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, 'TOP', $language, 'top'); |
|
479
|
|
|
$ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, 'RANDOM', $language, 'random'); |
|
480
|
|
|
} |
|
481
|
|
|
} |
|
482
|
|
|
|
|
483
|
|
|
return $ret; |
|
484
|
|
|
} |
|
485
|
|
|
|
|
486
|
|
|
/** |
|
487
|
|
|
* @private function getXoopsVersionTypeBlocks |
|
488
|
|
|
* @param $moduleDirname |
|
489
|
|
|
* @param $tableName |
|
490
|
|
|
* @param $stuTableSoleName |
|
491
|
|
|
* @param $language |
|
492
|
|
|
* @param $type |
|
493
|
|
|
* @return string |
|
494
|
|
|
*/ |
|
495
|
|
|
private function getXoopsVersionTypeBlocks($moduleDirname, $tableName, $stuTableSoleName, $language, $type) |
|
496
|
|
|
{ |
|
497
|
|
|
$stuTableName = mb_strtoupper($tableName); |
|
498
|
|
|
$ucfTableName = ucfirst($tableName); |
|
499
|
|
|
$ret = $this->pc->getPhpCodeCommentLine($ucfTableName . ' ' . $type); |
|
500
|
|
|
$blocks = [ |
|
501
|
|
|
'file' => "'{$tableName}.php'", |
|
502
|
|
|
'name' => "{$language}{$stuTableName}_BLOCK_{$stuTableSoleName}", |
|
503
|
|
|
'description' => "{$language}{$stuTableName}_BLOCK_{$stuTableSoleName}_DESC", |
|
504
|
|
|
'show_func' => "'b_{$moduleDirname}_{$tableName}_show'", |
|
505
|
|
|
'edit_func' => "'b_{$moduleDirname}_{$tableName}_edit'", |
|
506
|
|
|
'template' => "'{$moduleDirname}_block_{$tableName}.tpl'", |
|
507
|
|
|
'options' => "'{$type}|5|25|0'", |
|
508
|
|
|
]; |
|
509
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $blocks, 'blocks'); |
|
510
|
|
|
|
|
511
|
|
|
return $ret; |
|
512
|
|
|
} |
|
513
|
|
|
|
|
514
|
|
|
/** |
|
515
|
|
|
* @private function getXoopsVersionConfig |
|
516
|
|
|
* @param $module |
|
517
|
|
|
* @param $tables |
|
518
|
|
|
* @param $language |
|
519
|
|
|
* |
|
520
|
|
|
* @return string |
|
521
|
|
|
*/ |
|
522
|
|
|
private function getXoopsVersionConfig($module, $tables, $language) |
|
523
|
|
|
{ |
|
524
|
|
|
$moduleDirname = $module->getVar('mod_dirname'); |
|
525
|
|
|
$ret = $this->getDashComment('Config'); |
|
526
|
|
|
|
|
527
|
|
|
$table_editors = 0; |
|
528
|
|
|
$table_permissions = 0; |
|
529
|
|
|
$table_admin = 0; |
|
530
|
|
|
$table_user = 0; |
|
531
|
|
|
$table_tag = 0; |
|
532
|
|
|
$table_uploadimage = 0; |
|
533
|
|
|
$table_uploadfile = 0; |
|
534
|
|
|
$table_rate = 0; |
|
535
|
|
|
foreach ($tables as $table) { |
|
536
|
|
|
$fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); |
|
537
|
|
|
foreach (array_keys($fields) as $f) { |
|
538
|
|
|
$fieldElement = (int)$fields[$f]->getVar('field_element'); |
|
539
|
|
|
switch ($fieldElement) { |
|
540
|
|
|
case 3: |
|
541
|
|
|
$table_editors = 1; |
|
542
|
|
|
break; |
|
543
|
|
|
case 4: |
|
544
|
|
|
$table_editors = 1; |
|
545
|
|
|
break; |
|
546
|
|
|
case 10: |
|
547
|
|
|
case 11: |
|
548
|
|
|
case 12: |
|
549
|
|
|
case 13: |
|
550
|
|
|
$table_uploadimage = 1; |
|
551
|
|
|
break; |
|
552
|
|
|
case 14: |
|
553
|
|
|
$table_uploadfile = 1; |
|
554
|
|
|
break; |
|
555
|
|
|
case 'else': |
|
556
|
|
|
default: |
|
557
|
|
|
break; |
|
558
|
|
|
} |
|
559
|
|
|
} |
|
560
|
|
|
if (1 == $table->getVar('table_permissions')) { |
|
561
|
|
|
$table_permissions = 1; |
|
562
|
|
|
} |
|
563
|
|
|
if (1 == $table->getVar('table_admin')) { |
|
564
|
|
|
$table_admin = 1; |
|
565
|
|
|
} |
|
566
|
|
|
if (1 == $table->getVar('table_user')) { |
|
567
|
|
|
$table_user = 1; |
|
568
|
|
|
} |
|
569
|
|
|
if (1 == $table->getVar('table_tag')) { |
|
570
|
|
|
$table_tag = 1; |
|
571
|
|
|
} |
|
572
|
|
|
if (1 == $table->getVar('table_rate')) { |
|
573
|
|
|
$table_rate = 1; |
|
574
|
|
|
} |
|
575
|
|
|
} |
|
576
|
|
|
if (1 === $table_editors) { |
|
577
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Editor Admin', ''); |
|
578
|
|
|
$ret .= $this->xc->getXcXoopsLoad('xoopseditorhandler'); |
|
579
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$editorHandler', 'XoopsEditorHandler::getInstance()'); |
|
580
|
|
|
$editor = [ |
|
581
|
|
|
'name' => "'editor_admin'", |
|
582
|
|
|
'title' => "'{$language}EDITOR_ADMIN'", |
|
583
|
|
|
'description' => "'{$language}EDITOR_ADMIN_DESC'", |
|
584
|
|
|
'formtype' => "'select'", |
|
585
|
|
|
'valuetype' => "'text'", |
|
586
|
|
|
'default' => "'dhtml'", |
|
587
|
|
|
'options' => 'array_flip($editorHandler->getList())', |
|
588
|
|
|
]; |
|
589
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $editor, 'config'); |
|
590
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Editor User', ''); |
|
591
|
|
|
$ret .= $this->xc->getXcXoopsLoad('xoopseditorhandler'); |
|
592
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$editorHandler', 'XoopsEditorHandler::getInstance()'); |
|
593
|
|
|
$editor = [ |
|
594
|
|
|
'name' => "'editor_user'", |
|
595
|
|
|
'title' => "'{$language}EDITOR_USER'", |
|
596
|
|
|
'description' => "'{$language}EDITOR_USER_DESC'", |
|
597
|
|
|
'formtype' => "'select'", |
|
598
|
|
|
'valuetype' => "'text'", |
|
599
|
|
|
'default' => "'dhtml'", |
|
600
|
|
|
'options' => 'array_flip($editorHandler->getList())', |
|
601
|
|
|
]; |
|
602
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $editor, 'config'); |
|
603
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Editor : max characters admin area'); |
|
604
|
|
|
$maxsize_image = [ |
|
605
|
|
|
'name' => "'editor_maxchar'", |
|
606
|
|
|
'title' => "'{$language}EDITOR_MAXCHAR'", |
|
607
|
|
|
'description' => "'{$language}EDITOR_MAXCHAR_DESC'", |
|
608
|
|
|
'formtype' => "'textbox'", |
|
609
|
|
|
'valuetype' => "'int'", |
|
610
|
|
|
'default' => '50', |
|
611
|
|
|
]; |
|
612
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $maxsize_image, 'config'); |
|
613
|
|
|
} |
|
614
|
|
|
if (1 === $table_permissions) { |
|
615
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Get groups'); |
|
616
|
|
|
$ret .= $this->xc->getXcXoopsHandler('member'); |
|
617
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$xoopsGroups ', '$memberHandler->getGroupList()'); |
|
618
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$groups', '[]'); |
|
619
|
|
|
$group = $this->xc->getXcEqualsOperator('$groups[$group] ', '$key', null, "\t"); |
|
620
|
|
|
$ret .= $this->pc->getPhpCodeForeach('xoopsGroups', false, 'key', 'group', $group); |
|
621
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('General access groups'); |
|
622
|
|
|
$groups = [ |
|
623
|
|
|
'name' => "'groups'", |
|
624
|
|
|
'title' => "'{$language}GROUPS'", |
|
625
|
|
|
'description' => "'{$language}GROUPS_DESC'", |
|
626
|
|
|
'formtype' => "'select_multi'", |
|
627
|
|
|
'valuetype' => "'array'", |
|
628
|
|
|
'default' => '$groups', |
|
629
|
|
|
'options' => '$groups', |
|
630
|
|
|
]; |
|
631
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $groups, 'config'); |
|
632
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Upload groups'); |
|
633
|
|
|
$uplgroups = [ |
|
634
|
|
|
'name' => "'upload_groups'", |
|
635
|
|
|
'title' => "'{$language}UPLOAD_GROUPS'", |
|
636
|
|
|
'description' => "'{$language}UPLOAD_GROUPS_DESC'", |
|
637
|
|
|
'formtype' => "'select_multi'", |
|
638
|
|
|
'valuetype' => "'array'", |
|
639
|
|
|
'default' => '$groups', |
|
640
|
|
|
'options' => '$groups', |
|
641
|
|
|
]; |
|
642
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $uplgroups, 'config'); |
|
643
|
|
|
|
|
644
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Get Admin groups'); |
|
645
|
|
|
$ret .= $this->xc->getXcCriteriaCompo('crGroups'); |
|
646
|
|
|
$crit = $this->xc->getXcCriteria('', "'group_type'", "'Admin'", '', true); |
|
647
|
|
|
$ret .= $this->xc->getXcCriteriaAdd('crGroups', $crit, '', "\n"); |
|
648
|
|
|
$ret .= $this->xc->getXcXoopsHandler('member'); |
|
649
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$adminXoopsGroups ', '$memberHandler->getGroupList($crGroups)'); |
|
650
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$adminGroups', '[]'); |
|
651
|
|
|
$adminGroup = $this->xc->getXcEqualsOperator('$adminGroups[$adminGroup] ', '$key', null, "\t"); |
|
652
|
|
|
$ret .= $this->pc->getPhpCodeForeach('adminXoopsGroups', false, 'key', 'adminGroup', $adminGroup); |
|
653
|
|
|
$adminGroups = [ |
|
654
|
|
|
'name' => "'admin_groups'", |
|
655
|
|
|
'title' => "'{$language}ADMIN_GROUPS'", |
|
656
|
|
|
'description' => "'{$language}ADMIN_GROUPS_DESC'", |
|
657
|
|
|
'formtype' => "'select_multi'", |
|
658
|
|
|
'valuetype' => "'array'", |
|
659
|
|
|
'default' => '$adminGroups', |
|
660
|
|
|
'options' => '$adminGroups', |
|
661
|
|
|
]; |
|
662
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $adminGroups, 'config'); |
|
663
|
|
|
$ret .= $this->pc->getPhpCodeUnset('crGroups'); |
|
664
|
|
|
} |
|
665
|
|
|
|
|
666
|
|
|
if (1 === $table_rate) { |
|
667
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Get groups'); |
|
668
|
|
|
$ret .= $this->xc->getXcXoopsHandler('member'); |
|
669
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$xoopsGroups ', '$memberHandler->getGroupList()'); |
|
670
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$ratingbar_groups', '[]'); |
|
671
|
|
|
$group = $this->xc->getXcEqualsOperator('$ratingbar_groups[$group] ', '$key', null, "\t"); |
|
672
|
|
|
$ret .= $this->pc->getPhpCodeForeach('xoopsGroups', false, 'key', 'group', $group); |
|
673
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Rating: Groups with rating permissions'); |
|
674
|
|
|
$groups = [ |
|
675
|
|
|
'name' => "'ratingbar_groups'", |
|
676
|
|
|
'title' => "'{$language}RATINGBAR_GROUPS'", |
|
677
|
|
|
'description' => "'{$language}RATINGBAR_GROUPS_DESC'", |
|
678
|
|
|
'formtype' => "'select_multi'", |
|
679
|
|
|
'valuetype' => "'array'", |
|
680
|
|
|
'default' => '[1]', |
|
681
|
|
|
'options' => '$ratingbar_groups', |
|
682
|
|
|
]; |
|
683
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $groups, 'config'); |
|
684
|
|
|
|
|
685
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Rating : used ratingbar'); |
|
686
|
|
|
$mimetypes_image = [ |
|
687
|
|
|
'name' => "'ratingbars'", |
|
688
|
|
|
'title' => "'{$language}RATINGBARS'", |
|
689
|
|
|
'description' => "'{$language}RATINGBARS_DESC'", |
|
690
|
|
|
'formtype' => "'select'", |
|
691
|
|
|
'valuetype' => "'int'", |
|
692
|
|
|
'default' => "0", |
|
693
|
|
|
'options' => "['{$language}RATING_NONE' => 0, '{$language}RATING_5STARS' => 1, '{$language}RATING_10STARS' => 2, '{$language}RATING_LIKES' => 3, '{$language}RATING_10NUM' => 4]", |
|
694
|
|
|
]; |
|
695
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $mimetypes_image, 'config'); |
|
696
|
|
|
} |
|
697
|
|
|
|
|
698
|
|
|
$keyword = implode(', ', $this->getKeywords()); |
|
699
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Keywords'); |
|
700
|
|
|
$arrayKeyword = [ |
|
701
|
|
|
'name' => "'keywords'", |
|
702
|
|
|
'title' => "'{$language}KEYWORDS'", |
|
703
|
|
|
'description' => "'{$language}KEYWORDS_DESC'", |
|
704
|
|
|
'formtype' => "'textbox'", |
|
705
|
|
|
'valuetype' => "'text'", |
|
706
|
|
|
'default' => "'{$moduleDirname}, {$keyword}'", |
|
707
|
|
|
]; |
|
708
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $arrayKeyword, 'config'); |
|
709
|
|
|
unset($this->keywords); |
|
|
|
|
|
|
710
|
|
|
|
|
711
|
|
|
if (1 === $table_uploadimage || 1 === $table_uploadfile) { |
|
712
|
|
|
$ret .= $this->getXoopsVersionSelectSizeMB($moduleDirname); |
|
713
|
|
|
} |
|
714
|
|
|
if (1 === $table_uploadimage) { |
|
715
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Uploads : maxsize of image'); |
|
716
|
|
|
$maxsize_image = [ |
|
717
|
|
|
'name' => "'maxsize_image'", |
|
718
|
|
|
'title' => "'{$language}MAXSIZE_IMAGE'", |
|
719
|
|
|
'description' => "'{$language}MAXSIZE_IMAGE_DESC'", |
|
720
|
|
|
'formtype' => "'select'", |
|
721
|
|
|
'valuetype' => "'int'", |
|
722
|
|
|
'default' => '3145728', |
|
723
|
|
|
'options' => '$optionMaxsize', |
|
724
|
|
|
]; |
|
725
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $maxsize_image, 'config'); |
|
726
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Uploads : mimetypes of image'); |
|
727
|
|
|
$mimetypes_image = [ |
|
728
|
|
|
'name' => "'mimetypes_image'", |
|
729
|
|
|
'title' => "'{$language}MIMETYPES_IMAGE'", |
|
730
|
|
|
'description' => "'{$language}MIMETYPES_IMAGE_DESC'", |
|
731
|
|
|
'formtype' => "'select_multi'", |
|
732
|
|
|
'valuetype' => "'array'", |
|
733
|
|
|
'default' => "['image/gif', 'image/jpeg', 'image/png']", |
|
734
|
|
|
'options' => "['bmp' => 'image/bmp','gif' => 'image/gif','pjpeg' => 'image/pjpeg', 'jpeg' => 'image/jpeg','jpg' => 'image/jpg','jpe' => 'image/jpe', 'png' => 'image/png']", |
|
735
|
|
|
]; |
|
736
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $mimetypes_image, 'config'); |
|
737
|
|
|
$maxwidth_image = [ |
|
738
|
|
|
'name' => "'maxwidth_image'", |
|
739
|
|
|
'title' => "'{$language}MAXWIDTH_IMAGE'", |
|
740
|
|
|
'description' => "'{$language}MAXWIDTH_IMAGE_DESC'", |
|
741
|
|
|
'formtype' => "'textbox'", |
|
742
|
|
|
'valuetype' => "'int'", |
|
743
|
|
|
'default' => '8000', |
|
744
|
|
|
]; |
|
745
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $maxwidth_image, 'config'); |
|
746
|
|
|
$maxheight_image = [ |
|
747
|
|
|
'name' => "'maxheight_image'", |
|
748
|
|
|
'title' => "'{$language}MAXHEIGHT_IMAGE'", |
|
749
|
|
|
'description' => "'{$language}MAXHEIGHT_IMAGE_DESC'", |
|
750
|
|
|
'formtype' => "'textbox'", |
|
751
|
|
|
'valuetype' => "'int'", |
|
752
|
|
|
'default' => '8000', |
|
753
|
|
|
]; |
|
754
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $maxheight_image, 'config'); |
|
755
|
|
|
} |
|
756
|
|
|
if (1 === $table_uploadfile) { |
|
757
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Uploads : maxsize of file'); |
|
758
|
|
|
$maxsize_file = [ |
|
759
|
|
|
'name' => "'maxsize_file'", |
|
760
|
|
|
'title' => "'{$language}MAXSIZE_FILE'", |
|
761
|
|
|
'description' => "'{$language}MAXSIZE_FILE_DESC'", |
|
762
|
|
|
'formtype' => "'select'", |
|
763
|
|
|
'valuetype' => "'int'", |
|
764
|
|
|
'default' => '3145728', |
|
765
|
|
|
'options' => '$optionMaxsize', |
|
766
|
|
|
]; |
|
767
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $maxsize_file, 'config'); |
|
768
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Uploads : mimetypes of file'); |
|
769
|
|
|
$mimetypes_file = [ |
|
770
|
|
|
'name' => "'mimetypes_file'", |
|
771
|
|
|
'title' => "'{$language}MIMETYPES_FILE'", |
|
772
|
|
|
'description' => "'{$language}MIMETYPES_FILE_DESC'", |
|
773
|
|
|
'formtype' => "'select_multi'", |
|
774
|
|
|
'valuetype' => "'array'", |
|
775
|
|
|
'default' => "['application/pdf', 'application/zip', 'text/comma-separated-values', 'text/plain', 'image/gif', 'image/jpeg', 'image/png']", |
|
776
|
|
|
'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']", |
|
777
|
|
|
]; |
|
778
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $mimetypes_file, 'config'); |
|
779
|
|
|
} |
|
780
|
|
|
if (1 === $table_admin) { |
|
781
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Admin pager'); |
|
782
|
|
|
$adminPager = [ |
|
783
|
|
|
'name' => "'adminpager'", |
|
784
|
|
|
'title' => "'{$language}ADMIN_PAGER'", |
|
785
|
|
|
'description' => "'{$language}ADMIN_PAGER_DESC'", |
|
786
|
|
|
'formtype' => "'textbox'", |
|
787
|
|
|
'valuetype' => "'int'", |
|
788
|
|
|
'default' => '10', |
|
789
|
|
|
]; |
|
790
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $adminPager, 'config'); |
|
791
|
|
|
} |
|
792
|
|
|
if (1 === $table_user) { |
|
793
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('User pager'); |
|
794
|
|
|
$userPager = [ |
|
795
|
|
|
'name' => "'userpager'", |
|
796
|
|
|
'title' => "'{$language}USER_PAGER'", |
|
797
|
|
|
'description' => "'{$language}USER_PAGER_DESC'", |
|
798
|
|
|
'formtype' => "'textbox'", |
|
799
|
|
|
'valuetype' => "'int'", |
|
800
|
|
|
'default' => '10', |
|
801
|
|
|
]; |
|
802
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $userPager, 'config'); |
|
803
|
|
|
} |
|
804
|
|
|
if (1 === $table_tag) { |
|
805
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Use tag'); |
|
806
|
|
|
$useTag = [ |
|
807
|
|
|
'name' => "'usetag'", |
|
808
|
|
|
'title' => "'{$language}USE_TAG'", |
|
809
|
|
|
'description' => "'{$language}USE_TAG_DESC'", |
|
810
|
|
|
'formtype' => "'yesno'", |
|
811
|
|
|
'valuetype' => "'int'", |
|
812
|
|
|
'default' => '0', |
|
813
|
|
|
]; |
|
814
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $useTag, 'config'); |
|
815
|
|
|
} |
|
816
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Number column'); |
|
817
|
|
|
$numbCol = [ |
|
818
|
|
|
'name' => "'numb_col'", |
|
819
|
|
|
'title' => "'{$language}NUMB_COL'", |
|
820
|
|
|
'description' => "'{$language}NUMB_COL_DESC'", |
|
821
|
|
|
'formtype' => "'select'", |
|
822
|
|
|
'valuetype' => "'int'", |
|
823
|
|
|
'default' => '1', |
|
824
|
|
|
'options' => "[1 => '1', 2 => '2', 3 => '3', 4 => '4']", |
|
825
|
|
|
]; |
|
826
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $numbCol, 'config'); |
|
827
|
|
|
|
|
828
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Divide by'); |
|
829
|
|
|
$divideby = [ |
|
830
|
|
|
'name' => "'divideby'", |
|
831
|
|
|
'title' => "'{$language}DIVIDEBY'", |
|
832
|
|
|
'description' => "'{$language}DIVIDEBY_DESC'", |
|
833
|
|
|
'formtype' => "'select'", |
|
834
|
|
|
'valuetype' => "'int'", |
|
835
|
|
|
'default' => '1', |
|
836
|
|
|
'options' => "[1 => '1', 2 => '2', 3 => '3', 4 => '4']", |
|
837
|
|
|
]; |
|
838
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $divideby, 'config'); |
|
839
|
|
|
|
|
840
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Table type'); |
|
841
|
|
|
$tableType = [ |
|
842
|
|
|
'name' => "'table_type'", |
|
843
|
|
|
'title' => "'{$language}TABLE_TYPE'", |
|
844
|
|
|
'description' => "'{$language}DIVIDEBY_DESC'", |
|
845
|
|
|
'formtype' => "'select'", |
|
846
|
|
|
'valuetype' => "'int'", |
|
847
|
|
|
'default' => "'bordered'", |
|
848
|
|
|
'options' => "['bordered' => 'bordered', 'striped' => 'striped', 'hover' => 'hover', 'condensed' => 'condensed']", |
|
849
|
|
|
]; |
|
850
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $tableType, 'config'); |
|
851
|
|
|
|
|
852
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Panel by'); |
|
853
|
|
|
$panelType = [ |
|
854
|
|
|
'name' => "'panel_type'", |
|
855
|
|
|
'title' => "'{$language}PANEL_TYPE'", |
|
856
|
|
|
'description' => "'{$language}PANEL_TYPE_DESC'", |
|
857
|
|
|
'formtype' => "'select'", |
|
858
|
|
|
'valuetype' => "'text'", |
|
859
|
|
|
'default' => "'default'", |
|
860
|
|
|
'options' => "['default' => 'default', 'primary' => 'primary', 'success' => 'success', 'info' => 'info', 'warning' => 'warning', 'danger' => 'danger']", |
|
861
|
|
|
]; |
|
862
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $panelType, 'config'); |
|
863
|
|
|
|
|
864
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Advertise'); |
|
865
|
|
|
$advertise = [ |
|
866
|
|
|
'name' => "'advertise'", |
|
867
|
|
|
'title' => "'{$language}ADVERTISE'", |
|
868
|
|
|
'description' => "'{$language}ADVERTISE_DESC'", |
|
869
|
|
|
'formtype' => "'textarea'", |
|
870
|
|
|
'valuetype' => "'text'", |
|
871
|
|
|
'default' => "''", |
|
872
|
|
|
]; |
|
873
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $advertise, 'config'); |
|
874
|
|
|
|
|
875
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Bookmarks'); |
|
876
|
|
|
$bookmarks = [ |
|
877
|
|
|
'name' => "'bookmarks'", |
|
878
|
|
|
'title' => "'{$language}BOOKMARKS'", |
|
879
|
|
|
'description' => "'{$language}BOOKMARKS_DESC'", |
|
880
|
|
|
'formtype' => "'yesno'", |
|
881
|
|
|
'valuetype' => "'int'", |
|
882
|
|
|
'default' => '0', |
|
883
|
|
|
]; |
|
884
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $bookmarks, 'config'); |
|
885
|
|
|
|
|
886
|
|
|
/* |
|
887
|
|
|
* removed, as there are no system templates in xoops core for fb or disqus comments |
|
888
|
|
|
* modulebuilder currently is also not creatings tpl files for this |
|
889
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Facebook Comments'); |
|
890
|
|
|
$facebookComments = [ |
|
891
|
|
|
'name' => "'facebook_comments'", |
|
892
|
|
|
'title' => "'{$language}FACEBOOK_COMMENTS'", |
|
893
|
|
|
'description' => "'{$language}FACEBOOK_COMMENTS_DESC'", |
|
894
|
|
|
'formtype' => "'yesno'", |
|
895
|
|
|
'valuetype' => "'int'", |
|
896
|
|
|
'default' => '0', |
|
897
|
|
|
]; |
|
898
|
|
|
$ret .= $this->uxc->getUserModVersion(3, $facebookComments, 'config', '$c'); |
|
899
|
|
|
$ret .= $this->getSimpleString('++$c;'); |
|
900
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Disqus Comments'); |
|
901
|
|
|
$disqusComments = [ |
|
902
|
|
|
'name' => "'disqus_comments'", |
|
903
|
|
|
'title' => "'{$language}DISQUS_COMMENTS'", |
|
904
|
|
|
'description' => "'{$language}DISQUS_COMMENTS_DESC'", |
|
905
|
|
|
'formtype' => "'yesno'", |
|
906
|
|
|
'valuetype' => "'int'", |
|
907
|
|
|
'default' => '0', |
|
908
|
|
|
]; |
|
909
|
|
|
$ret .= $this->uxc->getUserModVersion(3, $disqusComments, 'config', '$c'); |
|
910
|
|
|
$ret .= $this->getSimpleString('++$c;'); |
|
911
|
|
|
*/ |
|
912
|
|
|
|
|
913
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Make Sample button visible?'); |
|
914
|
|
|
$maintainedby = [ |
|
915
|
|
|
'name' => "'displaySampleButton'", |
|
916
|
|
|
'title' => "'CO_' . \$moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON'", |
|
917
|
|
|
'description' => "'CO_' . \$moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC'", |
|
918
|
|
|
'formtype' => "'yesno'", |
|
919
|
|
|
'valuetype' => "'int'", |
|
920
|
|
|
'default' => '1', |
|
921
|
|
|
]; |
|
922
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $maintainedby, 'config'); |
|
923
|
|
|
|
|
924
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Maintained by'); |
|
925
|
|
|
$maintainedby = [ |
|
926
|
|
|
'name' => "'maintainedby'", |
|
927
|
|
|
'title' => "'{$language}MAINTAINEDBY'", |
|
928
|
|
|
'description' => "'{$language}MAINTAINEDBY_DESC'", |
|
929
|
|
|
'formtype' => "'textbox'", |
|
930
|
|
|
'valuetype' => "'text'", |
|
931
|
|
|
'default' => "'{$module->getVar('mod_support_url')}'", |
|
932
|
|
|
]; |
|
933
|
|
|
$ret .= $this->uxc->getUserModVersionArray(2, $maintainedby, 'config'); |
|
934
|
|
|
|
|
935
|
|
|
return $ret; |
|
936
|
|
|
} |
|
937
|
|
|
|
|
938
|
|
|
/** |
|
939
|
|
|
* @private function getXoopsVersionNotifications |
|
940
|
|
|
* @param $module |
|
941
|
|
|
* @param $language |
|
942
|
|
|
* @return string |
|
943
|
|
|
*/ |
|
944
|
|
|
private function getXoopsVersionNotifications($module, $language) |
|
945
|
|
|
{ |
|
946
|
|
|
$moduleDirname = $module->getVar('mod_dirname'); |
|
947
|
|
|
$ret = $this->getDashComment('Notifications'); |
|
948
|
|
|
$ret .= $this->uxc->getUserModVersionText(1, 1, 'hasNotification'); |
|
949
|
|
|
$notifications = ['lookup_file' => "'include/notification.inc.php'", 'lookup_func' => "'{$moduleDirname}_notify_iteminfo'"]; |
|
950
|
|
|
$ret .= $this->uxc->getUserModVersionArray(1, $notifications, 'notification'); |
|
951
|
|
|
|
|
952
|
|
|
$notifyFiles = []; |
|
953
|
|
|
$tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); |
|
954
|
|
|
$tableCategory = []; |
|
955
|
|
|
$tableBroken = []; |
|
956
|
|
|
$tableComments = []; |
|
957
|
|
|
$tableSubmit = []; |
|
958
|
|
|
$tableId = null; |
|
|
|
|
|
|
959
|
|
|
$tableMid = null; |
|
|
|
|
|
|
960
|
|
|
$notifyCategory = ''; |
|
961
|
|
|
$notifyEventGlobal = $this->pc->getPhpCodeCommentLine('Global events notification'); |
|
962
|
|
|
$notifyEventTable = $this->pc->getPhpCodeCommentLine('Event notifications for items'); |
|
963
|
|
|
|
|
964
|
|
|
//global events |
|
965
|
|
|
$notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'global_new', 'global', 0, 'global_new', 'global_new_notify'); |
|
966
|
|
|
$notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'global_modify', 'global', 0, 'global_modify', 'global_modify_notify'); |
|
967
|
|
|
$notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'global_delete', 'global', 0, 'global_delete', 'global_delete_notify'); |
|
968
|
|
|
$notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'global_approve', 'global', 0, 'global_approve', 'global_approve_notify'); |
|
969
|
|
|
foreach (array_keys($tables) as $t) { |
|
970
|
|
|
$tableBroken[] = $tables[$t]->getVar('table_broken'); |
|
971
|
|
|
$tableComments[] = $tables[$t]->getVar('table_comments'); |
|
972
|
|
|
} |
|
973
|
|
|
if (in_array(1, $tableBroken)) { |
|
974
|
|
|
$notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'global_broken', 'global', 0, 'global_broken', 'global_broken_notify'); |
|
975
|
|
|
} |
|
976
|
|
|
if (in_array(1, $tableComments)) { |
|
977
|
|
|
$notifyEventGlobal .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'global_comment', 'global', 0, 'global_comment', 'global_comment_notify'); |
|
978
|
|
|
} |
|
979
|
|
|
|
|
980
|
|
|
foreach (array_keys($tables) as $t) { |
|
981
|
|
|
$tableId = $tables[$t]->getVar('table_id'); |
|
982
|
|
|
$tableMid = $tables[$t]->getVar('table_mid'); |
|
983
|
|
|
$tableName = $tables[$t]->getVar('table_name'); |
|
984
|
|
|
$tableSoleName = $tables[$t]->getVar('table_solename'); |
|
985
|
|
|
$tableCategory[] = $tables[$t]->getVar('table_category'); |
|
986
|
|
|
$tableSubmit[] = $tables[$t]->getVar('table_submit'); |
|
987
|
|
|
$fields = $this->getTableFields($tableMid, $tableId); |
|
988
|
|
|
$fieldId = 0; |
|
989
|
|
|
foreach (array_keys($fields) as $f) { |
|
990
|
|
|
$fieldName = $fields[$f]->getVar('field_name'); |
|
991
|
|
|
if (0 == $f) { |
|
992
|
|
|
$fieldId = $fieldName; |
|
993
|
|
|
} |
|
994
|
|
|
} |
|
995
|
|
|
if (1 == $tables[$t]->getVar('table_notifications')) { |
|
996
|
|
|
$notifyFiles[] = $tableName; |
|
997
|
|
|
$notifyCategory .= $this->getXoopsVersionNotificationTableName($language, 'category', $tableName, $tableSoleName, $tableName, $fieldId, 1); |
|
998
|
|
|
//$notifyEvent .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_new', $tableName, 0, $tableSoleName, $tableSoleName . '_new_notify'); |
|
999
|
|
|
$notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_modify', $tableName, 0, $tableSoleName . '_modify', $tableSoleName . '_modify_notify'); |
|
1000
|
|
|
$notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_delete', $tableName, 0, $tableSoleName . '_delete', $tableSoleName . '_delete_notify'); |
|
1001
|
|
|
$notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_approve', $tableName, 0, $tableSoleName . '_approve', $tableSoleName . '_approve_notify'); |
|
1002
|
|
|
if (1 == $tables[$t]->getVar('table_broken')) { |
|
1003
|
|
|
$notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_broken', $tableName, 0, $tableSoleName . '_broken', $tableSoleName . '_broken_notify'); |
|
1004
|
|
|
} |
|
1005
|
|
|
/*event will be added by xoops |
|
1006
|
|
|
if (1 == $tables[$t]->getVar('table_comments')) { |
|
1007
|
|
|
$notifyEventTable .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', $tableSoleName . '_comment', $tableName, 0, $tableSoleName . '_comment', $tableSoleName . '_comment_notify'); |
|
1008
|
|
|
}*/ |
|
1009
|
|
|
} |
|
1010
|
|
|
} |
|
1011
|
|
|
$ret .= $this->pc->getPhpCodeCommentLine('Categories of notification'); |
|
1012
|
|
|
$ret .= $this->getXoopsVersionNotificationGlobal($language, 'category', 'global', 'global', $notifyFiles); |
|
1013
|
|
|
|
|
1014
|
|
|
//$ret .= $this->getXoopsVersionNotificationCategory($language, 'category', 'category', 'category', $notifyFiles, $fieldParent, '1'); |
|
1015
|
|
|
|
|
1016
|
|
|
$ret .= $notifyCategory . $notifyEventGlobal . $notifyEventTable; |
|
1017
|
|
|
|
|
1018
|
|
|
|
|
1019
|
|
|
return $ret; |
|
1020
|
|
|
} |
|
1021
|
|
|
|
|
1022
|
|
|
/** |
|
1023
|
|
|
* @private function getXoopsVersionNotificationGlobal |
|
1024
|
|
|
* @param $language |
|
1025
|
|
|
* @param $type |
|
1026
|
|
|
* @param $name |
|
1027
|
|
|
* @param $title |
|
1028
|
|
|
* @param $from |
|
1029
|
|
|
* |
|
1030
|
|
|
* @return string |
|
1031
|
|
|
*/ |
|
1032
|
|
|
private function getXoopsVersionNotificationGlobal($language, $type, $name, $title, $from) |
|
1033
|
|
|
{ |
|
1034
|
|
|
$title = mb_strtoupper($title); |
|
1035
|
|
|
$implodeFrom = implode(".php', '", $from); |
|
1036
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('Global Notify'); |
|
1037
|
|
|
$global = [ |
|
1038
|
|
|
'name' => "'{$name}'", |
|
1039
|
|
|
'title' => "{$language}NOTIFY_{$title}", |
|
1040
|
|
|
'description' => "''", |
|
1041
|
|
|
'subscribe_from' => "['index.php', '{$implodeFrom}.php']", |
|
1042
|
|
|
]; |
|
1043
|
|
|
$ret .= $this->uxc->getUserModVersionArray(3, $global, 'notification', "'{$type}'"); |
|
1044
|
|
|
|
|
1045
|
|
|
return $ret; |
|
1046
|
|
|
} |
|
1047
|
|
|
|
|
1048
|
|
|
|
|
1049
|
|
|
/** |
|
1050
|
|
|
* @private function getXoopsVersionNotificationTableName |
|
1051
|
|
|
* @param $language |
|
1052
|
|
|
* @param $type |
|
1053
|
|
|
* @param $name |
|
1054
|
|
|
* @param $title |
|
1055
|
|
|
* @param $file |
|
1056
|
|
|
* @param $item |
|
1057
|
|
|
* @param $allow |
|
1058
|
|
|
* |
|
1059
|
|
|
* @return string |
|
1060
|
|
|
*/ |
|
1061
|
|
|
private function getXoopsVersionNotificationTableName($language, $type, $name, $title, $file, $item, $allow) |
|
1062
|
|
|
{ |
|
1063
|
|
|
$stuTitle = mb_strtoupper($title); |
|
1064
|
|
|
$ucfTitle = ucfirst($title); |
|
1065
|
|
|
$ret = $this->pc->getPhpCodeCommentLine($ucfTitle . ' Notify'); |
|
1066
|
|
|
$table = [ |
|
1067
|
|
|
'name' => "'{$name}'", |
|
1068
|
|
|
'title' => "{$language}NOTIFY_{$stuTitle}", |
|
1069
|
|
|
'description' => "''", |
|
1070
|
|
|
'subscribe_from' => "'{$file}.php'", |
|
1071
|
|
|
'item_name' => "'{$item}'", |
|
1072
|
|
|
'allow_bookmark' => (string)$allow, |
|
1073
|
|
|
]; |
|
1074
|
|
|
$ret .= $this->uxc->getUserModVersionArray(3, $table, 'notification', "'{$type}'"); |
|
1075
|
|
|
|
|
1076
|
|
|
return $ret; |
|
1077
|
|
|
} |
|
1078
|
|
|
|
|
1079
|
|
|
/** |
|
1080
|
|
|
* @private function getXoopsVersionNotifications |
|
1081
|
|
|
* @param $language |
|
1082
|
|
|
* @param $type |
|
1083
|
|
|
* @param $name |
|
1084
|
|
|
* @param $category |
|
1085
|
|
|
* @param $admin |
|
1086
|
|
|
* @param $title |
|
1087
|
|
|
* @param $mail |
|
1088
|
|
|
* |
|
1089
|
|
|
* @return string |
|
1090
|
|
|
*/ |
|
1091
|
|
|
private function getXoopsVersionNotificationCodeComplete($language, $type, $name, $category, $admin, $title, $mail) |
|
1092
|
|
|
{ |
|
1093
|
|
|
$title = mb_strtoupper($title); |
|
1094
|
|
|
$ucfTitle = ucfirst($title); |
|
1095
|
|
|
$ret = $this->pc->getPhpCodeCommentLine($ucfTitle . ' Notify'); |
|
1096
|
|
|
$event = [ |
|
1097
|
|
|
'name' => "'{$name}'", |
|
1098
|
|
|
'category' => "'{$category}'", |
|
1099
|
|
|
'admin_only' => (string)$admin, |
|
1100
|
|
|
'title' => "{$language}NOTIFY_{$title}", |
|
1101
|
|
|
'caption' => "{$language}NOTIFY_{$title}_CAPTION", |
|
1102
|
|
|
'description' => "''", |
|
1103
|
|
|
'mail_template' => "'{$mail}'", |
|
1104
|
|
|
'mail_subject' => "{$language}NOTIFY_{$title}_SUBJECT", |
|
1105
|
|
|
]; |
|
1106
|
|
|
$ret .= $this->uxc->getUserModVersionArray(3, $event, 'notification', "'{$type}'"); |
|
1107
|
|
|
|
|
1108
|
|
|
return $ret; |
|
1109
|
|
|
} |
|
1110
|
|
|
|
|
1111
|
|
|
/** |
|
1112
|
|
|
* @private function getXoopsVersionNotifications |
|
1113
|
|
|
* @param $moduleDirname |
|
1114
|
|
|
* @param string $t |
|
1115
|
|
|
* @return string |
|
1116
|
|
|
*/ |
|
1117
|
|
|
private function getXoopsVersionSelectSizeMB($moduleDirname, $t = '') |
|
1118
|
|
|
{ |
|
1119
|
|
|
$ucModuleDirname = mb_strtoupper($moduleDirname); |
|
1120
|
|
|
|
|
1121
|
|
|
$ret = $this->pc->getPhpCodeCommentLine('create increment steps for file size'); |
|
1122
|
|
|
$ret .= $this->pc->getPhpCodeIncludeDir("__DIR__ . '/include/xoops_version.inc.php'", '',true,true); |
|
1123
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$iniPostMaxSize ', "{$moduleDirname}ReturnBytes(ini_get('post_max_size'))"); |
|
1124
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$iniUploadMaxFileSize', "{$moduleDirname}ReturnBytes(ini_get('upload_max_filesize'))"); |
|
1125
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$maxSize ', "min(\$iniPostMaxSize, \$iniUploadMaxFileSize)"); |
|
1126
|
|
|
$cond = $this->xc->getXcEqualsOperator('$increment', '500', null, $t . "\t"); |
|
1127
|
|
|
$ret .= $this->pc->getPhpCodeConditions('$maxSize', ' > ', '10000 * 1048576', $cond, false, $t); |
|
1128
|
|
|
$cond = $this->xc->getXcEqualsOperator('$increment', '200', null, $t . "\t"); |
|
1129
|
|
|
$ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '10000 * 1048576', $cond, false, $t); |
|
1130
|
|
|
$cond = $this->xc->getXcEqualsOperator('$increment', '100', null, $t . "\t"); |
|
1131
|
|
|
$ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '5000 * 1048576', $cond, false, $t); |
|
1132
|
|
|
$cond = $this->xc->getXcEqualsOperator('$increment', '50', null, $t . "\t"); |
|
1133
|
|
|
$ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '2500 * 1048576', $cond, false, $t); |
|
1134
|
|
|
$cond = $this->xc->getXcEqualsOperator('$increment', '10', null, $t . "\t"); |
|
1135
|
|
|
$ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '1000 * 1048576', $cond, false, $t); |
|
1136
|
|
|
$cond = $this->xc->getXcEqualsOperator('$increment', '5', null, $t . "\t"); |
|
1137
|
|
|
$ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '500 * 1048576', $cond, false, $t); |
|
1138
|
|
|
$cond = $this->xc->getXcEqualsOperator('$increment', '2', null, $t . "\t"); |
|
1139
|
|
|
$ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '100 * 1048576', $cond, false, $t); |
|
1140
|
|
|
$cond = $this->xc->getXcEqualsOperator('$increment', '1', null, $t . "\t"); |
|
1141
|
|
|
$ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '50 * 1048576', $cond, false, $t); |
|
1142
|
|
|
$cond = $this->xc->getXcEqualsOperator('$increment', '0.5', null, $t . "\t"); |
|
1143
|
|
|
$ret .= $this->pc->getPhpCodeConditions('$maxSize', ' <= ', '25 * 1048576', $cond, false, $t); |
|
1144
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$optionMaxsize', '[]'); |
|
1145
|
|
|
$ret .= $this->xc->getXcEqualsOperator('$i', '$increment'); |
|
1146
|
|
|
$while = $this->xc->getXcEqualsOperator("\$optionMaxsize[\$i . ' ' . _MI_{$ucModuleDirname}_SIZE_MB]", '$i * 1048576', null, $t . "\t"); |
|
1147
|
|
|
$while .= $this->xc->getXcEqualsOperator('$i', '$increment', '+',$t . "\t"); |
|
1148
|
|
|
$ret .= $this->pc->getPhpCodeWhile('i * 1048576', $while, '$maxSize', '<='); |
|
1149
|
|
|
|
|
1150
|
|
|
return $ret; |
|
1151
|
|
|
} |
|
1152
|
|
|
|
|
1153
|
|
|
/** |
|
1154
|
|
|
* @public function render |
|
1155
|
|
|
* @param null |
|
1156
|
|
|
* @return bool|string |
|
1157
|
|
|
*/ |
|
1158
|
|
|
public function render() |
|
1159
|
|
|
{ |
|
1160
|
|
|
$module = $this->getModule(); |
|
1161
|
|
|
$table = $this->getTable(); |
|
1162
|
|
|
$tables = $this->getTables(); |
|
1163
|
|
|
$filename = $this->getFileName(); |
|
1164
|
|
|
$moduleDirname = $module->getVar('mod_dirname'); |
|
1165
|
|
|
$language = $this->getLanguage($moduleDirname, 'MI'); |
|
1166
|
|
|
$content = $this->getHeaderFilesComments($module); |
|
1167
|
|
|
$content .= $this->getXoopsVersionHeader($module, $language); |
|
1168
|
|
|
$content .= $this->getXoopsVersionTemplatesAdminUser($moduleDirname, $tables, $module->getVar('mod_admin'), $module->getVar('mod_user')); |
|
1169
|
|
|
$content .= $this->getXoopsVersionMySQL($moduleDirname, $table, $tables); |
|
1170
|
|
|
$tableSearch = []; |
|
1171
|
|
|
$tableComments = []; |
|
1172
|
|
|
$tableSubmenu = []; |
|
1173
|
|
|
$tableBlocks = []; |
|
1174
|
|
|
$tableNotifications = []; |
|
1175
|
|
|
foreach (array_keys($tables) as $t) { |
|
1176
|
|
|
$tableSearch[] = $tables[$t]->getVar('table_search'); |
|
1177
|
|
|
$tableComments[] = $tables[$t]->getVar('table_comments'); |
|
1178
|
|
|
$tableSubmenu[] = $tables[$t]->getVar('table_submenu'); |
|
1179
|
|
|
$tableBlocks[] = $tables[$t]->getVar('table_blocks'); |
|
1180
|
|
|
$tableNotifications[] = $tables[$t]->getVar('table_notifications'); |
|
1181
|
|
|
} |
|
1182
|
|
|
if (in_array(1, $tableSearch)) { |
|
1183
|
|
|
$content .= $this->getXoopsVersionSearch($moduleDirname); |
|
1184
|
|
|
} |
|
1185
|
|
|
if (in_array(1, $tableComments)) { |
|
1186
|
|
|
$content .= $this->getXoopsVersionComments($moduleDirname, $tables); |
|
1187
|
|
|
} |
|
1188
|
|
|
if (in_array(1, $tableSubmenu)) { |
|
1189
|
|
|
$content .= $this->getXoopsVersionSubmenu($language, $tables); |
|
1190
|
|
|
} |
|
1191
|
|
|
if (in_array(1, $tableBlocks)) { |
|
1192
|
|
|
$content .= $this->getXoopsVersionBlocks($moduleDirname, $tables, $language); |
|
1193
|
|
|
} |
|
1194
|
|
|
$content .= $this->getXoopsVersionConfig($module, $tables, $language); |
|
1195
|
|
|
if (in_array(1, $tableNotifications)) { |
|
1196
|
|
|
$content .= $this->getXoopsVersionNotifications($module, $language); |
|
1197
|
|
|
} |
|
1198
|
|
|
$this->create($moduleDirname, '/', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); |
|
1199
|
|
|
|
|
1200
|
|
|
return $this->renderFile(); |
|
1201
|
|
|
} |
|
1202
|
|
|
} |
|
1203
|
|
|
|