GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (115)

Security Analysis    no request data  

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.

src/model/BlockSet.php (5 issues)

unused private properties.

Unused Code Minor

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
namespace SheaDawson\Blocks\Model;
4
5
use SheaDawson\Blocks\Forms\GridFieldConfigBlockManager;
6
use SilverStripe\ORM\DataObject;
7
use SilverStripe\ORM\ArrayLib;
8
use SilverStripe\CMS\Model\SiteTree;
9
use SilverStripe\Security\PermissionProvider;
10
use SilverStripe\Security\Permission;
11
use SilverStripe\Security\Group;
12
use SilverStripe\Forms\TreeMultiselectField;
13
use SilverStripe\Forms\CheckboxField;
14
use SilverStripe\Forms\HeaderField;
15
use SilverStripe\Forms\LiteralField;
16
use SilverStripe\Forms\GridField\GridField;
17
use SilverStripe\Forms\GridField\GridFieldConfig_RelationEditor;
18
use SilverStripe\Forms\GridField\GridFieldDeleteAction;
19
use Symbiote\GridFieldExtensions\GridFieldOrderableRows;
20
use Symbiote\MultiValueField\Fields\MultiValueCheckboxField;
21
use Symbiote\MultiValueField\ORM\FieldType\MultiValueField;
22
23
/**
24
 * BlockSet.
25
 *
26
 * @author Shea Dawson <[email protected]>
27
 */
