diff options
author | Thomas Willingham <beardyunixer@beardyunixer.com> | 2014-09-18 17:08:23 +0100 |
---|---|---|
committer | Thomas Willingham <beardyunixer@beardyunixer.com> | 2014-09-18 17:08:23 +0100 |
commit | 595be9919b0ce85087937985444477189381976c (patch) | |
tree | bc31493095cedd2bcf6a8fd280d1196450439c4e | |
parent | 65441b95bbf84f8f88445b6352995c9c89beb1f4 (diff) | |
parent | 0b47fb9a91b58147e616ea75a23dea0d431c40f8 (diff) | |
download | volse-hubzilla-595be9919b0ce85087937985444477189381976c.tar.gz volse-hubzilla-595be9919b0ce85087937985444477189381976c.tar.bz2 volse-hubzilla-595be9919b0ce85087937985444477189381976c.zip |
Merge branch 'master' of https://github.com/friendica/red
-rw-r--r-- | doc/to_do_code.bb | 2 | ||||
-rw-r--r-- | include/identity.php | 18 | ||||
-rw-r--r-- | include/permissions.php | 36 | ||||
-rw-r--r-- | mod/new_channel.php | 7 | ||||
-rw-r--r-- | view/css/mod_new_channel.css | 4 | ||||
-rw-r--r-- | view/en-gb/strings.php | 2 | ||||
-rw-r--r-- | view/js/mod_new_channel.js | 4 | ||||
-rwxr-xr-x | view/tpl/new_channel.tpl | 9 |
8 files changed, 71 insertions, 11 deletions
diff --git a/doc/to_do_code.bb b/doc/to_do_code.bb index 0005b4be3..fe213baf3 100644 --- a/doc/to_do_code.bb +++ b/doc/to_do_code.bb @@ -14,6 +14,8 @@ We need much more than this, but here are areas where developers can help. Pleas [li]implement oembed provider interface[/li]
+[li]refactor the oembed client interface so that we can safely sandbox remote content[/li]
+
[li]implement openid server interface[/li]
[li]Write more webpage layouts[/li]
diff --git a/include/identity.php b/include/identity.php index 38e96ab71..50c5d13b9 100644 --- a/include/identity.php +++ b/include/identity.php @@ -219,13 +219,15 @@ function create_identity($arr) { $perms_sql = ''; $role_permissions = null; + $global_perms = get_perms(); if(array_key_exists('permissions_role',$arr) && $arr['permissions_role']) { $role_permissions = get_role_perms($arr['permissions_role']); + if($role_permissions) { foreach($role_permissions as $p => $v) { if(strpos($p,'channel_') !== false) { - $perms_keys .= ', ' . $global_perms[$p][0]; + $perms_keys .= ', ' . $p; $perms_vals .= ', ' . intval($v); } if($p === 'directory_publish') @@ -235,16 +237,16 @@ function create_identity($arr) { } else { $defperms = site_default_perms(); - $global_perms = get_perms(); foreach($defperms as $p => $v) { $perms_keys .= ', ' . $global_perms[$p][0]; $perms_vals .= ', ' . intval($v); } } + $expire = get_config('system', 'default_expire_days'); $expire = (($expire===false)? '0': $expire); - + $r = q("insert into channel ( channel_account_id, channel_primary, channel_name, channel_address, channel_guid, channel_guid_sig, channel_hash, channel_prvkey, channel_pubkey, channel_pageflags, channel_expire_days $perms_keys ) @@ -264,8 +266,6 @@ function create_identity($arr) { ); - - $r = q("select * from channel where channel_account_id = %d and channel_guid = '%s' limit 1", intval($arr['account_id']), @@ -361,14 +361,18 @@ function create_identity($arr) { // Save our permissions role so we can perhaps call it up and modify it later. - if($role_permissions) + if($role_permissions) { set_pconfig($newuid,'system','permissions_role',$arr['permissions_role']); + if(array_key_exists('online',$role_permissions)) + set_pconfig('system','hide_presence',1-intval($role_permissions['online'])); + } - // Create a group with no members. This allows somebody to use it + // Create a group with yourself as a member. This allows somebody to use it // right away as a default group for new contacts. require_once('include/group.php'); group_add($newuid, t('Friends')); + group_add_member($newuid,t('Friends'),$ret['channel']['channel_hash']); // if our role_permissions indicate that we're using a default collection ACL, add it. diff --git a/include/permissions.php b/include/permissions.php index 0e213a208..e25052f95 100644 --- a/include/permissions.php +++ b/include/permissions.php @@ -440,6 +440,7 @@ function get_role_perms($role) { $ret['perms_auto'] = false; $ret['default_collection'] = false; $ret['directory_publish'] = true; + $ret['online'] = true; $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT |PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE; @@ -471,6 +472,7 @@ function get_role_perms($role) { $ret['perms_auto'] = false; $ret['default_collection'] = true; $ret['directory_publish'] = true; + $ret['online'] = true; $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT |PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE; @@ -502,6 +504,7 @@ function get_role_perms($role) { $ret['perms_auto'] = false; $ret['default_collection'] = true; $ret['directory_publish'] = false; + $ret['online'] = false; $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT |PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE; @@ -528,10 +531,11 @@ function get_role_perms($role) { break; - case 'forum_public': + case 'forum': $ret['perms_auto'] = true; $ret['default_collection'] = false; $ret['directory_publish'] = true; + $ret['online'] = false; $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT |PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE|PERMS_W_TAGWALL; @@ -562,6 +566,7 @@ function get_role_perms($role) { $ret['perms_auto'] = false; $ret['default_collection'] = true; $ret['directory_publish'] = true; + $ret['online'] = false; $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT |PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE|PERMS_W_TAGWALL; @@ -593,6 +598,7 @@ function get_role_perms($role) { $ret['perms_auto'] = false; $ret['default_collection'] = true; $ret['directory_publish'] = false; + $ret['online'] = false; $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT |PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE; @@ -623,6 +629,7 @@ function get_role_perms($role) { $ret['perms_auto'] = true; $ret['default_collection'] = false; $ret['directory_publish'] = true; + $ret['online'] = false; $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL |PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE; @@ -654,6 +661,7 @@ function get_role_perms($role) { $ret['perms_auto'] = false; $ret['default_collection'] = true; $ret['directory_publish'] = false; + $ret['online'] = false; $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL |PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_W_LIKE; @@ -684,6 +692,7 @@ function get_role_perms($role) { $ret['perms_auto'] = true; $ret['default_collection'] = false; $ret['directory_publish'] = true; + $ret['online'] = false; $ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK |PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE; $ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_PHOTOS|PERMS_R_ABOOK @@ -719,3 +728,28 @@ function get_role_perms($role) { } +function role_selector($current) { + $roles = array( + 'social' => array( t('Social Networking'), + array('social' => t('Mostly Public'), 'social_restricted' => t('Restricted'), 'social_private' => t('Private'))), + 'forum' => array( t('Community Forum'), + array('forum' => t('Mostly Public'), 'forum_restricted' => t('Restricted'), 'forum_private' => t('Private'))), + 'feed' => array( t('Feed Republish'), + array('feed' => t('Mostly Public'), 'feed_restricted' => t('Restricted'))), + 'soapbox' => array( t('Celebrity/Soapbox'), + array('soapbox' => t('Mostly Public'))), + 'other' => array( t('Other'), + array('custom' => t('Custom/Expert Mode')))); + $o = '<select name="permissions_role" id="privacy-role-select">'; + foreach($roles as $k => $v) { + $o .= '<optgroup label="'. htmlspecialchars($v[0]) . '" >'; + foreach($v[1] as $kk => $vv) { + $selected = (($kk === $current) ? ' selected="selected" ' : ''); + $o .= '<option value="' . $kk . '" ' . $selected . '>' . htmlspecialchars($vv) . '</option>'; + } + $o .= '<optgroup>'; + } + $o .= '</select>'; + return $o; +} + diff --git a/mod/new_channel.php b/mod/new_channel.php index eafef2c08..8329f0ec3 100644 --- a/mod/new_channel.php +++ b/mod/new_channel.php @@ -1,6 +1,8 @@ <?php require_once('include/identity.php'); +require_once('include/permissions.php'); + function new_channel_init(&$a) { @@ -100,7 +102,7 @@ function new_channel_content(&$a) { $name = ((x($_REQUEST,'name')) ? $_REQUEST['name'] : "" ); $nickname = ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : "" ); - + $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" ); $o = replace_macros(get_markup_template('new_channel.tpl'), array( @@ -113,6 +115,9 @@ function new_channel_content(&$a) { '$nick_desc' => t('Your nickname will be used to create an easily remembered channel address (like an email address) which you can share with others.'), '$label_import' => t('Or <a href="import">import an existing channel</a> from another location'), '$name' => $name, + '$label_role' => t('Channel Type'), + '$help_role' => t('Please choose a channel type (such as social networking or community forum) and privacy requirements so we can select the best permissions for you'), + '$role_select' => role_selector(($privacy_role) ? $privacy_role : 'social'), '$nickname' => $nickname, '$submit' => t('Create') )); diff --git a/view/css/mod_new_channel.css b/view/css/mod_new_channel.css index 3b9c80953..2af0fbb2d 100644 --- a/view/css/mod_new_channel.css +++ b/view/css/mod_new_channel.css @@ -1,13 +1,13 @@ h2 { margin-left: 15%; - margin-top: 15%; + margin-top: 5%; } #newchannel-form { font-size: 1.4em; margin-left: 15%; - margin-top: 5%; + margin-top: 20px; width: 50%; } diff --git a/view/en-gb/strings.php b/view/en-gb/strings.php index abf14f43a..a95915844 100644 --- a/view/en-gb/strings.php +++ b/view/en-gb/strings.php @@ -27,3 +27,5 @@ $a->strings["Do you want to authorize this application to access your posts and $a->strings["If your certificate is not recognized, members of other sites (who may themselves have valid certificates) will get a warning message on their own site complaining about security issues."] = "If your certificate is not recognised, members of other sites (who may themselves have valid certificates) will get a warning message on their own site complaining about security issues."; $a->strings["This is a hub of the Red Matrix - a global cooperative network of decentralized privacy enhanced websites."] = "This is a hub of the Red Matrix - a global cooperative network of decentralised privacy enhanced websites."; $a->strings["You are cordially invited to join me and some other close friends on the Red Matrix - a revolutionary new decentralized communication and information tool."] = "You are cordially invited to join me and some other close friends on the Red Matrix - a revolutionary new decentralised communication and information tool."; +$a->strings["l F d, Y \\@ g:i A"] = "l j F, Y \\@ G:i"; +$a->strings["D, d M Y - g:i A"] = "D, d M Y - G:i"; diff --git a/view/js/mod_new_channel.js b/view/js/mod_new_channel.js index a3c1dd05c..882da940e 100644 --- a/view/js/mod_new_channel.js +++ b/view/js/mod_new_channel.js @@ -1,16 +1,20 @@ $(document).ready(function() { $("#newchannel-name").blur(function() { + $("#name-spinner").spin('small'); var zreg_name = $("#newchannel-name").val(); $.get("new_channel/autofill.json?f=&name=" + encodeURIComponent(zreg_name),function(data) { $("#newchannel-nickname").val(data); zFormError("#newchannel-name-feedback",data.error); + $("#name-spinner").spin(false); }); }); $("#newchannel-nickname").blur(function() { + $("#nick-spinner").spin('small'); var zreg_nick = $("#newchannel-nickname").val(); $.get("new_channel/checkaddr.json?f=&nick=" + encodeURIComponent(zreg_nick),function(data) { $("#newchannel-nickname").val(data); zFormError("#newchannel-nickname-feedback",data.error); + $("#nick-spinner").spin(false); }); }); diff --git a/view/tpl/new_channel.tpl b/view/tpl/new_channel.tpl index 261f965da..b28810236 100755 --- a/view/tpl/new_channel.tpl +++ b/view/tpl/new_channel.tpl @@ -4,8 +4,16 @@ <div id="newchannel-desc" class="descriptive-paragraph">{{$desc}}</div> + <div id="newchannel-role-help" class="descriptive-paragraph">{{$help_role}}</div> + + <label for="newchannel-role" id="label-newchannel-role" class="newchannel-label" >{{$label_role}}</label> + {{$role_select}} + <div id="newchannel-role-end" class="newchannel-field-end"></div> + + <label for="newchannel-name" id="label-newchannel-name" class="newchannel-label" >{{$label_name}}</label> <input type="text" name="name" id="newchannel-name" class="newchannel-input" value="{{$name}}" /> + <div id="name-spinner"></div> <div id="newchannel-name-feedback" class="newchannel-feedback"></div> <div id="newchannel-name-end" class="newchannel-field-end"></div> @@ -13,6 +21,7 @@ <label for="newchannel-nickname" id="label-newchannel-nickname" class="newchannel-label" >{{$label_nick}}</label> <input type="text" name="nickname" id="newchannel-nickname" class="newchannel-input" value="{{$nickname}}" /> + <div id="nick-spinner"></div> <div id="newchannel-nickname-feedback" class="newchannel-feedback"></div> <div id="newchannel-nickname-end" class="newchannel-field-end"></div> |