phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] filemanager/index.php, 1.30.2.9.2.16


From: nomail
Subject: [Phpgroupware-cvs] filemanager/index.php, 1.30.2.9.2.16
Date: Fri, 28 May 2004 09:23:27 +0200

Update of /filemanager
Modified Files:
        Branch: Version-0_9_16-branch
          index.php

date: 2004/05/28 07:23:27;  author: powerstat;  state: Exp;  lines: +101 -69

Log Message:
patch #3101
also added some {}
=====================================================================
Index: filemanager/index.php
diff -u filemanager/index.php:1.30.2.9.2.15 filemanager/index.php:1.30.2.9.2.16
--- filemanager/index.php:1.30.2.9.2.15 Fri May 14 01:10:01 2004
+++ filemanager/index.php       Fri May 28 07:23:27 2004
@@ -78,6 +78,20 @@
        }
 }
 
+/* This allows files to be uploaded using "enter" on your keyboard */
+$upload_files = false;
+$array_fileuploads = count ($_FILES['upload_file']['name']);
+if ($array_fileuploads > 0)
+{
+       for ($i = 0; $i < $array_fileuploads; ++$i)
+               {
+               if ($_FILES['upload_file']['name'][$i])
+                       {
+                               $upload_files = true;
+                       }
+               }
+}
+
 if ($noheader || $nofooter || ($download && (count ($fileman) > 0)) || ($op == 
'view' && $file) || ($op == 'history' && $file) || ($op == 'help' && 
$help_name))
 {
        $noheader = True;
@@ -157,13 +171,18 @@
 
 /* This just prevents // in some cases */
 if ($path == '/')
+{
        $dispsep = '';
+}
 else
+{
        $dispsep = '/';
+}
 
 if (!($lesspath = substr ($path, 0, strrpos ($path, '/'))))
+{
        $lesspath = '/';
-
+}
 $now = date ('Y-m-d');
 
 if ($phpwh_debug)
@@ -543,7 +562,7 @@
 
 }
 
-if ($newfile && $createfile)
+if ($createfile)
 {
        if ($badchar = bad_chars ($createfile, True, True))
        {
@@ -587,8 +606,9 @@
        while (list ($num, $help_array) = each ($help_info))
        {
                if ($help_array[0] != $help_name)
+               {
                        continue;
-
+               }
                $help_array[1] = preg_replace ("/\[(.*)\|(.*)\]/Ue", 
"html_help_link ('\\1', '\\2', False, True)", $help_array[1]);
                $help_array[1] = preg_replace ("/\[(.*)\]/Ue", "html_help_link 
('\\1', '\\1', False, True)", $help_array[1]);
 
@@ -656,7 +676,7 @@
                        }
                }
                $columns++;
-               html_table_begin ('100%',1);
+               html_table_begin ('100%');
                
                        html_table_row_begin (NULL, NULL, NULL, 
HTML_TABLE_FILES_HEADER_BG_COLOR);
                        
@@ -724,7 +744,7 @@
                                                {                               
                
                                                        html_table_begin 
('100%');
                                                                // Show Upload 
fields
-                                                               
html_table_row_begin ('center');
+                                                               
html_table_row_begin ('center','', '', '', '', 
'','style="background-color:#C0C0C0"');
                                                                        
html_table_col_begin (NULL, NULL, NULL, NULL, 4);
                                                                                
html_text (lang('Show') . html_nbsp (1, True));
                                                                                
html_link ($GLOBALS['appname'].'/index.php?show_upload_boxes=1', '1');
@@ -769,7 +789,7 @@
                                                                                
html (html_form_input ('text', 'upload_comment[]', NULL, NULL, NULL, NULL, 
NULL, '', 1) . html_break (1, NULL, 1), $show_upload_boxes);
                                                                        
html_table_col_end ();
                                                                        
html_table_col_begin ('left',NULL,NULL,NULL,NULL,'',0,'');
-                                                                               
html_form_input ('image', 'upload_files', lang('Upload files'), NULL, NULL, 
NULL, $imagepath.'/1uparrow.png', NULL, NULL, NULL, 'upload_files', 
"document.getElementById('form_files').action=document.getElementById('upload_file').action;document.getElementById('form_files').enctype='multipart/form-data'");
+                                                                               
html_form_input ('image', 'upload_files', lang('Upload files'), NULL, NULL, 
NULL, $imagepath.'/1uparrow.png', NULL, NULL, NULL, 'upload_files' );
                                                                                
html_help_link ('upload_files');
                                                                                
html_text_bold (lang('upload files'));
                                                                        
html_table_col_end ();
@@ -780,7 +800,7 @@
                                html_table_col_end ();
                        html_table_row_end();
                        
-                       html_table_row_begin();
+                       html_table_row_begin('','', '', '', '', '', 
'style="background-color:#C0C0C0"');
                                ###
                                # Start File Table Column Headers
                                # Reads values from $file_attributes array and 
preferences
@@ -852,12 +872,13 @@
                                                        break;
                                                }
                                        }
-       
-                                       if ($rename && $this_selected)
+
+                                       if (($rename || ($menu=='rename')) && 
$this_selected)
                                        {
                                                $renamethis = 1;
+                                               echo 'rename' . $rename;
                                        }
-                                       elseif ($edit_comments && 
$this_selected)
+                                       elseif (($edit_comments || 
($menu=='edit_comments')) && $this_selected)
                                        {
                                                $edit_this_comment = 1;
                                        }
@@ -867,8 +888,15 @@
                                {
                                        continue;
                                }
-       
-                               html_table_row_begin (NULL, NULL, NULL, 
HTML_TABLE_FILES_BG_COLOR);
+                               // alternate row colors
+                               if ($i % 2)
+                               {
+                                       html_table_row_begin (NULL, NULL, NULL, 
HTML_TABLE_FILES_BG_COLOR,'','','style="background-color:#dddddd"');
+                               }
+                               else
+                               {
+                                       html_table_row_begin (NULL, NULL, NULL, 
HTML_TABLE_FILES_BG_COLOR,'','','style="background-color:white"');
+                               }
        
                                ###
                                # Checkboxes
@@ -1130,9 +1158,10 @@
                                                                        
html_form_option ('delete',lang('Delete'));
                                                                        
html_form_option ('edit_comments',lang('Edit comments'));
                                                                        
html_form_option ('','---------------',NULL,1);
-                                                                       
//html_form_option ('go_to',lang('Go To:'));
                                                                        
html_form_option ('move_to',lang('Move To:'));
-                                                                       
html_form_option ('copy_to',lang('Copy To:'));                          
+                                                                       
html_form_option ('copy_to',lang('Copy To:'));  
+                                                                       
html_form_option ('','---------------',NULL,1);
+                                                                       
html_form_option ('go_to',lang('Go To:'));                                      
                                                        
                                                                
html_form_select_end ();
                                                                html_nbsp ();
                                                                echo 
'<noscript>';
@@ -1258,10 +1287,11 @@
                                                                        {
                                                                                
html_text_bold (lang('Unused space').': ');
                                                                                
html_text (borkb ($quota - get_size($GLOBALS['homedir'],True), NULL, 1));
-                                                                               
}else
+                                                                       }
+                                                                       else
                                                                        {
                                                                                
        html_text ('',NULL,1);
-                                                                               
}
+                                                                       }
                                                                                
