more infrastructure for sharing page design elements
This commit is contained in:
parent
e2f45a76b1
commit
ec604a4158
@ -27,12 +27,15 @@ function impel_init(&$a) {
|
|||||||
switch($j['type']) {
|
switch($j['type']) {
|
||||||
case 'webpage':
|
case 'webpage':
|
||||||
$arr['item_restrict'] = ITEM_WEBPAGE;
|
$arr['item_restrict'] = ITEM_WEBPAGE;
|
||||||
|
$namespace = 'WEBPAGE';
|
||||||
break;
|
break;
|
||||||
case 'block':
|
case 'block':
|
||||||
$arr['item_restrict'] = ITEM_BUILDBLOCK;
|
$arr['item_restrict'] = ITEM_BUILDBLOCK;
|
||||||
|
$namespace = 'BUILDBLOCK';
|
||||||
break;
|
break;
|
||||||
case 'layout':
|
case 'layout':
|
||||||
$arr['item_restrict'] = ITEM_PDL;
|
$arr['item_restrict'] = ITEM_PDL;
|
||||||
|
$namespace = 'PDL';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
logger('mod_impel: unrecognised element type' . print_r($j,true));
|
logger('mod_impel: unrecognised element type' . print_r($j,true));
|
||||||
@ -47,6 +50,19 @@ function impel_init(&$a) {
|
|||||||
$arr['author_xchan'] = (($j['author_xchan']) ? $j['author_xchan'] : $get_observer_hash());
|
$arr['author_xchan'] = (($j['author_xchan']) ? $j['author_xchan'] : $get_observer_hash());
|
||||||
$arr['mimetype'] = (($j['mimetype']) ? $j['mimetype'] : 'text/bbcode');
|
$arr['mimetype'] = (($j['mimetype']) ? $j['mimetype'] : 'text/bbcode');
|
||||||
|
|
||||||
|
if(! $j['mid'])
|
||||||
|
$j['mid'] = item_message_id();
|
||||||
|
|
||||||
|
$arr['mid'] = $arr['parent_mid'] = $j['mid'];
|
||||||
|
|
||||||
|
|
||||||
|
if($j['pagetitle']) {
|
||||||
|
require_once('library/urlify/URLify.php');
|
||||||
|
$pagetitle = strtolower(URLify::transliterate($j['pagetitle']));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$channel = get_channel();
|
$channel = get_channel();
|
||||||
|
|
||||||
@ -64,7 +80,33 @@ function impel_init(&$a) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$x = item_store($arr,$execflag);
|
$remote_id = 0;
|
||||||
|
|
||||||
|
$z = q("select * from item_id where $sid = '%s' and service = '%s' and uid = %d limit 1",
|
||||||
|
dbesc($pagetitle),
|
||||||
|
dbesc($namespace),
|
||||||
|
intval(local_user())
|
||||||
|
);
|
||||||
|
$i = q("select id from item where mid = '%s' and $uid = %d limit 1",
|
||||||
|
dbesc($arr['mid']),
|
||||||
|
intval(local_user())
|
||||||
|
);
|
||||||
|
if($z && $i) {
|
||||||
|
$remote_id = $z[0]['id'];
|
||||||
|
$arr['id'] = $i[0]['id'];
|
||||||
|
$x = item_store_update($arr,$execflag);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$x = item_store($arr,$execflag);
|
||||||
|
}
|
||||||
|
if($x['success'])
|
||||||
|
$item_id = $x['item_id'];
|
||||||
|
|
||||||
|
$channel = get_channel();
|
||||||
|
|
||||||
|
update_remote_id($channel,$item_id,$arr['item_restrict'],$pagetitle,$namespace,$remote_id,$arr['mid']);
|
||||||
|
|
||||||
|
|
||||||
$ret['success'] = true;
|
$ret['success'] = true;
|
||||||
json_return_and_die(true);
|
json_return_and_die(true);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user