Merge pull request #9724 from MrPetovan/bug/notices
authorMichael Vogel <icarus@dabo.de>
Thu, 31 Dec 2020 16:30:50 +0000 (17:30 +0100)
committerGitHub <noreply@github.com>
Thu, 31 Dec 2020 16:30:50 +0000 (17:30 +0100)
Various improvements

src/Content/Text/BBCode.php
src/Network/Probe.php
src/Repository/PermissionSet.php
view/theme/frio/css/style.css
view/theme/frio/php/default.php
view/theme/frio/php/standard.php
view/theme/frio/scheme/black.css
view/theme/frio/scheme/dark.css

index ea818d7..25812db 100644 (file)
@@ -1393,6 +1393,16 @@ class BBCode
                                        $text = self::convertAttachment($text, $simple_html, $try_oembed);
                                }
 
+                               $nosmile = strpos($text, '[nosmile]') !== false;
+                               $text = str_replace('[nosmile]', '', $text);
+
+                               // Replace non graphical smilies for external posts
+                               if (!$nosmile && !$for_plaintext) {
+                                       $text = self::performWithEscapedTags($text, ['img'], function ($text) {
+                                               return Smilies::replace($text);
+                                       });
+                               }
+
                                // leave open the posibility of [map=something]
                                // this is replaced in Item::prepareBody() which has knowledge of the item location
                                if (strpos($text, '[/map]') !== false) {
@@ -1506,11 +1516,6 @@ class BBCode
                                        });
                                }
 
-                               // This is actually executed in Item::prepareBody()
-
-                               $nosmile = strpos($text, '[nosmile]') !== false;
-                               $text = str_replace('[nosmile]', '', $text);
-
                                // Check for font change text
                                $text = preg_replace("/\[font=(.*?)\](.*?)\[\/font\]/sm", "<span style=\"font-family: $1;\">$2</span>", $text);
 
@@ -1683,13 +1688,6 @@ class BBCode
                                        $text = preg_replace("/\[event\-id\](.*?)\[\/event\-id\]/ism", '', $text);
                                }
 
-                               // Replace non graphical smilies for external posts
-                               if (!$nosmile && !$for_plaintext) {
-                                       $text = self::performWithEscapedTags($text, ['img'], function ($text) {
-                                               return Smilies::replace($text);
-                                       });
-                               }
-
                                if (!$for_plaintext && DI::config()->get('system', 'big_emojis') && ($simple_html != self::DIASPORA)) {
                                        $conv = html_entity_decode(str_replace([' ', "\n", "\r"], '', $text));
                                        // Emojis are always 4 byte Unicode characters
index d5dcba5..f4ca039 100644 (file)
@@ -1801,26 +1801,28 @@ class Probe
 
                $hrefParts = parse_url($href);
 
-               // Root path case (/path) including relative scheme case (//host/path)
-               if ($hrefParts['path'] && $hrefParts['path'][0] == '/') {
-                       $path = $hrefParts['path'];
-               } else {
-                       $path = $path . '/' . $hrefParts['path'];
-
-                       // Resolve arbitrary relative path
-                       // Lifted from https://www.php.net/manual/en/function.realpath.php#84012
-                       $parts = array_filter(explode('/', $path), 'strlen');
-                       $absolutes = array();
-                       foreach ($parts as $part) {
-                               if ('.' == $part) continue;
-                               if ('..' == $part) {
-                                       array_pop($absolutes);
-                               } else {
-                                       $absolutes[] = $part;
+               if (!empty($hrefParts['path'])) {
+                       // Root path case (/path) including relative scheme case (//host/path)
+                       if ($hrefParts['path'] && $hrefParts['path'][0] == '/') {
+                               $path = $hrefParts['path'];
+                       } else {
+                               $path = $path . '/' . $hrefParts['path'];
+
+                               // Resolve arbitrary relative path
+                               // Lifted from https://www.php.net/manual/en/function.realpath.php#84012
+                               $parts = array_filter(explode('/', $path), 'strlen');
+                               $absolutes = array();
+                               foreach ($parts as $part) {
+                                       if ('.' == $part) continue;
+                                       if ('..' == $part) {
+                                               array_pop($absolutes);
+                                       } else {
+                                               $absolutes[] = $part;
+                                       }
                                }
-                       }
 
-                       $path = '/' . implode('/', $absolutes);
+                               $path = '/' . implode('/', $absolutes);
+                       }
                }
 
                // Relative scheme case (//host/path)
index b9d07e1..c28dd03 100644 (file)
@@ -25,7 +25,6 @@ use Friendica\BaseRepository;
 use Friendica\Collection;
 use Friendica\Database\Database;
 use Friendica\Model;
-use Friendica\Model\Group;
 use Friendica\Network\HTTPException;
 use Friendica\Util\ACLFormatter;
 use Psr\Log\LoggerInterface;
@@ -162,9 +161,19 @@ class PermissionSet extends BaseRepository
         */
        public function selectByContactId($contact_id, $uid)
        {
+               $cdata = Model\Contact::getPublicAndUserContacID($contact_id, $uid);
+               if (!empty($cdata)) {
+                       $public_contact_str = '<' . $cdata['public'] . '>';
+                       $user_contact_str = '<' . $cdata['user'] . '>';
+                       $contact_id = $cdata['user'];
+               } else {
+                       $public_contact_str = '<' . $contact_id . '>';
+                       $user_contact_str = '';
+               }
+
                $groups = [];
-               if ($this->dba->exists('contact', ['id' => $contact_id, 'uid' => $uid, 'blocked' => false])) {
-                       $groups = Group::getIdsByContactId($contact_id);
+               if (!empty($user_contact_str) && $this->dba->exists('contact', ['id' => $contact_id, 'uid' => $uid, 'blocked' => false])) {
+                       $groups = Model\Group::getIdsByContactId($contact_id);
                }
 
                $group_str = '<<>>'; // should be impossible to match
@@ -172,11 +181,16 @@ class PermissionSet extends BaseRepository
                        $group_str .= '|<' . preg_quote($group_id) . '>';
                }
 
-               $contact_str = '<' . $contact_id . '>';
-
-               $condition = ["`uid` = ? AND (NOT (`deny_cid` REGEXP ? OR deny_gid REGEXP ?)
-                       AND (allow_cid REGEXP ? OR allow_gid REGEXP ? OR (allow_cid = '' AND allow_gid = '')))",
-                       $uid, $contact_str, $group_str, $contact_str, $group_str];
+               if (!empty($user_contact_str)) {
+                       $condition = ["`uid` = ? AND (NOT (`deny_cid` REGEXP ? OR `deny_cid` REGEXP ? OR deny_gid REGEXP ?)
+                               AND (allow_cid REGEXP ? OR allow_cid REGEXP ? OR allow_gid REGEXP ? OR (allow_cid = '' AND allow_gid = '')))",
+                               $uid, $user_contact_str, $public_contact_str, $group_str,
+                               $user_contact_str, $public_contact_str, $group_str];
+               } else {
+                       $condition = ["`uid` = ? AND (NOT (`deny_cid` REGEXP ? OR deny_gid REGEXP ?)
+                               AND (allow_cid REGEXP ? OR allow_gid REGEXP ? OR (allow_cid = '' AND allow_gid = '')))",
+                               $uid, $public_contact_str, $group_str, $public_contact_str, $group_str];
+               }
 
                return $this->select($condition);
        }
