Completed
Push — master ( 3e3e88...d3bebc )
by Gino
08:11 queued 03:57
created

UserXoopsVersion::write()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 11
rs 9.4285
cc 2
eloc 8
nc 2
nop 4
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 29 and the first side effect is on line 24.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 */
12
/**
13
 * tdmcreate module.
14
 *
15
 * @copyright       The XOOPS Project http://sourceforge.net/projects/xoops/
16
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
17
 *
18
 * @since           2.5.0
19
 *
20
 * @author          Txmod Xoops http://www.txmodxoops.org
21
 *
22
 * @version         $Id: UserXoopsVersion.php 12258 2014-01-02 09:33:29Z timgno $
23
 */
24
defined('XOOPS_ROOT_PATH') || die('Restricted access');
25
26
/**
27
 * Class UserXoopsVersion.
28
 */
29
class UserXoopsVersion extends TDMCreateFile
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
30
{
31
    /*
32
    * @var mixed
33
    */
34
    private $phpcode = null;
35
36
    /*
37
    * @var mixed
38
    */
39
    private $xoopscode = null;
40
41
    /*
42
    * @var mixed
43
    */
44
    private $usercode = null;
45
46
    /*
47
    * @var array
48
    */
49
    private $keywords = array();
50
51
    /*
52
    *  @public function constructor
53
    *  @param null
54
    */
55
    /**
56
     *
57
     */
58
    public function __construct()
59
    {
60
        parent::__construct();
61
        $this->phpcode = TDMCreatePhpCode::getInstance();
62
        $this->xoopscode = TDMCreateXoopsCode::getInstance();
63
        $this->usercode = UserXoopsCode::getInstance();
64
    }
65
66
    /*
67
    *  @static function &getInstance
68
    *  @param null
69
    */
70
    /**
71
     * @return UserXoopsVersion
72
     */
73
    public static function &getInstance()
74
    {
75
        static $instance = false;
76
        if (!$instance) {
77
            $instance = new self();
78
        }
79
80
        return $instance;
81
    }
82
83
    /*
84
    *  @public function write
85
    *  @param $module
86
    *  @param mixed $table
87
    *  @param mixed $tables
88
    *  @param $filename
89
    */
90
    /**
91
     * @param $module
92
     * @param $table
93
     * @param $tables
94
     * @param $filename
95
     */
96
    public function write($module, $table, $tables, $filename)
97
    {
98
        $this->setModule($module);
99
        $this->setTable($table);
100
        $this->setTables($tables);
101
        $this->setFileName($filename);
102
        foreach (array_keys($tables) as $t) {
103
            $tableName = $tables[$t]->getVar('table_name');
104
            $this->setKeywords($tableName);
105
        }
106
    }
107
108
    /*
109
    *  @public function setKeywords
110
    *  @param mixed $keywords
111
    */
112
    /**
113
     * @param $keywords
114
     */
115
    public function setKeywords($keywords)
116
    {
117
        if (is_array($keywords)) {
118
            $this->keywords = $keywords;
119
        } else {
120
            $this->keywords[] = $keywords;
121
        }
122
    }
123
124
    /*
125
    *  @public function getKeywords
126
    *  @param null
127
    */
128
    /**
129
     * @return array
130
     */
131
    public function getKeywords()
132
    {
133
        return $this->keywords;
134
    }
135
136
    /*
137
     * @private function getXoopsVersionHeader
138
     * @param $module
139
     * @param $language
140
     *
141
     * @return string
142
     */
143
    private function getXoopsVersionHeader($module, $language)
144
    {
145
        $date = date(_DBDATESTRING);
146
        $ret = $this->getSimpleString("defined('XOOPS_ROOT_PATH') || die('Restricted access');");
147
        $ret .= $this->getCommentLine();
148
        $ret .= $this->xoopscode->getXoopsCodeEqualsOperator('$dirname ', 'basename(__DIR__)');
149
        $ret .= $this->getHeaderComment('Informations');
150
        $ha = (1 == $module->getVar('mod_admin')) ? 1 : 0;
151
        $hm = (1 == $module->getVar('mod_user')) ? 1 : 0;
152
153
        $descriptions = array('name' => "{$language}NAME", 'version' => "{$module->getVar('mod_version')}", 'description' => "{$language}DESC",
154
                            'author' => "'{$module->getVar('mod_author')}'", 'author_mail' => "'{$module->getVar('mod_author_mail')}'", 'author_website_url' => "'{$module->getVar('mod_author_website_url')}'",
155
                            'author_website_name' => "'{$module->getVar('mod_author_website_name')}'",'credits' => "'{$module->getVar('mod_credits')}'",'license' => "'{$module->getVar('mod_license')}'",
156
                            'license_url' => "'www.gnu.org/licenses/gpl-2.0.html/'", 'help' => "'page=help'", 'release_info' => "'{$module->getVar('mod_release_info')}'",
157
                            'release_file' => "XOOPS_URL . '/modules/{$module->getVar('mod_dirname')}/docs/{$module->getVar('mod_release_file')}'", 'release_date' => "'{$date}'",
158
                            'manual' => "'{$module->getVar('mod_manual')}'", 'manual_file' => "XOOPS_URL . '/modules/{$module->getVar('mod_dirname')}/docs/{$module->getVar('mod_manual_file')}'",
159
                            'min_php' => "'{$module->getVar('mod_min_php')}'", 'min_xoops' => "'{$module->getVar('mod_min_xoops')}'", 'min_admin' => "'{$module->getVar('mod_min_admin')}'",
160
                            'min_db' => "array('mysql' => '{$module->getVar('mod_min_mysql')}', 'mysqli' => '{$module->getVar('mod_min_mysql')}')", 'image' => "'assets/images/{$module->getVar('mod_image')}'",
161
                            'dirname' => 'basename(__DIR__)', 'dirmoduleadmin' => "'Frameworks/moduleclasses/moduleadmin'", 'sysicons16' => "'../../Frameworks/moduleclasses/icons/16'",
162
                            'sysicons32' => "'../../Frameworks/moduleclasses/icons/32'", 'modicons16' => "'assets/icons/16'", 'modicons32' => "'assets/icons/32'",
163
                            'demo_site_url' => "'{$module->getVar('mod_demo_site_url')}'", 'demo_site_name' => "'{$module->getVar('mod_demo_site_name')}'", 'support_url' => "'{$module->getVar('mod_support_url')}'",
164
                            'support_name' => "'{$module->getVar('mod_support_name')}'", 'module_website_url' => "'{$module->getVar('mod_website_url')}'", 'module_website_name' => "'{$module->getVar('mod_website_name')}'", 'release' => "'{$module->getVar('mod_release')}'", 'module_status' => "'{$module->getVar('mod_status')}'",
165
                            'system_menu' => '1', 'hasAdmin' => $ha, 'hasMain' => $hm, 'adminindex' => "'admin/index.php'", 'adminmenu' => "'admin/menu.php'",
166
                            'onInstall' => "'include/install.php'", 'onUpdate' => "'include/update.php'", );
167
168
        $ret .= $this->usercode->getUserModVersion(1, $descriptions);
169
170
        return $ret;
171
    }
172
173
    /*
174
    *  @private function getXoopsVersionMySQL
175
    *  @param $moduleDirname
176
    *  @param $table
177
    */
178
    /**
179
     * @param $moduleDirname
180
     * @param $table
181
     *
182
     * @return string
183
     */
184
    private function getXoopsVersionMySQL($moduleDirname, $table, $tables)
185
    {
186
        $tableName = $table->getVar('table_name');
187
        $n = 1;
188
        $ret = '';
189
        if (!empty($tableName)) {
190
            $ret .= $this->getHeaderComment('Mysql');
191
            $ret .= $this->usercode->getUserModVersion(2, "'sql/mysql.sql'", 'sqlfile', "'mysql'");
192
            $ret .= $this->getCommentLine('Tables');
193
194
            foreach (array_keys($tables) as $t) {
195
                $ret .= $this->usercode->getUserModVersion(2, "'{$moduleDirname}_{$tables[$t]->getVar('table_name')}'", 'tables', $n);
196
                ++$n;
197
            }
198
            unset($n);
199
        }
200
201
        return $ret;
202
    }
203
204
    /*
205
    *  @private function getXoopsVersionSearch
206
    *  @param $moduleDirname
207
    */
208
    /**
209
     * @param $moduleDirname
210
     *
211
     * @return string
212
     */
213
    private function getXoopsVersionSearch($moduleDirname)
214
    {
215
        $ret = $this->getHeaderComment('Search');
216
        $ret .= $this->usercode->getUserModVersion(1, 1, 'hasSearch');
217
        $ret .= $this->usercode->getUserModVersion(2, "'include/search.inc.php'", 'search', "'file'");
218
        $ret .= $this->usercode->getUserModVersion(2, "'{$moduleDirname}_search'", 'search', "'func'");
219
220
        return $ret;
221
    }
222
223
    /*
224
    *  @private function getXoopsVersionComments
225
    *  @param $moduleDirname
226
    */
227
    /**
228
     * @param $moduleDirname
229
     *
230
     * @return string
231
     */
232
    private function getXoopsVersionComments($moduleDirname)
233
    {
234
        $ret = $this->getHeaderComment('Comments');
235
        $ret .= $this->usercode->getUserModVersion(2, "'comments.php'", 'comments', "'pageName'");
236
        $ret .= $this->usercode->getUserModVersion(2, "'com_id'", 'comments', "'itemName'");
237
        $ret .= $this->getCommentLine('Comment callback functions');
238
        $ret .= $this->usercode->getUserModVersion(2, "'include/comment_functions.php'", 'comments', "'callbackFile'");
239
        $descriptions = array('approve' => "'{$moduleDirname}CommentsApprove'", 'update' => "'{$moduleDirname}CommentsUpdate'");
240
        $ret .= $this->usercode->getUserModVersion(3, $descriptions, 'comments', "'callback'");
241
242
        return $ret;
243
    }
244
245
    /*
246
    *  @private function getXoopsVersionTemplatesAdmin
247
    *  @param $moduleDirname
248
    */
249
    /**
250
     * @param $moduleDirname
251
     * @param $tables
252
     *
253
     * @return string
254
     */
255
    private function getXoopsVersionTemplatesAdmin($moduleDirname, $tables)
256
    {
257
        $ret = $this->getHeaderComment('Templates');
258
        $ret .= $this->getCommentLine('Admin');
259
260
        $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'about', false, true);
261
        $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'header', false, true);
