phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] fudforum/setup/base/src rev_fmt.inc.t, 1.1.1.1.2.1 ge


From: ceb
Subject: [Phpgroupware-cvs] fudforum/setup/base/src rev_fmt.inc.t, 1.1.1.1.2.1 getfile.php.t, 1.1.1.1.2.1
Date: Mon, 26 Sep 2005 01:22:00 +0200

Update of fudforum/setup/base/src

Modified Files:
     Branch: Version-0_9_16-branch
            rev_fmt.inc.t lines: +18 -2
            getfile.php.t lines: +53 -29

Log Message:
hopefully :) fix for ie-only attachment downloading problem

====================================================
Index: fudforum/setup/base/src/rev_fmt.inc.t
diff -u fudforum/setup/base/src/rev_fmt.inc.t:1.1 
fudforum/setup/base/src/rev_fmt.inc.t:1.1.1.1.2.1
--- fudforum/setup/base/src/rev_fmt.inc.t:1.1   Sat Nov  1 22:57:21 2003
+++ fudforum/setup/base/src/rev_fmt.inc.t       Sun Sep 25 23:22:15 2005
@@ -16,4 +16,20 @@
 {
        $data = strtr($data, $GLOBALS['__REVERSE_ARRAY__']);
 }
-?>
\ No newline at end of file
+
+/*$GLOBALS['__revfs'] = array('"', '<', '>', '&');
+$GLOBALS['__revfd'] = array('"', '<', '>', '&');
+
+function reverse_fmt($data)
+{
+       $s = $d = array();
+       foreach ($GLOBALS['__revfs'] as $k => $v) {
+               if (strpos($data, $v) !== false) {
+                       $s[] = $v;
+                       $d[] = $GLOBALS['__revfd'][$k];
+               }
+       }
+
+       return $s ? str_replace($s, $d, $data) : $data;
+}*/
+?>

====================================================
Index: fudforum/setup/base/src/getfile.php.t
diff -u fudforum/setup/base/src/getfile.php.t:1.1 
fudforum/setup/base/src/getfile.php.t:1.1.1.1.2.1
--- fudforum/setup/base/src/getfile.php.t:1.1   Sat Nov  1 22:57:18 2003
+++ fudforum/setup/base/src/getfile.php.t       Sun Sep 25 23:22:15 2005
@@ -1,48 +1,57 @@
 <?php