28
class BlockSet extends DataObject implements PermissionProvider
29
{
30
    /**
31
     * @var array
32
     **/
33
    private static $table_name = "BlockSet";
0 ignored issues
show
The property $table_name is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
34
35
    /**
36
     * @var array
37
     **/
38
    private static $db = [
0 ignored issues
show
The property $db is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
39
        'Title' => 'Varchar(255)',
40
        'PageTypes' => MultiValueField::class,
41
        'IncludePageParent' => 'Boolean',
42
    ];
43
44
    /**
45
     * @var array
46
     **/
47
    private static $many_many = [
0 ignored issues
show
The property $many_many is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
48
        "Blocks" => Block::class,
49
        "PageParents" => SiteTree::class,
50
    ];
51
52
    /**
53
     * @var array
54
     **/
55
    private static $many_many_extraFields = [
0 ignored issues
show
The property $many_many_extraFields is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
56
        'Blocks' => [
57
            'Sort' => 'Int',
58
            'BlockArea' => 'Varchar',
59
            'AboveOrBelow' => 'Varchar',
60
        ],
61
    ];
62
63
    /**
64
     * @var array
65
     **/
66
    private static $above_or_below_options = [
0 ignored issues
show
The property $above_or_below_options is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
67
        'Above' => 'Above Page Blocks',
68
        'Below' => 'Below Page Blocks',
69
    ];
70
71
    public function getCMSFields()
72
    {
73
        $fields = parent::getCMSFields();
74
75
        $fields->removeFieldFromTab('Root', 'PageParents');
76
77
        $fields->addFieldToTab('Root.Main', HeaderField::create('SettingsHeading', _t('BlockSet.Settings', 'Settings')), 'Title');
78
        $fields->addFieldToTab('Root.Main', MultiValueCheckboxField::create('PageTypes', _t('BlockSet.OnlyApplyToThesePageTypes', 'Only apply to these Page Types:'), $this->pageTypeOptions())
79
                ->setDescription(_t('BlockSet.OnlyApplyToThesePageTypesDescription', 'Selected Page Types will inherit this Block Set automatically. Leave all unchecked to apply to all page types.')));
80
        $fields->addFieldToTab('Root.Main', TreeMultiselectField::create('PageParents', _t('BlockSet.OnlyApplyToChildrenOfThesePages', 'Only apply to children of these Pages:'), 'SilverStripe\\CMS\\Model\\SiteTree'));
81
        $fields->addFieldToTab('Root.Main', CheckboxField::create('IncludePageParent', _t('BlockSet.ApplyBlockSetToSelectedPageParentsAsWellAsChildren','Apply block set to selected page parents as well as children')));
82
83
        if (!$this->ID) {
84
            $fields->addFieldToTab('Root.Main', LiteralField::create('NotSaved', "<p class='message warning'>"._t('BlockSet.YouCanAddBlocksToThisSetOnceYouHaveSavedIt', 'You can add Blocks to this set once you have saved it for the first time').'</p>'));
85
86
            return $fields;
87
        }
88
89
        $fields->removeFieldFromTab('Root', 'Blocks');
90
91
        /**
92
        * @todo - change relation editor back to the custom block manager config and fix issues when 'creating' Blocks from a BlockSet.
93
		*/
94
        $gridConfig = GridFieldConfig_RelationEditor::create();
95
        $gridConfig->addComponent(new GridFieldOrderableRows('Sort'));
96
        $gridConfig->addComponent(new GridFieldDeleteAction());
97
98
        $gridSource = $this->Blocks()->Sort('Sort');
99
100
        $fields->addFieldToTab('Root.Blocks', HeaderField::create('BlocksHeading', _t('Block.PLURALNAME', 'Blocks')));
101
        $fields->addFieldToTab('Root.Blocks', GridField::create('Blocks', _t('Block.PLURALNAME', 'Blocks'), $gridSource, $gridConfig));
102
103
        return $fields;
104
    }
105
106
    /**
107
     * Returns a sorted array suitable for a dropdown with pagetypes and their translated name.
108
     *
109
     * @return array
110
     */
111
    protected function pageTypeOptions()
112
    {
113
        $pageTypes = [];
114
        $classes = ArrayLib::valueKey(SiteTree::page_type_classes());
115
        unset($classes['VirtualPage']);
116
        unset($classes['ErrorPage']);
117
        unset($classes['RedirectorPage']);
118
        foreach ($classes as $pageTypeClass) {
119
            $pageTypes[$pageTypeClass] = singleton($pageTypeClass)->i18n_singular_name();
120
        }
121
        asort($pageTypes);
122
123
        return $pageTypes;
124
    }
125
126
    /**
127
     * Returns a list of pages this BlockSet features on.
128
     *
129
     * @return DataList
130
     */
131
    public function Pages()
132
    {
133
        $pages = SiteTree::get();
134
        $types = $this->PageTypes->getValue();
135
        if (count($types)) {
136
            $pages = $pages->filter('ClassName', $types);
137
        }
138
139
        $parents = $this->PageParents()->column('ID');
140
        if (count($parents)) {
141
            $pages = $pages->filter('ParentID', $parents);
142
        }
143
144
        return $pages;
145
    }
146
147
    public function canView($member = null)
148
    {
149
        return true;
150
    }
151
152
    public function canEdit($member = null)
153
    {
154
        return Permission::check('ADMIN', 'any', $member) || Permission::check('BLOCK_EDIT', 'any', $member);
155
    }
156
157
    public function canDelete($member = null)
158
    {
159
        return Permission::check('ADMIN', 'any', $member) || Permission::check('BLOCK_DELETE', 'any', $member);
160
    }
161
162
    public function canCreate($member = null, $context = [])
163
    {
164
        return Permission::check('ADMIN', 'any', $member) || Permission::check('BLOCK_CREATE', 'any', $member);
165
    }
166
167
    public function providePermissions()
168
    {
169
        return [
170
            'BLOCKSET_EDIT' => [
171
                'name' => _t('BlockSet.EditBlockSet','Edit a Block Set'),
172
                'category' => _t('Block.PermissionCategory', 'Blocks'),
173
            ],
174
            'BLOCKSET_DELETE' => [
175
                'name' => _t('BlockSet.DeleteBlockSet','Delete a Block Set'),
176
                'category' => _t('Block.PermissionCategory', 'Blocks'),
177
            ],
178
            'BLOCKSET_CREATE' => [
179
                'name' => _t('BlockSet.CreateBlockSet','Create a Block Set'),
180
                'category' => _t('Block.PermissionCategory', 'Blocks'),
181
            ],
182
        ];
183
    }
184
}
185