small fixes to item post to try and sort out segfault issues on php 5.3 (?)

This commit is contained in:
Friendika 2011-05-29 15:47:26 -07:00
parent 69f014d02b
commit 547fd1e0e5
3 changed files with 8 additions and 13 deletions

View file

@ -4,7 +4,7 @@ set_time_limit(0);
ini_set('pcre.backtrack_limit', 250000); 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 ( 'DFRN_PROTOCOL_VERSION', '2.21' );
define ( 'DB_UPDATE_VERSION', 1059 ); define ( 'DB_UPDATE_VERSION', 1059 );

View file

@ -12,14 +12,6 @@ class EmailNotification {
* @param textVersion text only version of the message * @param textVersion text only version of the message
*/ */
static public function sendTextHtmlEmail($fromName,$fromEmail,$replyTo,$toEmail,$messageSubject,$htmlVersion,$textVersion) { 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 // generate a mime boundary
$mimeBoundary =rand(0,9)."-" $mimeBoundary =rand(0,9)."-"

View file

@ -204,6 +204,8 @@ function item_post(&$a) {
continue; continue;
$image_uri = substr($image,strrpos($image,'/') + 1); $image_uri = substr($image,strrpos($image,'/') + 1);
$image_uri = substr($image_uri,0, strpos($image_uri,'-')); $image_uri = substr($image_uri,0, strpos($image_uri,'-'));
if(! strlen($image_uri))
continue;
$srch = '<' . intval($profile_uid) . '>'; $srch = '<' . intval($profile_uid) . '>';
$r = q("SELECT `id` FROM `photo` WHERE `allow_cid` = '%s' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = '' $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", 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)) { if(preg_match_all("/\[attachment\](.+?)\[\/attachment\]/",$body,$match)) {
$attaches = $match[1]; $attaches = $match[1];
@ -239,13 +241,13 @@ function item_post(&$a) {
foreach($attaches as $attach) { foreach($attaches as $attach) {
$r = q("SELECT * FROM `attach` WHERE `uid` = %d AND `id` = %d LIMIT 1", $r = q("SELECT * FROM `attach` WHERE `uid` = %d AND `id` = %d LIMIT 1",
intval($profile_uid), intval($profile_uid),
intval($attaches) intval($attach)
); );
if(count($r)) { if(count($r)) {
$r = q("UPDATE `attach` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' $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", WHERE `uid` = %d AND `id` = %d LIMIT 1",
intval($profile_uid), intval($profile_uid),
intval($attaches) intval($attach)
); );
} }
} }
@ -361,6 +363,7 @@ function item_post(&$a) {
} }
$attachments = ''; $attachments = '';
$match = false;
if(preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/',$body,$match)) { if(preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/',$body,$match)) {
foreach($match[2] as $mtch) { foreach($match[2] as $mtch) {
@ -371,7 +374,7 @@ function item_post(&$a) {
if(count($r)) { if(count($r)) {
if(strlen($attachments)) if(strlen($attachments))
$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); $body = str_replace($match[1],'',$body);
} }