]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/Widget.php
Fix undefined offset notices in Protocol\Email
[friendica.git] / src / Content / Widget.php
index 2f78d0fd3d387dd52f6e4830f2ed2f41c9c8b240..35e8913e0869866dcf9c33778b46c5d2d6d8cb8b 100644 (file)
@@ -18,9 +18,8 @@ use Friendica\Model\Contact;
 use Friendica\Model\FileTag;
 use Friendica\Model\GContact;
 use Friendica\Model\Profile;
-
-require_once 'boot.php';
-require_once 'include/dba.php';
+use Friendica\Util\Strings;
+use Friendica\Util\XML;
 
 class Widget
 {
@@ -45,7 +44,7 @@ class Widget
         */
        public static function findPeople()
        {
-               $a = get_app();
+               $a = \get_app();
                $global_dir = Config::get('system', 'directory');
 
                if (Config::get('system', 'invitation_only')) {
@@ -138,7 +137,7 @@ class Widget
 
                $extra_sql = self::unavailableNetworks();
 
-               $r = DBA::p("SELECT DISTINCT(`network`) FROM `contact` WHERE `uid` = ? AND `network` != '' $extra_sql ORDER BY `network`",
+               $r = DBA::p("SELECT DISTINCT(`network`) FROM `contact` WHERE `uid` = ? AND NOT `deleted` AND `network` != '' $extra_sql ORDER BY `network`",
                        local_user()
                );
 
@@ -153,10 +152,10 @@ class Widget
                }
 
                return Renderer::replaceMacros(Renderer::getMarkupTemplate('nets.tpl'), array(
-                       '$title' => L10n::t('Networks'),
+                       '$title' => L10n::t('Protocols'),
                        '$desc' => '',
                        '$sel_all' => (($selected == '') ? 'selected' : ''),
-                       '$all' => L10n::t('All Networks'),
+                       '$all' => L10n::t('All Protocols'),
                        '$nets' => $nets,
                        '$base' => $baseurl,
                ));
@@ -174,10 +173,6 @@ class Widget
                        return '';
                }
 
-               if (!Feature::isEnabled(local_user(), 'filing')) {
-                       return '';
-               }
-
                $saved = PConfig::get(local_user(), 'system', 'filetags');
                if (!strlen($saved)) {
                        return;
@@ -189,7 +184,7 @@ class Widget
                if ($cnt) {
                        foreach ($matches as $mtch)
                        {
-                               $unescaped = xmlify(FileTag::decode($mtch[1]));
+                               $unescaped = XML::escape(FileTag::decode($mtch[1]));
                                $terms[] = array('name' => $unescaped, 'selected' => (($selected == $unescaped) ? 'selected' : ''));
                        }
                }
@@ -212,7 +207,7 @@ class Widget
         */
        public static function categories($baseurl, $selected = '')
        {
-               $a = get_app();
+               $a = \get_app();
 
                if (!Feature::isEnabled($a->profile['profile_uid'], 'categories')) {
                        return '';
@@ -229,7 +224,7 @@ class Widget
 
                if ($cnt) {
                        foreach ($matches as $mtch) {
-                               $unescaped = xmlify(FileTag::decode($mtch[1]));
+                               $unescaped = XML::escape(FileTag::decode($mtch[1]));
                                $terms[] = array('name' => $unescaped, 'selected' => (($selected == $unescaped) ? 'selected' : ''));
                        }
                }
@@ -269,11 +264,11 @@ class Widget
                if (!$cid) {
                        if (Profile::getMyURL()) {
                                $contact = DBA::selectFirst('contact', ['id'],
-                                               ['nurl' => normalise_link(Profile::getMyURL()), 'uid' => $profile_uid]);
+                                               ['nurl' => Strings::normaliseLink(Profile::getMyURL()), 'uid' => $profile_uid]);
                                if (DBA::isResult($contact)) {
                                        $cid = $contact['id'];
                                } else {
-                                       $gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Profile::getMyURL())]);
+                                       $gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => Strings::normaliseLink(Profile::getMyURL())]);
                                        if (DBA::isResult($gcontact)) {
                                                $zcid = $gcontact['id'];
                                        }
@@ -321,7 +316,7 @@ class Widget
         */
        public static function tagCloud($limit = 50)
        {
-               $a = get_app();
+               $a = \get_app();
 
                if (!$a->profile['profile_uid'] || !$a->profile['url']) {
                        return '';