Changeset 1206
- Timestamp:
- 07/28/08 07:33:13 (4 months ago)
- Files:
-
- bb-attachments/trunk/bb-attachments.php (modified) (6 diffs)
- bb-attachments/trunk/icons/missing.gif (added)
- bb-attachments/trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
bb-attachments/trunk/bb-attachments.php
r1205 r1206 6 6 Author: _ck_ 7 7 Author URI: http://bbShowcase.org 8 Version: 0.1. 88 Version: 0.1.9 9 9 10 10 License: CC-GNU-GPL http://creativecommons.org/licenses/GPL/2.0/ … … 45 45 $bb_attachments['inline']['solution']="resize"; // resize|frame - images can be either resized or CSS framed to meet above requirement 46 46 // only resize is supported at this time 47 $bb_attachments['style']=" #thread .post li {clear:none;}";47 $bb_attachments['style']=".bb_attachments_link, .bb_attachments_link img {border:0; text-decoration:none;} #thread .post li {clear:none;}"; 48 48 49 49 // stop editing here (advanced user settings below) … … 56 56 57 57 $bb_attachments['icons']['url']=bb_get_option('uri').trim(str_replace(array(trim(BBPATH,"/\\"),"\\"),array("","/"),dirname(__FILE__)),' /\\').'/icons/'; 58 $bb_attachments['icons']['path']=rtrim(dirname(__FILE__),' /\\').'/icons/'; 58 59 59 60 $bb_attachments['title']=" <img title='attachments' border='0' align='absmiddle' src='".$bb_attachments['icons']['url'].$bb_attachments['icons']['default']."' />"; // text, html or image to show on topic titles if has attachments … … 172 173 $output.="<li>"; 173 174 $output.="<span".(($attachment->status>0) ? " class='deleted' ": "")."> "; 174 if (isset($bb_attachments['icons'][$attachment->ext])) {$icon=$bb_attachments['icons'][$attachment->ext];} else {$icon=$bb_attachments['icons']['default'];} 175 if ($attachment->status>0) {$icon="missing.gif";} 176 else {if (isset($bb_attachments['icons'][$attachment->ext])) {$icon=$bb_attachments['icons'][$attachment->ext];} else {$icon=$bb_attachments['icons']['default'];}} 175 177 $output.=" <img align='absmiddle' title='".$attachment->ext."' src='".$bb_attachments['icons']['url'].$icon."' /> "; 176 178 … … 230 232 231 233 function bb_attachments_bbcode($text) { 232 $text = preg_replace("/\[attachment=([0-9]+?)\,([0-9]+?)\]/sim","<a href='?bb_attachments=$1&bbat=$2'><imgsrc='?bb_attachments=$1&bbat=$2&inline'></a>",$text);234 $text = preg_replace("/\[attachment=([0-9]+?)\,([0-9]+?)\]/sim","<a class='bb_attachments_link' href='?bb_attachments=$1&bbat=$2'><img src='?bb_attachments=$1&bbat=$2&inline'></a>",$text); 233 235 return $text; 234 236 } … … 446 448 set_time_limit(0); 447 449 fpassthru($fp); // avoids file touch bug with readfile 448 fclose($fp); 450 fclose($fp); 451 exit(); 449 452 } 450 } 451 exit(); 452 } 453 } else { 454 $im=@imagecreatetruecolor(1,1); 453 } else { bb_attachments_inline_missing();} 454 } else { bb_attachments_inline_missing();} 455 } else { bb_attachments_inline_missing();} 456 } 457 458 function bb_attachments_inline_missing() { 459 global $bb_attachments; 460 $missing=$bb_attachments['icons']['path']."missing.gif"; 455 461 header("Cache-Control: public, must-revalidate, post-check=0, pre-check=0"); 456 header("Content-type: image/png"); 457 header("Content-Length: ".strlen($im)); 458 imagepng($im); 459 imagedestroy($im); 462 header("Content-Type: image/gif"); 463 header("Content-Length: ".filesize($missing)); 464 header('Content-Disposition: inline; filename="missing.gif"'); 465 header("Content-Transfer-Encoding: binary"); 466 ob_clean(); 467 flush(); 468 $fp = @fopen($missing,"rb"); 469 set_time_limit(0); 470 fpassthru($fp); // avoids file touch bug with readfile 471 fclose($fp); 460 472 exit(); 461 }462 473 } 463 474 bb-attachments/trunk/readme.txt
r1205 r1206 55 55 * 0.1.7 bug squashed for IIS ? 56 56 * 0.1.8 workaround for lack of apache_request_headers, javascript insert bug 57 * 0.1.9 handle missing inline images a bit better with "x" icon 57 58 58 59 == To Do ==
