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/CreateSmartyCode.php (1 issue)

1
<?php namespace XoopsModules\Tdmcreate\Files;
2
3
use  XoopsModules\Tdmcreate;
4
use  XoopsModules\Tdmcreate\Files;
5
6
/*
7
 You may not change or alter any portion of this comment or credits
8
 of supporting developers from this source code or any supporting source code
9
 which is considered copyrighted (c) material of the original comment or credit authors.
10
11
 This program is distributed in the hope that it will be useful,
12
 but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 */
15
/**
16
 * tdmcreate module.
17
 *
18
 * @copyright       XOOPS Project (https://xoops.org)
19
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
20
 *
21
 * @since           2.5.0
22
 *
23
 * @author          Txmod Xoops http://www.txmodxoops.org
24
 *
25
 * @version         $Id: CreateSmartyCode.php 12258 2014-01-02 09:33:29Z timgno $
26
 */
27
28
/**
29
 * Class CreateSmartyCode.
30
 */
31
class CreateSmartyCode
32
{
33
    /**
34
    *  @public function constructor
35
    *  @param null
36
    */
37
38
    public function __construct()
39
    {
40
    }
41
42
    /**
43
    *  @static function getInstance
44
    *  @param null
45
     * @return Files\CreateSmartyCode
46
     */
47
    public static function getInstance()
48
    {
49
        static $instance = false;
50
        if (!$instance) {
51
            $instance = new self();
52
        }
53
54
        return $instance;
55
    }
56
57
    /**
58
     * @public function getSmartyTag
59
     *
60
     * @param string $tag
61
     * @param array  $attributes
62
     * @param string $content
63
     *
64
     * @param string $t
65
     * @return string
66
     */
67
    public function getSmartyTag($tag = '', $attributes = [], $content = '', $t = '')
68
    {
69
        if (empty($attributes)) {
70
            $attributes = [];
71
        }
72
        $attr = $this->getAttributes($attributes);
73
        $ret = "{$t}<{{$tag}{$attr}}>{$content}<{/{$tag}}>";
74
75
        return $ret;
76
    }
77
78
    /**
79
    *  @private function setAttributes
80
    *  @param array $attributes
81
    *
82
    * @return string
83
    */
84
    private function getAttributes($attributes)
85
    {
86
        $str = '';
87
        foreach ($attributes as $name => $value) {
88
            if ('_' !== $name) {
89
                $str .= ' '.$name.'="'.$value.'"';
90
            }
91
        }
92
93
        return $str;
94
    }
95
96
    /**
97
    *  @public function getSmartyEmpty
98
    *  @param string $empty
99
     *
100
     * @return string
101
     */
102
    public function getSmartyEmpty($empty = '')
103
    {
104
        return (string)$empty;
105
    }
106
107
    /**
108
     * @public   function getSmartyComment
109
     * @param string $smartyComment
110
     * @param string $t
111
     * @return string
112
     */
113
    public function getSmartyComment($smartyComment = '', $t = '')
114
    {
115
        return "{$t}<{* {$smartyComment} *}>";
116
    }
117
118
    /**
119
     * @public function getSmartyNoSimbol
120
     * @param string $noSimbol
121
     *
122
     * @param string $t
123
     * @return string
124
     */
125
    public function getSmartyNoSimbol($noSimbol = '', $t = '')
126
    {
127
        return "{$t}<{{$noSimbol}}>";
128
    }
129
130
    /**
131
     * @public function getSmartyConst
132
     * @param string $language
133
     * @param mixed  $const
134
     *
135
     * @param string $t
136
     * @return string
137
     */
138
    public function getSmartyConst($language, $const, $t = '')
139
    {
140
        return "{$t}<{\$smarty.const.{$language}{$const}}>";
141
    }
142
143
    /**
144
     * @public function getSmartySingleVar
145
     * @param string $var
146
     *
147
     * @param string $t
148
     * @return string
149
     */
150
    public function getSmartySingleVar($var, $t = '')
151
    {
152
        return "{$t}<{\${$var}}>";
153
    }
154
155
    /**
156
     * @public function getSmartyDoubleVar
157
     * @param string $leftVar
158
     * @param string $rightVar
159
     *
160
     * @param string $t
161
     * @return string
162
     */
163
    public function getSmartyDoubleVar($leftVar, $rightVar, $t = '')
164
    {
165
        return "{$t}<{\${$leftVar}.{$rightVar}}>";
166
    }
167
168
    /**
169
     * @public function getSmartyIncludeFile
170
     * @param        $moduleDirname
171
     * @param string $fileName
172
     * @param bool   $admin
173
     *
174
     * @param bool   $q
175
     * @param string $t
176
     * @return string
177
     */
178
    public function getSmartyIncludeFile($moduleDirname, $fileName = 'header', $admin = false, $q = false, $t = '')
179
    {
180
        if (!$admin && !$q) {
181
            $ret = "{$t}<{include file='db:{$moduleDirname}_{$fileName}.tpl'}>\n";
182
        } elseif ($admin && !$q) {
183
            $ret = "{$t}<{include file='db:{$moduleDirname}_admin_{$fileName}.tpl'}>\n";
184
        } elseif (!$admin && $q) {
185
            $ret = "{$t}<{includeq file='db:{$moduleDirname}_{$fileName}.tpl'}>\n";
186
        } elseif ($admin && $q) {
187
            $ret = "{$t}<{includeq file='db:{$moduleDirname}_admin_{$fileName}.tpl'}>\n";
188
        }
189
190
        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...
191
    }
192
193
    /**
194
     * @public function getSmartyIncludeFileListSection
195
     * @param        $moduleDirname
196
     * @param        $fileName
197
     * @param        $tableFieldName
198
     *
199
     * @param string $t
200
     * @return string
201
     */
202
    public function getSmartyIncludeFileListSection($moduleDirname, $fileName, $tableFieldName, $t = '')
203
    {
204
        return "{$t}<{include file='db:{$moduleDirname}_{$fileName}_list.tpl' {$tableFieldName}=\${$tableFieldName}[i]}>\n";
205
    }
206
207
    /**
208
     * @public function getSmartyIncludeFileListForeach
209
     * @param        $moduleDirname
210
     * @param        $fileName
211
     * @param        $tableFieldName
212
     *
213
     * @param string $t
214
     * @return string
215
     */
216
    public function getSmartyIncludeFileListForeach($moduleDirname, $fileName, $tableFieldName, $t = '')
217
    {
218
        return "{$t}<{include file='db:{$moduleDirname}_{$fileName}_list.tpl' {$tableFieldName}=\${$tableFieldName}}>\n";
219
    }
220
221
    /**
222
     * @public function getSmartyConditions
223
     * @param string $condition
224
     * @param string $operator
225
     * @param string $type
226
     * @param string $contentIf
227
     * @param mixed  $contentElse
228
     * @param bool   $count
229
     *
230
     * @param bool   $noSimbol
231
     * @param string $t
232
     * @return string
233
     */
234
    public function getSmartyConditions($condition = '', $operator = '', $type = '', $contentIf = '', $contentElse = false, $count = false, $noSimbol = false, $t = '')
235
    {
236
        $ret = '';
237
        if (!$contentElse) {
238
            if (!$count) {
239
                $ret = "{$t}<{if \${$condition}{$operator}{$type}}>\n";
240
            } elseif (!$noSimbol) {
241
                $ret = "{$t}<{if {$condition}{$operator}{$type}}>\n";
242
            } else {
243
                $ret = "{$t}<{if count(\${$condition}){$operator}{$type}}>\n";
244
            }
245
            $ret .= "{$t}{$contentIf}";
246
            $ret .= "{$t}<{/if}>\n";
247
        } else {
248
            if (!$count) {
249
                $ret = "{$t}<{if \${$condition}{$operator}{$type}}>\n";
250
            } elseif (!$noSimbol) {
251
                $ret = "{$t}<{if {$condition}{$operator}{$type}}>\n";
252
            } else {
253
                $ret = "{$t}<{if count(\${$condition}){$operator}{$type}}>\n";
254
            }
255
            $ret .= "{$t}{$contentIf}";
256
            $ret .= "{$t}<{else}>\n";
257
            $ret .= "{$t}{$contentElse}";
258
            $ret .= "{$t}<{/if}>\n";
259
        }
260
261
        return $ret;
262
    }
263
264
    /**
265
     * @public function getSmartyForeach
266
     * @param string $item
267
     * @param string $from
268
     * @param string $content
269
     *
270
     * @param string $name
271
     * @param string $key
272
     * @param string $t
273
     * @return string
274
     */
275
    public function getSmartyForeach($item = 'item', $from = 'from', $content = 'content', $name = '', $key = '', $t = '')
276
    {
277
        $name = '' != $name ? " name={$name}" : '';
278
        $key = '' != $key ? " key={$key}" : '';
279
        $ret = "{$t}<{foreach item={$item} from=\${$from}{$key}{$name}}>\n";
280
        $ret .= "{$t}{$content}";
281
        $ret .= "{$t}<{/foreach}>\n";
282
283
        return $ret;
284
    }
285
286
    /**
287
     * @public function getSmartyForeachQuery
288
     * @param string $item
289
     * @param string $from
290
     * @param string $content
291
     *
292
     * @param string $loop
293
     * @param string $key
294
     * @param string $t
295
     * @return string
296
     */
297
    public function getSmartyForeachQuery($item = 'item', $from = 'from', $content = 'content', $loop = 'loop', $key = '', $t = '')
298
    {
299
        $loop = '' != $loop ? " loop={$loop}" : '';
300
        $key = '' != $key ? " key={$key}" : '';
301
        $ret = "{$t}<{foreachq item={$item} from=\${$from}{$key}{$loop}}>\n";
302
        $ret .= "{$t}{$content}";
303
        $ret .= "{$t}<{/foreachq}>\n";
304
305
        return $ret;
306
    }
307
308
    /**
309
     * @public function getSmartySection
310
     * @param string $name
311
     * @param string $loop
312
     * @param string $content
313
     *
314
     * @param int    $start
315
     * @param int    $step
316
     * @param string $t
317
     * @return string
318
     */
319
    public function getSmartySection($name = 'name', $loop = 'loop', $content = 'content', $start = 0, $step = 0, $t = '')
320
    {
321
        $start = 0 != $start ? " start={$start}" : '';
322
        $step = 0 != $step ? " step={$step}" : '';
323
        $ret = "{$t}<{section name={$name} loop=\${$loop}{$start}{$step}}>\n";
324
        $ret .= "{$t}{$content}";
325
        $ret .= "{$t}<{/section}>\n";
326
327
        return $ret;
328
    }
329
}
330