phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: ftp/inc functions.inc.php,1.14,1.15


From: Miles Lott <address@hidden>
Subject: [Phpgroupware-cvs] CVS: ftp/inc functions.inc.php,1.14,1.15
Date: Sat, 11 May 2002 19:55:10 -0400

Update of /cvsroot/phpgroupware/ftp/inc
In directory subversions:/tmp/cvs-serv12421

Modified Files:
        functions.inc.php 
Log Message:
minor formatting

Index: functions.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/ftp/inc/functions.inc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** functions.inc.php   11 Dec 2001 02:13:29 -0000      1.14
--- functions.inc.php   11 May 2002 23:55:05 -0000      1.15
***************
*** 18,24 ****
        }
  
!       function getConnectionInfo() 
        {
!               $unencrypted=$GLOBALS['phpgw']->session->appsession();
                return $unencrypted;
        }
--- 18,24 ----
        }
  
!       function getConnectionInfo()
        {
!               $unencrypted = $GLOBALS['phpgw']->session->appsession();
                return $unencrypted;
        }
***************
*** 28,34 ****
                // echo "connecting to $host with $user and $pass\n";
                $ftp = ftp_connect($host);
!               if ( $ftp ) 
                {
!                       if ( ftp_login($ftp,$user,$pass) ) 
                        {
                                return $ftp;
--- 28,34 ----
                // echo "connecting to $host with $user and $pass\n";
                $ftp = ftp_connect($host);
!               if($ftp) 
                {
!                       if(ftp_login($ftp,$user,$pass)) 
                        {
                                return $ftp;
***************
*** 96,100 ****
        }
  
!       function newLogin($dfhost,$dfuser,$dfpass) 
        {
                $login_form_begin= '<form 
action="'.createLink($GLOBALS['target']).'" method="post">'."\n".'<input 
type="hidden" name="action" value="login">'."\n";
--- 96,100 ----
        }
  
!       function newLogin($dfhost,$dfuser,$dfpass)
        {
                $login_form_begin= '<form 
action="'.createLink($GLOBALS['target']).'" method="post">'."\n".'<input 
type="hidden" name="action" value="login">'."\n";
***************
*** 132,139 ****
                ftp_chdir($ftp,$dir);
                $remotefile=$dir . '/' . $file;
!               if ( ! ftp_get( $ftp, $tmpfile, $remotefile, FTP_BINARY ) )
                {
                        echo 'tmpfile="' . $tmpfile . '",file="' . $remotefile 
. '"<br>' . "\n";
!                       ftp_quit( $ftp );
                        echo macro_get_Link('newlogin','Start over?');
                        $retval=0;
--- 132,139 ----
                ftp_chdir($ftp,$dir);
                $remotefile=$dir . '/' . $file;
!               if(!ftp_get($ftp, $tmpfile, $remotefile, FTP_BINARY))
                {
                        echo 'tmpfile="' . $tmpfile . '",file="' . $remotefile 
. '"<br>' . "\n";
!                       ftp_quit($ftp);
                        echo macro_get_Link('newlogin','Start over?');
                        $retval=0;
***************
*** 141,147 ****
                else
                {
!                       ftp_quit( $ftp );
                        $b = CreateObject('phpgwapi.browser');
!                       if ($GLOBALS['phpgw_info']['server']['ftp_use_mime'])
                        {
                                $mime = getMimeType($file);
--- 141,147 ----
                else
                {
!                       ftp_quit($ftp);
                        $b = CreateObject('phpgwapi.browser');
!                       if($GLOBALS['phpgw_info']['server']['ftp_use_mime'])
                        {
                                $mime = getMimeType($file);
***************
*** 154,161 ****
                        //header( "Content-Type: application/octet-stream" );
                        //header( "Content-Disposition: attachment; filename=" 
. $file );
!                       readfile( $tmpfile );
!                       $retval=1;
                }
!               @unlink( $tmpfile );
                return $retval;
        }
--- 154,161 ----
                        //header( "Content-Type: application/octet-stream" );
                        //header( "Content-Disposition: attachment; filename=" 
. $file );
!                       readfile($tmpfile);
!                       $retval = 1;
                }
!               @unlink($tmpfile);
                return $retval;
        }
***************
*** 163,185 ****
        function getMimeType($file)
        {
!               $file=basename($file);
                $mimefile = PHPGW_APP_ROOT . SEP . 'mime.types';
!               $fp=fopen($mimefile,"r");
                $contents = explode("\n",fread ($fp, filesize($mimefile)));
                fclose($fp);
  
!               $parts=explode(".",$file);
!               $ext=$parts[(sizeof($parts)-1)];
  
                for($i=0;$i<sizeof($contents);$i++)
                {
!                       if (! ereg("^#",$contents[$i]))
                        {
!                               $line=split("[[:space:]]+", $contents[$i]);
!                               if (sizeof($line) >= 2)
                                {
                                        for($j=1;$j<sizeof($line);$j++)
                                        {
!                                               if ($line[$j] == $ext)
                                                {
                                                        $mimetype=$line[0];
--- 163,185 ----
        function getMimeType($file)
        {
!               $file = basename($file);
                $mimefile = PHPGW_APP_ROOT . SEP . 'mime.types';
!               $fp = fopen($mimefile,"r");
                $contents = explode("\n",fread ($fp, filesize($mimefile)));
                fclose($fp);
  
!               $parts = explode(".",$file);
!               $ext = $parts[(sizeof($parts)-1)];
  
                for($i=0;$i<sizeof($contents);$i++)
                {
!                       if(!ereg("^#",$contents[$i]))
                        {
!                               $line = split("[[:space:]]+", $contents[$i]);
!                               if(sizeof($line) >= 2)
                                {
                                        for($j=1;$j<sizeof($line);$j++)
                                        {
!                                               if($line[$j] == $ext)
                                                {
                                                        $mimetype=$line[0];
***************
*** 193,208 ****
        }
  
!       function phpftp_view( $ftp, $tempdir, $dir, $file ) 
        {
                srand((double)microtime()*1000000);
                $randval = rand();
!               $tmpfile="$tempdir/" . $file . "." . $randval;
                ftp_chdir($ftp,$dir);
                $remotefile=$dir . "/" . $file;
!               if ( ! ftp_get( $ftp, $tmpfile, $remotefile, FTP_BINARY ) ) 
                {
                        echo "tmpfile=\"$tmpfile\",file=\"$remotefile\"<BR>\n";
                        macro_get_Link('newlogin','Start over?');
!                       $retval=0;
                }
                else 
--- 193,208 ----
        }
  
!       function phpftp_view($ftp, $tempdir, $dir, $file)
        {
                srand((double)microtime()*1000000);
                $randval = rand();
!               $tmpfile = "$tempdir/" . $file . "." . $randval;
                ftp_chdir($ftp,$dir);
                $remotefile=$dir . "/" . $file;
!               if(!ftp_get( $ftp, $tmpfile, $remotefile, FTP_BINARY))
                {
                        echo "tmpfile=\"$tmpfile\",file=\"$remotefile\"<BR>\n";
                        macro_get_Link('newlogin','Start over?');
!                       $retval = 0;
                }
                else 
***************
*** 211,217 ****
                        header('Content-Type: '.$content_type);
                        readfile( $tmpfile );
!                       $retval=1;
                }
!               @unlink( $tmpfile );
                return $retval;
        }
--- 211,217 ----
                        header('Content-Type: '.$content_type);
                        readfile( $tmpfile );
!                       $retval = 1;
                }
!               @unlink($tmpfile);
                return $retval;
        }
***************
*** 225,234 ****
        function analysedir($dirline)
        {
!               if (ereg("([-dl])[rwxst-]{9}",substr($dirline,0,10)))
                {
                        $systyp = 'UNIX';
                }
  
!               if (substr($dirline,0,5) == 'total')
                {
                        $dirinfo[0] = -1;
--- 225,234 ----
        function analysedir($dirline)
        {
!               if(ereg("([-dl])[rwxst-]{9}",substr($dirline,0,10)))
                {
                        $systyp = 'UNIX';
                }
  
!               if(substr($dirline,0,5) == 'total')
                {
                        $dirinfo[0] = -1;
***************
*** 236,240 ****
                elseif($systyp=='Windows_NT')
                {
!                       if (ereg("[-0-9]+ *[0-9:]+[PA]?M? +<DIR> 
{10}(.*)",$dirline,$regs))
                        {
                                $dirinfo[0] = 1;
--- 236,240 ----
                elseif($systyp=='Windows_NT')
                {
!                       if(ereg("[-0-9]+ *[0-9:]+[PA]?M? +<DIR> 
{10}(.*)",$dirline,$regs))
                        {
                                $dirinfo[0] = 1;
***************
*** 251,260 ****
                elseif($systyp=='UNIX')
                {
!                       if (ereg("([-d][rwxst-]{9}).*  ([a-zA-Z0-9]*) 
([a-zA-Z]+ [0-9: ]*[0-9]) (.+)",$dirline,$regs))
                        {
                                $ta = explode(' ',$dirline);
!                               while (list(,$p) = each($ta))
                                {
!                                       if ($p)
                                        {
                                                $a[] = $p;
--- 251,260 ----
                elseif($systyp=='UNIX')
                {
!                       if(ereg("([-d][rwxst-]{9}).*  ([a-zA-Z0-9]*) ([a-zA-Z]+ 
[0-9: ]*[0-9]) (.+)",$dirline,$regs))
                        {
                                $ta = explode(' ',$dirline);
!                               while(list(,$p) = each($ta))
                                {
!                                       if($p)
                                        {
                                                $a[] = $p;
***************
*** 270,279 ****
                        }
                }
!     
!               if (($dirinfo[2]=='.') || ($dirinfo[2]=='..'))
                {
                        $dirinfo[0] = 0;
                }
!         
                return $fileinfo;
        }
--- 270,279 ----
                        }
                }
! 
!               if(($dirinfo[2]=='.') || ($dirinfo[2]=='..'))
                {
                        $dirinfo[0] = 0;
                }
! 
                return $fileinfo;
        }
***************
*** 286,292 ****
                ftp_chdir($ftp,$dir);
                $dirlist = ftp_rawlist($ftp,'');
!               for ($i=$start; 
$i<($start+$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']);
 $i++)
                {
!                       if ($i < count($dirlist))
                        {
                                $dirinfo[] = analysedir($dirlist[$i]);
--- 286,292 ----
                ftp_chdir($ftp,$dir);
                $dirlist = ftp_rawlist($ftp,'');
!               for($i=$start; 
$i<($start+$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']);
 $i++)
                {
!                       if($i < count($dirlist))
                        {
                                $dirinfo[] = analysedir($dirlist[$i]);
***************
*** 296,300 ****
        }
  
!       function macro_get_Link($action,$string) 
        {
                // globals everything it needs but the string to link
--- 296,300 ----
        }
  
!       function macro_get_Link($action,$string)
        {
                // globals everything it needs but the string to link
***************
*** 304,308 ****
                                
'olddir='.urlencode($olddir).'&action='.urlencode($action)
                                . 
'&file='.urlencode($file).'&newdir='.urlencode($newdir)
!                       ).'">';
                $retval .= $string;
                $retval .= '</a>';
--- 304,309 ----
                                
'olddir='.urlencode($olddir).'&action='.urlencode($action)
                                . 
'&file='.urlencode($file).'&newdir='.urlencode($newdir)
!                       )
!                       . '">';
                $retval .= $string;
                $retval .= '</a>';
***************
*** 314,318 ****
        }
  
!       function phpftp_rename($origfile,$newfile,$confirm) 
        {
        }
--- 315,319 ----
        }
  
!       function phpftp_rename($origfile,$newfile,$confirm)
        {
        }




reply via email to

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