262
        $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'index', false, true);
263
        $tablePermissions = array();
264 View Code Duplication
        foreach (array_keys($tables) as $t) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
265
            $tableName = $tables[$t]->getVar('table_name');
266
            $tablePermissions[] = $tables[$t]->getVar('table_permissions');
267
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName, false, true);
268
        }
269
        if (in_array(1, $tablePermissions)) {
270
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'permissions', false, true);
271
        }
272
        $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'footer', false, true);
273
274
        return $ret;
275
    }
276
277
    /*
278
    *  @private function getXoopsVersionTemplatesLine
279
    *  @param $moduleDirname
280
    */
281
    /**
282
     * @param $moduleDirname
283
     *
284
     * @return string
285
     */
286
    private function getXoopsVersionTemplatesLine($moduleDirname, $type, $extra = false, $isAdmin = false)
287
    {
288
        $ret = '';
289
        $desc = "'description' => ''";
290
        $arrayFile = "array('file' =>";
291
        if ($isAdmin) {
292
            $ret .= $this->usercode->getUserModVersion(2, "{$arrayFile} '{$moduleDirname}_admin_{$type}.tpl', {$desc}, 'type' => 'admin')", 'templates', '');
293
        } else {
294
            if ($extra !== false) {
295
                $ret .= $this->usercode->getUserModVersion(2, "{$arrayFile} '{$moduleDirname}_{$type}_{$extra}.tpl', {$desc})", 'templates', '');
296
            } else {
297
				$ret .= $this->usercode->getUserModVersion(2, "{$arrayFile} '{$moduleDirname}_{$type}.tpl', {$desc})", 'templates', '');                
298
            }
299
        }
300
301
        return $ret;
302
    }
