Changeset 1205

Show
Ignore:
Timestamp:
07/28/08 04:43:32 (4 months ago)
Author:
_ck_
Message:

0.1.8 workaround for lack of apache_request_headers, javascript insert bug

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • bb-attachments/trunk/bb-attachments.php

    r1191 r1205  
    66Author: _ck_ 
    77Author URI: http://bbShowcase.org 
    8 Version: 0.1.7 
     8Version: 0.1.8 
    99 
    1010License: CC-GNU-GPL http://creativecommons.org/licenses/GPL/2.0/ 
     
    214214        } 
    215215if ($output) {$output="<h3>".__("Attachments")."</h3><ol>".$output."</ol>";} 
    216 if ($location="edit.php") { 
    217 $output.='<scr'.'ipt type="text/javascript" defer="defer">function bbat_inline_insert(post_id,id) { 
    218         myValue="[attachment="+post_id+","+id+"]"; 
    219         if (document.selection) {myField.focus();sel = document.selection.createRange();sel.text = myValue;} 
    220         else if (myField.selectionStart || myField.selectionStart == "0") {var startPos = myField.selectionStart; var endPos = myField.selectionEnd; 
    221                 myField.value = myField.value.substring(0, startPos)+ myValue+ myField.value.substring(endPos, myField.value.length); 
    222         } else {myField.value += myValue;} 
     216if ($location=="edit.php") { 
     217$output.='<scr'.'ipt type="text/javascript" defer="defer"> 
     218        function bbat_inline_insert(post_id,id) { 
     219        bbat_field = document.getElementsByTagName("textarea")[0]; 
     220        bbat_value="[attachment="+post_id+","+id+"]"; 
     221        if (document.selection) {bbat_field.focus(); sel = document.selection.createRange();sel.text = bbat_value;} 
     222        else if (bbat_field.selectionStart || bbat_field.selectionStart == "0") {var startPos = bbat_field.selectionStart; var endPos = bbat_field.selectionEnd; 
     223                bbat_field.value = bbat_field.value.substring(0, startPos)+ bbat_value+ bbat_field.value.substring(endPos, bbat_field.value.length); 
     224        } else {bbat_field.value += bbat_value;} 
    223225return false;} </script>'; 
    224226} 
     
    424426                        } 
    425427                         
    426                         $headers = apache_request_headers(); 
     428                        // $headers = apache_request_headers();  $ifModifiedSince=$headers['If-Modified-Since']; 
     429                        $ifModifiedSince = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE']) : false; 
    427430                        $filemtime=filemtime($fullpath); 
    428431                        $httpcode="200"; 
    429                         if (isset($headers['If-Modified-Since']) && (strtotime($headers['If-Modified-Since']) == $filemtime)) {$httpcode="304";}                                       
     432                        if ($ifModifiedSince && (strtotime($ifModifiedSince) >= $filemtime)) {$httpcode="304";}                                
    430433                        if (ini_get('zlib.output_compression')) {ini_set('zlib.output_compression', 'Off');}    // fix for IE 
    431434                        header('Last-Modified: '.gmdate('D, d M Y H:i:s', $filemtime).' GMT', true, $httpcode); 
  • bb-attachments/trunk/readme.txt

    r1185 r1205  
    5353* 0.1.5 first attempt at inline image display ability 
    5454* 0.1.6 BBcode replacement for inserted inline attachment 
     55* 0.1.7 bug squashed for IIS ? 
     56* 0.1.8 workaround for lack of apache_request_headers, javascript insert bug 
    5557         
    5658== To Do ==