moving a lot of structure around. 'entity' is now 'channel'
This commit is contained in:
parent
dd5725c272
commit
fbafd92f7f
30
boot.php
30
boot.php
@ -368,7 +368,8 @@ if(! class_exists('App')) {
|
||||
class App {
|
||||
|
||||
public $account = null;
|
||||
public $identity = null;
|
||||
private $channel = null;
|
||||
|
||||
public $language;
|
||||
public $module_loaded = false;
|
||||
public $query_string;
|
||||
@ -594,6 +595,15 @@ if(! class_exists('App')) {
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
function set_channel($channel) {
|
||||
$this->channel = $channel;
|
||||
}
|
||||
|
||||
function get_channel()
|
||||
return $this->channel;
|
||||
}
|
||||
|
||||
|
||||
function set_pager_total($n) {
|
||||
$this->pager['total'] = intval($n);
|
||||
}
|
||||
@ -1056,7 +1066,7 @@ if(! function_exists('get_max_import_size')) {
|
||||
if(! function_exists('profile_load')) {
|
||||
function profile_load(&$a, $nickname, $profile = 0) {
|
||||
|
||||
$user = q("select entity_id from entity where entity_address = '%s' limit 1",
|
||||
$user = q("select channel_id from channel where channel_address = '%s' limit 1",
|
||||
dbesc($nickname)
|
||||
);
|
||||
|
||||
@ -1069,7 +1079,7 @@ function profile_load(&$a, $nickname, $profile = 0) {
|
||||
|
||||
if(remote_user() && count($_SESSION['remote'])) {
|
||||
foreach($_SESSION['remote'] as $visitor) {
|
||||
if($visitor['uid'] == $user[0]['entity_id']) {
|
||||
if($visitor['uid'] == $user[0]['channel_id']) {
|
||||
$r = q("SELECT `profile_id` FROM `contact` WHERE `id` = %d LIMIT 1",
|
||||
intval($visitor['cid'])
|
||||
);
|
||||
@ -1084,17 +1094,17 @@ function profile_load(&$a, $nickname, $profile = 0) {
|
||||
|
||||
if($profile) {
|
||||
$profile_int = intval($profile);
|
||||
$r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar_date` AS picdate, entity.* FROM `profile`
|
||||
left join `contact` on `contact`.`uid` = `profile`.`uid` LEFT JOIN entity ON `profile`.`uid` = entity.entity_id
|
||||
WHERE entity.entity_address = '%s' AND `profile`.`id` = %d and `contact`.`self` = 1 LIMIT 1",
|
||||
$r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar_date` AS picdate, channel.* FROM `profile`
|
||||
left join `contact` on `contact`.`uid` = `profile`.`uid` LEFT JOIN channel ON `profile`.`uid` = channel.channel_id
|
||||
WHERE channel.channel_address = '%s' AND `profile`.`id` = %d and `contact`.`self` = 1 LIMIT 1",
|
||||
dbesc($nickname),
|
||||
intval($profile_int)
|
||||
);
|
||||
}
|
||||
if(! ($r && count($r))) {
|
||||
$r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar_date` AS picdate, `entity`.* FROM `profile`
|
||||
left join `contact` on `contact`.`uid` = `profile`.`uid` LEFT JOIN `entity` ON `profile`.`uid` = entity.entity_id
|
||||
WHERE entity.entity_address = '%s' AND `profile`.`is_default` = 1 and `contact`.`self` = 1 LIMIT 1",
|
||||
$r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar_date` AS picdate, `channel`.* FROM `profile`
|
||||
left join `contact` on `contact`.`uid` = `profile`.`uid` LEFT JOIN `channel` ON `profile`.`uid` = channel.channel_id
|
||||
WHERE channel.channel_address = '%s' AND `profile`.`is_default` = 1 and `contact`.`self` = 1 LIMIT 1",
|
||||
dbesc($nickname)
|
||||
);
|
||||
}
|
||||
@ -1119,7 +1129,7 @@ function profile_load(&$a, $nickname, $profile = 0) {
|
||||
$a->profile = $r[0];
|
||||
|
||||
|
||||
$a->page['title'] = $a->profile['entity_name'] . " @ " . $a->config['sitename'];
|
||||
$a->page['title'] = $a->profile['channel_name'] . " @ " . $a->config['sitename'];
|
||||
// FIXME
|
||||
$_SESSION['theme'] = $a->profile['theme'];
|
||||
|
||||
|
135
database.sql
135
database.sql
@ -9,7 +9,7 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
|
||||
CREATE TABLE IF NOT EXISTS `account` (
|
||||
`account_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`account_parent` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`account_default_entity` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`account_default_channel` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`account_salt` char(32) NOT NULL DEFAULT '',
|
||||
`account_password` char(255) NOT NULL DEFAULT '',
|
||||
`account_email` char(255) NOT NULL DEFAULT '',
|
||||
@ -30,7 +30,7 @@ CREATE TABLE IF NOT EXISTS `account` (
|
||||
KEY `account_roles` (`account_roles`),
|
||||
KEY `account_lastlog` (`account_lastlog`),
|
||||
KEY `account_expires` (`account_expires`),
|
||||
KEY `account_default_entity` (`account_default_entity`)
|
||||
KEY `account_default_channel` (`account_default_channel`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `addon` (
|
||||
@ -94,6 +94,67 @@ CREATE TABLE IF NOT EXISTS `challenge` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `channel` (
|
||||
`channel_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`channel_account_id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`channel_primary` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`channel_name` char(255) NOT NULL DEFAULT '',
|
||||
`channel_address` char(255) NOT NULL DEFAULT '',
|
||||
`channel_global_id` char(255) NOT NULL DEFAULT '',
|
||||
`channel_timezone` char(128) NOT NULL DEFAULT 'UTC',
|
||||
`channel_location` char(255) NOT NULL DEFAULT '',
|
||||
`channel_theme` char(255) NOT NULL DEFAULT '',
|
||||
`channel_startpage` char(255) NOT NULL DEFAULT '',
|
||||
`channel_pubkey` text NOT NULL,
|
||||
`channel_prvkey` text NOT NULL,
|
||||
`channel_notifyflags` int(10) unsigned NOT NULL DEFAULT '65535',
|
||||
`channel_pageflags` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`channel_max_anon_mail` int(10) unsigned NOT NULL DEFAULT '10',
|
||||
`channel_max_friend_req` int(10) unsigned NOT NULL DEFAULT '10',
|
||||
`channel_passwd_reset` char(255) NOT NULL DEFAULT '',
|
||||
`channel_default_gid` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`channel_allow_cid` mediumtext NOT NULL,
|
||||
`channel_allow_gid` mediumtext NOT NULL,
|
||||
`channel_deny_cid` mediumtext NOT NULL,
|
||||
`channel_deny_gid` mediumtext NOT NULL,
|
||||
`channel_r_stream` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`channel_r_profile` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`channel_r_photos` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`channel_r_abook` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`channel_w_stream` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`channel_w_wall` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`channel_w_tagwall` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`channel_w_comment` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`channel_w_mail` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`channel_w_photos` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`channel_w_chat` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
PRIMARY KEY (`channel_id`),
|
||||
KEY `channel_account_id` (`channel_account_id`),
|
||||
KEY `channel_primary` (`channel_primary`),
|
||||
KEY `channel_name` (`channel_name`),
|
||||
KEY `channel_address` (`channel_address`),
|
||||
KEY `channel_global_id` (`channel_global_id`),
|
||||
KEY `channel_timezone` (`channel_timezone`),
|
||||
KEY `channel_location` (`channel_location`),
|
||||
KEY `channel_theme` (`channel_theme`),
|
||||
KEY `channel_notifyflags` (`channel_notifyflags`),
|
||||
KEY `channel_pageflags` (`channel_pageflags`),
|
||||
KEY `channel_max_anon_mail` (`channel_max_anon_mail`),
|
||||
KEY `channel_max_friend_req` (`channel_max_friend_req`),
|
||||
KEY `channel_default_gid` (`channel_default_gid`),
|
||||
KEY `channel_r_stream` (`channel_r_stream`),
|
||||
KEY `channel_r_profile` (`channel_r_profile`),
|
||||
KEY `channel_r_photos` (`channel_r_photos`),
|
||||
KEY `channel_r_abook` (`channel_r_abook`),
|
||||
KEY `channel_w_stream` (`channel_w_stream`),
|
||||
KEY `channel_w_wall` (`channel_w_wall`),
|
||||
KEY `channel_w_tagwall` (`channel_w_tagwall`),
|
||||
KEY `channel_w_comment` (`channel_w_comment`),
|
||||
KEY `channel_w_mail` (`channel_w_mail`),
|
||||
KEY `channel_w_photos` (`channel_w_photos`),
|
||||
KEY `channel_w_chat` (`channel_w_chat`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `clients` (
|
||||
`client_id` varchar(20) NOT NULL,
|
||||
`pw` varchar(20) NOT NULL,
|
||||
@ -216,66 +277,6 @@ CREATE TABLE IF NOT EXISTS `deliverq` (
|
||||
KEY `contact` (`contact`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `entity` (
|
||||
`entity_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`entity_account_id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`entity_primary` tinyint(1) unsigned NOT NULL DEFAULT '0',
|
||||
`entity_name` char(255) NOT NULL DEFAULT '',
|
||||
`entity_address` char(255) NOT NULL DEFAULT '',
|
||||
`entity_global_id` char(255) NOT NULL DEFAULT '',
|
||||
`entity_timezone` char(128) NOT NULL DEFAULT 'UTC',
|
||||
`entity_location` char(255) NOT NULL DEFAULT '',
|
||||
`entity_theme` char(255) NOT NULL DEFAULT '',
|
||||
`entity_startpage` char(255) NOT NULL DEFAULT '',
|
||||
`entity_pubkey` text NOT NULL,
|
||||
`entity_prvkey` text NOT NULL,
|
||||
`entity_notifyflags` int(10) unsigned NOT NULL DEFAULT '65535',
|
||||
`entity_pageflags` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`entity_max_anon_mail` int(10) unsigned NOT NULL DEFAULT '10',
|
||||
`entity_max_friend_req` int(10) unsigned NOT NULL DEFAULT '10',
|
||||
`entity_passwd_reset` char(255) NOT NULL DEFAULT '',
|
||||
`entity_default_gid` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`entity_allow_cid` mediumtext NOT NULL,
|
||||
`entity_allow_gid` mediumtext NOT NULL,
|
||||
`entity_deny_cid` mediumtext NOT NULL,
|
||||
`entity_deny_gid` mediumtext NOT NULL,
|
||||
`entity_r_stream` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`entity_r_profile` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`entity_r_photos` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`entity_r_abook` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`entity_w_stream` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`entity_w_wall` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`entity_w_tagwall` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`entity_w_comment` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`entity_w_mail` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`entity_w_photos` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
`entity_w_chat` tinyint(3) unsigned NOT NULL DEFAULT '128',
|
||||
PRIMARY KEY (`entity_id`),
|
||||
KEY `entity_account_id` (`entity_account_id`),
|
||||
KEY `entity_name` (`entity_name`),
|
||||
KEY `entity_address` (`entity_address`),
|
||||
KEY `entity_global_id` (`entity_global_id`),
|
||||
KEY `entity_timezone` (`entity_timezone`),
|
||||
KEY `entity_location` (`entity_location`),
|
||||
KEY `entity_theme` (`entity_theme`),
|
||||
KEY `entity_notifyflags` (`entity_notifyflags`),
|
||||
KEY `entity_pageflags` (`entity_pageflags`),
|
||||
KEY `entity_max_anon_mail` (`entity_max_anon_mail`),
|
||||
KEY `entity_max_friend_req` (`entity_max_friend_req`),
|
||||
KEY `entity_default_gid` (`entity_default_gid`),
|
||||
KEY `entity_primary` (`entity_primary`),
|
||||
KEY `entity_r_stream` (`entity_r_stream`),
|
||||
KEY `entity_r_profile` (`entity_r_profile`),
|
||||
KEY `entity_r_photos` (`entity_r_photos`),
|
||||
KEY `entity_w_stream` (`entity_w_stream`),
|
||||
KEY `entity_w_wall` (`entity_w_wall`),
|
||||
KEY `entity_w_comment` (`entity_w_comment`),
|
||||
KEY `entity_w_mail` (`entity_w_mail`),
|
||||
KEY `entity_w_tagwall` (`entity_w_tagwall`),
|
||||
KEY `entity_w_photos` (`entity_w_photos`),
|
||||
KEY `entity_w_chat` (`entity_w_chat`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `event` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`uid` int(11) NOT NULL,
|
||||
@ -450,13 +451,15 @@ CREATE TABLE IF NOT EXISTS `hubloc` (
|
||||
`hubloc_url` char(255) NOT NULL DEFAULT '',
|
||||
`hubloc_url_sig` char(255) NOT NULL,
|
||||
`hubloc_callback` char(255) NOT NULL DEFAULT '',
|
||||
`hubloc_connect` char(255) NOT NULL DEFAULT '',
|
||||
`hubloc_sitekey` text NOT NULL,
|
||||
PRIMARY KEY (`hubloc_id`),
|
||||
KEY `hubloc_url` (`hubloc_url`),
|
||||
KEY `hubloc_guid` (`hubloc_guid`),
|
||||
KEY `hubloc_flags` (`hubloc_flags`),
|
||||
KEY `hubloc_guid_sig` (`hubloc_guid_sig`),
|
||||
KEY `hubloc_url_sig` (`hubloc_url_sig`)
|
||||
KEY `hubloc_url_sig` (`hubloc_url_sig`),
|
||||
KEY `hubloc_connect` (`hubloc_connect`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `intro` (
|
||||
@ -571,14 +574,16 @@ CREATE TABLE IF NOT EXISTS `item` (
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `item_id` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`iid` int(11) NOT NULL,
|
||||
`uid` int(11) NOT NULL,
|
||||
`sid` char(255) NOT NULL,
|
||||
`service` char(255) NOT NULL,
|
||||
PRIMARY KEY (`iid`),
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `uid` (`uid`),
|
||||
KEY `sid` (`sid`),
|
||||
KEY `service` (`service`)
|
||||
KEY `service` (`service`),
|
||||
KEY `iid` (`iid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `locks` (
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
|
||||
function map_perms($entity,$zguid,$zsig) {
|
||||
function map_perms($channel,$zguid,$zsig) {
|
||||
|
||||
$is_contact = false;
|
||||
$is_site = false;
|
||||
@ -19,18 +19,18 @@ function map_perms($entity,$zguid,$zsig) {
|
||||
|
||||
$r = q("select * from contact where guid = '%s' and uid = %d limit 1",
|
||||
dbesc($zguid),
|
||||
intval($entity['entity_id'])
|
||||
intval($channel['channel_id'])
|
||||
);
|
||||
if($r && count($r)) {
|
||||
$is_contact = true;
|
||||
$contact = $r[0];
|
||||
}
|
||||
$r = q("select * from entity where entity_global_id = '%s'",
|
||||
$r = q("select * from channel where channel_global_id = '%s'",
|
||||
dbesc($zguid)
|
||||
);
|
||||
if($r && count($r)) {
|
||||
foreach($r as $rr) {
|
||||
if(base64url_encode(rsa_sign($rr['entity_global_id'],$rr['entity_prvkey'])) === $zsig) {
|
||||
if(base64url_encode(rsa_sign($rr['channel_global_id'],$rr['channel_prvkey'])) === $zsig) {
|
||||
$is_site = true;
|
||||
break;
|
||||
}
|
||||
@ -39,25 +39,25 @@ function map_perms($entity,$zguid,$zsig) {
|
||||
}
|
||||
|
||||
$perms = array(
|
||||
'view_stream' => array('entity_r_stream', PERMS_R_STREAM ),
|
||||
'view_profile' => array('entity_r_profile', PERMS_R_PROFILE),
|
||||
'view_photos' => array('entity_r_photos', PERMS_R_PHOTOS),
|
||||
'view_contacts' => array('entity_r_abook', PERMS_R_ABOOK),
|
||||
'view_stream' => array('channel_r_stream', PERMS_R_STREAM ),
|
||||
'view_profile' => array('channel_r_profile', PERMS_R_PROFILE),
|
||||
'view_photos' => array('channel_r_photos', PERMS_R_PHOTOS),
|
||||
'view_contacts' => array('channel_r_abook', PERMS_R_ABOOK),
|
||||
|
||||
'send_stream' => array('entity_w_stream', PERMS_W_STREAM),
|
||||
'post_wall' => array('entity_w_wall', PERMS_W_WALL),
|
||||
'tag_deliver' => array('entity_w_tagwall', PERMS_W_TAGWALL),
|
||||
'post_comments' => array('entity_w_comment', PERMS_W_COMMENT),
|
||||
'post_mail' => array('entity_w_mail', PERMS_W_MAIL),
|
||||
'post_photos' => array('entity_w_photos', PERMS_W_PHOTOS),
|
||||
'chat' => array('entity_w_chat', PERMS_W_CHAT),
|
||||
'send_stream' => array('channel_w_stream', PERMS_W_STREAM),
|
||||
'post_wall' => array('channel_w_wall', PERMS_W_WALL),
|
||||
'tag_deliver' => array('channel_w_tagwall', PERMS_W_TAGWALL),
|
||||
'post_comments' => array('channel_w_comment', PERMS_W_COMMENT),
|
||||
'post_mail' => array('channel_w_mail', PERMS_W_MAIL),
|
||||
'post_photos' => array('channel_w_photos', PERMS_W_PHOTOS),
|
||||
'chat' => array('channel_w_chat', PERMS_W_CHAT),
|
||||
);
|
||||
|
||||
|
||||
$ret = array();
|
||||
|
||||
foreach($perms as $k => $v) {
|
||||
$ret[$k] = z_check_perms($k,$v,$entity,$contact,$is_contact,$is_site,$is_network,$is_anybody);
|
||||
$ret[$k] = z_check_perms($k,$v,$channel,$contact,$is_contact,$is_site,$is_network,$is_anybody);
|
||||
|
||||
}
|
||||
|
||||
@ -65,11 +65,11 @@ function map_perms($entity,$zguid,$zsig) {
|
||||
|
||||
}
|
||||
|
||||
function z_check_perms($k,$v,$entity,$contact,$is_contact,$is_site,$is_network,$is_anybody) {
|
||||
function z_check_perms($k,$v,$channel,$contact,$is_contact,$is_site,$is_network,$is_anybody) {
|
||||
|
||||
$allow = (($contact['self']) ? true : false);
|
||||
|
||||
switch($entity[$v[0]]) {
|
||||
switch($channel[$v[0]]) {
|
||||
case PERMS_PUBLIC:
|
||||
if($is_anybody)
|
||||
$allow = true;
|
||||
|
@ -7,7 +7,7 @@ require_once('include/crypto.php');
|
||||
function identity_check_service_class($account_id) {
|
||||
$ret = array('success' => false, $message => '');
|
||||
|
||||
$r = q("select count(entity_id) as total from entity were entity_account_id = %d ",
|
||||
$r = q("select count(channel_id) as total from channel were channel_account_id = %d ",
|
||||
intval($account_id)
|
||||
);
|
||||
if(! ($r && count($r))) {
|
||||
@ -53,9 +53,9 @@ function create_identity($arr) {
|
||||
|
||||
$primary = true;
|
||||
|
||||
$r = q("insert into entity ( entity_account_id, entity_primary,
|
||||
entity_name, entity_address, entity_global_id, entity_prvkey,
|
||||
entity_pubkey, entity_pageflags )
|
||||
$r = q("insert into channel ( channel_account_id, channel_primary,
|
||||
channel_name, channel_address, channel_global_id, channel_prvkey,
|
||||
channel_pubkey, channel_pageflags )
|
||||
values ( %d, %d, '%s', '%s', '%s', '%s', '%s', %d ) ",
|
||||
|
||||
intval($arr['account_id']),
|
||||
@ -68,8 +68,8 @@ function create_identity($arr) {
|
||||
intval(PAGE_NORMAL)
|
||||
);
|
||||
|
||||
$r = q("select * from entity where entity_account_id = %d
|
||||
and entity_global_id = '%s' limit 1",
|
||||
$r = q("select * from channel where channel_account_id = %d
|
||||
and channel_global_id = '%s' limit 1",
|
||||
intval($arr['account_id']),
|
||||
dbesc($guid)
|
||||
);
|
||||
@ -79,50 +79,50 @@ function create_identity($arr) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
$ret['entity'] = $r[0];
|
||||
$ret['channel'] = $r[0];
|
||||
|
||||
set_default_login_identity($arr['account_id'],$ret['entity']['entity_id'],false);
|
||||
set_default_login_identity($arr['account_id'],$ret['channel']['channel_id'],false);
|
||||
|
||||
// Create a verified hub location pointing to this site.
|
||||
|
||||
$r = q("insert into hubloc ( hubloc_guid, hubloc_guid_sig, hubloc_flags,
|
||||
hubloc_url, hubloc_url_sig, hubloc_callback, hubloc_sitekey )
|
||||
values ( '%s', '%s', %d, '%s', '%s', '%s', '%s' )",
|
||||
dbesc($ret['entity']['entity_global_id']),
|
||||
dbesc(base64url_encode(rsa_sign($ret['entity']['entity_global_id'],$ret['entity']['entity_prvkey']))),
|
||||
dbesc($ret['channel']['channel_global_id']),
|
||||
dbesc(base64url_encode(rsa_sign($ret['channel']['channel_global_id'],$ret['channel']['channel_prvkey']))),
|
||||
intval(($primary) ? HUBLOC_FLAGS_PRIMARY : 0),
|
||||
dbesc(z_root()),
|
||||
dbesc(base64url_encode(rsa_sign(z_root(),$ret['entity']['entity_prvkey']))),
|
||||
dbesc(base64url_encode(rsa_sign(z_root(),$ret['channel']['channel_prvkey']))),
|
||||
dbesc(z_root() . '/post'),
|
||||
dbesc(get_config('system','pubkey'))
|
||||
);
|
||||
if(! $r)
|
||||
logger('create_identity: Unable to store hub location');
|
||||
|
||||
$newuid = $ret['entity']['entity_id'];
|
||||
$newuid = $ret['channel']['channel_id'];
|
||||
|
||||
$r = q("INSERT INTO `profile` ( `aid`, `uid`, `profile_name`, `is_default`, `name`, `photo`, `thumb`)
|
||||
VALUES ( %d, %d, '%s', %d, '%s', '%s', '%s') ",
|
||||
intval($ret['entity']['entity_account_id']),
|
||||
intval($ret['channel']['channel_account_id']),
|
||||
intval($newuid),
|
||||
t('default'),
|
||||
1,
|
||||
dbesc($ret['entity']['entity_name']),
|
||||
dbesc($ret['channel']['channel_name']),
|
||||
dbesc($a->get_baseurl() . "/photo/profile/{$newuid}"),
|
||||
dbesc($a->get_baseurl() . "/photo/avatar/{$newuid}")
|
||||
);
|
||||
|
||||
$r = q("INSERT INTO `contact` ( `aid`, `uid`, `created`, `self`, `name`, `nick`, `photo`, `thumb`, `micro`, `blocked`, `pending`, `url`, `name_date`, `uri_date`, `avatar_date`, `closeness` )
|
||||
VALUES ( %d, %d, '%s', 1, '%s', '%s', '%s', '%s', '%s', 0, 0, '%s', '%s', '%s', '%s', 0 ) ",
|
||||
intval($ret['entity']['entity_account_id']),
|
||||
intval($ret['channel']['channel_account_id']),
|
||||
intval($newuid),
|
||||
datetime_convert(),
|
||||
dbesc($ret['entity']['entity_name']),
|
||||
dbesc($ret['entity']['entity_address']),
|
||||
dbesc($ret['channel']['channel_name']),
|
||||
dbesc($ret['channel']['channel_address']),
|
||||
dbesc($a->get_baseurl() . "/photo/profile/{$newuid}"),
|
||||
dbesc($a->get_baseurl() . "/photo/avatar/{$newuid}"),
|
||||
dbesc($a->get_baseurl() . "/photo/micro/{$newuid}"),
|
||||
dbesc($a->get_baseurl() . "/profile/{$ret['entity']['entity_address']}"),
|
||||
dbesc($a->get_baseurl() . "/profile/{$ret['channel']['channel_address']}"),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert())
|
||||
@ -141,16 +141,16 @@ function create_identity($arr) {
|
||||
|
||||
}
|
||||
|
||||
// set default identity for account_id to identity_id
|
||||
// set default identity for account_id to channel_id
|
||||
// if $force is false only do this if there is no current default
|
||||
|
||||
function set_default_login_identity($account_id,$entity_id,$force = true) {
|
||||
$r = q("select account_default_entity from account where account_id = %d limit 1",
|
||||
function set_default_login_identity($account_id,$channel_id,$force = true) {
|
||||
$r = q("select account_default_channel from account where account_id = %d limit 1",
|
||||
intval($account_id)
|
||||
);
|
||||
if(($r) && (count($r)) && ((! intval($r[0]['account_default_entity'])) || $force)) {
|
||||
$r = q("update account set account_default_entity = %d where account_id = %d limit 1",
|
||||
intval($entity_id),
|
||||
if(($r) && (count($r)) && ((! intval($r[0]['account_default_channel'])) || $force)) {
|
||||
$r = q("update account set account_default_channel = %d where account_id = %d limit 1",
|
||||
intval($channel_id),
|
||||
intval($account_id)
|
||||
);
|
||||
}
|
||||
|
@ -27,7 +27,9 @@ function nav(&$a) {
|
||||
*
|
||||
*/
|
||||
|
||||
$myident = ((is_array($a->identity) && isset($a->identity['entity_address'])) ? $a->identity['entity_address'] . '@' : '');
|
||||
$channel = $a->get_channel();
|
||||
|
||||
$myident = ((is_array($channel) && isset($channel['channel_address'])) ? $channel['channel_address'] . '@' : '');
|
||||
|
||||
$sitelocation = $myident . substr($a->get_baseurl($ssl_state),strpos($a->get_baseurl($ssl_state),'//') + 2 );
|
||||
|
||||
@ -46,16 +48,16 @@ function nav(&$a) {
|
||||
$nav['logout'] = Array('logout',t('Logout'), "", t('End this session'));
|
||||
|
||||
// user menu
|
||||
$nav['usermenu'][] = Array('profile/' . $a->identity['entity_address'], t('Status'), "", t('Your posts and conversations'));
|
||||
$nav['usermenu'][] = Array('profile/' . $a->identity['entity_address']. '?tab=profile', t('Profile'), "", t('Your profile page'));
|
||||
$nav['usermenu'][] = Array('photos/' . $a->identity['entity_address'], t('Photos'), "", t('Your photos'));
|
||||
$nav['usermenu'][] = Array('profile/' . $channel['channel_address'], t('Status'), "", t('Your posts and conversations'));
|
||||
$nav['usermenu'][] = Array('profile/' . $channel['channel_address']. '?tab=profile', t('Profile'), "", t('Your profile page'));
|
||||
$nav['usermenu'][] = Array('photos/' . $channel['channel_address'], t('Photos'), "", t('Your photos'));
|
||||
$nav['usermenu'][] = Array('events/', t('Events'), "", t('Your events'));
|
||||
|
||||
// user info
|
||||
$r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->identity['entity_id']));
|
||||
$r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($channel['channel_id']));
|
||||
$userinfo = array(
|
||||
'icon' => $r[0]['micro'],
|
||||
'name' => $a->identity['entity_name'],
|
||||
'name' => $channel['channel_name'],
|
||||
);
|
||||
|
||||
}
|
||||
@ -111,9 +113,9 @@ function nav(&$a) {
|
||||
|
||||
$nav['network'] = array('network', t('Network'), "", t('Conversations from your friends'));
|
||||
|
||||
$nav['home'] = array('profile/' . $a->identity['entity_address'], t('Home'), "", t('Your posts and conversations'));
|
||||
$nav['home'] = array('profile/' . $channel['channel_address'], t('Home'), "", t('Your posts and conversations'));
|
||||
|
||||
if($a->identity['entity_pageflags'] == PAGE_NORMAL) {
|
||||
if($channel['channel_pageflags'] == PAGE_NORMAL) {
|
||||
$nav['introductions'] = array('notifications/intros', t('Introductions'), "", t('Friend Requests'));
|
||||
$nav['notifications'] = array('notifications', t('Notifications'), "", t('Notifications'));
|
||||
$nav['notifications']['all']=array('notifications/system', t('See all notifications'), "", "");
|
||||
|
@ -27,27 +27,27 @@ function authenticate_success($user_record, $login_initial = false, $interactive
|
||||
|
||||
$uid_to_load = (((x($_SESSION,'uid')) && (intval($_SESSION['uid']))) ? intval($_SESSION['uid']) : 0);
|
||||
if(! $uid_to_load)
|
||||
$uid_to_load = intval($a->account['account_default_entity']);
|
||||
$uid_to_load = intval($a->account['account_default_channel']);
|
||||
|
||||
if($uid_to_load) {
|
||||
$r = q("select * from entity where entity_id = %d and entity_account_id = %d limit 1",
|
||||
$r = q("select * from channel where channel_id = %d and channel_account_id = %d limit 1",
|
||||
intval($uid_to_load),
|
||||
intval($a->account['account_id'])
|
||||
);
|
||||
if($r && count($r)) {
|
||||
$_SESSION['uid'] = intval($r[0]['entity_id']);
|
||||
$a->identity = $r[0];
|
||||
$_SESSION['theme'] = $a->identity['entity_theme'];
|
||||
date_default_timezone_set($a->identity['entity_timezone']);
|
||||
$_SESSION['uid'] = intval($r[0]['channel_id']);
|
||||
$a->set_channel($r[0]);
|
||||
$_SESSION['theme'] = $r[0]['channel_theme'];
|
||||
date_default_timezone_set($r[0]['channel_timezone']);
|
||||
}
|
||||
|
||||
$r = q("SELECT * FROM contact WHERE uid = %d AND self = 1 LIMIT 1",
|
||||
intval($a->identity['entity_id'])
|
||||
$c = q("SELECT * FROM contact WHERE uid = %d AND self = 1 LIMIT 1",
|
||||
intval($r[0]['channel_id'])
|
||||
);
|
||||
|
||||
if($r && count($r)) {
|
||||
$a->contact = $r[0];
|
||||
$a->cid = $r[0]['id'];
|
||||
if($c && count($c)) {
|
||||
$a->contact = $c[0];
|
||||
$a->cid = $c[0]['id'];
|
||||
$_SESSION['cid'] = $a->cid;
|
||||
}
|
||||
|
||||
|
@ -1665,10 +1665,10 @@ function check_webbie($arr) {
|
||||
}
|
||||
}
|
||||
if(strlen($str)) {
|
||||
$r = q("select entity_address from entity where entity_address in ( $str ) ");
|
||||
$r = q("select channel_address from channel where channel_address in ( $str ) ");
|
||||
if(count($r)) {
|
||||
foreach($r as $rr) {
|
||||
$taken[] = $rr['entity_address'];
|
||||
$taken[] = $rr['channel_address'];
|
||||
}
|
||||
}
|
||||
foreach($arr as $x) {
|
||||
|
@ -2,14 +2,14 @@
|
||||
|
||||
/**
|
||||
*
|
||||
* @function zot_new_uid($entity_nick)
|
||||
* @entity_id = unique nickname of controlling entity
|
||||
* @function zot_new_uid($channel_nick)
|
||||
* @channel_id = unique nickname of controlling entity
|
||||
* @returns string
|
||||
*
|
||||
*/
|
||||
|
||||
function zot_new_uid($entity_nick) {
|
||||
$rawstr = z_root() . '/' . $entity_nick . '.' . mt_rand();
|
||||
function zot_new_uid($channel_nick) {
|
||||
$rawstr = z_root() . '/' . $channel_nick . '.' . mt_rand();
|
||||
return(base64url_encode(hash('whirlpool',$rawstr,true),true));
|
||||
}
|
||||
|
||||
@ -59,13 +59,13 @@ function zot_verify(&$item,$identity) {
|
||||
|
||||
|
||||
|
||||
function zot_notify($entity,$url) {
|
||||
function zot_notify($channel,$url) {
|
||||
$x = z_post_url($url, array(
|
||||
'type' => 'notify',
|
||||
'guid' => $entity['entity_global_id'],
|
||||
'guid_sig' => base64url_encode($guid,$entity['prvkey']),
|
||||
'guid' => $channel['channel_global_id'],
|
||||
'guid_sig' => base64url_encode($guid,$channel['prvkey']),
|
||||
'hub' => z_root(),
|
||||
'hub_sig' => base64url_encode(z_root,$entity['prvkey']),
|
||||
'hub_sig' => base64url_encode(z_root,$channel['prvkey']),
|
||||
'callback' => '/post',
|
||||
'spec' => ZOT_REVISION)
|
||||
);
|
||||
|
@ -13,7 +13,7 @@ function feed_init(&$a) {
|
||||
|
||||
$channel = '';
|
||||
if(argc() > 1) {
|
||||
$r = q("select * from entity where entity_address = '%s' limit 1",
|
||||
$r = q("select * from channel where channel_address = '%s' limit 1",
|
||||
dbesc(argv(1))
|
||||
);
|
||||
if(!($r && count($r)))
|
||||
@ -23,13 +23,13 @@ function feed_init(&$a) {
|
||||
|
||||
// check site and channel permissions
|
||||
|
||||
if(!($channel['entity_r_stream'] & PERMS_PUBLIC))
|
||||
if(!($channel['channel_r_stream'] & PERMS_PUBLIC))
|
||||
killme();
|
||||
|
||||
if((intval(get_config('system','block_public'))) && (! get_account_id()))
|
||||
killme();
|
||||
|
||||
logger('mod_feed: public feed request from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $channel['entity_address']);
|
||||
logger('mod_feed: public feed request from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $channel['channel_address']);
|
||||
echo get_public_feed($channel,$params);
|
||||
killme();
|
||||
}
|
||||
|
@ -6,8 +6,10 @@ function home_init(&$a) {
|
||||
$ret = array();
|
||||
call_hooks('home_init',$ret);
|
||||
|
||||
if(local_user() && ($a->identity['entity_address']))
|
||||
goaway( $a->get_baseurl() . '/profile/' . $a->identity['entity_address']);
|
||||
$channel = $a->get_channel();
|
||||
|
||||
if(local_user() && $channel && $channel['channel_address']))
|
||||
goaway( $a->get_baseurl() . '/profile/' . $channel['channel_address']);
|
||||
|
||||
}}
|
||||
|
||||
|
38
mod/item.php
38
mod/item.php
@ -175,12 +175,12 @@ function item_post(&$a) {
|
||||
|
||||
$user = null;
|
||||
|
||||
$r = q("SELECT entity.*, account.* FROM entity left join account on entity.entity_account_id = account.account_id
|
||||
where entity.entity_id = %d LIMIT 1",
|
||||
$r = q("SELECT channel.*, account.* FROM channel left join account on channel.channel_account_id = account.account_id
|
||||
where channel.channel_id = %d LIMIT 1",
|
||||
intval($profile_uid)
|
||||
);
|
||||
if(count($r))
|
||||
$entity = $r[0];
|
||||
$channel = $r[0];
|
||||
|
||||
if($orig_post) {
|
||||
$str_group_allow = $orig_post['allow_gid'];
|
||||
@ -208,10 +208,10 @@ function item_post(&$a) {
|
||||
&& (! array_key_exists('group_allow',$_REQUEST))
|
||||
&& (! array_key_exists('contact_deny',$_REQUEST))
|
||||
&& (! array_key_exists('group_deny',$_REQUEST))) {
|
||||
$str_group_allow = $entity['entity_allow_gid'];
|
||||
$str_contact_allow = $entity['entity_allow_cid'];
|
||||
$str_group_deny = $entity['entity_deny_gid'];
|
||||
$str_contact_deny = $entity['entity_deny_cid'];
|
||||
$str_group_allow = $channel['channel_allow_gid'];
|
||||
$str_contact_allow = $channel['channel_allow_cid'];
|
||||
$str_group_deny = $channel['channel_deny_gid'];
|
||||
$str_contact_deny = $channel['channel_deny_cid'];
|
||||
}
|
||||
else {
|
||||
|
||||
@ -756,11 +756,11 @@ function item_post(&$a) {
|
||||
if($contact_record != $author) {
|
||||
notification(array(
|
||||
'type' => NOTIFY_COMMENT,
|
||||
'notify_flags' => $entity['entity_notifyflags'],
|
||||
'language' => $entity['account_language'],
|
||||
'to_name' => $entity['entity_name'],
|
||||
'to_email' => $entity['account_email'],
|
||||
'uid' => $entity['entity_id'],
|
||||
'notify_flags' => $channel['channel_notifyflags'],
|
||||
'language' => $channel['account_language'],
|
||||
'to_name' => $channel['channel_name'],
|
||||
'to_email' => $channel['account_email'],
|
||||
'uid' => $channel['channel_id'],
|
||||
'item' => $datarray,
|
||||
'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
|
||||
'source_name' => $datarray['author-name'],
|
||||
@ -781,11 +781,11 @@ function item_post(&$a) {
|
||||
if($contact_record != $author) {
|
||||
notification(array(
|
||||
'type' => NOTIFY_WALL,
|
||||
'notify_flags' => $entity['entity_notifyflags'],
|
||||
'language' => $entity['account_language'],
|
||||
'to_name' => $entity['entity_name'],
|
||||
'to_email' => $entity['account_email'],
|
||||
'uid' => $entity['entity_id'],
|
||||
'notify_flags' => $channel['channel_notifyflags'],
|
||||
'language' => $channel['account_language'],
|
||||
'to_name' => $channel['channel_name'],
|
||||
'to_email' => $channel['account_email'],
|
||||
'uid' => $channel['channel_id'],
|
||||
'item' => $datarray,
|
||||
'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
|
||||
'source_name' => $datarray['author-name'],
|
||||
@ -806,7 +806,7 @@ function item_post(&$a) {
|
||||
WHERE `id` = %d LIMIT 1",
|
||||
intval($parent),
|
||||
dbesc(($parent == $post_id) ? $uri : $parent_item['uri']),
|
||||
dbesc($a->get_baseurl() . '/display/' . $entity['entity_address'] . '/' . $post_id),
|
||||
dbesc($a->get_baseurl() . '/display/' . $channel['channel_address'] . '/' . $post_id),
|
||||
dbesc(datetime_convert()),
|
||||
intval($post_id)
|
||||
);
|
||||
@ -837,7 +837,7 @@ function item_post(&$a) {
|
||||
);
|
||||
|
||||
$datarray['id'] = $post_id;
|
||||
$datarray['plink'] = $a->get_baseurl() . '/display/' . $entity['entity_address'] . '/' . $post_id;
|
||||
$datarray['plink'] = $a->get_baseurl() . '/display/' . $channel['channel_address'] . '/' . $post_id;
|
||||
|
||||
call_hooks('post_local_end', $datarray);
|
||||
|
||||
|
@ -9,18 +9,18 @@ function manage_content(&$a) {
|
||||
|
||||
$change_channel = ((argc() > 1) ? intval(argv(1)) : 0);
|
||||
if($change_channel) {
|
||||
$r = q("select * from entity where entity_id = %d and entity_account_id = %d limit 1",
|
||||
$r = q("select * from channel where channel_id = %d and channel_account_id = %d limit 1",
|
||||
intval($change_channel),
|
||||
intval(get_account_id())
|
||||
);
|
||||
if($r && count($r)) {
|
||||
$_SESSION['uid'] = intval($r[0]['entity_id']);
|
||||
get_app()->identity = $r[0];
|
||||
$_SESSION['theme'] = $r[0]['entity_theme'];
|
||||
date_default_timezone_set($r[0]['entity_timezone']);
|
||||
$_SESSION['uid'] = intval($r[0]['channel_id']);
|
||||
get_app()->set_channel($r[0]);
|
||||
$_SESSION['theme'] = $r[0]['channel_theme'];
|
||||
date_default_timezone_set($r[0]['channel_timezone']);
|
||||
}
|
||||
if($r[0]['entity_startpage'])
|
||||
goaway(z_root() . '/' . $r[0]['entity_startpage']);
|
||||
if($r[0]['channel_startpage'])
|
||||
goaway(z_root() . '/' . $r[0]['channel_startpage']);
|
||||
goaway(z_root());
|
||||
}
|
||||
|
||||
@ -28,20 +28,20 @@ function manage_content(&$a) {
|
||||
$channels = null;
|
||||
|
||||
if(local_user()) {
|
||||
$r = q("select entity.*, contact.* from entity left join contact on entity.entity_id = contact.uid
|
||||
where entity.entity_account_id = %d and contact.self = 1",
|
||||
$r = q("select channel.*, contact.* from channel left join contact on channel.channel_id = contact.uid
|
||||
where channel.channel_account_id = %d and contact.self = 1",
|
||||
intval(get_account_id())
|
||||
);
|
||||
|
||||
if($r && count($r)) {
|
||||
$channels = $r;
|
||||
for($x = 0; $x < count($channels); $x ++)
|
||||
$channels[$x]['link'] = 'manage/' . intval($channels[$x]['entity_id']);
|
||||
$channels[$x]['link'] = 'manage/' . intval($channels[$x]['channel_id']);
|
||||
}
|
||||
}
|
||||
|
||||
$links = array(
|
||||
array( 'zentity', t('Create a new channel'), t('New Channel'))
|
||||
array( 'zchannel', t('Create a new channel'), t('New Channel'))
|
||||
);
|
||||
|
||||
|
||||
|
@ -20,8 +20,10 @@ function profile_init(&$a) {
|
||||
|
||||
|
||||
$profile = 0;
|
||||
$channel = $a->get_channel();
|
||||
|
||||
if((local_user()) && (argc() > 2) && (argv(2) === 'view')) {
|
||||
$which = $a->identity['entity_address'];
|
||||
$which = $channel['channel_address'];
|
||||
$profile = argv(1);
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,8 @@ function profile_photo_init(&$a) {
|
||||
return;
|
||||
}
|
||||
|
||||
profile_load($a,$a->identity['entity_address']);
|
||||
$channel = $a->get_channel();
|
||||
profile_load($a,$channel['channel_address']);
|
||||
|
||||
}
|
||||
|
||||
|
@ -320,24 +320,6 @@ function settings_post(&$a) {
|
||||
$str_group_deny = perms2str($_POST['group_deny']);
|
||||
$str_contact_deny = perms2str($_POST['contact_deny']);
|
||||
|
||||
$openidserver = $a->user['openidserver'];
|
||||
$openid = normalise_openid($openid);
|
||||
|
||||
// If openid has changed or if there's an openid but no openidserver, try and discover it.
|
||||
|
||||
if($openid != $a->user['openid'] || (strlen($openid) && (! strlen($openidserver)))) {
|
||||
$tmp_str = $openid;
|
||||
if(strlen($tmp_str) && validate_url($tmp_str)) {
|
||||
logger('updating openidserver');
|
||||
require_once('library/openid.php');
|
||||
$open_id_obj = new LightOpenID;
|
||||
$open_id_obj->identity = $openid;
|
||||
$openidserver = $open_id_obj->discover($open_id_obj->identity);
|
||||
}
|
||||
else
|
||||
$openidserver = '';
|
||||
}
|
||||
|
||||
set_pconfig(local_user(),'expire','items', $expire_items);
|
||||
set_pconfig(local_user(),'expire','notes', $expire_notes);
|
||||
set_pconfig(local_user(),'expire','starred', $expire_starred);
|
||||
@ -660,15 +642,18 @@ function settings_content(&$a) {
|
||||
|
||||
load_pconfig(local_user(),'expire');
|
||||
|
||||
$username = $a->identity['entity_name'];
|
||||
$email = $a->account['account_email'];
|
||||
$nickname = $a->identity['entity_address'];
|
||||
$timezone = $a->identity['entity_timezone'];
|
||||
$notify = $a->identity['entity_notifyflags'];
|
||||
$defloc = $a->identity['entity_location'];
|
||||
$channel = $a->get_channel();
|
||||
|
||||
$maxreq = $a->identity['entity_max_friend_req'];
|
||||
$username = $channel['channel_name'];
|
||||
$email = $a->account['account_email'];
|
||||
$nickname = $channel['channel_address'];
|
||||
$timezone = $channel['channel_timezone'];
|
||||
$notify = $channel['channel_notifyflags'];
|
||||
$defloc = $channel['channel_location'];
|
||||
|
||||
$maxreq = $channel['channel_max_friend_req'];
|
||||
$expire = get_pconfig(local_user(),'expire','content_expire_days');
|
||||
|
||||
$blockwall = $a->user['blockwall'];
|
||||
$blocktags = $a->user['blocktags'];
|
||||
$unkmail = $a->user['unkmail'];
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
require_once('include/identity.php');
|
||||
|
||||
function zentity_init(&$a) {
|
||||
function zchannel_init(&$a) {
|
||||
|
||||
$cmd = ((argc() > 1) ? argv(1) : '');
|
||||
|
||||
@ -57,7 +57,7 @@ function zentity_init(&$a) {
|
||||
}
|
||||
|
||||
|
||||
function zentity_post(&$a) {
|
||||
function zchannel_post(&$a) {
|
||||
|
||||
$arr = $_POST;
|
||||
|
||||
@ -73,7 +73,7 @@ function zentity_post(&$a) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(! strlen($next_page = get_config('system','workflow_identity_next')))
|
||||
if(! strlen($next_page = get_config('system','workflow_channel_next')))
|
||||
$next_page = 'settings';
|
||||
|
||||
goaway(z_root() . '/' . $next_page);
|
||||
@ -86,7 +86,7 @@ function zentity_post(&$a) {
|
||||
|
||||
|
||||
|
||||
function zentity_content(&$a) {
|
||||
function zchannel_content(&$a) {
|
||||
|
||||
if(! get_account_id()) {
|
||||
notice( t('Permission denied.') . EOL);
|
||||
@ -97,7 +97,7 @@ function zentity_content(&$a) {
|
||||
$nickname = ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : "" );
|
||||
|
||||
|
||||
$o = replace_macros(get_markup_template('zentity.tpl'), array(
|
||||
$o = replace_macros(get_markup_template('zchannel.tpl'), array(
|
||||
|
||||
'$title' => t('Add a Channel'),
|
||||
'$desc' => t('A channel is your own collection of related web pages. A channel can be used to hold social network profiles, blogs, conversation groups and forums, celebrity pages, and much more. You may create as many channels as your service provider allows.'),
|
@ -13,12 +13,12 @@ function zfinger_init(&$a) {
|
||||
$r = null;
|
||||
|
||||
if(strlen($zguid)) {
|
||||
$r = q("select * from entity where entity_global_id = '%s' limit 1",
|
||||
$r = q("select * from channel where channel_global_id = '%s' limit 1",
|
||||
dbesc($zguid)
|
||||
);
|
||||
}
|
||||
elseif(strlen($zaddr)) {
|
||||
$r = q("select * from entity where entity_address = '%s' limit 1",
|
||||
$r = q("select * from channel where channel_address = '%s' limit 1",
|
||||
dbesc($zaddr)
|
||||
);
|
||||
}
|
||||
@ -34,7 +34,7 @@ function zfinger_init(&$a) {
|
||||
|
||||
$e = $r[0];
|
||||
|
||||
$id = $e['entity_id'];
|
||||
$id = $e['channel_id'];
|
||||
$r = q("select contact.*, profile.*
|
||||
from contact left join profile on contact.uid = profile.uid
|
||||
where contact.uid = %d && contact.self = 1 and profile.is_default = 1 limit 1",
|
||||
@ -49,18 +49,18 @@ function zfinger_init(&$a) {
|
||||
|
||||
// Communication details
|
||||
|
||||
$ret['guid'] = $e['entity_global_id'];
|
||||
$ret['guid_sig'] = base64url_encode(rsa_sign($e['entity_global_id'],$e['entity_prvkey']));
|
||||
$ret['key'] = $e['entity_pubkey'];
|
||||
$ret['name'] = $e['entity_name'];
|
||||
$ret['address'] = $e['entity_address'];
|
||||
$ret['guid'] = $e['channel_global_id'];
|
||||
$ret['guid_sig'] = base64url_encode(rsa_sign($e['channel_global_id'],$e['channel_prvkey']));
|
||||
$ret['key'] = $e['channel_pubkey'];
|
||||
$ret['name'] = $e['channel_name'];
|
||||
$ret['address'] = $e['channel_address'];
|
||||
|
||||
$ret['profile'] = $profile;
|
||||
|
||||
// array of (verified) hubs this entity uses
|
||||
// array of (verified) hubs this channel uses
|
||||
|
||||
$ret['hubs'] = array();
|
||||
$x = zot_get_hubloc(array($e['entity_global_id']));
|
||||
$x = zot_get_hubloc(array($e['channel_global_id']));
|
||||
if($x && count($x)) {
|
||||
foreach($x as $hub) {
|
||||
if(! ($hub['hubloc_flags'] & HUBLOC_FLAGS_UNVERIFIED)) {
|
||||
@ -68,7 +68,7 @@ function zfinger_init(&$a) {
|
||||
'primary' => (($hub['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY) ? true : false),
|
||||
'url' => $hub['hubloc_url'],
|
||||
/// hmmm we probably shouldn't sign somebody else's hub. FIXME
|
||||
'url_sig' => base64url_encode(rsa_sign($hub['hubloc_url'],$e['entity_prvkey'])),
|
||||
'url_sig' => base64url_encode(rsa_sign($hub['hubloc_url'],$e['channel_prvkey'])),
|
||||
'callback' => $hub['hubloc_callback'],
|
||||
'sitekey' => $hub['hubloc_sitekey']
|
||||
);
|
||||
|
@ -16,12 +16,12 @@ function zperms_init(&$a) {
|
||||
$r = null;
|
||||
|
||||
if(strlen($zguid)) {
|
||||
$r = q("select * from entity where entity_global_id = '%s' limit 1",
|
||||
$r = q("select * from channel where channel_global_id = '%s' limit 1",
|
||||
dbesc($zguid)
|
||||
);
|
||||
}
|
||||
elseif(strlen($zaddr)) {
|
||||
$r = q("select * from entity where entity_address = '%s' limit 1",
|
||||
$r = q("select * from channel where channel_address = '%s' limit 1",
|
||||
dbesc($zaddr)
|
||||
);
|
||||
}
|
||||
@ -36,7 +36,7 @@ function zperms_init(&$a) {
|
||||
}
|
||||
$e = $r[0];
|
||||
|
||||
$id = $e['entity_id'];
|
||||
$id = $e['channel_id'];
|
||||
$r = q("select contact.*, profile.*
|
||||
from contact left join profile on contact.uid = profile.uid
|
||||
where contact.uid = %d && contact.self = 1 and profile.is_default = 1 limit 1",
|
||||
@ -49,21 +49,21 @@ function zperms_init(&$a) {
|
||||
|
||||
|
||||
$ret['success'] = true;
|
||||
$ret['guid'] = $e['entity_global_id'];
|
||||
$ret['guid_sig'] = base64url_encode(rsa_sign($e['entity_global_id'],$e['entity_prvkey']));
|
||||
$ret['key'] = $e['entity_pubkey'];
|
||||
$ret['name'] = $e['entity_name'];
|
||||
$ret['address'] = $e['entity_address'];
|
||||
$ret['guid'] = $e['channel_global_id'];
|
||||
$ret['guid_sig'] = base64url_encode(rsa_sign($e['channel_global_id'],$e['channel_prvkey']));
|
||||
$ret['key'] = $e['channel_pubkey'];
|
||||
$ret['name'] = $e['channel_name'];
|
||||
$ret['address'] = $e['channel_address'];
|
||||
$ret['target'] = $ztarget;
|
||||
$ret['target_sig'] = $zsig;
|
||||
$ret['permissions'] = map_perms($r[0],$ztarget,$zsig);
|
||||
|
||||
$ret['profile'] = $profile;
|
||||
|
||||
// array of (verified) hubs this entity uses
|
||||
// array of (verified) hubs this channel uses
|
||||
|
||||
$ret['hubs'] = array();
|
||||
$x = zot_get_hubloc(array($e['entity_global_id']));
|
||||
$x = zot_get_hubloc(array($e['channel_global_id']));
|
||||
if($x && count($x)) {
|
||||
foreach($x as $hub) {
|
||||
if(! ($hub['hubloc_flags'] & HUBLOC_FLAGS_UNVERIFIED)) {
|
||||
@ -71,7 +71,7 @@ function zperms_init(&$a) {
|
||||
'primary' => (($hub['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY) ? true : false),
|
||||
'url' => $hub['hubloc_url'],
|
||||
/// hmmm we probably shouldn't sign somebody else's hub. FIXME
|
||||
'url_sig' => base64url_encode(rsa_sign($hub['hubloc_url'],$e['entity_prvkey'])),
|
||||
'url_sig' => base64url_encode(rsa_sign($hub['hubloc_url'],$e['channel_prvkey'])),
|
||||
'callback' => $hub['hubloc_callback'],
|
||||
'sitekey' => $hub['hubloc_sitekey']
|
||||
);
|
||||
|
@ -105,7 +105,7 @@ function zregister_post(&$a) {
|
||||
authenticate_success($result['account'],true,false,true);
|
||||
|
||||
if(! strlen($next_page = get_config('system','workflow_register_next')))
|
||||
$next_page = 'zentity';
|
||||
$next_page = 'zchannel';
|
||||
|
||||
$_SESSION['workflow'] = true;
|
||||
|
||||
|
@ -1 +1 @@
|
||||
2012-09-21.84
|
||||
2012-09-25.88
|
||||
|
@ -4,36 +4,36 @@ h2 {
|
||||
margin-top: 15%;
|
||||
}
|
||||
|
||||
#zentity-form {
|
||||
#zchannel-form {
|
||||
font-size: 1.4em;
|
||||
margin-left: 15%;
|
||||
margin-top: 5%;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
#zentity-form .descriptive-paragraph {
|
||||
#zchannel-form .descriptive-paragraph {
|
||||
color: #888;
|
||||
margin-left: 20px;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
.zentity-label {
|
||||
.zchannel-label {
|
||||
float: left;
|
||||
width: 275px;
|
||||
}
|
||||
|
||||
.zentity-input {
|
||||
.zchannel-input {
|
||||
float: left;
|
||||
width: 275px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.zentity-feedback {
|
||||
.zchannel-feedback {
|
||||
float: left;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.zentity-field-end {
|
||||
.zchannel-field-end {
|
||||
clear: both;
|
||||
margin-bottom: 20px;
|
||||
}
|
17
view/js/mod_zchannel.js
Normal file
17
view/js/mod_zchannel.js
Normal file
@ -0,0 +1,17 @@
|
||||
$(document).ready(function() {
|
||||
$("#zchannel-name").blur(function() {
|
||||
var zreg_name = $("#zchannel-name").val();
|
||||
$.get("zchannel/autofill.json?f=&name=" + encodeURIComponent(zreg_name),function(data) {
|
||||
$("#zchannel-nickname").val(data);
|
||||
zFormError("#zchannel-name-feedback",data.error);
|
||||
});
|
||||
});
|
||||
$("#zchannel-nickname").blur(function() {
|
||||
var zreg_nick = $("#zchannel-nickname").val();
|
||||
$.get("zchannel/checkaddr.json?f=&nick=" + encodeURIComponent(zreg_nick),function(data) {
|
||||
$("#zchannel-nickname").val(data);
|
||||
zFormError("#zchannel-nickname-feedback",data.error);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
@ -1,17 +0,0 @@
|
||||
$(document).ready(function() {
|
||||
$("#zentity-name").blur(function() {
|
||||
var zreg_name = $("#zentity-name").val();
|
||||
$.get("zentity/autofill.json?f=&name=" + encodeURIComponent(zreg_name),function(data) {
|
||||
$("#zentity-nickname").val(data);
|
||||
zFormError("#zentity-name-feedback",data.error);
|
||||
});
|
||||
});
|
||||
$("#zentity-nickname").blur(function() {
|
||||
var zreg_nick = $("#zentity-nickname").val();
|
||||
$.get("zentity/checkaddr.json?f=&nick=" + encodeURIComponent(zreg_nick),function(data) {
|
||||
$("#zentity-nickname").val(data);
|
||||
zFormError("#zentity-nickname-feedback",data.error);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
@ -1,5 +1,5 @@
|
||||
<div class="channel-selection">
|
||||
<a href="$channel.link" class="channel-selection-photo-link" title="$channel.entity_name"><img class="channel-photo" src="$channel.thumb" alt="$channel.entity_name" /></a>
|
||||
<a href="$channel.link" class="channel-selection-name-link" title="$channel.entity_name"><div class="channel-name">$channel.entity_name</div></a>
|
||||
<a href="$channel.link" class="channel-selection-photo-link" title="$channel.channel_name"><img class="channel-photo" src="$channel.thumb" alt="$channel.channel_name" /></a>
|
||||
<a href="$channel.link" class="channel-selection-name-link" title="$channel.channel_name"><div class="channel-name">$channel.channel_name</div></a>
|
||||
</div>
|
||||
<div class="channel-selection-end"></div>
|
||||
|
@ -1,54 +1,54 @@
|
||||
<div style="display:none;">
|
||||
<dl class='entity_nickname'>
|
||||
<dl class='channel_nickname'>
|
||||
<dt>Nickname</dt>
|
||||
<dd>
|
||||
<a class="nickname url uid" href="$diaspora.podloc/" rel="me">$diaspora.nickname</a>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class='entity_fn'>
|
||||
<dl class='channel_fn'>
|
||||
<dt>Full name</dt>
|
||||
<dd>
|
||||
<span class='fn'>$diaspora.fullname</span>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<dl class='entity_given_name'>
|
||||
<dl class='channel_given_name'>
|
||||
<dt>First name</dt>
|
||||
<dd>
|
||||
<span class='given_name'>$diaspora.firstname</span>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class='entity_family_name'>
|
||||
<dl class='channel_family_name'>
|
||||
<dt>Family name</dt>
|
||||
<dd>
|
||||
<span class='family_name'>$diaspora.lastname</span>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="entity_url">
|
||||
<dl class="channel_url">
|
||||
<dt>URL</dt>
|
||||
<dd>
|
||||
<a class="url" href="$diaspora.podloc/" id="pod_location" rel="me">$diaspora.podloc/</a>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="entity_photo">
|
||||
<dl class="channel_photo">
|
||||
<dt>Photo</dt>
|
||||
<dd>
|
||||
<img class="photo avatar" height="300" width="300" src="$diaspora.photo300">
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="entity_photo_medium">
|
||||
<dl class="channel_photo_medium">
|
||||
<dt>Photo</dt>
|
||||
<dd>
|
||||
<img class="photo avatar" height="100" width="100" src="$diaspora.photo100">
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="entity_photo_small">
|
||||
<dl class="channel_photo_small">
|
||||
<dt>Photo</dt>
|
||||
<dd>
|
||||
<img class="photo avatar" height="50" width="50" src="$diaspora.photo50">
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="entity_searchable">
|
||||
<dl class="channel_searchable">
|
||||
<dt>Searchable</dt>
|
||||
<dd>
|
||||
<span class="searchable">$diaspora.searchable</span>
|
||||
|
29
view/tpl/zchannel.tpl
Normal file
29
view/tpl/zchannel.tpl
Normal file
@ -0,0 +1,29 @@
|
||||
<h2>$title</h2>
|
||||
|
||||
<form action="zchannel" method="post" id="zchannel-form">
|
||||
|
||||
<div id="zchannel-desc" class="descriptive-paragraph">$desc</div>
|
||||
|
||||
<label for="zchannel-name" id="label-zchannel-name" class="zchannel-label" >$label_name</label>
|
||||
<input type="text" name="name" id="zchannel-name" class="zchannel-input" value="$name" />
|
||||
<div id="zchannel-name-feedback" class="zchannel-feedback"></div>
|
||||
<div id="zchannel-name-end" class="zchannel-field-end"></div>
|
||||
|
||||
<div id="zchannel-name-help" class="descriptive-paragraph">$help_name</div>
|
||||
|
||||
<label for="zchannel-nickname" id="label-zchannel-nickname" class="zchannel-label" >$label_nick</label>
|
||||
<input type="text" name="nickname" id="zchannel-nickname" class="zchannel-input" value="$nickname" />
|
||||
<div id="zchannel-nickname-feedback" class="zchannel-feedback"></div>
|
||||
<div id="zchannel-nickname-end" class="zchannel-field-end"></div>
|
||||
|
||||
<div id="zchannel-nick-desc" class="descriptive-paragraph">$nick_desc</div>
|
||||
|
||||
|
||||
<input type="checkbox" name="import" id="zchannel-import" value="1" />
|
||||
<label for="zchannel-import" id="label-zchannel-import">$label_import</label>
|
||||
<div id="zchannel-import-end" class="zchannel-field-end"></div>
|
||||
|
||||
<input type="submit" name="submit" id="zchannel-submit-button" value="$submit" />
|
||||
<div id="zchannel-submit-end" class="zchannel-field-end"></div>
|
||||
|
||||
</form>
|
@ -1,29 +0,0 @@
|
||||
<h2>$title</h2>
|
||||
|
||||
<form action="zentity" method="post" id="zentity-form">
|
||||
|
||||
<div id="zentity-desc" class="descriptive-paragraph">$desc</div>
|
||||
|
||||
<label for="zentity-name" id="label-zentity-name" class="zentity-label" >$label_name</label>
|
||||
<input type="text" name="name" id="zentity-name" class="zentity-input" value="$name" />
|
||||
<div id="zentity-name-feedback" class="zentity-feedback"></div>
|
||||
<div id="zentity-name-end" class="zentity-field-end"></div>
|
||||
|
||||
<div id="zentity-name-help" class="descriptive-paragraph">$help_name</div>
|
||||
|
||||
<label for="zentity-nickname" id="label-zentity-nickname" class="zentity-label" >$label_nick</label>
|
||||
<input type="text" name="nickname" id="zentity-nickname" class="zentity-input" value="$nickname" />
|
||||
<div id="zentity-nickname-feedback" class="zentity-feedback"></div>
|
||||
<div id="zentity-nickname-end" class="zentity-field-end"></div>
|
||||
|
||||
<div id="zentity-nick-desc" class="descriptive-paragraph">$nick_desc</div>
|
||||
|
||||
|
||||
<input type="checkbox" name="import" id="zentity-import" value="1" />
|
||||
<label for="zentity-import" id="label-zentity-import">$label_import</label>
|
||||
<div id="zentity-import-end" class="zentity-field-end"></div>
|
||||
|
||||
<input type="submit" name="submit" id="zentity-submit-button" value="$submit" />
|
||||
<div id="zentity-submit-end" class="zentity-field-end"></div>
|
||||
|
||||
</form>
|
Reference in New Issue
Block a user