303
304
    /*
305
    *  @private function getXoopsVersionTemplatesUser
306
    *  @param $moduleDirname
307
    */
308
    /**
309
     * @param $moduleDirname
310
     *
311
     * @return string
312
     */
313
    private function getXoopsVersionTemplatesUser($moduleDirname, $tables)
314
    {
315
        $table = $this->getTable();
0 ignored issues
show
Unused Code introduced by
$table is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
316
        $ret = $this->getCommentLine('User');
317
318
        $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'header');
319
        $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'index');
320
        $tableBroken = array();
321
        $tablePdf = array();
322
        $tablePrint = array();
323
        $tableRate = array();
324
        $tableRss = array();
325
        $tableSearch = array();
326
        $tableSingle = array();
327
        $tableSubmit = array();
328
        foreach (array_keys($tables) as $t) {
329
            $tableName = $tables[$t]->getVar('table_name');
330
            $tableBroken[] = $tables[$t]->getVar('table_broken');
331
            $tablePdf[] = $tables[$t]->getVar('table_pdf');
332
            $tablePrint[] = $tables[$t]->getVar('table_print');
333
            $tableRate[] = $tables[$t]->getVar('table_rate');
334
            $tableRss[] = $tables[$t]->getVar('table_rss');
335
            $tableSearch[] = $tables[$t]->getVar('table_search');
336
            $tableSingle[] = $tables[$t]->getVar('table_single');
337
            $tableSubmit[] = $tables[$t]->getVar('table_submit');
338
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName);
339
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, $tableName, 'list');
0 ignored issues
show
Documentation introduced by
'list' is of type string, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
340
        }
341
        $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'breadcrumbs');
342
        if (in_array(1, $tableBroken)) {
343
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'broken');
344
        }
345
        if (in_array(1, $tablePdf)) {
346
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'pdf');
347
        }
348
        if (in_array(1, $tablePrint)) {
349
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'print');
350
        }
351
        if (in_array(1, $tableRate)) {
352
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'rate');
353
        }
354
        if (in_array(1, $tableRss)) {
355
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'rss');
356
        }
357
        if (in_array(1, $tableSearch)) {
358
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'search');
359
        }
360
        if (in_array(1, $tableSingle)) {
361
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'single');
362
        }
363
        if (in_array(1, $tableSubmit)) {
364
            $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'submit');
365
        }
366
        $ret .= $this->getXoopsVersionTemplatesLine($moduleDirname, 'footer');
367
368
        return $ret;
369
    }
370
371
    /*
372
    *  @private function getXoopsVersionSubmenu
373
    *  @param $language
374
    */
375
    /**
376
     * @param $language
377
     *
378
     * @return string
379
     */
380
    private function getXoopsVersionSubmenu($language, $tables)
381
    {
382
        $ret = $this->getHeaderComment('Submenu');
383
        $i = 1;
384
        $tableSubmit = array();
385
        foreach (array_keys($tables) as $t) {
386
            $tableName = $tables[$t]->getVar('table_name');
387
            $tableSubmit[] = $tables[$t]->getVar('table_submit');
388
            if (1 == $tables[$t]->getVar('table_submenu')) {
389
                $ret .= $this->getCommentLine('Sub', $tableName);
390
                $tname = array('name' => "{$language}SMNAME{$i}", 'url' => "'{$tableName}.php'");
391
                $ret .= $this->usercode->getUserModVersion(3, $tname, 'sub', $i);
392
            }
393
            ++$i;
394
        }
395
        if (in_array(1, $tableSubmit)) {
396
            $ret .= $this->getCommentLine('Sub', 'Submit');
397
            $submit = array('name' => "{$language}SMNAME{$i}", 'url' => "'submit.php'");
398
            $ret .= $this->usercode->getUserModVersion(3, $submit, 'sub', $i);
399
        }
400
        unset($i);
401
402
        return $ret;
403
    }
404
405
    /*
406
    *  @private function getXoopsVersionBlocks
407
    *  @param $moduleDirname
408
    *  @param $language
409
    */
410
    /**
411
     * @param $moduleDirname
412
     * @param $language
413
     *
414
     * @return string
415
     */
416
    private function getXoopsVersionBlocks($moduleDirname, $table, $tables, $language)
0 ignored issues
show
Unused Code introduced by
The parameter $table is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
417
    {
418
        $ret = $this->getHeaderComment('Blocks');
419
        $ret .= $this->getSimpleString('$b = 1;');
420
        foreach (array_keys($tables) as $i) {
421
            $tableName = $tables[$i]->getVar('table_name');
422
            $tableFieldName = $tables[$i]->getVar('table_fieldname');
423
            if (1 == $tables[$i]->getVar('table_category')) {
424
                $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, $language, $tableFieldName);
425
            } else {
426
                $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, $language, 'last');
427
                $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, $language, 'new');
428
                $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, $language, 'hits');
429
                $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, $language, 'top');
