Merge branch 'master' into openid

This commit is contained in:
friendica 2015-03-11 19:35:23 -07:00
commit 64ae17aa6a
14 changed files with 105 additions and 25 deletions

View File

@ -75,7 +75,10 @@ server {
# rewrite to front controller as default rule
location / {
rewrite ^/(.*) /index.php?q=$uri&$args last;
if ($is_args != "") {
rewrite ^/(.*) /index.php?q=$uri&$args last;
}
rewrite ^/(.*) /index.php?q=$uri last;
}
# make sure webfinger and other well known services aren't blocked

View File

@ -672,7 +672,7 @@ class Item extends BaseObject {
'$edquote' => t('Quote'),
'$edcode' => t('Code'),
'$edimg' => t('Image'),
'$edurl' => t('Link'),
'$edurl' => t('Insert Link'),
'$edvideo' => t('Video'),
'$preview' => t('Preview'), // ((feature_enabled($conv->get_profile_owner(),'preview')) ? t('Preview') : ''),
'$indent' => $indent,

View File

@ -756,11 +756,17 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
// html5 video and audio
if (strpos($Text,'[/video]') !== false) {
$Text = preg_replace_callback("/\[video\](.*?\.(ogg|ogv|oga|ogm|webm|mp4))\[\/video\]/ism", 'tryzrlvideo', $Text);
$Text = preg_replace_callback("/\[video\](.*?\.(ogg|ogv|oga|ogm|webm|mp4|mpeg|mpg))\[\/video\]/ism", 'tryzrlvideo', $Text);
}
if (strpos($Text,'[/audio]') !== false) {
$Text = preg_replace_callback("/\[audio\](.*?\.(ogg|ogv|oga|ogm|webm|mp4|mp3|opus))\[\/audio\]/ism", 'tryzrlaudio', $Text);
}
if (strpos($Text,'[/zvideo]') !== false) {
$Text = preg_replace_callback("/\[zvideo\](.*?\.(ogg|ogv|oga|ogm|webm|mp4|mpeg|mpg))\[\/zvideo\]/ism", 'tryzrlvideo', $Text);
}
if (strpos($Text,'[/zaudio]') !== false) {
$Text = preg_replace_callback("/\[zaudio\](.*?\.(ogg|ogv|oga|ogm|webm|mp4|mp3|opus))\[\/zaudio\]/ism", 'tryzrlaudio', $Text);
}
// Try to Oembed
if ($tryoembed) {
@ -771,6 +777,13 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
if (strpos($Text,'[/audio]') !== false) {
$Text = preg_replace_callback("/\[audio\](.*?)\[\/audio\]/ism", 'tryoembed', $Text);
}
if (strpos($Text,'[/zvideo]') !== false) {
$Text = preg_replace_callback("/\[zvideo\](.*?)\[\/zvideo\]/ism", 'tryoembed', $Text);
}
if (strpos($Text,'[/zaudio]') !== false) {
$Text = preg_replace_callback("/\[zaudio\](.*?)\[\/zaudio\]/ism", 'tryoembed', $Text);
}
}
// if video couldn't be embedded, link to it instead.
@ -781,6 +794,13 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) {
$Text = preg_replace("/\[audio\](.*?)\[\/audio\]/", '<a href="$1">$1</a>', $Text);
}
if (strpos($Text,'[/zvideo]') !== false) {
$Text = preg_replace("/\[zvideo\](.*?)\[\/zvideo\]/", '<a class="zid" href="$1">$1</a>', $Text);
}
if (strpos($Text,'[/zaudio]') !== false) {
$Text = preg_replace("/\[zaudio\](.*?)\[\/zaudio\]/", '<a class="zid" href="$1">$1</a>', $Text);
}

View File

@ -1173,6 +1173,11 @@ function status_editor($a, $x, $popup = false) {
'$id_select' => $id_select,
'$id_seltext' => t('Post as'),
'$writephoto' => perm_is_allowed($x['profile_uid'], get_observer_hash(), 'post_photos'),
'$bold' => t('Bold'),
'$italic' => t('Italic'),
'$underline' => t('Underline'),
'$quote' => t('Quote'),
'$code' => t('Code'),
'$upload' => t('Upload photo'),
'$shortupload' => t('upload photo'),
'$attach' => t('Attach file'),

View File

@ -1287,6 +1287,12 @@ function diaspora_comment($importer,$xml,$msg) {
// our post, so he/she must be a contact of ours and his/her public key
// should be in $msg['key']
if($importer['system']) {
// don't relay to the sys channel
logger('diaspora_comment: relay to sys channel blocked.');
return;
}
$author_signature = base64_decode($author_signature);
if(! rsa_verify($signed_data,$author_signature,$key,'sha256')) {

View File

@ -8,13 +8,25 @@ function oembed_replacecb($matches){
}
// if the url is embeddable with oembed, return the bbcode link.
function oembed_process($url) {
$j = oembed_fetch_url($url);
logger('oembed_process: ' . print_r($j,true));
if($j && $j->type !== 'error')
return '[embed]' . $url . '[/embed]';
return false;
}
function oembed_fetch_url($embedurl){
$a = get_app();
$txt = Cache::get($a->videowidth . $embedurl);
if(strstr($txt,'youtu')) {
if(strstr($txt,'youtu') && strstr(z_root(),'https:')) {
$txt = str_replace('http:','https:',$txt);
}
@ -105,7 +117,7 @@ function oembed_format_object($j){
$th=120; $tw = $th*$tr;
$tpl=get_markup_template('oembed_video.tpl');
if(strstr($embedurl,'youtu')) {
if(strstr($embedurl,'youtu') && strstr(z_root(),'https:')) {
$embedurl = str_replace('http:','https:',$embedurl);
$j->thumbnail_url = str_replace('http:','https:', $j->thumbnail_url);
$jhtml = str_replace('http:','https:', $jhtml);
@ -142,7 +154,7 @@ function oembed_format_object($j){
// add link to source if not present in "rich" type
if ( $j->type!='rich' || !strpos($j->html,$embedurl) ){
$embedlink = (isset($j->title))?$j->title:$embedurl;
$ret .= "<a href='$embedurl' rel='oembed'>$embedlink</a>";
$ret .= '<span class="bookmark-identifier">#^</span>' . "<a href='$embedurl' rel='oembed'>$embedlink</a>";
$ret .= "<br>";
if (isset($j->author_name)) $ret.=" by ".$j->author_name;
if (isset($j->provider_name)) $ret.=" on ".$j->provider_name;

View File

@ -469,7 +469,7 @@ function zot_refresh($them,$channel = null, $force = false) {
if($closeness === false)
$closeness = 80;
$y = q("insert into abook ( abook_account, abook_channel, abook_closeness, abook_xchan, abook_their_perms, abook_my_perms, abook_created, abook_updated, abook_dob, abook_flags ) values ( %d, %d, '%s', %d, %d, '%s', '%s', '%s', %d )",
$y = q("insert into abook ( abook_account, abook_channel, abook_closeness, abook_xchan, abook_their_perms, abook_my_perms, abook_created, abook_updated, abook_dob, abook_flags ) values ( %d, %d, %d, '%s', %d, %d, '%s', '%s', '%s', %d )",
intval($channel['channel_account_id']),
intval($channel['channel_id']),
intval($closeness),

View File

@ -141,6 +141,11 @@ function editblock_content(&$a) {
'$action' => 'item',
'$webpage' => ITEM_BUILDBLOCK,
'$share' => t('Edit'),
'$bold' => t('Bold'),
'$italic' => t('Italic'),
'$underline' => t('Underline'),
'$quote' => t('Quote'),
'$code' => t('Code'),
'$upload' => t('Upload photo'),
'$attach' => t('Attach file'),
'$weblink' => t('Insert web link'),

View File

@ -137,6 +137,11 @@ function editlayout_content(&$a) {
'$action' => 'item',
'$webpage' => ITEM_PDL,
'$share' => t('Edit'),
'$bold' => t('Bold'),
'$italic' => t('Italic'),
'$underline' => t('Underline'),
'$quote' => t('Quote'),
'$code' => t('Code'),
'$upload' => t('Upload photo'),
'$attach' => t('Attach file'),
'$weblink' => t('Insert web link'),

View File

@ -111,6 +111,11 @@ function editpost_content(&$a) {
'$return_path' => $_SESSION['return_url'],
'$action' => 'item',
'$share' => t('Edit'),
'$bold' => t('Bold'),
'$italic' => t('Italic'),
'$underline' => t('Underline'),
'$quote' => t('Quote'),
'$code' => t('Code'),
'$upload' => t('Upload photo'),
'$attach' => t('Attach file'),
'$weblink' => t('Insert web link'),

View File

@ -172,6 +172,11 @@ function editwebpage_content(&$a) {
'$action' => 'item',
'$share' => t('Edit'),
'$bold' => t('Bold'),
'$italic' => t('Italic'),
'$underline' => t('Underline'),
'$quote' => t('Quote'),
'$code' => t('Code'),
'$upload' => t('Upload photo'),
'$attach' => t('Attach file'),
'$weblink' => t('Insert web link'),

View File

@ -1,5 +1,6 @@
<?php
require_once('include/oembed.php');
/* To-Do
https://developers.google.com/+/plugins/snippet/
@ -250,6 +251,8 @@ function parse_url_content(&$a) {
}
}
logger('parse_url: ' . $url);
$result = z_fetch_url($url,false,0,array('novalidate' => true, 'nobody' => true));
if($result['success']) {
$hdrs=array();
@ -261,25 +264,31 @@ function parse_url_content(&$a) {
if (array_key_exists('Content-Type', $hdrs))
$type = $hdrs['Content-Type'];
if($type) {
if(in_array($type,array('image/jpeg','image/gif','image/png'))) {
$s = $br . '[img]' . $url . '[/img]' . $br;
$s = preg_replace_callback('/\[img(.*?)\](.*?)\[\/img\]/ism','red_zrlify_img_callback',$s);
echo $s;
$zrl = is_matrix_url($url);
if(stripos($type,'image/') !== false) {
if($zrl)
echo $br . '[zmg]' . $url . '[/zmg]' . $br;
else
echo $br . '[img]' . $url . '[/img]' . $br;
killme();
}
if(stripos($type,'video/') !== false) {
echo $br . '[video]' . $url . '[/video]' . $br;
if($zrl)
echo $br . '[zvideo]' . $url . '[/zvideo]' . $br;
else
echo $br . '[video]' . $url . '[/video]' . $br;
killme();
}
if(stripos($type,'audio/') !== false) {
echo $br . '[audio]' . $url . '[/audio]' . $br;
if($zrl)
echo $br . '[zaudio]' . $url . '[/zaudio]' . $br;
else
echo $br . '[audio]' . $url . '[/audio]' . $br;
killme();
}
}
}
logger('parse_url: ' . $url);
$template = $br . '#^[url=%s]%s[/url]%s' . $br;
$arr = array('url' => $url, 'text' => '');
@ -291,6 +300,11 @@ function parse_url_content(&$a) {
killme();
}
$x = oembed_process($url);
if($x) {
echo $x;
killme();
}
if($url && $title && $text) {

View File

@ -40,18 +40,18 @@
</button>
</div>
<div class='btn-group'>
<button class="btn btn-default btn-xs" title="{{$edimg}}" onclick="insertbbcomment('{{$comment}}','img', {{$id}}); return false;">
<!--button class="btn btn-default btn-xs" title="{{$edimg}}" onclick="insertbbcomment('{{$comment}}','img', {{$id}}); return false;">
<i class="icon-camera comment-icon"></i>
</button>
</button-->
<button class="btn btn-default btn-xs" title="{{$edurl}}" onclick="insertCommentURL('{{$comment}}',{{$id}}); return false;">
<i class="icon-link comment-icon"></i>
</button>
<button class="btn btn-default btn-xs" title="{{$edvideo}}" onclick="insertbbcomment('{{$comment}}','video', {{$id}}); return false;">
<!--button class="btn btn-default btn-xs" title="{{$edvideo}}" onclick="insertbbcomment('{{$comment}}','video', {{$id}}); return false;">
<i class="icon-facetime-video comment-icon"></i>
</button>
</div>
</button-->
<!--/div-->
{{if $feature_encrypt}}
<div class='btn-group'>
<!--div class='btn-group'-->
<button class="btn btn-default btn-xs" title="{{$encrypt}}" onclick="red_encrypt('{{$cipher}}','#comment-edit-text-' + '{{$id}}',''); return false;">
<i class="icon-key comment-icon"></i>
</button>

View File

@ -68,12 +68,12 @@
<button id="profile-link-wrapper" class="btn btn-default btn-sm" title="{{$weblink}}" ondragenter="linkdropper(event);" ondragover="linkdropper(event);" ondrop="linkdrop(event);" onclick="jotGetLink(); return false;">
<i id="profile-link" class="icon-link jot-icons"></i>
</button>
<button id="profile-video-wrapper" class="btn btn-default btn-sm" title="{{$video}}" onclick="jotVideoURL();return false;">
<!--button id="profile-video-wrapper" class="btn btn-default btn-sm" title="{{$video}}" onclick="jotVideoURL();return false;">
<i id="profile-video" class="icon-facetime-video jot-icons"></i>
</button>
<button id="profile-audio-wrapper" class="btn btn-default btn-sm" title="{{$audio}}" onclick="jotAudioURL();return false;">
<i id="profile-audio" class="icon-volume-up jot-icons"></i>
</button>
</button -->
</div>
<div class="btn-group hidden-xs hidden-sm">
<button id="profile-location-wrapper" class="btn btn-default btn-sm" title="{{$setloc}}" onclick="jotGetLocation();return false;">
@ -114,8 +114,8 @@
{{if $writephoto}}<li class="visible-xs"><a id="wall-image-upload-sub" href="#" ><i class="icon-camera"></i>&nbsp;{{$upload}}</a></li>{{/if}}
<li class="visible-xs"><a id="wall-file-upload-sub" href="#" ><i class="icon-paper-clip"></i>&nbsp;{{$attach}}</a></li>
<li class="visible-xs"><a href="#" onclick="jotGetLink(); return false;"><i class="icon-link"></i>&nbsp;{{$weblink}}</a></li>
<li class="visible-xs"><a href="#" onclick="jotVideoURL(); return false;"><i class="icon-facetime-video"></i>&nbsp;{{$video}}</a></li>
<li class="visible-xs"><a href="#" onclick="jotAudioURL(); return false;"><i class="icon-volume-up"></i>&nbsp;{{$audio}}</a></li>
<!--li class="visible-xs"><a href="#" onclick="jotVideoURL(); return false;"><i class="icon-facetime-video"></i>&nbsp;{{$video}}</a></li-->
<!--li class="visible-xs"><a href="#" onclick="jotAudioURL(); return false;"><i class="icon-volume-up"></i>&nbsp;{{$audio}}</a></li-->
{{/if}}
<li class="divider visible-xs"></li>
<li class="visible-xs visible-sm"><a href="#" onclick="jotGetLocation(); return false;"><i class="icon-globe"></i>&nbsp;{{$setloc}}</a></li>