Issues (67)

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.

app/Schedule/ScheduledShow.php (1 issue)

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 WITR\Schedule;
4
5
use WITR\Show;
6
use WITR\User;
7
use Carbon\Carbon;
8
9
class ScheduledShow
10
{
11
12
    protected $show;
13
    protected $dj;
14
    protected $startingHour;
15
    protected $endingHour;
16
    protected $id;
17
    protected $dayOfWeek;
18
19
    public static function fromShowAndDJ($show, $dj)
20
    {
21
        $scheduledShow = new ScheduledShow();
22
23
        $scheduledShow->show = $show;
24
        $scheduledShow->dj = $dj;
25
26
        return $scheduledShow;
27
    }
28
29
    public function dj()
30
    {
31
        return $this->dj->name;
32
    }
33
34
    public function djId()
35
    {
36
        return $this->dj->id;
37
    }
38
39
    public function show()
40
    {
41
        return $this->show->name;
42
    }
43
44
    public function showId()
45
    {
46
        return $this->show->id;
47
    }
48
49
    public function djPicture()
50
    {
51
        return $this->dj->picture;
52
    }
53
54
    public function showPicture()
55
    {
56
        return $this->show->show_picture;
57
    }
58
59
    public function sliderPicture()
60
    {
61
        return $this->show->slider_picture;
62
    }
63
64
    public function sliderStyle()
65
    {
66
        return $this->show->style;
67
    }
68
69
    public function startsAt($startingHour)
70
    {
71
        $this->startingHour = $startingHour;
72
        $this->endingHour = $startingHour;
73
        $this->extendShowByHour();
74
    }
75
76
    public function start()
77
    {
78
        return $this->startingHour;
79
    }
80
81
    public function end()
82
    {
83
        return $this->endingHour;
84
    }
85
86
    public function extendShowByHour()
87
    {
88
        $this->endingHour++;
89
    }
90
91
    public function timespan()
92
    {
93
        $suffix = $this->endingHour < 12 || $this->endingHour > 24 ? 'AM' : 'PM';
94
        $endingHour = $this->hourAdjusted($this->endingHour);
95
        $startingHour = $this->hourAdjusted($this->startingHour);
96
        return $startingHour . ' - ' . $endingHour . ' ' . $suffix;
97
    }
98
99
    private function hourAdjusted($hour)
100
    {
101
        while ($hour > 12) {
102
            $hour -= 12;
103
        }
104
        return $hour;
105
    }
106
107
    public function airsDayOfWeek($airsDayOfWeek)
108
    {
109
        $this->dayOfWeek = $airsDayOfWeek;
110
    }
111
112
    public function getAirDate()
113
    {
114
        return Weekday::display($this->dayOfWeek);
115
    }
116
117
    public function getRelativeAirDate()
118
    {
119
        $now = ScheduleTime::now();
120
        if ($this->dayOfWeek == $now->dayOfWeek)
0 ignored issues
show
The property dayOfWeek does not exist on object<WITR\Schedule\ScheduleTime>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
121
        {
122
            return 'Today';
123
        }
124
        else if ($this->dayOfWeek == $now->addDay()->dayOfWeek)
125
        {
126
            return 'Tomorrow';
127
        }
128
        else 
129
        {
130
            return $this->getAirDate();
131
        }
132
    }
133
134
135
    public function airDayOfWeek()
136
    {
137
        return $this->dayOfWeek;
138
    }
139
140
    public function showDescription()
141
    {
142
        return $this->show->description;
143
    }
144
145
    public function setId($id)
146
    {
147
        $this->id = $id;
148
    }
149
150
    public function id()
151
    {
152
        return $this->id;
153
    }
154
155
    public function nowPlaying()
156
    {
157
        $today = ScheduleTime::now();
158
159
        if ($this->airDayOfWeek() != $today->dayOfWeek())
160
        {
161
            return false;
162
        }
163
164
        if ($this->startingHour > $today->hour() || $this->endingHour <= $today->hour())
165
        {
166
            return false;
167
        }
168
169
        return true;
170
    }
171
}
172