430
                $ret .= $this->getXoopsVersionTypeBlocks($moduleDirname, $tableName, $language, 'random');
431
            }
432
        }
433
        $ret .= $this->getSimpleString('unset($b);');
434
435
        return $ret;
436
    }
437
438
    /*
439
    *  @private function getXoopsVersionTypeBlocks
440
    *  @param $moduleDirname
441
    *  @param $language
442
    */
443
    /**
444
     * @param $moduleDirname
445
     * @param $language
446
     *
447
     * @return string
448
     */
449
    private function getXoopsVersionTypeBlocks($moduleDirname, $tableName, $language, $type)
450
    {
451
        $stuTableName = strtoupper($tableName);
452
        $stuType = strtoupper($type);
453
        $ucfType = ucfirst($type);
454
        $ret = $this->getCommentLine("{$ucfType}");
455
        $blocks = array('file' => "'{$tableName}.php'", 'name' => "{$language}{$stuTableName}_BLOCK_{$stuType}", 'description' => "{$language}{$stuTableName}_BLOCK_{$stuType}_DESC",
456
                        'show_func' => "'b_{$moduleDirname}_{$tableName}_show'", 'edit_func' => "'b_{$moduleDirname}_{$tableName}_edit'",
457
                        'template' => "'{$moduleDirname}_block_{$tableName}.tpl'", 'options' => "'{$type}|5|25|0'", );
458
        $ret .= $this->usercode->getUserModVersion(3, $blocks, 'blocks', '$b');
459
        $ret .= $this->getSimpleString('++$b;');
460
461
        return $ret;
462
    }
463
464
    /*
465
    *  @private function getXoopsVersionConfig
466
    *  @param $moduleDirname
467
    *  @param $language
468
    */
469
    /**
470
     * @param $module
471
     * @param $table
472
     * @param $language
473
     *
474
     * @return string
475
     */
476
    private function getXoopsVersionConfig($module, $table, $language)
477
    {
478
        $moduleDirname = $module->getVar('mod_dirname');
479
        $ret = $this->getHeaderComment('Config');
480
        $ret .= $this->getSimpleString('$c = 1;');
481
        $fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id'));
482
        $fieldName = array();
483
        $fieldElement = array();
484
        foreach (array_keys($fields) as $f) {
485
            $fieldName[] = $fields[$f]->getVar('field_name');
486
            $fieldElement[] = $fields[$f]->getVar('field_element');
487
        }
488
        if (in_array(4, $fieldElement)) {
489
            $rpFieldName = $this->getRightString($fieldName);
490
            $ucfFieldName = ucfirst($rpFieldName);
491
            $ret .= $this->getCommentLine('Editor', $rpFieldName);
492
            $ret .= $this->xoopscode->getXoopsCodeLoad('xoopseditorhandler');
493
            $ret .= $this->xoopscode->getXoopsCodeEqualsOperator('editorHandler ', 'XoopsEditorHandler::getInstance()');
494
            $editor = array('name' => "'{$moduleDirname}_editor_{$rpFieldName}'", 'title' => "'{$language}EDITOR_{$ucfFieldName}'", 'description' => "'{$language}EDITOR_{$ucfFieldName}_DESC'",
495
                    'formtype' => "'select'", 'valuetype' => "'text'", 'default' => "'dhtml'", 'options' => 'array_flip($editorHandler->getList())', );
496
            $ret .= $this->usercode->getUserModVersion(3, $editor, 'config', '$c');
497
            $ret .= $this->getSimpleString('++$c;');
498
        }
499
        if (1 == $table->getVar('table_permissions')) {
500
            $ret .= $this->getCommentLine('Get groups');
501
            $ret .= $this->xoopscode->getXoopsCodeEqualsOperator('$memberHandler ', "xoops_gethandler('member')", true);
502
            $ret .= $this->xoopscode->getXoopsCodeEqualsOperator('$xoopsGroups ', '$memberHandler->getGroupList()');
503
            $group = $this->xoopscode->getXoopsCodeEqualsOperator('$groups[$group] ', '$key');
504
            $ret .= $this->phpcode->getPhpCodeForeach('xoopsGroups', false, 'key', 'group', $group);
505
            $groups = array('name' => "'groups'", 'title' => "'{$language}GROUPS'", 'description' => "'{$language}GROUPS_DESC'",
506
                        'formtype' => "'select_multi'", 'valuetype' => "'array'", 'default' => '$groups', 'options' => '$groups', );
507
            $ret .= $this->usercode->getUserModVersion(3, $groups, 'config', '$c');
508
            $ret .= $this->getSimpleString('++$c;');
509
            $ret .= $this->getCommentLine('Get Admin groups');
510
            $ret .= $this->xoopscode->getXoopsCodeEqualsOperator('$criteria ', 'new CriteriaCompo()');
511
            $ret .= $this->getSimpleString("\$criteria->add( new Criteria( 'group_type', 'Admin' ) );");
512
            $ret .= $this->xoopscode->getXoopsCodeEqualsOperator('$memberHandler ', "xoops_gethandler('member')", true);
513
            $ret .= $this->xoopscode->getXoopsCodeEqualsOperator('$adminXoopsGroups ', '$memberHandler->getGroupList($criteria)');
514
            $adminGroup = $this->xoopscode->getXoopsCodeEqualsOperator('$adminGroups[$adminGroup] ', '$key');
515
            $ret .= $this->phpcode->getPhpCodeForeach('adminXoopsGroups', false, 'key', 'adminGroup', $adminGroup);
516
            $adminGroups = array('name' => "'admin_groups'", 'title' => "'{$language}GROUPS'", 'description' => "'{$language}GROUPS_DESC'",
517
                        'formtype' => "'select_multi'", 'valuetype' => "'array'", 'default' => '$adminGroups', 'options' => '$adminGroups', );
518
            $ret .= $this->usercode->getUserModVersion(3, $adminGroups, 'config', '$c');
519
            $ret .= $this->getSimpleString('++$c;');
520
        }
521
        $keyword = implode(', ', $this->getKeywords());
522
        $ret .= $this->getCommentLine('Keywords');
523
        $arrayKeyword = array('name' => "'keywords'", 'title' => "'{$language}KEYWORDS'", 'description' => "'{$language}KEYWORDS_DESC'",
524
                        'formtype' => "'textbox'", 'valuetype' => "'text'", 'default' => "'{$moduleDirname}, {$keyword}'", );
525
        $ret .= $this->usercode->getUserModVersion(3, $arrayKeyword, 'config', '$c');
526
        $ret .= $this->getSimpleString('++$c;');
527
        unset($this->keywords);
528
        if (is_object($table)) {
529
            if (in_array(array(10, 11, 12, 13, 14), $fieldElement)) {
530
                $ret .= $this->getCommentLine('Uploads : maxsize of image');
531
                $maxsize = array('name' => "'maxsize'", 'title' => "'{$language}MAXSIZE'", 'description' => "'{$language}MAXSIZE_DESC'",
532
                    'formtype' => "'textbox'", 'valuetype' => "'int'", 'default' => '5000000', );
533
                $ret .= $this->usercode->getUserModVersion(3, $maxsize, 'config', '$c');
534
                $ret .= $this->getCommentLine('Uploads : mimetypes of image');
535
                $ret .= $this->getSimpleString('++$c;');
536
                $mimetypes = array('name' => "'mimetypes'", 'title' => "'{$language}MIMETYPES'", 'description' => "'{$language}MIMETYPES_DESC'",
537
                    'formtype' => "'select_multi'", 'valuetype' => "'array'", 'default' => "array('image/gif', 'image/jpeg', 'image/png')", 'options' => "array('bmp' => 'image/bmp','gif' => 'image/gif','pjpeg' => 'image/pjpeg',
538
				   'jpeg' => 'image/jpeg','jpg' => 'image/jpg','jpe' => 'image/jpe',
539
				   'png' => 'image/png')", );
540
                $ret .= $this->usercode->getUserModVersion(3, $mimetypes, 'config', '$c');
541
                $ret .= $this->getSimpleString('++$c;');
542
            }
543 View Code Duplication
            if (1 == $table->getVar('table_admin')) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
544
                $ret .= $this->getCommentLine('Admin pager');
545
                $adminPager = array('name' => "'adminpager'", 'title' => "'{$language}ADMIN_PAGER'", 'description' => "'{$language}ADMIN_PAGER_DESC'",
546
                        'formtype' => "'textbox'", 'valuetype' => "'int'", 'default' => '10', );
547
                $ret .= $this->usercode->getUserModVersion(3, $adminPager, 'config', '$c');
548
                $ret .= $this->getSimpleString('++$c;');
549
            }
550 View Code Duplication
            if (1 == $table->getVar('table_user')) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
551
                $ret .= $this->getCommentLine('User pager');
552
                $userPager = array('name' => "'userpager'", 'title' => "'{$language}USER_PAGER'", 'description' => "'{$language}USER_PAGER_DESC'",
553
                        'formtype' => "'textbox'", 'valuetype' => "'int'", 'default' => '10', );
554
                $ret .= $this->usercode->getUserModVersion(3, $userPager, 'config', '$c');
555
                $ret .= $this->getSimpleString('++$c;');
556
            }
