From fbafd92f7f7b96b215b98f30de9a1ccbdb3479be Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 25 Sep 2012 17:57:20 -0700 Subject: moving a lot of structure around. 'entity' is now 'channel' --- boot.php | 30 ++++++---- database.sql | 135 +++++++++++++++++++++++--------------------- include/Contact.php | 38 ++++++------- include/identity.php | 48 ++++++++-------- include/nav.php | 18 +++--- include/security.php | 22 ++++---- include/text.php | 4 +- include/zot.php | 16 +++--- mod/feed.php | 6 +- mod/home.php | 6 +- mod/item.php | 38 ++++++------- mod/manage.php | 22 ++++---- mod/profile.php | 4 +- mod/profile_photo.php | 3 +- mod/settings.php | 33 +++-------- mod/zchannel.php | 118 ++++++++++++++++++++++++++++++++++++++ mod/zentity.php | 118 -------------------------------------- mod/zfinger.php | 22 ++++---- mod/zperms.php | 22 ++++---- mod/zregister.php | 2 +- version.inc | 2 +- view/css/mod_zchannel.css | 40 +++++++++++++ view/css/mod_zentity.css | 40 ------------- view/js/mod_zchannel.js | 17 ++++++ view/js/mod_zentity.js | 17 ------ view/php/mod_zchannel.php | 3 + view/php/mod_zentity.php | 3 - view/tpl/channel.tpl | 4 +- view/tpl/diaspora_vcard.tpl | 18 +++--- view/tpl/zchannel.tpl | 29 ++++++++++ view/tpl/zentity.tpl | 29 ---------- 31 files changed, 457 insertions(+), 450 deletions(-) create mode 100644 mod/zchannel.php delete mode 100644 mod/zentity.php create mode 100644 view/css/mod_zchannel.css delete mode 100644 view/css/mod_zentity.css create mode 100644 view/js/mod_zchannel.js delete mode 100644 view/js/mod_zentity.js create mode 100644 view/php/mod_zchannel.php delete mode 100644 view/php/mod_zentity.php create mode 100644 view/tpl/zchannel.tpl delete mode 100644 view/tpl/zentity.tpl diff --git a/boot.php b/boot.php index fbc2e1f71..afa9c0e1e 100644 --- a/boot.php +++ b/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']; diff --git a/database.sql b/database.sql index 8f525b60d..fa3bc4027 100644 --- a/database.sql +++ b/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` ( diff --git a/include/Contact.php b/include/Contact.php index d4d29b297..38c3c3203 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -1,7 +1,7 @@ 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), - - '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), + '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('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; diff --git a/include/identity.php b/include/identity.php index 1fd3c7eb0..41d83b66d 100644 --- a/include/identity.php +++ b/include/identity.php @@ -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) ); } diff --git a/include/nav.php b/include/nav.php index dd2dbe8ab..4c37913c0 100644 --- a/include/nav.php +++ b/include/nav.php @@ -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'), "", ""); diff --git a/include/security.php b/include/security.php index bc1e97059..f5e829e47 100644 --- a/include/security.php +++ b/include/security.php @@ -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; } diff --git a/include/text.php b/include/text.php index eba0f5859..61c7e6389 100644 --- a/include/text.php +++ b/include/text.php @@ -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) { diff --git a/include/zot.php b/include/zot.php index 20ec7686d..8f76e78b1 100644 --- a/include/zot.php +++ b/include/zot.php @@ -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) ); diff --git a/mod/feed.php b/mod/feed.php index 69d8fdb05..a6adc620e 100644 --- a/mod/feed.php +++ b/mod/feed.php @@ -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(); } diff --git a/mod/home.php b/mod/home.php index b96e3f29f..a49ce567e 100644 --- a/mod/home.php +++ b/mod/home.php @@ -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']); }} diff --git a/mod/item.php b/mod/item.php index 12765cba3..1db18cc85 100644 --- a/mod/item.php +++ b/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); diff --git a/mod/manage.php b/mod/manage.php index 4bf161a39..b9237822b 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -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')) ); diff --git a/mod/profile.php b/mod/profile.php index ee457c8b6..aaa324078 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -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); } diff --git a/mod/profile_photo.php b/mod/profile_photo.php index 445045cb9..3bde6a99d 100644 --- a/mod/profile_photo.php +++ b/mod/profile_photo.php @@ -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']); } diff --git a/mod/settings.php b/mod/settings.php index 922a90467..7cbe278a3 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -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']; + $channel = $a->get_channel(); + + $username = $channel['channel_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']; + $nickname = $channel['channel_address']; + $timezone = $channel['channel_timezone']; + $notify = $channel['channel_notifyflags']; + $defloc = $channel['channel_location']; - $maxreq = $a->identity['entity_max_friend_req']; + $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']; diff --git a/mod/zchannel.php b/mod/zchannel.php new file mode 100644 index 000000000..f401d91c6 --- /dev/null +++ b/mod/zchannel.php @@ -0,0 +1,118 @@ + 1) ? argv(1) : ''); + + + if($cmd === 'autofill.json') { + require_once('library/urlify/URLify.php'); + $result = array('error' => false, 'message' => ''); + $n = trim($_REQUEST['name']); + + $x = strtolower(URLify::transliterate($n)); + + $test = array(); + + // first name + $test[] = legal_webbie(substr($x,0,strpos($x,' '))); + if($test[0]) { + // first name plus first initial of last + $test[] = ((strpos($x,' ')) ? $test[0] . legal_webbie(trim(substr($x,strpos($x,' '),2))) : ''); + // first name plus random number + $test[] = $test[0] . mt_rand(1000,9999); + } + // fullname + $test[] = legal_webbie($x); + // fullname plus random number + $test[] = legal_webbie($x) . mt_rand(1000,9999); + + json_return_and_die(check_webbie($test)); + } + + if($cmd === 'checkaddr.json') { + require_once('library/urlify/URLify.php'); + $result = array('error' => false, 'message' => ''); + $n = trim($_REQUEST['nick']); + + $x = strtolower(URLify::transliterate($n)); + + $test = array(); + + $n = legal_webbie($x); + if(strlen($n)) { + $test[] = $n; + $test[] = $n . mt_rand(1000,9999); + } + + for($y = 0; $y < 100; $y ++) + $test[] = 'id' . mt_rand(1000,9999); + + json_return_and_die(check_webbie($test)); + } + + +} + + +function zchannel_post(&$a) { + + $arr = $_POST; + + if(($arr['account_id'] = get_account_id()) === false) { + notice( t('Permission denied.') . EOL ); + return; + } + + $result = create_identity($arr); + + if(! $result['success']) { + notice($result['message']); + return; + } + + if(! strlen($next_page = get_config('system','workflow_channel_next'))) + $next_page = 'settings'; + + goaway(z_root() . '/' . $next_page); + +} + + + + + + + +function zchannel_content(&$a) { + + if(! get_account_id()) { + notice( t('Permission denied.') . EOL); + return; + } + + $name = ((x($_REQUEST,'name')) ? $_REQUEST['name'] : "" ); + $nickname = ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : "" ); + + + $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.'), + + '$label_name' => t('Channel Name'), + '$help_name' => t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group" '), + '$label_nick' => t('Choose a short nickname'), + '$nick_desc' => t('Your nickname will be used to create an easily remembered web address ("webbie") for your channel.'), + '$label_import' => t('Check this box to import an existing channel file from another location'), + '$name' => $name, + '$nickname' => $nickname, + '$submit' => t('Create') + )); + + return $o; + +} + diff --git a/mod/zentity.php b/mod/zentity.php deleted file mode 100644 index a0f49b47c..000000000 --- a/mod/zentity.php +++ /dev/null @@ -1,118 +0,0 @@ - 1) ? argv(1) : ''); - - - if($cmd === 'autofill.json') { - require_once('library/urlify/URLify.php'); - $result = array('error' => false, 'message' => ''); - $n = trim($_REQUEST['name']); - - $x = strtolower(URLify::transliterate($n)); - - $test = array(); - - // first name - $test[] = legal_webbie(substr($x,0,strpos($x,' '))); - if($test[0]) { - // first name plus first initial of last - $test[] = ((strpos($x,' ')) ? $test[0] . legal_webbie(trim(substr($x,strpos($x,' '),2))) : ''); - // first name plus random number - $test[] = $test[0] . mt_rand(1000,9999); - } - // fullname - $test[] = legal_webbie($x); - // fullname plus random number - $test[] = legal_webbie($x) . mt_rand(1000,9999); - - json_return_and_die(check_webbie($test)); - } - - if($cmd === 'checkaddr.json') { - require_once('library/urlify/URLify.php'); - $result = array('error' => false, 'message' => ''); - $n = trim($_REQUEST['nick']); - - $x = strtolower(URLify::transliterate($n)); - - $test = array(); - - $n = legal_webbie($x); - if(strlen($n)) { - $test[] = $n; - $test[] = $n . mt_rand(1000,9999); - } - - for($y = 0; $y < 100; $y ++) - $test[] = 'id' . mt_rand(1000,9999); - - json_return_and_die(check_webbie($test)); - } - - -} - - -function zentity_post(&$a) { - - $arr = $_POST; - - if(($arr['account_id'] = get_account_id()) === false) { - notice( t('Permission denied.') . EOL ); - return; - } - - $result = create_identity($arr); - - if(! $result['success']) { - notice($result['message']); - return; - } - - if(! strlen($next_page = get_config('system','workflow_identity_next'))) - $next_page = 'settings'; - - goaway(z_root() . '/' . $next_page); - -} - - - - - - - -function zentity_content(&$a) { - - if(! get_account_id()) { - notice( t('Permission denied.') . EOL); - return; - } - - $name = ((x($_REQUEST,'name')) ? $_REQUEST['name'] : "" ); - $nickname = ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : "" ); - - - $o = replace_macros(get_markup_template('zentity.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.'), - - '$label_name' => t('Channel Name'), - '$help_name' => t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group" '), - '$label_nick' => t('Choose a short nickname'), - '$nick_desc' => t('Your nickname will be used to create an easily remembered web address ("webbie") for your channel.'), - '$label_import' => t('Check this box to import an existing channel file from another location'), - '$name' => $name, - '$nickname' => $nickname, - '$submit' => t('Create') - )); - - return $o; - -} - diff --git a/mod/zfinger.php b/mod/zfinger.php index 66dcb16f6..95c17ecd8 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -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'] ); diff --git a/mod/zperms.php b/mod/zperms.php index b2c18c7d0..de1d4dd6d 100644 --- a/mod/zperms.php +++ b/mod/zperms.php @@ -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'] ); diff --git a/mod/zregister.php b/mod/zregister.php index 478921c3f..a83f42bd0 100644 --- a/mod/zregister.php +++ b/mod/zregister.php @@ -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; diff --git a/version.inc b/version.inc index 0acbe2abe..636607431 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2012-09-21.84 +2012-09-25.88 diff --git a/view/css/mod_zchannel.css b/view/css/mod_zchannel.css new file mode 100644 index 000000000..1b4527a99 --- /dev/null +++ b/view/css/mod_zchannel.css @@ -0,0 +1,40 @@ + +h2 { + margin-left: 15%; + margin-top: 15%; +} + +#zchannel-form { + font-size: 1.4em; + margin-left: 15%; + margin-top: 5%; + width: 50%; +} + +#zchannel-form .descriptive-paragraph { + color: #888; + margin-left: 20px; + margin-bottom: 25px; +} + +.zchannel-label { + float: left; + width: 275px; +} + +.zchannel-input { + float: left; + width: 275px; + padding: 5px; +} + +.zchannel-feedback { + float: left; + margin-left: 5px; +} + +.zchannel-field-end { + clear: both; + margin-bottom: 20px; +} + diff --git a/view/css/mod_zentity.css b/view/css/mod_zentity.css deleted file mode 100644 index 402572a38..000000000 --- a/view/css/mod_zentity.css +++ /dev/null @@ -1,40 +0,0 @@ - -h2 { - margin-left: 15%; - margin-top: 15%; -} - -#zentity-form { - font-size: 1.4em; - margin-left: 15%; - margin-top: 5%; - width: 50%; -} - -#zentity-form .descriptive-paragraph { - color: #888; - margin-left: 20px; - margin-bottom: 25px; -} - -.zentity-label { - float: left; - width: 275px; -} - -.zentity-input { - float: left; - width: 275px; - padding: 5px; -} - -.zentity-feedback { - float: left; - margin-left: 5px; -} - -.zentity-field-end { - clear: both; - margin-bottom: 20px; -} - diff --git a/view/js/mod_zchannel.js b/view/js/mod_zchannel.js new file mode 100644 index 000000000..9f85295d7 --- /dev/null +++ b/view/js/mod_zchannel.js @@ -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); + }); + }); + + }); diff --git a/view/js/mod_zentity.js b/view/js/mod_zentity.js deleted file mode 100644 index ad78db7d4..000000000 --- a/view/js/mod_zentity.js +++ /dev/null @@ -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); - }); - }); - - }); diff --git a/view/php/mod_zchannel.php b/view/php/mod_zchannel.php new file mode 100644 index 000000000..e7709cbd8 --- /dev/null +++ b/view/php/mod_zchannel.php @@ -0,0 +1,3 @@ +page['template'] = 'full'; diff --git a/view/php/mod_zentity.php b/view/php/mod_zentity.php deleted file mode 100644 index e7709cbd8..000000000 --- a/view/php/mod_zentity.php +++ /dev/null @@ -1,3 +0,0 @@ -page['template'] = 'full'; diff --git a/view/tpl/channel.tpl b/view/tpl/channel.tpl index eb9635ce8..0702bb50b 100644 --- a/view/tpl/channel.tpl +++ b/view/tpl/channel.tpl @@ -1,5 +1,5 @@
-$channel.entity_name -
$channel.entity_name
+$channel.channel_name +
$channel.channel_name
diff --git a/view/tpl/diaspora_vcard.tpl b/view/tpl/diaspora_vcard.tpl index de3981a94..8d889cd4a 100644 --- a/view/tpl/diaspora_vcard.tpl +++ b/view/tpl/diaspora_vcard.tpl @@ -1,54 +1,54 @@
-
+
Nickname
$diaspora.nickname
-
+
Full name
$diaspora.fullname
-
+
First name
$diaspora.firstname
-
+
Family name
$diaspora.lastname
-
+
URL
$diaspora.podloc/
-
+
Photo
-
+
Photo
-
+
Photo
-
+
Searchable
$diaspora.searchable diff --git a/view/tpl/zchannel.tpl b/view/tpl/zchannel.tpl new file mode 100644 index 000000000..d714d8a59 --- /dev/null +++ b/view/tpl/zchannel.tpl @@ -0,0 +1,29 @@ +

$title

+ +
+ +
$desc
+ + + + +
+ +
$help_name
+ + + + +
+ +
$nick_desc
+ + + + +
+ + +
+ +
diff --git a/view/tpl/zentity.tpl b/view/tpl/zentity.tpl deleted file mode 100644 index b2da59934..000000000 --- a/view/tpl/zentity.tpl +++ /dev/null @@ -1,29 +0,0 @@ -

$title

- -
- -
$desc
- - - -
-
- -
$help_name
- - - -
-
- -
$nick_desc
- - - - -
- - -
- -
-- cgit v1.2.3