moving a lot of structure around. 'entity' is now 'channel'

This commit is contained in:
friendica
2012-09-25 17:57:20 -07:00
parent dd5725c272
commit fbafd92f7f
28 changed files with 307 additions and 300 deletions

View File

@@ -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;