From: Mikael Nordfeldth Date: Mon, 5 May 2014 17:06:22 +0000 (+0200) Subject: Stronger typing and function access control in OStatus X-Git-Url: https://git.mxchange.org/?p=quix0rs-gnu-social.git;a=commitdiff_plain;h=bbada781b70d78d5c85b675c7add80a9263c5b30 Stronger typing and function access control in OStatus --- diff --git a/plugins/OStatus/actions/salmon.php b/plugins/OStatus/actions/salmon.php index 7cb4ac2fce..2a6fc15edd 100644 --- a/plugins/OStatus/actions/salmon.php +++ b/plugins/OStatus/actions/salmon.php @@ -22,9 +22,7 @@ * @author James Walker */ -if (!defined('STATUSNET')) { - exit(1); -} +if (!defined('GNUSOCIAL')) { exit(1); } class SalmonAction extends Action { @@ -32,7 +30,7 @@ class SalmonAction extends Action var $activity = null; var $target = null; - function prepare($args) + protected function prepare(array $args=array()) { StatusNet::setApi(true); // Send smaller error pages @@ -78,9 +76,9 @@ class SalmonAction extends Action * Check the posted activity type and break out to appropriate processing. */ - function handle($args) + protected function handle() { - StatusNet::setApi(true); // Send smaller error pages + parent::handle(); common_log(LOG_DEBUG, "Got a " . $this->activity->verb); if (Event::handle('StartHandleSalmonTarget', array($this->activity, $this->target)) && diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index 59eccc52d0..7ab5b7c8f0 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -342,12 +342,13 @@ class Ostatus_profile extends Managed_DataObject * @param Profile $actor * @return boolean success */ - public function notifyActivity($entry, $actor) + public function notifyActivity($entry, Profile $actor) { if ($this->salmonuri) { $salmon = new Salmon(); return $salmon->post($this->salmonuri, $this->notifyPrepXml($entry), $actor); } + common_debug(__CLASS__.' error: No salmonuri for Ostatus_profile uri: '.$this->uri); return false; } diff --git a/plugins/OStatus/lib/salmon.php b/plugins/OStatus/lib/salmon.php index c93b314f8a..244fe4748b 100644 --- a/plugins/OStatus/lib/salmon.php +++ b/plugins/OStatus/lib/salmon.php @@ -46,7 +46,7 @@ class Salmon * @param Profile $actor local user profile whose keys to sign with * @return boolean success */ - public function post($endpoint_uri, $xml, $actor) + public function post($endpoint_uri, $xml, Profile $actor) { if (empty($endpoint_uri)) { return false;