index 927d557..80183b7 100644 (file)
@@ -119,7 +119,7 @@ blockquote {
 #back-to-top {
     display: none;
     cursor: pointer;
-    color: white;
+    color: $nav_icon_color;
     position: fixed;
     z-index: 49;
     right: 20px;
@@ -128,7 +128,7 @@ blockquote {
     font-size: 2.9em;
     padding: 0 12px 0 12px;
     border-radius: 10px;
-    background-color: #aaa;
+    background-color: $nav_bg;
     line-height: 1.5;
 }
 
index cdac7d9..c6b8f96 100644 (file)
@@ -149,7 +149,7 @@ $is_singleuser_class = $is_singleuser ? "is-singleuser" : "is-not-singleuser";
                                </div><!--row-->
                        </div><!-- container -->
 
-                       <div id="back-to-top" title="back to top">&#8679;</div>
+                       <div id="back-to-top" title="back to top"></div>
                </main>
 
                <footer>
index 927b046..c97c047 100644 (file)
@@ -70,7 +70,7 @@
                        </div><!--row-->
                </div><!-- container -->
 
-               <div id="back-to-top" title="back to top">&#8679;</div>
+               <div id="back-to-top" title="back to top"></div>
        </main>
 
 <footer>
index 263322d..4f58f8c 100644 (file)
@@ -347,7 +347,9 @@ section > .generic-page-wrapper,
 .fsuggest-content-wrapper,
 .panel,
 aside .widget,
-.nav-container .widget{
+.nav-container .widget,
+#back-to-top
+{
        box-shadow: 0 0 3px $link_color;
        -webkit-box-shadow: 0 0 3px $link_color;
 }
@@ -355,3 +357,7 @@ aside .widget,
 input[type=text].tt-input {
        box-shadow: none;
 }
+
+#back-to-top {
+       color: $link_color;
+}
index bf5a347..c9ba99c 100644 (file)
@@ -327,3 +327,7 @@ legend {
 input[type=text].tt-input {
        box-shadow: none;
 }
+
+#back-to-top {
+       border: 1px solid $nav_icon_color;
+}