[Comoblog-commit] comoblog/batch comoblog_batch.php,1.5,1.6
Status: Inactive
Brought to you by:
markwallis
|
From: Mark W. \(a. serialmonkey\) <mar...@us...> - 2005-10-05 01:33:04
|
Update of /cvsroot/comoblog/comoblog/batch In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24764/batch Modified Files: comoblog_batch.php Log Message: RFE: 1304056 - Restriction of number of images to upload from a post Index: comoblog_batch.php =================================================================== RCS file: /cvsroot/comoblog/comoblog/batch/comoblog_batch.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- comoblog_batch.php 5 Oct 2005 00:45:34 -0000 1.5 +++ comoblog_batch.php 5 Oct 2005 01:32:56 -0000 1.6 @@ -298,7 +298,13 @@ $posts[$post_cnt]['images_mime'] = array(); $posts[$post_cnt]['images_cid'] = array(); $posts[$post_cnt]['images_tmp'] = array(); - + + $image_count = 0; + if (CFG_MAX_ALLOWED_IMAGES == 'unlimited') + $max_image_count = 0; + else + $max_image_count = CFG_MAX_ALLOWED_IMAGES; + if (is_array($decoded_msg[$msg_cnt]->parts)) { // multipart for ($p = 0; $p < count($decoded_msg[$msg_cnt]->parts); $p++) { $text_plain = 0; @@ -331,7 +337,8 @@ if ($imgsize[2] == 1) $ctype = 'image/gif'; elseif($imgsize[2] == 2) $ctype = 'image/jpg'; elseif($imgsize[2] == 3) $ctype = 'image/png'; - if ($ctype != '') { + if ($ctype != '' && ($max_image_count == 0 || $image_count < $max_image_count)) { + $image_count += 1; array_push ($posts[$post_cnt]['images'], $decoded_msg[$msg_cnt]->parts[$p]->parts[$pp]->body); array_push ($posts[$post_cnt]['images_mime'], $ctype); array_push ($posts[$post_cnt]['images_cid'], $decoded_msg[$msg_cnt]->parts[$p]->parts[$pp]->headers['content-id']); @@ -368,7 +375,8 @@ if ($imgsize[2] == 1) $ctype = 'image/gif'; elseif($imgsize[2] == 2) $ctype = 'image/jpg'; elseif($imgsize[2] == 3) $ctype = 'image/png'; - if ($ctype != '') { + if ($ctype != '' && ($max_image_count == 0 || $image_count < $max_image_count)) { + $image_count += 1; array_push ($posts[$post_cnt]['images'], $decoded_msg[$msg_cnt]->parts[$p]->body); array_push ($posts[$post_cnt]['images_mime'], $ctype); array_push ($posts[$post_cnt]['images_cid'], $decoded_msg[$msg_cnt]->parts[$p]->headers['content-id']); @@ -402,7 +410,8 @@ if ($imgsize[2] == 1) $ctype = 'image/gif'; elseif($imgsize[2] == 2) $ctype = 'image/jpg'; elseif($imgsize[2] == 3) $ctype = 'image/png'; - if ($ctype != '') { + if ($ctype != '' && ($max_image_count == 0 || $image_count < $max_image_count)) { + $image_count += 1; array_push ($posts[$post_cnt]['images'], $decoded_msg[$msg_cnt]->body); array_push ($posts[$post_cnt]['images_mime'], $ctype); array_push ($posts[$post_cnt]['images_cid'], $decoded_msg[$msg_cnt]->headers['content-id']); |