Go kill yourself isset
This commit is contained in:
parent
c8f3f079cc
commit
64dbb7b539
@ -201,38 +201,38 @@ class Activitypub_notice extends Managed_DataObject
|
|||||||
* Validates a remote notice.
|
* Validates a remote notice.
|
||||||
*
|
*
|
||||||
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
||||||
* @param StdClass $data
|
* @param Object $data
|
||||||
* @return boolean true in case of success
|
* @return boolean true in case of success
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static function validate_remote_notice(&$data)
|
public static function validate_remote_notice($data)
|
||||||
{
|
{
|
||||||
if (!isset($data->attributedTo)) {
|
if (empty($data->attributedTo)) {
|
||||||
common_debug('ActivityPub Notice Validator: Rejected because attributedTo was not specified.');
|
common_debug('ActivityPub Notice Validator: Rejected because attributedTo was not specified.');
|
||||||
throw new Exception('No attributedTo specified.');
|
throw new Exception('No attributedTo specified.');
|
||||||
}
|
}
|
||||||
if (!isset($data->id)) {
|
if (empty($data->id)) {
|
||||||
common_debug('ActivityPub Notice Validator: Rejected because Object ID was not specified.');
|
common_debug('ActivityPub Notice Validator: Rejected because Object ID was not specified.');
|
||||||
throw new Exception('Object ID not specified.');
|
throw new Exception('Object ID not specified.');
|
||||||
} elseif (!filter_var($data->id, FILTER_VALIDATE_URL)) {
|
} elseif (!filter_var($data->id, FILTER_VALIDATE_URL)) {
|
||||||
common_debug('ActivityPub Notice Validator: Rejected because Object ID is invalid.');
|
common_debug('ActivityPub Notice Validator: Rejected because Object ID is invalid.');
|
||||||
throw new Exception('Invalid Object ID.');
|
throw new Exception('Invalid Object ID.');
|
||||||
}
|
}
|
||||||
if (!isset($data->type) || $data->type !== 'Note') {
|
if (empty($data->type) || $data->type !== 'Note') {
|
||||||
common_debug('ActivityPub Notice Validator: Rejected because of Type.');
|
common_debug('ActivityPub Notice Validator: Rejected because of Type.');
|
||||||
throw new Exception('Invalid Object type.');
|
throw new Exception('Invalid Object type.');
|
||||||
}
|
}
|
||||||
if (!isset($data->content)) {
|
if (empty($data->content)) {
|
||||||
common_debug('ActivityPub Notice Validator: Rejected because Content was not specified.');
|
common_debug('ActivityPub Notice Validator: Rejected because Content was not specified.');
|
||||||
throw new Exception('Object content was not specified.');
|
throw new Exception('Object content was not specified.');
|
||||||
}
|
}
|
||||||
if (!isset($data->url)) {
|
if (empty($data->url)) {
|
||||||
throw new Exception('Object URL was not specified.');
|
throw new Exception('Object URL was not specified.');
|
||||||
} elseif (!filter_var($data->url, FILTER_VALIDATE_URL)) {
|
} elseif (!filter_var($data->url, FILTER_VALIDATE_URL)) {
|
||||||
common_debug('ActivityPub Notice Validator: Rejected because Object URL is invalid.');
|
common_debug('ActivityPub Notice Validator: Rejected because Object URL is invalid.');
|
||||||
throw new Exception('Invalid Object URL.');
|
throw new Exception('Invalid Object URL.');
|
||||||
}
|
}
|
||||||
if (!isset($data->cc)) {
|
if (empty($data->cc)) {
|
||||||
common_debug('ActivityPub Notice Validator: Rejected because Object CC was not specified.');
|
common_debug('ActivityPub Notice Validator: Rejected because Object CC was not specified.');
|
||||||
throw new Exception('Object CC was not specified.');
|
throw new Exception('Object CC was not specified.');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user