diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-08-13 19:35:57 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-08-13 19:35:57 -0700 |
commit | d1406200084b47deefe68637777e0b1851166cfe (patch) | |
tree | c22f39574b3120b67133a0b08f1faad92407c9dc /include/items.php | |
parent | 50a1e0c618f3d1d512ea952230f76c6a005490c2 (diff) | |
download | volse-hubzilla-d1406200084b47deefe68637777e0b1851166cfe.tar.gz volse-hubzilla-d1406200084b47deefe68637777e0b1851166cfe.tar.bz2 volse-hubzilla-d1406200084b47deefe68637777e0b1851166cfe.zip |
add item validation function
Diffstat (limited to 'include/items.php')
-rwxr-xr-x | include/items.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/items.php b/include/items.php index ce4980c6a..d8c551cea 100755 --- a/include/items.php +++ b/include/items.php @@ -495,6 +495,32 @@ function post_activity_item($arr) { return $ret; } + +function validate_item_elements($message,$arr) { + + $result = array('success' => false); + + if(! array_key_exists('created',$arr)) + $result['message'] = 'missing created, possible author/owner lookup failure'; + + if((! $arr['mid']) || (! $arr['parent_mid'])) + $result['message'] = 'missing message-id or parent message-id'; + + if(array_key_exists('flags',$message) && in_array('relay',$message['flags']) && $arr['mid'] === $arr['parent_mid']) + $result['message'] = 'relay set on top level post'; + + if(! $result['message']) + $result['success'] = true; + + return $result; + +} + + + + + + /** * @brief Generate an Atom feed. * |