This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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 | * Copyright 2014 Fabian Grutschus. All rights reserved. |
||
5 | * |
||
6 | * Redistribution and use in source and binary forms, with or without modification, |
||
7 | * are permitted provided that the following conditions are met: |
||
8 | * |
||
9 | * 1. Redistributions of source code must retain the above copyright notice, this |
||
10 | * list of conditions and the following disclaimer. |
||
11 | * |
||
12 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
||
13 | * this list of conditions and the following disclaimer in the documentation |
||
14 | * and/or other materials provided with the distribution. |
||
15 | * |
||
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
||
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
19 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |
||
20 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
26 | * |
||
27 | * The views and conclusions contained in the software and documentation are those |
||
28 | * of the authors and should not be interpreted as representing official policies, |
||
29 | * either expressed or implied, of the copyright holders. |
||
30 | * |
||
31 | * @author Fabian Grutschus <[email protected]> |
||
32 | * @copyright 2014 Fabian Grutschus. All rights reserved. |
||
33 | * @license BSD |
||
34 | * @link http://github.com/fabiang/xmpp |
||
35 | */ |
||
36 | |||
37 | namespace Fabiang\Xmpp\Protocol; |
||
38 | |||
39 | use Fabiang\Xmpp\Util\XML; |
||
40 | |||
41 | /** |
||
42 | * Protocol setting for Xmpp. |
||
43 | * |
||
44 | * @package Xmpp\Protocol |
||
45 | */ |
||
46 | class Presence implements ProtocolImplementationInterface |
||
47 | { |
||
48 | /** |
||
49 | * Signals that the entity is available for communication. |
||
50 | */ |
||
51 | |||
52 | const TYPE_AVAILABLE = 'available'; |
||
53 | |||
54 | /** |
||
55 | * Signals that the entity is no longer available for communication. |
||
56 | */ |
||
57 | const TYPE_UNAVAILABLE = 'unavailable'; |
||
58 | |||
59 | /** |
||
60 | * The sender wishes to subscribe to the recipient's presence. |
||
61 | */ |
||
62 | const TYPE_SUBSCRIBE = 'subscribe'; |
||
63 | |||
64 | /** |
||
65 | * The sender has allowed the recipient to receive their presence. |
||
66 | */ |
||
67 | const TYPE_SUBSCRIBED = 'subscribed'; |
||
68 | |||
69 | /** |
||
70 | * The sender is unsubscribing from another entity's presence. |
||
71 | */ |
||
72 | const TYPE_UNSUBSCRIBE = 'unsubscribe'; |
||
73 | |||
74 | /** |
||
75 | * The subscription request has been denied or a previously-granted subscription has been cancelled. |
||
76 | */ |
||
77 | const TYPE_UNSUBSCRIBED = 'unsubscribed'; |
||
78 | |||
79 | /** |
||
80 | * A request for an entity's current presence; SHOULD be generated only by a server on behalf of a user. |
||
81 | */ |
||
82 | const TYPE_PROBE = 'probe'; |
||
83 | |||
84 | /** |
||
85 | * An error has occurred regarding processing or delivery of a previously-sent presence stanza. |
||
86 | */ |
||
87 | const TYPE_ERROR = 'error'; |
||
88 | |||
89 | /** |
||
90 | * The entity or resource is available. |
||
91 | */ |
||
92 | const SHOW_AVAILABLE = 'available'; |
||
93 | |||
94 | /** |
||
95 | * The entity or resource is temporarily away. |
||
96 | */ |
||
97 | const SHOW_AWAY = 'away'; |
||
98 | |||
99 | /** |
||
100 | * The entity or resource is actively interested in chatting. |
||
101 | */ |
||
102 | const SHOW_CHAT = 'chat'; |
||
103 | |||
104 | /** |
||
105 | * The entity or resource is busy (dnd = "Do Not Disturb"). |
||
106 | */ |
||
107 | const SHOW_DND = 'dnd'; |
||
108 | |||
109 | /** |
||
110 | * The entity or resource is away for an extended period (xa = "eXtended Away"). |
||
111 | */ |
||
112 | const SHOW_XA = 'xa'; |
||
113 | |||
114 | /** |
||
115 | * Presence to. |
||
116 | * |
||
117 | * @var string|null |
||
118 | */ |
||
119 | protected $to; |
||
120 | |||
121 | /** |
||
122 | * Priority. |
||
123 | * |
||
124 | * @var integer |
||
125 | */ |
||
126 | protected $priority = 1; |
||
127 | |||
128 | /** |
||
129 | * Nickname for presence. |
||
130 | * |
||
131 | * @var string |
||
132 | */ |
||
133 | protected $nickname; |
||
134 | |||
135 | /** |
||
136 | * Channel password. |
||
137 | * |
||
138 | * @var string |
||
139 | */ |
||
140 | protected $password; |
||
141 | |||
142 | 3 | /** |
|
143 | * Constructor. |
||
144 | 3 | * |
|
145 | 3 | * @param integer $priority |
|
146 | * @param string $to |
||
147 | * @param string $nickname |
||
148 | */ |
||
149 | public function __construct($priority = 1, $to = null, $nickname = null) |
||
150 | 3 | { |
|
151 | $this->setPriority($priority)->setTo($to)->setNickname($nickname); |
||
152 | 3 | } |
|
153 | |||
154 | 3 | /** |
|
155 | 3 | * {@inheritDoc} |
|
156 | 3 | */ |
|
157 | public function toString() |
||
158 | 3 | { |
|
159 | $presence = '<presence'; |
||
160 | |||
161 | if (null !== $this->getTo()) { |
||
162 | $presence .= ' to="' . XML::quote($this->getTo()) . '/' . XML::quote($this->getNickname()) . '"'; |
||
163 | } |
||
164 | |||
165 | $presence .= '><priority>' . $this->getPriority() . '</priority>'; |
||
166 | 3 | ||
167 | if (null !== $this->getPassword()) { |
||
168 | 3 | $presence .= "<x xmlns='http://jabber.org/protocol/muc'><password>" . $this->getPassword() . "</password></x>"; |
|
169 | } |
||
170 | |||
171 | $presence .= '</presence>'; |
||
172 | return $presence; |
||
173 | } |
||
174 | |||
175 | /** |
||
176 | * Get nickname. |
||
177 | 3 | * |
|
178 | * @return string |
||
179 | 3 | */ |
|
180 | 3 | public function getNickname() |
|
181 | { |
||
182 | return $this->nickname; |
||
183 | } |
||
184 | |||
185 | /** |
||
186 | * Set nickname. |
||
187 | * |
||
188 | 3 | * @param string $nickname |
|
189 | * @return $this |
||
190 | 3 | */ |
|
191 | public function setNickname($nickname) |
||
192 | { |
||
193 | $this->nickname = (string) $nickname; |
||
194 | return $this; |
||
195 | } |
||
196 | |||
197 | /** |
||
198 | * Get to. |
||
199 | 3 | * |
|
200 | * @return string¦null |
||
201 | 3 | */ |
|
202 | 3 | public function getTo() |
|
203 | { |
||
204 | return $this->to; |
||
205 | } |
||
206 | |||
207 | /** |
||
208 | * Set to. |
||
209 | * |
||
210 | 3 | * @param string|null $to |
|
211 | * @return $this |
||
212 | 3 | */ |
|
213 | public function setTo($to = null) |
||
214 | { |
||
215 | $this->to = $to; |
||
216 | return $this; |
||
217 | } |
||
218 | |||
219 | /** |
||
220 | * Get priority. |
||
221 | 3 | * |
|
222 | * @return integer |
||
223 | 3 | */ |
|
224 | 3 | public function getPriority() |
|
225 | { |
||
226 | return $this->priority; |
||
227 | } |
||
228 | |||
229 | /** |
||
230 | * Set priority. |
||
231 | * |
||
232 | * @param integer $priority |
||
233 | * @return $this |
||
234 | */ |
||
235 | public function setPriority($priority) |
||
236 | { |
||
237 | $this->priority = (int) $priority; |
||
238 | return $this; |
||
239 | } |
||
240 | |||
241 | /** |
||
242 | * Get channel password. |
||
243 | * |
||
244 | * @return string¦null |
||
245 | */ |
||
246 | public function getPassword() |
||
247 | { |
||
248 | return $this->password; |
||
249 | } |
||
250 | |||
251 | /** |
||
252 | * Set channel password. |
||
253 | * |
||
254 | * @param string|null $to |
||
0 ignored issues
–
show
|
|||
255 | * @return $this |
||
256 | */ |
||
257 | public function setPassword($password = null) |
||
258 | { |
||
259 | $this->password = $password; |
||
260 | return $this; |
||
261 | } |
||
262 | } |
||
263 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.