@@ -101,7 +101,7 @@ |
||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | - * @param mixed $page |
|
| 104 | + * @param DataObject|null $page |
|
| 105 | 105 | * |
| 106 | 106 | * @return mixed |
| 107 | 107 | */ |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | $shareToken = ShareToken::get()->filter('token', $token)->first(); |
| 40 | 40 | |
| 41 | - if(!$shareToken) { |
|
| 41 | + if (!$shareToken) { |
|
| 42 | 42 | return $this->errorPage(); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $controller = $this->getControllerFor($page); |
| 54 | 54 | |
| 55 | - if(!$shareToken->isExpired() && $page->generateKey($shareToken->Token) === $key) { |
|
| 55 | + if (!$shareToken->isExpired() && $page->generateKey($shareToken->Token) === $key) { |
|
| 56 | 56 | Requirements::css(SHAREDRAFTCONTENT_DIR . '/css/top-bar.css'); |
| 57 | 57 | |
| 58 | 58 | // Temporarily un-secure the draft site and switch to draft |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | 'Latest' => $latest, |
| 80 | 80 | )); |
| 81 | 81 | $include = (string) $data->renderWith('Includes/TopBar'); |
| 82 | - } catch(Exception $ex) { |
|
| 82 | + } catch (Exception $ex) { |
|
| 83 | 83 | $restore(); |
| 84 | 84 | throw $ex; |
| 85 | 85 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function MakeShareDraftLink() { |
| 15 | 15 | if ($member = Member::currentUser()) { |
| 16 | - if($this->owner->hasMethod('CurrentPage') && $this->owner->CurrentPage()->canEdit($member)) { |
|
| 16 | + if ($this->owner->hasMethod('CurrentPage') && $this->owner->CurrentPage()->canEdit($member)) { |
|
| 17 | 17 | return $this->owner->CurrentPage()->ShareTokenLink(); |
| 18 | 18 | } elseif ($this->owner->hasMethod('canEdit') && $this->owner->canEdit($member)) { |
| 19 | 19 | return $this->owner->ShareTokenLink(); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * @return ShareToken |
| 48 | 48 | */ |
| 49 | 49 | protected function getNewShareToken() { |
| 50 | - if(!$this->owner->ShareTokenSalt) { |
|
| 50 | + if (!$this->owner->ShareTokenSalt) { |
|
| 51 | 51 | $this->owner->ShareTokenSalt = $this->getNewToken(); |
| 52 | 52 | $this->owner->write(); |
| 53 | 53 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $tries = 1; |
| 58 | 58 | $limit = 5; |
| 59 | 59 | |
| 60 | - while(!$found && ($tries++ < $limit)) { |
|
| 60 | + while (!$found && ($tries++ < $limit)) { |
|
| 61 | 61 | $token = $this->getNewToken(); |
| 62 | 62 | |
| 63 | 63 | $found = ShareToken::get()->filter(array( |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Remove expired share tokens. |
|
| 4 | - * |
|
| 5 | - * Action to remove all expired ShareTokens from the database. |
|
| 6 | - * |
|
| 7 | - * To run this action the user needs admin rights. |
|
| 8 | - */ |
|
| 3 | + * Remove expired share tokens. |
|
| 4 | + * |
|
| 5 | + * Action to remove all expired ShareTokens from the database. |
|
| 6 | + * |
|
| 7 | + * To run this action the user needs admin rights. |
|
| 8 | + */ |
|
| 9 | 9 | class RemoveExpiredShareTokens extends BuildTask { |
| 10 | 10 | |
| 11 | 11 | protected $title = 'Remove expired share tokens'; |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | public function init() { |
| 16 | 16 | parent::init(); |
| 17 | 17 | |
| 18 | - if(!Permission::check('ADMIN')) { |
|
| 18 | + if (!Permission::check('ADMIN')) { |
|
| 19 | 19 | return Security::permissionFailure($this); |
| 20 | 20 | } |
| 21 | 21 | } |