aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/items.php')
-rwxr-xr-xinclude/items.php34
1 files changed, 21 insertions, 13 deletions
diff --git a/include/items.php b/include/items.php
index 4ac4d6049..3bbd4cce3 100755
--- a/include/items.php
+++ b/include/items.php
@@ -1463,6 +1463,11 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
$ret = array('success' => false, 'item_id' => 0);
+ if(array_key_exists('cancel',$arr) && $arr['cancel']) {
+ logger('cancelled by plugin');
+ return $ret;
+ }
+
if(! $arr['uid']) {
logger('item_store: no uid');
$ret['message'] = 'No uid.';
@@ -1808,6 +1813,7 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
$x = q("update item set parent = id where id = %d",
intval($r[0]['id'])
);
+ $arr['parent'] = $r[0]['id'];
}
@@ -1881,6 +1887,12 @@ function item_store_update($arr,$allow_exec = false, $deliver = true) {
$allow_exec = $d['allow_exec'];
$ret = array('success' => false, 'item_id' => 0);
+
+ if(array_key_exists('cancel',$arr) && $arr['cancel']) {
+ logger('cancelled by plugin');
+ return $ret;
+ }
+
if(! intval($arr['uid'])) {
logger('item_store_update: no uid');
$ret['message'] = 'no uid.';
@@ -3968,8 +3980,8 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$sql_nets .= "( abook.abook_closeness >= " . intval($arr['cmin']) . " ";
$sql_nets .= " AND abook.abook_closeness <= " . intval($arr['cmax']) . " ) ";
- /** @fixme dead code, $cmax is undefined */
- if ($cmax == 99)
+
+ if ($arr['cmax'] == 99)
$sql_nets .= " OR abook.abook_closeness IS NULL ) ";
}
}
@@ -4104,25 +4116,21 @@ function webpage_to_namespace($webpage) {
function update_remote_id($channel,$post_id,$webpage,$pagetitle,$namespace,$remote_id,$mid) {
- $page_type = '';
-
if(! $post_id)
return;
- if($webpage == ITEM_TYPE_WEBPAGE)
- $page_type = 'WEBPAGE';
- elseif($webpage == ITEM_TYPE_BLOCK)
- $page_type = 'BUILDBLOCK';
- elseif($webpage == ITEM_TYPE_PDL)
- $page_type = 'PDL';
- elseif($webpage == ITEM_TYPE_DOC)
- $page_type = 'docfile';
- elseif($namespace && $remote_id) {
+ $page_type = webpage_to_namespace($webpage);
+
+ if($page_type == 'unknown' && $namespace && $remote_id) {
$page_type = $namespace;
$pagetitle = $remote_id;
}
+ else {
+ $page_type = '';
+ }
if($page_type) {
+
// store page info as an alternate message_id so we can access it via
// https://sitename/page/$channelname/$pagetitle
// if no pagetitle was given or it couldn't be transliterated into a url, use the first