some high-level stuff we may need for shareable menus. Also make the client register function do the right thing even though I refuse to make it work. If **you** want service federation with things like pumpio and openid connect, it's time for **you** to put your own skin in the game and quit treating project volunteers like excrement just because you can't get up off your lazy buttocks.
This commit is contained in:
parent
5a889558aa
commit
11301d51a5
@ -437,11 +437,6 @@ require_once('include/items.php');
|
|||||||
|
|
||||||
function api_client_register(&$a,$type) {
|
function api_client_register(&$a,$type) {
|
||||||
|
|
||||||
// This currently isn't providing the correct authentication flow.
|
|
||||||
|
|
||||||
if(! local_channel())
|
|
||||||
goaway(z_root() . '/login');
|
|
||||||
|
|
||||||
$ret = array();
|
$ret = array();
|
||||||
$key = random_string(16);
|
$key = random_string(16);
|
||||||
$secret = random_string(16);
|
$secret = random_string(16);
|
||||||
@ -460,12 +455,7 @@ require_once('include/items.php');
|
|||||||
dbesc($name),
|
dbesc($name),
|
||||||
dbesc($redirect),
|
dbesc($redirect),
|
||||||
dbesc($icon),
|
dbesc($icon),
|
||||||
intval(api_user())
|
intval(0)
|
||||||
);
|
|
||||||
$r = q("INSERT INTO xperm (xp_client, xp_channel, xp_perm) VALUES ('%s', %d, '%s') ",
|
|
||||||
dbesc($key),
|
|
||||||
intval(api_user()),
|
|
||||||
dbesc('all')
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$ret['client_id'] = $key;
|
$ret['client_id'] = $key;
|
||||||
|
@ -25,6 +25,10 @@ function impel_init(&$a) {
|
|||||||
$channel = $a->get_channel();
|
$channel = $a->get_channel();
|
||||||
|
|
||||||
$arr = array();
|
$arr = array();
|
||||||
|
$is_menu = false;
|
||||||
|
|
||||||
|
// a portable menu has its links rewritten with the local baseurl
|
||||||
|
$portable_menu = false;
|
||||||
|
|
||||||
switch($j['type']) {
|
switch($j['type']) {
|
||||||
case 'webpage':
|
case 'webpage':
|
||||||
@ -42,10 +46,28 @@ function impel_init(&$a) {
|
|||||||
$namespace = 'PDL';
|
$namespace = 'PDL';
|
||||||
$installed_type = t('layout');
|
$installed_type = t('layout');
|
||||||
break;
|
break;
|
||||||
|
case 'portable-menu':
|
||||||
|
$portable_menu = true;
|
||||||
|
// fall through
|
||||||
|
case 'menu':
|
||||||
|
$is_menu = true;
|
||||||
|
$installed_type = t('menu');
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
logger('mod_impel: unrecognised element type' . print_r($j,true));
|
logger('mod_impel: unrecognised element type' . print_r($j,true));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if($is_menu) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
$arr['uid'] = local_channel();
|
$arr['uid'] = local_channel();
|
||||||
$arr['aid'] = $channel['channel_account_id'];
|
$arr['aid'] = $channel['channel_account_id'];
|
||||||
$arr['title'] = $j['title'];
|
$arr['title'] = $j['title'];
|
||||||
@ -113,11 +135,15 @@ function impel_init(&$a) {
|
|||||||
}
|
}
|
||||||
$x = item_store($arr,$execflag);
|
$x = item_store($arr,$execflag);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($x['success']) {
|
if($x['success']) {
|
||||||
$item_id = $x['item_id'];
|
$item_id = $x['item_id'];
|
||||||
update_remote_id($channel,$item_id,$arr['item_restrict'],$pagetitle,$namespace,$remote_id,$arr['mid']);
|
update_remote_id($channel,$item_id,$arr['item_restrict'],$pagetitle,$namespace,$remote_id,$arr['mid']);
|
||||||
$ret['success'] = true;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($x['success']) {
|
||||||
|
$ret['success'] = true;
|
||||||
info( sprintf( t('%s element installed'), $installed_type));
|
info( sprintf( t('%s element installed'), $installed_type));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Reference in New Issue
Block a user