aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-03-11 19:35:23 -0700
committerfriendica <info@friendica.com>2015-03-11 19:35:23 -0700
commit64ae17aa6a1bdbc3933422272a391d4e3662f59b (patch)
treeb87f4c0866d9ecfa832d43b7e622e3100386a408
parenta40c19d19d31bba3fe037a9778c521461e2b0290 (diff)
parentb3a9a6c802170a15cc58fd3af966b35f81c50818 (diff)
downloadvolse-hubzilla-64ae17aa6a1bdbc3933422272a391d4e3662f59b.tar.gz
volse-hubzilla-64ae17aa6a1bdbc3933422272a391d4e3662f59b.tar.bz2
volse-hubzilla-64ae17aa6a1bdbc3933422272a391d4e3662f59b.zip
Merge branch 'master' into openid
-rw-r--r--doc/install/sample-nginx.conf5
-rw-r--r--include/ItemObject.php2
-rw-r--r--include/bbcode.php22
-rw-r--r--include/conversation.php5
-rwxr-xr-xinclude/diaspora.php6
-rwxr-xr-xinclude/oembed.php18
-rw-r--r--include/zot.php2
-rw-r--r--mod/editblock.php5
-rw-r--r--mod/editlayout.php5
-rw-r--r--mod/editpost.php5
-rw-r--r--mod/editwebpage.php5
-rw-r--r--mod/parse_url.php30
-rwxr-xr-xview/tpl/comment_item.tpl12
-rwxr-xr-xview/tpl/jot.tpl8
14 files changed, 105 insertions, 25 deletions
diff --git a/doc/install/sample-nginx.conf b/doc/install/sample-nginx.conf
index f533d8ee0..c1e5663a8 100644
--- a/doc/install/sample-nginx.conf
+++ b/doc/install/sample-nginx.conf
@@ -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
diff --git a/include/ItemObject.php b/include/ItemObject.php
index 1785d55e7..4fc01e6d4 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -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,
diff --git a/include/bbcode.php b/include/bbcode.php
index aa6641ca2..32e5d014f 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -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);
+ }
+
diff --git a/include/conversation.php b/include/conversation.php
index bc1883efc..0e35202fa 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -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'),
diff --git a/include/diaspora.php b/include/diaspora.php
index 7295b4261..da55b8fb6 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -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')) {
diff --git a/include/oembed.php b/include/oembed.php
index 38c433e99..0628afaa9 100755
--- a/include/oembed.php
+++ b/include/oembed.php
@@ -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;
diff --git a/include/zot.php b/include/zot.php
index c3325609b..5c12dc4ba 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -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),
diff --git a/mod/editblock.php b/mod/editblock.php
index 46126f94e..cacb5c27d 100644
--- a/mod/editblock.php
+++ b/mod/editblock.php
@@ -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'),
diff --git a/mod/editlayout.php b/mod/editlayout.php
index 847a64320..21607de8c 100644
--- a/mod/editlayout.php
+++ b/mod/editlayout.php
@@ -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'),
diff --git a/mod/editpost.php b/mod/editpost.php
index bdd3be450..edc5fa1b7 100644
--- a/mod/editpost.php
+++ b/mod/editpost.php
@@ -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'),
diff --git a/mod/editwebpage.php b/mod/editwebpage.php
index c07efc7ee..3e0bd9ff4 100644
--- a/mod/editwebpage.php
+++ b/mod/editwebpage.php
@@ -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'),
diff --git a/mod/parse_url.php b/mod/parse_url.php
index 49d5cae76..b6c0559f9 100644
--- a/mod/parse_url.php
+++ b/mod/parse_url.php
@@ -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) {
diff --git a/view/tpl/comment_item.tpl b/view/tpl/comment_item.tpl
index c9a3c451c..b62b31033 100755
--- a/view/tpl/comment_item.tpl
+++ b/view/tpl/comment_item.tpl
@@ -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>
diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl
index 05aa76d67..51ea8eedf 100755
--- a/view/tpl/jot.tpl
+++ b/view/tpl/jot.tpl
@@ -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>