Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make lib/Page/*.Page.php compatible with PHP 8.2 #3

Merged
merged 10 commits into from
May 19, 2023
5 changes: 4 additions & 1 deletion lib/Page/AddPage.php
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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