557 View Code Duplication
            if (1 == $table->getVar('table_tag')) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
558
                $ret .= $this->getCommentLine('Use tag');
559
                $useTag = array('name' => "'usetag'", 'title' => "'{$language}USE_TAG'", 'description' => "'{$language}USE_TAG_DESC'",
560
                        'formtype' => "'yesno'", 'valuetype' => "'int'", 'default' => '0', );
561
                $ret .= $this->usercode->getUserModVersion(3, $useTag, 'config', '$c');
562
                $ret .= $this->getSimpleString('++$c;');
563
            }
564
        }
565
        $ret .= $this->getCommentLine('Number column');
566
        $numbCol = array('name' => "'numb_col'", 'title' => "'{$language}NUMB_COL'", 'description' => "'{$language}NUMB_COL_DESC'",
567
                        'formtype' => "'select'", 'valuetype' => "'int'", 'default' => '1', 'options' => "array(1 => '1', 2 => '2', 3 => '3', 4 => '4')", );
568
        $ret .= $this->usercode->getUserModVersion(3, $numbCol, 'config', '$c');
569
        $ret .= $this->getSimpleString('++$c;');
570
        $ret .= $this->getCommentLine('Divide by');
571
        $divideby = array('name' => "'divideby'", 'title' => "'{$language}DIVIDEBY'", 'description' => "'{$language}DIVIDEBY_DESC'",
572
                        'formtype' => "'select'", 'valuetype' => "'int'", 'default' => '1', 'options' => "array(1 => '1', 2 => '2', 3 => '3', 4 => '4')", );
573
        $ret .= $this->usercode->getUserModVersion(3, $divideby, 'config', '$c');
574
        $ret .= $this->getSimpleString('++$c;');
575
        $ret .= $this->getCommentLine('Table type');
576
        $tableType = array('name' => "'table_type'", 'title' => "'{$language}DIVIDEBY'", 'description' => "'{$language}DIVIDEBY_DESC'",
577
                        'formtype' => "'select'", 'valuetype' => "'int'", 'default' => "'bordered'", 'options' => "array('bordered' => 'bordered', 'striped' => 'striped', 'hover' => 'hover', 'condensed' => 'condensed')", );
578
        $ret .= $this->usercode->getUserModVersion(3, $tableType, 'config', '$c');
