aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addon/facebook/facebook.php51
-rw-r--r--boot.php8
-rw-r--r--doc/Home.md4
-rw-r--r--include/bbcode.php2
-rw-r--r--include/conversation.php3
-rw-r--r--include/items.php45
-rw-r--r--mod/network.php2
-rw-r--r--view/jot-header.tpl18
-rw-r--r--view/theme/duepuntozero/style.css2
9 files changed, 106 insertions, 29 deletions
diff --git a/addon/facebook/facebook.php b/addon/facebook/facebook.php
index c7821b272..8999561c8 100644
--- a/addon/facebook/facebook.php
+++ b/addon/facebook/facebook.php
@@ -379,18 +379,23 @@ function facebook_post_hook(&$a,&$b) {
$deny = array_unique(array_merge($deny_people,$deny_groups));
$allow_str = dbesc(implode(', ',$recipients));
- $r = q("SELECT `notify` FROM `contact` WHERE `id` IN ( $allow_str ) AND `network` = 'face'");
- $allow_arr = array();
- if(count($r))
- foreach($r as $rr)
- $allow_arr[] = $rr['notify'];
+ if($allow_str) {
+ $r = q("SELECT `notify` FROM `contact` WHERE `id` IN ( $allow_str ) AND `network` = 'face'");
+ $allow_arr = array();
+ if(count($r))
+ foreach($r as $rr)
+ $allow_arr[] = $rr['notify'];
+ }
$deny_str = dbesc(implode(', ',$deny));
- $r = q("SELECT `notify` FROM `contact` WHERE `id` IN ( $deny_str ) AND `network` = 'face'");
- $deny_arr = array();
- if(count($r))
- foreach($r as $rr)
- $deny_arr[] = $rr['notify'];
+ if($deny_str) {
+ $r = q("SELECT `notify` FROM `contact` WHERE `id` IN ( $deny_str ) AND `network` = 'face'");
+ $deny_arr = array();
+ if(count($r))
+ foreach($r as $rr)
+ $deny_arr[] = $rr['notify'];
+ }
+
if(count($deny_arr) && (! count($allow_arr))) {
// One or more FB folks were denied access but nobody on FB was specifically allowed access.
@@ -442,10 +447,22 @@ function facebook_post_hook(&$a,&$b) {
// make links readable before we strip the code
+ if(preg_match("/\[url=(.+?)\](.+?)\[\/url\]/is",$msg,$matches)) {
+
+ $link = $matches[1];
+ if(substr($matches[2],0,5) != '[img]' )
+ $linkname = $matches[2];
+ }
+
$msg = preg_replace("/\[url=(.+?)\](.+?)\[\/url\]/is",'$2 $1',$msg);
+ if(preg_match("/\[img\](.+?)\[\/img\]/is",$msg,$matches))
+ $image = $matches[1];
+
$msg = preg_replace("/\[img\](.+?)\[\/img\]/is", t('Image: ') . '$1', $msg);
+
+
$msg = trim(strip_tags(bbcode($msg)));
$msg = html_entity_decode($msg,ENT_QUOTES,'UTF-8');
@@ -478,6 +495,12 @@ function facebook_post_hook(&$a,&$b) {
'access_token' => $fb_token,
'message' => $msg
);
+ if(isset($image))
+ $postvars['picture'] = $image;
+ if(isset($link))
+ $postvars['link'] = $link;
+ if(isset($linkname))
+ $postvars['name'] = $linkname;
}
if(($b['private']) && (! $b['parent'])) {
@@ -490,17 +513,15 @@ function facebook_post_hook(&$a,&$b) {
}
- if(! $reply) {
- if($b['plink'])
- $postvars['actions'] = '{"name": "' . t('View on Friendika') . '", "link": "' . $b['plink'] . '"}';
- }
-
if($reply) {
$url = 'https://graph.facebook.com/' . $reply . '/' . (($likes) ? 'likes' : 'comments');
}
else {
$url = 'https://graph.facebook.com/me/feed';
+ if($b['plink'])
+ $postvars['actions'] = '{"name": "' . t('View on Friendika') . '", "link": "' . $b['plink'] . '"}';
}
+
logger('facebook: post to ' . $url);
logger('facebook: postvars: ' . print_r($postvars,true));
diff --git a/boot.php b/boot.php
index 4e2379469..719491d6b 100644
--- a/boot.php
+++ b/boot.php
@@ -2,7 +2,7 @@
set_time_limit(0);
-define ( 'FRIENDIKA_VERSION', '2.1.962' );
+define ( 'FRIENDIKA_VERSION', '2.1.966' );
define ( 'DFRN_PROTOCOL_VERSION', '2.21' );
define ( 'DB_UPDATE_VERSION', 1054 );
@@ -845,8 +845,10 @@ function login($register = false) {
$tpl = load_view_file("view/login.tpl");
}
-
- $o = replace_macros($tpl,array(
+
+ $o = '<script type="text/javascript"> $(document).ready(function() { $("#login-name").focus();} );</script>';
+
+ $o .= replace_macros($tpl,array(
'$logout' => t('Logout'),
'$register_html' => $register_html,
'$classname' => $classname,
diff --git a/doc/Home.md b/doc/Home.md
index 838e63065..cf4946f95 100644
--- a/doc/Home.md
+++ b/doc/Home.md
@@ -28,3 +28,7 @@ Friendika Documentation and Resources
* [Forums](http://groups.google.com/group/friendika)
* [Developer Forums](http://groups.google.com/group/friendika-dev)
+**About**
+
+* [Site/Version Info](friendika)
+
diff --git a/include/bbcode.php b/include/bbcode.php
index 6fadbaf7e..89a14988a 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -80,7 +80,7 @@ function bbcode($Text,$preserve_nl = false) {
// Images
// [img]pathtoimage[/img]
- $Text = preg_replace("/\[img\](.+?)\[\/img\]/", '<img src="$1">', $Text);
+ $Text = preg_replace("/\[img\](.+?)\[\/img\]/", '<img src="$1" alt="' . t('Image/photo') . '" />', $Text);
// html5 video and audio
diff --git a/include/conversation.php b/include/conversation.php
index b3e424e52..1558a5c41 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -687,6 +687,7 @@ function status_editor($a,$x) {
'$baseurl' => $a->get_baseurl(),
'$geotag' => $geotag,
'$nickname' => $x['nickname'],
+ '$ispublic' => t('Visible to <strong>everybody</strong>'),
'$linkurl' => t('Please enter a link URL:'),
'$utubeurl' => t('Please enter a YouTube link:'),
'$vidurl' => t("Please enter a video\x28.ogg\x29 link/URL:"),
@@ -745,7 +746,7 @@ function status_editor($a,$x) {
'$content' => '',
'$post_id' => '',
'$baseurl' => $a->get_baseurl(),
- '$defloc' => $x['default-location'],
+ '$defloc' => $x['default_location'],
'$visitor' => $x['visitor'],
'$emailcc' => t('CC: email addresses'),
'$jotnets' => $jotnets,
diff --git a/include/items.php b/include/items.php
index 733cd8048..c5ecac777 100644
--- a/include/items.php
+++ b/include/items.php
@@ -1496,10 +1496,17 @@ function atom_author($tag,$name,$uri,$h,$w,$photo) {
function atom_entry($item,$type,$author,$owner,$comment = false) {
+ $a = get_app();
+
if($item['deleted'])
return '<at:deleted-entry ref="' . xmlify($item['uri']) . '" when="' . xmlify(datetime_convert('UTC','UTC',$item['edited'] . '+00:00',ATOM_TIME)) . '" />' . "\r\n";
- $a = get_app();
+
+ if($item['allow_cid'] || $item['allow_gid'] || $item['deny_cid'] || $item['deny_gid'])
+ $body = fix_private_photos($item['body'],$owner['uid']);
+ else
+ $body = $item['body'];
+
$o = "\r\n\r\n<entry>\r\n";
@@ -1517,8 +1524,8 @@ function atom_entry($item,$type,$author,$owner,$comment = false) {
$o .= '<title>' . xmlify($item['title']) . '</title>' . "\r\n";
$o .= '<published>' . xmlify(datetime_convert('UTC','UTC',$item['created'] . '+00:00',ATOM_TIME)) . '</published>' . "\r\n";
$o .= '<updated>' . xmlify(datetime_convert('UTC','UTC',$item['edited'] . '+00:00',ATOM_TIME)) . '</updated>' . "\r\n";
- $o .= '<dfrn:env>' . base64url_encode($item['body'], true) . '</dfrn:env>' . "\r\n";
- $o .= '<content type="' . $type . '" >' . xmlify(($type === 'html') ? bbcode($item['body']) : $item['body']) . '</content>' . "\r\n";
+ $o .= '<dfrn:env>' . base64url_encode($body, true) . '</dfrn:env>' . "\r\n";
+ $o .= '<content type="' . $type . '" >' . xmlify(($type === 'html') ? bbcode($body) : $body) . '</content>' . "\r\n";
$o .= '<link rel="alternate" type="text/html" href="' . xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']) . '" />' . "\r\n";
if($comment)
$o .= '<dfrn:comment-allow>' . intval($item['last-child']) . '</dfrn:comment-allow>' . "\r\n";
@@ -1563,6 +1570,38 @@ function atom_entry($item,$type,$author,$owner,$comment = false) {
return $o;
}
+function fix_private_photos($s,$uid) {
+ $a = get_app();
+ logger('fix_private_photos');
+
+ if(preg_match("/\[img\](.+?)\[\/img\]/is",$s,$matches)) {
+ $image = $matches[1];
+ logger('fix_private_photos: found photo ' . $image);
+ if(stristr($image ,$a->get_baseurl() . '/photo/')) {
+ $i = basename($image);
+ $i = str_replace('.jpg','',$i);
+ $x = strpos($i,'-');
+ if($x) {
+ $res = substr($i,$x+1);
+ $i = substr($i,0,$x);
+ $r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `scale` = %d AND `uid` = %d",
+ dbesc($i),
+ intval($res),
+ intval($uid)
+ );
+ if(count($r)) {
+ logger('replacing photo');
+ $s = str_replace($image, 'data:image/jpg;base64,' . base64_encode($r[0]['data']), $s);
+ }
+ }
+ logger('fix_private_photos: replaced: ' . $s, LOGGER_DATA);
+ }
+ }
+ return($s);
+}
+
+
+
function item_getfeedtags($item) {
$ret = array();
$matches = false;
diff --git a/mod/network.php b/mod/network.php
index ae991e6ee..8846b8086 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -137,7 +137,7 @@ function network_content(&$a, $update = 0) {
notice( t('Group is empty'));
}
- $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` AND `contact-id` IN ( $contact_str )) ";
+ $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` AND ( `contact-id` IN ( $contact_str ) OR `allow_gid` REGEXP '<" . intval($group) . ">' )) ";
$o = '<h2>' . t('Group: ') . $r[0]['name'] . '</h2>' . $o;
}
elseif($cid) {
diff --git a/view/jot-header.tpl b/view/jot-header.tpl
index 0fdd30209..3b4c8c615 100644
--- a/view/jot-header.tpl
+++ b/view/jot-header.tpl
@@ -3,6 +3,7 @@
<script language="javascript" type="text/javascript">
var editor;
+var textlen = 0;
tinyMCE.init({
theme : "advanced",
@@ -29,23 +30,29 @@ tinyMCE.init({
//Character count
ed.onKeyUp.add(function(ed, e) {
var txt = tinyMCE.activeEditor.getContent();
- var text = txt.length;
- if(txt.length <= 140) {
+ textlen = txt.length;
+ if(textlen != 0 && $('#jot-perms-icon').is('.unlock')) {
+ $('#profile-jot-desc').html(ispublic);
+ }
+ else {
+ $('#profile-jot-desc').html('&nbsp;');
+ }
+ if(textlen <= 140) {
$('#character-counter').removeClass('red');
$('#character-counter').removeClass('orange');
$('#character-counter').addClass('grey');
}
- if((txt.length > 140) && (txt .length <= 420)) {
+ if((textlen > 140) && (textlen <= 420)) {
$('#character-counter').removeClass('grey');
$('#character-counter').removeClass('red');
$('#character-counter').addClass('orange');
}
- if(txt.length > 420) {
+ if(textlen > 420) {
$('#character-counter').removeClass('grey');
$('#character-counter').removeClass('orange');
$('#character-counter').addClass('red');
}
- $('#character-counter').text(text);
+ $('#character-counter').text(textlen);
});
ed.onInit.add(function(ed) {
@@ -58,6 +65,7 @@ tinyMCE.init({
</script>
<script type="text/javascript" src="include/ajaxupload.js" ></script>
<script>
+ var ispublic = '$ispublic';
$(document).ready(function() {
var uploader = new window.AjaxUpload(
'wall-image-upload',
diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css
index a23f72987..8ba548be8 100644
--- a/view/theme/duepuntozero/style.css
+++ b/view/theme/duepuntozero/style.css
@@ -1895,9 +1895,11 @@ a.mail-list-link {
#profile-jot-desc {
/*float: left;*/
width: 480px;
+ color: #FF0000;
margin-top: 10px;
margin-bottom: 10px;
}
+
#character-counter {
float: right;
font-size: 120%;