MW-Peachy /
Peachy
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 | * This file is part of Peachy MediaWiki Bot API |
||
| 5 | * |
||
| 6 | * Peachy is free software: you can redistribute it and/or modify |
||
| 7 | * it under the terms of the GNU General Public License as published by |
||
| 8 | * the Free Software Foundation, either version 3 of the License, or |
||
| 9 | * (at your option) any later version. |
||
| 10 | * |
||
| 11 | * This program is distributed in the hope that it will be useful, |
||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 14 | * GNU General Public License for more details. |
||
| 15 | * |
||
| 16 | * You should have received a copy of the GNU General Public License |
||
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
| 18 | */ |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @file |
||
| 22 | * Stores all the subclasses of Exception |
||
| 23 | */ |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Generic Peachy Error |
||
| 27 | * |
||
| 28 | * @package Exceptions |
||
| 29 | */ |
||
| 30 | class PeachyError extends Exception { |
||
| 31 | |||
| 32 | public function __construct( $code, $text ) { |
||
| 33 | parent::__construct( |
||
| 34 | "API Error: " . $code . " (" . $text . ")" |
||
| 35 | ); |
||
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Assertation error bot |
||
| 41 | * |
||
| 42 | * @package Exceptions |
||
| 43 | */ |
||
| 44 | class AssertFailure extends Exception { |
||
| 45 | |||
| 46 | public function __contstruct( $type ) { |
||
| 47 | parent::__construct( |
||
|
0 ignored issues
–
show
|
|||
| 48 | "Assert Failure: ".( $type == "bot" ? "Bot is no longer flagged as a bot" : "User is logged out" ) |
||
| 49 | ); |
||
| 50 | } |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Generic API Error |
||
| 55 | * |
||
| 56 | * @package Exceptions |
||
| 57 | */ |
||
| 58 | class MWAPIError extends Exception { |
||
| 59 | |||
| 60 | public function __construct( $error ) { |
||
| 61 | parent::__construct( |
||
| 62 | "API Error: " . $error['code'] . " (" . $error['text'] . $error['info'] . ")" |
||
| 63 | ); |
||
| 64 | } |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Error with user permissions |
||
| 69 | * |
||
| 70 | * @package Exceptions |
||
| 71 | */ |
||
| 72 | class PermissionsError extends Exception { |
||
| 73 | public function __construct( $error ) { |
||
| 74 | parent::__construct( |
||
| 75 | "Permissions Error: " . $error |
||
| 76 | ); |
||
| 77 | } |
||
| 78 | } |
||
| 79 | |||
| 80 | /** |
||
| 81 | * Generic cURL Error |
||
| 82 | * |
||
| 83 | * @package Exceptions |
||
| 84 | */ |
||
| 85 | class CURLError extends Exception { |
||
| 86 | private $errno; |
||
| 87 | private $error; |
||
| 88 | |||
| 89 | /** |
||
| 90 | * @param integer $errno |
||
| 91 | * @param string $error |
||
| 92 | */ |
||
| 93 | public function __construct( $errno, $error ) { |
||
| 94 | $this->errno = $errno; |
||
| 95 | $this->error = $error; |
||
| 96 | |||
| 97 | parent::__construct( |
||
| 98 | "cURL Error (" . $this->errno . "): " . $this->error |
||
| 99 | ); |
||
| 100 | } |
||
| 101 | |||
| 102 | public function get_errno() { |
||
| 103 | return $this->errno; |
||
| 104 | } |
||
| 105 | |||
| 106 | public function get_error() { |
||
| 107 | return $this->error; |
||
| 108 | } |
||
| 109 | |||
| 110 | } |
||
| 111 | |||
| 112 | /** |
||
| 113 | * Invalid Title Error |
||
| 114 | * |
||
| 115 | * @package Exceptions |
||
| 116 | */ |
||
| 117 | class BadTitle extends Exception { |
||
| 118 | |||
| 119 | private $title; |
||
| 120 | |||
| 121 | public function __construct( $title ) { |
||
| 122 | $this->title = $title; |
||
| 123 | parent::__construct( |
||
| 124 | "Invalid title: $title" |
||
| 125 | ); |
||
| 126 | |||
| 127 | } |
||
| 128 | |||
| 129 | public function getTitle() { |
||
| 130 | return $this->title; |
||
| 131 | } |
||
| 132 | } |
||
| 133 | |||
| 134 | /** |
||
| 135 | * No Title Error |
||
| 136 | * |
||
| 137 | * @package Exceptions |
||
| 138 | */ |
||
| 139 | class NoTitle extends Exception { |
||
| 140 | |||
| 141 | public function __construct() { |
||
| 142 | parent::__construct( |
||
| 143 | "No title or pageid stated when instantiating Page class" |
||
| 144 | ); |
||
| 145 | |||
| 146 | } |
||
| 147 | } |
||
| 148 | |||
| 149 | /** |
||
| 150 | * No User Error |
||
| 151 | * |
||
| 152 | * @package Exceptions |
||
| 153 | */ |
||
| 154 | class NoUser extends Exception { |
||
| 155 | |||
| 156 | public function __construct( $title ) { |
||
| 157 | parent::__construct( |
||
| 158 | "Non-existant user: $title" |
||
| 159 | ); |
||
| 160 | |||
| 161 | } |
||
| 162 | } |
||
| 163 | |||
| 164 | /** |
||
| 165 | * Blocked User Error |
||
| 166 | * |
||
| 167 | * @package Exceptions |
||
| 168 | */ |
||
| 169 | class UserBlocked extends Exception { |
||
| 170 | |||
| 171 | public function __construct( $pgUsername = "User" ) { |
||
| 172 | parent::__construct( |
||
| 173 | $pgUsername . " is currently blocked." |
||
| 174 | ); |
||
| 175 | |||
| 176 | } |
||
| 177 | |||
| 178 | } |
||
| 179 | |||
| 180 | /** |
||
| 181 | * Logged Out Error |
||
| 182 | * |
||
| 183 | * @package Exceptions |
||
| 184 | */ |
||
| 185 | class LoggedOut extends Exception { |
||
| 186 | |||
| 187 | public function __construct() { |
||
| 188 | parent::__construct( |
||
| 189 | "User is not logged in." |
||
| 190 | ); |
||
| 191 | |||
| 192 | } |
||
| 193 | |||
| 194 | } |
||
| 195 | |||
| 196 | /** |
||
| 197 | * Missing DependencyError Error |
||
| 198 | * |
||
| 199 | * @package Exceptions |
||
| 200 | */ |
||
| 201 | class DependencyError extends Exception { |
||
| 202 | |||
| 203 | public function __construct( $software, $url = false ) { |
||
| 204 | $message = "Missing dependency: \`" . $software . "\`. "; |
||
| 205 | if( $url ) $message .= "Download from <$url>"; |
||
| 206 | parent::__construct( |
||
| 207 | $message |
||
| 208 | ); |
||
| 209 | |||
| 210 | } |
||
| 211 | |||
| 212 | } |
||
| 213 | |||
| 214 | /** |
||
| 215 | * Misspelling of "dependency", used for backwards compatibility |
||
| 216 | * |
||
| 217 | * @package Exceptions |
||
| 218 | * @deprecated since 31 Jan 2014 |
||
| 219 | */ |
||
| 220 | class DependancyError extends DependencyError { |
||
| 221 | public function __construct( $software, $url = false ) { |
||
| 222 | parent::__construct( $software, $url ); |
||
| 223 | } |
||
| 224 | } |
||
| 225 | |||
| 226 | /** |
||
| 227 | * Login Error |
||
| 228 | * |
||
| 229 | * @package Exceptions |
||
| 230 | */ |
||
| 231 | class LoginError extends Exception { |
||
| 232 | |||
| 233 | /** |
||
| 234 | * @param string[] $error |
||
| 235 | */ |
||
| 236 | public function __construct( $error ) { |
||
| 237 | parent::__construct( |
||
| 238 | "Login Error: " . $error[0] . " (" . $error[1] . ")" |
||
| 239 | ); |
||
| 240 | } |
||
| 241 | } |
||
| 242 | |||
| 243 | /** |
||
| 244 | * Peachy Hook Error |
||
| 245 | * |
||
| 246 | * @package Exceptions |
||
| 247 | * @package Peachy_Hooks |
||
| 248 | */ |
||
| 249 | class HookError extends Exception { |
||
| 250 | public function __construct( $error ) { |
||
| 251 | parent::__construct( |
||
| 252 | "Hook Error: " . $error |
||
| 253 | ); |
||
| 254 | } |
||
| 255 | } |
||
| 256 | |||
| 257 | /** |
||
| 258 | * Generic Database Error |
||
| 259 | * |
||
| 260 | * @package Exceptions |
||
| 261 | * @package Peachy_Database |
||
| 262 | */ |
||
| 263 | class DBError extends Exception { |
||
| 264 | |||
| 265 | /** |
||
| 266 | * @param string $sql |
||
| 267 | */ |
||
| 268 | public function __construct( $error, $errno, $sql = null ) { |
||
| 269 | parent::__construct( |
||
| 270 | "Database Error: " . $error . " (code $errno) " . $sql |
||
| 271 | ); |
||
| 272 | } |
||
| 273 | } |
||
| 274 | |||
| 275 | /** |
||
| 276 | * Generic Edit Error |
||
| 277 | * |
||
| 278 | * @package Exceptions |
||
| 279 | */ |
||
| 280 | class EditError extends Exception { |
||
| 281 | |||
| 282 | /** |
||
| 283 | * @param string $error |
||
| 284 | * @param string $text |
||
| 285 | */ |
||
| 286 | public function __construct( $error, $text ) { |
||
| 287 | parent::__construct( |
||
| 288 | "Edit Error: " . $error . " ($text)" |
||
| 289 | ); |
||
| 290 | } |
||
| 291 | } |
||
| 292 | |||
| 293 | /** |
||
| 294 | * Generic Move Error |
||
| 295 | * |
||
| 296 | * @package Exceptions |
||
| 297 | */ |
||
| 298 | class MoveError extends Exception { |
||
| 299 | public function __construct( $error, $text ) { |
||
| 300 | parent::__construct( |
||
| 301 | "Move Error: " . $error . " ($text)" |
||
| 302 | ); |
||
| 303 | } |
||
| 304 | } |
||
| 305 | |||
| 306 | /** |
||
| 307 | * Generic Delete Error |
||
| 308 | * |
||
| 309 | * @package Exceptions |
||
| 310 | */ |
||
| 311 | class DeleteError extends Exception { |
||
| 312 | public function __construct( $error, $text ) { |
||
| 313 | parent::__construct( |
||
| 314 | "Delete Error: " . $error . " ($text)" |
||
| 315 | ); |
||
| 316 | } |
||
| 317 | } |
||
| 318 | |||
| 319 | /** |
||
| 320 | * Generic Undelete Error |
||
| 321 | * |
||
| 322 | * @package Exceptions |
||
| 323 | */ |
||
| 324 | class UndeleteError extends Exception { |
||
| 325 | public function __construct( $error, $text ) { |
||
| 326 | parent::__construct( |
||
| 327 | "Undelete Error: " . $error . " ($text)" |
||
| 328 | ); |
||
| 329 | } |
||
| 330 | } |
||
| 331 | |||
| 332 | /** |
||
| 333 | * Generic Protect Error |
||
| 334 | * |
||
| 335 | * @package Exceptions |
||
| 336 | */ |
||
| 337 | class ProtectError extends Exception { |
||
| 338 | public function __construct( $error, $text ) { |
||
| 339 | parent::__construct( |
||
| 340 | "Protect Error: " . $error . " ($text)" |
||
| 341 | ); |
||
| 342 | } |
||
| 343 | } |
||
| 344 | |||
| 345 | /** |
||
| 346 | * Generic Email Error |
||
| 347 | * |
||
| 348 | * @package Exceptions |
||
| 349 | */ |
||
| 350 | class EmailError extends Exception { |
||
| 351 | public function __construct( $error, $text ) { |
||
| 352 | parent::__construct( |
||
| 353 | "Email Error: " . $error . " ($text)" |
||
| 354 | ); |
||
| 355 | } |
||
| 356 | } |
||
| 357 | |||
| 358 | /** |
||
| 359 | * Generic Image Error |
||
| 360 | * |
||
| 361 | * @package Exceptions |
||
| 362 | */ |
||
| 363 | class ImageError extends Exception { |
||
| 364 | public function __construct( $error ) { |
||
| 365 | parent::__construct( |
||
| 366 | "Image Error: " . $error |
||
| 367 | ); |
||
| 368 | } |
||
| 369 | } |
||
| 370 | |||
| 371 | /** |
||
| 372 | * Error for wrong parameters in a function |
||
| 373 | * |
||
| 374 | * @package Exceptions |
||
| 375 | */ |
||
| 376 | class BadEntryError extends Exception { |
||
| 377 | |||
| 378 | /** |
||
| 379 | * @param string $error |
||
| 380 | */ |
||
| 381 | public function __construct( $error, $text ) { |
||
| 382 | parent::__construct( |
||
| 383 | "Bad Entry Error: " . $error . " ($text)" |
||
| 384 | ); |
||
| 385 | } |
||
| 386 | } |
||
| 387 | |||
| 388 | /** |
||
| 389 | * Generic XML Error |
||
| 390 | * |
||
| 391 | * @package Exceptions |
||
| 392 | * @package XML |
||
| 393 | */ |
||
| 394 | class XMLError extends Exception { |
||
| 395 | public function __construct( $error ) { |
||
| 396 | parent::__construct( |
||
| 397 | "XML Error: " . $error |
||
| 398 | ); |
||
| 399 | } |
||
| 400 | } |
||
| 401 | |||
| 402 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()method in theSoncalls the wrong method in the parent class.