Issues (519)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  Header Injection
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

class/Files/CreateHtmlSmartyCodes.php (13 issues)

1
<?php namespace XoopsModules\Tdmcreate\Files;
2
3
use XoopsModules\Tdmcreate;
4
5
/*
6
 You may not change or alter any portion of this comment or credits
7
 of supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit authors.
9
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 */
14
/**
15
 * tdmcreate module.
16
 *
17
 * @copyright       XOOPS Project (https://xoops.org)
18
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
19
 *
20
 * @since           2.5.0
21
 *
22
 * @author          Txmod Xoops http://www.txmodxoops.org
23
 *
24
 * @version         $Id: CreateHtmlSmartyCodes.php 12258 2014-01-02 09:33:29Z timgno $
25
 */
26
27
/**
28
 * Class CreateHtmlSmartyCodes.
29
 */
30
class CreateHtmlSmartyCodes
31
{
32
    /**
33
    *  @public function constructor
34
    *  @param null
35
    */
36
37
    public function __construct()
38
    {
39
    }
40
41
    /**
42
    *  @static function getInstance
43
    *  @param null
44
     * @return Tdmcreate\Files\CreateHtmlSmartyCodes
45
     */
46
    public static function getInstance()
47
    {
48
        static $instance = false;
49
        if (!$instance) {
50
            $instance = new self();
51
        }
52
53
        return $instance;
54
    }
55
56
    /**
57
     * @public function getHtmlTag
58
     * @param string $tag
59
     * @param array  $attributes
60
     * @param string $content
61
     * @param bool   $noClosed
62
     *
63
     * @param string $t
64
     * @return string
65
     */
66
    public function getHtmlTag($tag = '', $attributes = [], $content = '', $noClosed = false, $t = '')
67
    {
68
        if (empty($attributes)) {
69
            $attributes = [];
70
        }
71
        $attr = $this->getAttributes($attributes);
72
        if ('br' === $tag) {
73
            $ret = "{$t}<{$tag}{$attr}>\n";
74
        } elseif ($noClosed) {
75
            $ret = "{$t}<{$tag}{$attr} />\n";
76
        } else {
77
            $ret = "{$t}<{$tag}{$attr}>{$content}</{$tag}>\n";
78
        }
79
80
        return $ret;
81
    }
82
83
    /**
84
    *  @private function setAttributes
85
    *  @param array $attributes
86
    *
87
    * @return string
88
    */
89
    private function getAttributes($attributes)
90
    {
91
        $str = '';
92
        foreach ($attributes as $name => $value) {
93
            if ('_' !== $name) {
94
                $str .= ' '.$name.'="'.$value.'"';
95
            }
96
        }
97
98
        return $str;
99
    }
100
101
    /**
102
    *  @public function getHtmlEmpty
103
    *  @param string $empty
104
     *
105
     * @return string
106
     */
107
    public function getHtmlEmpty($empty = '')
108
    {
109
        return (string)$empty;
110
    }
111
112
    /**
113
    *  @public function getHtmlComment
114
    *  @param string $htmlComment
115
     *
116
     * @return string
117
     */
118
    public function getHtmlComment($htmlComment = '')
119
    {
120
        return "<!-- {$htmlComment} -->";
121
    }
122
123
    /**
124
     * @public function getHtmlBr
125
     * @param int    $brNumb
126
     * @param string $htmlClass
127
     *
128
     * @param string $t
129
     * @return string
130
     */
131
    public function getHtmlBr($brNumb = 1, $htmlClass = '', $t = '')
132
    {
133
        $brClass = ('' != $htmlClass) ? " class='{$htmlClass}'" : '';
134
        $ret = '';
135
        for ($i = 0; $i < $brNumb; ++$i) {
136
            $ret .= "{$t}<br{$brClass} />\n";
137
        }
138
139
        return $ret;
140
    }
141
142
    /**
143
     * @public function getHtmlHNumb
144
     * @param string $content
145
     *
146
     * @param string $n
147
     * @param string $htmlHClass
148
     * @param string $t
149
     * @return string
150
     */
151
    public function getHtmlHNumb($content = '', $n = '1', $htmlHClass = '', $t = '')
152
    {
153
        $hClass = ('' != $htmlHClass) ? " class='{$htmlHClass}'" : '';
154
        $ret = "{$t}<h{$n}{$hClass}>{$content}</h{$n}>\n";
155
156
        return $ret;
157
    }
158
159
    /**
160
     * @public function getHtmlDiv
161
     * @param string $content
162
     *
163
     * @param string $divClass
164
     * @param string $t
165
     * @return string
166
     */
167
    public function getHtmlDiv($content = '', $divClass = '', $t = '')
168
    {
169
        $rDivClass = ('' != $divClass) ? " class='{$divClass}'" : '';
170
        $ret = "{$t}<div{$rDivClass}>\n";
171
        $ret .= "{$t}{$content}";
172
        $ret .= "{$t}</div>\n";
173
174
        return $ret;
175
    }
176
177
    /**
178
     * @public function getHtmlPre
179
     * @param string $content
180
     *
181
     * @param string $preClass
182
     * @param string $t
183
     * @return string
184
     */
185
    public function getHtmlPre($content = '', $preClass = '', $t = '')
186
    {
187
        $rPreClass = ('' != $preClass) ? " class='{$preClass}'" : '';
188
        $ret = "{$t}<pre{$rPreClass}>\n";
189
        $ret .= "{$t}{$content}";
190
        $ret .= "{$t}</pre>\n";
191
192
        return $ret;
193
    }
194
195
    /**
196
     * @public function getHtmlSpan
197
     * @param string $content
198
     *
199
     * @param string $spanClass
200
     * @param string $t
201
     * @return string
202
     */
203
    public function getHtmlSpan($content = '', $spanClass = '', $t = '')
204
    {
205
        $rSpanClass = ('' != $spanClass) ? " class='{$spanClass}'" : '';
206
        $ret = "{$t}<span{$rSpanClass}>{$content}</span>\n";
207
208
        return $ret;
209
    }
210
211
    /**
212
     * @public function getHtmlParagraph
213
     * @param string $content
214
     *
215
     * @param string $pClass
216
     * @param string $t
217
     * @return string
218
     */
219
    public function getHtmlParagraph($content = '', $pClass = '', $t = '')
220
    {
221
        $rPClass = ('' != $pClass) ? " class='{$pClass}'" : '';
222
        $ret = "{$t}<p{$rPClass}>\n";
223
        $ret .= "{$t}{$content}";
224
        $ret .= "{$t}</p>\n";
225
226
        return $ret;
227
    }
228
229
    /**
230
     * @public function getHtmlI
231
     * @param string $content
232
     *
233
     * @param string $iClass
234
     * @param string $t
235
     * @return string
236
     */
237
    public function getHtmlI($content = '', $iClass = '', $t = '')
238
    {
239
        $rIClass = ('' != $iClass) ? " class='{$iClass}'" : '';
240
        $ret = "{$t}<i{$rIClass}>{$content}</i>\n";
241
242
        return $ret;
243
    }
244
245
    /**
246
     * @public function getHtmlUl
247
     * @param string $content
248
     *
249
     * @param string $ulClass
250
     * @param string $t
251
     * @return string
252
     */
253
    public function getHtmlUl($content = '', $ulClass = '', $t = '')
0 ignored issues
show
The parameter $t is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

253
    public function getHtmlUl($content = '', $ulClass = '', /** @scrutinizer ignore-unused */ $t = '')

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

Loading history...
254
    {
255
        $rUlClass = ('' != $ulClass) ? " class='{$ulClass}'" : '';
256
        $ret = "<ul{$rUlClass}>\n";
257
        $ret .= "\t{$content}\n";
258
        $ret .= "</ul>\n";
259
260
        return $ret;
261
    }
262
263
    /**
264
     * @public function getHtmlOl
265
     * @param string $content
266
     *
267
     * @param string $olClass
268
     * @param string $t
269
     * @return string
270
     */
271
    public function getHtmlOl($content = '', $olClass = '', $t = '')
0 ignored issues
show
The parameter $t is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

271
    public function getHtmlOl($content = '', $olClass = '', /** @scrutinizer ignore-unused */ $t = '')

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

Loading history...
272
    {
273
        $rOlClass = ('' != $olClass) ? " class='{$olClass}'" : '';
274
        $ret = "<ol{$rOlClass}>\n";
275
        $ret .= "\t{$content}\n";
276
        $ret .= "</ol>\n";
277
278
        return $ret;
279
    }
280
281
    /**
282
     * @public function getHtmlLi
283
     * @param string $content
284
     * @param string $liClass
285
     *
286
     * @param string $t
287
     * @return string
288
     */
289
    public function getHtmlLi($content = '', $liClass = '', $t = '')
0 ignored issues
show
The parameter $t is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

289
    public function getHtmlLi($content = '', $liClass = '', /** @scrutinizer ignore-unused */ $t = '')

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

Loading history...
290
    {
291
        $rLiClass = ('' != $liClass) ? " class='{$liClass}'" : '';
292
293
        return "<li{$rLiClass}>{$content}</li>";
294
    }
295
296
    /**
297
     * @public function getHtmlStrong
298
     * @param string $content
299
     * @param string $strongClass
300
     *
301
     * @param string $t
302
     * @return string
303
     */
304
    public function getHtmlStrong($content = '', $strongClass = '', $t = '')
0 ignored issues
show
The parameter $t is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

304
    public function getHtmlStrong($content = '', $strongClass = '', /** @scrutinizer ignore-unused */ $t = '')

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

Loading history...
305
    {
306
        $rStrongClass = ('' != $strongClass) ? " class='{$strongClass}'" : '';
307
308
        return "<strong{$rStrongClass}>{$content}</strong>";
309
    }
310
311
    /**
312
     * @public function getHtmlAnchor
313
     * @param string $url
314
     * @param string $content
315
     * @param string $title
316
     * @param string $target
317
     * @param string $aClass
318
     *
319
     * @param string $rel
320
     * @param string $t
321
     * @return string
322
     */
323
    public function getHtmlAnchor($url = '#', $content = '&nbsp;', $title = '', $target = '', $aClass = '', $rel = '', $t = '')
0 ignored issues
show
The parameter $t is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

323
    public function getHtmlAnchor($url = '#', $content = '&nbsp;', $title = '', $target = '', $aClass = '', $rel = '', /** @scrutinizer ignore-unused */ $t = '')

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

Loading history...
324
    {
325
        $target = ('' != $target) ? " target='{$target}'" : '';
326
        $rAClass = ('' != $aClass) ? " class='{$aClass}'" : '';
327
        $rel = ('' != $rel) ? " rel='{$rel}'" : '';
328
329
        return "<a{$rAClass} href='{$url}' title='{$title}'{$target}{$rel}>{$content}</a>";
330
    }
331
332
    /**
333
     * @public function getHtmlImage
334
     * @param string $src
335
     * @param string $alt
336
     * @param string $imgClass
337
     *
338
     * @param string $t
339
     * @return string
340
     */
341
    public function getHtmlImage($src = 'blank.gif', $alt = 'blank.gif', $imgClass = '', $t = '')
0 ignored issues
show
The parameter $t is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

341
    public function getHtmlImage($src = 'blank.gif', $alt = 'blank.gif', $imgClass = '', /** @scrutinizer ignore-unused */ $t = '')

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

Loading history...
342
    {
343
        $rImgClass = ('' != $imgClass) ? " class='{$imgClass}'" : '';
344
        $ret = "<img{$rImgClass} src='{$src}' alt='{$alt}' />";
345
346
        return $ret;
347
    }
348
349
    /**
350
     * @public function getHtmlTable
351
     * @param string $content
352
     * @param string $tableClass
353
     *
354
     * @param string $t
355
     * @return string
356
     */
357
    public function getHtmlTable($content = '', $tableClass = '', $t = '')
0 ignored issues
show
The parameter $t is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

357
    public function getHtmlTable($content = '', $tableClass = '', /** @scrutinizer ignore-unused */ $t = '')

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

Loading history...
358
    {
359
        $rTableClass = ('' != $tableClass) ? " class='{$tableClass}'" : '';
360
        $ret = "<table{$rTableClass}>\n";
361
        $ret .= "\t{$content}\n";
362
        $ret .= "</table>\n";
363
364
        return $ret;
365
    }
366
367
    /**
368
     * @public function getHtmlTableThead
369
     * @param string $content
370
     * @param string $theadClass
371
     *
372
     * @param string $t
373
     * @return string
374
     */
375
    public function getHtmlTableThead($content = '', $theadClass = '', $t = '')
0 ignored issues
show
The parameter $t is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

375
    public function getHtmlTableThead($content = '', $theadClass = '', /** @scrutinizer ignore-unused */ $t = '')

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

Loading history...
376
    {
377
        $rTheadClass = ('' != $theadClass) ? " class='{$theadClass}'" : '';
378
        $ret = "\t<thead{$rTheadClass}>\n";
379
        $ret .= "\t\t{$content}\n";
380
        $ret .= "\t</thead>\n";
381
382
        return $ret;
383
    }
384
385
    /**
386
     * @public function getHtmlTableTbody
387
     * @param string $content
388
     * @param string $tbodyClass
389
     *
390
     * @param string $t
391
     * @return string
392
     */
393
    public function getHtmlTableTbody($content = '', $tbodyClass = '', $t = '')
0 ignored issues
show
The parameter $t is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

393
    public function getHtmlTableTbody($content = '', $tbodyClass = '', /** @scrutinizer ignore-unused */ $t = '')

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

Loading history...
394
    {
395
        $rTbodyClass = ('' != $tbodyClass) ? " class='{$tbodyClass}'" : '';
396
        $ret = "\t<tbody{$rTbodyClass}>\n";
397
        $ret .= "\t\t{$content}\n";
398
        $ret .= "\t</tbody>\n";
399
400
        return $ret;
401
    }
402
403
    /**
404
     * @public function getHtmlTableTfoot
405
     * @param string $content
406
     * @param string $tfootClass
407
     *
408
     * @param string $t
409
     * @return string
410
     */
411
    public function getHtmlTableTfoot($content = '', $tfootClass = '', $t = '')
0 ignored issues
show
The parameter $t is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

411
    public function getHtmlTableTfoot($content = '', $tfootClass = '', /** @scrutinizer ignore-unused */ $t = '')

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

Loading history...
412
    {
413
        $rTfootClass = ('' != $tfootClass) ? " class='{$tfootClass}'" : '';
414
        $ret = "\t<tfoot{$rTfootClass}>\n";
415
        $ret .= "\t\t{$content}\n";
416
        $ret .= "\t</tfoot>\n";
417
418
        return $ret;
419
    }
420
421
    /**
422
     * @public function getHtmlTableRow
423
     * @param string $content
424
     * @param string $trClass
425
     *
426
     * @param string $t
427
     * @return string
428
     */
429
    public function getHtmlTableRow($content = '', $trClass = '', $t = '')
0 ignored issues
show
The parameter $t is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

429
    public function getHtmlTableRow($content = '', $trClass = '', /** @scrutinizer ignore-unused */ $t = '')

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

Loading history...
430
    {
431
        $rTrClass = ('' != $trClass) ? " class='{$trClass}'" : '';
432
        $ret = "\t<tr{$rTrClass}>\n";
433
        $ret .= "\t\t{$content}\n";
434
        $ret .= "\t</tr>\n";
435
436
        return $ret;
437
    }
438
439
    /**
440
     * @public function getHtmlTableHead
441
     * @param string $content
442
     * @param string $thClass
443
     * @param string $colspan
444
     *
445
     * @param string $t
446
     * @return string
447
     */
448
    public function getHtmlTableHead($content = '', $thClass = '', $colspan = '', $t = '')
0 ignored issues
show
The parameter $t is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

448
    public function getHtmlTableHead($content = '', $thClass = '', $colspan = '', /** @scrutinizer ignore-unused */ $t = '')

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

Loading history...
449
    {
450
        $rThClass = ('' != $thClass) ? " class='{$thClass}'" : '';
451
        $colspan = ('' != $colspan) ? " colspan='{$colspan}'" : '';
452
453
        return "<th{$colspan}{$rThClass}>{$content}</th>";
454
    }
455
456
    /**
457
    *  @public function getHtmlTableData
458
     * @param $content
459
     * @param $tdClass
460
     * @param $colspan
461
     *
462
     * @return string
463
     */
464
    public function getHtmlTableData($content = '', $tdClass = '', $colspan = '')
465
    {
466
        $rTdClass = ('' != $tdClass) ? " class='{$tdClass}'" : '';
467
        $colspan = ('' != $colspan) ? " colspan='{$colspan}'" : '';
468
469
        return "<td{$colspan}{$rTdClass}>{$content}</td>";
470
    }
471
472
    /**
473
    *  @public function getSmartyComment
474
    *  @param string $comment
475
     *
476
     * @return string
477
     */
478
    public function getSmartyComment($comment = '')
479
    {
480
        return "<{* {$comment} *}>";
481
    }
482
483
    /**
484
    *  @public function getSmartyNoSimbol
485
    *  @param string $noSimbol
486
     *
487
     * @return string
488
     */
489
    public function getSmartyNoSimbol($noSimbol = '')
490
    {
491
        return "<{{$noSimbol}}>";
492
    }
493
494
    /**
495
    *  @public function getSmartyConst
496
    *  @param string $language
497
    *  @param mixed $const
498
     *
499
     * @return string
500
     */
501
    public function getSmartyConst($language, $const)
502
    {
503
        return "<{\$smarty.const.{$language}{$const}}>";
504
    }
505
506
    /**
507
    *  @public function getSmartySingleVar
508
    *  @param string $var
509
     *
510
     * @return string
511
     */
512
    public function getSmartySingleVar($var)
513
    {
514
        return "<{\${$var}}>";
515
    }
516
517
    /**
518
    *  @public function getSmartyDoubleVar
519
    *  @param string $leftVar
520
    *  @param string $rightVar
521
     *
522
     * @return string
523
     */
524
    public function getSmartyDoubleVar($leftVar, $rightVar)
525
    {
526
        return "<{\${$leftVar}.{$rightVar}}>";
527
    }
528
529
    /**
530
     * @public function getSmartyIncludeFile
531
     * @param        $moduleDirname
532
     * @param string $fileName
533
     * @param bool   $admin
534
     *
535
     * @param bool   $q
536
     * @return string
537
     */
538
    public function getSmartyIncludeFile($moduleDirname, $fileName = 'header', $admin = false, $q = false)
539
    {
540
        if (!$admin && !$q) {
541
            $ret = "<{include file='db:{$moduleDirname}_{$fileName}.tpl'}>\n";
542
        } elseif ($admin && !$q) {
543
            $ret = "<{include file='db:{$moduleDirname}_admin_{$fileName}.tpl'}>\n";
544
        } elseif (!$admin && $q) {
545
            $ret = "<{includeq file='db:{$moduleDirname}_{$fileName}.tpl'}>\n";
546
        } elseif ($admin && $q) {
547
            $ret = "<{includeq file='db:{$moduleDirname}_admin_{$fileName}.tpl'}>\n";
548
        }
549
550
        return $ret;
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $ret does not seem to be defined for all execution paths leading up to this point.
Loading history...
551
    }
552
553
    /**
554
    *  @public function getSmartyIncludeFileListSection
555
     * @param $moduleDirname
556
     * @param $fileName
557
     * @param $tableFieldName
558
     *
559
     * @return string
560
     */
561
    public function getSmartyIncludeFileListSection($moduleDirname, $fileName, $tableFieldName)
562
    {
563
        return "<{include file='db:{$moduleDirname}_{$fileName}_list.tpl' {$tableFieldName}=\${$tableFieldName}[i]}>";
564
    }
565
566
    /**
567
    *  @public function getSmartyIncludeFileListForeach
568
     * @param $moduleDirname
569
     * @param $fileName
570
     * @param $tableFieldName
571
     *
572
     * @return string
573
     */
574
    public function getSmartyIncludeFileListForeach($moduleDirname, $fileName, $tableFieldName)
575
    {
576
        return "<{include file='db:{$moduleDirname}_{$fileName}_list.tpl' {$tableFieldName}=\${$tableFieldName}}>";
577
    }
578
579
    /**
580
     * @public function getSmartyConditions
581
     * @param string $condition
582
     * @param string $operator
583
     * @param string $type
584
     * @param string $contentIf
585
     * @param mixed  $contentElse
586
     * @param bool   $count
587
     *
588
     * @param bool   $noSimbol
589
     * @return string
590
     */
591
    public function getSmartyConditions($condition = '', $operator = '', $type = '', $contentIf = '', $contentElse = false, $count = false, $noSimbol = false)
592
    {
593
        if (!$contentElse) {
594
            if (!$count) {
595
                $ret = "<{if \${$condition}{$operator}{$type}}>\n";
596
            } elseif (!$noSimbol) {
597
                $ret = "<{if {$condition}{$operator}{$type}}>\n";
598
            } else {
599
                $ret = "<{if count(\${$condition}){$operator}{$type}}>\n";
600
            }
601
            $ret .= "\t{$contentIf}\n";
602
            $ret .= "<{/if}>\n";
603
        } else {
604
            if (!$count) {
605
                $ret = "<{if \${$condition}{$operator}{$type}}>\n";
606
            } elseif (!$noSimbol) {
607
                $ret = "<{if {$condition}{$operator}{$type}}>\n";
608
            } else {
609
                $ret = "<{if count(\${$condition}){$operator}{$type}}>\n";
610
            }
611
            $ret .= "\t{$contentIf}\n";
612
            $ret .= "<{else}>\n";
613
            $ret .= "\t{$contentElse}\n";
614
            $ret .= "<{/if}>\n";
615
        }
616
617
        return $ret;
618
    }
619
620
    /**
621
     * @public function getSmartyForeach
622
     * @param string $item
623
     * @param string $from
624
     * @param string $content
625
     *
626
     * @param string $name
627
     * @param string $key
628
     * @return string
629
     */
630
    public function getSmartyForeach($item = 'item', $from = 'from', $content = 'content', $name = '', $key = '')
631
    {
632
        $name = '' != $name ? " name={$name}" : '';
633
        $key = '' != $key ? " key={$key}" : '';
634
        $ret = "<{foreach item={$item} from=\${$from}{$key}{$name}}>\n";
635
        $ret .= "\t{$content}\n";
636
        $ret .= "<{/foreach}>\n";
637
638
        return $ret;
639
    }
640
641
    /**
642
     * @public function getSmartyForeachQuery
643
     * @param string $item
644
     * @param string $from
645
     * @param string $content
646
     *
647
     * @param string $loop
648
     * @param string $key
649
     * @return string
650
     */
651
    public function getSmartyForeachQuery($item = 'item', $from = 'from', $content = 'content', $loop = 'loop', $key = '')
652
    {
653
        $loop = '' != $loop ? " loop={$loop}" : '';
654
        $key = '' != $key ? " key={$key}" : '';
655
        $ret = "<{foreachq item={$item} from=\${$from}{$key}{$loop}}>\n";
656
        $ret .= "\t{$content}\n";
657
        $ret .= "<{/foreachq}>\n";
658
659
        return $ret;
660
    }
661
662
    /**
663
     * @public function getSmartySection
664
     * @param string $name
665
     * @param string $loop
666
     * @param string $content
667
     *
668
     * @param int    $start
669
     * @param int    $step
670
     * @return string
671
     */
672
    public function getSmartySection($name = 'name', $loop = 'loop', $content = 'content', $start = 0, $step = 0)
673
    {
674
        $start = 0 != $start ? " start={$start}" : '';
675
        $step = 0 != $step ? " step={$step}" : '';
676
        $ret = "<{section name={$name} loop=\${$loop}{$start}{$step}}>\n";
677
        $ret .= "\t{$content}\n";
678
        $ret .= "<{/section}>\n";
679
680
        return $ret;
681
    }
682
}
683