aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-08-13 19:35:57 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-08-13 19:35:57 -0700
commitd1406200084b47deefe68637777e0b1851166cfe (patch)
treec22f39574b3120b67133a0b08f1faad92407c9dc /include/items.php
parent50a1e0c618f3d1d512ea952230f76c6a005490c2 (diff)
downloadvolse-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-xinclude/items.php26
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.
*