phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: ftp index.php,1.16,1.17


From: Miles Lott <address@hidden>
Subject: [Phpgroupware-cvs] CVS: ftp index.php,1.16,1.17
Date: Sat, 11 May 2002 19:58:53 -0400

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

Modified Files:
        index.php 
Log Message:
minor formatting

Index: index.php
===================================================================
RCS file: /cvsroot/phpgroupware/ftp/index.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** index.php   11 Dec 2001 02:13:29 -0000      1.16
--- index.php   11 May 2002 23:58:49 -0000      1.17
***************
*** 1,15 ****
  <?php
! /**************************************************************************\
! * phpGroupWare - Ftp Module                                                *
! * http://www.phpgroupware.org                                              *
! * Written by Scott Moser <address@hidden>                             *
! * --------------------------------------------                             *
! *  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.                                              *
! \**************************************************************************/
  
!       /* $Id$ */
  
        $GLOBALS['phpgw_info']['flags'] = array(
--- 1,15 ----
  <?php
!   /**************************************************************************\
!   * phpGroupWare - Ftp Module                                                *
!   * http://www.phpgroupware.org                                              *
!   * Written by Scott Moser <address@hidden>                             *
!   * --------------------------------------------                             *
!   *  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.                                              *
!   \**************************************************************************/
  
!   /* $Id$ */
  
        $GLOBALS['phpgw_info']['flags'] = array(
***************
*** 25,29 ****
        include('../header.inc.php');
  
!       if (! $start)
        {
                $start = 0;
--- 25,29 ----
        include('../header.inc.php');
  
!       if(!$start)
        {
                $start = 0;
***************
*** 65,72 ****
        $GLOBALS['phpgw']->template->set_var('module_name',lang('module name'));
  
!       if ($action=='' || $action=='login')
        {
                // if theres no action, try to login to default host with user 
and pass
!               if ($action=='login') 
                {
                        // username, ftpserver and password should have been 
passed in
--- 65,72 ----
        $GLOBALS['phpgw']->template->set_var('module_name',lang('module name'));
  
!       if($action=='' || $action=='login')
        {
                // if theres no action, try to login to default host with user 
and pass
!               if($action=='login')
                {
                        // username, ftpserver and password should have been 
passed in
***************
*** 79,83 ****
                {
                        // try to default with session id and passwd
!                       if (!($connInfo=getConnectionInfo())) 
                        {
                                $connInfo['username']  = $default_login;
--- 79,83 ----
                {
                        // try to default with session id and passwd
!                       if(!($connInfo=getConnectionInfo()))
                        {
                                $connInfo['username']  = $default_login;
***************
*** 90,119 ****
                updateSession($connInfo);
                $sessionUpdated=true;
!       } 
  
!       if ($action != 'newlogin') 
        {
!               if (empty($connInfo)) 
                {
                        $connInfo=getConnectionInfo();
                }
                
address@hidden($connInfo['ftpserver'],$connInfo['username'],$connInfo['password']);
!               if ($ftp)
                {
                        $homedir=ftp_pwd($ftp);
                        $retval=ftp_pasv($ftp,1);
!                       if ($action == 'delete' || $action == 'rmdir') 
                        {
!                               if ($confirm) 
                                {
!                                       if ($action=='delete') 
                                        {
                                                $retval=ftp_delete($ftp,$olddir 
. '/' . $file);
                                        }
!                                       else 
                                        {
                                                $retval=ftp_rmdir($ftp,$olddir 
. '/' . $file);
                                        }
!                                       if ($retval) 
                                        {
                                                
$GLOBALS['phpgw']->template->set_var("misc_data",lang('deleted',"$olddir/$file"),
 true);
--- 90,119 ----
                updateSession($connInfo);
                $sessionUpdated=true;
!       }
  
!       if($action != 'newlogin')
        {
!               if(empty($connInfo))
                {
                        $connInfo=getConnectionInfo();
                }
                
address@hidden($connInfo['ftpserver'],$connInfo['username'],$connInfo['password']);
!               if($ftp)
                {
                        $homedir=ftp_pwd($ftp);
                        $retval=ftp_pasv($ftp,1);
!                       if($action == 'delete' || $action == 'rmdir')
                        {
!                               if($confirm)
                                {
!                                       if($action=='delete')
                                        {
                                                $retval=ftp_delete($ftp,$olddir 
. '/' . $file);
                                        }
!                                       else
                                        {
                                                $retval=ftp_rmdir($ftp,$olddir 
. '/' . $file);
                                        }
!                                       if($retval)
                                        {
                                                
$GLOBALS['phpgw']->template->set_var("misc_data",lang('deleted',"$olddir/$file"),
 true);
***************
*** 123,127 ****
                                                
$GLOBALS['phpgw']->template->set_var('misc_data',lang('failed to delete', 
"$olddir/$file"), true);
                                        }
!                               } else if (!$cancel) 
                                {
                                        
$GLOBALS['phpgw']->template->set_var('misc_data',confirmDeleteForm($session,$file,$olddir),true);
--- 123,128 ----
                                                
$GLOBALS['phpgw']->template->set_var('misc_data',lang('failed to delete', 
"$olddir/$file"), true);
                                        }
!                               }
!                               elseif(!$cancel)
                                {
                                        
$GLOBALS['phpgw']->template->set_var('misc_data',confirmDeleteForm($session,$file,$olddir),true);
***************
*** 129,142 ****
                        }
  
!                       if ($action == 'rename')
                        {
!                               if ($confirm) 
                                {
!                                       if (ftp_rename($ftp,$olddir . '/' . 
$filename, $olddir . '/' . $newfilename)) 
                                        {
                                                
$GLOBALS['phpgw']->template->set_var('misc_data',lang('renamed',
                                                        "$filename", 
"$newfilename"), true);
!                                       } 
!                                       else 
                                        {
                                                
$GLOBALS['phpgw']->template->set_var('misc_data',lang('failed to rename',
--- 130,143 ----
                        }
  
!                       if($action == 'rename')
                        {
!                               if($confirm)
                                {
!                                       if(ftp_rename($ftp,$olddir . '/' . 
$filename, $olddir . '/' . $newfilename))
                                        {
                                                
$GLOBALS['phpgw']->template->set_var('misc_data',lang('renamed',
                                                        "$filename", 
"$newfilename"), true);
!                                       }
!                                       else
                                        {
                                                
$GLOBALS['phpgw']->template->set_var('misc_data',lang('failed to rename',
***************
*** 149,170 ****
                                }
                        }
!                       if ($action == 'get') 
                        {
                                phpftp_get($ftp,$tempdir,$olddir,$file);
                                $GLOBALS['phpgw']->common->phpgw_exit();
!                       } 
!                       if ($action == 'view') 
                        {
                                phpftp_view($ftp,$tempdir,$olddir,$file);
                                $GLOBALS['phpgw']->common->phpgw_exit();
                        }
!                       if ($action == 'upload') 
                        {
                                $newfile=$olddir . '/' . $uploadfile_name;
!                               if (ftp_put($ftp,$newfile, $uploadfile, 
FTP_BINARY)) 
                                {
                                        
$GLOBALS['phpgw']->template->set_var('misc_data',lang('uploaded',$newfile), 
true);
                                }
!                               else 
                                {
                                        
$GLOBALS['phpgw']->template->set_var('misc_data',lang('failed to 
upload',$newfile), true);
--- 150,171 ----
                                }
                        }
!                       if($action == 'get')
                        {
                                phpftp_get($ftp,$tempdir,$olddir,$file);
                                $GLOBALS['phpgw']->common->phpgw_exit();
!                       }
!                       if($action == 'view')
                        {
                                phpftp_view($ftp,$tempdir,$olddir,$file);
                                $GLOBALS['phpgw']->common->phpgw_exit();
                        }
!                       if($action == 'upload')
                        {
                                $newfile=$olddir . '/' . $uploadfile_name;
!                               if(ftp_put($ftp,$newfile, $uploadfile, 
FTP_BINARY))
                                {
                                        
$GLOBALS['phpgw']->template->set_var('misc_data',lang('uploaded',$newfile), 
true);
                                }
!                               else
                                {
                                        
$GLOBALS['phpgw']->template->set_var('misc_data',lang('failed to 
upload',$newfile), true);
***************
*** 172,185 ****
                                unlink($uploadfile);
                        }
!                       if ($action == 'mkdir')
                        {
!                               if ($newdirname!='')
                                {
!                                       if (ftp_mkdir($ftp,$olddir . '/' . 
$newdirname)) 
                                        {
                                                
$GLOBALS['phpgw']->template->set_var('misc_data',lang('created directory',
                                                        "$olddir/$newdirname"), 
true);
                                        }
!                                       else 
                                        {
                                                
$GLOBALS['phpgw']->template->set_var('misc_data',lang('failed to mkdir',
--- 173,186 ----
                                unlink($uploadfile);
                        }
!                       if($action == 'mkdir')
                        {
!                               if($newdirname!='')
                                {
!                                       if(ftp_mkdir($ftp,$olddir . '/' . 
$newdirname))
                                        {
                                                
$GLOBALS['phpgw']->template->set_var('misc_data',lang('created directory',
                                                        "$olddir/$newdirname"), 
true);
                                        }
!                                       else
                                        {
                                                
$GLOBALS['phpgw']->template->set_var('misc_data',lang('failed to mkdir',
***************
*** 187,191 ****
                                        }
                                }
!                               else 
                                {
                                        
$GLOBALS['phpgw']->template->set_var('misc_data',lang('empty dirname'),true);
--- 188,192 ----
                                        }
                                }
!                               else
                                {
                                        
$GLOBALS['phpgw']->template->set_var('misc_data',lang('empty dirname'),true);
***************
*** 194,200 ****
  
                        // heres where most of the work takes place
!                       if ($action == 'cwd')
                        {
!                               if ($olddir == $newdir)
                                {
                                        ftp_chdir($ftp,$newdir);
--- 195,201 ----
  
                        // heres where most of the work takes place
!                       if($action == 'cwd')
                        {
!                               if($olddir == $newdir)
                                {
                                        ftp_chdir($ftp,$newdir);
***************
*** 206,210 ****
                                }
                        }
!                       elseif ($action == '' && $connInfo['cwd'] != '')
                        {
                                // this must have come back from another 
module, try to 
--- 207,211 ----
                                }
                        }
!                       elseif($action == '' && $connInfo['cwd'] != '')
                        {
                                // this must have come back from another 
module, try to 
***************
*** 212,221 ****
                                ftp_chdir($ftp,$connInfo['cwd']);
                        }
!                       elseif ($olddir)
                        {
                                ftp_chdir($ftp,$olddir);
                        }
  
!                       if (! $olddir)
                        {
                                $olddir = ftp_pwd($ftp);
--- 213,222 ----
                                ftp_chdir($ftp,$connInfo['cwd']);
                        }
!                       elseif($olddir)
                        {
                                ftp_chdir($ftp,$olddir);
                        }
  
!                       if(!$olddir)
                        {
                                $olddir = ftp_pwd($ftp);
***************
*** 276,280 ****
                        
$GLOBALS['phpgw']->template->set_var('lang_rename',lang('Rename'));
  
- 
                        $newdir = $olddir;
                        
$GLOBALS['phpgw']->template->set_var('name',macro_get_link('cwd','..'));
--- 277,280 ----
***************
*** 286,290 ****
                        
$GLOBALS['phpgw']->template->fp('rowlist_dir','row',True);
  
!                       while (list(,$fileinfo) = each($contents))
                        {
  //                            echo '<pre>'; print_r($fileinfo); echo '</pre>';
--- 286,290 ----
                        
$GLOBALS['phpgw']->template->fp('rowlist_dir','row',True);
  
!                       while(list(,$fileinfo) = each($contents))
                        {
  //                            echo '<pre>'; print_r($fileinfo); echo '</pre>';
***************
*** 294,303 ****
                                
$GLOBALS['phpgw']->template->set_var('permissions',$fileinfo['permissions']);
  
! /*                            if ($fileinfo['size'] < 1024)
                                {
                                        $fileinfo['size'] = $fileinfo['size'] . 
' b';
                                }
!                               else */
!                               if ($fileinfo['size'] < 999999)
                                {
                                        $fileinfo['size'] = 
round(10*($fileinfo['size']/1024))/10 .' k';
--- 294,303 ----
                                
$GLOBALS['phpgw']->template->set_var('permissions',$fileinfo['permissions']);
  
! /*                            if($fileinfo['size'] < 1024)
                                {
                                        $fileinfo['size'] = $fileinfo['size'] . 
' b';
                                }
!                               else*/
!                               if($fileinfo['size'] < 999999)
                                {
                                        $fileinfo['size'] = 
round(10*($fileinfo['size']/1024))/10 .' k';
***************
*** 310,314 ****
                                        $fileinfo['size'] = 
($fileinfo['size']/10) .' MB';
                                }
!                               if (substr($fileinfo['permissions'],0,1) == 'd')
                                {
                                        $file = $fileinfo['name'];
--- 310,314 ----
                                        $fileinfo['size'] = 
($fileinfo['size']/10) .' MB';
                                }
!                               if(substr($fileinfo['permissions'],0,1) == 'd')
                                {
                                        $file = $fileinfo['name'];
***************
*** 329,345 ****
                        ftp_quit($ftp);
                        $GLOBALS['phpgw']->template->pfp('out','main');
!               } 
!               else 
                {
                        updateSession();
                        $sessionUpdated=true;
!                       if (!$tried_default) 
                        {
                                // don't put out an error on the default login
                                for($i=0;$i<strlen($connInfo['password']);$i++)
                                {
!                                        $pass.="*"; 
                                }
!                               
$GLOBALS['phpgw']->template->set_var('error_message', lang('bad connection', 
                                        $connInfo['ftpserver'], 
$connInfo['username'], $pass), true);
                                
$GLOBALS['phpgw']->template->parse('out','bad_connect',false);
--- 329,345 ----
                        ftp_quit($ftp);
                        $GLOBALS['phpgw']->template->pfp('out','main');
!               }
!               else
                {
                        updateSession();
                        $sessionUpdated=true;
!                       if(!$tried_default)
                        {
                                // don't put out an error on the default login
                                for($i=0;$i<strlen($connInfo['password']);$i++)
                                {
!                                       $pass.="*";
                                }
!                               
$GLOBALS['phpgw']->template->set_var('error_message', lang('bad connection',
                                        $connInfo['ftpserver'], 
$connInfo['username'], $pass), true);
                                
$GLOBALS['phpgw']->template->parse('out','bad_connect',false);
***************
*** 349,353 ****
                }
        }
!       else 
        {
                // set the login and such to ""
--- 349,353 ----
                }
        }
!       else
        {
                // set the login and such to ""
***************
*** 357,361 ****
                newLogin($default_server,$default_login,'');
        }
!       if (!$sessionUpdated && $action=='cwd') 
        {
                // echo "updating session with new cwd<BR>\n";
--- 357,361 ----
                newLogin($default_server,$default_login,'');
        }
!       if(!$sessionUpdated && $action=='cwd')
        {
                // echo "updating session with new cwd<BR>\n";




reply via email to

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