579
        $ret .= $this->getSimpleString('++$c;');
580
        $ret .= $this->getCommentLine('Panel by');
581
        $panelType = array('name' => "'panel_type'", 'title' => "'{$language}PANEL_TYPE'", 'description' => "'{$language}PANEL_TYPE_DESC'",
582
                        'formtype' => "'select'", 'valuetype' => "'text'", 'default' => "'default'", 'options' => "array('default' => 'default', 'primary' => 'primary', 'success' => 'success', 'info' => 'info', 'warning' => 'warning', 'danger' => 'danger')", );
583
        $ret .= $this->usercode->getUserModVersion(3, $panelType, 'config', '$c');
584
        $ret .= $this->getSimpleString('++$c;');
585
        $ret .= $this->getCommentLine('Panel by');
586
        $advertise = array('name' => "'advertise'", 'title' => "'{$language}ADVERTISE'", 'description' => "'{$language}ADVERTISE_DESC'",
587
                        'formtype' => "'textarea'", 'valuetype' => "'text'", 'default' => "''", );
588
        $ret .= $this->usercode->getUserModVersion(3, $advertise, 'config', '$c');
589
        $ret .= $this->getSimpleString('++$c;');
590
        $ret .= $this->getCommentLine('Panel by');
591
        $bookmarks = array('name' => "'bookmarks'", 'title' => "'{$language}BOOKMARKS'", 'description' => "'{$language}BOOKMARKS_DESC'",
592
                        'formtype' => "'yesno'", 'valuetype' => "'int'", 'default' => '0', );
593
        $ret .= $this->usercode->getUserModVersion(3, $bookmarks, 'config', '$c');
594
        $ret .= $this->getSimpleString('++$c;');
595
        $ret .= $this->getCommentLine('Facebook Comments');
596
        $facebookComments = array('name' => "'facebook_comments'", 'title' => "'{$language}FACEBOOK_COMMENTS'", 'description' => "'{$language}FACEBOOK_COMMENTS_DESC'",
597
                        'formtype' => "'yesno'", 'valuetype' => "'int'", 'default' => '0', );
598
        $ret .= $this->usercode->getUserModVersion(3, $facebookComments, 'config', '$c');
599
        $ret .= $this->getSimpleString('++$c;');
600
        $ret .= $this->getCommentLine('Disqus Comments');
601
        $disqusComments = array('name' => "'disqus_comments'", 'title' => "'{$language}DISQUS_COMMENTS'", 'description' => "'{$language}DISQUS_COMMENTS_DESC'",
602
                        'formtype' => "'yesno'", 'valuetype' => "'int'", 'default' => '0', );
603
        $ret .= $this->usercode->getUserModVersion(3, $disqusComments, 'config', '$c');
604
        $ret .= $this->getSimpleString('++$c;');
605
        $ret .= $this->getCommentLine('Maintained by');
606
        $maintainedby = array('name' => "'maintainedby'", 'title' => "'{$language}MAINTAINEDBY'", 'description' => "'{$language}MAINTAINEDBY_DESC'",
607
                        'formtype' => "'yesno'", 'valuetype' => "'int'", 'default' => "'{$module->getVar('mod_support_url')}'", );
608
        $ret .= $this->usercode->getUserModVersion(3, $maintainedby, 'config', '$c');
609
        $ret .= $this->getSimpleString('unset($c);');
610
611
        return $ret;
612
    }
613
614
    /*
615
    *  @private function getNotificationsType
616
    *  @param $language
617
    *  @param $type
618
    *  @param $tableName
619
    *  @param $item
620
    *  @param $typeOfNotify
621
    */
622
    /**
623
     * @param $language
624
     * @param $type
625
     * @param $tableName
626
     * @param $notifyFile
627
     * @param $item
628
     * @param $typeOfNotify
629
     *
630
     * @return string
631
     */
632
    private function getNotificationsType($language, $type = 'category', $tableName, $notifyFile, $item, $typeOfNotify)
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
633
    {
634
        $stuTableName = strtoupper($tableName);
635
        $stuTypeOfNotify = strtoupper($typeOfNotify);
636
        $notifyFile = explode(', ', $notifyFile);
637
        $notifyFile = implode(', ', $notifyFile);
638
        $ret = '';
639
        switch ($type) {
640
            case 'category':
641
                $ret .= $this->getCommentLine('Category Notify');
642
                $category = array('name' => "'category'", 'title' => "'{$language}{$stuTableName}_NOTIFY'", 'description' => "'{$language}{$stuTableName}_NOTIFY_DESC'",
643
                                    'subscribe_from' => "array('index.php',{$notifyFile})", 'item_name' => "'{$item}'", "'allow_bookmark'" => '1', );
644
                $ret .= $this->usercode->getUserModVersion(3, $category, 'notification', "'{$type}'");
645
                break;
646
            case 'event':
647
                $ret .= $this->getCommentLine('Event Notify');
648
                $event = array('name' => "'{$typeOfNotify}'", 'category' => "'{$tableName}'", 'admin_only' => '1', "'title'" => "'{$language}{$stuTableName}_{$stuTypeOfNotify}_NOTIFY'",
649
                                'caption' => "'{$language}{$stuTableName}_{$stuTypeOfNotify}_NOTIFY_CAPTION'", 'description' => "'{$language}{$stuTableName}_{$stuTypeOfNotify}_NOTIFY_DESC'",
650
                                'mail_template' => "'{$tableName}_{$typeOfNotify}_notify'", 'mail_subject' => "'{$language}{$stuTableName}_{$stuTypeOfNotify}_NOTIFY_SUBJECT'", );
651
                $ret .= $this->usercode->getUserModVersion(3, $event, 'notification', "'{$type}'");
652
                break;
653
        }
654
655
        return $ret;
656
    }