$i = count_files($GLOBALS['homedir'],True);
                                                        
                                                                                
html_break (2);
@@ -1296,8 +1326,6 @@
                html_table_end ();
        }
        html_form_end();
-       html_form_begin 
($GLOBALS['appname'].'/index.php?op=upload&path='.$path, 'post', 
'multipart/form-data', '', 'upload', 0, 'upload_file');
-       html_form_end();
 }
 
 ###
@@ -1457,7 +1485,7 @@
 # Handle File Uploads
 ###
 
-elseif ($op == 'upload' && $path != '/' && $path != $GLOBALS['fakebase'])
+elseif ($upload_files && ($path != '/') && $path != $GLOBALS['fakebase'])
 {
        for ($i = 0; $i != $show_upload_boxes; $i++)
        {
@@ -1490,9 +1518,7 @@
                                continue;
                        }
                }
-// twiggers check either no quota is given or quota is exceeded
-
-print_r($GLOBALS['phpgwinfo']);
+//check either no quota is given or quota is exceeded
                if (!strstr ($path, $GLOBALS['homedir']) || $quota==-1 || 
$quota - 
get_size($GLOBALS['homedir'],True)-$_FILES['upload_file']['size'][$i]>0)
                {
                        if ($_FILES['upload_file']['size'][$i] > 0)
@@ -1582,30 +1608,33 @@
 ###
 
 //elseif ($comment_files)
-elseif ($comment_files  or $menu == "edit_comments")
+elseif ($comment_files  || $menu == "edit_comments")
 {
-       while (list ($file) = each ($comment_files))
+       if (is_array($comment_files))
        {
-               if ($badchar = bad_chars ($comment_files[$file], False, True))
+               while (list ($file) = each ($comment_files))
                {
-                       echo $GLOBALS['phpgw']->common->error_list (array 
(html_text_italic ($file, 1) . html_encode (': ' . lang('Comments cannot 
contain "%1"', $badchar), 1)));
-                       continue;
+                       if ($badchar = bad_chars ($comment_files[$file], False, 
True))
+                       {
+                               echo $GLOBALS['phpgw']->common->error_list 
(array (html_text_italic ($file, 1) . html_encode (': ' . lang('Comments cannot 
contain "%1"', $badchar), 1)));
+                               continue;
+                       }
+       
+                       $GLOBALS['phpgw']->vfs->set_attributes (array (
+                                       'string'        => $file,
+                                       'relatives'     => array (RELATIVE_ALL),
+                                       'attributes'    => array (
+                                                               'comment' => 
stripslashes ($comment_files[$file])
+                                                       )
+                               )
+                       );
+       
+                       html_text_summary (lang('Updated comment for %1', 
$path.'/'.$file));
                }
-
-               $GLOBALS['phpgw']->vfs->set_attributes (array (
-                               'string'        => $file,
-                               'relatives'     => array (RELATIVE_ALL),
-                               'attributes'    => array (
-                                                       'comment' => 
stripslashes ($comment_files[$file])
-                                               )
-                       )
-               );
-
-               html_text_summary (lang('Updated comment for %1', 
$path.'/'.$file));
+       
+               html_break (2);
+               html_link_back ();
        }
-
-       html_break (2);
-       html_link_back ();
 }
 
 ###
@@ -1613,36 +1642,39 @@
 ###
 
 //elseif ($renamefiles)
-elseif ($renamefiles  or $menu == "rename")
+elseif ($renamefiles || $menu == "rename")
 {
-       while (list ($from, $to) = each ($renamefiles))
+       if (is_array($renamefiles))
        {
-               if ($badchar = bad_chars ($to, True, True))
-               {
-                       echo $GLOBALS['phpgw']->common->error_list (array 
(html_encode (lang('File names cannot contain "%1"', $badchar), 1)));
-                       continue;
-               }
-
-               if (ereg ("/", $to) || ereg ("\\\\", $to))
+               while (list ($from, $to) = each ($renamefiles))
                {
-                       echo $GLOBALS['phpgw']->common->error_list (array 
(lang("File names cannot contain \\ or /")));
-               }
-               elseif (!$GLOBALS['phpgw']->vfs->mv (array (
-                                       'from'  => $from,
-                                       'to'    => $to
-                       ))
-               )
-               {
-                       echo $GLOBALS['phpgw']->common->error_list (array 
(lang('Could not rename %1 to %2', $disppath.'/'.$from, $disppath.'/'.$to)));
-               }
-               else 
-               {
-                       html_text_summary (lang('Renamed %1 to %2', 
$disppath.'/'.$from, $disppath.'/'.$to));
+                       if ($badchar = bad_chars ($to, True, True))
+                       {
+                               echo $GLOBALS['phpgw']->common->error_list 
(array (html_encode (lang('File names cannot contain "%1"', $badchar), 1)));
+                               continue;
+                       }
+       
+                       if (ereg ("/", $to) || ereg ("\\\\", $to))
+                       {
+                               echo $GLOBALS['phpgw']->common->error_list 
(array (lang("File names cannot contain \\ or /")));
+                       }
+                       elseif (!$GLOBALS['phpgw']->vfs->mv (array (
+                                               'from'  => $from,
+                                               'to'    => $to
+                               ))
+                       )
+                       {
+                               echo $GLOBALS['phpgw']->common->error_list 
(array (lang('Could not rename %1 to %2', $disppath.'/'.$from, 
$disppath.'/'.$to)));
+                       }
+                       else 
+                       {
+                               html_text_summary (lang('Renamed %1 to %2', 
$disppath.'/'.$from, $disppath.'/'.$to));
+                       }
                }
+       
+               html_break (2);
+               html_link_back ();
        }
-
-        html_break (2);
-        html_link_back ();
 }
 
 ###
@@ -1654,7 +1686,7 @@
 {
        while (list ($num, $file) = each ($fileman))
        {
-               // twiggers check either no quota is given or quota is exceeded
+               // check either no quota is given or quota is exceeded
                if (strstr ($todir,$disppath) || !strstr ($todir, 
$GLOBALS['homedir']) || $quota==-1 || $quota - 
get_size($GLOBALS['homedir'],True)-get_size(array('directory' => 
$disppath,'name'      => $file), False)>0)
                {
                        if ($GLOBALS['phpgw']->vfs->mv (array (
@@ -1697,7 +1729,7 @@
 {
        while (list ($num, $file) = each ($fileman))
        {
-               // twiggers check either no quota is given or quota is exceeded
+               // check either no quota is given or quota is exceeded
                if (!strstr ($todir, $GLOBALS['homedir']) || $quota==-1 || 
$quota - get_size($GLOBALS['homedir'],True)-get_size(array('directory' => 
$disppath,'name'   => $file), False)>0)
                {
                        if ($GLOBALS['phpgw']->vfs->cp (array (
@@ -1757,7 +1789,7 @@
        html_link_back ();
 }
 
-elseif ($newdir && $createdir)
+elseif ($createdir)
 {
        if ($badchar = bad_chars ($createdir, True, True))
        {




reply via email to

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