Author Topic: Integration zip viewer to 4images !  (Read 9670 times)

0 Members and 1 Guest are viewing this topic.

Offline milance

  • Newbie
  • *
  • Posts: 28
    • View Profile
Integration zip viewer to 4images !
« on: November 09, 2005, 11:09:41 PM »
How to integrate zip viewer to 4images ???
Thank you..
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/template/media/zip.html

Fatal error: Cannot redeclare msdos_time_to_unix() (previously declared in /var/www/free.fr/x/x/name/includes/template.php(101) : eval()'d code:35) in /var/www/free.fr/x/x/name/includes/template.php(101) : eval()'d code on line 35
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Code: [Select]
<?php 
/*************************************************************************** 
 *                                   zip.php 
 *                            ------------------- 
 *   begin                : Saturday', Mar 08', 2003 
 *   copyright            : ('C) 2002-03 Bugada Andrea 
 *   email                : phpATM@free.fr 
 * 
 *   $Id: zip.php, v1.12 2003/03/09 11:53:50 bugada Exp $ 
 * 
 * 
 ***************************************************************************/ 

/*************************************************************************** 
 * 
 *   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. 
 * 
 ***************************************************************************/ 

// 
// VIEWER VARIABLES SET 
// ------------------------------------------------------------------------------------------ 
// $current_dir: contains the directory (absolute path) of the file to be showed 
// $directory:   contains the directory (relative to upload folder) of the file to be showed 
// $filename:    contains the filename to be showed 
// 


// 
// Converte il formato della data da dos a unix 
// 
function msdos_time_to_unix($DOSdate$DOStime

   $year = (($DOSdate 65024) >> 9) + 1980
   $month = ($DOSdate 480) >> 5
   $day = ($DOSdate 31); 
   $hours = ($DOStime 63488) >> 11
   $minutes = ($DOStime 2016) >> 5
   $seconds = ($DOStime 31) * 2
   return mktime($hours$minutes$seconds$month$day$year); 


// 
// Elenca il contenuto di un file zip 
// 
function list_zip($filename

   global $bordercolor$headercolor$tablecolor$font$headerfontcolor
   global $normalfontcolor$datetimeformat$mess

   $fp = @fopen($filename,'rb'); 
   if (!$fp
   
      return; 
   
   fseek($fp, -22SEEK_END); 

   // Get central directory field values 
   $headersignature 0
   do 
   

      // Search header 
      $data fread($fp22); 
      list($headersignature,$numberentries$centraldirsize$centraldiroffset) = 
         array_values(unpack('Vheadersignature/x6/vnumberentries/Vcentraldirsize/Vcentraldiroffset'$data)); 

      fseek($fp, -23SEEK_CUR); 
   } while (($headersignature != 0x06054b50) && (ftell($fp) > 0)); 

   if ($headersignature != 0x06054b50
   
      echo "<p><font face=\"$font\" size=\"3\" color=\"$normalfontcolor\">$mess[45]</font></p>"
      fclose($fp); 
      return; 
   

   // Go to start of central directory 
   fseek($fp$centraldiroffsetSEEK_SET); 

   // Read central dir entries 
   echo "<p><font face=\"$font\" size=\"3\" color=\"$normalfontcolor\">$mess[46]</font></p>"
   echo "<p><table border=\"0\" width=\"90%\" bgcolor=\"$bordercolor\" cellpadding=\"4\" cellspacing=\"1\">"
   echo "<tr bgcolor=\"$headercolor\"> 
   <td> 
      <b><font face=\"
$font\" size=\"2\" color=\"$headerfontcolor\">$mess[15]</font></b> 
   </td> 
   <td> 
      <b><font face=\"
$font\" size=\"2\" color=\"$headerfontcolor\">$mess[17]</font></b> 
   </td> 
   <td> 
      <b><font face=\"
$font\" size=\"2\" color=\"$headerfontcolor\">$mess[47]</font></b> 
   </td> 
   </tr>"


   for ($i 1$i <= $numberentries$i++) 
   
      // Read central dir entry 
      $data fread($fp46); 
      list($arcfiletime,$arcfiledate,$arcfilesize,$arcfilenamelen,$arcfileattr) = 
         array_values(unpack("x12/varcfiletime/varcfiledate/x8/Varcfilesize/Varcfilenamelen/x6/varcfileattr"$data)); 
      $filenamelen fread($fp$arcfilenamelen); 

      $arcfiledatetime msdos_time_to_unix($arcfiledate$arcfiletime); 

      echo "<tr bgcolor=\"$tablecolor\">"

      // Print FileName 
      echo '<td>'
      echo "<font face=\"$font\" size=\"1\" color=\"$normalfontcolor\">"
      if ($arcfileattr == 16
      
         echo "<b>$filenamelen</b>"
      
      else 
      
         echo $filenamelen
      

      echo '</font>'
      echo '</td>'

      // Print FileSize column 
      echo "<td><font face=\"$font\" size=\"1\" color=\"$normalfontcolor\">"

      if ($arcfileattr == 16
         echo $mess[48]; 
      else 
         echo $arcfilesize ' bytes'

      echo '</td></font>'

      // Print FileDate column 
      echo "<td><font face=\"$font\" size=\"1\" color=\"$normalfontcolor\">"
      echo date($datetimeformat$arcfiledatetime); 
      echo '</td></font>'
      echo '</tr>'
   
   echo '</table></p>'
   fclose($fp); 
   return



// 
// START OF VIEWER MAIN CODE 
// 
echo "<html>\n"
echo 
"<head><title></title></head>\n"
echo 
"<body>\n"
echo 
"<center>\n"
list_zip("{media_src}"); 
echo 
"{media_icon}</center>\n"
echo 
"</body>\n"
echo 
"</html>\n"
?>


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Integration zip viewer to 4images !
« Reply #1 on: November 09, 2005, 11:55:32 PM »
Please dont double post and use BBCode so it would make your posts easier to read.

P.S. the other topic deleted.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline milance

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Integration zip viewer to 4images !
« Reply #2 on: November 10, 2005, 07:04:35 AM »
Sory ! :(

Offline Acidgod

  • Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Integration zip viewer to 4images !
« Reply #3 on: November 10, 2005, 11:32:00 AM »
what do you meen with zip viewer?

is it a script to list the content of a zip file?

Offline milance

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Integration zip viewer to 4images !
« Reply #4 on: November 10, 2005, 06:20:25 PM »
Hello !
Yes it's that. I want to use them for 4images for listing zip files. Visit my site on http://deleted!!! I don't use this site for images, i use it for another kind of files. That site is just an exemple, my relly site is http://www.midi-matrix.com .
Thank you .

/template/media/zip.html

Fatal error: Cannot redeclare msdos_time_to_unix() (previously declared in /var/www/free.fr/x/x/name/includes/template.php(101) : eval()'d code:35) in /var/www/free.fr/x/x/name/includes/template.php(101) : eval()'d code on line 35

Offline Acidgod

  • Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: Integration zip viewer to 4images !
« Reply #5 on: November 10, 2005, 06:53:25 PM »
sorry i don´t now where is the problem... )o:

please post  the code of the template or the link to the error message or both...

Offline milance

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Integration zip viewer to 4images !
« Reply #6 on: November 10, 2005, 09:33:06 PM »
link to the error message : http://deleted!!!/categories.php?cat_id=2

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Integration zip viewer to 4images !
« Reply #7 on: November 11, 2005, 12:46:25 AM »
Code: [Select]
<?php 
/*************************************************************************** 
 *                                   zip.php 
 *                            ------------------- 
 *   begin                : Saturday', Mar 08', 2003 
 *   copyright            : ('C) 2002-03 Bugada Andrea 
 *   email                : phpATM@free.fr 
 * 
 *   $Id: zip.php, v1.12 2003/03/09 11:53:50 bugada Exp $ 
 * 
 * 
 ***************************************************************************/ 

/*************************************************************************** 
 * 
 *   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. 
 * 
 ***************************************************************************/ 

// 
// VIEWER VARIABLES SET 
// ------------------------------------------------------------------------------------------ 
// $current_dir: contains the directory (absolute path) of the file to be showed 
// $directory:   contains the directory (relative to upload folder) of the file to be showed 
// $filename:    contains the filename to be showed 
// 

if (!function_exists("list_zip"))
{
  
// 
  // Converte il formato della data da dos a unix 
  // 
  
function msdos_time_to_unix($DOSdate$DOStime
  { 
     
$year = (($DOSdate 65024) >> 9) + 1980
     
$month = ($DOSdate 480) >> 5
     
$day = ($DOSdate 31); 
     
$hours = ($DOStime 63488) >> 11
     
$minutes = ($DOStime 2016) >> 5
     
$seconds = ($DOStime 31) * 2
     return 
mktime($hours$minutes$seconds$month$day$year); 
  } 
  
  
// 
  // Elenca il contenuto di un file zip 
  // 
  
function list_zip($filename
  { 
     global 
$bordercolor$headercolor$tablecolor$font$headerfontcolor
     global 
$normalfontcolor$datetimeformat$mess
  
     
$fp = @fopen($filename,'rb'); 
     if (!
$fp
     { 
        return; 
     } 
     
fseek($fp, -22SEEK_END); 
  
     
// Get central directory field values 
     
$headersignature 0
     do 
     { 
        
// Search header 
        
$data fread($fp22); 
        list(
$headersignature,$numberentries$centraldirsize$centraldiroffset) = 
           
array_values(unpack('Vheadersignature/x6/vnumberentries/Vcentraldirsize/Vcentraldiroffset'$data)); 
  
        
fseek($fp, -23SEEK_CUR); 
     } while ((
$headersignature != 0x06054b50) && (ftell($fp) > 0)); 
  
     if (
$headersignature != 0x06054b50
     { 
        echo 
"<p><font face=\"$font\" size=\"3\" color=\"$normalfontcolor\">$mess[45]</font></p>"
        
fclose($fp); 
        return; 
     } 
  
     
// Go to start of central directory 
     
fseek($fp$centraldiroffsetSEEK_SET); 
  
     
// Read central dir entries 
     
echo "<p><font face=\"$font\" size=\"3\" color=\"$normalfontcolor\">$mess[46]</font></p>"
     echo 
"<p><table border=\"0\" width=\"90%\" bgcolor=\"$bordercolor\" cellpadding=\"4\" cellspacing=\"1\">"
     echo 
"<tr bgcolor=\"$headercolor\"> 
     <td> 
        <b><font face=\"
$font\" size=\"2\" color=\"$headerfontcolor\">$mess[15]</font></b> 
     </td> 
     <td> 
        <b><font face=\"
$font\" size=\"2\" color=\"$headerfontcolor\">$mess[17]</font></b> 
     </td> 
     <td> 
        <b><font face=\"
$font\" size=\"2\" color=\"$headerfontcolor\">$mess[47]</font></b> 
     </td> 
     </tr>"

  
     for (
$i 1$i <= $numberentries$i++) 
     { 
        
// Read central dir entry 
        
$data fread($fp46); 
        list(
$arcfiletime,$arcfiledate,$arcfilesize,$arcfilenamelen,$arcfileattr) = 
           
array_values(unpack("x12/varcfiletime/varcfiledate/x8/Varcfilesize/Varcfilenamelen/x6/varcfileattr"$data)); 
        
$filenamelen fread($fp$arcfilenamelen); 
  
        
$arcfiledatetime msdos_time_to_unix($arcfiledate$arcfiletime); 
  
        echo 
"<tr bgcolor=\"$tablecolor\">"
  
        
// Print FileName 
        
echo '<td>'
        echo 
"<font face=\"$font\" size=\"1\" color=\"$normalfontcolor\">"
        if (
$arcfileattr == 16
        { 
           echo 
"<b>$filenamelen</b>"
        } 
        else 
        { 
           echo 
$filenamelen
        } 
  
        echo 
'</font>'
        echo 
'</td>'
  
        
// Print FileSize column 
        
echo "<td><font face=\"$font\" size=\"1\" color=\"$normalfontcolor\">"
  
        if (
$arcfileattr == 16
           echo 
$mess[48]; 
        else 
           echo 
$arcfilesize ' bytes'
  
        echo 
'</td></font>'
  
        
// Print FileDate column 
        
echo "<td><font face=\"$font\" size=\"1\" color=\"$normalfontcolor\">"
        echo 
date($datetimeformat$arcfiledatetime); 
        echo 
'</td></font>'
        echo 
'</tr>'
     } 
     echo 
'</table></p>'
     
fclose($fp); 
     return; 
  } 
}

// 
// START OF VIEWER MAIN CODE 
// 
echo "<html>\n"
echo 
"<head><title></title></head>\n"
echo 
"<body>\n"
echo 
"<center>\n"
list_zip("{media_src}"); 
echo 
"{media_icon}</center>\n"
echo 
"</body>\n"
echo 
"</html>\n"
?>
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline milance

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Integration zip viewer to 4images !
« Reply #8 on: November 11, 2005, 12:12:38 PM »
Thank you w@no excelent  :D

« Last Edit: April 19, 2008, 12:38:32 AM by milance »