657
658
    /*
659
    *  @private function getXoopsVersionNotifications
660
    *  @param $moduleDirname
661
    *  @param $language
662
    */
663
    /**
664
     * @param $moduleDirname
665
     * @param $language
666
     *
667
     * @return string
668
     */
669
    private function getXoopsVersionNotifications($module, $language)
670
    {
671
        $moduleDirname = $module->getVar('mod_dirname');
672
        $ret = $this->getHeaderComment('Notifications');
673
        $ret .= $this->usercode->getUserModVersion(1, 1, 'hasNotification');
674
        $notifications = array("'lookup_file'" => "'include/notification.inc.php'", "'lookup_func'" => "'{$moduleDirname}_notify_iteminfo'");
675
        $ret .= $this->usercode->getUserModVersion(2, $notifications, 'notification');
676
677
        $notifyFiles = array();
678
        $single = 'single';
679
        $tables = $this->getTableTables($module->getVar('mod_id'), 'table_order');
680
        $tableCategory = array();
681
        $tableBroken = array();
682
        $tableSubmit = array();
683
		$tableId = null;
684
		$tableMid = null;
685
        foreach (array_keys($tables) as $t) {
686
            $tableId = $tables[$t]->getVar('table_id');
687
            $tableMid = $tables[$t]->getVar('table_mid');
688
            $tableName = $tables[$t]->getVar('table_name');
689
            $tableCategory[] = $tables[$t]->getVar('table_category');
690
            $tableBroken[] = $tables[$t]->getVar('table_broken');
691
            $tableSubmit[] = $tables[$t]->getVar('table_submit');
692
            if (1 == $tables[$t]->getVar('table_notifications')) {
693
                if ($t <= count($tableName)) {
694
                    $notifyFiles[] = $tables[$t]->getVar('table_name');
695
                }
696
            }
697
            if (1 == $tables[$t]->getVar('table_single')) {
698
                $single = $tableName;
699
            }
700
        }
701
        $fields = $this->getTableFields($tableMid, $tableId);
702
        $fieldId = null;
703
		$fieldParent = null;
704 View Code Duplication
        foreach (array_keys($fields) as $f) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
705
            $fieldName = $fields[$f]->getVar('field_name');
706
            $fieldElement = $fields[$f]->getVar('field_element');
707
            if (0 == $f) {
708
                $fieldId = $fieldName;
709
            }
710
            if ($fieldElement > 15) {
711
                $fieldParent = $fieldName;
712
            }
713
        }
714
715
        $num = 1;
716
        $ret .= $this->getXoopsVersionNotificationGlobal($language, 'category', 'global', 'global', $notifyFiles, $num);
717
        ++$num;
718
        $ret .= $this->getXoopsVersionNotificationCategory($language, 'category', 'category', 'category', $notifyFiles, $fieldParent, '1', $num);
719
        ++$num;
720
        $ret .= $this->getXoopsVersionNotificationTableName($language, 'category', 'file', 'file', $single, $fieldId, 1, $num);
721
        unset($num);
722
        $num = 1;
723
        if (in_array(1, $tableCategory)) {
724
            ++$num;
725
            $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'new_category', 'global', 0, 'global', 'newcategory', 'global_newcategory_notify', $num);
726
        }
727
        $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'file_modify', 'global', 1, 'global', 'filemodify', 'global_filemodify_notify', $num);
728
        if (in_array(1, $tableBroken)) {
729
            ++$num;
730
            $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'file_broken', 'global', 1, 'global', 'filebroken', 'global_filebroken_notify', $num);
731
        }
732
        if (in_array(1, $tableSubmit)) {
733
            ++$num;
734
            $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'file_submit', 'global', 1, 'global', 'filesubmit', 'global_filesubmit_notify', $num);
735
        }
736
        ++$num;
737
        $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'new_file', 'global', 0, 'global', 'newfile', 'global_newfile_notify', $num);
738
        if (in_array(1, $tableCategory)) {
739
            ++$num;
740
            $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'file_submit', 'category', 1, 'category', 'filesubmit', 'category_filesubmit_notify', $num);
741
            ++$num;
742
            $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'new_file', 'category', 0, 'category', 'newfile', 'category_newfile_notify', $num);
743
        }
744
        ++$num;
745
        $ret .= $this->getXoopsVersionNotificationCodeComplete($language, 'event', 'approve', 'file', 1, 'file', 'approve', 'file_approve_notify', $num);
746
        unset($num);
747
748
        return $ret;
749
    }
750
751
    /*
752
    *  @private function getXoopsVersionNotificationGlobal
753
    */
754
    /**
755
     * @param $language
756
     * @param $type
757
     * @param $name
758
     * @param $title
759
     * @param $from
760
     *
761
     * @return string
762
     */
763
    private function getXoopsVersionNotificationGlobal($language, $type, $name, $title, $from, $num)
764
    {
765
        $title = strtoupper($title);
766
        $implodeFrom = implode(".php', '", $from);
767
        $ret = $this->getCommentLine('Global Notify');
768
        $global = array('name' => "'{$name}'", 'title' => "{$language}{$title}_NOTIFY", 'description' => "{$language}{$title}_NOTIFY_DESC",
769
                        'subscribe_from' => "array('index.php', '{$implodeFrom}.php')", );
770
        $ret .= $this->usercode->getUserModVersion(4, $global, 'notification', "'{$type}'", $num);
771
772
        return $ret;
773
    }
774
775
    /*
776
    *  @private function getXoopsVersionNotificationCategory
777
    */
778
    /**
779
     * @param $language
780
     * @param $type
781
     * @param $name
782
     * @param $title
783
     * @param $from
784
     *
785
     * @return string
786
     */
