[Comoblog-commit] comoblog/batch comoblog_batch.php,1.8,1.9
Status: Inactive
Brought to you by:
markwallis
|
From: Mark W. \(a. serialmonkey\) <mar...@us...> - 2005-12-11 12:14:18
|
Update of /cvsroot/comoblog/comoblog/batch In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11056/batch Modified Files: comoblog_batch.php Log Message: Rolled in support for 3g2 video files - from Bill Chambers and David Bennett Index: comoblog_batch.php =================================================================== RCS file: /cvsroot/comoblog/comoblog/batch/comoblog_batch.php,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- comoblog_batch.php 9 Oct 2005 00:31:34 -0000 1.8 +++ comoblog_batch.php 11 Dec 2005 12:14:01 -0000 1.9 @@ -114,7 +114,9 @@ $post['images_extension'][$i] = 'gif'; elseif ($post['images_mime'][$i] == 'image/png') $post['images_extension'][$i] = 'png'; - + elseif ($post['images_mime'][$i] == 'video/3gpp2') + $post['images_extension'][$i] = '3g2'; + //echo "+++".$post['images_cid'][$i]."+++"; //echo $post['post_mail_body']; @@ -325,6 +327,18 @@ $posts[$post_cnt]['post_ctype'] = $ctype; } + elseif (eregi('\.3g2',$cname)) { + $ctype = ''; + // check if part body is a valid image file + $now = str_replace(' ', '', microtime()).rand(); + $fp = fopen (CFG_BASE_PATH.'/img/tmp/'.$now, 'wb'); + fwrite ($fp, $decoded_msg[$msg_cnt]->parts[$p]->parts[$pp]->body); + fclose($fp); + array_push ($posts[$post_cnt]['images'], $decoded_msg[$msg_cnt]->parts[$p]->parts[$pp]->body); + array_push ($posts[$post_cnt]['images_mime'], 'video/3gpp2'); + array_push ($posts[$post_cnt]['images_cid'], $decoded_msg[$msg_cnt]->parts[$p]->parts[$pp]->headers['content-id']); + array_push ($posts[$post_cnt]['images_tmp'], CFG_BASE_PATH.'/img/tmp/'.$now); + } else { $ctype = ''; @@ -355,7 +369,11 @@ } else { $ctype = strtolower ($decoded_msg[$msg_cnt]->parts[$p]->ctype_primary."/".$decoded_msg[$msg_cnt]->parts[$p]->ctype_secondary); - if (($ctype == 'text/html' && $text_html == 0) || ($ctype == 'text/plain' && $text_html == 0 && $text_plain == 0)) { + $cname = strtolower ($decoded_msg[$msg_cnt]->parts[$p]->d_parameters['filename']); + if ($cname == '') + $cname = strtolower ($decoded_msg[$msg_cnt]->parts[$p]->ctype_parameters['name']); + + if (($ctype == 'text/html' && $text_html == 0) || ($ctype == 'text/plain' && $text_html == 0 && $text_plain == 0)) { $posts[$post_cnt]['post_mail_body'] = $decoded_msg[$msg_cnt]->parts[$p]->body; if ($ctype == 'text/plain') $text_plain++; @@ -363,6 +381,18 @@ $posts[$post_cnt]['post_ctype'] = $ctype; } + elseif (eregi('\.3g2',$cname)) { + $ctype = ''; + // check if part body is a valid image file + $now = str_replace(' ', '', microtime()).rand(); + $fp = fopen (CFG_BASE_PATH.'/img/tmp/'.$now, 'wb'); + fwrite ($fp, $decoded_msg[$msg_cnt]->parts[$p]->body); + fclose($fp); + array_push ($posts[$post_cnt]['images'], $decoded_msg[$msg_cnt]->parts[$p]->body); + array_push ($posts[$post_cnt]['images_mime'], 'video/3gpp2'); + array_push ($posts[$post_cnt]['images_cid'], $decoded_msg[$msg_cnt]->parts[$p]->headers['content-id']); + array_push ($posts[$post_cnt]['images_tmp'], CFG_BASE_PATH.'/img/tmp/'.$now); + } else { $ctype = ''; @@ -395,10 +425,27 @@ } else { // multipart $ctype = strtolower($decoded_msg[$msg_cnt]->ctype_primary.'/'.$decoded_msg[$msg_cnt]->ctype_secondary); + $cname = strtolower ($decoded_msg[$msg_cnt]->d_parameters['filename']); + if ($cname == '') { + $cname = strtolower ($decoded_msg[$msg_cnt]->ctype_parameters['name']); + } + if ($ctype == 'text/plain' || $ctype == 'text/html') { $posts[$post_cnt]['post_mail_body'] = $decoded_msg[$msg_cnt]->body; $posts[$post_cnt]['post_ctype'] = $ctype; } + elseif (eregi('\.3g2',$cname)) { + $ctype = ''; + // check if part body is a valid image file + $now = str_replace(' ', '', microtime()).rand(); + $fp = fopen (CFG_BASE_PATH.'/img/tmp/'.$now, 'wb'); + fwrite ($fp, $decoded_msg[$msg_cnt]->body); + fclose($fp); + array_push ($posts[$post_cnt]['images'], $decoded_msg[$msg_cnt]->body); + array_push ($posts[$post_cnt]['images_mime'], 'video/3gpp2'); + array_push ($posts[$post_cnt]['images_cid'], $decoded_msg[$msg_cnt]->headers['content-id']); + array_push ($posts[$post_cnt]['images_tmp'], CFG_BASE_PATH.'/img/tmp/'.$now); + } else { $ctype = ''; |