aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addon/facebook/facebook.php29
-rw-r--r--include/acl.js18
-rw-r--r--include/bb2diaspora.php6
-rw-r--r--include/bbcode.php5
-rw-r--r--include/text.php3
-rw-r--r--mod/events.php9
-rw-r--r--mod/localtime.php9
-rw-r--r--mod/profile_photo.php8
8 files changed, 69 insertions, 18 deletions
diff --git a/addon/facebook/facebook.php b/addon/facebook/facebook.php
index 10f6b1399..fe348f689 100644
--- a/addon/facebook/facebook.php
+++ b/addon/facebook/facebook.php
@@ -111,7 +111,8 @@ function facebook_init(&$a) {
$token = substr($token,0,strpos($token,'&'));
set_pconfig($uid,'facebook','access_token',$token);
set_pconfig($uid,'facebook','post','1');
- set_pconfig($uid,'facebook','no_linking',1);
+ if(get_pconfig($uid,'facebook','no_linking') === false)
+ set_pconfig($uid,'facebook','no_linking',1);
fb_get_self($uid);
fb_get_friends($uid);
fb_consume_all($uid);
@@ -275,6 +276,9 @@ function facebook_post(&$a) {
$no_wall = ((x($_POST,'facebook_no_wall')) ? intval($_POST['facebook_no_wall']) : 0);
set_pconfig($uid,'facebook','no_wall',$no_wall);
+
+ $private_wall = ((x($_POST,'facebook_private_wall')) ? intval($_POST['facebook_private_wall']) : 0);
+ set_pconfig($uid,'facebook','private_wall',$private_wall);
$linkvalue = ((x($_POST,'facebook_linking')) ? intval($_POST['facebook_linking']) : 0);
@@ -352,6 +356,12 @@ function facebook_content(&$a) {
$o .= '<div id="facebook-disable-wrapper">';
$o .= '<a href="' . $a->get_baseurl() . '/facebook/remove' . '">' . t('Remove Facebook connector') . '</a></div>';
+
+ $o .= '<div id="facebook-enable-wrapper">';
+
+ $o .= '<a href="https://www.facebook.com/dialog/oauth?client_id=' . $appid . '&redirect_uri='
+ . $a->get_baseurl() . '/facebook/' . $a->user['nickname'] . '&scope=publish_stream,read_stream,offline_access">' . t('Re-authenticate [This is necessary whenever your Facebook password is changed.]') . '</a>';
+ $o .= '</div>';
$o .= '<div id="facebook-post-default-form">';
$o .= '<form action="facebook" method="post" >';
@@ -361,12 +371,22 @@ function facebook_content(&$a) {
$no_linking = get_pconfig(local_user(),'facebook','no_linking');
$checked = (($no_linking) ? '' : ' checked="checked" ');
- $o .= '<input type="checkbox" name="facebook_linking" value="1"' . $checked . '/>' . ' ' . t('Link all your Facebook friends and conversations') . EOL ;
+ $o .= '<input type="checkbox" name="facebook_linking" value="1"' . $checked . '/>' . ' ' . t('Link all your Facebook friends and conversations on this website') . EOL ;
+
+ $o .= '<p>' . t('Facebook conversations consist of your <em>profile wall</em> and your friend <em>stream</em>.');
+ $o .= ' ' . t('On this website, your Facebook friend stream is only visible to you.');
+ $o .= ' ' . t('The following settings determine the privacy of your Facebook profile wall on this website.') . '</p>';
+
+ $private_wall = get_pconfig(local_user(),'facebook','private_wall');
+ $checked = (($private_wall) ? ' checked="checked" ' : '');
+ $o .= '<input type="checkbox" name="facebook_private_wall" value="1"' . $checked . '/>' . ' ' . t('On this website your Facebook profile wall conversations will only be visible to you') . EOL ;
+
$no_wall = get_pconfig(local_user(),'facebook','no_wall');
$checked = (($no_wall) ? ' checked="checked" ' : '');
- $o .= '<input type="checkbox" name="facebook_no_wall" value="1"' . $checked . '/>' . ' ' . t('Do not link your Facebook profile wall posts - as these could be visible to people that would not be able to see them on Facebook.') . EOL ;
+ $o .= '<input type="checkbox" name="facebook_no_wall" value="1"' . $checked . '/>' . ' ' . t('Do not import your Facebook profile wall conversations') . EOL ;
+ $o .= '<p>' . t('If you choose to link conversations and leave both of these boxes unchecked, your Facebook profile wall will be merged with your profile wall on this website and your privacy settings on this website will be used to determine who may see the conversations.') . '</p>';
$o .= '<input type="submit" name="submit" value="' . t('Submit') . '" /></form></div>';
}
@@ -770,11 +790,12 @@ function fb_consume_all($uid) {
return;
if(! get_pconfig($uid,'facebook','no_wall')) {
+ $private_wall = intval(get_pconfig($uid,'facebook','private_wall'));
$s = fetch_url('https://graph.facebook.com/me/feed?access_token=' . $access_token);
if($s) {
$j = json_decode($s);
logger('fb_consume_stream: wall: ' . print_r($j,true), LOGGER_DATA);
- fb_consume_stream($uid,$j,true);
+ fb_consume_stream($uid,$j,($private_wall) ? false : true);
}
}
$s = fetch_url('https://graph.facebook.com/me/home?access_token=' . $access_token);
diff --git a/include/acl.js b/include/acl.js
index 82b631ee9..ba6c6af73 100644
--- a/include/acl.js
+++ b/include/acl.js
@@ -58,7 +58,9 @@ ACL.prototype.on_search = function(event){
}
ACL.prototype.on_showall = function(event){
+ event.preventDefault()
event.stopPropagation();
+
if (that.showall.hasClass("selected")){
return false;
}
@@ -69,12 +71,14 @@ ACL.prototype.on_showall = function(event){
that.deny_cid = [];
that.deny_gid = [];
- that.updateview();
+ that.update_view();
return false;
}
ACL.prototype.on_button_show = function(event){
+ event.preventDefault()
+ event.stopImmediatePropagation()
event.stopPropagation();
/*that.showall.removeClass("selected");
@@ -86,6 +90,8 @@ ACL.prototype.on_button_show = function(event){
return false;
}
ACL.prototype.on_button_hide = function(event){
+ event.preventDefault()
+ event.stopImmediatePropagation()
event.stopPropagation();
/*that.showall.removeClass("selected");
@@ -118,7 +124,7 @@ ACL.prototype.set_allow = function(itemid){
if (that.deny_cid.indexOf(id)>=0) that.deny_cid.remove(id);
break;
}
- that.updateview();
+ that.update_view();
}
ACL.prototype.set_deny = function(itemid){
@@ -142,10 +148,10 @@ ACL.prototype.set_deny = function(itemid){
if (that.allow_cid.indexOf(id)>=0) that.allow_cid.remove(id);
break;
}
- that.updateview();
+ that.update_view();
}
-ACL.prototype.updateview = function(){
+ACL.prototype.update_view = function(){
if (that.allow_gid.length==0 && that.allow_cid.length==0 &&
that.deny_gid.length==0 && that.deny_cid.length==0){
that.showall.addClass("selected");
@@ -153,7 +159,7 @@ ACL.prototype.updateview = function(){
$('#jot-perms-icon').removeClass('lock').addClass('unlock');
$('#jot-public').show();
$('.profile-jot-net input').attr('disabled', false);
- if(editor != false) {
+ if(typeof editor != 'undefined' && editor != false) {
$('#profile-jot-desc').html(ispublic);
}
@@ -235,6 +241,6 @@ ACL.prototype.populate = function(data){
//console.log(html);
that.list_content.append(html);
});
- that.updateview();
+ that.update_view();
}
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index 591aaf7fa..5b240bdd2 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -42,6 +42,8 @@ function stripdcode_br_cb($s) {
function bb2diaspora($Text,$preserve_nl = false) {
+ $ev = bbtoevent($Text);
+
// Replace any html brackets with HTML Entities to prevent executing HTML or script
// Don't use strip_tags here because it breaks [url] search by replacing & with amp
@@ -52,7 +54,6 @@ function bb2diaspora($Text,$preserve_nl = false) {
// After we're finished processing the bbcode we'll
// replace all of the event code with a reformatted version.
- $ev = bbtoevent($Text);
if($preserve_nl)
$Text = str_replace(array("\n","\r"), array('',''),$Text);
@@ -185,7 +186,10 @@ function bb2diaspora($Text,$preserve_nl = false) {
$Text = preg_replace("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",'',$Text);
}
+ $Text = preg_replace("/\<(.*?)(src|href)=(.*?)\&amp\;(.*?)\>/ism",'<$1$2=$3&$4>',$Text);
+ $Text = preg_replace('/\[(.*?)\\\\_(.*?)\]\((.*?)\)/ism','[$1_$2]($3)',$Text);
+ $Text = preg_replace('/\[(.*?)\\\\\*(.*?)\]\((.*?)\)/ism','[$1*$2]($3)',$Text);
call_hooks('bb2diaspora',$Text);
diff --git a/include/bbcode.php b/include/bbcode.php
index af6c10c44..3886af37d 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -43,7 +43,7 @@ function bbcode($Text,$preserve_nl = false) {
// Perform URL Search
- $Text = preg_replace("/([^\]\=]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\%\$\!\+\,]+)/", '$1<a href="$2" target="external-link">$2</a>', $Text);
+ $Text = preg_replace("/([^\]\=]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/", '$1<a href="$2" target="external-link">$2</a>', $Text);
$Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/m", '<a href="$1" target="external-link">$1</a>', $Text);
$Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/m", '<a href="$1" target="external-link">$2</a>', $Text);
@@ -159,7 +159,8 @@ function bbcode($Text,$preserve_nl = false) {
$Text = preg_replace("/\[event\-adjust\](.*?)\[\/event\-adjust\]/ism",'',$Text);
}
-
+ // fix any escaped ampersands that may have been converted into links
+ $Text = preg_replace("/\<(.*?)(src|href)=(.*?)\&amp\;(.*?)\>/ism",'<$1$2=$3&$4>',$Text);
call_hooks('bbcode',$Text);
diff --git a/include/text.php b/include/text.php
index 2d65b681d..501121c80 100644
--- a/include/text.php
+++ b/include/text.php
@@ -635,7 +635,8 @@ function valid_email($x){
if(! function_exists('linkify')) {
function linkify($s) {
- $s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\.\=\_\~\#\'\%\$\!\+]*)/", ' <a href="$1" target="external-link">$1</a>', $s);
+ $s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\'\%\$\!\+]*)/", ' <a href="$1" target="external-link">$1</a>', $s);
+ $s = preg_replace("/\<(.*?)(src|href)=(.*?)\&amp\;(.*?)\>/ism",'<$1$2=$3&$4>',$s);
return($s);
}}
diff --git a/mod/events.php b/mod/events.php
index 27ca69830..5bc9807ed 100644
--- a/mod/events.php
+++ b/mod/events.php
@@ -45,13 +45,20 @@ function events_post(&$a) {
$finish = datetime_convert('UTC','UTC',$finish);
}
+ // Don't allow the event to finish before it begins.
+ // It won't hurt anything, but somebody will file a bug report
+ // and we'll waste a bunch of time responding to it. Time that
+ // could've been spent doing something else.
+
+ if(strcmp($finish,$start) < 0)
+ $finish = $start;
$desc = escape_tags(trim($_POST['desc']));
$location = escape_tags(trim($_POST['location']));
$type = 'event';
if((! $desc) || (! $start)) {
- notice('Event description and start time are required.');
+ notice( t('Event description and start time are required.') . EOL);
goaway($a->get_baseurl() . '/events/new');
}
diff --git a/mod/localtime.php b/mod/localtime.php
index f5ecf3a96..c03eae1b0 100644
--- a/mod/localtime.php
+++ b/mod/localtime.php
@@ -26,16 +26,21 @@ function localtime_content(&$a) {
$o .= '<p>' . t('Friendika provides this service for sharing events with other networks and friends in unknown timezones.') . '</p>';
+
+ $o .= '<p>' . sprintf( t('UTC time: %s'), $t) . '</p>';
+
+ if($_REQUEST['timezone'])
+ $o .= '<p>' . sprintf( t('Current timezone: %s'), $_REQUEST['timezone']) . '</p>';
+
if(x($a->data,'mod-localtime'))
$o .= '<p>' . sprintf( t('Converted localtime: %s'),$a->data['mod-localtime']) . '</p>';
- $o .= '<p>' . sprintf( t('UTC time: %s'), $t) . '</p>';
$o .= '<form action ="' . $a->get_baseurl() . '/localtime?f=&time=' . $t . '" method="post" >';
$o .= '<p>' . t('Please select your timezone:') . '</p>';
- $o .= select_timezone();
+ $o .= select_timezone(($_REQUEST['timezone']) ? $_REQUEST['timezone'] : 'America/Los_Angeles');
$o .= '<input type="submit" name="submit" value="' . t('Submit') . '" /></form>';
diff --git a/mod/profile_photo.php b/mod/profile_photo.php
index 8dc896653..4de3aaa3e 100644
--- a/mod/profile_photo.php
+++ b/mod/profile_photo.php
@@ -155,9 +155,15 @@ function profile_photo_content(&$a) {
notice( t('Permission denied.') . EOL );
return;
}
+ $havescale = false;
+ foreach($r as $rr) {
+ if($rr['scale'] == 5)
+ $havescale = true;
+ }
+
// set an already uloaded photo as profile photo
// if photo is in 'Profile Photos', change it in db
- if ($r[0]['album']== t('Profile Photos')){
+ if (($r[0]['album']== t('Profile Photos')) && ($havescale)){
$r=q("UPDATE `photo` SET `profile`=0 WHERE `profile`=1 AND `uid`=%d",
intval(local_user()));