Changeset 4bfe4ec in github for program/steps/mail/get.inc
- Timestamp:
- May 22, 2012 4:26:36 AM (13 months ago)
- Branches:
- master, HEAD, dev-browser-capabilities, pdo
- Children:
- 5a575b7
- Parents:
- 38a08c0
- File:
-
- 1 edited
-
program/steps/mail/get.inc (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
program/steps/mail/get.inc
rb4f95a9 r4bfe4ec 39 39 ob_end_clean(); 40 40 41 // Now we need IMAP connection42 if (!$RCMAIL->storage_connect()) {43 // Get action is often executed simultanously.44 // Some servers have MAXPERIP or other limits.45 // To workaround this we'll wait for some time46 // and try again (once).47 // Note: Random sleep interval is used to minimize concurency48 // in getting message parts49 if (!isset($_GET['_redirected'])) {50 usleep(rand(10,30)*100000); // 1-3 sec.51 header('Location: ' . $_SERVER['REQUEST_URI'] . '&_redirected=1');52 }53 else {54 raise_error(array(55 'code' => 500, 'type' => 'php',56 'file' => __FILE__, 'line' => __LINE__,57 'message' => 'Unable to get/display message part. IMAP connection error'),58 true, true);59 }60 // Don't kill session, just quit (#1486995)61 exit;62 }63 64 41 // similar code as in program/steps/mail/show.inc 65 42 if (!empty($_GET['_uid'])) { … … 67 44 $MESSAGE = new rcube_message(get_input_value('_uid', RCUBE_INPUT_GET)); 68 45 } 46 47 // check connection status 48 check_storage_status(); 69 49 70 50 // show part page … … 138 118 } 139 119 120 // check connection status 121 if ($part->size && empty($part->body)) { 122 check_storage_status(); 123 } 124 140 125 $OUTPUT = new rcube_output_html(); 141 126 $OUTPUT->write($out); … … 171 156 // do content filtering to avoid XSS through fake images 172 157 if (!empty($_REQUEST['_embed']) && $browser->ie && $browser->ver <= 8) { 173 if ($part->body) 158 if ($part->body) { 174 159 echo preg_match('/<(script|iframe|object)/i', $part->body) ? '' : $part->body; 160 $sent = true; 161 } 175 162 else if ($part->size) { 176 163 $stdout = fopen('php://output', 'w'); 177 164 stream_filter_register('rcube_content', 'rcube_content_filter') or die('Failed to register content filter'); 178 165 stream_filter_append($stdout, 'rcube_content'); 179 $ RCMAIL->storage->get_message_part($MESSAGE->uid, $part->mime_id, $part, false, $stdout);166 $sent = $RCMAIL->storage->get_message_part($MESSAGE->uid, $part->mime_id, $part, false, $stdout); 180 167 } 181 168 } 182 169 else { 183 170 // turn off output buffering and print part content 184 if ($part->body) 171 if ($part->body) { 185 172 echo $part->body; 186 else if ($part->size) 187 $RCMAIL->storage->get_message_part($MESSAGE->uid, $part->mime_id, $part, true); 173 $sent = true; 174 } 175 else if ($part->size) { 176 $sent = $RCMAIL->storage->get_message_part($MESSAGE->uid, $part->mime_id, $part, true); 177 } 178 } 179 180 // check connection status 181 if ($part->size && !$sent) { 182 check_storage_status(); 188 183 } 189 184 } … … 214 209 215 210 211 function check_storage_status() 212 { 213 $error = rcmail::get_instance()->storage->get_error_code(); 214 215 // Check if we have a connection error 216 if ($error == rcube_imap_generic::ERROR_BAD) { 217 ob_end_clean(); 218 219 // Get action is often executed simultanously. 220 // Some servers have MAXPERIP or other limits. 221 // To workaround this we'll wait for some time 222 // and try again (once). 223 // Note: Random sleep interval is used to minimize concurency 224 // in getting message parts 225 226 if (!isset($_GET['_redirected'])) { 227 usleep(rand(10,30)*100000); // 1-3 sec. 228 header('Location: ' . $_SERVER['REQUEST_URI'] . '&_redirected=1'); 229 } 230 else { 231 raise_error(array( 232 'code' => 500, 'type' => 'php', 233 'file' => __FILE__, 'line' => __LINE__, 234 'message' => 'Unable to get/display message part. IMAP connection error'), 235 true, true); 236 } 237 238 // Don't kill session, just quit (#1486995) 239 exit; 240 } 241 }
Note: See TracChangeset
for help on using the changeset viewer.
