]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #6315 from MrPetovan/bug/6309-add-fulltext-index-profile
authorMichael Vogel <icarus@dabo.de>
Thu, 27 Dec 2018 17:04:06 +0000 (18:04 +0100)
committerGitHub <noreply@github.com>
Thu, 27 Dec 2018 17:04:06 +0000 (18:04 +0100)
Rework mod/match and mod/msearch

52 files changed:
include/api.php
include/conversation.php
mod/admin.php
mod/allfriends.php
mod/babel.php
mod/common.php
mod/credits.php
mod/crepair.php
mod/dfrn_poll.php
mod/dfrn_request.php
mod/display.php
mod/editpost.php
mod/events.php
mod/follow.php
mod/hovercard.php
mod/message.php
mod/network.php
mod/notifications.php
mod/profile.php
mod/redir.php
mod/unfollow.php
mod/viewcontacts.php
mod/wallmessage.php
src/Content/Text/HTML.php
src/Core/Installer.php
src/Model/Event.php
src/Model/Profile.php
src/Module/Contact.php
src/Module/Itemsource.php
src/Protocol/ActivityPub/Processor.php
src/Protocol/Diaspora.php
src/Protocol/PortableContact.php
src/Util/Strings.php
tests/src/Core/InstallerTest.php
view/templates/babel.tpl
view/templates/dfrn_req_confirm.tpl
view/templates/email_notify_html.tpl
view/templates/hovercard.tpl
view/templates/photo_view.tpl
view/templates/profile_vcard.tpl
view/templates/vcard-widget.tpl
view/templates/wallmessage.tpl
view/theme/duepuntozero/templates/profile_vcard.tpl
view/theme/frio/templates/contact_template.tpl
view/theme/frio/templates/event_stream_item.tpl
view/theme/frio/templates/field_textarea.tpl
view/theme/frio/templates/photo_view.tpl
view/theme/frio/templates/vcard-widget.tpl
view/theme/quattro/templates/photo_view.tpl
view/theme/quattro/templates/profile_vcard.tpl
view/theme/vier/templates/photo_view.tpl
view/theme/vier/templates/profile_vcard.tpl

