Issues (632)

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.

Apps/Controller/Front/Profile.php (2 issues)

1
<?php
2
3
namespace Apps\Controller\Front;
4
5
use Apps\ActiveRecord\Profile as ProfileRecords;
6
use Apps\ActiveRecord\UserLog;
7
use Apps\ActiveRecord\UserNotification;
8
use Apps\Model\Front\Profile\FormSettings;
9
use Apps\Model\Front\Sitemap\EntityBuildMap;
10
use Extend\Core\Arch\FrontAppController;
11
use Ffcms\Core\App;
12
use Ffcms\Core\Exception\ForbiddenException;
13
use Ffcms\Core\Exception\SyntaxException;
14
15
/**
16
 * Class Profile. User profiles application front controller
17
 * @package Apps\Controller\Front
18
 */
19
class Profile extends FrontAppController
20
{
21
    const BLOCK_PER_PAGE = 10;
22
    const EVENT_CHANGE_PASSWORD = 'profile.changepassword.success';
23
    const NOTIFY_PER_PAGE = 25;
24
    const FEED_PER_PAGE = 10;
25
    const LOG_PER_PAGE = 5;
26
27
    /**
28
     * Fat actions like actionIndex(), actionShow() are located in standalone traits.
29
     * This feature allow provide better read&write accessibility
30
     */
31
32
    use Profile\ActionIndex {
33
        index as actionIndex;
34
    }
35
36
    use Profile\ActionShow {
37
        show as actionShow;
38
    }
39
40
    use Profile\ActionFeed {
41
        feed as actionFeed;
42
    }
43
44
    use Profile\ActionWallDelete {
45
        wallDelete as actionWalldelete;
46
    }
47
48
    use Profile\ActionAvatar {
49
        avatar as actionAvatar;
50
    }
51
52
    use Profile\ActionNotifications {
53
        notifications as actionNotifications;
54
    }
55
56
    use Profile\ActionIgnore {
57
        ignore as actionIgnore;
58
    }
59
60
    use Profile\ActionSearch {
61
        search as actionSearch;
62
    }
63
64
    use Profile\ActionUnblock {
65
        unblock as actionUnblock;
66
    }
67
68
    use Profile\ActionPassword {
69
        password as actionPassword;
70
    }
71
72
73
    /**
74
     * Show user messages (based on ajax, all in template)
75
     * @return string
76
     * @throws ForbiddenException
77
     */
78
    public function actionMessages()
79
    {
80
        if (!App::$User->isAuth()) {
81
            throw new ForbiddenException();
82
        }
83
84
        return $this->view->render('profile/messages');
85
    }
86
87
    /**
88
     * User profile settings
89
     * @return string
90
     * @throws \Ffcms\Core\Exception\SyntaxException
91
     * @throws ForbiddenException
92
     */
93
    public function actionSettings()
94
    {
95
        // check if auth
96
        if (!App::$User->isAuth()) {
97
            throw new ForbiddenException();
98
        }
99
100
        // get user object
101
        $user = App::$User->identity();
102
        // create model and pass user object
103
        $model = new FormSettings($user);
104
105
        // check if form is submited
106
        if ($model->send() && $model->validate()) {
107
            $model->save();
108
            App::$Session->getFlashBag()->add('success', __('Profile data are successful updated'));
109
        }
110
111
        // render view
112
        return $this->view->render('profile/settings', [
113
            'model' => $model
114
        ]);
115
    }
116
117
    /**
118
     * Show user logs
119
     * @return string
120
     * @throws ForbiddenException
121
     */
122
    public function actionLog()
123
    {
124
        // check if user is authorized
125
        if (!App::$User->isAuth()) {
126
            throw new ForbiddenException();
127
        }
128
129
        // get log records
130
        $records = UserLog::where('user_id', App::$User->identity()->getId());
131
132
        // build pagination info
133
        $totalCount = $records->count();
134
        $page = (int)$this->request->query->get('page', 0);
135
        $offset = $page * static::LOG_PER_PAGE;
136
137
        // apply pagination limits
138
        $records = $records->skip($offset)
139
            ->take(static::LOG_PER_PAGE)
140
            ->orderBy('id', 'DESC')
141
            ->get();
142
143
        // render output view
144
        return $this->view->render('profile/log', [
145
            'records' => $records,
146
            'pagination' => [
147
                'step' => static::LOG_PER_PAGE,
148
                'total' => $totalCount,
149
                'page' => $page
150
            ]
151
        ]);
152
    }
153
154
    /**
155
     * Cron schedule - build user profiles sitemap
156
     */
157
    public static function buildSitemapSchedule()
158
    {
159
        // get not empty user profiles
160
        $profiles = ProfileRecords::whereNotNull('nick');
161
        if ($profiles->count() < 1) {
162
            return;
163
        }
164
165
        // get languages if multilanguage enabled
166
        $langs = null;
167
        if (App::$Properties->get('multiLanguage')) {
168
            $langs = App::$Properties->get('languages');
169
        }
170
171
        // build sitemap from content items via business model
172
        $sitemap = new EntityBuildMap($langs);
173
        foreach ($profiles->get() as $user) {
174
            $sitemap->add('profile/show/' . $user->user_id, $user->updated_at, 'weekly', 0.2);
175
        }
176
177
        try {
178
            $sitemap->save('profile');
179
        } catch (SyntaxException $e) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
180
        }
181
    }
182
183
    /**
184
     * Cleanup tables as scheduled action
185
     */
186
    public static function cleanupTablesSchedule()
187
    {
188
        // calculate date (now - 1week) for sql query
189
        $date = (new \DateTime('now'))->modify('-1 week')->format('Y-m-d');
190
        try {
191
            UserNotification::where('created_at', '<=', $date)->delete();
192
            UserLog::where('created_at', '<=', $date)->delete();
193
        } catch (\Exception $e) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
194
        }
195
    }
196
}
197