we'll need a special system channel (not attached to any account) for directory synchronisation
This commit is contained in:
parent
11534ae91e
commit
9d6a4093ba
1
boot.php
1
boot.php
@ -147,6 +147,7 @@ define ( 'PAGE_NORMAL', 0x0000 );
|
|||||||
define ( 'PAGE_HIDDEN', 0x0001 );
|
define ( 'PAGE_HIDDEN', 0x0001 );
|
||||||
define ( 'PAGE_AUTOCONNECT', 0x0002 );
|
define ( 'PAGE_AUTOCONNECT', 0x0002 );
|
||||||
define ( 'PAGE_APPLICATION', 0x0004 );
|
define ( 'PAGE_APPLICATION', 0x0004 );
|
||||||
|
define ( 'PAGE_DIRECTORY_CHANNEL', 0x0008 ); // system channel used for directory synchronisation
|
||||||
|
|
||||||
define ( 'PAGE_REMOVED', 0x8000 );
|
define ( 'PAGE_REMOVED', 0x8000 );
|
||||||
|
|
||||||
|
@ -44,6 +44,21 @@ function validate_channelname($name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Create the system channel for directory synchronisation - this has no account attached
|
||||||
|
|
||||||
|
|
||||||
|
function create_dir_account() {
|
||||||
|
create_account(array(
|
||||||
|
'account_id' => 'xxx', // This will create an identity with an (integer) account_id of 0, but account_id is required
|
||||||
|
'nickname' => 'dir',
|
||||||
|
'name' => 'Directory',
|
||||||
|
'pageflags' => PAGE_DIRECTORY_CHANNEL|PAGE_HIDDEN,
|
||||||
|
'publish' => 0
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Required: name, nickname, account_id
|
// Required: name, nickname, account_id
|
||||||
|
|
||||||
// optional: pageflags
|
// optional: pageflags
|
||||||
@ -107,7 +122,7 @@ function create_identity($arr) {
|
|||||||
dbesc($hash),
|
dbesc($hash),
|
||||||
dbesc($key['prvkey']),
|
dbesc($key['prvkey']),
|
||||||
dbesc($key['pubkey']),
|
dbesc($key['pubkey']),
|
||||||
intval(PAGE_NORMAL)
|
intval($pageflags)
|
||||||
);
|
);
|
||||||
|
|
||||||
$r = q("select * from channel where channel_account_id = %d
|
$r = q("select * from channel where channel_account_id = %d
|
||||||
@ -123,6 +138,7 @@ function create_identity($arr) {
|
|||||||
|
|
||||||
$ret['channel'] = $r[0];
|
$ret['channel'] = $r[0];
|
||||||
|
|
||||||
|
if(intval($arr['account_id']))
|
||||||
set_default_login_identity($arr['account_id'],$ret['channel']['channel_id'],false);
|
set_default_login_identity($arr['account_id'],$ret['channel']['channel_id'],false);
|
||||||
|
|
||||||
// Ensure that there is a host keypair.
|
// Ensure that there is a host keypair.
|
||||||
@ -200,6 +216,7 @@ function create_identity($arr) {
|
|||||||
intval(ABOOK_FLAG_SELF)
|
intval(ABOOK_FLAG_SELF)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if(intval($ret['channel']['channel_account_id'])) {
|
||||||
|
|
||||||
// Create a group with no members. This allows somebody to use it
|
// Create a group with no members. This allows somebody to use it
|
||||||
// right away as a default group for new contacts.
|
// right away as a default group for new contacts.
|
||||||
@ -210,6 +227,7 @@ function create_identity($arr) {
|
|||||||
call_hooks('register_account', $newuid);
|
call_hooks('register_account', $newuid);
|
||||||
|
|
||||||
proc_run('php','include/directory.php', $ret['channel']['channel_id']);
|
proc_run('php','include/directory.php', $ret['channel']['channel_id']);
|
||||||
|
}
|
||||||
|
|
||||||
$ret['success'] = true;
|
$ret['success'] = true;
|
||||||
return $ret;
|
return $ret;
|
||||||
|
@ -1 +1 @@
|
|||||||
2013-03-15.253
|
2013-03-18.256
|
||||||
|
Reference in New Issue
Block a user