Stronger typing and function access control in OStatus

This commit is contained in:
Mikael Nordfeldth 2014-05-05 19:06:22 +02:00
parent 30f4f5606c
commit bbada781b7
3 changed files with 7 additions and 8 deletions

View File

@ -22,9 +22,7 @@
* @author James Walker <james@status.net>
*/
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)) &&

View File

@ -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;
}

View File

@ -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;