]> git.mxchange.org Git - friendica.git/blobdiff - mod/message.php
SQL typo mod/message
[friendica.git] / mod / message.php
index 1a808701e3e5a0256ebf2fe8610e6b757b65b9fd..d3bd1558cc8d5f6116755677be3e0a54250e7180 100644 (file)
@@ -52,17 +52,6 @@ function message_post(App $a) {
        $body      = ((x($_REQUEST,'body'))      ? escape_tags(trim($_REQUEST['body'])) : '');
        $recipient = ((x($_REQUEST,'messageto')) ? intval($_REQUEST['messageto'])       : 0 );
 
-       // Work around doubled linefeeds in Tinymce 3.5b2
-
-/*     $plaintext = intval(get_pconfig(local_user(),'system','plaintext') && !feature_enabled(local_user(),'richtext'));
-       if(! $plaintext) {
-               $body = fix_mce_lf($body);
-       }*/
-       $plaintext = intval(!feature_enabled(local_user(),'richtext'));
-       if(! $plaintext) {
-               $body = fix_mce_lf($body);
-       }
-
        $ret = send_message($recipient, $body, $subject, $replyto);
        $norecip = false;
 
@@ -360,7 +349,7 @@ function message_content(App $a) {
 
                $o .= $header;
 
-               $r = q("SELECT count(*) AS `total` FROM `mail`
+               $r = q("SELECT count(*) AS `total` FROM `mail`, ANY_VALUE(`created`) AS `created`
                        WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `created` DESC",
                        intval(local_user())
                );
@@ -539,9 +528,14 @@ function message_content(App $a) {
 }
 
 function get_messages($user, $lstart, $lend) {
-
+       //TODO: rewritte with a sub-query to get the first message of each private thread with certainty
        return q("SELECT max(`mail`.`created`) AS `mailcreated`, min(`mail`.`seen`) AS `mailseen`,
-               `mail`.* , `contact`.`name`, `contact`.`url`, `contact`.`thumb` , `contact`.`network`,
+               ANY_VALUE(`mail`.`id`), ANY_VALUE(`mail`.`uid`), ANY_VALUE(`mail`.`guid`), ANY_VALUE(`mail`.`from-name`),
+               ANY_VALUE(`mail`.`from-photo`), ANY_VALUE(`mail`.`from-url`), ANY_VALUE(`mail`.`contact-id`),
+               ANY_VALUE(`mail`.`convid`), ANY_VALUE(`mail`.`title`), ANY_VALUE(`mail`.`body`), ANY_VALUE(`mail`.`seen`),
+               ANY_VALUE(`mail`.`reply`), ANY_VALUE(`mail`.`replied`), ANY_VALUE(`mail`.`unknown`),
+               ANY_VALUE(`mail`.`uri`), ANY_VALUE(`mail`.`parent-uri`), ANY_VALUE(`mail`.`created`),
+               ANY_VALUE(`contact`.`name`), ANY_VALUE(`contact`.`url`), ANY_VALUE(`contact`.`thumb`), ANY_VALUE(`contact`.`network`),
                count( * ) as count
                FROM `mail` LEFT JOIN `contact` ON `mail`.`contact-id` = `contact`.`id`
                WHERE `mail`.`uid` = %d GROUP BY `parent-uri` ORDER BY `mailcreated` DESC  LIMIT %d , %d ",