]> git.mxchange.org Git - friendica.git/commitdiff
Removed notices that revealed themselfes over night ... (#5645)
authorMichael Vogel <icarus@dabo.de>
Tue, 21 Aug 2018 15:35:09 +0000 (17:35 +0200)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Tue, 21 Aug 2018 15:35:09 +0000 (17:35 +0200)
* Removed notices that revealed themselfes over night ...

* And more notices removed that occured over night

* One more ..

* Some more notices of the day ...

include/items.php
mod/dfrn_poll.php
mod/follow.php
src/Core/NotificationsManager.php
src/Model/Contact.php
src/Network/Probe.php
src/Protocol/Diaspora.php
src/Worker/DiscoverPoCo.php
view/templates/profile_edit.tpl
view/theme/vier/templates/profile_edit.tpl

index 9922c447f009daf7002c20d23dcadbd6e7d505ba..08858682e60cefc5844370e0d408f987782a504b 100644 (file)
@@ -371,7 +371,7 @@ function drop_item($id)
 
        if ((local_user() == $item['uid']) || $contact_id) {
                // Check if we should do HTML-based delete confirmation
-               if ($_REQUEST['confirm']) {
+               if (!empty($_REQUEST['confirm'])) {
                        // <form> can't take arguments in its "action" parameter
                        // so add any arguments as hidden inputs
                        $query = explode_querystring($a->query_string);
@@ -395,7 +395,7 @@ function drop_item($id)
                        ]);
                }
                // Now check how the user responded to the confirmation query
-               if ($_REQUEST['canceled']) {
+               if (!empty($_REQUEST['canceled'])) {
                        goaway(System::baseUrl() . '/' . $_SESSION['return_url']);
                }
 
index 5e5540be140a65db3a28e51e25362347f9563370..54539ee03d7bd4cc580bb7845b9fa34b59734488 100644 (file)
@@ -480,6 +480,12 @@ function dfrn_poll_content(App $a)
                }
 
                if (($type === 'profile') && (strlen($sec))) {
+                       // heluecht: I don't know why we don't fail immediately when the user or contact hadn't been found.
+                       // Since it doesn't make sense to continue from this point on, we now fail here. This should be safe.
+                       if (!DBA::isResult($r)) {
+                               System::httpExit(404, ["title" => L10n::t('Page not found.')]);
+                       }
+
                        // URL reply
                        if ($dfrn_version < 2.2) {
                                $s = Network::fetchUrl($r[0]['poll']
index ef2325ad03d3d7ae0a599297ca525373f08057a1..627ab52033049065a9d737fdf8c725068215c121 100644 (file)
@@ -16,9 +16,7 @@ use Friendica\Util\Proxy as ProxyUtils;
 function follow_post(App $a)
 {
        if (!local_user()) {
-               notice(L10n::t('Permission denied.'));
-               goaway($_SESSION['return_url']);
-               // NOTREACHED
+               System::httpExit(403, ['title' => L10n::t('Access denied.')]);
        }
 
        if (isset($_REQUEST['cancel'])) {
index c994755e7a231cd3f54d552a4f7c31f5f79cd83b..d256b9adc1b0f0ba52a6f9f54124d22fe5dab7d7 100644 (file)
@@ -344,6 +344,10 @@ class NotificationsManager extends BaseObject
                                                break;
 
                                        case ACTIVITY_FRIEND:
+                                               if (!isset($it['object'])) {
+                                                       logger('Incomplete data: ' . json_encode($it) . ' - ' . System::callstack(20), LOGGER_DEBUG);
+                                               }
+
                                                $xmlhead = "<" . "?xml version='1.0' encoding='UTF-8' ?" . ">";
                                                $obj = XML::parseString($xmlhead . $it['object']);
                                                $it['fname'] = $obj->title;
index f8bfe3f0b8132af619446cfb5e21380ca30628ab..4c41fdc3fedb3042d218ad338bb5999d1602020d 100644 (file)
@@ -364,8 +364,13 @@ class Contact extends BaseObject
         */
        public static function markForArchival(array $contact)
        {
-
-               if (!isset($contact['url'])) {
+               if (!isset($contact['url']) && !empty($contact['id'])) {
+                       $fields = ['id', 'url', 'archive', 'self', 'term-date'];
+                       $contact = DBA::selectFirst('contact', [], ['id' => $contact['id']]);
+                       if (!DBA::isResult($contact)) {
+                               return;
+                       }
+               } elseif (!isset($contact['url'])) {
                        logger('Empty contact: ' . json_encode($contact) . ' - ' . System::callstack(20), LOGGER_DEBUG);
                }
 
@@ -376,10 +381,7 @@ class Contact extends BaseObject
 
                if ($contact['term-date'] <= NULL_DATE) {
                        DBA::update('contact', ['term-date' => DateTimeFormat::utcNow()], ['id' => $contact['id']]);
-
-                       if ($contact['url'] != '') {
-                               DBA::update('contact', ['term-date' => DateTimeFormat::utcNow()], ['`nurl` = ? AND `term-date` <= ? AND NOT `self`', normalise_link($contact['url']), NULL_DATE]);
-                       }
+                       DBA::update('contact', ['term-date' => DateTimeFormat::utcNow()], ['`nurl` = ? AND `term-date` <= ? AND NOT `self`', normalise_link($contact['url']), NULL_DATE]);
                } else {
                        /* @todo
                         * We really should send a notification to the owner after 2-3 weeks
@@ -397,10 +399,7 @@ class Contact extends BaseObject
                                 * the whole process over again.
                                 */
                                DBA::update('contact', ['archive' => 1], ['id' => $contact['id']]);
-
-                               if ($contact['url'] != '') {
-                                       DBA::update('contact', ['archive' => 1], ['nurl' => normalise_link($contact['url']), 'self' => false]);
-                               }
+                               DBA::update('contact', ['archive' => 1], ['nurl' => normalise_link($contact['url']), 'self' => false]);
                        }
                }
        }
@@ -423,13 +422,18 @@ class Contact extends BaseObject
                        return;
                }
 
+               if (!isset($contact['url']) && !empty($contact['id'])) {
+                       $fields = ['id', 'url', 'batch'];
+                       $contact = DBA::selectFirst('contact', [], ['id' => $contact['id']]);
+                       if (!DBA::isResult($contact)) {
+                               return;
+                       }
+               }
+
                // It's a miracle. Our dead contact has inexplicably come back to life.
                $fields = ['term-date' => NULL_DATE, 'archive' => false];
                DBA::update('contact', $fields, ['id' => $contact['id']]);
-
-               if (!empty($contact['url'])) {
-                       DBA::update('contact', $fields, ['nurl' => normalise_link($contact['url'])]);
-               }
+               DBA::update('contact', $fields, ['nurl' => normalise_link($contact['url'])]);
 
                if (!empty($contact['batch'])) {
                        $condition = ['batch' => $contact['batch'], 'contact-type' => self::ACCOUNT_TYPE_RELAY];
index 6e4996de54e54398a1f72bdf457a973364ad15c1..5bbdf7c4e03f675347c1d0a442eea7573e62443e 100644 (file)
@@ -933,7 +933,12 @@ class Probe
                }
 
                $prof_data = [];
-               $prof_data["addr"]         = $data["addr"];
+
+               // The "addr" is not always part of the fetched data
+               if (!empty($data["addr"])) {
+                       $prof_data["addr"] = $data["addr"];
+               }
+
                $prof_data["nick"]         = $data["nick"];
                $prof_data["dfrn-request"] = $data["request"];
                $prof_data["dfrn-confirm"] = $data["confirm"];
index d833f410f4146dbb75b2659b19edf9f9ad9ca81e..e62329e180a0fb1471a4edfbeea8763eb1017a15 100644 (file)
@@ -3075,7 +3075,7 @@ class Diaspora
                logger("transmit: ".$logid."-".$guid." to ".$dest_url." returns: ".$return_code);
 
                if (!$return_code || (($return_code == 503) && (stristr($a->get_curl_headers(), "retry-after")))) {
-                       if (!$no_queue && ($contact['contact-type'] != Contact::ACCOUNT_TYPE_RELAY)) {
+                       if (!$no_queue && !empty($contact['contact-type']) && ($contact['contact-type'] != Contact::ACCOUNT_TYPE_RELAY)) {
                                logger("queue message");
                                // queue message for redelivery
                                Queue::add($contact["id"], Protocol::DIASPORA, $envelope, $public_batch, $guid);
index bf1c2a64a718806c5626354993c5b900ff975b6e..e6fc8391ffa044d686c59f1b47e84dfcd125b7f7 100644 (file)
@@ -216,7 +216,7 @@ class DiscoverPoCo
                $x = Network::fetchUrl(get_server()."/lsearch?p=1&n=500&search=".urlencode($search));
                $j = json_decode($x);
 
-               if (count($j->results)) {
+               if (!empty($j->results)) {
                        foreach ($j->results as $jj) {
                                // Check if the contact already exists
                                $exists = q("SELECT `id`, `last_contact`, `last_failure`, `updated` FROM `gcontact` WHERE `nurl` = '%s'", normalise_link($jj->url));
index a25945c689b2f70d78fdcdd03172cec06cbbf85d..2363bd3f060b3d74d1933e3f91173788dd43219e 100644 (file)
         <input type="hidden" name="religion" id="profile-edit-religion" value="{{$religion.2}}" />
         <input type="hidden" id="likes-jot-text" name="likes" value="{{$likes.2}}" />
         <input type="hidden" id="dislikes-jot-text" name="dislikes" value="{{$dislikes.2}}" />
+        <input type="hidden" name="marital" id="profile-edit-marital" value="{{$marital.2}}" />
         <input type="hidden" name="with" id="profile-edit-with" value="{{$with.2}}" />
         <input type="hidden" name="howlong" id="profile-edit-howlong" value="{{$howlong.2}}" />
+        <input type="hidden" name="sexual" id="profile-edit-sexual" value="{{$sexual.2}}" />
         <input type="hidden" id="romance-jot-text" name="romance" value="{{$romance.2}}" />
         <input type="hidden" id="work-jot-text" name="work" value="{{$work.2}}" />
         <input type="hidden" id="education-jot-text" name="education" value="{{$education.2}}" />
index f1280f41c8b6d11589a92ee9dd6a9db9ab6136f3..0951847b0a018321e72d9e2061eb2ef0159f67ec 100644 (file)
         <input type="hidden" name="religion" id="profile-edit-religion" value="{{$religion.2}}" />
         <input type="hidden" id="likes-jot-text" name="likes" value="{{$likes.2}}" />
         <input type="hidden" id="dislikes-jot-text" name="dislikes" value="{{$dislikes.2}}" />
+        <input type="hidden" name="marital" id="profile-edit-marital" value="{{$marital.2}}" />
         <input type="hidden" name="with" id="profile-edit-with" value="{{$with.2}}" />
         <input type="hidden" name="howlong" id="profile-edit-howlong" value="{{$howlong.2}}" />
+        <input type="hidden" name="sexual" id="profile-edit-sexual" value="{{$sexual.2}}" />
         <input type="hidden" id="romance-jot-text" name="romance" value="{{$romance.2}}" />
         <input type="hidden" id="work-jot-text" name="work" value="{{$work.2}}" />
         <input type="hidden" id="education-jot-text" name="education" value="{{$education.2}}" />