Issues (51)

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/Utility.php (2 issues)

1
<?php
2
3
namespace XoopsModules\About;
4
5
/*
6
 About Utility Class Definition
7
8
 You may not change or alter any portion of this comment or credits of
9
 supporting developers from this source code or any supporting source code
10
 which is considered copyrighted (c) material of the original comment or credit
11
 authors.
12
13
 This program is distributed in the hope that it will be useful, but
14
 WITHOUT ANY WARRANTY; without even the implied warranty of
15
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
 */
17
18
/**
19
 * Module:  About
20
 *
21
 * @package      ::    \module\About\class
22
 * @license      http://www.fsf.org/copyleft/gpl.html GNU public license
23
 * @copyright    https://xoops.org 2001-2017 &copy; XOOPS Project
24
 * @author       ZySpec <[email protected]>
25
 * @author       Mamba <[email protected]>
26
 * @since        ::      File available since version 1.54
27
 */
28
29
use XoopsModules\About;
30
use XoopsModules\About\Common;
31
use XoopsModules\About\Constants;
32
33
require_once dirname(__DIR__) . '/include/vars.php';
34
define($GLOBALS['artdirname'] . '_FUNCTIONS_RENDER_LOADED', true);
35
36
/**
37
 * Class Utility
38
 */
39
class Utility extends Common\SysUtility
40
{
41
    //--------------- Custom module methods -----------------------------
42
    /**
43
     * @param       $dir
44
     * @param int   $mode
45
     * @param bool  $recursive
46
     * @return bool
47
     */
48
    public static function aboutmkdirs($dir, $mode = 0777, $recursive = true)
49
    {
50
        if ('' === $dir || null === $dir) {
51
            return $dir;
52
        }
53
        if ('/' === $dir || \is_dir($dir)) {
54
            return $dir;
55
        }
56
        if (static::aboutmkdirs(\dirname($dir), $mode, $recursive)) {
57
            return \mkdir($dir, $mode);
58
        }
59
60
        return $dir;
61
    }
62
63
    /**
64
     * Function to get template file of a specified style of a specified page
65
     *
66
     *
67
     * @param mixed      $page
68
     * @param null|mixed $style
69
     * @return string template file name, using default style if style is invalid
70
     */
71
    public static function getTemplate($page = 'index', $style = null)
72
    {
73
        global $xoops;
74
75
        $template_dir = $xoops->path("modules/{$GLOBALS['artdirname']}/templates/");
76
        $style        = null === $style ? '' : '_' . $style;
77
        $file_name    = "{$GLOBALS['artdirname']}_{$page}{$style}.tpl";
78
        if (file_exists($template_dir . $file_name)) {
79
            return $file_name;
80
        }
81
        // Couldn't find file, try to see if the "default" style for this page exists
82
        if (!empty($style)) {
83
            $style     = '';
84
            $file_name = "{$GLOBALS['artdirname']}_{$page}{$style}.tpl";
85
            if (file_exists($template_dir . $file_name)) {
86
                return $file_name;
87
            }
88
        }
89
90
        // Couldn't find a suitable template for this page
91
        return null;
92
    }
93
94
    /**
95
     * Function to get a list of template files of a page, indexed by file name
96
     *
97
     *
98
     * @param mixed     $page
99
     * @param bool $refresh recreate the data
100
     * @return array
101
     */
102
    public static function getTemplateList($page = 'index', $refresh = false)
103
    {
104
        $tplFiles = self::getTplPageList($page, $refresh);
105
        $template = [];
106
        if ($tplFiles && is_array($tplFiles)) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $tplFiles of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
107
            foreach (array_keys($tplFiles) as $temp) {
108
                $template[$temp] = $temp;
109
            }
110
        }
111
112
        return $template;
113
    }
114
115
    /**
116
     * Function to get CSS file URL of a style
117
     *
118
     * The hardcoded path is not desirable for theme switch, however, we have to keabout it before getting a good solution for cache
119
     *
120
     *
121
     * @param mixed $style
122
     * @return string file URL, false if not found
123
     */
124
    public static function getCss($style = 'default')
125
    {
126
        global $xoops;
127
128
        if (is_readable($xoops->path('modules/' . $GLOBALS['artdirname'] . '/assets/css/style_' . mb_strtolower($style) . '.css'))) {
129
            return $xoops->path('modules/' . $GLOBALS['artdirname'] . '/assets/css/style_' . mb_strtolower($style) . '.css', true);
130
        }
131
132
        return $xoops->path('modules/' . $GLOBALS['artdirname'] . '/assets/css/style.css', true);
133
    }
134
135
    /**
136
     * Function to module header for a page with specified style
137
     *
138
     *
139
     * @param mixed $style
140
     * @return string
141
     */
142
    public static function getModuleHeader($style = 'default')
143
    {
144
        $xoops_module_header = '<link rel="stylesheet" type="text/css" href="' . self::getCss($style) . '">';
145
146
        return $xoops_module_header;
147
    }
148
149
    /**
150
     * Function to get a list of template files of a page, indexed by style
151
     *
152
     *
153
     * @param mixed $page
154
     * @param bool  $refresh
155
     * @return array
156
     */
157
    public static function &getTplPageList($page = '', $refresh = true)
158
    {
159
        $list = null;
0 ignored issues
show
The assignment to $list is dead and can be removed.
Loading history...
160
161
        $cache_file = empty($page) ? 'template-list' : 'template-page';
162
        /*
163
        load_functions("cache");
164
        $list = mod_loadCacheFile($cache_file, $GLOBALS["artdirname"]);
165
        */
166
167
        xoops_load('xoopscache');
168
        $key  = $GLOBALS['artdirname'] . "_{$cache_file}";
169
        $list = \XoopsCache::read($key);
170
171
        if (!is_array($list) || $refresh) {
172
            $list = self::template_lookup(!empty($page));
173
        }
174
175
        $ret = empty($page) ? $list : @$list[$page];
176
177
        return $ret;
178
    }
179
180
    /**
181
     * @param bool $index_by_page
182
     * @return array
183
     */
184
    public static function &template_lookup($index_by_page = false)
185
    {
186
        require_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
187
188
        $files = \XoopsLists::getHtmlListAsArray(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['artdirname'] . '/templates/');
189
        $list  = [];
190
        foreach ($files as $file => $name) {
191
            // The valid file name must be: art_article_mytpl.html OR art_category-1_your-trial.html
192
            if (preg_match('/^' . $GLOBALS['artdirname'] . "_([^_]*)(_(.*))?\.(tpl|xotpl)$/i", $name, $matches)) {
193
                if (empty($matches[1])) {
194
                    continue;
195
                }
196
                if (empty($matches[3])) {
197
                    $matches[3] = 'default';
198
                }
199
                if (empty($index_by_page)) {
200
                    $list[] = ['file' => $name, 'description' => $matches[3]];
201
                } else {
202
                    $list[$matches[1]][$matches[3]] = $name;
203
                }
204
            }
205
        }
206
207
        $cache_file = empty($index_by_page) ? 'template-list' : 'template-page';
208
        xoops_load('xoopscache');
209
        $key = $GLOBALS['artdirname'] . "_{$cache_file}";
210
        \XoopsCache::write($key, $list);
211
212
        //load_functions("cache");
213
        //mod_createCacheFile($list, $cache_file, $GLOBALS["artdirname"]);
214
        return $list;
215
    }
216
217
}
218