{{foreach $files as $f}}
@@ -59,7 +63,7 @@
{{* This part contains the conent loader icon which is visible when new conent is loaded *}} - diff --git a/view/theme/frio/templates/jot.tpl b/view/theme/frio/templates/jot.tpl index 2ebd1c1ddc..2258a6f4f0 100644 --- a/view/theme/frio/templates/jot.tpl +++ b/view/theme/frio/templates/jot.tpl @@ -9,7 +9,7 @@ {{* Note: We need 2 modal close buttons here to bypass a bug in bootstrap. The second is for mobile view. The first one doesnt work with dropdowns. To get a working close button in with dropdows the close button needs to be inserted after the dropdown. *}} - + {{* The Jot navigation menu for desktop user (text input, permissions, preview, filebrowser) *}} ', $Text); + //$Text = str_replace('
', '', $Text); + //$Text = str_replace('
  • ', '
  • ', $Text); + //$Text = str_replace('
    From b0accf4d4c674799ae210fce012dd0f31834717e Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 6 Apr 2017 23:49:56 -0400 Subject: [PATCH 25/32] Fix code blocks to Diaspora - Extracts code blocks before BBCode conversion to prevent code highlighting and whitespace meddling - Use the improved HTLM To Markdown library - Use instead of for Diaspora inline code blocks --- include/bb2diaspora.php | 40 +++++++++++++++++++++++++++++++--- include/bbcode.php | 48 ++++++++++++++++++++++++++++++----------- 2 files changed, 73 insertions(+), 15 deletions(-) diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 5a60cd945a..cef293c766 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -105,8 +105,18 @@ function diaspora_mentions($match) { return $mention; } -function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) { - +/** + * @brief Converts a BBCode text into Markdown + * + * This function converts a BBCode item body to be sent to Markdown-enabled + * systems like Diaspora and Libertree + * + * @param string $Text + * @param bool $preserve_nl Effects unclear, unused in Friendica + * @param bool $fordiaspora Diaspora requires more changes than Libertree + * @return string + */ +function bb2diaspora($Text, $preserve_nl = false, $fordiaspora = true) { $a = get_app(); $OriginalText = $Text; @@ -129,6 +139,18 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) { // Converting images with size parameters to simple images. Markdown doesn't know it. $Text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $Text); + // Extracting multi-line code blocks before the whitespace processing/code highlighter in bbcode() + $codeblocks = []; + $Text = preg_replace_callback('#\[code(?:=([^\]]*))?\](?=\n)(.*?)\[\/code\]#is', + function ($matches) use (&$codeblocks) { + $return = '#codeblock-' . count($codeblocks) . '#'; + + $prefix = '````' . $matches[1] . PHP_EOL; + $codeblocks[] = $prefix . trim($matches[2]) . PHP_EOL . '````'; + return $return; + } + , $Text); + // Convert it to HTML - don't try oembed if ($fordiaspora) { $Text = bbcode($Text, $preserve_nl, false, 3); @@ -158,7 +180,8 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) { $stamp1 = microtime(true); // Now convert HTML to Markdown - $Text = new HTML_To_Markdown($Text); + $converter = new HtmlConverter(); + $Text = $converter->convert($Text); // unmask the special chars back to HTML $Text = str_replace(array('&_lt_;', '&_gt_;', '&_amp_;'), array('<', '>', '&'), $Text); @@ -177,6 +200,17 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) { $Text = preg_replace_callback("/([@]\[(.*?)\])\(([$URLSearchString]*?)\)/ism", 'diaspora_mentions', $Text); } + // Restore code blocks + $Text = preg_replace_callback('/#codeblock-([0-9]+)#/iU', + function ($matches) use ($codeblocks) { + $return = ''; + if (isset($codeblocks[intval($matches[1])])) { + $return = $codeblocks[$matches[1]]; + } + return $return; + } + , $Text); + call_hooks('bb2diaspora',$Text); return $Text; diff --git a/include/bbcode.php b/include/bbcode.php index f73f586d34..fd380edc99 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -159,13 +159,6 @@ function stripcode_br_cb($s) { return '[code]' . str_replace('
    ', '', $s[1]) . '[/code]'; } -function bb_onelinecode_cb($match) { - if (strpos($match[1],"
    ")===false){ - return "".$match[1].""; - } - return "".$match[1].""; -} - function tryoembed($match) { $url = $match[1]; @@ -729,9 +722,31 @@ function bb_highlight($match) { return $match[0]; } - // BBcode 2 HTML was written by WAY2WEB.net - // extended to work with Mistpark/Friendica - Mike Macgirvin - +/** + * @brief Converts a BBCode message to HTML message + * + * BBcode 2 HTML was written by WAY2WEB.net + * extended to work with Mistpark/Friendica - Mike Macgirvin + * + * Simple HTML values meaning: + * - 0: Friendica display + * - 1: Unused + * - 2: Used for Facebook, Google+, Windows Phone push, Friendica API + * - 3: Used before converting to Markdown in bb2diaspora.php + * - 4: Used for WordPress, Libertree (before Markdown), pump.io and tumblr + * - 5: Unused + * - 6: Used for Appnet + * - 7: Used for dfrn, OStatus + * - 8: Used for WP backlink text setting + * + * @staticvar array $allowed_src_protocols + * @param string $Text + * @param bool $preserve_nl + * @param bool $tryoembed + * @param int $simplehtml + * @param bool $forplaintext + * @return string + */ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = false, $forplaintext = false) { $a = get_app(); @@ -1158,8 +1173,17 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa } - //replace oneliner with - $Text = preg_replace_callback("|(?!]*>)([^<]*)(?!]*>)|ism", 'bb_onelinecode_cb', $Text); + // Replace inline code blocks + $Text = preg_replace_callback("|(?!]*>)([^<]*)(?!]*>)|ism", + function ($match) use ($simplehtml) { + $return = '' . $match[1] . ''; + // Use for Diaspora inline code blocks + if ($simplehtml === 3) { + $return = '' . $match[1] . ''; + } + return $return; + } + , $Text); // Unhide all [noparse] contained bbtags unspacefying them // and triming the [noparse] tag. From 6060f311e92bee7a3cc495573f64986d09f0413d Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Fri, 7 Apr 2017 11:26:11 +0200 Subject: [PATCH 26/32] small fix for #3254 --- include/update_gcontact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/update_gcontact.php b/include/update_gcontact.php index 221c0829f5..883a229895 100644 --- a/include/update_gcontact.php +++ b/include/update_gcontact.php @@ -21,7 +21,7 @@ function update_gcontact_run(&$argv, &$argc) { $r = q("SELECT * FROM `gcontact` WHERE `id` = %d", intval($contact_id)); - if (!dbm::_is_result($r)) { + if (!dbm::is_result($r)) { return; } From a9b36965607c0683760d01286a2001b0141ef7b5 Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Fri, 7 Apr 2017 11:35:45 +0200 Subject: [PATCH 27/32] Bugfix: bulk deletion button was not available anymore --- view/theme/frio/css/style.css | 2 +- view/theme/frio/js/theme.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index 2f3eb99c95..596b6de1e9 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -119,7 +119,7 @@ code { line-height: 1.5; } -a#item-delete-selected { +#item-delete-selected { cursor: pointer; color: white; position: fixed; diff --git a/view/theme/frio/js/theme.js b/view/theme/frio/js/theme.js index 00f9691016..4e32f9128c 100644 --- a/view/theme/frio/js/theme.js +++ b/view/theme/frio/js/theme.js @@ -83,12 +83,12 @@ $(document).ready(function(){ } }); - if(checked == true) { - $("a#item-delete-selected").fadeTo(400, 1); - $("a#item-delete-selected").show(); + if(checked) { + $("#item-delete-selected").fadeTo(400, 1); + $("#item-delete-selected").show(); } else { - $("a#item-delete-selected").fadeTo(400, 0, function(){ - $("a#item-delete-selected").hide(); + $("#item-delete-selected").fadeTo(400, 0, function(){ + $("#item-delete-selected").hide(); }); } }); From fb94a0add71642b08bab610d1cfb70eab4598ffc Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Fri, 7 Apr 2017 12:59:22 +0200 Subject: [PATCH 28/32] the Quattro admin_user template was missing the users note for the admin --- view/theme/quattro/templates/admin_users.tpl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/view/theme/quattro/templates/admin_users.tpl b/view/theme/quattro/templates/admin_users.tpl index f00e786778..ddb395db9c 100644 --- a/view/theme/quattro/templates/admin_users.tpl +++ b/view/theme/quattro/templates/admin_users.tpl @@ -39,6 +39,9 @@ + +

    {{$pendingnotetext}}: {{$u.note}}

    + {{/foreach}} From 47a6f6b726f1716fa5d78b2008652aade9e5e8a7 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 7 Apr 2017 21:34:06 +0000 Subject: [PATCH 29/32] Issue 3300: The temp path creation couldn't create a subdirectory with the hostname --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot.php b/boot.php index 084bca112e..1d8a9e7f76 100644 --- a/boot.php +++ b/boot.php @@ -2472,7 +2472,7 @@ function get_temppath() { // Check if it is usable if (($temppath != "") AND App::directory_usable($temppath)) { // To avoid any interferences with other systems we create our own directory - $new_temppath .= "/".$a->get_hostname(); + $new_temppath = $temppath."/".$a->get_hostname(); if (!is_dir($new_temppath)) { /// @TODO There is a mkdir()+chmod() upwards, maybe generalize this (+ configurable) into a function/method? mkdir($new_temppath); From 8786bcdf0a615e95989af5eedd3fce4ad153c503 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 8 Apr 2017 08:12:14 +0000 Subject: [PATCH 30/32] Avoid duplicates with feeds and "remote self" --- include/feed.php | 9 +++++++-- include/items.php | 10 ++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/include/feed.php b/include/feed.php index 2959933703..2117676dba 100644 --- a/include/feed.php +++ b/include/feed.php @@ -200,7 +200,6 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) { if ($item["plink"] == "") { $item["plink"] = $xpath->evaluate('rss:link/text()', $entry)->item(0)->nodeValue; } - $item["plink"] = original_url($item["plink"]); $item["uri"] = $xpath->evaluate('atom:id/text()', $entry)->item(0)->nodeValue; @@ -210,12 +209,17 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) { if ($item["uri"] == "") { $item["uri"] = $item["plink"]; } + + $orig_plink = $item["plink"]; + + $item["plink"] = original_url($item["plink"]); + $item["parent-uri"] = $item["uri"]; if (!$simulate) { $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s' AND `network` IN ('%s', '%s')", intval($importer["uid"]), dbesc($item["uri"]), dbesc(NETWORK_FEED), dbesc(NETWORK_DFRN)); - if ($r) { + if (dbm::is_result($r)) { logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$r[0]["id"], LOGGER_DEBUG); continue; } @@ -340,6 +344,7 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) { // Distributed items should have a well formatted URI. // Additionally we have to avoid conflicts with identical URI between imported feeds and these items. if ($notify) { + $item['guid'] = uri_to_guid($orig_plink, $a->get_hostname()); unset($item['uri']); unset($item['parent-uri']); } diff --git a/include/items.php b/include/items.php index c2b3d7d1f5..f3885d21f9 100644 --- a/include/items.php +++ b/include/items.php @@ -407,10 +407,12 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa // We have to avoid duplicates. So we create the GUID in form of a hash of the plink or uri. // In difference to the call to "uri_to_guid" several lines below we add the hash of our own host. // This is done because our host is the original creator of the post. - if (isset($arr['plink'])) { - $arr['guid'] = uri_to_guid($arr['plink'], $a->get_hostname()); - } elseif (isset($arr['uri'])) { - $arr['guid'] = uri_to_guid($arr['uri'], $a->get_hostname()); + if (!isset($arr['guid'])) { + if (isset($arr['plink'])) { + $arr['guid'] = uri_to_guid($arr['plink'], $a->get_hostname()); + } elseif (isset($arr['uri'])) { + $arr['guid'] = uri_to_guid($arr['uri'], $a->get_hostname()); + } } } From c65fc6f8ded65af51f082ab88c05d68e94d9360c Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Sat, 8 Apr 2017 13:30:16 +0200 Subject: [PATCH 31/32] Bugfix: there was a gui issue on the navbar account dropdown button --- view/theme/frio/css/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index 596b6de1e9..3879605276 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -440,7 +440,7 @@ nav.navbar .nav>li>a:focus{ border-radius: 3px; } #topbar-first .nav>.account .dropdown-toggle { - padding: 10px 5px 8px; + padding: 10px 5px 0px; line-height: 1.1em; text-align: left } From 318166a381dd64fbf37d230000dae2c12e23d0bc Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 8 Apr 2017 08:59:41 -0400 Subject: [PATCH 32/32] Fix path to default Text_Highlighter CSS --- view/templates/head.tpl | 2 +- view/theme/frio/templates/head.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/view/templates/head.tpl b/view/templates/head.tpl index 0772af0bc1..bfc5728ed2 100644 --- a/view/templates/head.tpl +++ b/view/templates/head.tpl @@ -7,7 +7,7 @@ - + diff --git a/view/theme/frio/templates/head.tpl b/view/theme/frio/templates/head.tpl index 7652bd0fe6..32005417c8 100644 --- a/view/theme/frio/templates/head.tpl +++ b/view/theme/frio/templates/head.tpl @@ -12,7 +12,7 @@ - +