Issues (34)

Security Analysis    not enabled

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

  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  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.
  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.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
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.

code/WishListPage.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 *@author nicolaas[at]sunnysideup.co.nz
5
 *
6
 *
7
 *
8
 **/
9
10
class WishListPage extends Page
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...
11
{
12
13
    /**
14
     * Icon to use for this page type.
15
     */
16
    public static $icon = "wishlist/images/treeicons/WishListPage";
17
18
    /**
19
     * Additional page database fields.
20
     */
21
    public static $db = array(
22
        "AddedToListText" => "Varchar(255)",
23
        "AddedToListTextError" => "Varchar(255)",
24
        "RemovedFromListConfirmation" => "Varchar(255)",
25
        "RetrieveListConfirmation" => "Varchar(255)",
26
        "ClearListConfirmation" => "Varchar(255)",
27
        "RemovedFromListText" => "Varchar(255)",
28
        "RemovedFromListTextError" => "Varchar(255)",
29
        "ClearWishList" => "Varchar(255)",
30
        "SavedWishListText" => "Varchar(255)",
31
        "SavedWishListTextError" => "Varchar(255)",
32
        "RetrievedWishListText" => "Varchar(255)",
33
        "RetrievedWishListTextError" => "Varchar(255)"
34
    );
35
36
37
    /**
38
     * Add page CMS fields.
39
     * @return FieldSet
40
     */
41
    public function getCMSFields()
42
    {
43
        $fields = parent::getCMSFields();
44
        $fields->addFieldToTab("Root.Content.SaveAndRemoveMessages", new TextField($name = "AddedToListText", $title = "added to list"));
45
        $fields->addFieldToTab("Root.Content.SaveAndRemoveMessages", new TextField($name = "AddedToListTextError", $title = "could not add to list"));
46
        $fields->addFieldToTab("Root.Content.SaveAndRemoveMessages", new TextField($name = "RemovedFromListText", $title = "removed from list"));
47
        $fields->addFieldToTab("Root.Content.SaveAndRemoveMessages", new TextField($name = "RemovedFromListTextError", $title = "could not remove from list"));
48
        $fields->addFieldToTab("Root.Content.WholeListMessages", new TextField($name = "ClearWishList", $title = "cleared list"));
49
        $fields->addFieldToTab("Root.Content.WholeListMessages", new TextField($name = "SavedWishListText", $title = "saved list"));
50
        $fields->addFieldToTab("Root.Content.WholeListMessages", new TextField($name = "SavedWishListTextError", $title = "could not save list"));
51
        $fields->addFieldToTab("Root.Content.WholeListMessages", new TextField($name = "RetrievedWishListText", $title = "retrieved list"));
52
        $fields->addFieldToTab("Root.Content.WholeListMessages", new TextField($name = "RetrievedWishListTextError", $title = "could not retrieve list"));
53
        $fields->addFieldToTab("Root.Content.DoubleChecksQuestions", new TextField($name = "RemovedFromListConfirmation", $title = "Are you sure you want to remove this item? Pop-up double-check question..."));
54
        $fields->addFieldToTab("Root.Content.DoubleChecksQuestions", new TextField($name = "RetrieveListConfirmation", $title = "Are you sure you want to retrieve your saved list? Pop-up double-check question... We ask them because they will loose their currently shown list."));
55
        $fields->addFieldToTab("Root.Content.DoubleChecksQuestions", new TextField($name = "ClearListConfirmation", $title = "Are you sure you want to clear your saved list? Pop-up double-check question..."));
56
        return $fields;
57
    }
58
59
    /**
60
     * Add default records to database.
61
     * Make sure you call parent::requireDefaultRecords().
62
     */
63
    public function requireDefaultRecords()
64
    {
65
        parent::requireDefaultRecords();
66
        $update = array();
67
        $page = DataObject::get_one("WishListPage");
68
        if (!$page) {
69
            $page = new WishListPage();
70
            $page->Title = "Wish List";
71
            $page->MetaTitle = "Wish List";
72
            $page->URLSegment = "wish-list";
73
            $page->MenuTitle = "wish list";
74
        }
75
        if ($page) {
76
            if (!$page->AddedToListText) {
77
                $page->AddedToListText = "added to wish list";
78
                $update[] ="updated AddedToListText";
79
            }
80
            if (!$page->AddedToListTextError) {
81
                $page->AddedToListTextError = "could not add to wish list";
82
                $update[] ="updated AddedToListTextError";
83
            }
84
            if (!$page->RemovedFromListConfirmation) {
85
                $page->RemovedFromListConfirmation = "are you sure you want to remove it from your wish list?";
86
                $update[] ="updated RemovedFromListConfirmation";
87
            }
88
            if (!$page->RetrieveListConfirmation) {
89
                $page->RetrieveListConfirmation = "Are you sure you would like to retrieve your saved list?  It will replace your current list.  Do you want to go ahead?";
90
                $update[] ="updated RetrieveListConfirmation";
91
            }
92
            if (!$page->ClearListConfirmation) {
93
                $page->ClearListConfirmation = "Are you sure you would like to clear your saved list? ";
94
                $update[] ="updated ClearListConfirmation";
95
            }
96
            if (!$page->RemovedFromListText) {
97
                $page->RemovedFromListText = "removed from wish list";
98
                $update[] ="updated RemovedFromListText";
99
            }
100
            if (!$page->RemovedFromListTextError) {
101
                $page->RemovedFromListTextError = "could not be removed from wish list";
102
                $update[] ="updated RemovedFromListTextError";
103
            }
104
            if (!$page->ClearWishList) {
105
                $page->ClearWishList = "cleared wish list";
106
                $update[] ="updated ClearWishList";
107
            }
108
            if (!$page->SavedWishListText) {
109
                $page->SavedWishListText = "saved wish list";
110
                $update[] ="updated SavedWishListText";
111
            }
112
            if (!$page->SavedWishListTextError) {
113
                $page->SavedWishListTextError = "could not save wish list";
114
                $update[] ="updated SavedWishListTextError";
115
            }
116
            if (!$page->RetrievedWishListText) {
117
                $page->RetrievedWishListText = "retrieved wish list";
118
                $update[] ="updated RetrievedWishListText";
119
            }
120
            if (!$page->RetrievedWishListTextError) {
121
                $page->RetrievedWishListTextError = "could not retrieve wish list";
122
                $update[] ="updated RetrievedWishListTextError";
123
            }
124
            if (count($update)) {
125
                $page->writeToStage('Stage');
126
                $page->publish('Stage', 'Live');
127
                DB::alteration_message($page->ClassName." created/updated: <ul><li>".implode("</li><li>", $update)."</li></ul>", 'created');
128
            }
129
        }
130
    }
131
}
132
133
class WishListPage_Controller extends Page_Controller
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
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...
134
{
135
136
    /**
137
     * Initialisation function that is run before any action on the controller is called.
138
     */
139
    public function init()
140
    {
141
        parent::init();
142
        WishListDecorator_Controller::set_inline_requirements();
143
    }
144
145
    /**
146
     * Return whether there are wish list items to be saved.
147
     * @return boolean
148
     */
149
    public function CanSaveWishList()
150
    {
151
        return $this->CanRetrieveWishList();
152
    }
153
154
    /**
155
     * Return whether there are wish list items to be retrieved (that haven't already been retrieved).
156
     * @return boolean
157
     */
158
    public function CanRetrieveWishList()
159
    {
160
        if ($array = WishListDecorator_Controller::get_wish_list_from_member_array()) {
161
            if (is_array($array)) {
162
                if (count($array)) {
163
                    return true;
164
                }
165
            }
166
        }
167
        return false;
168
    }
169
170
    /**
171
     * Return whether the member wish list is non-empty and hence can be cleared.
172
     * @return boolean
173
     */
174
    public function CanClearWishList()
175
    {
176
        return $this->CanRetrieveWishList();
177
    }
178
}
179