787 View Code Duplication
    private function getXoopsVersionNotificationCategory($language, $type, $name, $title, $file, $item, $allow, $num)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
788
    {
789
        $title = strtoupper($title);
790
        $impFile = implode(".php', '", $file);
791
        $ret = $this->getCommentLine('Category Notify');
792
        $global = array('name' => "'{$name}'", 'title' => "{$language}{$title}_NOTIFY", 'description' => "{$language}{$title}_NOTIFY_DESC",
793
                        'subscribe_from' => "array('{$impFile}.php')", 'item_name' => "'{$item}'", 'allow_bookmark' => "{$allow}", );
794
        $ret .= $this->usercode->getUserModVersion(4, $global, 'notification', "'{$type}'", $num);
795
796
        return $ret;
797
    }
798
799
    /*
800
    *  @private function getXoopsVersionNotificationTableName
801
    */
802
    /**
803
     * @param $language
804
     * @param $type
805
     * @param $name
806
     * @param $title
807
     * @param $from
808
     * @param $item
809
     * @param $allow
810
     *
811
     * @return string
812
     */
813 View Code Duplication
    private function getXoopsVersionNotificationTableName($language, $type, $name, $title, $from, $item = 'cid', $allow = 1, $num)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
814
    {
815
        $stuTitle = strtoupper($title);
816
        $ucfTitle = ucfirst($title);
817
        $ret = $this->getCommentLine($ucfTitle.' Notify');
818
        $global = array('name' => "'{$name}'", 'title' => "{$language}{$stuTitle}_NOTIFY", 'description' => "{$language}{$stuTitle}_NOTIFY_DESC",
819
                        'subscribe_from' => "'{$from}.php'", 'item_name' => "'{$item}'", 'allow_bookmark' => "{$allow}", );
820
        $ret .= $this->usercode->getUserModVersion(4, $global, 'notification', "'{$type}'", $num);
821
822
        return $ret;
823
    }
824
825
    /*
826
    *  @private function getXoopsVersionNotifications
827
    */
828
    /**
829
     * @param $language
830
     * @param $type
831
     * @param $name
832
     * @param $title
833
     * @param $from
834
     * @param $item
835
     * @param $mail
836
     *
837
     * @return string
838
     */
839
    private function getXoopsVersionNotificationCodeComplete($language, $type, $name, $category, $admin = 1, $title, $table, $mail, $num)
840
    {
841
        $title = strtoupper($title);
842
        $table = strtoupper($table);
843
        $ucfTitle = ucfirst($title);
844
        $ret = $this->getCommentLine($ucfTitle.' Notify');
845
        $event = array('name' => "'{$name}'", 'category' => "'{$category}'", 'admin_only' => "{$admin}", 'title' => "{$language}{$title}_{$table}_NOTIFY",
846
                        'caption' => "{$language}{$title}_{$table}_NOTIFY_CAPTION", 'description' => "{$language}{$title}_{$table}_NOTIFY_DESC",
847
                        'mail_template' => "'{$mail}'", 'mail_subject' => "{$language}{$title}_{$table}_NOTIFY_SUBJECT", );
848
        $ret .= $this->usercode->getUserModVersion(4, $event, 'notification', "'{$type}'", $num);
849
850
        return $ret;
851
    }
852
853
    /*
854
    *  @public function render
855
    *  @param null
856
    */
857
    /**
858
     * @return bool|string
859
     */
860
    public function render()
861
    {
862
        $module = $this->getModule();
863
        $table = $this->getTable();
864
        $tables = $this->getTables();
865
        $filename = $this->getFileName();
866
        $moduleDirname = $module->getVar('mod_dirname');
867
        $language = $this->getLanguage($moduleDirname, 'MI');
868
        $content = $this->getHeaderFilesComments($module, $filename);
869
        $content .= $this->getXoopsVersionHeader($module, $language);
870
        if (1 == $module->getVar('mod_admin')) {
871
            $content .= $this->getXoopsVersionTemplatesAdmin($moduleDirname, $tables);
872
        }
873
        if (1 == $module->getVar('mod_user')) {
874
            $content .= $this->getXoopsVersionTemplatesUser($moduleDirname, $tables);
875
        }
876
        $content .= $this->getXoopsVersionMySQL($moduleDirname, $table, $tables);
877
        $tableSearch = array();
878
        $tableComments = array();
879
        $tableSubmenu = array();
880
        $tableBlocks = array();
881
        $tableNotifications = array();
882
        foreach (array_keys($tables) as $t) {
883
            $tableSearch[] = $tables[$t]->getVar('table_search');
884
            $tableComments[] = $tables[$t]->getVar('table_comments');
885
            $tableSubmenu[] = $tables[$t]->getVar('table_submenu');
886
            $tableBlocks[] = $tables[$t]->getVar('table_blocks');
887
            $tableNotifications[] = $tables[$t]->getVar('table_notifications');
888
        }
889
        if (in_array(1, $tableSearch)) {
890
            $content .= $this->getXoopsVersionSearch($moduleDirname);
891
        }
892
        if (in_array(1, $tableComments)) {
893
            $content .= $this->getXoopsVersionComments($moduleDirname);
894
        }
895
        if (in_array(1, $tableSubmenu)) {
896
            $content .= $this->getXoopsVersionSubmenu($language, $tables);
897
        }
898
        if (in_array(1, $tableBlocks)) {
899
            $content .= $this->getXoopsVersionBlocks($moduleDirname, $table, $tables, $language);
900
        }
901
        $content .= $this->getXoopsVersionConfig($module, $table, $language);
902
        if (in_array(1, $tableNotifications)) {
903
            $content .= $this->getXoopsVersionNotifications($module, $language);
904
        }
905
        $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
906
907
        return $this->renderFile();
908
    }
909
}
910