1) Implement the OAuth protocol to retrieve a token from a server to authorize the access to an API on behalf of the current user.
+
2) Perform calls to a Web services API using a token previously obtained using this class or a token provided some other way by the Web services provider.
Regardless of your purposes, you always need to start calling the class Initialize function after initializing setup variables. After you are done with the class, always call the Finalize function at the end.
+
This class supports either OAuth protocol versions 1.0, 1.0a and 2.0. It abstracts the differences between these protocol versions, so the class usage is the same independently of the OAuth version of the server.
+
The class also provides built-in support to several popular OAuth servers, so you do not have to manually configure all the details to access those servers. Just set the server variable to configure the class to access one of the built-in supported servers.
Before proceeding to the actual OAuth authorization process, you need to have registered your application with the OAuth server. The registration provides you values to set the variables client_id and client_secret.
+
You also need to set the variables redirect_uri and scope before calling the Process function to make the class perform the necessary interactions with the OAuth server.
+
The OAuth protocol involves multiple steps that include redirection to the OAuth server. There it asks permission to the current user to grant your application access to APIs on his/her behalf. When there is a redirection, the class will set the exit variable to 1. Then your script should exit immediately without outputting anything.
+
When the OAuth access token is successfully obtained, the following variables are set by the class with the obtained values: access_token, access_token_secret, access_token_expiry, access_token_type. You may want to store these values to use them later when calling the server APIs.
+
If there was a problem during OAuth authorization process, check the variable authorization_error to determine the reason.
+
Once you get the access token, you can call the server APIs using the CallAPI function. Check the access_token_error variable to determine if there was an error when trying to to call the API.
+
If for some reason the user has revoked the access to your application, you need to ask the user to authorize your application again. First you may need to call the function ResetAccessToken to reset the value of the access token that may be cached in session variables.
Store the message that is returned when an error occurs.
+
Usage
+
Check this variable to understand what happened when a call to any of the class functions has failed.
+
This class uses cumulative error handling. This means that if one class functions that may fail is called and this variable was already set to an error message due to a failure in a previous call to the same or other function, the function will also fail and does not do anything.
+
This allows programs using this class to safely call several functions that may fail and only check the failure condition after the last function call.
+
Just set this variable to an empty string to clear the error condition.
Set this variable to 1 if you need to check what is going on during calls to the class. When enabled, the debug output goes either to the variable debug_output and the PHP error log.
The class provides built-in support to several types of OAuth servers. This means that the class can automatically initialize several configuration variables just by setting this server variable.
+
Currently it supports the following servers: 'Bitbucket', 'Box', 'Dropbox', 'Eventful', 'Facebook', 'Fitbit', 'Flickr', 'Foursquare', 'github', 'Google', 'Instagram', 'LinkedIn', 'Microsoft', 'Scoop.it', 'StockTwits', 'Tumblr', 'Twitter', 'XING' and 'Yahoo'. Please contact the author if you would like to ask to add built-in support for other types of OAuth servers.
+
If you want to access other types of OAuth servers that are not yet supported, set this variable to an empty string and configure other variables with values specific to those servers.
URL of the OAuth server to request the initial token for OAuth 1.0 and 1.0a servers.
+
Usage
+
Set this variable to the OAuth request token URL when you are not accessing one of the built-in supported OAuth servers.
+
For OAuth 1.0 and 1.0a servers, the request token URL can have certain marks that will act as template placeholders which will be replaced with given values before requesting the authorization token. Currently it supports the following placeholder marks:
+
{SCOPE} - scope of the requested permissions to the granted by the OAuth server with the user permissions
URL of the OAuth server to redirect the browser so the user can grant access to your application.
+
Usage
+
Set this variable to the OAuth request token URL when you are not accessing one of the built-in supported OAuth servers.
+
For certain servers, the dialog URL can have certain marks that will act as template placeholders which will be replaced with values defined before redirecting the users browser. Currently it supports the following placeholder marks:
+
{REDIRECT_URI} - URL to redirect when returning from the OAuth server authorization page
+
{CLIENT_ID} - client application identifier registered at the server
+
{SCOPE} - scope of the requested permissions to the granted by the OAuth server with the user permissions
URL of the OAuth server to redirect the browser so the user can grant access to your application when offline access is requested.
+
Usage
+
Set this variable to the OAuth request token URL when you are not accessing one of the built-in supported OAuth servers and the OAuth server supports offline access.
+
It should have the same format as the dialog_url variable.
Pass the OAuth session state in a variable with a different name to work around implementation bugs of certain OAuth servers
+
Usage
+
Set this variable when you are not accessing one of the built-in supported OAuth servers if the OAuth server has a bug that makes it not pass back the OAuth state identifier in a request variable named state.
Determine if the OAuth parameters should be passed via HTTP Authorization request header.
+
Usage
+
Set this variable to 1 if the OAuth server requires that the OAuth parameters be passed using the HTTP Authorization instead of the request URI parameters.
Permissions that your application needs to call the OAuth server APIs
+
Usage
+
Check the documentation of the APIs that your application needs to call to set this variable with the identifiers of the permissions that the user needs to grant to your application.
Specify whether it will be necessary to call the API when the user is not present and the server supports renewing expired access tokens using refresh tokens.
+
Usage
+
Set this variable to 1 if the server supports renewing expired tokens automatically when the user is not present.
Timestamp of the expiry of the access token obtained from the OAuth server.
+
Usage
+
Check this variable to get the obtained access token expiry time upon successful OAuth authorization. If this variable is empty, that means no expiry time was set.
HTTP response status returned by the server when calling an API
+
Usage
+
Check this variable after calling the CallAPI function if the API calls and you need to process the error depending the response status. 200 means no error. 0 means the server response was not retrieved.
Store the values of the access token when it is succefully retrieved from the OAuth server.
+
Usage
+
This function is meant to be only be called from inside the class. By default it stores access tokens in a session variable named 'OAUTH_ACCESS_TOKEN'.
+
Actual implementations should create a sub-class and override this function to make the access token values be stored in other types of containers, like for instance databases.
+
Arguments
+
+
access_token - Associative array with properties of the access token. The array may have set the following properties:
+
'value': string value of the access token
+
'authorized': boolean value that determines if the access token was obtained successfully
+
'expiry': (optional) timestamp in ISO format relative to UTC time zone of the access token expiry time
+
'type': (optional) type of OAuth token that may determine how it should be used when sending API call requests.
+
'refresh': (optional) token that some servers may set to allowing refreshing access tokens when they expire.
+
+
Return value
+
This function should return 1 if the access token was stored successfully.
Retrieve the OAuth access token if it was already previously stored by the StoreAccessToken function.
+
Usage
+
This function is meant to be only be called from inside the class. By default it retrieves access tokens stored in a session variable named 'OAUTH_ACCESS_TOKEN'.
+
Actual implementations should create a sub-class and override this function to retrieve the access token values from other types of containers, like for instance databases.
+
Arguments
+
+
access_token - Return the properties of the access token in an associative array. If the access token was not yet stored, it returns an empty array. Otherwise, the properties it may return are the same that may be passed to the StoreAccessToken.
+
+
Return value
+
This function should return 1 if the access token was retrieved successfully.
Reset the access token to a state back when the user has not yet authorized the access to the OAuth server API.
+
Usage
+
Call this function if for some reason the token to access the API was revoked and you need to ask the user to authorize the access again.
+
By default the class stores and retrieves access tokens in a session variable named 'OAUTH_ACCESS_TOKEN'.
+
This function must be called when the user is accessing your site pages, so it can reset the information stored in session variables that cache the state of a previously retrieved access token.
+
Actual implementations should create a sub-class and override this function to reset the access token state when it is stored in other types of containers, like for instance databases.
+
Return value
+
This function should return 1 if the access token was resetted successfully.
Send a HTTP request to the Web services API using a previously obtained authorization token via OAuth.
+
Usage
+
This function can be used to call an API after having previously obtained an access token through the OAuth protocol using the Process function, or by directly setting the variables access_token, as well as access_token_secret in case of using OAuth 1.0 or 1.0a services.
+
Arguments
+
+
url - URL of the API where the HTTP request will be sent.
+
method - HTTP method that will be used to send the request. It can be 'GET', 'POST', 'DELETE', 'PUT', etc..
+
parameters - Associative array with the names and values of the API call request parameters.
+
options - Associative array with additional options to configure the request. Currently it supports the following options:
+
'2Legged': boolean option that determines if the API request should be 2 legged. The default value is 0.
+
'Accept': content type value of the Accept HTTP header to be sent in the API call HTTP request. Some APIs require that a certain value be sent to specify which version of the API is being called. The default value is '*/*'.
+
'ConvertObjects': boolean option that determines if objects should be converted into arrays when the response is returned in JSON format. The default value is 0.
+
'FailOnAccessError': boolean option that determines if this functions should fail when the server response status is not between 200 and 299. The default value is 0.
+
'Files': associative array with details of the parameters that must be passed as file uploads. The array indexes must have the same name of the parameters to be sent as files. The respective array entry values must also be associative arrays with the parameters for each file. Currently it supports the following parameters:
+
- Type - defines how the parameter value should be treated. It can be 'FileName' if the parameter value is is the name of a local file to be uploaded. It may also be 'Data' if the parameter value is the actual data of the file to be uploaded.
+
- Default: 'FileName'
+
- ContentType - MIME value of the content type of the file. It can be 'automatic/name' if the content type should be determine from the file name extension.
+
- Default: 'automatic/name'
+
'PostValuesInURI': boolean option to determine that a POST request should pass the request values in the URI. The default value is 0.
+
'FollowRedirection': limit number of times that HTTP response redirects will be followed. If it is set to 0, redirection responses fail in error. The default value is 0.
+
'RequestBody': request body data of a custom type. The 'RequestContentType' option must be specified, so the 'RequestBody' option is considered.
+
'RequestContentType': content type that should be used to send the request values. It can be either 'application/x-www-form-urlencoded' for sending values like from Web forms, or 'application/json' for sending the values encoded in JSON format. Other types are accepted if the 'RequestBody' option is specified. The default value is 'application/x-www-form-urlencoded'.
+
'RequestBody': request body data of a custom type. The 'RequestContentType' option must be specified, so the 'RequestBody' option is considered.
+
'Resource': string with a label that will be used in the error messages and debug log entries to identify what operation the request is performing. The default value is 'API call'.
+
'ResponseContentType': content type that should be considered when decoding the API request response. This overrides the Content-Type header returned by the server. If the content type is 'application/x-www-form-urlencoded' the function will parse the data returning an array of key-value pairs. If the content type is 'application/json' the response will be decode as a JSON-encoded data type. Other content type values will make the function return the original response value as it was returned from the server. The default value for this option is to use what the server returned in the Content-Type header.
+
response - Return the value of the API response. If the value is JSON encoded, this function will decode it and return the value converted to respective types. If the value is form encoded, this function will decode the response and return it as an array. Otherwise, the class will return the value as a string.
+
+
Return value
+
This function returns 1 if the call was done successfully.
Initialize the class variables and internal state. It must be called before calling other class functions.
+
Usage
+
Set the server variable before calling this function to let it initialize the class variables to work with the specified server type. Alternatively, you can set other class variables manually to make it work with servers that are not yet built-in supported.
+
Return value
+
This function returns 1 if it was able to successfully initialize the class for the specified server type.
Process the OAuth protocol interaction with the OAuth server.
+
Usage
+
Call this function when you need to retrieve the OAuth access token. Check the access_token to determine if the access token was obtained successfully.
+
Return value
+
This function returns 1 if the OAuth protocol was processed without errors.
+
+
+
+
+Manuel Lemos (mlemos-at-acm.org)
+
+
From 4d91b6e6d243eacb12faffb4d4ce2a3eec85f820 Mon Sep 17 00:00:00 2001
From: friendica
Date: Mon, 15 Sep 2014 22:53:33 -0700
Subject: [PATCH 11/32] fat finger - must have been here a while
---
mod/admin.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mod/admin.php b/mod/admin.php
index 836b12281..9a35a8de8 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -768,7 +768,7 @@ function admin_page_channels_post(&$a){
);
proc_run('php','include/directory.php',$uid,'nopush');
}
- notice( sprintf( tt("%s channel censored/uncensored", "%s channelss censored/uncensored", count($channels)), count($channels)) );
+ notice( sprintf( tt("%s channel censored/uncensored", "%s channels censored/uncensored", count($channels)), count($channels)) );
}
if (x($_POST,'page_channels_delete')){
require_once("include/Contact.php");
From b2f2424b5272f7c58343fe810f303b55f1b7bf5e Mon Sep 17 00:00:00 2001
From: friendica
Date: Mon, 15 Sep 2014 23:11:08 -0700
Subject: [PATCH 12/32] push individual block to directory
---
mod/admin.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/mod/admin.php b/mod/admin.php
index 9a35a8de8..68ce6fe85 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -814,6 +814,7 @@ function admin_page_channels(&$a){
intval(PAGE_CENSORED),
intval( $uid )
);
+ proc_run('php','include/directory.php',$uid,'nopush');
notice( sprintf( (($channel[0]['channel_pageflags'] & PAGE_CENSORED) ? t("Channel '%s' uncensored"): t("Channel '%s' censored")) , $channel[0]['channel_name'] . ' (' . $channel[0]['channel_address'] . ')' ) . EOL);
}; break;
From a1b66f56f0981a0853f180a458c401a80dda28ce Mon Sep 17 00:00:00 2001
From: friendica
Date: Tue, 16 Sep 2014 03:33:48 -0700
Subject: [PATCH 13/32] use the more portable encoded_item format for exported
items - but with added attributes so we can use it as a reasonably complete
item backup. The encoded_item format gives us extended author and owner
information in case we need to probe them to bring the entry back. It also
contains taxonomy entries. Importing and/or recovering will best be
accomplished in chunks. It could take some time and some memory to chew
through this.
---
include/identity.php | 18 ++++++------------
include/items.php | 28 +++++++++++++++++++++++++---
version.inc | 2 +-
3 files changed, 32 insertions(+), 16 deletions(-)
diff --git a/include/identity.php b/include/identity.php
index 1078ff082..2039738e0 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -489,18 +489,12 @@ function identity_basic_export($channel_id, $items = false) {
intval($channel_id)
);
if($r) {
- for($x = 0; $x < count($r); $x ++) {
- if($r[$x]['diaspora_meta'])
- $r[$x]['diaspora_meta'] = crypto_unencapsulate(json_decode($r[$x]['diaspora_meta'],true),$key);
- if($r[$x]['item_flags'] & ITEM_OBSCURED) {
- $r[$x]['item_flags'] = $r[$x]['item_flags'] ^ ITEM_OBSCURED;
- if($r[$x]['title'])
- $r[$x]['title'] = crypto_unencapsulate(json_decode($r[$x]['title'],true),$key);
- if($r[$x]['body'])
- $r[$x]['body'] = crypto_unencapsulate(json_decode($r[$x]['body'],true),$key);
- }
- }
- $ret['item'] = $r;
+ $ret['item'] = array();
+ xchan_query($r);
+ $r = fetch_post_tags($r,true);
+ foreach($r as $rr)
+ $ret['item'][] = encode_item($rr,true);
+
}
return $ret;
diff --git a/include/items.php b/include/items.php
index beec65d8a..1fa833eb2 100755
--- a/include/items.php
+++ b/include/items.php
@@ -1007,8 +1007,7 @@ function import_author_unknown($x) {
}
-
-function encode_item($item) {
+function encode_item($item,$mirror = false) {
$x = array();
$x['type'] = 'activity';
$x['encoding'] = 'zot';
@@ -1030,14 +1029,37 @@ function encode_item($item) {
$c_scope = map_scope($comment_scope);
+ $key = get_config('system','prvkey');
+
if(array_key_exists('item_flags',$item) && ($item['item_flags'] & ITEM_OBSCURED)) {
- $key = get_config('system','prvkey');
if($item['title'])
$item['title'] = crypto_unencapsulate(json_decode_plus($item['title']),$key);
if($item['body'])
$item['body'] = crypto_unencapsulate(json_decode_plus($item['body']),$key);
}
+ // If we're trying to backup an item so that it's recoverable or for export/imprt,
+ // add all the attributes we need to recover it
+
+ if($mirror) {
+ $x['id'] = $item['id'];
+ $x['parent'] = $item['parent'];
+ $x['uid'] = $item['uid'];
+ $x['allow_cid'] = $item['allow_cid'];
+ $x['allow_gid'] = $item['allow_gid'];
+ $x['deny_cid'] = $item['deny_cid'];
+ $x['deny_gid'] = $item['deny_gid'];
+ $x['revision'] = $item['revision'];
+ $x['layout_mid'] = $item['layout_mid'];
+ $x['postopts'] = $item['postopts'];
+ $x['resource_id'] = $item['resource_id'];
+ $x['resource_type'] = $item['resource_type'];
+ $x['item_restrict'] = $item['item_restrict'];
+ $x['item_flags'] = $item['item_flags'];
+ $x['diaspora_meta'] = crypto_unencapsulate(json_decode($item['diaspora_meta'],true),$key);
+ $x['attach'] = $item['attach'];
+ }
+
$x['message_id'] = $item['mid'];
$x['message_top'] = $item['parent_mid'];
diff --git a/version.inc b/version.inc
index c3d994d3e..973190772 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2014-09-15.799
+2014-09-16.800
From 6a82ccecd08e84dff0f4e3198693823d7019c6d2 Mon Sep 17 00:00:00 2001
From: friendica
Date: Tue, 16 Sep 2014 05:14:06 -0700
Subject: [PATCH 14/32] when importing channels - use the new location
notification message to tell your original site where it sits in terms of
primary.
---
mod/import.php | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/mod/import.php b/mod/import.php
index 0663a8b57..2fbb71fc4 100644
--- a/mod/import.php
+++ b/mod/import.php
@@ -379,21 +379,17 @@ function import_post(&$a) {
//FIXME just a note here for when folks want to import content - be very careful to unset ITEM_ORIGIN on all imported content. Or you could end up with a nasty routing loop when somebody tries to reply to one of those posts.
-
-
-
// FIXME - ensure we have a self entry if somebody is trying to pull a fast one
- if($seize) {
- // notify old server that it is no longer primary.
-
- }
+ // send out refresh requests
+ // notify old server that it may no longer be primary.
+
+ proc_run('php','include/notifier.php','location',$channel['channel_id']);
// This will indirectly perform a refresh_all *and* update the directory
proc_run('php', 'include/directory.php', $channel['channel_id']);
- // send out refresh requests
notice( t('Import completed.') . EOL);
@@ -401,7 +397,6 @@ function import_post(&$a) {
goaway(z_root() . '/network' );
-
}
From b5bb2230ebd9648e30c79efed6ffe672a2ae19bf Mon Sep 17 00:00:00 2001
From: marijus
Date: Tue, 16 Sep 2014 14:18:03 +0200
Subject: [PATCH 15/32] this still has less issues
---
view/js/main.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/view/js/main.js b/view/js/main.js
index d6b405258..2e297c9d6 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -1114,7 +1114,7 @@ $(window).scroll(function () {
$('#more').show();
}
- if($(window).scrollTop() + $(window).height() == $(document).height()) {
+ if($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
if((pageHasMoreContent) && (! loadingPage)) {
$('#more').hide();
$('#no-more').hide();
@@ -1134,7 +1134,7 @@ $(window).scroll(function () {
$('#more').show();
}
- if($(window).scrollTop() + $(window).height() == $(document).height()) {
+ if($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
if((pageHasMoreContent) && (! loadingPage) && (! justifiedGalleryActive)) {
$('#more').hide();
$('#no-more').hide();
From 5bdfc2f64780abd36d889dc0bbe52026b768631b Mon Sep 17 00:00:00 2001
From: Alexandre Hannud Abdo
Date: Tue, 16 Sep 2014 18:56:34 -0300
Subject: [PATCH 16/32] Fix name attribute of button elements so jquery
'.submit()' doesn't break
According to "Additional notes" in:
http://api.jquery.com/submit/
Not fixing buttons created with 'input' tags.
---
view/tpl/comment_item.tpl | 2 +-
view/tpl/jot.tpl | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/view/tpl/comment_item.tpl b/view/tpl/comment_item.tpl
index 351cc8e14..e68314797 100755
--- a/view/tpl/comment_item.tpl
+++ b/view/tpl/comment_item.tpl
@@ -58,7 +58,7 @@
{{/if}}
-
+
diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl
index c4fdba0f5..c51dc02a5 100755
--- a/view/tpl/jot.tpl
+++ b/view/tpl/jot.tpl
@@ -85,7 +85,7 @@
{{/if}}
-
+
From c4608d4c827881b0f0fa5e2031de3fbd5b0568d7 Mon Sep 17 00:00:00 2001
From: friendica
Date: Tue, 16 Sep 2014 19:07:19 -0700
Subject: [PATCH 17/32] just mark dead hubloc deleted - don't remove them. This
could cause problems. Also clean up fetch_url/post_url header option
---
include/network.php | 15 ++++-----------
include/photos.php | 1 +
include/zot.php | 6 ++++--
3 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/include/network.php b/include/network.php
index 0191f203d..e84ea91f4 100644
--- a/include/network.php
+++ b/include/network.php
@@ -38,6 +38,7 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
return false;
@curl_setopt($ch, CURLOPT_HEADER, true);
+ @curl_setopt($ch, CURLINFO_HEADER_OUT, true);
@curl_setopt($ch, CURLOPT_CAINFO, get_capath());
@curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
@curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
@@ -47,11 +48,8 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
if($ciphers)
@curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers);
- if (x($opts,'accept_content')){
- @curl_setopt($ch,CURLOPT_HTTPHEADER, array (
- "Accept: " . $opts['accept_content']
- ));
- }
+ if(x($opts,'headers'))
+ @curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']);
if(x($opts,'timeout') && intval($opts['timeout'])) {
@curl_setopt($ch, CURLOPT_TIMEOUT, $opts['timeout']);
@@ -166,6 +164,7 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) {
return ret;
@curl_setopt($ch, CURLOPT_HEADER, true);
+ @curl_setopt($ch, CURLINFO_HEADER_OUT, true);
@curl_setopt($ch, CURLOPT_CAINFO, get_capath());
@curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
@curl_setopt($ch, CURLOPT_POST,1);
@@ -176,12 +175,6 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) {
if($ciphers)
@curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers);
-
- if (x($opts,'accept_content')){
- @curl_setopt($ch,CURLOPT_HTTPHEADER, array (
- "Accept: " . $opts['accept_content']
- ));
- }
if(x($opts,'headers'))
@curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']);
diff --git a/include/photos.php b/include/photos.php
index 06a99457a..badbbd791 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -266,6 +266,7 @@ function photo_upload($channel, $observer, $args) {
proc_run('php', "include/notifier.php", 'wall-new', $item_id);
$ret['success'] = true;
+ $ret['item'] = $arr;
$ret['body'] = $arr['body'];
$ret['resource_id'] = $photo_hash;
$ret['photoitem_id'] = $item_id;
diff --git a/include/zot.php b/include/zot.php
index add44e288..b7ffe14e4 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1844,8 +1844,10 @@ function sync_locations($sender,$arr,$absolute = false) {
if($absolute && $xisting) {
foreach($xisting as $x) {
if(! array_key_exists('updated',$x)) {
- logger('sync_locations: removing unreferenced hub location ' . $x['hubloc_url']);
- $r = q("delete from hubloc where hubloc_id = %d limit 1",
+ logger('sync_locations: deleting unreferenced hub location ' . $x['hubloc_url']);
+ $r = q("update hubloc set hubloc_flags = (hubloc_flags ^ %d), hubloc_updated = '%s' where hubloc_id = %d limit 1",
+ intval(HUBLOC_FLAGS_DELETED),
+ dbesc(datetime_convert()),
intval($x['hubloc_id'])
);
$what .= 'removed_hub';
From 53d0e855dfaeccfebd55d0b3c91cf040b2e317a4 Mon Sep 17 00:00:00 2001
From: friendica
Date: Tue, 16 Sep 2014 20:46:44 -0700
Subject: [PATCH 18/32] z_post_url_json() added to easily deal with JSON post
APIs; without getting content-type unknown warnings/errors. Also added a
debug option to z_get|post_url so you could track and log some of these nasty
little buggers.
---
include/network.php | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/include/network.php b/include/network.php
index e84ea91f4..7286f0b12 100644
--- a/include/network.php
+++ b/include/network.php
@@ -124,6 +124,10 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
}
$ret['body'] = substr($s,strlen($header));
$ret['header'] = $header;
+
+ if(x($opts,'debug')) {
+ $ret['debug'] = $curl_info;
+ }
@curl_close($ch);
return($ret);
@@ -251,11 +255,24 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) {
$ret['body'] = substr($s,strlen($header));
$ret['header'] = $header;
+
+ if(x($opts,'debug')) {
+ $ret['debug'] = $curl_info;
+ }
+
+
curl_close($ch);
return($ret);
}
+function z_post_url_json($url,$params,$redirects = 0, $opts = array()) {
+
+ $opts = array_merge($opts,array('headers' => array('Content-Type: application/json')));
+ return z_post_url($url,json_encode($params),$redirects,$opts);
+
+}
+
function json_return_and_die($x) {
header("content-type: application/json");
From 19e8d10b7a877618c9a2b97bf6be9fb2e80a4ea4 Mon Sep 17 00:00:00 2001
From: friendica
Date: Tue, 16 Sep 2014 21:08:34 -0700
Subject: [PATCH 19/32] still some old Friendica database queries in
diaspora_signed_retraction
---
include/diaspora.php | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/include/diaspora.php b/include/diaspora.php
index ea3c78bfe..3b6321643 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -2043,35 +2043,33 @@ function diaspora_signed_retraction($importer,$xml,$msg) {
}
if($type === 'StatusMessage' || $type === 'Comment' || $type === 'Like') {
- $r = q("select * from item where guid = '%s' and uid = %d and not file like '%%[%%' limit 1",
+ $r = q("select * from item where mid = '%s' and uid = %d limit 1",
dbesc($guid),
intval($importer['channel_id'])
);
- if(count($r)) {
- if(link_compare($r[0]['author-link'],$contact['url'])) {
- q("update item set `deleted` = 1, `edited` = '%s', `changed` = '%s', `body` = '' , `title` = '' where `id` = %d",
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- intval($r[0]['id'])
- );
+ if($r) {
+ if($r[0]['author_xchan'] == $contact['xchan_hash']) {
+
+ drop_item($r[0]['id'],false, DROPITEM_PHASE1);
// Now check if the retraction needs to be relayed by us
//
// The first item in the `item` table with the parent id is the parent. However, MySQL doesn't always
// return the items ordered by `item`.`id`, in which case the wrong item is chosen as the parent.
// The only item with `parent` and `id` as the parent id is the parent item.
- $p = q("select origin from item where parent = %d and id = %d limit 1",
+ $p = q("select item_flags from item where parent = %d and id = %d limit 1",
$r[0]['parent'],
$r[0]['parent']
);
- if(count($p)) {
- if(($p[0]['origin']) && (! $parent_author_signature)) {
- q("insert into sign (`retract_iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
- $r[0]['id'],
- dbesc($signed_data),
- dbesc($sig),
- dbesc($diaspora_handle)
- );
+ if($p) {
+ if(($p[0]['item_flags'] & ITEM_ORIGIN) && (! $parent_author_signature)) {
+// FIXME so we can relay this
+// q("insert into sign (`retract_iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
+// $r[0]['id'],
+// dbesc($signed_data),
+// dbesc($sig),
+// dbesc($diaspora_handle)
+// );
// the existence of parent_author_signature would have meant the parent_author or owner
// is already relaying.
From 0090cbf84b6679a72ac164dfb86a701ed0faa601 Mon Sep 17 00:00:00 2001
From: friendica
Date: Tue, 16 Sep 2014 22:26:52 -0700
Subject: [PATCH 20/32] that's why bb2diaspora_itemwallwall() wasn't doing its
thang.
---
include/bb2diaspora.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index 846725639..e60f72add 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -269,12 +269,12 @@ function bb2diaspora_itemwallwall(&$item) {
logger('bb2diaspora_itemwallwall: author: ' . print_r($item['author'],true), LOGGER_DEBUG);
}
- if(($item['mid'] == $item['parent_mid']) && ($item['author_xchan'] != $item['owner_xchan']) && (is_array($item['author'])) && $item['author']['url'] && $item['author']['name'] && $item['author']['photo']['src']) {
+ if(($item['mid'] == $item['parent_mid']) && ($item['author_xchan'] != $item['owner_xchan']) && (is_array($item['author'])) && $item['author']['xchan_url'] && $item['author']['xchan_name'] && $item['author']['xchan_photo_m']) {
logger('bb2diaspora_itemwallwall: wall to wall post',LOGGER_DEBUG);
// post will come across with the owner's identity. Throw a preamble onto the post to indicate the true author.
$item['body'] = "\n\n"
- . '[img]' . $item['author']['photo']['src'] . '[/img]'
- . '[url=' . $item['author']['url'] . ']' . $item['author']['name'] . '[/url]' . "\n\n"
+ . '[img]' . $item['author']['xchan_photo_m'] . '[/img]'
+ . '[url=' . $item['author']['xchan_url'] . ']' . $item['author']['xchan_name'] . '[/url]' . "\n\n"
. $item['body'];
}
}
From cd790447782c0a7deba56209afc2e6352e004743 Mon Sep 17 00:00:00 2001
From: friendica
Date: Tue, 16 Sep 2014 23:12:50 -0700
Subject: [PATCH 21/32] no sense maintaining 2 to-do files. I think the one I'm
removing is referenced online somewhere - which is why it wasn't done
earlier. Can't find it, so just note that somebody will complain and we'll
have to edit the pointer someday.
---
doc/To-Do-Code.md | 60 -----------------------------------------------
doc/To-Do.md | 23 ------------------
2 files changed, 83 deletions(-)
delete mode 100644 doc/To-Do-Code.md
delete mode 100644 doc/To-Do.md
diff --git a/doc/To-Do-Code.md b/doc/To-Do-Code.md
deleted file mode 100644
index bdbbc6cdf..000000000
--- a/doc/To-Do-Code.md
+++ /dev/null
@@ -1,60 +0,0 @@
-Project Code To-Do List
-=======================
-
-We need much more than this, but here are areas where developers can help. Please edit this page when items are finished. Another place for developers to start is with the issues list.
-
-* Documentation - see [Red Documentation Project To-Do List](help/To-Do)
-
-* Finish the anti-spam bayesian engine
-
-* Integrate the "open site" list with the register page
-
-* implement oembed provider interface
-
-* implement openid server interface
-
-* Write more webpage layouts
-
-* Write more webpage widgets
-
-* (Advanced) create a UI for building Comanche pages
-
-* External post connectors - create standard interface
-
-* External post connectors, add popular services
-
-* templatise and translate the Web interface to webDAV
-
-* Extend WebDAV to provide desktop access to photo albums
-
-* service classes - provide a pluggable subscription payment gateway for premium accounts
-
-* service classes - account overview page showing resources consumed by channel. With special consideration this page can also be accessed at a meta level by the site admin to drill down on problematic accounts/channels.
-
-* Events module - fix permissions on events, and provide JS translation support for the calendar overview; integrate with calDAV
-
-* Events module - event followups and RSVP
-
-
-* Uploads - integrate https://github.com/blueimp/jQuery-File-Upload
-
-* App taxonomy
-
-* replace the tinymce visual editor and/or make the visual editor pluggable and responsive to different output formats. We probably want library/bbedit for bbcode. This needs a fair bit of work to catch up with our "enhanced bbcode", but start with images, links, bold and highlight and work from there.
-
-* Photos module - turn photos into normal conversations and fix tagging
-
-* Provide RSS feed support which look like channels (in matrix only - copyright issues)
-
-* Create mobile clients for the top platforms - which involves extending the API so that we can do stuff far beyond the current crop of Twitter/Statusnet clients. Ditto for mobile themes. We can probably use something like the Friendica Android app as a base to start from.
-
-* Implement owned and exchangeable "things".
-
-* Family Account creation - using service classes (an account holder can create a certain number of sub-accounts which are all tied to their subscription - if the subscription lapses they all go away).
-
-* Put mod_admin under Comanche
-
-In many cases some of the work has already been started and code exists so that you needn't start from scratch. Please contact one of the developer channels like Channel One (one@zothub.com) before embarking and we can tell you what we already have and provide some insights on how we envision these features fitting together.
-
-
-
\ No newline at end of file
diff --git a/doc/To-Do.md b/doc/To-Do.md
deleted file mode 100644
index 76b78b6ac..000000000
--- a/doc/To-Do.md
+++ /dev/null
@@ -1,23 +0,0 @@
-Documentation we need to write
-==============================
-
-
-* Database schema detailed descriptions
-
-* Complete plugin hook documentation
-
-* API documentation
-
-* Function and code documentation (doxygen)
-
-* New Member guide
-
-* "Extra Feature" reference, description of each
-
-* Detailed Personal Settings Documentation
-
-* Administration Guide (post-install)
-
-* Administration Guide (pre-install)
-
-
From 401409357238183702c1628a02ccef6cf0394d72 Mon Sep 17 00:00:00 2001
From: friendica
Date: Wed, 17 Sep 2014 17:59:46 -0700
Subject: [PATCH 22/32] implement permission roles - the backend should be done
except for maybe a couple of small tweaks. Now we just need to define the
rest of the roles and create a chooser for them. Adam started on this some
time back but I don't know where that has gone.
---
doc/to_do_code.bb | 16 +++++++++++
include/follow.php | 13 +++++++++
include/identity.php | 61 +++++++++++++++++++++++++++++++++++------
include/permissions.php | 11 +++++---
mod/connedit.php | 22 +++++++++++++++
version.inc | 2 +-
view/js/mod_connedit.js | 13 +++++++--
7 files changed, 122 insertions(+), 16 deletions(-)
diff --git a/doc/to_do_code.bb b/doc/to_do_code.bb
index 91997a284..0005b4be3 100644
--- a/doc/to_do_code.bb
+++ b/doc/to_do_code.bb
@@ -4,6 +4,8 @@ We need much more than this, but here are areas where developers can help. Pleas
[li]Documentation - see Red Documentation Project To-Do List[/li]
+[li]Include TOS link in registration/verification email[/li]
+
[li]Finish the anti-spam bayesian engine[/li]
[li]If DAV folders exist, add an option to the Settings page to set a default folder for attachment uploads.[/li]
@@ -38,8 +40,22 @@ We need much more than this, but here are areas where developers can help. Pleas
[li]Uploads - integrate #^[url=https://github.com/blueimp/jQuery-File-Upload]https://github.com/blueimp/jQuery-File-Upload[/url][/li]
+[li]Import/export - include items, events, things, etc.[/li]
+
+[li]Import channel from Diaspora/Friendica[/li]
+
+[li]MediaGoblin photo "crosspost" connector[/li]
+
+[li]Create management page/UI for extensible profile fields[/li]
+
+[li]Create interface to include/exclude and re-order standard profile fields[/li]
+
+[li]Provide a mechanism to share page design elements in posts (just like apps)[/li]
+
[li]App taxonomy[/li]
+[li]Customisable App collection pages[/li]
+
[li]replace the tinymce visual editor and/or make the visual editor pluggable and responsive to different output formats. We probably want library/bbedit for bbcode. This needs a fair bit of work to catch up with our "enhanced bbcode", but start with images, links, bold and highlight and work from there.[/li]
[li]Photos module - turn photos into normal conversations and fix tagging[/li]
diff --git a/include/follow.php b/include/follow.php
index 18a9e66ea..3c1fcd890 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -63,6 +63,13 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
$my_perms = PERMS_W_STREAM|PERMS_W_MAIL;
+ $role = get_pconfig($uid,'system','permissions_role');
+ if($role) {
+ $x = get_role_perms($role);
+ if($x['perms_follow'])
+ $my_perms = $x['perms_follow'];
+ }
+
logger('follow: ' . $url . ' ' . print_r($j,true), LOGGER_DEBUG);
@@ -153,6 +160,12 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
$xchan_hash = $r[0]['xchan_hash'];
$their_perms = 0;
$my_perms = PERMS_W_STREAM|PERMS_W_MAIL;
+ $role = get_pconfig($uid,'system','permissions_role');
+ if($role) {
+ $x = get_role_perms($role);
+ if($x['perms_follow'])
+ $my_perms = $x['perms_follow'];
+ }
}
}
diff --git a/include/identity.php b/include/identity.php
index 2039738e0..38e96ab71 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -215,13 +215,31 @@ function create_identity($arr) {
if(array_key_exists('primary', $arr))
$primary = intval($arr['primary']);
+
$perms_sql = '';
- $defperms = site_default_perms();
- $global_perms = get_perms();
- foreach($defperms as $p => $v) {
- $perms_keys .= ', ' . $global_perms[$p][0];
- $perms_vals .= ', ' . intval($v);
+ $role_permissions = null;
+
+ 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_vals .= ', ' . intval($v);
+ }
+ if($p === 'directory_publish')
+ $publish = intval($v);
+ }
+ }
+ }
+ 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');
@@ -322,25 +340,52 @@ function create_identity($arr) {
dbesc($a->get_baseurl() . "/photo/profile/m/{$newuid}")
);
- $r = q("insert into abook ( abook_account, abook_channel, abook_xchan, abook_closeness, abook_created, abook_updated, abook_flags )
- values ( %d, %d, '%s', %d, '%s', '%s', %d ) ",
+ $myperms = 0;
+ if($role_permissions) {
+ $myperms = ((array_key_exists('perms_auto',$role_permissions) && $role_permissions['perms_auto']) ? intval($role_permissions['perms_accept']) : 0);
+ }
+
+ $r = q("insert into abook ( abook_account, abook_channel, abook_xchan, abook_closeness, abook_created, abook_updated, abook_flags, abook_my_perms )
+ values ( %d, %d, '%s', %d, '%s', '%s', %d, %d ) ",
intval($ret['channel']['channel_account_id']),
intval($newuid),
dbesc($hash),
intval(0),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
- intval(ABOOK_FLAG_SELF)
+ intval(ABOOK_FLAG_SELF),
+ intval($myperms)
);
if(intval($ret['channel']['channel_account_id'])) {
+ // Save our permissions role so we can perhaps call it up and modify it later.
+
+ if($role_permissions)
+ set_pconfig($newuid,'system','permissions_role',$arr['permissions_role']);
+
// Create a group with no members. 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'));
+ // if our role_permissions indicate that we're using a default collection ACL, add it.
+
+ if(is_array($role_permissions) && $role_permissions['default_collection']) {
+ $r = q("select hash from groups where uid = %d and name = '%s' limit 1",
+ intval($newuid),
+ dbesc( t('Friends') )
+ );
+ if($r) {
+ q("update channel set channel_allow_gid = '%s' where channel_id = %d limit 1",
+ dbesc('<' . $r[0]['hash'] . '>'),
+ intval($newuid)
+ );
+ }
+ }
+
+
call_hooks('register_account', $newuid);
proc_run('php','include/directory.php', $ret['channel']['channel_id']);
diff --git a/include/permissions.php b/include/permissions.php
index 8e4676f51..70c682cfc 100644
--- a/include/permissions.php
+++ b/include/permissions.php
@@ -419,11 +419,12 @@ function site_default_perms() {
*
* Given a string for the channel role ('social','forum', etc)
* return an array of all permission fields pre-filled for this role.
- * This includes the channel permission scope indicators as well as
- * perms_auto: The permissions to apply automatically on receipt of a connection request
+ * This includes the channel permission scope indicators (anything beginning with 'channel_') as well as
+ * perms_auto: true or false to create auto-permissions for this channel
* perms_follow: The permissions to apply when initiating a connection request to another channel
* perms_accept: The permissions to apply when accepting a connection request from another channel (not automatic)
- *
+ * default_collection: true or false to make the default ACL include the channel's default collection
+ * directory_publish: true or false to publish this channel in the directory
* Any attributes may be extended (new roles defined) and modified (specific permissions altered) by plugins
*
*/
@@ -436,7 +437,9 @@ function get_role_perms($role) {
switch($role) {
case 'social':
- $ret['perms_auto'] = 0;
+ $ret['perms_auto'] = false;
+ $ret['default_collection'] = false;
+ $ret['directory_publish'] = 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;
diff --git a/mod/connedit.php b/mod/connedit.php
index b2de42343..7ad719738 100644
--- a/mod/connedit.php
+++ b/mod/connedit.php
@@ -255,6 +255,28 @@ function connedit_content(&$a) {
return login();
}
+ $my_perms = 0;
+ $role = get_pconfig(local_user(),'system','permissions_role');
+ if($role) {
+ $x = get_role_perms($role);
+ if($x['perms_accept'])
+ $my_perms = $x['perms_accept'];
+ }
+ if($my_perms) {
+ $o .= "\n";
+ }
+
if(argc() == 3) {
$contact_id = intval(argv(1));
diff --git a/version.inc b/version.inc
index 973190772..1213afd33 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2014-09-16.800
+2014-09-17.801
diff --git a/view/js/mod_connedit.js b/view/js/mod_connedit.js
index 6231dbd0c..fabf24e95 100644
--- a/view/js/mod_connedit.js
+++ b/view/js/mod_connedit.js
@@ -6,11 +6,18 @@ function abook_perms_msg() {
}
$(document).ready(function() {
- if(typeof(after_following) !== 'undefined' && after_following)
- connectFullShare();
+ if(typeof(after_following) !== 'undefined' && after_following) {
+ if(typeof(connectDefaultShare) !== 'undefined')
+ connectDefaultShare();
+ else
+ connectFullShare();
+ }
$('#id_pending').click(function() {
- connectFullShare();
+ if(typeof(connectDefaultShare) !== 'undefined')
+ connectDefaultShare();
+ else
+ connectFullShare();
});
$('.abook-edit-me').click(function() {
From 618b93d42e54e0ecefb69d6e1acf24429d39785e Mon Sep 17 00:00:00 2001
From: friendica
Date: Wed, 17 Sep 2014 19:08:15 -0700
Subject: [PATCH 23/32] let the xchan diagnostic accept a webbie
---
mod/xchan.php | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/mod/xchan.php b/mod/xchan.php
index e51cc53cc..a4dc70550 100644
--- a/mod/xchan.php
+++ b/mod/xchan.php
@@ -7,7 +7,7 @@ function xchan_content(&$a) {
$o .= '
+
+
+ {{$role_select}}
+
+
+
From 22aa5aca14cce46727e15bd061cb6900a21b46b8 Mon Sep 17 00:00:00 2001
From: friendica
Date: Wed, 17 Sep 2014 21:27:02 -0700
Subject: [PATCH 27/32] add a spinner or two to the new channel page so folks
have a clue that we're doing something in the background - trying to complete
the nick field for them (and then check it before they submit).
---
view/js/mod_new_channel.js | 4 ++++
view/tpl/new_channel.tpl | 2 ++
2 files changed, 6 insertions(+)
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 b6562f707..b28810236 100755
--- a/view/tpl/new_channel.tpl
+++ b/view/tpl/new_channel.tpl
@@ -13,6 +13,7 @@
+
@@ -20,6 +21,7 @@
+
From c6062d7872e832c06ebc55fd249d1dacf0e264d1 Mon Sep 17 00:00:00 2001
From: friendica
Date: Wed, 17 Sep 2014 21:52:30 -0700
Subject: [PATCH 28/32] usability tweaks
---
include/identity.php | 8 ++++++--
include/permissions.php | 9 +++++++++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/include/identity.php b/include/identity.php
index ead785543..50c5d13b9 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -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 932ae897b..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;
@@ -532,6 +535,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_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
From 71672083450a8d5923c1839a1c766033203b3771 Mon Sep 17 00:00:00 2001
From: friendica
Date: Wed, 17 Sep 2014 22:30:25 -0700
Subject: [PATCH 29/32] forgot this one...
---
doc/to_do_code.bb | 2 ++
1 file changed, 2 insertions(+)
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]
From 8eb21cceb3a8274d8727073d03b8093f467ec852 Mon Sep 17 00:00:00 2001
From: friendica
Date: Wed, 17 Sep 2014 22:53:38 -0700
Subject: [PATCH 30/32] use 24-hour clock for non-American dates
---
view/en-gb/strings.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/view/en-gb/strings.php b/view/en-gb/strings.php
index abf14f43a..358c90d36 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"];
From 0deb592cb5a6562f36a2f52025a71d3a20fcae42 Mon Sep 17 00:00:00 2001
From: friendica
Date: Wed, 17 Sep 2014 22:55:27 -0700
Subject: [PATCH 31/32] typo
---
view/en-gb/strings.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/view/en-gb/strings.php b/view/en-gb/strings.php
index 358c90d36..a95915844 100644
--- a/view/en-gb/strings.php
+++ b/view/en-gb/strings.php
@@ -28,4 +28,4 @@ $a->strings["If your certificate is not recognized, members of other sites (who
$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"];
+$a->strings["D, d M Y - g:i A"] = "D, d M Y - G:i";
From 0b47fb9a91b58147e616ea75a23dea0d431c40f8 Mon Sep 17 00:00:00 2001
From: friendica
Date: Wed, 17 Sep 2014 22:59:56 -0700
Subject: [PATCH 32/32] keep the language consistent
---
mod/new_channel.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mod/new_channel.php b/mod/new_channel.php
index e70c64f23..8329f0ec3 100644
--- a/mod/new_channel.php
+++ b/mod/new_channel.php
@@ -116,7 +116,7 @@ function new_channel_content(&$a) {
'$label_import' => t('Or import an existing channel from another location'),
'$name' => $name,
'$label_role' => t('Channel Type'),
- '$help_role' => t('Please choose a channel role (such as social networking or community forum) and privacy requirements so we can select the best permissions for you'),
+ '$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')