From 115f9a4e4570caf53ee042be9690bb7342ee9e90 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 11 Mar 2015 21:31:50 +0100 Subject: [PATCH 1/7] update sample-nginx.conf redirect to check for args --- doc/install/sample-nginx.conf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 From 35fc14d6ab286a20bc8c510733c46cbd5f0d9676 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 11 Mar 2015 15:11:57 -0700 Subject: [PATCH 2/7] don't relay diaspora comments to sys channel --- include/diaspora.php | 6 ++++++ 1 file changed, 6 insertions(+) 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')) { From d6ce32ef7885579ba0503bc7a826ded2ddac4d71 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 11 Mar 2015 17:31:15 -0700 Subject: [PATCH 3/7] parse_url changes for oembed/zvideo/etc. --- mod/parse_url.php | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) 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 @@ 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) { From 4e98a70e66ccac9de891760219bf86eda3bb3d68 Mon Sep 17 00:00:00 2001 From: Michael Johnston Date: Wed, 11 Mar 2015 20:56:40 -0400 Subject: [PATCH 4/7] add missing %d for abook_closeness --- include/zot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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), From 1b3fee05e6db1fa80cd1a76395fa9e558e1e53c4 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 11 Mar 2015 18:04:43 -0700 Subject: [PATCH 5/7] turn parse_url into the definitive url attaching mechanism --- include/bbcode.php | 22 +++++++++++++++++++++- include/oembed.php | 16 ++++++++++++++-- 2 files changed, 35 insertions(+), 3 deletions(-) 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\]/", '$1', $Text); } + if (strpos($Text,'[/zvideo]') !== false) { + $Text = preg_replace("/\[zvideo\](.*?)\[\/zvideo\]/", '$1', $Text); + } + if (strpos($Text,'[/zaudio]') !== false) { + $Text = preg_replace("/\[zaudio\](.*?)\[\/zaudio\]/", '$1', $Text); + } + diff --git a/include/oembed.php b/include/oembed.php index 38c433e99..ea91ec22b 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); From d80088f6f6b2d976fc683fcc6db52d2d5ba2f092 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 11 Mar 2015 18:12:04 -0700 Subject: [PATCH 6/7] make embeds bookmarkable --- include/oembed.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/oembed.php b/include/oembed.php index ea91ec22b..0628afaa9 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -154,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 .= "$embedlink"; + $ret .= '#^' . "$embedlink"; $ret .= "
"; if (isset($j->author_name)) $ret.=" by ".$j->author_name; if (isset($j->provider_name)) $ret.=" on ".$j->provider_name; From b3a9a6c802170a15cc58fd3af966b35f81c50818 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 11 Mar 2015 18:56:28 -0700 Subject: [PATCH 7/7] remove the now redundant audio/video buttons and label the editor text style buttons which didn't have them. Unused editor buttons were commented in case we need to bring them back. If things go smoothly we can remove them. Use the link icon going forward - for all links. --- include/ItemObject.php | 2 +- include/conversation.php | 5 +++++ mod/editblock.php | 5 +++++ mod/editlayout.php | 5 +++++ mod/editpost.php | 5 +++++ mod/editwebpage.php | 5 +++++ view/tpl/comment_item.tpl | 12 ++++++------ view/tpl/jot.tpl | 8 ++++---- 8 files changed, 36 insertions(+), 11 deletions(-) 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/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/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/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 @@
- - 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 @@ -