]> git.mxchange.org Git - friendica.git/commitdiff
small fixes to item post to try and sort out segfault issues on php 5.3 (?)
authorFriendika <info@friendika.com>
Sun, 29 May 2011 22:47:26 +0000 (15:47 -0700)
committerFriendika <info@friendika.com>
Sun, 29 May 2011 22:47:26 +0000 (15:47 -0700)
boot.php
include/EmailNotification.php
mod/item.php

index 6de0f7a7fa49ac22ec04a299c37552f0faed9589..0495c97d7c89ebe55f272c14d724403f6cc333db 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -4,7 +4,7 @@ set_time_limit(0);
 ini_set('pcre.backtrack_limit', 250000);
 
 
-define ( 'FRIENDIKA_VERSION',      '2.2.993' );
+define ( 'FRIENDIKA_VERSION',      '2.2.995' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.21'    );
 define ( 'DB_UPDATE_VERSION',      1059      );
 
index 209d5476a71b1e4708b46e4b08456bd2d33067de..78912c0b96175b673293130f6aadf55d2ba4615f 100644 (file)
@@ -12,14 +12,6 @@ class EmailNotification {
         * @param textVersion           text only version of the message
         */
        static public function sendTextHtmlEmail($fromName,$fromEmail,$replyTo,$toEmail,$messageSubject,$htmlVersion,$textVersion) {
-               logger("sendTextHtmlEmail: BEGIN");
-               logger("fromName:       " . $fromName);
-               logger("fromEmail:      " . $fromEmail);
-               logger("replyTo:        " . $replyTo);
-               logger("toEmail:        " . $toEmail);
-               logger("messageSubject: " . $messageSubject);
-               //logger("htmlVersion:    " . $htmlVersion);
-               //logger("textVersion:    " . $textVersion);
                
                // generate a mime boundary
                $mimeBoundary   =rand(0,9)."-"
index b07f26e32896593515b20e8377b737c3b9ff1e93..0fb780adc75be709235876d4c12d7007056d1af1 100644 (file)
@@ -204,6 +204,8 @@ function item_post(&$a) {
                                        continue;
                                $image_uri = substr($image,strrpos($image,'/') + 1);
                                $image_uri = substr($image_uri,0, strpos($image_uri,'-'));
+                               if(! strlen($image_uri))
+                                       continue;
                                $srch = '<' . intval($profile_uid) . '>';
                                $r = q("SELECT `id` FROM `photo` WHERE `allow_cid` = '%s' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = ''
                                        AND `resource-id` = '%s' AND `uid` = %d LIMIT 1",
@@ -231,7 +233,7 @@ function item_post(&$a) {
        }
 
 
-       $match = null;
+       $match = false;
 
        if(preg_match_all("/\[attachment\](.+?)\[\/attachment\]/",$body,$match)) {
                $attaches = $match[1];
@@ -239,13 +241,13 @@ function item_post(&$a) {
                        foreach($attaches as $attach) {
                                $r = q("SELECT * FROM `attach` WHERE `uid` = %d AND `id` = %d LIMIT 1",
                                        intval($profile_uid),
-                                       intval($attaches)
+                                       intval($attach)
                                );                              
                                if(count($r)) {
                                        $r = q("UPDATE `attach` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
                                                WHERE `uid` = %d AND `id` = %d LIMIT 1",
                                                intval($profile_uid),
-                                               intval($attaches)
+                                               intval($attach)
                                        );
                                }
                        }
@@ -361,6 +363,7 @@ function item_post(&$a) {
        }
 
        $attachments = '';
+       $match = false;
 
        if(preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/',$body,$match)) {
                foreach($match[2] as $mtch) {
@@ -371,7 +374,7 @@ function item_post(&$a) {
                        if(count($r)) {
                                if(strlen($attachments))
                                        $attachments .= ',';
-                               $attachments .= '[attach]href="' . $a->get_baseurl() . '/attach/' . $r[0]['id'] . '" size="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . $r[0]['filename'] . '"[/attach]'; 
+                               $attachments .= '[attach]href="' . $a->get_baseurl() . '/attach/' . $r[0]['id'] . '" size="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . (($r[0]['filename']) ? $r[0]['filename'] : ' ') . '"[/attach]'; 
                        }
                        $body = str_replace($match[1],'',$body);
                }