implement republish permission for use in sourced channels
This commit is contained in:
parent
2353e6d23f
commit
dffce63662
36
boot.php
36
boot.php
@ -45,7 +45,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' );
|
||||
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
|
||||
define ( 'ZOT_REVISION', 1 );
|
||||
|
||||
define ( 'DB_UPDATE_VERSION', 1075 );
|
||||
define ( 'DB_UPDATE_VERSION', 1076 );
|
||||
|
||||
define ( 'EOL', '<br />' . "\r\n" );
|
||||
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
||||
@ -228,26 +228,26 @@ define ( 'NETWORK_PHANTOM', 'unkn'); // Place holder
|
||||
*/
|
||||
|
||||
|
||||
define ( 'PERMS_R_STREAM', 0x0001);
|
||||
define ( 'PERMS_R_PROFILE', 0x0002);
|
||||
define ( 'PERMS_R_PHOTOS', 0x0004);
|
||||
define ( 'PERMS_R_ABOOK', 0x0008);
|
||||
define ( 'PERMS_R_STREAM', 0x00001);
|
||||
define ( 'PERMS_R_PROFILE', 0x00002);
|
||||
define ( 'PERMS_R_PHOTOS', 0x00004);
|
||||
define ( 'PERMS_R_ABOOK', 0x00008);
|
||||
|
||||
|
||||
define ( 'PERMS_W_STREAM', 0x0010);
|
||||
define ( 'PERMS_W_WALL', 0x0020);
|
||||
define ( 'PERMS_W_TAGWALL', 0x0040);
|
||||
define ( 'PERMS_W_COMMENT', 0x0080);
|
||||
define ( 'PERMS_W_MAIL', 0x0100);
|
||||
define ( 'PERMS_W_PHOTOS', 0x0200);
|
||||
define ( 'PERMS_W_CHAT', 0x0400);
|
||||
define ( 'PERMS_A_DELEGATE', 0x0800);
|
||||
|
||||
define ( 'PERMS_R_STORAGE', 0x1000);
|
||||
define ( 'PERMS_W_STORAGE', 0x2000);
|
||||
define ( 'PERMS_R_PAGES', 0x4000);
|
||||
define ( 'PERMS_W_PAGES', 0x8000);
|
||||
define ( 'PERMS_W_STREAM', 0x00010);
|
||||
define ( 'PERMS_W_WALL', 0x00020);
|
||||
define ( 'PERMS_W_TAGWALL', 0x00040);
|
||||
define ( 'PERMS_W_COMMENT', 0x00080);
|
||||
define ( 'PERMS_W_MAIL', 0x00100);
|
||||
define ( 'PERMS_W_PHOTOS', 0x00200);
|
||||
define ( 'PERMS_W_CHAT', 0x00400);
|
||||
define ( 'PERMS_A_DELEGATE', 0x00800);
|
||||
|
||||
define ( 'PERMS_R_STORAGE', 0x01000);
|
||||
define ( 'PERMS_W_STORAGE', 0x02000);
|
||||
define ( 'PERMS_R_PAGES', 0x04000);
|
||||
define ( 'PERMS_W_PAGES', 0x08000);
|
||||
define ( 'PERMS_A_REPUBLISH', 0x10000);
|
||||
|
||||
// General channel permissions
|
||||
|
||||
|
@ -219,7 +219,8 @@ function channel_remove($channel_id, $local = true) {
|
||||
$r = q("update channel set channel_pageflags = (channel_pageflags | %d), channel_r_stream = 0, channel_r_profile = 0,
|
||||
channel_r_photos = 0, channel_r_abook = 0, channel_w_stream = 0, channel_w_wall = 0, channel_w_tagwall = 0,
|
||||
channel_w_comment = 0, channel_w_mail = 0, channel_w_photos = 0, channel_w_chat = 0, channel_a_delegate = 0,
|
||||
channel_r_storage = 0, channel_w_storage = 0, channel_r_pages = 0, channel_w_pages = 0 where channel_id = %d limit 1",
|
||||
channel_r_storage = 0, channel_w_storage = 0, channel_r_pages = 0, channel_w_pages = 0, channel_a_republish = 0
|
||||
where channel_id = %d limit 1",
|
||||
intval(PAGE_REMOVED),
|
||||
intval($channel_id)
|
||||
);
|
||||
|
@ -2308,6 +2308,17 @@ function check_item_source($uid,$item) {
|
||||
if(! $r)
|
||||
return false;
|
||||
|
||||
$x = q("select abook_their_perms from abook where abook_channel = %d and abook_xchan = '%s' limit 1",
|
||||
intval($uid),
|
||||
dbesc($item['owner_xchan'])
|
||||
);
|
||||
|
||||
if(! $x)
|
||||
return false;
|
||||
|
||||
if(! ($x[0]['abook_their_perms'] & PERMS_A_REPUBLISH))
|
||||
return false;
|
||||
|
||||
if($r[0]['src_channel_xchan'] === $item['owner_xchan'])
|
||||
return false;
|
||||
|
||||
|
@ -28,6 +28,7 @@ function get_perms() {
|
||||
'write_storage' => array('channel_w_storage', intval(PERMS_W_STORAGE), false, t('Can write to my "public" file storage'), ''),
|
||||
'write_pages' => array('channel_w_pages', intval(PERMS_W_PAGES), false, t('Can edit my "public" pages'), ''),
|
||||
|
||||
'republish' => array('channel_a_republish', intval(PERMS_A_REPUBLISH), false, t('Can source my "public" posts in derived channels'), t('Somewhat advanced - very useful in open communities')),
|
||||
'delegate' => array('channel_a_delegate', intval(PERMS_A_DELEGATE), false, t('Can administer my channel resources'), t('Extremely advanced. Leave this alone unless you know what you are doing')),
|
||||
);
|
||||
$ret = array('global_permissions' => $global_perms);
|
||||
|
@ -181,6 +181,7 @@ CREATE TABLE IF NOT EXISTS `channel` (
|
||||
`channel_w_storage` int(10) unsigned NOT NULL DEFAULT '128',
|
||||
`channel_r_pages` int(10) unsigned NOT NULL DEFAULT '128',
|
||||
`channel_w_pages` int(10) unsigned NOT NULL DEFAULT '128',
|
||||
`channel_a_republish` int(1) unsigned NOT NULL DEFAULT '128',
|
||||
PRIMARY KEY (`channel_id`),
|
||||
UNIQUE KEY `channel_address_unique` (`channel_address`),
|
||||
KEY `channel_account_id` (`channel_account_id`),
|
||||
@ -213,6 +214,7 @@ CREATE TABLE IF NOT EXISTS `channel` (
|
||||
KEY `channel_w_storage` (`channel_w_storage`),
|
||||
KEY `channel_r_pages` (`channel_r_pages`),
|
||||
KEY `channel_w_pages` (`channel_w_pages`),
|
||||
KEY `channel_a_republish` (`channel_a_republish`),
|
||||
KEY `channel_deleted` (`channel_deleted`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
define( 'UPDATE_VERSION' , 1075 );
|
||||
define( 'UPDATE_VERSION' , 1076 );
|
||||
|
||||
/**
|
||||
*
|
||||
@ -851,3 +851,11 @@ ADD INDEX ( `ud_last` ) ");
|
||||
}
|
||||
|
||||
|
||||
function update_r1075() {
|
||||
$r = q("ALTER TABLE `channel` ADD `channel_a_republish` INT UNSIGNED NOT NULL DEFAULT '128',
|
||||
ADD INDEX ( `channel_a_republish` )");
|
||||
|
||||
if($r)
|
||||
return UPDATE_SUCCESS;
|
||||
return UPDATE_FAILED;
|
||||
}
|
||||
|
@ -377,23 +377,24 @@ function settings_post(&$a) {
|
||||
$pageflags = ($pageflags ^ PAGE_ADULT);
|
||||
|
||||
$arr = array();
|
||||
$arr['channel_r_stream'] = (($_POST['view_stream']) ? $_POST['view_stream'] : 0);
|
||||
$arr['channel_r_profile'] = (($_POST['view_profile']) ? $_POST['view_profile'] : 0);
|
||||
$arr['channel_r_photos'] = (($_POST['view_photos']) ? $_POST['view_photos'] : 0);
|
||||
$arr['channel_r_abook'] = (($_POST['view_contacts']) ? $_POST['view_contacts'] : 0);
|
||||
$arr['channel_w_stream'] = (($_POST['send_stream']) ? $_POST['send_stream'] : 0);
|
||||
$arr['channel_w_wall'] = (($_POST['post_wall']) ? $_POST['post_wall'] : 0);
|
||||
$arr['channel_w_tagwall'] = (($_POST['tag_deliver']) ? $_POST['tag_deliver'] : 0);
|
||||
$arr['channel_w_comment'] = (($_POST['post_comments']) ? $_POST['post_comments'] : 0);
|
||||
$arr['channel_w_mail'] = (($_POST['post_mail']) ? $_POST['post_mail'] : 0);
|
||||
$arr['channel_w_photos'] = (($_POST['post_photos']) ? $_POST['post_photos'] : 0);
|
||||
$arr['channel_w_chat'] = (($_POST['chat']) ? $_POST['chat'] : 0);
|
||||
$arr['channel_a_delegate'] = (($_POST['delegate']) ? $_POST['delegate'] : 0);
|
||||
$arr['channel_r_storage'] = (($_POST['view_storage']) ? $_POST['view_storage'] : 0);
|
||||
$arr['channel_w_storage'] = (($_POST['write_storage']) ? $_POST['write_storage'] : 0);
|
||||
$arr['channel_r_pages'] = (($_POST['view_pages']) ? $_POST['view_pages'] : 0);
|
||||
$arr['channel_w_pages'] = (($_POST['write_pages']) ? $_POST['write_pages'] : 0);
|
||||
|
||||
$arr['channel_r_stream'] = (($_POST['view_stream']) ? $_POST['view_stream'] : 0);
|
||||
$arr['channel_r_profile'] = (($_POST['view_profile']) ? $_POST['view_profile'] : 0);
|
||||
$arr['channel_r_photos'] = (($_POST['view_photos']) ? $_POST['view_photos'] : 0);
|
||||
$arr['channel_r_abook'] = (($_POST['view_contacts']) ? $_POST['view_contacts'] : 0);
|
||||
$arr['channel_w_stream'] = (($_POST['send_stream']) ? $_POST['send_stream'] : 0);
|
||||
$arr['channel_w_wall'] = (($_POST['post_wall']) ? $_POST['post_wall'] : 0);
|
||||
$arr['channel_w_tagwall'] = (($_POST['tag_deliver']) ? $_POST['tag_deliver'] : 0);
|
||||
$arr['channel_w_comment'] = (($_POST['post_comments']) ? $_POST['post_comments'] : 0);
|
||||
$arr['channel_w_mail'] = (($_POST['post_mail']) ? $_POST['post_mail'] : 0);
|
||||
$arr['channel_w_photos'] = (($_POST['post_photos']) ? $_POST['post_photos'] : 0);
|
||||
$arr['channel_w_chat'] = (($_POST['chat']) ? $_POST['chat'] : 0);
|
||||
$arr['channel_a_delegate'] = (($_POST['delegate']) ? $_POST['delegate'] : 0);
|
||||
$arr['channel_r_storage'] = (($_POST['view_storage']) ? $_POST['view_storage'] : 0);
|
||||
$arr['channel_w_storage'] = (($_POST['write_storage']) ? $_POST['write_storage'] : 0);
|
||||
$arr['channel_r_pages'] = (($_POST['view_pages']) ? $_POST['view_pages'] : 0);
|
||||
$arr['channel_w_pages'] = (($_POST['write_pages']) ? $_POST['write_pages'] : 0);
|
||||
$arr['channel_a_republish'] = (($_POST['republish']) ? $_POST['republish'] : 0);
|
||||
|
||||
$defperms = 0;
|
||||
if(x($_POST['def_view_stream']))
|
||||
$defperms += $_POST['def_view_stream'];
|
||||
@ -427,6 +428,8 @@ function settings_post(&$a) {
|
||||
$defperms += $_POST['def_view_pages'];
|
||||
if(x($_POST['def_write_pages']))
|
||||
$defperms += $_POST['def_write_pages'];
|
||||
if(x($_POST['def_republish']))
|
||||
$defperms += $_POST['def_republish'];
|
||||
|
||||
$notify = 0;
|
||||
|
||||
@ -531,7 +534,7 @@ function settings_post(&$a) {
|
||||
);
|
||||
*/
|
||||
|
||||
$r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d, channel_r_stream = %d, channel_r_profile = %d, channel_r_photos = %d, channel_r_abook = %d, channel_w_stream = %d, channel_w_wall = %d, channel_w_tagwall = %d, channel_w_comment = %d, channel_w_mail = %d, channel_w_photos = %d, channel_w_chat = %d, channel_a_delegate = %d, channel_r_storage = %d, channel_w_storage = %d, channel_r_pages = %d, channel_w_pages = %d where channel_id = %d limit 1",
|
||||
$r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d, channel_r_stream = %d, channel_r_profile = %d, channel_r_photos = %d, channel_r_abook = %d, channel_w_stream = %d, channel_w_wall = %d, channel_w_tagwall = %d, channel_w_comment = %d, channel_w_mail = %d, channel_w_photos = %d, channel_w_chat = %d, channel_a_delegate = %d, channel_r_storage = %d, channel_w_storage = %d, channel_r_pages = %d, channel_w_pages = %d, channel_a_republish = %d where channel_id = %d limit 1",
|
||||
dbesc($username),
|
||||
intval($pageflags),
|
||||
dbesc($timezone),
|
||||
@ -556,6 +559,7 @@ function settings_post(&$a) {
|
||||
intval($arr['channel_w_storage']),
|
||||
intval($arr['channel_r_pages']),
|
||||
intval($arr['channel_w_pages']),
|
||||
intval($arr['channel_a_republish']),
|
||||
intval(local_user())
|
||||
);
|
||||
|
||||
|
@ -38,6 +38,7 @@ function connectFullShare() {
|
||||
$('#me_id_perms_post_mail').attr('checked','checked');
|
||||
$('#me_id_perms_chat').attr('checked','checked');
|
||||
$('#me_id_perms_view_storage').attr('checked','checked');
|
||||
$('#me_id_perms_republish').attr('checked','checked');
|
||||
}
|
||||
|
||||
function connectCautiousShare() {
|
||||
@ -73,6 +74,8 @@ function connectForum() {
|
||||
$('#me_id_perms_post_comments').attr('checked','checked');
|
||||
$('#me_id_perms_post_mail').attr('checked','checked');
|
||||
$('#me_id_perms_tag_deliver').attr('checked','checked');
|
||||
$('#me_id_perms_republish').attr('checked','checked');
|
||||
|
||||
}
|
||||
|
||||
function connectSoapBox() {
|
||||
|
Reference in New Issue
Block a user