Skip to content

Commit

Permalink
Merge pull request #3 from TDannhauer/master
Browse files Browse the repository at this point in the history
Make lib/Page/*.Page.php compatible with PHP 8.2
  • Loading branch information
mrubinsk committed May 19, 2023
2 parents b5f2941 + 54e00e9 commit 49bf81a
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 10 deletions.
5 changes: 4 additions & 1 deletion lib/Page/AddPage.php
Expand Up @@ -54,8 +54,11 @@ public function __construct($newpage)

/**
* Bail out if there's no page name.
*
* $param integer $mode The page render mode.
* $param array $params Any page parameters.
*/
public function preDisplay()
public function preDisplay($mode, $params)
{
if (!strlen($this->referrer())) {
$GLOBALS['notification']->push(_("Page name must not be empty"));
Expand Down
4 changes: 3 additions & 1 deletion lib/Page/AttachedFiles.php
Expand Up @@ -52,9 +52,11 @@ public function __construct($referrer)
/**
* Returns the current user's permissions for the referring page.
*
* @param string $pageName The page name (unused in this method).
*
* @return integer The permissions bitmask.
*/
public function getPermissions()
public function getPermissions($pageName = null)
{
return parent::getPermissions($this->referrer());
}
Expand Down
9 changes: 7 additions & 2 deletions lib/Page/DeletePage.php
Expand Up @@ -45,18 +45,23 @@ public function __construct($referrer)
/**
* Retrieve this user's permissions for the referring page.
*
* @param string $pageName The page name (unused in this method).
*
* @return integer The permissions bitmask.
*/
public function getPermissions()
public function getPermissions($pageName = null)
{
return parent::getPermissions($this->referrer());
}

/**
* Send them back whence they came if they aren't allowed to
* delete this page.
*
* $param integer $mode The page render mode.
* $param array $params Any page parameters.
*/
public function preDisplay()
public function preDisplay($mode, $params)
{
$page = Wicked_Page::getPage($this->referrer());
if (!$page->allows(Wicked::MODE_REMOVE)) {
Expand Down
5 changes: 4 additions & 1 deletion lib/Page/EditPage.php
Expand Up @@ -83,8 +83,11 @@ public function getPermissions($pageName = null)
/**
* Send them back whence they came if they aren't allowed to edit
* this page.
*
* $param integer $mode The page render mode.
* $param array $params Any page parameters.
*/
public function preDisplay()
public function preDisplay($mode, $params)
{
if (!$this->allows(Wicked::MODE_EDIT)) {
Wicked::url($this->referrer(), true)->redirect();
Expand Down
4 changes: 3 additions & 1 deletion lib/Page/MergeOrRename.php
Expand Up @@ -79,9 +79,11 @@ public function allows($mode)
/**
* Retrieve this user's permissions for the referring page.
*
* @param string $pageName The page name (unused in this method).
*
* @return integer The permissions bitmask.
*/
public function getPermissions()
public function getPermissions($pageName = null)
{
return parent::getPermissions($this->referrer());
}
Expand Down
9 changes: 7 additions & 2 deletions lib/Page/NewPage.php
Expand Up @@ -55,18 +55,23 @@ public function __construct($referrer)
/**
* Retrieve this user's permissions for the referring page.
*
* @param string $pageName The page name (unused in this method).
*
* @return integer The permissions bitmask.
*/
public function getPermissions()
public function getPermissions($pageName = null)
{
return parent::getPermissions($this->referrer());
}

/**
* Send them back whence they came if they aren't allowed to edit
* this page.
*
* $param integer $mode The page render mode.
* $param array $params Any page parameters.
*/
public function preDisplay()
public function preDisplay($mode, $params)
{
if (!strlen($this->referrer())) {
$GLOBALS['notification']->push(_("Page name must not be empty"));
Expand Down
9 changes: 7 additions & 2 deletions lib/Page/RevertPage.php
Expand Up @@ -45,18 +45,23 @@ public function __construct($referrer)
/**
* Retrieve this user's permissions for the referring page.
*
* @param string $pageName The page name (unused in this method).
*
* @return integer The permissions bitmask.
*/
public function getPermissions()
public function getPermissions($pageName = null)
{
return parent::getPermissions($this->referrer());
}

/**
* Send them back whence they came if they aren't allowed to
* edit this page.
*
* $param integer $mode The page render mode.
* $param array $params Any page parameters.
*/
public function preDisplay()
public function preDisplay($mode, $params)
{
$page = Wicked_Page::getPage($this->referrer());
if (!$page->allows(Wicked::MODE_EDIT)) {
Expand Down

0 comments on commit 49bf81a

Please sign in to comment.