index 1676748f753cb557f94ea87b3fadf7123366d630..ddcb8c8dcdb3fad71da3cb3e5152b225d68a88d2 100644 (file)
@@ -642,8 +642,6 @@ function api_get_user(App $a, $contact_id = null)
                $contact = DBA::selectFirst('contact', [], ['uid' => 0, 'nurl' => Strings::normaliseLink($url)]);
 
                if (DBA::isResult($contact)) {
-                       $network_name = ContactSelector::networkToName($contact['network'], $contact['url']);
-
                        // If no nick where given, extract it from the address
                        if (($contact['nick'] == "") || ($contact['name'] == $contact['nick'])) {
                                $contact['nick'] = api_get_nick($contact["url"]);
@@ -654,7 +652,7 @@ function api_get_user(App $a, $contact_id = null)
                                'id_str' => (string) $contact["id"],
                                'name' => $contact["name"],
                                'screen_name' => (($contact['nick']) ? $contact['nick'] : $contact['name']),
-                               'location' => ($contact["location"] != "") ? $contact["location"] : $network_name,
+                               'location' => ($contact["location"] != "") ? $contact["location"] : ContactSelector::networkToName($contact['network'], $contact['url']),
                                'description' => $contact["about"],
                                'profile_image_url' => $contact["micro"],
                                'profile_image_url_https' => $contact["micro"],
@@ -712,8 +710,6 @@ function api_get_user(App $a, $contact_id = null)
                $uinfo[0]['nick'] = api_get_nick($uinfo[0]["url"]);
        }
 
-       $network_name = ContactSelector::networkToName($uinfo[0]['network'], $uinfo[0]['url']);
-
        $pcontact_id  = Contact::getIdForURL($uinfo[0]['url'], 0, true);
 
        if (!empty($profile['about'])) {
@@ -727,7 +723,7 @@ function api_get_user(App $a, $contact_id = null)
        } elseif (!empty($uinfo[0]["location"])) {
                $location = $uinfo[0]["location"];
        } else {
-               $location = $network_name;
+               $location = ContactSelector::networkToName($uinfo[0]['network'], $uinfo[0]['url']);
        }
 
        $ret = [
index d6ad4f11b6c420b7be9864b97697c6e8cfdd12c9..1059941b9e0bcb274b12f678ff37d4f7b6895601 100644 (file)
@@ -389,7 +389,7 @@ function visible_activity($item) {
         * likes (etc.) can apply to other things besides posts. Check if they are post children,
         * in which case we handle them specially
         */
-       $hidden_activities = [ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE];
+       $hidden_activities = [ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE, ACTIVITY_FOLLOW];
        foreach ($hidden_activities as $act) {
                if (activity_match($item['verb'], $act)) {
                        return false;
index db66eabbc4859140b1386ff869ae3458831fce4e..b906ad7d0557613856214e78d2fc8ed9302e823f 100644 (file)
@@ -1440,9 +1440,7 @@ function admin_page_site(App $a)
                $banner = '<a href="https://friendi.ca"><img id="logo-img" src="images/friendica-32.png" alt="logo" /></a><span id="logo-text"><a href="https://friendi.ca">Friendica</a></span>';
        }
 
-       $banner = htmlspecialchars($banner);
        $info = Config::get('config', 'info');
-       $info = htmlspecialchars($info);
 
        // Automatically create temporary paths
        get_temppath();
index 80da130480444f2292701e1e0a286e13dba844e4..ceb32e6c1898dcefe2b2cc768c15ff609f5a9ef4 100644 (file)
@@ -79,9 +79,9 @@ function allfriends_content(App $a)
                $entry = [
                        'url'          => $rr['url'],
                        'itemurl'      => defaults($contact_details, 'addr', $rr['url']),
-                       'name'         => htmlentities($contact_details['name']),
+                       'name'         => $contact_details['name'],
                        'thumb'        => ProxyUtils::proxifyUrl($contact_details['thumb'], false, ProxyUtils::SIZE_THUMB),
-                       'img_hover'    => htmlentities($contact_details['name']),
+                       'img_hover'    => $contact_details['name'],
                        'details'      => $contact_details['location'],
                        'tags'         => $contact_details['keywords'],
                        'about'        => $contact_details['about'],
@@ -98,9 +98,7 @@ function allfriends_content(App $a)
        $tab_str = Module\Contact::getTabsHTML($a, $contact, 4);
 
        $tpl = Renderer::getMarkupTemplate('viewcontact_template.tpl');
-
        $o .= Renderer::replaceMacros($tpl, [
-               //'$title' => L10n::t('Friends of %s', htmlentities($c[0]['name'])),
                '$tab_str' => $tab_str,
                '$contacts' => $entries,
                '$paginate' => $pager->renderFull($total),
index b9846e4fb433a16867f7d6afd20bedff2cbd0aac..64c9557767d278d7a6122019dbd6016f4c3087d0 100644 (file)
@@ -142,7 +142,7 @@ function babel_content()
 
        $tpl = Renderer::getMarkupTemplate('babel.tpl');
        $o = Renderer::replaceMacros($tpl, [
-               '$text'          => ['text', L10n::t('Source text'), htmlentities(defaults($_REQUEST, 'text', '')), ''],
+               '$text'          => ['text', L10n::t('Source text'), defaults($_REQUEST, 'text', ''), ''],
                '$type_bbcode'   => ['type', L10n::t('BBCode'), 'bbcode', '', defaults($_REQUEST, 'type', 'bbcode') == 'bbcode'],
                '$type_markdown' => ['type', L10n::t('Markdown'), 'markdown', '', defaults($_REQUEST, 'type', 'bbcode') == 'markdown'],
                '$type_html'     => ['type', L10n::t('HTML'), 'html', '', defaults($_REQUEST, 'type', 'bbcode') == 'html'],
index 5d98f07321becec12fe83c45abca244ec5e2e362..1c4032f11f411e49fbe0d6e81a8598cad21b827d 100644 (file)
@@ -48,7 +48,7 @@ function common_content(App $a)
 
                if (DBA::isResult($contact)) {
                        $vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate("vcard-widget.tpl"), [
-                               '$name'  => htmlentities($contact['name']),
+                               '$name'  => $contact['name'],
                                '$photo' => $contact['photo'],
                                'url'    => 'contact/' . $cid
                        ]);
@@ -121,7 +121,7 @@ function common_content(App $a)
                        'itemurl'      => defaults($contact_details, 'addr', $common_friend['url']),
                        'name'         => $contact_details['name'],
                        'thumb'        => ProxyUtils::proxifyUrl($contact_details['thumb'], false, ProxyUtils::SIZE_THUMB),
-                       'img_hover'    => htmlentities($contact_details['name']),
+                       'img_hover'    => $contact_details['name'],
                        'details'      => $contact_details['location'],
                        'tags'         => $contact_details['keywords'],
                        'about'        => $contact_details['about'],
index c53c86b8b9882b3b1913cb2db2ab651a8069d7f1..f397bdca70f5f00898ae80d8cf3bf7b86f84f3e3 100644 (file)
@@ -13,7 +13,7 @@ function credits_content()
 {
        /* fill the page with credits */
        $credits_string = file_get_contents('util/credits.txt');
-       $names = explode("\n", htmlspecialchars($credits_string));
+       $names = explode("\n", $credits_string);
        $tpl = Renderer::getMarkupTemplate('credits.tpl');
        return Renderer::replaceMacros($tpl, [
                '$title'  => L10n::t('Credits'),
index 8623d3c4ac122d5b1695c1de3065024af39c89ff..91b22dbc92b1c9085ce4709b361d4fa67cf009a7 100644 (file)
@@ -158,8 +158,8 @@ function crepair_content(App $a)
                        $remote_self_options
                ],
 
-               '$name'         => ['name', L10n::t('Name') , htmlentities($contact['name'])],
-               '$nick'         => ['nick', L10n::t('Account Nickname'), htmlentities($contact['nick'])],
+               '$name'         => ['name', L10n::t('Name') , $contact['name']],
+               '$nick'         => ['nick', L10n::t('Account Nickname'), $contact['nick']],
                '$attag'        => ['attag', L10n::t('@Tagname - overrides Name/Nickname'), $contact['attag']],
                '$url'          => ['url', L10n::t('Account URL'), $contact['url']],
                '$request'      => ['request', L10n::t('Friend Request URL'), $contact['request']],
index a46d215e76056b46b1a5a696c3406d10c0e23315..6b2016886db462274ad9da07712f11de6505c43b 100644 (file)
@@ -434,7 +434,7 @@ function dfrn_poll_content(App $a)
                switch ($direction) {
                        case -1:
                                if ($type === 'profile') {
-                                       $sql_extra = sprintf(" AND ( `dfrn-id` = '%s' OR `issued-id` = '%s' ) ", DBA::escape($dfrn_id), DBA::escape($dfrn_id));
+                                       $sql_extra = sprintf(" AND (`dfrn-id` = '%s' OR `issued-id` = '%s') ", DBA::escape($dfrn_id), DBA::escape($dfrn_id));
                                } else {
                                        $sql_extra = sprintf(" AND `issued-id` = '%s' ", DBA::escape($dfrn_id));
                                }
index 35e308531df9d05c9a99b5bc330c19cab1ec6950..15e11c3dab33029f99eca968da730d2ad91c5b8e 100644 (file)
@@ -510,8 +510,7 @@ function dfrn_request_content(App $a)
 
                        dfrn_request_post($a);
 
-                       killme();
-                       return; // NOTREACHED
+                       exit();
                }
 
                $tpl = Renderer::getMarkupTemplate("dfrn_req_confirm.tpl");
@@ -519,7 +518,6 @@ function dfrn_request_content(App $a)
                        '$dfrn_url' => $dfrn_url,
                        '$aes_allow' => (($aes_allow) ? '<input type="hidden" name="aes_allow" value="1" />' : "" ),
                        '$hidethem' => L10n::t('Hide this contact'),
-                       '$hidechecked' => '',
                        '$confirm_key' => $confirm_key,
                        '$welcome' => L10n::t('Welcome home %s.', $a->user['username']),
                        '$please' => L10n::t('Please confirm your introduction/connection request to %s.', $dfrn_url),
index 054ba1924ff2b0b1640655170fa4b05094a7d182..a616fc8cc343022dcdbe7b0240f14795157cf8c5 100644 (file)
@@ -289,8 +289,8 @@ function display_content(App $a, $update = false, $update_uid = 0)
 
        $parent = Item::selectFirst(['uid'], ['uri' => $item_parent_uri, 'wall' => true]);
        if (DBA::isResult($parent)) {
-               $a->profile['uid'] = $parent['uid'];
-               $a->profile['profile_uid'] = $parent['uid'];
+               $a->profile['uid'] = defaults($a->profile, 'uid', $parent['uid']);
+               $a->profile['profile_uid'] = defaults($a->profile, 'profile_uid', $parent['uid']);
                $is_remote_contact = Contact::isFollower(remote_user(), $a->profile['profile_uid']);
        }
 
index b518588a591a46042cef3b7978295a42d9f58227..1e53285830dd5d2d272cc8182076bd878a704999 100644 (file)
@@ -6,6 +6,7 @@ use Friendica\App;
 use Friendica\Content\Feature;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
+use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
 use Friendica\Core\System;
@@ -54,8 +55,6 @@ function editpost_content(App $a)
                '$nickname' => $a->user['nickname']
        ]);
 
-       $tpl = Renderer::getMarkupTemplate("jot.tpl");
-
        if (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) {
                $lockstate = 'lock';
        } else {
@@ -84,9 +83,9 @@ function editpost_content(App $a)
                }
        }
 
-       Addon::callHooks('jot_tool', $jotplugins);
-       //Addon::callHooks('jot_networks', $jotnets);
+       Hook::callAll('jot_tool', $jotplugins);
 
+       $tpl = Renderer::getMarkupTemplate("jot.tpl");
        $o .= Renderer::replaceMacros($tpl, [
                '$is_edit' => true,
                '$return_path' => '/display/' . $item['guid'],
@@ -119,7 +118,7 @@ function editpost_content(App $a)
                '$emailcc' => L10n::t('CC: email addresses'),
                '$public' => L10n::t('Public post'),
                '$jotnets' => $jotnets,
-               '$title' => htmlspecialchars($item['title']),
+               '$title' => $item['title'],
                '$placeholdertitle' => L10n::t('Set title'),
                '$category' => FileTag::fileToList($item['file'], 'category'),
                '$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? L10n::t("Categories \x28comma-separated list\x29") : ''),
index c61ad9dd3426fc01867140abee99617a3f205438..a54260c435ef95ca3f73413c1184ab80a0861835 100644 (file)
@@ -95,13 +95,23 @@ function events_post(App $a)
        // and we'll waste a bunch of time responding to it. Time that
        // could've been spent doing something else.
 
-       $summary  = Strings::escapeHtml(trim(defaults($_POST, 'summary', '')));
-       $desc     = Strings::escapeHtml(trim(defaults($_POST, 'desc', '')));
-       $location = Strings::escapeHtml(trim(defaults($_POST, 'location', '')));
+       $summary  = trim(defaults($_POST, 'summary' , ''));
+       $desc     = trim(defaults($_POST, 'desc'    , ''));
+       $location = trim(defaults($_POST, 'location', ''));
        $type     = 'event';
 
-       $action = ($event_id == '') ? 'new' : "event/" . $event_id;
-       $onerror_path = "events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish";
+       $params = [
+               'summary'     => $summary,
+               'description' => $desc,
+               'location'    => $location,
+               'start'       => $start_text,
+               'finish'      => $finish_text,
+               'adjust'      => $adjust,
+               'nofinish'    => $nofinish,
+       ];
+
+       $action = ($event_id == '') ? 'new' : 'event/' . $event_id;
+       $onerror_path = 'events/' . $action . '?' . http_build_query($params, null, null, PHP_QUERY_RFC3986);
 
        if (strcmp($finish, $start) < 0 && !$nofinish) {
                notice(L10n::t('Event can not end before it has started.') . EOL);
@@ -135,10 +145,10 @@ function events_post(App $a)
 
 
        if ($share) {
-               $str_group_allow   = !empty($_POST['group_allow'])   ? perms2str($_POST['group_allow'])   : '';
-               $str_contact_allow = !empty($_POST['contact_allow']) ? perms2str($_POST['contact_allow']) : '';
-               $str_group_deny    = !empty($_POST['group_deny'])    ? perms2str($_POST['group_deny'])    : '';
-               $str_contact_deny  = !empty($_POST['contact_deny'])  ? perms2str($_POST['contact_deny'])  : '';
+               $str_group_allow   = perms2str(defaults($_POST, 'group_allow'  , ''));
+               $str_contact_allow = perms2str(defaults($_POST, 'contact_allow', ''));
+               $str_group_deny    = perms2str(defaults($_POST, 'group_deny'   , ''));
+               $str_contact_deny  = perms2str(defaults($_POST, 'contact_deny' , ''));
 
                // Undo the pseudo-contact of self, since there are real contacts now
                if (strpos($str_contact_allow, '<' . $self . '>') !== false) {
@@ -179,7 +189,7 @@ function events_post(App $a)
        if (intval($_REQUEST['preview'])) {
                $html = Event::getHTML($datarray);
                echo $html;
-               killme();
+               exit();
        }
 
        $item_id = Event::store($datarray);
@@ -362,8 +372,9 @@ function events_content(App $a)
                }
 
                if ($a->argc > 1 && $a->argv[1] === 'json') {
+                       header('Content-Type: application/json');
                        echo json_encode($events);
-                       killme();
+                       exit();
                }
 
                if (!empty($_GET['id'])) {
index 1ee61ce9e14802448c8a8b87e59a699a18b5ed4c..f8e2539d97e2cf6c9e0f14adb266bcc21dd4d2e4 100644 (file)
@@ -144,11 +144,8 @@ function follow_content(App $a)
                $r[0]['about'] = '';
        }
 
-       $header = L10n::t('Connect/Follow');
-
        $o = Renderer::replaceMacros($tpl, [
-               '$header'        => htmlentities($header),
-               //'$photo'         => ProxyUtils::proxifyUrl($ret['photo'], false, ProxyUtils::SIZE_SMALL),
+               '$header'        => L10n::t('Connect/Follow'),
                '$desc'          => '',
                '$pls_answer'    => L10n::t('Please answer the following:'),
                '$does_know_you' => ['knowyou', L10n::t('Does %s know you?', $ret['name']), false, '', [L10n::t('No'), L10n::t('Yes')]],
@@ -170,13 +167,6 @@ function follow_content(App $a)
                '$url_label'     => L10n::t('Profile URL'),
                '$myaddr'        => $myaddr,
                '$request'       => $request,
-               /*
-                * @TODO commented out?
-               '$location'      => Friendica\Content\Text\BBCode::::convert($r[0]['location']),
-               '$location_label'=> L10n::t('Location:'),
-               '$about'         => Friendica\Content\Text\BBCode::::convert($r[0]['about'], false, false),
-               '$about_label'   => L10n::t('About:'),
-               */
                '$keywords'      => $r[0]['keywords'],
                '$keywords_label'=> L10n::t('Tags:')
        ]);
index 6160642762a4adcbc427d6f21b048fa62df60c19..101ebd5af2e4e1b9068e9550368ef7bad137565c 100644 (file)
@@ -96,20 +96,20 @@ function hovercard_content()
 
        // Move the contact data to the profile array so we can deliver it to
        $profile = [
-               'name'     => $contact['name'],
-               'nick'     => $contact['nick'],
-               'addr'     => defaults($contact, 'addr', $contact['url']),
-               'thumb'    => ProxyUtils::proxifyUrl($contact['thumb'], false, ProxyUtils::SIZE_THUMB),
-               'url'      => Contact::magicLink($contact['url']),
-               'nurl'     => $contact['nurl'], // We additionally store the nurl as identifier
-               'location' => $contact['location'],
-               'gender'   => $contact['gender'],
-               'about'    => $contact['about'],
-               'network => Strings::formatNetworkName($contact['network'], $contact['url']),
-               'tags'     => $contact['keywords'],
-               'bd'       => $contact['birthday'] <= DBA::NULL_DATE ? '' : $contact['birthday'],
+               'name'         => $contact['name'],
+               'nick'         => $contact['nick'],
+               'addr'         => defaults($contact, 'addr', $contact['url']),
+               'thumb'        => ProxyUtils::proxifyUrl($contact['thumb'], false, ProxyUtils::SIZE_THUMB),
+               'url'          => Contact::magicLink($contact['url']),
+               'nurl'         => $contact['nurl'], // We additionally store the nurl as identifier
+               'location'     => $contact['location'],
+               'gender'       => $contact['gender'],
+               'about'        => $contact['about'],
+               'network_link' => Strings::formatNetworkName($contact['network'], $contact['url']),
+               'tags'         => $contact['keywords'],
+               'bd'           => $contact['birthday'] <= DBA::NULL_DATE ? '' : $contact['birthday'],
                'account_type' => Contact::getAccountType($contact),
-               'actions'  => $actions,
+               'actions'      => $actions,
        ];
        if ($datatype == 'html') {
                $tpl = Renderer::getMarkupTemplate('hovercard.tpl');
index b812f5cdd5c3a130c4fc1e7f6d57db5a75739646..9ef55fbfe83bf4f7eb478593e2a02f9159c91163 100644 (file)
@@ -245,22 +245,22 @@ function message_content(App $a)
 
                $tpl = Renderer::getMarkupTemplate('prv_message.tpl');
                $o .= Renderer::replaceMacros($tpl, [
-                       '$header' => L10n::t('Send Private Message'),
-                       '$to' => L10n::t('To:'),
+                       '$header'     => L10n::t('Send Private Message'),
+                       '$to'         => L10n::t('To:'),
                        '$showinputs' => 'true',
-                       '$prefill' => $prefill,
-                       '$preid' => $preid,
-                       '$subject' => L10n::t('Subject:'),
-                       '$subjtxt' => !empty($_REQUEST['subject']) ? strip_tags($_REQUEST['subject']) : '',
-                       '$text' => !empty($_REQUEST['body']) ? Strings::escapeHtml(htmlspecialchars($_REQUEST['body'])) : '',
-                       '$readonly' => '',
-                       '$yourmessage' => L10n::t('Your message:'),
-                       '$select' => $select,
-                       '$parent' => '',
-                       '$upload' => L10n::t('Upload photo'),
-                       '$insert' => L10n::t('Insert web link'),
-                       '$wait' => L10n::t('Please wait'),
-                       '$submit' => L10n::t('Submit')
+                       '$prefill'    => $prefill,
+                       '$preid'      => $preid,
+                       '$subject'    => L10n::t('Subject:'),
+                       '$subjtxt'    => defaults($_REQUEST, 'subject', ''),
+                       '$text'       => defaults($_REQUEST, 'body', ''),
+                       '$readonly'   => '',
+                       '$yourmessage'=> L10n::t('Your message:'),
+                       '$select'     => $select,
+                       '$parent'     => '',
+                       '$upload'     => L10n::t('Upload photo'),
+                       '$insert'     => L10n::t('Insert web link'),
+                       '$wait'       => L10n::t('Please wait'),
+                       '$submit'     => L10n::t('Submit')
                ]);
                return $o;
        }
index 2c5a54ce5db7ed5ea3be7862144f4edd52e07a78..29a340afdc240c6d8b3c1c786f1c2af388f5674b 100644 (file)
@@ -664,7 +664,7 @@ function networkThreadedView(App $a, $update, $parent)
 
                        $entries[0] = [
                                'id' => 'network',
-                               'name' => htmlentities($contact['name']),
+                               'name' => $contact['name'],
                                'itemurl' => defaults($contact, 'addr', $contact['nurl']),
                                'thumb' => ProxyUtils::proxifyUrl($contact['thumb'], false, ProxyUtils::SIZE_THUMB),
                                'details' => $contact['location'],
index 54c54fa222b00009b4390bb5d23710ed6d5391f5..00c234d157717639ee948ebdc687faad128174a9 100644 (file)
@@ -237,7 +237,7 @@ function notifications_content(App $a)
 
                                        $notif_content[] = Renderer::replaceMacros($tpl, [
                                                '$type'        => $notif['label'],
-                                               '$header'      => htmlentities($header),
+                                               '$header'      => $header,
                                                '$str_notifytype' => L10n::t('Notification type:'),
                                                '$notify_type' => $notif['notify_type'],
                                                '$dfrn_text'   => $dfrn_text,
index 593e2ee19f178d4f356be04b78b837e27b5fa027..51f8ca7534124f8174747d60cfd5a93fa7cca19e 100644 (file)
@@ -33,24 +33,16 @@ function profile_init(App $a)
                $a->page['aside'] = '';
        }
 
-       if ($a->argc > 1) {
-               $which = htmlspecialchars($a->argv[1]);
-       } else {
-               $r = q("SELECT `nickname` FROM `user` WHERE `blocked` = 0 AND `account_expired` = 0 AND `account_removed` = 0 AND `verified` = 1 ORDER BY RAND() LIMIT 1");
-               if (DBA::isResult($r)) {
-                       $a->internalRedirect('profile/' . $r[0]['nickname']);
-               } else {
-                       Logger::log('profile error: mod_profile ' . $a->query_string, Logger::DEBUG);
-                       notice(L10n::t('Requested profile is not available.') . EOL);
-                       $a->error = 404;
-                       return;
-               }
+       if ($a->argc < 2) {
+               System::httpExit(400);
        }
 
+       $which = filter_var($a->argv[1], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_BACKTICK);
+
        $profile = 0;
        if (local_user() && $a->argc > 2 && $a->argv[2] === 'view') {
                $which = $a->user['nickname'];
-               $profile = htmlspecialchars($a->argv[1]);
+               $profile = filter_var($a->argv[1], FILTER_SANITIZE_NUMBER_INT);
        } else {
                DFRN::autoRedir($a, $which);
        }
index f8dfa3ab9fe8e115191b42d29758c8ce87b06da2..33b7d36f91b141e1dbbc944587cd9ac18666d1d4 100644 (file)
@@ -83,14 +83,15 @@ function redir_init(App $a) {
 
                // When the remote page does support OWA, then we enforce the use of it
                $basepath = Contact::getBasepath($contact_url);
-               $serverret = Network::curl($basepath . '/magic');
-               if ($serverret->isSuccess()) {
-                       $contact['issued-id'] = '';
-                       $contact['dfrn-id'] = '';
+               if ($basepath == System::baseUrl()) {
+                       $use_magic = true;
+               } else {
+                       $serverret = Network::curl($basepath . '/magic');
+                       $use_magic = $serverret->isSuccess();
                }
 
                // Doing remote auth with dfrn.
-               if (local_user() && (!empty($contact['dfrn-id']) || !empty($contact['issued-id'])) && empty($contact['pending'])) {
+               if (local_user() && !$use_magic && (!empty($contact['dfrn-id']) || !empty($contact['issued-id'])) && empty($contact['pending'])) {
                        $dfrn_id = $orig_id = (($contact['issued-id']) ? $contact['issued-id'] : $contact['dfrn-id']);
 
                        if ($contact['duplex'] && $contact['issued-id']) {
index 433a4782ff872c15b1fa0afabaffe1f09b155e38..a66c88aefd2d9dcfe993c4d81cef222f11efcbd7 100644 (file)
@@ -114,10 +114,8 @@ function unfollow_content(App $a)
        // Makes the connection request for friendica contacts easier
        $_SESSION['fastlane'] = $contact['url'];
 
-       $header = L10n::t('Disconnect/Unfollow');
-
        $o = Renderer::replaceMacros($tpl, [
-               '$header'        => htmlentities($header),
+               '$header'        => L10n::t('Disconnect/Unfollow'),
                '$desc'          => '',
                '$pls_answer'    => '',
                '$does_know_you' => '',
index 8b7acffbdc90fdd597a8680862101430eea1dad0..d36ea96c7de00248a5e6a572fb0c4ee684ecceeb 100644 (file)
@@ -29,18 +29,13 @@ function viewcontacts_init(App $a)
 
        Nav::setSelected('home');
 
-       $nick = $a->argv[1];
-       $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1",
-               DBA::escape($nick)
-       );
-
-       if (!DBA::isResult($r)) {
+       $user = DBA::selectFirst('user', [], ['nickname' => $a->argv[1], 'blocked' => false]);
+       if (!DBA::isResult($user)) {
                System::httpExit(404, ["title" => L10n::t('Page not found.')]);
        }
 
-       $a->data['user'] = $r[0];
-       $a->profile_uid = $r[0]['uid'];
-       $is_owner = (local_user() && (local_user() == $a->profile_uid));
+       $a->data['user'] = $user;
+       $a->profile_uid  = $user['uid'];
 
        Profile::load($a, $a->argv[1]);
 }
@@ -54,82 +49,69 @@ function viewcontacts_content(App $a)
 
        $is_owner = $a->profile['profile_uid'] == local_user();
 
-       $o = "";
-
        // tabs
-       $o .= Profile::getTabs($a, $is_owner, $a->data['user']['nickname']);
+       $o = Profile::getTabs($a, $is_owner, $a->data['user']['nickname']);
 
        if (!count($a->profile) || $a->profile['hide-friends']) {
                notice(L10n::t('Permission denied.') . EOL);
                return $o;
        }
 
-       $total = 0;
-       $r = q("SELECT COUNT(*) AS `total` FROM `contact`
-               WHERE `uid` = %d AND NOT `blocked` AND NOT `pending`
-                       AND NOT `hidden` AND NOT `archive`
-                       AND `network` IN ('%s', '%s', '%s', '%s')",
-               intval($a->profile['uid']),
-               DBA::escape(Protocol::ACTIVITYPUB),
-               DBA::escape(Protocol::DFRN),
-               DBA::escape(Protocol::DIASPORA),
-               DBA::escape(Protocol::OSTATUS)
-       );
-       if (DBA::isResult($r)) {
-               $total = $r[0]['total'];
-       }
+       $condition = [
+               'uid'     => $a->profile['uid'],
+               'blocked' => false,
+               'pending' => false,
+               'hidden'  => false,
+               'archive' => false,
+               'network' => [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]
+       ];
+
+       $total = DBA::count('count', $condition);
+
        $pager = new Pager($a->query_string);
 
-       $r = q("SELECT * FROM `contact`
-               WHERE `uid` = %d AND NOT `blocked` AND NOT `pending`
-                       AND NOT `hidden` AND NOT `archive`
-                       AND `network` IN ('%s', '%s', '%s', '%s')
-               ORDER BY `name` ASC LIMIT %d, %d",
-               intval($a->profile['uid']),
-               DBA::escape(Protocol::ACTIVITYPUB),
-               DBA::escape(Protocol::DFRN),
-               DBA::escape(Protocol::DIASPORA),
-               DBA::escape(Protocol::OSTATUS),
-               $pager->getStart(),
-               $pager->getItemsPerPage()
-       );
-       if (!DBA::isResult($r)) {
-               info(L10n::t('No contacts.').EOL);
+       $params = ['order' => ['name' => false], 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
+
+       $contacts_stmt = DBA::select('contact', [], $condition, $params);
+
+       if (!DBA::isResult($contacts_stmt)) {
+               info(L10n::t('No contacts.') . EOL);
                return $o;
        }
 
        $contacts = [];
 
-       foreach ($r as $rr) {
+       while ($contact = DBA::fetch($contacts_stmt)) {
                /// @TODO This triggers an E_NOTICE if 'self' is not there
-               if ($rr['self']) {
+               if ($contact['self']) {
                        continue;
                }
 
-               $contact_details = Contact::getDetailsByURL($rr['url'], $a->profile['uid'], $rr);
+               $contact_details = Contact::getDetailsByURL($contact['url'], $a->profile['uid'], $contact);
 
                $contacts[] = [
-                       'id' => $rr['id'],
-                       'img_hover' => L10n::t('Visit %s\'s profile [%s]', $contact_details['name'], $rr['url']),
-                       'photo_menu' => Contact::photoMenu($rr),
-                       'thumb' => ProxyUtils::proxifyUrl($contact_details['thumb'], false, ProxyUtils::SIZE_THUMB),
-                       'name' => htmlentities(substr($contact_details['name'], 0, 20)),
-                       'username' => htmlentities($contact_details['name']),
-                       'details'       => $contact_details['location'],
-                       'tags'          => $contact_details['keywords'],
-                       'about'         => $contact_details['about'],
-                       'account_type'  => Contact::getAccountType($contact_details),
-                       'url' => Contact::magicLink($rr['url']),
-                       'sparkle' => '',
-                       'itemurl' => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
-                       'network' => ContactSelector::networkToName($rr['network'], $rr['url']),
+                       'id'           => $contact['id'],
+                       'img_hover'    => L10n::t('Visit %s\'s profile [%s]', $contact_details['name'], $contact['url']),
+                       'photo_menu'   => Contact::photoMenu($contact),
+                       'thumb'        => ProxyUtils::proxifyUrl($contact_details['thumb'], false, ProxyUtils::SIZE_THUMB),
+                       'name'         => substr($contact_details['name'], 0, 20),
+                       'username'     => $contact_details['name'],
+                       'details'      => $contact_details['location'],
+                       'tags'         => $contact_details['keywords'],
+                       'about'        => $contact_details['about'],
+                       'account_type' => Contact::getAccountType($contact_details),
+                       'url'          => Contact::magicLink($contact['url']),
+                       'sparkle'      => '',
+                       'itemurl'      => (($contact_details['addr'] != "") ? $contact_details['addr'] : $contact['url']),
+                       'network'      => ContactSelector::networkToName($contact['network'], $contact['url']),
                ];
        }
 
+       DBA::close($contacts_stmt);
 
        $tpl = Renderer::getMarkupTemplate("viewcontact_template.tpl");
        $o .= Renderer::replaceMacros($tpl, [
-               '$title' => L10n::t('Contacts'),
+               '$title'    => L10n::t('Contacts'),
                '$contacts' => $contacts,
                '$paginate' => $pager->renderFull($total),
        ]);
index d93104644ed6462426b2dbb3afec7517f35b76d3..780230b8c700e479dfc28744b41877ddb9b88f40 100644 (file)
@@ -125,20 +125,20 @@ function wallmessage_content(App $a) {
 
        $tpl = Renderer::getMarkupTemplate('wallmessage.tpl');
        $o = Renderer::replaceMacros($tpl, [
-               '$header' => L10n::t('Send Private Message'),
-               '$subheader' => L10n::t('If you wish for %s to respond, please check that the privacy settings on your site allow private mail from unknown senders.', $user['username']),
-               '$to' => L10n::t('To:'),
-               '$subject' => L10n::t('Subject:'),
-               '$recipname' => $user['username'],
-               '$nickname' => $user['nickname'],
-               '$subjtxt' => (!empty($_REQUEST['subject']) ? strip_tags($_REQUEST['subject']) : ''),
-               '$text' => (!empty($_REQUEST['body']) ? Strings::escapeHtml(htmlspecialchars($_REQUEST['body'])) : ''),
-               '$readonly' => '',
-               '$yourmessage' => L10n::t('Your message:'),
-               '$parent' => '',
-               '$upload' => L10n::t('Upload photo'),
-               '$insert' => L10n::t('Insert web link'),
-               '$wait' => L10n::t('Please wait')
+               '$header'     => L10n::t('Send Private Message'),
+               '$subheader'  => L10n::t('If you wish for %s to respond, please check that the privacy settings on your site allow private mail from unknown senders.', $user['username']),
+               '$to'         => L10n::t('To:'),
+               '$subject'    => L10n::t('Subject:'),
+               '$recipname'  => $user['username'],
+               '$nickname'   => $user['nickname'],
+               '$subjtxt'    => defaults($_REQUEST, 'subject', ''),
+               '$text'       => defaults($_REQUEST, 'body', ''),
+               '$readonly'   => '',
+               '$yourmessage'=> L10n::t('Your message:'),
+               '$parent'     => '',
+               '$upload'     => L10n::t('Upload photo'),
+               '$insert'     => L10n::t('Insert web link'),
+               '$wait'       => L10n::t('Please wait')
        ]);
 
        return $o;
index e452e68353e5f8db7af39068e94882075157c5a5..276094a8f9e9d691c0eb743b0cf74bc69fa4bd24 100644 (file)
@@ -961,7 +961,7 @@ class HTML
                $save_label = $mode === 'text' ? L10n::t('Save') : L10n::t('Follow');
 
                $values = [
-                               '$s' => htmlspecialchars($s),
+                               '$s' => $s,
                                '$id' => $id,
                                '$action_url' => $url,
                                '$search_label' => L10n::t('Search'),
index 0169f7292b18758d96b1894e53b9536ca7f77b36..b899272cabf3d22cf6e942d345354ec608f951f1 100644 (file)
@@ -440,6 +440,13 @@ class Installer
                );
                $returnVal = $returnVal ? $status : false;
 
+               $status = $this->checkFunction('json_encode',
+                       L10n::t('JSON PHP module'),
+                       L10n::t('Error: JSON PHP module required but not installed.'),
+                       true
+               );
+               $returnVal = $returnVal ? $status : false;
+
                return $returnVal;
        }
 
index 784a9ffee86a6ec5a7b2e2703f26f408f54b8800..ce77ee7a9376bf51a39d8822f6d26af422b64ed4 100644 (file)
@@ -14,9 +14,9 @@ use Friendica\Core\PConfig;
 use Friendica\Core\Renderer;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
-use Friendica\Model\Contact;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Map;
+use Friendica\Util\Strings;
 use Friendica\Util\XML;
 
 /**
@@ -49,11 +49,11 @@ class Event extends BaseObject
 
                if ($simple) {
                        if (!empty($event['summary'])) {
-                               $o = "<h3>" . BBCode::convert($event['summary'], false, $simple) . "</h3>";
+                               $o = "<h3>" . BBCode::convert(Strings::escapeHtml($event['summary']), false, $simple) . "</h3>";
                        }
 
                        if (!empty($event['desc'])) {
-                               $o .= "<div>" . BBCode::convert($event['desc'], false, $simple) . "</div>";
+                               $o .= "<div>" . BBCode::convert(Strings::escapeHtml($event['desc']), false, $simple) . "</div>";
                        }
 
                        $o .= "<h4>" . L10n::t('Starts:') . "</h4><p>" . $event_start . "</p>";
@@ -63,7 +63,7 @@ class Event extends BaseObject
                        }
 
                        if (!empty($event['location'])) {
-                               $o .= "<h4>" . L10n::t('Location:') . "</h4><p>" . BBCode::convert($event['location'], false, $simple) . "</p>";
+                               $o .= "<h4>" . L10n::t('Location:') . "</h4><p>" . BBCode::convert(Strings::escapeHtml($event['location']), false, $simple) . "</p>";
                        }
 
                        return $o;
@@ -71,7 +71,7 @@ class Event extends BaseObject
 
                $o = '<div class="vevent">' . "\r\n";
 
-               $o .= '<div class="summary event-summary">' . BBCode::convert($event['summary'], false, $simple) . '</div>' . "\r\n";
+               $o .= '<div class="summary event-summary">' . BBCode::convert(Strings::escapeHtml($event['summary']), false, $simple) . '</div>' . "\r\n";
 
                $o .= '<div class="event-start"><span class="event-label">' . L10n::t('Starts:') . '</span>&nbsp;<span class="dtstart" title="'
                        . DateTimeFormat::utc($event['start'], (!empty($event['adjust']) ? DateTimeFormat::ATOM : 'Y-m-d\TH:i:s'))
@@ -86,12 +86,12 @@ class Event extends BaseObject
                }
 
                if (!empty($event['desc'])) {
-                       $o .= '<div class="description event-description">' . BBCode::convert($event['desc'], false, $simple) . '</div>' . "\r\n";
+                       $o .= '<div class="description event-description">' . BBCode::convert(Strings::escapeHtml($event['desc']), false, $simple) . '</div>' . "\r\n";
                }
 
                if (!empty($event['location'])) {
                        $o .= '<div class="event-location"><span class="event-label">' . L10n::t('Location:') . '</span>&nbsp;<span class="location">'
-                               . BBCode::convert($event['location'], false, $simple)
+                               . BBCode::convert(Strings::escapeHtml($event['location']), false, $simple)
                                . '</span></div>' . "\r\n";
 
                        // Include a map of the location if the [map] BBCode is used.
@@ -588,10 +588,9 @@ class Event extends BaseObject
                                $drop =                  [System::baseUrl() . '/events/drop/' . $event['id'] , L10n::t('Delete event')   , '', ''];
                        }
 
-                       $title = strip_tags(html_entity_decode(BBCode::convert($event['summary']), ENT_QUOTES, 'UTF-8'));
+                       $title = BBCode::convert(Strings::escapeHtml($event['summary']));
                        if (!$title) {
-                               list($title, $_trash) = explode("<br", BBCode::convert($event['desc']), 2);
-                               $title = strip_tags(html_entity_decode($title, ENT_QUOTES, 'UTF-8'));
+                               list($title, $_trash) = explode("<br", BBCode::convert(Strings::escapeHtml($event['desc'])), 2);
                        }
 
                        $author_link = $event['author-link'];
@@ -601,8 +600,9 @@ class Event extends BaseObject
                        $event['plink']       = Contact::magicLink($author_link, $plink);
 
                        $html = self::getHTML($event);
-                       $event['desc']     = BBCode::convert($event['desc']);
-                       $event['location'] = BBCode::convert($event['location']);
+                       $event['summary']  = BBCode::convert(Strings::escapeHtml($event['summary']));
+                       $event['desc']     = BBCode::convert(Strings::escapeHtml($event['desc']));
+                       $event['location'] = BBCode::convert(Strings::escapeHtml($event['location']));
                        $event_list[] = [
                                'id'       => $event['id'],
                                'start'    => $start,
index c0ee3ec6bb5d99c11188ca995ccfa930be983a58..bd455bc6ba4ca4898bf736b85c245d31d6fe5b05 100644 (file)
@@ -295,9 +295,9 @@ class Profile
                $profile['picdate'] = urlencode(defaults($profile, 'picdate', ''));
 
                if (($profile['network'] != '') && ($profile['network'] != Protocol::DFRN)) {
-                       $profile['network_name'] = Strings::formatNetworkName($profile['network'], $profile['url']);
+                       $profile['network_link'] = Strings::formatNetworkName($profile['network'], $profile['url']);
                } else {
-                       $profile['network_name'] = '';
+                       $profile['network_link'] = '';
                }
 
                Addon::callHooks('profile_sidebar_enter', $profile);
@@ -510,10 +510,8 @@ class Profile
                        $p['about'] = BBCode::convert($p['about']);
                }
 
-               if (isset($p['address'])) {
-                       $p['address'] = BBCode::convert($p['address']);
-               } elseif (isset($p['location'])) {
-                       $p['address'] = BBCode::convert($p['location']);
+               if (empty($p['address']) && !empty($p['location'])) {
+                       $p['address'] = $p['location'];
                }
 
                if (isset($p['photo'])) {
index d12f003c2e2a24e05e235022fc0754a758d57c63..410f5878bb3f9fb20d2f01c5f182f889f8e0c2ec 100644 (file)
@@ -75,18 +75,17 @@ class Contact extends BaseModule
                        $a->data['contact'] = $contact;
 
                        if (($contact['network'] != '') && ($contact['network'] != Protocol::DFRN)) {
-                               $networkname = Strings::formatNetworkName($contact['network'], $contact['url']);
+                               $network_link = Strings::formatNetworkName($contact['network'], $contact['url']);
                        } else {
-                               $networkname = '';
+                               $network_link = '';
                        }
 
-                       /// @TODO Add nice spaces
                        $vcard_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('vcard-widget.tpl'), [
                                '$name'         => $contact['name'],
                                '$photo'        => $contact['photo'],
                                '$url'          => Model\Contact::MagicLink($contact['url']),
                                '$addr'         => defaults($contact, 'addr', ''),
-                               '$network_name' => $networkname,
+                               '$network_link' => $network_link,
                                '$network'      => L10n::t('Network:'),
                                '$account_type' => Model\Contact::getAccountType($contact)
                        ]);
@@ -511,7 +510,7 @@ class Contact extends BaseModule
                                $relation_text = '';
                        }
 
-                       $relation_text = sprintf($relation_text, htmlentities($contact['name']));
+                       $relation_text = sprintf($relation_text, $contact['name']);
 
                        $url = Model\Contact::magicLink($contact['url']);
                        if (strpos($url, 'redir/') === 0) {
@@ -643,7 +642,7 @@ class Contact extends BaseModule
                                '$profileurllabel'=> L10n::t('Profile URL'),
                                '$profileurl'     => $contact['url'],
                                '$account_type'   => Model\Contact::getAccountType($contact),
-                               '$location'       => BBCode::convert($contact['location']),
+                               '$location'       => $contact['location'],
                                '$location_label' => L10n::t('Location:'),
                                '$xmpp'           => BBCode::convert($contact['xmpp']),
                                '$xmpp_label'     => L10n::t('XMPP:'),
index 2da679eeefffd725cc3cb680d71bf37badd474e5..4d85ef15ceff2a408a79087e92234daf4f349ae5 100644 (file)
@@ -25,12 +25,12 @@ class Itemsource extends \Friendica\BaseModule
                        $conversation = Model\Conversation::getByItemUri($item['uri']);
 
                        $item_uri = $item['uri'];
-                       $source = htmlspecialchars($conversation['source']);
+                       $source = $conversation['source'];
                }
 
                $tpl = Renderer::getMarkupTemplate('debug/itemsource.tpl');
                $o = Renderer::replaceMacros($tpl, [
-                       '$guid'          => ['guid', L10n::t('Item Guid'), htmlentities(defaults($_REQUEST, 'guid', '')), ''],
+                       '$guid'          => ['guid', L10n::t('Item Guid'), defaults($_REQUEST, 'guid', ''), ''],
                        '$source'        => $source,
                        '$item_uri'      => $item_uri
                ]);
index bff8767f380a4a76a9ff43c6892b623f2110e1d7..d2f5b3b2d5bc44b2cd08c29eb3232158caabf16f 100644 (file)
@@ -209,20 +209,20 @@ class Processor
         */
        public static function createEvent($activity, $item)
        {
-               $event['summary'] = $activity['name'];
-               $event['desc'] = $activity['content'];
-               $event['start'] = $activity['start-time'];
-               $event['finish'] = $activity['end-time'];
+               $event['summary']  = HTML::toBBCode($activity['name']);
+               $event['desc']     = HTML::toBBCode($activity['content']);
+               $event['start']    = $activity['start-time'];
+               $event['finish']   = $activity['end-time'];
                $event['nofinish'] = empty($event['finish']);
                $event['location'] = $activity['location'];
-               $event['adjust'] = true;
-               $event['cid'] = $item['contact-id'];
-               $event['uid'] = $item['uid'];
-               $event['uri'] = $item['uri'];
-               $event['edited'] = $item['edited'];
-               $event['private'] = $item['private'];
-               $event['guid'] = $item['guid'];
-               $event['plink'] = $item['plink'];
+               $event['adjust']   = true;
+               $event['cid']      = $item['contact-id'];
+               $event['uid']      = $item['uid'];
+               $event['uri']      = $item['uri'];
+               $event['edited']   = $item['edited'];
+               $event['private']  = $item['private'];
+               $event['guid']     = $item['guid'];
+               $event['plink']    = $item['plink'];
 
                $condition = ['uri' => $item['uri'], 'uid' => $item['uid']];
                $ev = DBA::selectFirst('event', ['id'], $condition);
index 4ce6ef7010f478b8c7a0daca4bf51368a6b9c9c9..64009581b5e2dea80f6e6c808766624e753cb98f 100644 (file)
@@ -3724,12 +3724,12 @@ class Diaspora
                } elseif (in_array($item["verb"], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) {
                        $message = self::constructLike($item, $owner);
                        $type = "like";
-               } else {
+               } elseif (!in_array($item["verb"], [ACTIVITY_FOLLOW])) {
                        $message = self::constructComment($item, $owner);
                        $type = "comment";
                }
 
-               if (!$message) {
+               if (empty($message)) {
                        return false;
                }
 
index f446461f669c6b065548283e97c56dae8cf0b3a8..3300b1d7abe28ce040caa1ebfea001308b56362a 100644 (file)
@@ -1376,7 +1376,7 @@ class PortableContact
                                        $info = defaults($data, 'info', '');
                                        $register_policy = defaults($data, 'register_policy', REGISTER_CLOSED);
                                        if (in_array($register_policy, ['REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN'])) {
-                                               $register_policy = constant($data['register_policy']);
+                                               $register_policy = constant($register_policy);
                                        } else {
                                                Logger::log("Register policy '$register_policy' from $server_url is invalid.");
                                                $register_policy = REGISTER_CLOSED; // set a default value
index 48e580d67892587ab648f2f0960c8a5193094caf..473774b71dba283c7cbecf28e9a99d8f2a25cd5d 100644 (file)
@@ -140,18 +140,18 @@ class Strings
     }
 
     /**
-     * @brief translate and format the networkname of a contact
+     * @brief Translate and format the network name of a contact
      *
-     * @param string $network   Networkname of the contact (e.g. dfrn, rss and so on)
-     * @param string $url       The contact url
+     * @param string $network Network name of the contact (e.g. dfrn, rss and so on)
+     * @param string $url     The contact url
      * 
-     * @return string   Formatted network name
+     * @return string Formatted network name
      */
-    public static function formatNetworkName($network, $url = 0)
+    public static function formatNetworkName($network, $url = '')
     {
-        if ($network != "") {
-            if ($url != "") {
-                $network_name = '<a href="' . $url  .'">' . ContactSelector::networkToName($network, $url) . "</a>";
+        if ($network != '') {
+            if ($url != '') {
+                $network_name = '<a href="' . $url  .'">' . ContactSelector::networkToName($network, $url) . '</a>';
             } else {
                 $network_name = ContactSelector::networkToName($network);
             }
@@ -161,7 +161,7 @@ class Strings
     }
 
     /**
-     * @brief Remove intentation from a text
+     * @brief Remove indentation from a text
      * 
      * @param string $text  String to be transformed.
      * @param string $chr   Optional. Indentation tag. Default tab (\t).
index b15b91e14c6bde0969d1c83ebb610a95f059940f..564c2562a877ca37c8f1db3700a565b958b5cc52 100644 (file)
@@ -43,6 +43,8 @@ class InstallerTest extends MockedTest
                $this->mockL10nT('Error: iconv PHP module required but not installed.', 1);
                $this->mockL10nT('POSIX PHP module', 1);
                $this->mockL10nT('Error: POSIX PHP module required but not installed.', 1);
+               $this->mockL10nT('JSON PHP module', 1);
+               $this->mockL10nT('Error: JSON PHP module required but not installed.', 1);
        }
 
        private function assertCheckExist($position, $title, $help, $status, $required, $assertionArray)
@@ -177,6 +179,17 @@ class InstallerTest extends MockedTest
                        true,
                        $install->getChecks());
 
+               $this->mockFunctionL10TCalls();
+               $this->setFunctions(['json_encode' => false]);
+               $install = new Installer();
+               $this->assertFalse($install->checkFunctions());
+               $this->assertCheckExist(9,
+                       'JSON PHP module',
+                       'Error: JSON PHP module required but not installed.',
+                       false,
+                       true,
+                       $install->getChecks());
+
                $this->mockFunctionL10TCalls();
                $this->setFunctions([
                        'curl_init' => true,
@@ -184,7 +197,8 @@ class InstallerTest extends MockedTest
                        'openssl_public_encrypt' => true,
                        'mb_strlen' => true,
                        'iconv_strlen' => true,
-                       'posix_kill' => true
+                       'posix_kill' => true,
+                       'json_encode' => true
                ]);
                $install = new Installer();
                $this->assertTrue($install->checkFunctions());
index 659864af3622c0712d04a7570a77e6460e14f711..caa829621aa924ddb11df51c3ff2026e9b34194f 100644 (file)
@@ -21,7 +21,7 @@
                        <h3 class="panel-title">{{$result.title}}</h3>
                </div>
                <div class="panel-body">
-                       {{$result.content}}
+                       {{$result.content nofilter}}
                </div>
        </div>
        {{/foreach}}
index accfd4f83f162bcf5054a3bd1c73d3fd64351e49..693f8cbf92d13bb74099122e6f07c115f67cd3fa 100644 (file)
 <input type="hidden" name="dfrn_url" value="{{$dfrn_url}}" />
 <input type="hidden" name="confirm_key" value="{{$confirm_key}}" />
 <input type="hidden" name="localconfirm" value="1" />
-{{$aes_allow}}
+{{$aes_allow nofilter}}
 
 <label id="dfrn-request-homecoming-hide-label" for="dfrn-request-homecoming-hide">{{$hidethem}}</label>
-<input type="checkbox" name="hidden-contact" value="1" {{if $hidechecked}}checked="checked" {{/if}} />
+<input type="checkbox" name="hidden-contact" value="1" />
 
 
 <div id="dfrn-request-homecoming-submit-wrapper" >
index 94fac7447134f5ad9c86b36e274d5686efa9604d..d9eeb841fd9b22a50cfce991022878bbefdf0331 100644 (file)
@@ -1,4 +1,3 @@
-
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional //EN">
 <html>
 <head>
@@ -6,28 +5,33 @@
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
 </head>
 <body>
-<table style="border:1px solid #ccc">
+       <table style="border:1px solid #ccc">
        <tbody>
-       <tr><td colspan="2" style="background:#084769; color:#FFFFFF; font-weight:bold; font-family:'lucida grande', tahoma, verdana,arial, sans-serif; padding: 4px 8px; vertical-align: middle; font-size:16px; letter-spacing: -0.03em; text-align: left;"><img style="width:32px;height:32px; float:left;" src='{{$siteurl}}/images/friendica-32.png'><div style="padding:7px; margin-left: 5px; float:left; font-size:18px;letter-spacing:1px;">{{$product}}</div><div style="clear: both;"></div></td></tr>
-
+               <tr>
+                       <td colspan="2" style="background:#084769; color:#FFFFFF; font-weight:bold; font-family:'lucida grande', tahoma, verdana,arial, sans-serif; padding: 4px 8px; vertical-align: middle; font-size:16px; letter-spacing: -0.03em; text-align: left;">
+                               <img style="width:32px;height:32px; float:left;" src='{{$siteurl}}/images/friendica-32.png'>
+                               <div style="padding:7px; margin-left: 5px; float:left; font-size:18px;letter-spacing:1px;">{{$product}}</div>
+                               <div style="clear: both;"></div>
+                       </td>
+               </tr>
 
-       <tr><td style="padding-top:22px;" colspan="2">{{$preamble}}</td></tr>
+               <tr><td colspan="2" style="padding-top:22px;">{{$preamble nofilter}}</td></tr>
 
-
-       {{if $content_allowed}}
+{{if $content_allowed}}
        {{if $source_photo}}
-       <tr><td style="padding-left:22px;padding-top:22px;width:60px;" valign="top" rowspan=3><a href="{{$source_link}}"><img style="border:0px;width:48px;height:48px;" src="{{$source_photo}}"></a></td>
-               <td style="padding-top:22px;"><a href="{{$source_link}}">{{$source_name}}</a></td></tr>
-       {{/if}}
-       <tr><td style="font-weight:bold;padding-bottom:5px;">{{$title}}</td></tr>
-       <tr><td style="padding-right:22px;">{{$htmlversion}}</td></tr>
-       {{/if}}
-       <tr><td style="padding-top:11px;" colspan="2">{{$hsitelink}}</td></tr>
-       <tr><td style="padding-bottom:11px;" colspan="2">{{$hitemlink}}</td></tr>
-       <tr><td></td><td>{{$thanks}}</td></tr>
-       <tr><td></td><td>{{$site_admin}}</td></tr>
+               <tr>
+                       <td style="padding-left:22px;padding-top:22px;width:60px;" valign="top" rowspan=3><a href="{{$source_link}}"><img style="border:0px;width:48px;height:48px;" src="{{$source_photo}}"></a></td>
+                       <td style="padding-top:22px;"><a href="{{$source_link}}">{{$source_name}}</a></td>
+               </tr>
+               {{/if}}
+               <tr><td style="font-weight:bold;padding-bottom:5px;">{{$title}}</td></tr>
+               <tr><td style="padding-right:22px;">{{$htmlversion nofilter}}</td></tr>
+{{/if}}
+               <tr><td colspan="2" style="padding-top:11px;">{{$hsitelink nofilter}}</td></tr>
+               <tr><td colspan="2" style="padding-bottom:11px;">{{$hitemlink nofilter}}</td></tr>
+               <tr><td></td><td>{{$thanks}}</td></tr>
+               <tr><td></td><td>{{$site_admin}}</td></tr>
        </tbody>
-</table>
+       </table>
 </body>
 </html>
-
index 0c259c440e9bd38f6f67684b136a6e6333e51518..a688f57b202c1a25c16f21d868a24722e73f971b 100644 (file)
@@ -12,7 +12,7 @@
                                </div>
                                <div class="profile-details">
                                        <span class="profile-addr">{{$profile.addr}}</span>
-                                       {{if $profile.network}}<span class="profile-network"> ({{$profile.network}})</span>{{/if}}
+                                       {{if $profile.network_link}}<span class="profile-network">({{$profile.network_link nofilter}})</span>{{/if}}
                                </div>
                                {{*{{if $profile.about}}<div class="profile-details profile-about">{{$profile.about nofilter}}</div>{{/if}}*}}
 
index d5c3d68269f5ac0f344dfce07e5a90f4688800b4..4f5be40fc500f1e251db1db71941e3b0ff5b4b04 100644 (file)
 {{/if}}
 {{if $tags.2}}<div id="tag-remove"><a href="{{$tags.2}}">{{$tags.3}}</a></div>{{/if}}
 
-{{if $edit}}{{$edit}}{{/if}}
+{{if $edit}}{{$edit nofilter}}{{/if}}
 
 {{if $likebuttons}}
 <div id="photo-like-div">
-       {{$likebuttons}}
-       {{$like}}
-       {{$dislike}}    
+       {{$likebuttons nofilter}}
+       {{$like nofilter}}
+       {{$dislike nofilter}}
 </div>
 {{/if}}
 
-{{$comments}}
+{{$comments nofilter}}
 
 {{$paginate nofilter}}
 
index f10a21ca6c97b0a3fcb60e21c42fbf6bc41871fe..124fca154f16f965182c249a31b26e42208ea0f3 100644 (file)
@@ -13,7 +13,7 @@
                <div id="profile-photo-wrapper"><a href="{{$profile.url}}"><img class="photo u-photo" width="175" height="175" src="{{$profile.photo}}" alt="{{$profile.name}}"></a></div>
        {{/if}}
        {{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}}
-       {{if $profile.network_name}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_name nofilter}}</dd></dl>{{/if}}
+       {{if $profile.network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_link nofilter}}</dd></dl>{{/if}}
        {{if $location}}
                <dl class="location"><dt class="location-label">{{$location}}</dt> 
                <dd class="adr h-adr">
index 47b64b68dafe5d0f561b8071ff3e0340173d527c..240466460efff31630eb2baee11472f5db73d44a 100644 (file)
@@ -9,6 +9,6 @@
        <div id="profile-photo-wrapper"><img class="vcard-photo photo u-photo" style="width: 175px; height: 175px;" src="{{$photo}}" alt="{{$name}}" /></div>
        {{/if}}
        {{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}}
-       {{if $network_name}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$network_name}}</dd></dl>{{/if}}
+       {{if $network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$network_link nofilter}}</dd></dl>{{/if}}
        <div id="profile-vcard-break"></div>
 </div>
index e89cf7952b4aa2d7ebf26664d521f3b575f6f027..29f95fe4970e8e7fcaaa8b7ce3e2d18d0e8a36c0 100644 (file)
@@ -1,4 +1,4 @@
-
+<div class="generic-page-wrapper">
 
 <h3>{{$header}}</h3>
 
@@ -31,3 +31,4 @@
 <div id="prvmail-end"></div>
 </form>
 </div>
+</div>
index 502750794311bb0e9a1ebfba1ffcc4829a409c34..a7d0a0bc5adc13443c4fbc8d98782493385733d2 100644 (file)
@@ -10,7 +10,7 @@
 
        {{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}}
 
-       {{if $profile.network_name}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_name nofilter}}</dd></dl>{{/if}}
+       {{if $profile.network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_link nofilter}}</dd></dl>{{/if}}
 
        {{if $location}}
                <dl class="location"><dt class="location-label">{{$location}}</dt> 
index 4ae4cf77cf0db0d15396e2b1b4308dab90beae1e..e7af64c68c73633cdf762c8e6ae78242419b1f5c 100644 (file)
@@ -188,7 +188,7 @@ We use this part to filter the contacts with jquery.textcomplete *}}
                                {/if}
                                {if $photo_menu.edit}
                                <a class="contact-action-link btn-link" href="{$photo_menu.edit.1}" data-toggle="tooltip" title="{$photo_menu.edit.0}">
-                                       <i class="fa fa-pencil" aria-hidden="true"></i>
+                                       <i class="fa fa-user" aria-hidden="true"></i>
                                </a>
                                {/if}
                                {if $photo_menu.drop}
index 330f88cbbbe95b00d6941ae52f33a7d81e3eb197..9264e9d2e3e92861606755ccb185b826475ff3d9 100644 (file)
@@ -12,7 +12,8 @@
                                        </span>
                                </div>
                                <div class="event-card-content media-body">
-                                       <div class="event-title event-card-title summary event-summary">{{$title}}</div>
+                                       <div class="event-title event-card-title summary event-summary">{{$title nofilter}}</div>
+
                                        {{* If there is a map, we insert a button for showing/hiding the map *}}
                                        {{if $location.map}}<button id="event-map-btn-{{$id}}" class="event-map-btn btn-link fakelink nav nav-pills preferences" data-map-id="event-location-map-{{$id}}" data-show-label="{{$show_map_label}}" data-hide-label="{{$hide_map_label}}">{{$map_btn_label}}</button>{{/if}}
                                        <div class="event-property">
index 05f8fc5a3748abb64b1c13b5957a6216aca6077a..baf2e844870f04fbd48445cc9766e17380083cd5 100644 (file)
@@ -1,7 +1,7 @@
 
        <div class="form-group field textarea">
                <label for="id_{{$field.0}}">{{$field.1}}</label>
-               <textarea class="form-control text-autosize" name="{{$field.0}}" id="id_{{$field.0}}" {{if $field.4}}{{$field.4}}{{/if}} aria-describedby="{{$field.0}}_tip">{{$field.2 nofilter}}</textarea>
+               <textarea class="form-control text-autosize" name="{{$field.0}}" id="id_{{$field.0}}" {{if $field.4}}{{$field.4}}{{/if}} aria-describedby="{{$field.0}}_tip">{{$field.2}}</textarea>
                {{if $field.3}}
                <span class="help-block" id="{{$field.0}}_tip" role="tooltip">{{$field.3 nofilter}}</span>
                {{/if}}
index 1d39b16eefac7bfa03521f076dc393dedc4b600c..359c42669622c9f334451048c163f9c3f8c41717 100644 (file)
                {{/if}}
 
                {{* The part for editing the photo - only available for the edit subpage *}}
-               {{if $edit}}{{$edit}}{{/if}}
+               {{if $edit}}{{$edit nofilter}}{{/if}}
 
                {{if $likebuttons}}
                <div id="photo-like-div">
-                       {{$likebuttons}}
-                       {{$like}}
-                       {{$dislike}}
+                       {{$likebuttons nofilter}}
+                       {{$like nofilter}}
+                       {{$dislike nofilter}}
                </div>
                {{/if}}
                <hr>
@@ -82,7 +82,7 @@
 
        {{* Insert the comments *}}
        <div id="photo-comment-wrapper-{{$id}}" class="photo-comment-wrapper">
-               {{$comments}}
+               {{$comments nofilter}}
        </div>
 
        {{$paginate nofilter}}
index f65db725b2bcf8aaeab9e96b26e8a4a0554b993e..0eae2841bd3e200d19e06e5ca96017f7e5284c77 100644 (file)
@@ -32,7 +32,7 @@
 
                        {{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}}
 
-                       {{if $network_name}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$network_name nofilter}}</dd></dl>{{/if}}
+                       {{if $network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$network_link nofilter}}</dd></dl>{{/if}}
                </div>
        </div>
 </div>
index cd1a7ccc99d2b19d92651314bcb1d3267047022e..0b65c2c5352f5d87f03901a05992581f067df1ea 100644 (file)
 {{/if}}
 {{if $tags.2}}<div id="tag-remove"><a href="{{$tags.2}}">{{$tags.3}}</a></div>{{/if}}
 
-{{if $edit}}{{$edit}}{{/if}}
+{{if $edit}}{{$edit nofilter}}{{/if}}
 
 {{if $likebuttons}}
 <div id="photo-like-div">
-       {{$likebuttons}}
-       {{$like}}
-       {{$dislike}}    
+       {{$likebuttons nofilter}}
+       {{$like nofilter}}
+       {{$dislike nofilter}}
 </div>
 {{/if}}
 
 <div class="wall-item-comment-wrapper photo">
-    {{$comments}}
+    {{$comments nofilter}}
 </div>
 
 {{$paginate nofilter}}
index 6e81bd90cf6eda95b7025a57f7707c5169827378..68028fe91e97f100d46fa8732886059645eddb84 100644 (file)
@@ -33,7 +33,7 @@
 
        {{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}}
 
-       {{if $profile.network_name}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_name nofilter}}</dd></dl>{{/if}}
+       {{if $profile.network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_link nofilter}}</dd></dl>{{/if}}
 
        {{if $location}}
                <dl class="location"><dt class="location-label">{{$location}}</dt> 
index 21eda89b353b25136133aef9ebe11bb3f30134ba..aa3f7aadd5d03f99fdf634a40f77eeb39b27f629 100644 (file)
 {{/if}}
 {{if $tags.2}}<div id="tag-remove"><a href="{{$tags.2}}">{{$tags.3}}</a></div>{{/if}}
 
-{{if $edit}}{{$edit}}{{/if}}
+{{if $edit}}{{$edit nofilter}}{{/if}}
 
 {{if $likebuttons}}
 <div id="photo-like-div">
-       {{$likebuttons}}
-       {{$like}}
-       {{$dislike}}    
+       {{$likebuttons nofilter}}
+       {{$like nofilter}}
+       {{$dislike nofilter}}
 </div>
 {{/if}}
 
 <div class="wall-item-comment-wrapper photo">
-{{$comments}}
+       {{$comments nofilter}}
 </div>
 
 {{$paginate nofilter}}
index 2acca2fd09174677db2fbd2486e8700f43533b24..b37f5d25916b34cb69b23a3328f2d12b82c6d1b9 100644 (file)
@@ -24,7 +24,7 @@
        {{/if}}
 
        {{if $account_type}}<div class="account-type">{{$account_type}}</div>{{/if}}
-       {{if $profile.network_name}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_name nofilter}}</dd></dl>{{/if}}
+       {{if $profile.network_link}}<dl class="network"><dt class="network-label">{{$network}}</dt><dd class="x-network">{{$profile.network_link nofilter}}</dd></dl>{{/if}}
        {{if $location}}
                <dl class="location"><dt class="location-label">{{$location}}</dt> 
                <dd class="adr h-adr">