@@ -280,11 +280,15 @@ discard block |
||
| 280 | 280 | function canLoginWith($provider) |
| 281 | 281 | { |
| 282 | 282 | $hosts = $this->getLoginProviders(); |
| 283 | - if($hosts === false) return false; |
|
| 283 | + if($hosts === false) { |
|
| 284 | + return false; |
|
| 285 | + } |
|
| 284 | 286 | $count = count($hosts); |
| 285 | 287 | for($i = 0; $i < $count; $i++) |
| 286 | 288 | { |
| 287 | - if(strcasecmp($hosts[$i], $provider) === 0) return true; |
|
| 289 | + if(strcasecmp($hosts[$i], $provider) === 0) { |
|
| 290 | + return true; |
|
| 291 | + } |
|
| 288 | 292 | } |
| 289 | 293 | return false; |
| 290 | 294 | } |
@@ -607,8 +611,7 @@ discard block |
||
| 607 | 611 | $this->change_pass($data->oldpass, $data->password); |
| 608 | 612 | unset($data->oldpass); |
| 609 | 613 | unset($data->password); |
| 610 | - } |
|
| 611 | - else if(isset($data->hash) && isset($data->password)) |
|
| 614 | + } else if(isset($data->hash) && isset($data->password)) |
|
| 612 | 615 | { |
| 613 | 616 | $this->change_pass($data->hash, $data->password, true); |
| 614 | 617 | return; |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @param string $name The name of the group to check if the user is in |
| 33 | 33 | * |
| 34 | - * @return true|false True if the user is in the group, false otherwise |
|
| 34 | + * @return boolean True if the user is in the group, false otherwise |
|
| 35 | 35 | */ |
| 36 | 36 | function isInGroupNamed($name) |
| 37 | 37 | { |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | /** |
| 42 | 42 | * The name the user should be displayed as |
| 43 | 43 | * |
| 44 | - * @return string The name the user should be displayed as |
|
| 44 | + * @return boolean The name the user should be displayed as |
|
| 45 | 45 | */ |
| 46 | 46 | function getDisplayName() |
| 47 | 47 | { |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | /** |
| 52 | 52 | * The given (or first) name for the user |
| 53 | 53 | * |
| 54 | - * @return string The user's first name |
|
| 54 | + * @return boolean The user's first name |
|
| 55 | 55 | */ |
| 56 | 56 | function getGivenName() |
| 57 | 57 | { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | /** |
| 62 | 62 | * The email address for the user |
| 63 | 63 | * |
| 64 | - * @return string The user's email address |
|
| 64 | + * @return boolean The user's email address |
|
| 65 | 65 | */ |
| 66 | 66 | function getEmail() |
| 67 | 67 | { |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | /** |
| 72 | 72 | * The user ID for the user |
| 73 | 73 | * |
| 74 | - * @return string The user's ID or username |
|
| 74 | + * @return boolean The user's ID or username |
|
| 75 | 75 | */ |
| 76 | 76 | function getUid() |
| 77 | 77 | { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | /** |
| 82 | 82 | * The photo for the user |
| 83 | 83 | * |
| 84 | - * @return string The user's photo as a binary string |
|
| 84 | + * @return boolean The user's photo as a binary string |
|
| 85 | 85 | */ |
| 86 | 86 | function getPhoto() |
| 87 | 87 | { |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | /** |
| 92 | 92 | * The phone number for the user |
| 93 | 93 | * |
| 94 | - * @return false|string The user's phone number |
|
| 94 | + * @return boolean The user's phone number |
|
| 95 | 95 | */ |
| 96 | 96 | function getPhoneNumber() |
| 97 | 97 | { |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | /** |
| 102 | 102 | * The organziation for the user |
| 103 | 103 | * |
| 104 | - * @return false|string The user's organization |
|
| 104 | + * @return boolean The user's organization |
|
| 105 | 105 | */ |
| 106 | 106 | function getOrganization() |
| 107 | 107 | { |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | /** |
| 112 | 112 | * The list of titles for the user |
| 113 | 113 | * |
| 114 | - * @return array The user's title(s) in short format |
|
| 114 | + * @return boolean The user's title(s) in short format |
|
| 115 | 115 | */ |
| 116 | 116 | function getTitles() |
| 117 | 117 | { |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | /** |
| 122 | 122 | * The list of titles for the user |
| 123 | 123 | * |
| 124 | - * @return array The user's title(s) in user friendly strings |
|
| 124 | + * @return boolean The user's title(s) in user friendly strings |
|
| 125 | 125 | * |
| 126 | 126 | * @SuppressWarnings("StaticAccess") |
| 127 | 127 | */ |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | /** |
| 160 | 160 | * The state the user's mailing address is in |
| 161 | 161 | * |
| 162 | - * @return string The user's state from their mailing address |
|
| 162 | + * @return boolean The user's state from their mailing address |
|
| 163 | 163 | */ |
| 164 | 164 | function getState() |
| 165 | 165 | { |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | /** |
| 170 | 170 | * The city the user's mailing address is in |
| 171 | 171 | * |
| 172 | - * @return string The user's city from their mailing address |
|
| 172 | + * @return boolean The user's city from their mailing address |
|
| 173 | 173 | */ |
| 174 | 174 | function getCity() |
| 175 | 175 | { |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | /** |
| 180 | 180 | * The last name for the user |
| 181 | 181 | * |
| 182 | - * @return string The user's last name |
|
| 182 | + * @return boolean The user's last name |
|
| 183 | 183 | */ |
| 184 | 184 | function getLastName() |
| 185 | 185 | { |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | /** |
| 190 | 190 | * The nick name for the user |
| 191 | 191 | * |
| 192 | - * @return string The user's nick name |
|
| 192 | + * @return boolean The user's nick name |
|
| 193 | 193 | */ |
| 194 | 194 | function getNickName() |
| 195 | 195 | { |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | /** |
| 200 | 200 | * The street address for the user |
| 201 | 201 | * |
| 202 | - * @return string The user's street address |
|
| 202 | + * @return boolean The user's street address |
|
| 203 | 203 | */ |
| 204 | 204 | function getAddress() |
| 205 | 205 | { |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | /** |
| 210 | 210 | * The postal (zip) code for the user's mailing address |
| 211 | 211 | * |
| 212 | - * @return string The user's postal code |
|
| 212 | + * @return boolean The user's postal code |
|
| 213 | 213 | */ |
| 214 | 214 | function getPostalCode() |
| 215 | 215 | { |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | /** |
| 220 | 220 | * The country the user's mailing address is in |
| 221 | 221 | * |
| 222 | - * @return string The user's country from their mailing address |
|
| 222 | + * @return boolean The user's country from their mailing address |
|
| 223 | 223 | */ |
| 224 | 224 | function getCountry() |
| 225 | 225 | { |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * This is the same as Areas in Flipside speak. |
| 233 | 233 | * |
| 234 | - * @return array The user's orgnaiational units |
|
| 234 | + * @return boolean The user's orgnaiational units |
|
| 235 | 235 | */ |
| 236 | 236 | function getOrganizationUnits() |
| 237 | 237 | { |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | /** |
| 242 | 242 | * The supplemental login types that the user can use to login |
| 243 | 243 | * |
| 244 | - * @return array The user's login providers |
|
| 244 | + * @return boolean The user's login providers |
|
| 245 | 245 | */ |
| 246 | 246 | function getLoginProviders() |
| 247 | 247 | { |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | /** |
| 252 | 252 | * The groups the user is a part of |
| 253 | 253 | * |
| 254 | - * @return false|array The user's Auth\Group structures |
|
| 254 | + * @return boolean The user's Auth\Group structures |
|
| 255 | 255 | */ |
| 256 | 256 | function getGroups() |
| 257 | 257 | { |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | * |
| 276 | 276 | * @param string $provider The hostname for the provider |
| 277 | 277 | * |
| 278 | - * @return true|false true if they can login with the provider, false otherwise |
|
| 278 | + * @return boolean true if they can login with the provider, false otherwise |
|
| 279 | 279 | */ |
| 280 | 280 | function canLoginWith($provider) |
| 281 | 281 | { |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | * |
| 295 | 295 | * @param string $password The new user password |
| 296 | 296 | * |
| 297 | - * @return true|false true if the user's password was changed, false otherwise |
|
| 297 | + * @return boolean true if the user's password was changed, false otherwise |
|
| 298 | 298 | */ |
| 299 | 299 | protected function setPass($password) |
| 300 | 300 | { |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | /** |
| 305 | 305 | * Has the user completely filled out their user profile? |
| 306 | 306 | * |
| 307 | - * @return true|false true if the user's profile is complete, false otherwise |
|
| 307 | + * @return boolean true if the user's profile is complete, false otherwise |
|
| 308 | 308 | */ |
| 309 | 309 | function isProfileComplete() |
| 310 | 310 | { |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | * |
| 323 | 323 | * @param string $password The user's current password |
| 324 | 324 | * |
| 325 | - * @return true|false true if the user's password is correct, false otherwise |
|
| 325 | + * @return boolean true if the user's password is correct, false otherwise |
|
| 326 | 326 | * |
| 327 | 327 | * @SuppressWarnings("UnusedFormalParameter") |
| 328 | 328 | */ |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | * |
| 337 | 337 | * @param string $hash The user's reset hash |
| 338 | 338 | * |
| 339 | - * @return true|false true if the user's hash is correct, false otherwise |
|
| 339 | + * @return boolean true if the user's hash is correct, false otherwise |
|
| 340 | 340 | * |
| 341 | 341 | * @SuppressWarnings("UnusedFormalParameter") |
| 342 | 342 | */ |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | * @param string $newpass The user's new password |
| 353 | 353 | * @param boolean $isHash Is $old_pass a password or a hash |
| 354 | 354 | * |
| 355 | - * @return true|false true if the user's password was changed, false otherwise |
|
| 355 | + * @return boolean true if the user's password was changed, false otherwise |
|
| 356 | 356 | */ |
| 357 | 357 | function change_pass($oldpass, $newpass, $isHash=false) |
| 358 | 358 | { |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | * |
| 377 | 377 | * @param string $name The user's new display name |
| 378 | 378 | * |
| 379 | - * @return true|false true if the user's display name was changed, false otherwise |
|
| 379 | + * @return boolean true if the user's display name was changed, false otherwise |
|
| 380 | 380 | */ |
| 381 | 381 | function setDisplayName($name) |
| 382 | 382 | { |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | * |
| 389 | 389 | * @param string $name The user's new given name |
| 390 | 390 | * |
| 391 | - * @return true|false true if the user's given name was changed, false otherwise |
|
| 391 | + * @return boolean true if the user's given name was changed, false otherwise |
|
| 392 | 392 | */ |
| 393 | 393 | function setGivenName($name) |
| 394 | 394 | { |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | * |
| 401 | 401 | * @param string $email The user's new email address |
| 402 | 402 | * |
| 403 | - * @return true|false true if the user's email address was changed, false otherwise |
|
| 403 | + * @return boolean true if the user's email address was changed, false otherwise |
|
| 404 | 404 | * |
| 405 | 405 | * @SuppressWarnings("UnusedFormalParameter") |
| 406 | 406 | */ |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | * |
| 415 | 415 | * @param string $uid The user's new user ID |
| 416 | 416 | * |
| 417 | - * @return true|false true if the user's ID was changed, false otherwise |
|
| 417 | + * @return boolean true if the user's ID was changed, false otherwise |
|
| 418 | 418 | * |
| 419 | 419 | * @SuppressWarnings("UnusedFormalParameter") |
| 420 | 420 | */ |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | * |
| 429 | 429 | * @param string $photo The user's new photo as a binary string |
| 430 | 430 | * |
| 431 | - * @return true|false true if the user's photo was changed, false otherwise |
|
| 431 | + * @return boolean true if the user's photo was changed, false otherwise |
|
| 432 | 432 | * |
| 433 | 433 | * @SuppressWarnings("UnusedFormalParameter") |
| 434 | 434 | */ |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | * |
| 443 | 443 | * @param string $phone The user's new phonew number |
| 444 | 444 | * |
| 445 | - * @return true|false true if the user's phone number was changed, false otherwise |
|
| 445 | + * @return boolean true if the user's phone number was changed, false otherwise |
|
| 446 | 446 | * |
| 447 | 447 | * @SuppressWarnings("UnusedFormalParameter") |
| 448 | 448 | */ |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | * |
| 457 | 457 | * @param string $org The user's new organization |
| 458 | 458 | * |
| 459 | - * @return true|false true if the user's organization was changed, false otherwise |
|
| 459 | + * @return boolean true if the user's organization was changed, false otherwise |
|
| 460 | 460 | * |
| 461 | 461 | * @SuppressWarnings("UnusedFormalParameter") |
| 462 | 462 | */ |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | * |
| 471 | 471 | * @param string $titles The user's new titles |
| 472 | 472 | * |
| 473 | - * @return true|false true if the user's titles were changed, false otherwise |
|
| 473 | + * @return boolean true if the user's titles were changed, false otherwise |
|
| 474 | 474 | * |
| 475 | 475 | * @SuppressWarnings("UnusedFormalParameter") |
| 476 | 476 | */ |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | * |
| 485 | 485 | * @param string $state The user's new state |
| 486 | 486 | * |
| 487 | - * @return true|false true if the user's state was changed, false otherwise |
|
| 487 | + * @return boolean true if the user's state was changed, false otherwise |
|
| 488 | 488 | * |
| 489 | 489 | * @SuppressWarnings("UnusedFormalParameter") |
| 490 | 490 | */ |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | * |
| 499 | 499 | * @param string $city The user's new city |
| 500 | 500 | * |
| 501 | - * @return true|false true if the user's city was changed, false otherwise |
|
| 501 | + * @return boolean true if the user's city was changed, false otherwise |
|
| 502 | 502 | * |
| 503 | 503 | * @SuppressWarnings("UnusedFormalParameter") |
| 504 | 504 | */ |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | * |
| 513 | 513 | * @param string $sn The user's new last name |
| 514 | 514 | * |
| 515 | - * @return true|false true if the user's last name was changed, false otherwise |
|
| 515 | + * @return boolean true if the user's last name was changed, false otherwise |
|
| 516 | 516 | * |
| 517 | 517 | * @SuppressWarnings("UnusedFormalParameter") |
| 518 | 518 | */ |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | * |
| 527 | 527 | * @param string $displayName The user's new nick name |
| 528 | 528 | * |
| 529 | - * @return true|false true if the user's nick name was changed, false otherwise |
|
| 529 | + * @return boolean true if the user's nick name was changed, false otherwise |
|
| 530 | 530 | */ |
| 531 | 531 | function setNickName($displayName) |
| 532 | 532 | { |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | * |
| 539 | 539 | * @param string $address The user's new mailing address |
| 540 | 540 | * |
| 541 | - * @return true|false true if the user's mailing address was changed, false otherwise |
|
| 541 | + * @return boolean true if the user's mailing address was changed, false otherwise |
|
| 542 | 542 | * |
| 543 | 543 | * @SuppressWarnings("UnusedFormalParameter") |
| 544 | 544 | */ |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | * |
| 553 | 553 | * @param string $postalcode The user's new postal code |
| 554 | 554 | * |
| 555 | - * @return true|false true if the user's postal code was changed, false otherwise |
|
| 555 | + * @return boolean true if the user's postal code was changed, false otherwise |
|
| 556 | 556 | * |
| 557 | 557 | * @SuppressWarnings("UnusedFormalParameter") |
| 558 | 558 | */ |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | * |
| 567 | 567 | * @param string $country The user's new country |
| 568 | 568 | * |
| 569 | - * @return true|false true if the user's country was changed, false otherwise |
|
| 569 | + * @return boolean true if the user's country was changed, false otherwise |
|
| 570 | 570 | * |
| 571 | 571 | * @SuppressWarnings("UnusedFormalParameter") |
| 572 | 572 | */ |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | * |
| 581 | 581 | * @param string $ous The user's new organizations |
| 582 | 582 | * |
| 583 | - * @return true|false true if the user's organizations was changed, false otherwise |
|
| 583 | + * @return boolean true if the user's organizations was changed, false otherwise |
|
| 584 | 584 | * |
| 585 | 585 | * @SuppressWarnings("UnusedFormalParameter") |
| 586 | 586 | */ |
@@ -704,7 +704,7 @@ discard block |
||
| 704 | 704 | /** |
| 705 | 705 | * Obtain the user's password reset hash |
| 706 | 706 | * |
| 707 | - * @return string|false A hash if available, false otherwise |
|
| 707 | + * @return boolean A hash if available, false otherwise |
|
| 708 | 708 | */ |
| 709 | 709 | public function getPasswordResetHash() |
| 710 | 710 | { |
@@ -128,26 +128,26 @@ discard block |
||
| 128 | 128 | public function getTitleNames() |
| 129 | 129 | { |
| 130 | 130 | $titles = $this->getTitles(); |
| 131 | - if($titles === false) |
|
| 131 | + if ($titles === false) |
|
| 132 | 132 | { |
| 133 | 133 | return false; |
| 134 | 134 | } |
| 135 | - if(self::$titlenames === null) |
|
| 135 | + if (self::$titlenames === null) |
|
| 136 | 136 | { |
| 137 | 137 | $dataSet = \DataSetFactory::getDataSetByName('profiles'); |
| 138 | 138 | $dataTable = $dataSet['position']; |
| 139 | 139 | $titlenames = $dataTable->read(); |
| 140 | 140 | self::$titlenames = array(); |
| 141 | 141 | $count = count($titlenames); |
| 142 | - for($i = 0; $i < $count; $i++) |
|
| 142 | + for ($i = 0; $i < $count; $i++) |
|
| 143 | 143 | { |
| 144 | 144 | self::$titlenames[$titlenames[$i]['short_name']] = $titlenames[$i]; |
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | $count = count($titles); |
| 148 | - for($i = 0; $i < $count; $i++) |
|
| 148 | + for ($i = 0; $i < $count; $i++) |
|
| 149 | 149 | { |
| 150 | - if(isset(self::$titlenames[$titles[$i]])) |
|
| 150 | + if (isset(self::$titlenames[$titles[$i]])) |
|
| 151 | 151 | { |
| 152 | 152 | $title = self::$titlenames[$titles[$i]]; |
| 153 | 153 | $titles[$i] = $title['name']; |
@@ -280,11 +280,11 @@ discard block |
||
| 280 | 280 | public function canLoginWith($provider) |
| 281 | 281 | { |
| 282 | 282 | $hosts = $this->getLoginProviders(); |
| 283 | - if($hosts === false) return false; |
|
| 283 | + if ($hosts === false) return false; |
|
| 284 | 284 | $count = count($hosts); |
| 285 | - for($i = 0; $i < $count; $i++) |
|
| 285 | + for ($i = 0; $i < $count; $i++) |
|
| 286 | 286 | { |
| 287 | - if(strcasecmp($hosts[$i], $provider) === 0) return true; |
|
| 287 | + if (strcasecmp($hosts[$i], $provider) === 0) return true; |
|
| 288 | 288 | } |
| 289 | 289 | return false; |
| 290 | 290 | } |
@@ -308,9 +308,9 @@ discard block |
||
| 308 | 308 | */ |
| 309 | 309 | public function isProfileComplete() |
| 310 | 310 | { |
| 311 | - if($this->getCountry() === false || $this->getAddress() === false || |
|
| 311 | + if ($this->getCountry() === false || $this->getAddress() === false || |
|
| 312 | 312 | $this->getPostalCode() === false || $this->getCity() === false || |
| 313 | - $this->getState() === false || $this->getPhoneNumber() === false) |
|
| 313 | + $this->getState() === false || $this->getPhoneNumber() === false) |
|
| 314 | 314 | { |
| 315 | 315 | return false; |
| 316 | 316 | } |
@@ -354,17 +354,17 @@ discard block |
||
| 354 | 354 | * |
| 355 | 355 | * @return true|false true if the user's password was changed, false otherwise |
| 356 | 356 | */ |
| 357 | - public function change_pass($oldpass, $newpass, $isHash=false) |
|
| 357 | + public function change_pass($oldpass, $newpass, $isHash = false) |
|
| 358 | 358 | { |
| 359 | - if($isHash === false && $this->validate_password($oldpass) === false) |
|
| 359 | + if ($isHash === false && $this->validate_password($oldpass) === false) |
|
| 360 | 360 | { |
| 361 | 361 | throw new \Exception('Invalid Password!', 3); |
| 362 | 362 | } |
| 363 | - if($isHash === true && $this->validate_reset_hash($oldpass) === false) |
|
| 363 | + if ($isHash === true && $this->validate_reset_hash($oldpass) === false) |
|
| 364 | 364 | { |
| 365 | 365 | throw new \Exception('Invalid Reset Hash!', 3); |
| 366 | 366 | } |
| 367 | - if($this->setPass($newpass) === false) |
|
| 367 | + if ($this->setPass($newpass) === false) |
|
| 368 | 368 | { |
| 369 | 369 | throw new \Exception('Unable to set password!', 6); |
| 370 | 370 | } |
@@ -602,99 +602,99 @@ discard block |
||
| 602 | 602 | $auth = \AuthProvider::getInstance(); |
| 603 | 603 | $ldap = $auth->getAuthenticator('Auth\LDAPAuthenticator'); |
| 604 | 604 | $ldap->get_and_bind_server(true); |
| 605 | - if(isset($data->oldpass) && isset($data->password)) |
|
| 605 | + if (isset($data->oldpass) && isset($data->password)) |
|
| 606 | 606 | { |
| 607 | 607 | $this->change_pass($data->oldpass, $data->password); |
| 608 | 608 | unset($data->oldpass); |
| 609 | 609 | unset($data->password); |
| 610 | 610 | } |
| 611 | - else if(isset($data->hash) && isset($data->password)) |
|
| 611 | + else if (isset($data->hash) && isset($data->password)) |
|
| 612 | 612 | { |
| 613 | 613 | $this->change_pass($data->hash, $data->password, true); |
| 614 | 614 | return; |
| 615 | 615 | } |
| 616 | - if(isset($data->displayName)) |
|
| 616 | + if (isset($data->displayName)) |
|
| 617 | 617 | { |
| 618 | 618 | $this->setDisplayName($data->displayName); |
| 619 | 619 | unset($data->displayName); |
| 620 | 620 | } |
| 621 | - if(isset($data->givenName)) |
|
| 621 | + if (isset($data->givenName)) |
|
| 622 | 622 | { |
| 623 | 623 | $this->setGivenName($data->givenName); |
| 624 | 624 | unset($data->givenName); |
| 625 | 625 | } |
| 626 | - if(isset($data->jpegPhoto)) |
|
| 626 | + if (isset($data->jpegPhoto)) |
|
| 627 | 627 | { |
| 628 | 628 | $this->setPhoto(base64_decode($data->jpegPhoto)); |
| 629 | 629 | unset($data->jpegPhoto); |
| 630 | 630 | } |
| 631 | - if(isset($data->mail)) |
|
| 631 | + if (isset($data->mail)) |
|
| 632 | 632 | { |
| 633 | - if($data->mail !== $this->getEmail()) |
|
| 633 | + if ($data->mail !== $this->getEmail()) |
|
| 634 | 634 | { |
| 635 | 635 | throw new \Exception('Unable to change email!'); |
| 636 | 636 | } |
| 637 | 637 | unset($data->mail); |
| 638 | 638 | } |
| 639 | - if(isset($data->uid)) |
|
| 639 | + if (isset($data->uid)) |
|
| 640 | 640 | { |
| 641 | - if($data->uid !== $this->getUid()) |
|
| 641 | + if ($data->uid !== $this->getUid()) |
|
| 642 | 642 | { |
| 643 | 643 | throw new \Exception('Unable to change uid!'); |
| 644 | 644 | } |
| 645 | 645 | unset($data->uid); |
| 646 | 646 | } |
| 647 | - if(isset($data->mobile)) |
|
| 647 | + if (isset($data->mobile)) |
|
| 648 | 648 | { |
| 649 | 649 | $this->setPhoneNumber($data->mobile); |
| 650 | 650 | unset($data->mobile); |
| 651 | 651 | } |
| 652 | - if(isset($data->o)) |
|
| 652 | + if (isset($data->o)) |
|
| 653 | 653 | { |
| 654 | 654 | $this->setOrganization($data->o); |
| 655 | 655 | unset($data->o); |
| 656 | 656 | } |
| 657 | - if(isset($data->title)) |
|
| 657 | + if (isset($data->title)) |
|
| 658 | 658 | { |
| 659 | 659 | $this->setTitles($data->title); |
| 660 | 660 | unset($data->title); |
| 661 | 661 | } |
| 662 | - if(isset($data->st)) |
|
| 662 | + if (isset($data->st)) |
|
| 663 | 663 | { |
| 664 | 664 | $this->setState($data->st); |
| 665 | 665 | unset($data->st); |
| 666 | 666 | } |
| 667 | - if(isset($data->l)) |
|
| 667 | + if (isset($data->l)) |
|
| 668 | 668 | { |
| 669 | 669 | $this->setCity($data->l); |
| 670 | 670 | unset($data->l); |
| 671 | 671 | } |
| 672 | - if(isset($data->sn)) |
|
| 672 | + if (isset($data->sn)) |
|
| 673 | 673 | { |
| 674 | 674 | $this->setLastName($data->sn); |
| 675 | 675 | unset($data->sn); |
| 676 | 676 | } |
| 677 | - if(isset($data->cn)) |
|
| 677 | + if (isset($data->cn)) |
|
| 678 | 678 | { |
| 679 | 679 | $this->setNickName($data->cn); |
| 680 | 680 | unset($data->cn); |
| 681 | 681 | } |
| 682 | - if(isset($data->postalAddress)) |
|
| 682 | + if (isset($data->postalAddress)) |
|
| 683 | 683 | { |
| 684 | 684 | $this->setAddress($data->postalAddress); |
| 685 | 685 | unset($data->postalAddress); |
| 686 | 686 | } |
| 687 | - if(isset($data->postalCode)) |
|
| 687 | + if (isset($data->postalCode)) |
|
| 688 | 688 | { |
| 689 | 689 | $this->setPostalCode($data->postalCode); |
| 690 | 690 | unset($data->postalCode); |
| 691 | 691 | } |
| 692 | - if(isset($data->c)) |
|
| 692 | + if (isset($data->c)) |
|
| 693 | 693 | { |
| 694 | 694 | $this->setCountry($data->c); |
| 695 | 695 | unset($data->c); |
| 696 | 696 | } |
| 697 | - if(isset($data->ou)) |
|
| 697 | + if (isset($data->ou)) |
|
| 698 | 698 | { |
| 699 | 699 | $this->setOrganizationUnits($data->ou); |
| 700 | 700 | unset($data->ou); |
@@ -749,13 +749,13 @@ discard block |
||
| 749 | 749 | public function getVcard() |
| 750 | 750 | { |
| 751 | 751 | $ret = "BEGIN:VCARD\nVERSION:2.1\n"; |
| 752 | - $ret.= 'N:'.$this->getLastName().';'.$this->getGivenName()."\n"; |
|
| 753 | - $ret.= 'FN:'.$this->getGivenName()."\n"; |
|
| 754 | - $ret.= 'TITLE:'.implode(',', $this->getTitles())."\n"; |
|
| 755 | - $ret.= "ORG: Austin Artistic Reconstruction\n"; |
|
| 756 | - $ret.= 'TEL;TYPE=MOBILE,VOICE:'.$this->getPhoneNumber()."\n"; |
|
| 757 | - $ret.= 'EMAIL;TYPE=PREF,INTERNET:'.$this->getEmail()."\n"; |
|
| 758 | - $ret.= "END:VCARD\n"; |
|
| 752 | + $ret .= 'N:'.$this->getLastName().';'.$this->getGivenName()."\n"; |
|
| 753 | + $ret .= 'FN:'.$this->getGivenName()."\n"; |
|
| 754 | + $ret .= 'TITLE:'.implode(',', $this->getTitles())."\n"; |
|
| 755 | + $ret .= "ORG: Austin Artistic Reconstruction\n"; |
|
| 756 | + $ret .= 'TEL;TYPE=MOBILE,VOICE:'.$this->getPhoneNumber()."\n"; |
|
| 757 | + $ret .= 'EMAIL;TYPE=PREF,INTERNET:'.$this->getEmail()."\n"; |
|
| 758 | + $ret .= "END:VCARD\n"; |
|
| 759 | 759 | return $ret; |
| 760 | 760 | } |
| 761 | 761 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | private function getUserFromSession() |
| 27 | 27 | { |
| 28 | - if(FlipSession::isLoggedIn()) |
|
| 28 | + if (FlipSession::isLoggedIn()) |
|
| 29 | 29 | { |
| 30 | 30 | return FlipSession::getUser(); |
| 31 | 31 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $auth = \AuthProvider::getInstance(); |
| 42 | 42 | $auth->login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']); |
| 43 | 43 | $user = FlipSession::getUser(); |
| 44 | - if($user === false) |
|
| 44 | + if ($user === false) |
|
| 45 | 45 | { |
| 46 | 46 | $data = substr($header['Authorization'], 6); |
| 47 | 47 | $userpass = explode(':', base64_decode($data)); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | private function getUserFromHeader($header) |
| 64 | 64 | { |
| 65 | - if(strncmp($header, 'Basic', 5) == 0) |
|
| 65 | + if (strncmp($header, 'Basic', 5) == 0) |
|
| 66 | 66 | { |
| 67 | 67 | return $this->getUserFromBasicAuth($header); |
| 68 | 68 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | public function call() |
| 73 | 73 | { |
| 74 | 74 | // no auth header |
| 75 | - if(!isset($this->headers['Authorization'])) |
|
| 75 | + if (!isset($this->headers['Authorization'])) |
|
| 76 | 76 | { |
| 77 | 77 | $this->app->user = $this->getUserFromSession(); |
| 78 | 78 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $this->app->user = $this->getUserFromHeader($header); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - if($this->app->user === false) |
|
| 85 | + if ($this->app->user === false) |
|
| 86 | 86 | { |
| 87 | 87 | $this->app->getLog()->error("No user found for call"); |
| 88 | 88 | } |
@@ -96,19 +96,19 @@ discard block |
||
| 96 | 96 | { |
| 97 | 97 | private function fix_encoded_element($key, $value, &$array, $prefix = '') |
| 98 | 98 | { |
| 99 | - if(is_array($value)) |
|
| 99 | + if (is_array($value)) |
|
| 100 | 100 | { |
| 101 | 101 | $array[$key] = implode(';', $value); |
| 102 | 102 | } |
| 103 | - else if($key === '_id' && is_object($value)) |
|
| 103 | + else if ($key === '_id' && is_object($value)) |
|
| 104 | 104 | { |
| 105 | 105 | $array[$key] = $value->{'$id'}; |
| 106 | 106 | } |
| 107 | - else if(is_object($value)) |
|
| 107 | + else if (is_object($value)) |
|
| 108 | 108 | { |
| 109 | 109 | $array[$key] = $this->app->request->getUrl().$this->app->request->getPath().$prefix.'/'.$key; |
| 110 | 110 | } |
| 111 | - else if(strncmp($value, 'data:', 5) === 0) |
|
| 111 | + else if (strncmp($value, 'data:', 5) === 0) |
|
| 112 | 112 | { |
| 113 | 113 | $array[$key] = $this->app->request->getUrl().$this->app->request->getPath().$prefix.'/'.$key; |
| 114 | 114 | } |
@@ -122,40 +122,40 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | ob_start(); |
| 124 | 124 | $df = fopen("php://output", 'w'); |
| 125 | - if(is_array($array)) |
|
| 125 | + if (is_array($array)) |
|
| 126 | 126 | { |
| 127 | 127 | $first = reset($array); |
| 128 | 128 | $keys = FALSE; |
| 129 | - if(is_array($first)) |
|
| 129 | + if (is_array($first)) |
|
| 130 | 130 | { |
| 131 | 131 | $keys = array_keys($first); |
| 132 | 132 | } |
| 133 | - else if(is_object($first)) |
|
| 133 | + else if (is_object($first)) |
|
| 134 | 134 | { |
| 135 | 135 | $keys = array_keys(get_object_vars($first)); |
| 136 | 136 | } |
| 137 | 137 | fputcsv($df, $keys); |
| 138 | 138 | foreach ($array as $row) |
| 139 | 139 | { |
| 140 | - if(is_array($row)) |
|
| 140 | + if (is_array($row)) |
|
| 141 | 141 | { |
| 142 | 142 | $id = $row[$keys[0]]; |
| 143 | - foreach($row as $key=>$value) |
|
| 143 | + foreach ($row as $key=>$value) |
|
| 144 | 144 | { |
| 145 | 145 | $this->fix_encoded_element($key, $value, $row, '/'.$id); |
| 146 | 146 | } |
| 147 | 147 | fputcsv($df, $row); |
| 148 | 148 | } |
| 149 | - else if(is_object($row)) |
|
| 149 | + else if (is_object($row)) |
|
| 150 | 150 | { |
| 151 | 151 | $keyName = $keys[0]; |
| 152 | 152 | $id = $row->$keyName; |
| 153 | - if(is_object($id)) |
|
| 153 | + if (is_object($id)) |
|
| 154 | 154 | { |
| 155 | 155 | $id = $id->{'$id'}; |
| 156 | 156 | } |
| 157 | 157 | $values = get_object_vars($row); |
| 158 | - foreach($values as $key=>$value) |
|
| 158 | + foreach ($values as $key=>$value) |
|
| 159 | 159 | { |
| 160 | 160 | $this->fix_encoded_element($key, $value, $values, '/'.$id); |
| 161 | 161 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | { |
| 168 | 168 | $array = get_object_vars($array); |
| 169 | 169 | fputcsv($df, array_keys($array)); |
| 170 | - foreach($array as $key=>$value) |
|
| 170 | + foreach ($array as $key=>$value) |
|
| 171 | 171 | { |
| 172 | 172 | $this->fix_encoded_element($key, $value, $array); |
| 173 | 173 | } |
@@ -185,34 +185,34 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | public function call() |
| 187 | 187 | { |
| 188 | - if($this->app->request->isOptions()) |
|
| 188 | + if ($this->app->request->isOptions()) |
|
| 189 | 189 | { |
| 190 | 190 | return; |
| 191 | 191 | } |
| 192 | 192 | $params = $this->app->request->params(); |
| 193 | 193 | $fmt = null; |
| 194 | - if(isset($params['fmt'])) |
|
| 194 | + if (isset($params['fmt'])) |
|
| 195 | 195 | { |
| 196 | 196 | $fmt = $params['fmt']; |
| 197 | 197 | } |
| 198 | - if($fmt === null && isset($params['$format'])) |
|
| 198 | + if ($fmt === null && isset($params['$format'])) |
|
| 199 | 199 | { |
| 200 | 200 | $fmt = $params['$format']; |
| 201 | - if(strstr($fmt, 'odata.streaming=true')) |
|
| 201 | + if (strstr($fmt, 'odata.streaming=true')) |
|
| 202 | 202 | { |
| 203 | 203 | $this->app->response->setStatus(406); |
| 204 | 204 | return; |
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | - if($fmt === null) |
|
| 207 | + if ($fmt === null) |
|
| 208 | 208 | { |
| 209 | 209 | $mimeType = $this->app->request->headers->get('Accept'); |
| 210 | - if(strstr($mimeType, 'odata.streaming=true')) |
|
| 210 | + if (strstr($mimeType, 'odata.streaming=true')) |
|
| 211 | 211 | { |
| 212 | 212 | $this->app->response->setStatus(406); |
| 213 | 213 | return; |
| 214 | 214 | } |
| 215 | - switch($mimeType) |
|
| 215 | + switch ($mimeType) |
|
| 216 | 216 | { |
| 217 | 217 | case 'text/csv': |
| 218 | 218 | $fmt = 'csv'; |
@@ -232,11 +232,11 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | $this->next->call(); |
| 234 | 234 | |
| 235 | - if($this->app->response->getStatus() == 200 && $this->app->fmt !== 'json') |
|
| 235 | + if ($this->app->response->getStatus() == 200 && $this->app->fmt !== 'json') |
|
| 236 | 236 | { |
| 237 | 237 | $data = json_decode($this->app->response->getBody()); |
| 238 | 238 | $text = ''; |
| 239 | - switch($this->app->fmt) |
|
| 239 | + switch ($this->app->fmt) |
|
| 240 | 240 | { |
| 241 | 241 | case 'data-table': |
| 242 | 242 | $this->app->response->headers->set('Content-Type', 'application/json'); |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | } |
| 264 | 264 | $this->app->response->setBody($text); |
| 265 | 265 | } |
| 266 | - else if($this->app->response->getStatus() == 200) |
|
| 266 | + else if ($this->app->response->getStatus() == 200) |
|
| 267 | 267 | { |
| 268 | 268 | $this->app->response->headers->set('Content-Type', 'application/json;odata.metadata=none'); |
| 269 | 269 | } |
@@ -293,12 +293,12 @@ discard block |
||
| 293 | 293 | return $this->post($uri, $handler); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - function get_json_body($array=false) |
|
| 296 | + function get_json_body($array = false) |
|
| 297 | 297 | { |
| 298 | 298 | return $this->getJsonBody($array); |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - function getJsonBody($array=false) |
|
| 301 | + function getJsonBody($array = false) |
|
| 302 | 302 | { |
| 303 | 303 | $body = $this->request->getBody(); |
| 304 | 304 | return json_decode($body, $array); |
@@ -75,8 +75,7 @@ discard block |
||
| 75 | 75 | if(!isset($this->headers['Authorization'])) |
| 76 | 76 | { |
| 77 | 77 | $this->app->user = $this->getUserFromSession(); |
| 78 | - } |
|
| 79 | - else |
|
| 78 | + } else |
|
| 80 | 79 | { |
| 81 | 80 | $header = $this->headers['Authorization']; |
| 82 | 81 | $this->app->user = $this->getUserFromHeader($header); |
@@ -99,16 +98,13 @@ discard block |
||
| 99 | 98 | if(is_array($value)) |
| 100 | 99 | { |
| 101 | 100 | $array[$key] = implode(';', $value); |
| 102 | - } |
|
| 103 | - else if($key === '_id' && is_object($value)) |
|
| 101 | + } else if($key === '_id' && is_object($value)) |
|
| 104 | 102 | { |
| 105 | 103 | $array[$key] = $value->{'$id'}; |
| 106 | - } |
|
| 107 | - else if(is_object($value)) |
|
| 104 | + } else if(is_object($value)) |
|
| 108 | 105 | { |
| 109 | 106 | $array[$key] = $this->app->request->getUrl().$this->app->request->getPath().$prefix.'/'.$key; |
| 110 | - } |
|
| 111 | - else if(strncmp($value, 'data:', 5) === 0) |
|
| 107 | + } else if(strncmp($value, 'data:', 5) === 0) |
|
| 112 | 108 | { |
| 113 | 109 | $array[$key] = $this->app->request->getUrl().$this->app->request->getPath().$prefix.'/'.$key; |
| 114 | 110 | } |
@@ -129,8 +125,7 @@ discard block |
||
| 129 | 125 | if(is_array($first)) |
| 130 | 126 | { |
| 131 | 127 | $keys = array_keys($first); |
| 132 | - } |
|
| 133 | - else if(is_object($first)) |
|
| 128 | + } else if(is_object($first)) |
|
| 134 | 129 | { |
| 135 | 130 | $keys = array_keys(get_object_vars($first)); |
| 136 | 131 | } |
@@ -145,8 +140,7 @@ discard block |
||
| 145 | 140 | $this->fix_encoded_element($key, $value, $row, '/'.$id); |
| 146 | 141 | } |
| 147 | 142 | fputcsv($df, $row); |
| 148 | - } |
|
| 149 | - else if(is_object($row)) |
|
| 143 | + } else if(is_object($row)) |
|
| 150 | 144 | { |
| 151 | 145 | $keyName = $keys[0]; |
| 152 | 146 | $id = $row->$keyName; |
@@ -162,8 +156,7 @@ discard block |
||
| 162 | 156 | fputcsv($df, $values); |
| 163 | 157 | } |
| 164 | 158 | } |
| 165 | - } |
|
| 166 | - else |
|
| 159 | + } else |
|
| 167 | 160 | { |
| 168 | 161 | $array = get_object_vars($array); |
| 169 | 162 | fputcsv($df, array_keys($array)); |
@@ -262,8 +255,7 @@ discard block |
||
| 262 | 255 | break; |
| 263 | 256 | } |
| 264 | 257 | $this->app->response->setBody($text); |
| 265 | - } |
|
| 266 | - else if($this->app->response->getStatus() == 200) |
|
| 258 | + } else if($this->app->response->getStatus() == 200) |
|
| 267 | 259 | { |
| 268 | 260 | $this->app->response->headers->set('Content-Type', 'application/json;odata.metadata=none'); |
| 269 | 261 | } |
@@ -26,16 +26,16 @@ |
||
| 26 | 26 | { |
| 27 | 27 | $namespace = substr($classname, 0, $lastNsPos); |
| 28 | 28 | $classname = substr($classname, $lastNsPos + 1); |
| 29 | - $filename = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; |
|
| 29 | + $filename = str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR; |
|
| 30 | 30 | } |
| 31 | 31 | $filename = __DIR__.DIRECTORY_SEPARATOR.$filename.'class.'.$classname.'.php'; |
| 32 | - if(is_readable($filename)) |
|
| 32 | + if (is_readable($filename)) |
|
| 33 | 33 | { |
| 34 | 34 | require $filename; |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | -if(version_compare(PHP_VERSION, '5.3.0', '>=')) |
|
| 38 | +if (version_compare(PHP_VERSION, '5.3.0', '>=')) |
|
| 39 | 39 | { |
| 40 | 40 | spl_autoload_register('FlipsideAutoload', true, true); |
| 41 | 41 | } |
@@ -17,8 +17,7 @@ |
||
| 17 | 17 | if(isset($GLOBALS['FLIPSIDE_SETTINGS_LOC'])) |
| 18 | 18 | { |
| 19 | 19 | require_once($GLOBALS['FLIPSIDE_SETTINGS_LOC'].'/class.FlipsideSettings.php'); |
| 20 | -} |
|
| 21 | -else |
|
| 20 | +} else |
|
| 22 | 21 | { |
| 23 | 22 | require_once('/var/www/secure_settings/class.FlipsideSettings.php'); |
| 24 | 23 | } |
@@ -5,18 +5,18 @@ discard block |
||
| 5 | 5 | { |
| 6 | 6 | protected $data = null; |
| 7 | 7 | |
| 8 | - function count($filter=false) |
|
| 8 | + function count($filter = false) |
|
| 9 | 9 | { |
| 10 | 10 | throw new \Exception('Unimplemented'); |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | - function search($filter=false, $select=false, $count=false, $skip=false, $sort=false, $params=false) |
|
| 13 | + function search($filter = false, $select = false, $count = false, $skip = false, $sort = false, $params = false) |
|
| 14 | 14 | { |
| 15 | - if($this->data === null) |
|
| 15 | + if ($this->data === null) |
|
| 16 | 16 | { |
| 17 | 17 | throw new \Exception('Unimplemented'); |
| 18 | 18 | } |
| 19 | - if($filter !== false) |
|
| 19 | + if ($filter !== false) |
|
| 20 | 20 | { |
| 21 | 21 | $array = $filter->filter_array($this->data); |
| 22 | 22 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | throw new \Exception('Unimplemented'); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - function read($filter=false, $select=false, $count=false, $skip=false, $sort=false, $params=false) |
|
| 31 | + function read($filter = false, $select = false, $count = false, $skip = false, $sort = false, $params = false) |
|
| 32 | 32 | { |
| 33 | 33 | return $this->search($filter, $select, $count, $skip, $sort, $params); |
| 34 | 34 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | function __construct($string = false) |
| 11 | 11 | { |
| 12 | - if($string !== false) |
|
| 12 | + if ($string !== false) |
|
| 13 | 13 | { |
| 14 | 14 | $this->string = $string; |
| 15 | 15 | $this->children = self::process_string($this->string); |
@@ -20,21 +20,21 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | $parens = false; |
| 22 | 22 | //First check for parenthesis... |
| 23 | - if($string[0] === '(' && substr($string, -1) === ')') |
|
| 23 | + if ($string[0] === '(' && substr($string, -1) === ')') |
|
| 24 | 24 | { |
| 25 | - $string = substr($string, 1, strlen($string)-2); |
|
| 25 | + $string = substr($string, 1, strlen($string) - 2); |
|
| 26 | 26 | $parens = true; |
| 27 | 27 | } |
| 28 | - if(preg_match('/(.+?)( and | or )(.+)/', $string, $clauses) === 0) |
|
| 28 | + if (preg_match('/(.+?)( and | or )(.+)/', $string, $clauses) === 0) |
|
| 29 | 29 | { |
| 30 | 30 | return array(new FilterClause($string)); |
| 31 | 31 | } |
| 32 | 32 | $children = array(); |
| 33 | - if($parens) array_push($children, '('); |
|
| 33 | + if ($parens) array_push($children, '('); |
|
| 34 | 34 | $children = array_merge($children, self::process_string($clauses[1])); |
| 35 | 35 | array_push($children, trim($clauses[2])); |
| 36 | 36 | $children = array_merge($children, self::process_string($clauses[3])); |
| 37 | - if($parens) array_push($children, ')'); |
|
| 37 | + if ($parens) array_push($children, ')'); |
|
| 38 | 38 | return $children; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -42,23 +42,23 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $ret = ''; |
| 44 | 44 | $count = count($this->children); |
| 45 | - for($i = 0; $i < $count; $i++) |
|
| 45 | + for ($i = 0; $i < $count; $i++) |
|
| 46 | 46 | { |
| 47 | - if($this->children[$i] === '(' || $this->children[$i] === ')') |
|
| 47 | + if ($this->children[$i] === '(' || $this->children[$i] === ')') |
|
| 48 | 48 | { |
| 49 | - $ret.=$this->children[$i]; |
|
| 49 | + $ret .= $this->children[$i]; |
|
| 50 | 50 | } |
| 51 | - else if($this->children[$i] === 'and') |
|
| 51 | + else if ($this->children[$i] === 'and') |
|
| 52 | 52 | { |
| 53 | - $ret.=' AND '; |
|
| 53 | + $ret .= ' AND '; |
|
| 54 | 54 | } |
| 55 | - else if($this->children[$i] === 'or') |
|
| 55 | + else if ($this->children[$i] === 'or') |
|
| 56 | 56 | { |
| 57 | - $ret.=' OR '; |
|
| 57 | + $ret .= ' OR '; |
|
| 58 | 58 | } |
| 59 | 59 | else |
| 60 | 60 | { |
| 61 | - $ret.=$this->children[$i]->to_sql_string(); |
|
| 61 | + $ret .= $this->children[$i]->to_sql_string(); |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | return $ret.$this->sqlAppend; |
@@ -69,19 +69,19 @@ discard block |
||
| 69 | 69 | $ret = ''; |
| 70 | 70 | $count = count($this->children); |
| 71 | 71 | $prefix = ''; |
| 72 | - for($i = 0; $i < $count; $i++) |
|
| 72 | + for ($i = 0; $i < $count; $i++) |
|
| 73 | 73 | { |
| 74 | - if($this->children[$i] === 'and') |
|
| 74 | + if ($this->children[$i] === 'and') |
|
| 75 | 75 | { |
| 76 | - if($prefix == '|') |
|
| 76 | + if ($prefix == '|') |
|
| 77 | 77 | { |
| 78 | 78 | throw new \Exception('Do not support both and or'); |
| 79 | 79 | } |
| 80 | 80 | $prefix = '&'; |
| 81 | 81 | } |
| 82 | - else if($this->children[$i] === 'or') |
|
| 82 | + else if ($this->children[$i] === 'or') |
|
| 83 | 83 | { |
| 84 | - if($prefix == '&') |
|
| 84 | + if ($prefix == '&') |
|
| 85 | 85 | { |
| 86 | 86 | throw new \Exception('Do not support both and or'); |
| 87 | 87 | } |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | else |
| 91 | 91 | { |
| 92 | - $ret.=$this->children[$i]->to_ldap_string(); |
|
| 92 | + $ret .= $this->children[$i]->to_ldap_string(); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | - if($count === 1 && $prefix === '') |
|
| 95 | + if ($count === 1 && $prefix === '') |
|
| 96 | 96 | { |
| 97 | 97 | return $ret; |
| 98 | 98 | } |
@@ -103,14 +103,14 @@ discard block |
||
| 103 | 103 | { |
| 104 | 104 | $ret = array(); |
| 105 | 105 | $count = count($this->children); |
| 106 | - for($i = 0; $i < $count; $i++) |
|
| 106 | + for ($i = 0; $i < $count; $i++) |
|
| 107 | 107 | { |
| 108 | - if($this->children[$i] === 'and') |
|
| 108 | + if ($this->children[$i] === 'and') |
|
| 109 | 109 | { |
| 110 | 110 | $old = array_pop($ret); |
| 111 | 111 | array_push($ret, array('$and'=>array($old, $this->children[++$i]->to_mongo_filter()))); |
| 112 | 112 | } |
| 113 | - else if($this->children[$i] === 'or') |
|
| 113 | + else if ($this->children[$i] === 'or') |
|
| 114 | 114 | { |
| 115 | 115 | $old = array_pop($ret); |
| 116 | 116 | array_push($ret, array('$or'=>array($old, $this->children[++$i]->to_mongo_filter()))); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | array_push($ret, $this->children[$i]->to_mongo_filter()); |
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | - if(count($ret) == 1 && is_array($ret[0])) |
|
| 123 | + if (count($ret) == 1 && is_array($ret[0])) |
|
| 124 | 124 | { |
| 125 | 125 | //print_r(json_encode($ret[0])); die(); |
| 126 | 126 | return $ret[0]; |
@@ -131,27 +131,27 @@ discard block |
||
| 131 | 131 | function filter_array(&$array) |
| 132 | 132 | { |
| 133 | 133 | $res = array(); |
| 134 | - if(is_array($array)) |
|
| 134 | + if (is_array($array)) |
|
| 135 | 135 | { |
| 136 | 136 | $search = $array; |
| 137 | 137 | $count = count($this->children); |
| 138 | - for($i = 0; $i < $count; $i++) |
|
| 138 | + for ($i = 0; $i < $count; $i++) |
|
| 139 | 139 | { |
| 140 | - if($this->children[$i] === 'and') |
|
| 140 | + if ($this->children[$i] === 'and') |
|
| 141 | 141 | { |
| 142 | 142 | $search = $res; |
| 143 | 143 | } |
| 144 | - else if($this->children[$i] === 'or') |
|
| 144 | + else if ($this->children[$i] === 'or') |
|
| 145 | 145 | { |
| 146 | 146 | $search = $array; |
| 147 | 147 | } |
| 148 | 148 | else |
| 149 | 149 | { |
| 150 | - foreach($search as $subarray) |
|
| 150 | + foreach ($search as $subarray) |
|
| 151 | 151 | { |
| 152 | - if(isset($subarray[$this->children[$i]->var1])) |
|
| 152 | + if (isset($subarray[$this->children[$i]->var1])) |
|
| 153 | 153 | { |
| 154 | - if($this->children[$i]->php_compare($subarray[$this->children[$i]->var1])) |
|
| 154 | + if ($this->children[$i]->php_compare($subarray[$this->children[$i]->var1])) |
|
| 155 | 155 | { |
| 156 | 156 | array_push($res, $subarray); |
| 157 | 157 | } |
@@ -171,10 +171,10 @@ discard block |
||
| 171 | 171 | public function getClause($substr) |
| 172 | 172 | { |
| 173 | 173 | $count = count($this->children); |
| 174 | - for($i = 0; $i < $count; $i++) |
|
| 174 | + for ($i = 0; $i < $count; $i++) |
|
| 175 | 175 | { |
| 176 | - if(!is_object($this->children[$i])) continue; |
|
| 177 | - if(strstr($this->children[$i]->var1, $substr) !== false || |
|
| 176 | + if (!is_object($this->children[$i])) continue; |
|
| 177 | + if (strstr($this->children[$i]->var1, $substr) !== false || |
|
| 178 | 178 | strstr($this->children[$i]->var2, $substr) !== false) |
| 179 | 179 | { |
| 180 | 180 | return $this->children[$i]; |
@@ -184,17 +184,17 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | public function addToSQLString($string) |
| 186 | 186 | { |
| 187 | - $this->sqlAppend.=$string; |
|
| 187 | + $this->sqlAppend .= $string; |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | public function appendChild($child) |
| 191 | 191 | { |
| 192 | - if($child === 'and' || $child === 'or') |
|
| 192 | + if ($child === 'and' || $child === 'or') |
|
| 193 | 193 | { |
| 194 | 194 | array_push($this->children, $child); |
| 195 | 195 | return; |
| 196 | 196 | } |
| 197 | - else if(is_a($child, '\Data\Filter')) |
|
| 197 | + else if (is_a($child, '\Data\Filter')) |
|
| 198 | 198 | { |
| 199 | 199 | $this->children = array_merge($this->children, $child->children); |
| 200 | 200 | } |
@@ -30,11 +30,15 @@ discard block |
||
| 30 | 30 | return array(new FilterClause($string)); |
| 31 | 31 | } |
| 32 | 32 | $children = array(); |
| 33 | - if($parens) array_push($children, '('); |
|
| 33 | + if($parens) { |
|
| 34 | + array_push($children, '('); |
|
| 35 | + } |
|
| 34 | 36 | $children = array_merge($children, self::process_string($clauses[1])); |
| 35 | 37 | array_push($children, trim($clauses[2])); |
| 36 | 38 | $children = array_merge($children, self::process_string($clauses[3])); |
| 37 | - if($parens) array_push($children, ')'); |
|
| 39 | + if($parens) { |
|
| 40 | + array_push($children, ')'); |
|
| 41 | + } |
|
| 38 | 42 | return $children; |
| 39 | 43 | } |
| 40 | 44 | |
@@ -47,16 +51,13 @@ discard block |
||
| 47 | 51 | if($this->children[$i] === '(' || $this->children[$i] === ')') |
| 48 | 52 | { |
| 49 | 53 | $ret.=$this->children[$i]; |
| 50 | - } |
|
| 51 | - else if($this->children[$i] === 'and') |
|
| 54 | + } else if($this->children[$i] === 'and') |
|
| 52 | 55 | { |
| 53 | 56 | $ret.=' AND '; |
| 54 | - } |
|
| 55 | - else if($this->children[$i] === 'or') |
|
| 57 | + } else if($this->children[$i] === 'or') |
|
| 56 | 58 | { |
| 57 | 59 | $ret.=' OR '; |
| 58 | - } |
|
| 59 | - else |
|
| 60 | + } else |
|
| 60 | 61 | { |
| 61 | 62 | $ret.=$this->children[$i]->to_sql_string(); |
| 62 | 63 | } |
@@ -78,16 +79,14 @@ discard block |
||
| 78 | 79 | throw new \Exception('Do not support both and or'); |
| 79 | 80 | } |
| 80 | 81 | $prefix = '&'; |
| 81 | - } |
|
| 82 | - else if($this->children[$i] === 'or') |
|
| 82 | + } else if($this->children[$i] === 'or') |
|
| 83 | 83 | { |
| 84 | 84 | if($prefix == '&') |
| 85 | 85 | { |
| 86 | 86 | throw new \Exception('Do not support both and or'); |
| 87 | 87 | } |
| 88 | 88 | $prefix = '|'; |
| 89 | - } |
|
| 90 | - else |
|
| 89 | + } else |
|
| 91 | 90 | { |
| 92 | 91 | $ret.=$this->children[$i]->to_ldap_string(); |
| 93 | 92 | } |
@@ -109,13 +108,11 @@ discard block |
||
| 109 | 108 | { |
| 110 | 109 | $old = array_pop($ret); |
| 111 | 110 | array_push($ret, array('$and'=>array($old, $this->children[++$i]->to_mongo_filter()))); |
| 112 | - } |
|
| 113 | - else if($this->children[$i] === 'or') |
|
| 111 | + } else if($this->children[$i] === 'or') |
|
| 114 | 112 | { |
| 115 | 113 | $old = array_pop($ret); |
| 116 | 114 | array_push($ret, array('$or'=>array($old, $this->children[++$i]->to_mongo_filter()))); |
| 117 | - } |
|
| 118 | - else |
|
| 115 | + } else |
|
| 119 | 116 | { |
| 120 | 117 | array_push($ret, $this->children[$i]->to_mongo_filter()); |
| 121 | 118 | } |
@@ -140,12 +137,10 @@ discard block |
||
| 140 | 137 | if($this->children[$i] === 'and') |
| 141 | 138 | { |
| 142 | 139 | $search = $res; |
| 143 | - } |
|
| 144 | - else if($this->children[$i] === 'or') |
|
| 140 | + } else if($this->children[$i] === 'or') |
|
| 145 | 141 | { |
| 146 | 142 | $search = $array; |
| 147 | - } |
|
| 148 | - else |
|
| 143 | + } else |
|
| 149 | 144 | { |
| 150 | 145 | foreach($search as $subarray) |
| 151 | 146 | { |
@@ -173,7 +168,9 @@ discard block |
||
| 173 | 168 | $count = count($this->children); |
| 174 | 169 | for($i = 0; $i < $count; $i++) |
| 175 | 170 | { |
| 176 | - if(!is_object($this->children[$i])) continue; |
|
| 171 | + if(!is_object($this->children[$i])) { |
|
| 172 | + continue; |
|
| 173 | + } |
|
| 177 | 174 | if(strstr($this->children[$i]->var1, $substr) !== false || |
| 178 | 175 | strstr($this->children[$i]->var2, $substr) !== false) |
| 179 | 176 | { |
@@ -193,12 +190,10 @@ discard block |
||
| 193 | 190 | { |
| 194 | 191 | array_push($this->children, $child); |
| 195 | 192 | return; |
| 196 | - } |
|
| 197 | - else if(is_a($child, '\Data\Filter')) |
|
| 193 | + } else if(is_a($child, '\Data\Filter')) |
|
| 198 | 194 | { |
| 199 | 195 | $this->children = array_merge($this->children, $child->children); |
| 200 | - } |
|
| 201 | - else |
|
| 196 | + } else |
|
| 202 | 197 | { |
| 203 | 198 | $this->children = array_merge($this->children, self::process_string($child)); |
| 204 | 199 | } |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | $collections = $this->db->getCollectionNames(); |
| 66 | 66 | if(in_array($name, $collections)) |
| 67 | 67 | { |
| 68 | - return true; |
|
| 68 | + return true; |
|
| 69 | 69 | } |
| 70 | 70 | return false; |
| 71 | 71 | } |
@@ -11,14 +11,14 @@ discard block |
||
| 11 | 11 | { |
| 12 | 12 | $namespace = substr($classname, 0, $lastNsPos); |
| 13 | 13 | $classname = substr($classname, $lastNsPos + 1); |
| 14 | - $filename = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; |
|
| 14 | + $filename = str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR; |
|
| 15 | 15 | } |
| 16 | - if(strlen($namespace)) |
|
| 16 | + if (strlen($namespace)) |
|
| 17 | 17 | { |
| 18 | - $namespace.=DIRECTORY_SEPARATOR; |
|
| 18 | + $namespace .= DIRECTORY_SEPARATOR; |
|
| 19 | 19 | } |
| 20 | 20 | $filename = __DIR__.'/../libs/mongofill/src/'.$namespace.$classname.'.php'; |
| 21 | - if(is_readable($filename)) |
|
| 21 | + if (is_readable($filename)) |
|
| 22 | 22 | { |
| 23 | 23 | require $filename; |
| 24 | 24 | } |
@@ -37,18 +37,18 @@ discard block |
||
| 37 | 37 | $this->mangaer = null; |
| 38 | 38 | $this->db = null; |
| 39 | 39 | $this->db_name = null; |
| 40 | - if(class_exists('MongoClient')) |
|
| 40 | + if (class_exists('MongoClient')) |
|
| 41 | 41 | { |
| 42 | 42 | $this->setupMongoClient($params); |
| 43 | 43 | } |
| 44 | - else if(class_exists('\MongoDB\Driver\Manager')) |
|
| 44 | + else if (class_exists('\MongoDB\Driver\Manager')) |
|
| 45 | 45 | { |
| 46 | 46 | $this->setupMongoManager($params); |
| 47 | 47 | } |
| 48 | 48 | else |
| 49 | 49 | { |
| 50 | 50 | require __DIR__.'/../libs/mongofill/src/functions.php'; |
| 51 | - if(version_compare(PHP_VERSION, '5.3.0', '>=')) |
|
| 51 | + if (version_compare(PHP_VERSION, '5.3.0', '>=')) |
|
| 52 | 52 | { |
| 53 | 53 | spl_autoload_register('\Data\MongofillAutoload', true, true); |
| 54 | 54 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | function tableExists($name) |
| 64 | 64 | { |
| 65 | 65 | $collections = $this->db->getCollectionNames(); |
| 66 | - if(in_array($name, $collections)) |
|
| 66 | + if (in_array($name, $collections)) |
|
| 67 | 67 | { |
| 68 | 68 | return true; |
| 69 | 69 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | function getTable($name) |
| 74 | 74 | { |
| 75 | - if($this->db !== null) |
|
| 75 | + if ($this->db !== null) |
|
| 76 | 76 | { |
| 77 | 77 | return new MongoDataTable($this->db->selectCollection($name)); |
| 78 | 78 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | private function setupMongoClient($params) |
| 86 | 86 | { |
| 87 | - if(isset($params['user'])) |
|
| 87 | + if (isset($params['user'])) |
|
| 88 | 88 | { |
| 89 | 89 | $this->client = new \MongoClient('mongodb://'.$params['host'].'/'.$params['db'], array('username'=>$params['user'], 'password'=>$params['pass'])); |
| 90 | 90 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | private function setupMongoManager($params) |
| 99 | 99 | { |
| 100 | - if(isset($params['user'])) |
|
| 100 | + if (isset($params['user'])) |
|
| 101 | 101 | { |
| 102 | 102 | $this->manager = new \MongoDB\Driver\Manager('mongodb://'.$params['user'].':'.$params['pass'].'@'.$params['host'].'/'.$params['db']); |
| 103 | 103 | } |
@@ -40,19 +40,16 @@ discard block |
||
| 40 | 40 | if(class_exists('MongoClient')) |
| 41 | 41 | { |
| 42 | 42 | $this->setupMongoClient($params); |
| 43 | - } |
|
| 44 | - else if(class_exists('\MongoDB\Driver\Manager')) |
|
| 43 | + } else if(class_exists('\MongoDB\Driver\Manager')) |
|
| 45 | 44 | { |
| 46 | 45 | $this->setupMongoManager($params); |
| 47 | - } |
|
| 48 | - else |
|
| 46 | + } else |
|
| 49 | 47 | { |
| 50 | 48 | require __DIR__.'/../libs/mongofill/src/functions.php'; |
| 51 | 49 | if(version_compare(PHP_VERSION, '5.3.0', '>=')) |
| 52 | 50 | { |
| 53 | 51 | spl_autoload_register('\Data\MongofillAutoload', true, true); |
| 54 | - } |
|
| 55 | - else |
|
| 52 | + } else |
|
| 56 | 53 | { |
| 57 | 54 | spl_autoload_register('\Data\MongofillAutoload'); |
| 58 | 55 | } |
@@ -75,8 +72,7 @@ discard block |
||
| 75 | 72 | if($this->db !== null) |
| 76 | 73 | { |
| 77 | 74 | return new MongoDataTable($this->db->selectCollection($name)); |
| 78 | - } |
|
| 79 | - else |
|
| 75 | + } else |
|
| 80 | 76 | { |
| 81 | 77 | return new MongoDataTable($this->db_name, $name); |
| 82 | 78 | } |
@@ -87,8 +83,7 @@ discard block |
||
| 87 | 83 | if(isset($params['user'])) |
| 88 | 84 | { |
| 89 | 85 | $this->client = new \MongoClient('mongodb://'.$params['host'].'/'.$params['db'], array('username'=>$params['user'], 'password'=>$params['pass'])); |
| 90 | - } |
|
| 91 | - else |
|
| 86 | + } else |
|
| 92 | 87 | { |
| 93 | 88 | $this->client = new \MongoClient('mongodb://'.$params['host'].'/'.$params['db']); |
| 94 | 89 | } |
@@ -100,8 +95,7 @@ discard block |
||
| 100 | 95 | if(isset($params['user'])) |
| 101 | 96 | { |
| 102 | 97 | $this->manager = new \MongoDB\Driver\Manager('mongodb://'.$params['user'].':'.$params['pass'].'@'.$params['host'].'/'.$params['db']); |
| 103 | - } |
|
| 104 | - else |
|
| 98 | + } else |
|
| 105 | 99 | { |
| 106 | 100 | $this->manager = new \MongoDB\Driver\Manager('mongodb://'.$params['host'].'/'.$params['db']); |
| 107 | 101 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | * @link http://www.php.net/manual/en/class.jsonserializable.php |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -if(PHP_VERSION_ID < 50400) |
|
| 13 | +if (PHP_VERSION_ID < 50400) |
|
| 14 | 14 | { |
| 15 | 15 | /** |
| 16 | 16 | * JsonSerializable interface |
@@ -247,15 +247,15 @@ |
||
| 247 | 247 | */ |
| 248 | 248 | protected function printIeCompatability($prefix='') |
| 249 | 249 | { |
| 250 | - //IE 8 doesn't support HTML 5. Install the shim... |
|
| 251 | - if($this->getBrowserMajorVer() < 9) |
|
| 252 | - { |
|
| 253 | - echo $prefix.'<script src="js/html5.js"></script>'; |
|
| 254 | - echo "\n"; |
|
| 255 | - } |
|
| 256 | - //Tell the browser not to use compatability mode... |
|
| 257 | - echo $prefix.'<meta http-equiv="X-UA-Compatible" content="IE=edge"/>'; |
|
| 258 | - echo "\n"; |
|
| 250 | + //IE 8 doesn't support HTML 5. Install the shim... |
|
| 251 | + if($this->getBrowserMajorVer() < 9) |
|
| 252 | + { |
|
| 253 | + echo $prefix.'<script src="js/html5.js"></script>'; |
|
| 254 | + echo "\n"; |
|
| 255 | + } |
|
| 256 | + //Tell the browser not to use compatability mode... |
|
| 257 | + echo $prefix.'<meta http-equiv="X-UA-Compatible" content="IE=edge"/>'; |
|
| 258 | + echo "\n"; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | /** |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | $this->importSupport = false; |
| 59 | 59 | |
| 60 | 60 | $browserName = $this->getBrowserName(); |
| 61 | - if($browserName === 'IE' && $this->getBrowserMajorVer() <= 7) |
|
| 61 | + if ($browserName === 'IE' && $this->getBrowserMajorVer() <= 7) |
|
| 62 | 62 | { |
| 63 | - header( 'Location: /badbrowser.php' ) ; |
|
| 63 | + header('Location: /badbrowser.php'); |
|
| 64 | 64 | } |
| 65 | - else if($browserName === 'Chrome' && $this->getBrowserMajorVer() >= 36) |
|
| 65 | + else if ($browserName === 'Chrome' && $this->getBrowserMajorVer() >= 36) |
|
| 66 | 66 | { |
| 67 | 67 | $this->importSupport = true; |
| 68 | 68 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | protected function getBrowscap() |
| 79 | 79 | { |
| 80 | - if(isset($GLOBALS['BROWSCAP_CACHE'])) |
|
| 80 | + if (isset($GLOBALS['BROWSCAP_CACHE'])) |
|
| 81 | 81 | { |
| 82 | 82 | return new Browscap($GLOBALS['BROWSCAP_CACHE']); |
| 83 | 83 | } |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | private function getBrowser() |
| 91 | 91 | { |
| 92 | - static $browser;//No accident can arise from depending on an unset variable. |
|
| 93 | - if(!isset($browser)) |
|
| 92 | + static $browser; //No accident can arise from depending on an unset variable. |
|
| 93 | + if (!isset($browser)) |
|
| 94 | 94 | { |
| 95 | 95 | $browser = $this->browscap->getBrowser(); |
| 96 | 96 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | private function getBrowserName() |
| 104 | 104 | { |
| 105 | - if(isset($this->browser->Browser)) |
|
| 105 | + if (isset($this->browser->Browser)) |
|
| 106 | 106 | { |
| 107 | 107 | return $this->browser->Browser; |
| 108 | 108 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | private function getBrowserMajorVer() |
| 119 | 119 | { |
| 120 | - if(isset($this->browser->MajorVer)) |
|
| 120 | + if (isset($this->browser->MajorVer)) |
|
| 121 | 121 | { |
| 122 | 122 | return $this->browser->MajorVer; |
| 123 | 123 | } |
@@ -190,19 +190,19 @@ discard block |
||
| 190 | 190 | * |
| 191 | 191 | * @return string The tag as a string |
| 192 | 192 | */ |
| 193 | - protected function createOpenTag($tagName, $attribs=array(), $selfClose=false) |
|
| 193 | + protected function createOpenTag($tagName, $attribs = array(), $selfClose = false) |
|
| 194 | 194 | { |
| 195 | 195 | $tag = '<'.$tagName; |
| 196 | 196 | $attribNames = array_keys($attribs); |
| 197 | - foreach($attribNames as $attribName) |
|
| 197 | + foreach ($attribNames as $attribName) |
|
| 198 | 198 | { |
| 199 | - $tag.=' '.$attribName; |
|
| 200 | - if($attribs[$attribName]) |
|
| 199 | + $tag .= ' '.$attribName; |
|
| 200 | + if ($attribs[$attribName]) |
|
| 201 | 201 | { |
| 202 | - $tag.='="'.$attribs[$attribName].'"'; |
|
| 202 | + $tag .= '="'.$attribs[$attribName].'"'; |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | - if($selfClose) |
|
| 205 | + if ($selfClose) |
|
| 206 | 206 | { |
| 207 | 207 | return $tag.'/>'; |
| 208 | 208 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * |
| 230 | 230 | * @return string The link |
| 231 | 231 | */ |
| 232 | - public function createLink($linkName, $linkTarget='#') |
|
| 232 | + public function createLink($linkName, $linkTarget = '#') |
|
| 233 | 233 | { |
| 234 | 234 | $startTag = $this->createOpenTag('a', array('href'=>$linkTarget)); |
| 235 | 235 | $endTag = $this->createCloseTag('a'); |
@@ -245,10 +245,10 @@ discard block |
||
| 245 | 245 | * |
| 246 | 246 | * @param string $prefix The prefix to append to each line |
| 247 | 247 | */ |
| 248 | - protected function printIeCompatability($prefix='') |
|
| 248 | + protected function printIeCompatability($prefix = '') |
|
| 249 | 249 | { |
| 250 | 250 | //IE 8 doesn't support HTML 5. Install the shim... |
| 251 | - if($this->getBrowserMajorVer() < 9) |
|
| 251 | + if ($this->getBrowserMajorVer() < 9) |
|
| 252 | 252 | { |
| 253 | 253 | echo $prefix.'<script src="js/html5.js"></script>'; |
| 254 | 254 | echo "\n"; |
@@ -263,16 +263,16 @@ discard block |
||
| 263 | 263 | * |
| 264 | 264 | * @param string $prefix The prefix to append to each line |
| 265 | 265 | */ |
| 266 | - protected function printHead($prefix='') |
|
| 266 | + protected function printHead($prefix = '') |
|
| 267 | 267 | { |
| 268 | 268 | echo $prefix.'<HEAD>'; |
| 269 | - if($this->getBrowserName() === 'IE') |
|
| 269 | + if ($this->getBrowserName() === 'IE') |
|
| 270 | 270 | { |
| 271 | 271 | $this->printIeCompatability($prefix.$prefix); |
| 272 | 272 | } |
| 273 | 273 | echo $prefix.$prefix.'<TITLE>'.$this->title.'</TITLE>'; |
| 274 | 274 | echo $prefix.$prefix.'<meta name="viewport" content="width=device-width, initial-scale=1.0">'; |
| 275 | - foreach($this->headTags as $tag) |
|
| 275 | + foreach ($this->headTags as $tag) |
|
| 276 | 276 | { |
| 277 | 277 | echo $prefix.$prefix.$tag."\n"; |
| 278 | 278 | } |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | * |
| 285 | 285 | * @param string $prefix The prefix to append to each line |
| 286 | 286 | */ |
| 287 | - protected function printBody($prefix='') |
|
| 287 | + protected function printBody($prefix = '') |
|
| 288 | 288 | { |
| 289 | 289 | echo $prefix.'<BODY '.$this->body_tags.'>'; |
| 290 | 290 | echo $prefix.$prefix.$this->body."\n"; |
@@ -312,16 +312,16 @@ discard block |
||
| 312 | 312 | */ |
| 313 | 313 | public function currentURL() |
| 314 | 314 | { |
| 315 | - if(!isset($_SERVER['REQUEST_URI'])) |
|
| 315 | + if (!isset($_SERVER['REQUEST_URI'])) |
|
| 316 | 316 | { |
| 317 | 317 | return ''; |
| 318 | 318 | } |
| 319 | 319 | $requestURI = $_SERVER['REQUEST_URI']; |
| 320 | - if($requestURI[0] === '/') |
|
| 320 | + if ($requestURI[0] === '/') |
|
| 321 | 321 | { |
| 322 | 322 | $requestURI = substr($requestURI, 1); |
| 323 | 323 | } |
| 324 | - return 'http'.(isset($_SERVER['HTTPS'])?'s':'').'://'.$_SERVER['HTTP_HOST'].'/'.$requestURI; |
|
| 324 | + return 'http'.(isset($_SERVER['HTTPS']) ? 's' : '').'://'.$_SERVER['HTTP_HOST'].'/'.$requestURI; |
|
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | /* vim: set tabstop=4 shiftwidth=4 expandtab: */ |
@@ -61,8 +61,7 @@ |
||
| 61 | 61 | if($browserName === 'IE' && $this->getBrowserMajorVer() <= 7) |
| 62 | 62 | { |
| 63 | 63 | header( 'Location: /badbrowser.php' ) ; |
| 64 | - } |
|
| 65 | - else if($browserName === 'Chrome' && $this->getBrowserMajorVer() >= 36) |
|
| 64 | + } else if($browserName === 'Chrome' && $this->getBrowserMajorVer() >= 36) |
|
| 66 | 65 | { |
| 67 | 66 | $this->importSupport = true; |
| 68 | 67 | } |
@@ -37,11 +37,11 @@ discard block |
||
| 37 | 37 | protected function __construct() |
| 38 | 38 | { |
| 39 | 39 | $this->methods = array(); |
| 40 | - if(isset(FlipsideSettings::$email_providers)) |
|
| 40 | + if (isset(FlipsideSettings::$email_providers)) |
|
| 41 | 41 | { |
| 42 | 42 | $keys = array_keys(FlipsideSettings::$email_providers); |
| 43 | 43 | $count = count($keys); |
| 44 | - for($i = 0; $i < $count; $i++) |
|
| 44 | + for ($i = 0; $i < $count; $i++) |
|
| 45 | 45 | { |
| 46 | 46 | $class = $keys[$i]; |
| 47 | 47 | array_push($this->methods, new $class(FlipsideSettings::$email_providers[$keys[$i]])); |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | public function getEmailMethod($methodName) |
| 60 | 60 | { |
| 61 | 61 | $count = count($this->methods); |
| 62 | - for($i = 0; $i < $count; $i++) |
|
| 62 | + for ($i = 0; $i < $count; $i++) |
|
| 63 | 63 | { |
| 64 | - if(strcasecmp(get_class($this->methods[$i]), $methodName) === 0) |
|
| 64 | + if (strcasecmp(get_class($this->methods[$i]), $methodName) === 0) |
|
| 65 | 65 | { |
| 66 | 66 | return $this->methods[$i]; |
| 67 | 67 | } |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function sendEmail($email, $methodName = false) |
| 81 | 81 | { |
| 82 | - if($methodName === false) |
|
| 82 | + if ($methodName === false) |
|
| 83 | 83 | { |
| 84 | 84 | $res = false; |
| 85 | 85 | $count = count($this->methods); |
| 86 | - for($i = 0; $i < $count; $i++) |
|
| 86 | + for ($i = 0; $i < $count; $i++) |
|
| 87 | 87 | { |
| 88 | 88 | $res = $this->methods[$i]->sendEmail($email); |
| 89 | - if($res !== false) |
|
| 89 | + if ($res !== false) |
|
| 90 | 90 | { |
| 91 | 91 | return $res; |
| 92 | 92 | } |
@@ -34,8 +34,7 @@ |
||
| 34 | 34 | $args['RawMessage'] = array(); |
| 35 | 35 | $args['RawMessage']['Data'] = base64_encode($email->getRawMessage()); |
| 36 | 36 | return $this->ses->sendRawEmail($args); |
| 37 | - } |
|
| 38 | - else |
|
| 37 | + } else |
|
| 39 | 38 | { |
| 40 | 39 | $args = array(); |
| 41 | 40 | $args['Source'] = $email->getFromAddress(); |