Changeset 1693
- Timestamp:
- 11/20/09 15:17:35 (14 years ago)
- Files:
-
- 6 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/filemanager/inc/class.bofilemanager.inc.php
r1506 r1693 110 110 if ($size < 1024) 111 111 $rstring = $left . $size . 'B' . $right; 112 else 113 $rstring = $left . round($size/1024) . 'KB' . $right; 112 else if ($size < 1048576) 113 $rstring = $left . round($size/1024) . 'KB' . $right; 114 else if ($size < 1073741824) 115 $rstring = $left . round($size/1024/1024) . 'MB' . $right; 116 else 117 $rstring = $left . round($size/1024/1024/1024) . 'GB' . $right; 118 114 119 115 120 return ($this->eor ($rstring, $return)); -
sandbox/filemanager/inc/class.uifilemanager.inc.php
r1678 r1693 28 28 'edit' => True, 29 29 'fileModels'=>True, 30 'getReturnExecuteForm' => True, 30 31 'uploadModel'=>True 31 32 ); … … 70 71 var $edit_save_done_x; 71 72 var $edit_cancel_x; 72 var $comment_files;73 73 var $upload_x; 74 var $uploadprocess;75 74 76 75 // this ones must be checked thorougly; … … 125 124 'sortby' => array('sortby' => ''), 126 125 'messages' => array('messages' => ''), 127 'comment_files' => array('comment_files' => ''),128 126 'show_upload_boxes' => array('show_upload_boxes' => '') 129 127 ); … … 163 161 $pref = CreateObject('phpgwapi.preferences', $this->bo->userinfo['username']); 164 162 $pref->read_repository(); 165 // 163 //$GLOBALS['phpgw']->hooks->single('add_def_pref', $GLOBALS['appname']); 166 164 $pref->save_repository(True); 167 165 $pref_array = $pref->read_repository(); … … 246 244 // FIXME we just created a fresh home dir so we know there nothing in it so we have to remove all existing content 247 245 } 248 } 249 246 247 248 } 250 249 251 250 } … … 526 525 $this->createdir(); 527 526 } 528 elseif($this->uploadprocess)529 {530 $this->fileUpload();531 }532 527 elseif($this->upload_x || $this->show_upload_boxes) 533 528 { … … 739 734 $icon=$this->mime_icon($files['mime_type']); 740 735 $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.view','file='.$files['name'].'&path='.$this->path); 736 //$link=$this->encode_href('inc/download.php','file='.base64_encode($files['name']).'&path='.base64_encode($this->path)); 741 737 742 738 $col_data='<a href="'.$link.'" target="'.$this->target.'">'.$icon.'</a> '. … … 1103 1099 1104 1100 1105 // move to bo1106 # Handle File Uploads1107 function fileUpload()1108 {1109 if($this->path != '/' && $this->path != $this->bo->fakebase)1110 {1111 for($i = 0; $i != $this->show_upload_boxes; $i++)1112 {1113 if($badchar = $this->bo->bad_chars($_FILES['upload_file']['name'][$i], True, True))1114 {1115 $this->messages[]=lang('Error:').lang('File names cannot contain "%1"', $badchar);1116 1117 continue;1118 }1119 1120 # Check to see if the file exists in the database, and get its info at the same time1121 $ls_array = $this->bo->vfs->ls(array(1122 'string'=> $this->path . '/' . $_FILES['upload_file']['name'][$i],1123 'relatives' => array(RELATIVE_NONE),1124 'checksubdirs' => False,1125 'nofiles' => True1126 ));1127 1128 $fileinfo = $ls_array[0];1129 1130 if($fileinfo['name'])1131 {1132 if($fileinfo['mime_type'] == 'Directory')1133 {1134 $this->messages[]= lang('Error:').lang('Cannot replace %1 because it is a directory', $fileinfo['name']);1135 continue;1136 }1137 }1138 $max_size = $this->current_config['filemanager_Max_file_size'];1139 if (! $max_size)1140 $max_size = ini_get('upload_max_filesize');1141 else1142 $max_size .= "M";1143 1144 $upload_max_filesize = str_replace("M","",$max_size) * 1024 * 1024;1145 1146 if ($_FILES['upload_file']['size'][$i] > $upload_max_filesize)1147 {1148 $this->messages[]=lang('The size of %1 has exceded the limit: %2', $this->disppath.'/'.$_FILES['upload_file']['name'][$i], $max_size);1149 }1150 else if(strlen($this->current_config['filemanager_antivirus_command']) > 0)1151 {1152 $command = "nice -n19 ".$this->current_config['filemanager_antivirus_command']." ".$_FILES['upload_file']['tmp_name'][$i];1153 exec("bash -c ".escapeshellcmd(escapeshellarg($command)),$output,$return);1154 if ($return == 1)1155 {1156 $this->messages[]=lang('Error:').lang('The file sent was considered infected');1157 $this->readFilesInfo();1158 $this->filelisting();1159 return true;1160 }1161 }1162 if($_FILES['upload_file']['size'][$i] > 0)1163 {1164 if($fileinfo['name'] && $fileinfo['deleteable'] != 'N')1165 {1166 $tmp_arr=array(1167 'string'=> $_FILES['upload_file']['name'][$i],1168 'relatives' => array(RELATIVE_ALL),1169 'attributes' => array(1170 'owner_id' => $this->bo->userinfo['username'],1171 'modifiedby_id' => $this->bo->userinfo['username'],1172 'modified' => $this->now,1173 'size' => $_FILES['upload_file']['size'][$i],1174 'mime_type' => $_FILES['upload_file']['type'][$i],1175 'deleteable' => 'Y',1176 'comment' => stripslashes($_POST['upload_comment'][$i])1177 )1178 );1179 $this->bo->vfs->set_attributes($tmp_arr);1180 1181 $tmp_arr=array(1182 'from' => $_FILES['upload_file']['tmp_name'][$i],1183 'to' => lang('new')."_".$_FILES['upload_file']['name'][$i],1184 'relatives' => array(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL)1185 );1186 $this->bo->vfs->cp($tmp_arr);1187 1188 $this->messages[]=lang('Created new %1', $this->disppath.'/'.$_FILES['upload_file']['name'][$i]);1189 }1190 else1191 {1192 1193 $this->bo->vfs->cp(array(1194 'from'=> $_FILES['upload_file']['tmp_name'][$i],1195 'to'=> $_FILES['upload_file']['name'][$i],1196 'relatives' => array(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL)1197 ));1198 1199 $this->bo->vfs->set_attributes(array(1200 'string'=> $_FILES['upload_file']['name'][$i],1201 'relatives' => array(RELATIVE_ALL),1202 'attributes'=> array(1203 'mime_type' => $_FILES['upload_file']['type'][$i],1204 'comment' => stripslashes($_POST['upload_comment'][$i])1205 )1206 ));1207 1208 $this->messages[]=lang('Created %1,%2', $this->disppath.'/'.$_FILES['upload_file']['name'][$i], $_FILES['upload_file']['size'][$i]);1209 }1210 }1211 elseif($_FILES['upload_file']['name'][$i])1212 {1213 $this->bo->vfs->touch(array(1214 'string'=> $_FILES['upload_file']['name'][$i],1215 'relatives' => array(RELATIVE_ALL)1216 ));1217 1218 $this->bo->vfs->set_attributes(array(1219 'string'=> $_FILES['upload_file']['name'][$i],1220 'relatives' => array(RELATIVE_ALL),1221 'attributes'=> array(1222 'mime_type' => $_FILES['upload_file']['type'][$i],1223 'comment' => stripslashes($_POST['upload_comment'][$i])1224 )1225 ));1226 1227 $this->messages[]=lang('Created %1,%2', $this->disppath.'/'.$_FILES['upload_file']['name'][$i], $file_size[$i]);1228 }1229 }1230 1231 $this->readFilesInfo();1232 $this->filelisting();1233 }1234 }1235 1101 # Handle Moving Files and Directories 1236 1102 function moveTo() … … 1359 1225 } 1360 1226 } 1227 function getReturnExecuteForm(){ 1228 $response = $_SESSION['response']; 1229 $_SESSION['response'] = null; 1230 echo $response; 1231 return; 1232 } 1361 1233 function showUploadboxes() 1362 1234 { … … 1368 1240 if($this->path != '/' && $this->path != $this->bo->fakebase && $this->can_add) 1369 1241 { 1370 $vars[form_action]=$GLOBALS[phpgw]->link('/index.php','menuaction=filemanager.uifilemanager.index'); 1242 $vars[max_size]=lang('Note: Uploaded is limited to %1MB',($this->current_config['filemanager_Max_file_size'])); 1243 $vars[form_action]=$GLOBALS[phpgw]->link('/filemanager/inc/upload.php'); 1244 //$vars[form_action]=$GLOBALS[phpgw]->link('/index.php','menuaction=filemanager.uifilemanager.index'); 1371 1245 $vars[path]=$this->path; 1372 1246 $vars[lang_file]=lang('File'); … … 1653 1527 'nofiles' => True 1654 1528 )); 1655 1529 if ($ls_array[0]['size'] > 4194304){ 1530 header('Location:'.$this->encode_href('inc/download.php','file='.base64_encode($this->file).'&path='.base64_encode($this->path))); 1531 return; 1532 } 1533 $_SESSION['debug'][] = $ls_array; 1656 1534 if($ls_array[0]['mime_type']) 1657 1535 { … … 1666 1544 if(in_array($mime_type,$viewable)) 1667 1545 { 1668 1546 /*Note: if you put application/octet-stream you force download */ 1669 1547 header('Content-type: ' . $mime_type); 1670 1548 header('Content-disposition: filename="' . $this->file . '"');//FIXME … … 1675 1553 $GLOBALS['phpgw']->browser->content_header($this->file,$mime_type);//FIXME 1676 1554 } 1555 1556 1677 1557 echo $this->bo->vfs->read(array( 1678 1558 'string' => $this->path.'/'.$this->file,//FIXME -
sandbox/filemanager/inc/class.vfs_functions.inc.php
r1654 r1693 216 216 function download() 217 217 { 218 for($i = 0; $i != $this->numoffiles; $i++) 219 { 220 if(!$this->fileman[$i]) 221 { 222 continue; 223 } 224 225 $download_browser = CreateObject('phpgwapi.browser'); 226 $download_browser->content_header($this->fileman[$i]); 227 echo $this->bo->vfs->read(array('string' => $this->fileman[$i])); 218 if($this->file) 219 { 220 //$GLOBALS['phpgw']->browser->content_header($this->file); 221 header ("Content-Type: application/octet-stream"); 222 header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); 223 header("Pragma: public"); 224 header("Expires: 0"); 225 header ("Content-Disposition: attachment; filename=\"". addslashes($this->file)."\""); 226 echo $this->bo->vfs->read(array('string' => $this->file)); 228 227 $GLOBALS['phpgw']->common->phpgw_exit(); 229 228 } -
sandbox/filemanager/js/connector.js
r1590 r1693 96 96 var connector = new cConnector(); 97 97 98 function cExecuteForm( url,form, handler){98 function cExecuteForm(form, handler){ 99 99 connector.showProgressBar(); 100 var iframe_el = document.getElementById('nullFrame'); 101 if (!iframe_el) 102 { 103 iframe_el = document.createElement('IFRAME'); 104 iframe_el.id = "nullFrame"; 100 if(! (divUpload = document.getElementById('divUpload'))) { 101 divUpload = document.createElement('DIV'); 102 divUpload.id = 'divUpload'; 103 document.body.appendChild(divUpload); 105 104 } 106 iframe_el.style.width = "0px"; 107 iframe_el.style.height = "0px"; 108 iframe_el.style.border = '0px'; 109 iframe_el.name = "nullFrame"; 110 iframe = document.body.appendChild(iframe_el); 111 iframe_el.setAttribute('onload', 'javascript:'+handler+'()'); 112 form.target = "nullFrame"; 113 form.submit(); 105 106 handlerExecuteForm = handler; 107 var form_handler = function (data){ 108 handlerExecuteForm(data); 109 handlerExecuteForm = null; 110 } 111 divUpload.innerHTML= "<iframe onload=\"connector.hideProgressBar();cExecute('./index.php/index.php?menuaction=filemanager.uifilemanager.getReturnExecuteForm',"+form_handler+");\" style='display:none;width:0;height:0;' name='uploadFile'></iframe>"; 112 form.target ="uploadFile"; 113 form.submit(); 114 114 } 115 115 -
sandbox/filemanager/js/uploadForm.js
r1627 r1693 11 11 document.getElementById('show_upload_boxes').value +=1; 12 12 } 13 14 function sendFiles(){ 15 cExecuteForm(document.getElementById('form_up'),handler_upload); 16 document.getElementById('button_up').style.visibility = "hidden"; 17 var line = document.getElementById('uploadOption'); 18 line.parentNode.innerHTML = "<img src='./filemanager/templates/default/images/progress.gif'>"; 19 } 20 21 function handler_upload(data){ 22 alert(data); 23 window.location = "/index.php?menuaction=filemanager.uifilemanager.index"; 24 } -
sandbox/filemanager/setup/phpgw_pt-br.lang
r1678 r1693 27 27 created %1 filemanager pt-br Criado %1 28 28 You have no permission to access this file filemanager pt-br Você não tem permissão para acessar este arquivo 29 The file sent was considered infected filemanager pt-br O arquivo enviado foi considerado infectado por vírus 29 The file %1 sent was considered infected filemanager pt-bt o arquivo (%1) enviado foi considerado infectado por vírus 30 Note: Uploaded is limited to %1MB filemanager pt-br Nota: O tamanho máximo de envio é limitado a %1MB 30 31 no comments filemanager pt-br sem comentários 31 32 created %1,%2 filemanager pt-br Criado %1, %2 -
sandbox/filemanager/templates/default/upload.tpl
r1627 r1693 1 1 <!-- BEGIN upload_header --> 2 2 <script src="filemanager/js/uploadForm.js" type="text/javascript"></script> 3 <form method="post" action="{form_action}" enctype="multipart/form-data">3 <form id="form_up" method="post" action="{form_action}" enctype="multipart/form-data"> 4 4 <div> 5 5 <table cellspacing="0" cellpadding="2"> … … 21 21 22 22 </tbody></table> 23 <span>{max_size}</span> 24 <br> 23 25 <input value="true" name="uploadprocess" type="hidden"> 24 26 <input value="{path}" name="path" type="hidden"> 25 27 <input value="{num_upload_boxes}" name="show_upload_boxes" id="show_upload_boxes" type="hidden"> 26 <input value="{lang_upload}" name="upload_files" type="submit">28 <input value="{lang_upload}" id="button_up" type="button" onclick="sendFiles();"> 27 29 </div> 28 30 </form> -
trunk/phpgwapi/inc/class.vfs_sql.inc.php
r1648 r1693 2391 2391 return False; 2392 2392 } 2393 // INSERT INTO phpgw_vfs_quota values('/home/amuller',200);2394 //2395 2393 return $GLOBALS['phpgw']->db->query("INSERT INTO phpgw_vfs_quota VALUES ('".$data['string']."',".$data['new_quota'].");", __LINE__,__FILE__); 2396 2394 }
Note: See TracChangeset
for help on using the changeset viewer.