From b19176169cd93e7aa305296a85e28c8c1c68352b Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 17 Jul 2014 20:54:30 -0700 Subject: provide a specific permission for liking profiles (reuse the obsolete bookmark permission), also remove the unused 'unconnected contacts' view for now. --- boot.php | 4 ++-- include/permissions.php | 5 ++++- install/database.sql | 4 ++-- install/update.php | 14 ++++++++++++-- mod/connections.php | 22 +++++++++++----------- mod/like.php | 2 +- mod/settings.php | 10 +++++----- view/js/mod_connedit.js | 3 +++ view/js/mod_settings.js | 20 ++++++++++++++++---- 9 files changed, 56 insertions(+), 28 deletions(-) diff --git a/boot.php b/boot.php index cd0dca2ca..af395f30b 100755 --- a/boot.php +++ b/boot.php @@ -47,7 +47,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1117 ); +define ( 'DB_UPDATE_VERSION', 1118 ); define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); @@ -282,7 +282,7 @@ define ( 'PERMS_W_STORAGE', 0x02000); define ( 'PERMS_R_PAGES', 0x04000); define ( 'PERMS_W_PAGES', 0x08000); define ( 'PERMS_A_REPUBLISH', 0x10000); -define ( 'PERMS_A_BOOKMARK', 0x20000); +define ( 'PERMS_W_LIKE', 0x20000); // General channel permissions diff --git a/include/permissions.php b/include/permissions.php index 9fded3b43..facba037f 100644 --- a/include/permissions.php +++ b/include/permissions.php @@ -20,9 +20,11 @@ function get_perms() { // Write permissions 'send_stream' => array('channel_w_stream', intval(PERMS_W_STREAM), false, t('Can send me their channel stream and posts'), ''), 'post_wall' => array('channel_w_wall', intval(PERMS_W_WALL), false, t('Can post on my channel page ("wall")'), ''), - 'post_comments' => array('channel_w_comment', intval(PERMS_W_COMMENT), false, t('Can comment on my posts'), ''), + 'post_comments' => array('channel_w_comment', intval(PERMS_W_COMMENT), false, t('Can comment on or like my posts'), ''), 'post_mail' => array('channel_w_mail', intval(PERMS_W_MAIL), false, t('Can send me private mail messages'), ''), 'post_photos' => array('channel_w_photos', intval(PERMS_W_PHOTOS), false, t('Can post photos to my photo albums'), ''), + 'post_like' => array('channel_w_like', intval(PERMS_W_LIKE), false, t('Can like/dislike stuff'), 'Profiles and things other than posts/comments'), + 'tag_deliver' => array('channel_w_tagwall', intval(PERMS_W_TAGWALL), false, t('Can forward to all my channel contacts via post @mentions'), t('Advanced - useful for creating group forum channels')), 'chat' => array('channel_w_chat', intval(PERMS_W_CHAT), false, t('Can chat with me (when available)'), t('')), 'write_storage' => array('channel_w_storage', intval(PERMS_W_STORAGE), false, t('Can write to my "public" file storage'), ''), @@ -395,6 +397,7 @@ function site_default_perms() { 'write_storage' => 0, 'write_pages' => 0, 'delegate' => 0, + 'post_like' => PERMS_NETWORK ); $global_perms = get_perms(); diff --git a/install/database.sql b/install/database.sql index e2b814067..c0440c035 100644 --- a/install/database.sql +++ b/install/database.sql @@ -204,7 +204,7 @@ CREATE TABLE IF NOT EXISTS `channel` ( `channel_r_pages` int(10) unsigned NOT NULL DEFAULT '128', `channel_w_pages` int(10) unsigned NOT NULL DEFAULT '128', `channel_a_republish` int(10) unsigned NOT NULL DEFAULT '128', - `channel_a_bookmark` int(10) unsigned NOT NULL DEFAULT '128', + `channel_w_like` int(10) unsigned NOT NULL DEFAULT '128', PRIMARY KEY (`channel_id`), UNIQUE KEY `channel_address_unique` (`channel_address`), KEY `channel_account_id` (`channel_account_id`), @@ -239,7 +239,7 @@ CREATE TABLE IF NOT EXISTS `channel` ( KEY `channel_w_pages` (`channel_w_pages`), KEY `channel_deleted` (`channel_deleted`), KEY `channel_a_republish` (`channel_a_republish`), - KEY `channel_a_bookmark` (`channel_a_bookmark`), + KEY `channel_w_like` (`channel_w_like`), KEY `channel_dirdate` (`channel_dirdate`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; diff --git a/install/update.php b/install/update.php index 6600808a6..5bc5c9aa3 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ t('Only show hidden connections'), ), - array( - 'label' => t('Unconnected'), - 'url' => z_root() . '/connections/unconnected', - 'sel' => ($unconnected) ? 'active' : '', - 'title' => t('Only show one-way connections'), - ), +// array( +// 'label' => t('Unconnected'), +// 'url' => z_root() . '/connections/unconnected', +// 'sel' => ($unconnected) ? 'active' : '', +// 'title' => t('Only show one-way connections'), +// ), ); diff --git a/mod/like.php b/mod/like.php index f4feca279..916faf230 100755 --- a/mod/like.php +++ b/mod/like.php @@ -149,7 +149,7 @@ function like_content(&$a) { $perms = get_all_perms($owner_uid,$observer['xchan_hash']); - if(! ($perms['post_wall'] && $perms['view_profile'])) { + if(! ($perms['post_like'] && $perms['view_profile'])) { if($interactive) { notice( t('Permission denied.') . EOL); return $o; diff --git a/mod/settings.php b/mod/settings.php index 7a63e5fc4..e036755fc 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -309,7 +309,7 @@ function settings_post(&$a) { $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); - $arr['channel_a_bookmark'] = (($_POST['bookmark']) ? $_POST['bookmark'] : 0); + $arr['channel_w_like'] = (($_POST['post_like']) ? $_POST['post_like'] : 0); $defperms = 0; if(x($_POST['def_view_stream'])) @@ -346,8 +346,8 @@ function settings_post(&$a) { $defperms += $_POST['def_write_pages']; if(x($_POST['def_republish'])) $defperms += $_POST['def_republish']; - if(x($_POST['def_bookmark'])) - $defperms += $_POST['def_bookmark']; + if(x($_POST['def_post_like'])) + $defperms += $_POST['def_post_like']; $notify = 0; @@ -405,7 +405,7 @@ function settings_post(&$a) { set_pconfig(local_user(),'system','hide_online_status',$hide_presence); set_pconfig(local_user(),'system','channel_menu',$channel_menu); - $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_default_group = '%s', 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, channel_a_bookmark = %d, channel_allow_cid = '%s', channel_allow_gid = '%s', channel_deny_cid = '%s', channel_deny_gid = '%s' 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_default_group = '%s', 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, channel_w_like = %d, channel_allow_cid = '%s', channel_allow_gid = '%s', channel_deny_cid = '%s', channel_deny_gid = '%s' where channel_id = %d limit 1", dbesc($username), intval($pageflags), dbesc($timezone), @@ -432,7 +432,7 @@ function settings_post(&$a) { intval($arr['channel_r_pages']), intval($arr['channel_w_pages']), intval($arr['channel_a_republish']), - intval($arr['channel_a_bookmark']), + intval($arr['channel_w_like']), dbesc($str_contact_allow), dbesc($str_group_allow), dbesc($str_contact_deny), diff --git a/view/js/mod_connedit.js b/view/js/mod_connedit.js index e66c26cda..4d25bb8c4 100644 --- a/view/js/mod_connedit.js +++ b/view/js/mod_connedit.js @@ -33,6 +33,7 @@ function connectFullShare() { $('#me_id_perms_chat').attr('checked','checked'); $('#me_id_perms_view_storage').attr('checked','checked'); $('#me_id_perms_republish').attr('checked','checked'); + $('#me_id_perms_post_like').attr('checked','checked'); $('.abook-permschange').show(); $('.abook-permschange').html(aStr['permschange']); @@ -52,6 +53,7 @@ function connectCautiousShare() { $('#me_id_perms_send_stream').attr('checked','checked'); $('#me_id_perms_post_comments').attr('checked','checked'); $('#me_id_perms_post_mail').attr('checked','checked'); + $('#me_id_perms_post_like').attr('checked','checked'); $('.abook-permschange').show(); $('.abook-permschange').html(aStr['permschange']); @@ -75,6 +77,7 @@ function connectForum() { $('#me_id_perms_post_mail').attr('checked','checked'); $('#me_id_perms_tag_deliver').attr('checked','checked'); $('#me_id_perms_republish').attr('checked','checked'); + $('#me_id_perms_post_like').attr('checked','checked'); $('.abook-permschange').show(); $('.abook-permschange').html(aStr['permschange']); diff --git a/view/js/mod_settings.js b/view/js/mod_settings.js index 4daa7f704..77c9d0ced 100644 --- a/view/js/mod_settings.js +++ b/view/js/mod_settings.js @@ -24,6 +24,18 @@ $(document).ready(function() { }); +/** + * 0 nobody + * 1 perms_specific + * 2 perms_contacts + * 3 perms_pending + * 4 perms_site + * 5 perms_network + * 6 perms_authed + * 7 perms_public + */ + + function channel_privacy_macro(n) { if(n == 0) { $('#id_view_stream option').eq(0).attr('selected','selected'); @@ -43,7 +55,7 @@ function channel_privacy_macro(n) { $('#id_write_pages option').eq(0).attr('selected','selected'); $('#id_delegate option').eq(0).attr('selected','selected'); $('#id_republish option').eq(0).attr('selected','selected'); - $('#id_bookmark option').eq(0).attr('selected','selected'); + $('#id_post_like option').eq(0).attr('selected','selected'); $('#id_profile_in_directory_onoff .off').removeClass('hidden'); $('#id_profile_in_directory_onoff .on').addClass('hidden'); $('#id_profile_in_directory').val(0); @@ -66,7 +78,7 @@ function channel_privacy_macro(n) { $('#id_write_pages option').eq(1).attr('selected','selected'); $('#id_delegate option').eq(0).attr('selected','selected'); $('#id_republish option').eq(0).attr('selected','selected'); - $('#id_bookmark option').eq(1).attr('selected','selected'); + $('#id_post_like option').eq(1).attr('selected','selected'); $('#id_profile_in_directory_onoff .off').removeClass('hidden'); $('#id_profile_in_directory_onoff .on').addClass('hidden'); $('#id_profile_in_directory').val(0); @@ -89,7 +101,7 @@ function channel_privacy_macro(n) { $('#id_write_pages option').eq(0).attr('selected','selected'); $('#id_delegate option').eq(0).attr('selected','selected'); $('#id_republish option').eq(1).attr('selected','selected'); - $('#id_bookmark option').eq(1).attr('selected','selected'); + $('#id_post_like option').eq(5).attr('selected','selected'); $('#id_profile_in_directory_onoff .on').removeClass('hidden'); $('#id_profile_in_directory_onoff .off').addClass('hidden'); $('#id_profile_in_directory').val(1); @@ -112,7 +124,7 @@ function channel_privacy_macro(n) { $('#id_write_pages option').eq(2).attr('selected','selected'); $('#id_delegate option').eq(0).attr('selected','selected'); $('#id_republish option').eq(5).attr('selected','selected'); - $('#id_bookmark option').eq(5).attr('selected','selected'); + $('#id_post_like option').eq(6).attr('selected','selected'); $('#id_profile_in_directory_onoff .on').removeClass('hidden'); $('#id_profile_in_directory_onoff .off').addClass('hidden'); $('#id_profile_in_directory').val(1); -- cgit v1.2.3