-/***************************************************************************
-* copyright            : (C) 2001-2003 Advanced Internet Designs Inc.
-* email                : address@hidden
-* $Id$
-*
-* This program is free software; you can redistribute it and/or modify it
-* under the terms of the GNU General Public License as published by the
-* Free Software Foundation; either version 2 of the License, or
-* (at your option) any later version.
-***************************************************************************/
-
-/*{PRE_HTML_PHP}*/
-/*{POST_HTML_PHP}*/
+       
/***************************************************************************
+       * copyright            : (C) 2001-2003 Advanced Internet Designs Inc.
+       * email                : address@hidden
+       * $Id$
+       *
+       * This program is free software; you can redistribute it and/or modify 
it
+       * under the terms of the GNU General Public License as published by the
+       * Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       
***************************************************************************/
+
+       /*{PRE_HTML_PHP}*/
+       /*{POST_HTML_PHP}*/
+
+       function get_preview_img($id)
+       {
+               return db_saq('SELECT mm.mime_hdr, a.original_name, a.location, 
0, 0, 0, a.fsize FROM {SQL_TABLE_PREFIX}attach a LEFT JOIN 
{SQL_TABLE_PREFIX}mime mm ON mm.id=a.mime_type WHERE a.message_id=0 AND 
a.id='.$id);
+       }

        if (!isset($_GET['id']) || !($id = (int)$_GET['id'])) {
                invl_inp_err();
        }
-       if (!isset($_GET['private'])) { /* non-private upload */
-               $r = db_saq('SELECT mm.mime_hdr, a.original_name, a.location, 
m.id, mod.id,
-                       ('.(_uid ? '(CASE WHEN g2.id IS NOT NULL THEN 
g2.group_cache_opt ELSE g1.group_cache_opt END)' : 'g1.group_cache_opt').' & 2) 
> 0
+
+       if (empty($_GET['private'])) { /* non-private upload */
+               $r = db_saq('SELECT mm.mime_hdr, a.original_name, a.location, 
m.id, mo.id,
+                       ('.(_uid ? 'COALESCE(g2.group_cache_opt, 
g1.group_cache_opt)' : 'g1.group_cache_opt').' & 2) > 0,
+                       a.fsize
                        FROM {SQL_TABLE_PREFIX}attach a
                        INNER JOIN {SQL_TABLE_PREFIX}msg m ON a.message_id=m.id 
AND a.attach_opt=0
                        INNER JOIN {SQL_TABLE_PREFIX}thread t ON 
m.thread_id=t.id
                        INNER JOIN {SQL_TABLE_PREFIX}group_cache g1 ON 
g1.user_id='.(_uid ? 2147483647 : 0).' AND g1.resource_id=t.forum_id
-                       LEFT JOIN {SQL_TABLE_PREFIX}mod mod ON 
mod.forum_id=t.forum_id AND mod.user_id='._uid.'
+                       LEFT JOIN {SQL_TABLE_PREFIX}mod mo ON 
mo.forum_id=t.forum_id AND mo.user_id='._uid.'
                        LEFT JOIN {SQL_TABLE_PREFIX}mime mm ON mm.id=a.mime_type
                        '.(_uid ? 'LEFT JOIN {SQL_TABLE_PREFIX}group_cache g2 
ON g2.user_id='._uid.' AND g2.resource_id=t.forum_id' : '').'
                        WHERE a.id='.$id);
                if (!$r) {
-                       invl_inp_err();
-               }
-               if (!($usr->users_opt & 1048576) && !$r[4] && !$r[5]) {
+                       if (!($r = get_preview_img($id))) {
+                               invl_inp_err();
+                       }
+               } else if (!$is_a && !$r[4] && !$r[5]) {
                        std_error('access');
                }
        } else {
-               $r = db_saq('SELECT mm.mime_hdr, a.original_name, a.location, 
pm.id, a.owner
+               $r = db_saq('SELECT mm.mime_hdr, a.original_name, a.location, 
pm.id, a.owner, a.fsize
                        FROM {SQL_TABLE_PREFIX}attach a
                        INNER JOIN {SQL_TABLE_PREFIX}pmsg pm ON 
a.message_id=pm.id AND a.attach_opt=1
                        LEFT JOIN {SQL_TABLE_PREFIX}mime mm ON mm.id=a.mime_type
                        WHERE a.attach_opt=1 AND a.id='.$id);
                if (!$r) {
-                       invl_inp_err();
-               }
-               if (!($usr->users_opt & 1048576) && $r[4] != _uid) {
+                       if (!($r = get_preview_img($id))) {
+                               invl_inp_err();
+                       }
+               } else if (!$is_a && $r[4] != _uid) {
                        std_error('access');
                }
        }
@@ -54,7 +63,7 @@

        reverse_fmt($r[1]);
        if (!$r[0]) {
-               $r[0] = 'application/ocet-stream';
+               $r[0] = 'application/octet-stream';
                $append = 'attachment; ';
        } else if (isset($_SERVER['HTTP_USER_AGENT']) && 
strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') && 
preg_match('!^(audio|video|image)/!i', $r[0])) {
                $append = 'inline; ';
@@ -74,13 +83,28 @@
                }
        }

-       header('Content-type: '.$r[0]);
-       header('Content-Disposition: '.$append.'filename='.$r[1]);
+       /* this is a hack for IE browsers when working on HTTPs,
+        * the no-cache headers appear to cause problems as indicated by the 
following
+        * MS advisories:
+        *      http://support.microsoft.com/?kbid=812935
+        *      http://support.microsoft.com/default.aspx?scid=kb;en-us;316431
+        */
+       if ($_SERVER["SERVER_PORT"] == "443" && 
(strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE') !== false)) {
+               header("Cache-Control: must-revalidate, post-check=0, 
pre-check=0", 1);
+               header("Pragma: public", 1);
+       } else if (__fud_cache(filemtime($r[2]))) {
+               return;
+       }
+
+       header('Content-Type: '.$r[0]);
+       header('Content-Disposition: '.$append.'filename="'.$r[1].'"');
+       header('Content-Length: '.array_pop($r));

        if (!$r[2]) {
                $r[2] = $GLOBALS['FILE_STORE'] . $id . '.atch';
        }

        attach_inc_dl_count($id, $r[3]);
-       @fpassthru(fopen($r[2], 'rb'));
-?>
\ No newline at end of file
+       //@fpassthru(fopen($r[2], 'rb'));
+       @readfile($r[2]);
+?>






reply via email to

[Prev in Thread] Current Thread [Next in Thread]