aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Contact.php38
-rw-r--r--include/identity.php48
-rw-r--r--include/nav.php18
-rw-r--r--include/security.php22
-rw-r--r--include/text.php4
-rw-r--r--include/zot.php16
6 files changed, 74 insertions, 72 deletions
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 @@
<?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),
-
- '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)
);