]> git.mxchange.org Git - friendica.git/blobdiff - mod/message.php
Improve Addons documentation
[friendica.git] / mod / message.php
index 1e49311d3f436b3fb0f503b442aef50bd4234491..b414fe0e49f6110371dbeb6a6c7bec1a0a533f8f 100644 (file)
@@ -118,7 +118,7 @@ function message_content(App $a)
                }
 
                // 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);
@@ -141,16 +141,18 @@ function message_content(App $a)
                                '$cancel' => L10n::t('Cancel'),
                        ]);
                }
+
                // Now check how the user responded to the confirmation query
-               if ($_REQUEST['canceled']) {
+               if (!empty($_REQUEST['canceled'])) {
                        goaway($_SESSION['return_url']);
                }
 
                $cmd = $a->argv[1];
                if ($cmd === 'drop') {
-                       if (dba::delete('mail', ['id' => $a->argv[2]])) {
+                       if (dba::delete('mail', ['id' => $a->argv[2], 'uid' => local_user()])) {
                                info(L10n::t('Message deleted.') . EOL);
                        }
+
                        //goaway(System::baseUrl(true) . '/message' );
                        goaway($_SESSION['return_url']);
                } else {
@@ -306,8 +308,10 @@ function message_content(App $a)
                                WHERE `mail`.`uid` = %d $sql_extra ORDER BY `mail`.`created` ASC",
                                intval(local_user())
                        );
+               } else {
+                       $messages = false;
                }
-               if (!count($messages)) {
+               if (!DBM::is_result($messages)) {
                        notice(L10n::t('Message not available.') . EOL);
                        return $o;
                }