- Timestamp:
- 12/17/09 15:16:25 (14 years ago)
- Location:
- sandbox/filemanager
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/filemanager/inc/class.bofilemanager.inc.php
r1693 r1869 129 129 if ($all) 130 130 { 131 if (preg_match("-([\\/<>\ '\"\&])-", $string, $badchars))131 if (preg_match("-([\\/<>\|\'\"\&])-", $string, $badchars)) 132 132 $rstring = $badchars[1]; 133 133 } -
sandbox/filemanager/inc/class.vfs_functions.inc.php
r1865 r1869 53 53 function vfs_functions() 54 54 { 55 $this->now = date('Y-m-d ');55 $this->now = date('Y-m-d H:i:s'); 56 56 57 57 $this->bo = CreateObject('filemanager.bofilemanager'); … … 197 197 ) 198 198 { 199 echo "True :".$this->file;199 echo "True|".$this->file; 200 200 } 201 201 else … … 244 244 245 245 function delete(){ 246 foreach($this->fileman as $filename) 247 { 246 foreach($this->fileman as $filecode) 247 { 248 $filename = base64_decode($filecode); 248 249 if($this->verifyLock($filename,RELATIVE_ALL) && $this->bo->vfs->rm(array( 249 250 'string' => $this->path.'/'.$filename, … … 251 252 ))) 252 253 { 253 echo $filename." :";254 } 255 else 256 { 257 echo "False :".$filename;254 echo $filename."|"; 255 } 256 else 257 { 258 echo "False|".$filename; 258 259 return False; 259 260 } … … 261 262 } 262 263 function archive(){ 263 foreach($this->fileman as $filename) 264 { 264 foreach($this->fileman as $filecode) 265 { 266 $filename = base64_decode($filecode); 265 267 if(!$this->verifyLock($filename,RELATIVE_ALL)) 266 268 { 267 echo "locked :".$filename;269 echo "locked|".$filename; 268 270 return False; 269 271 } 270 272 $command .= " ".escapeshellarg($filename); 271 273 } 272 $zipFileName=$GLOBALS['phpgw_info']['user']['account_lid'].date("Y md").".zip";274 $zipFileName=$GLOBALS['phpgw_info']['user']['account_lid'].date("Y-m-d,H:i:s").".zip"; 273 275 $zipFilePath=ini_get("session.save_path")."/".$zipFileName; 274 276 $command = $zipFilePath.$command; … … 278 280 } 279 281 280 exec("cd ".$this->bo->vfs->basedir.$this->path.";".escapeshellcmd("nice -n19 zip -9 ".$command)."; history -c"); 282 exec("cd ".$this->bo->vfs->basedir.$this->path.";".escapeshellcmd("nice -n19 zip -9 ".$command),$output,$return_var); 283 exec("history -c"); // privacy is good, we dont want get passwords! 284 if ($return_var > 1){ 285 echo "False|".$return_var; 286 return false; 287 } 281 288 282 289 $this->bo->vfs->cp(array( … … 305 312 306 313 if ($return_var == 9 || $return_var == 5 || $return_var == 82){ 307 echo "wpasswd :$command";314 echo "wpasswd|"; 308 315 return false; 309 316 }else if($return_var > 1){ 310 echo "False :";317 echo "False|"; 311 318 } 312 319 … … 322 329 if($badchar = $this->bo->bad_chars($this->comment, False, True)) 323 330 { 324 echo "False :badchar:".$badchar;331 echo "False|badchar|".$badchar; 325 332 return False; 326 333 } … … 334 341 ))) 335 342 { 336 echo "True :".$this->file;343 echo "True|".$this->file; 337 344 return True; 338 345 } … … 345 352 if($badchar = $this->bo->bad_chars($this->to, True, True)) 346 353 { 347 echo "Error :badchar:".$badchar;354 echo "Error|badchar|".$badchar; 348 355 return false; 349 356 } 350 357 if(ereg("/", $this->to) || ereg("\\\\", $this->to)) 351 358 { 352 echo "Error :slashes";359 echo "Error|slashes"; 353 360 return false; 354 361 } 355 362 elseif(!$this->verifyLock($this->file,RELATIVE_CURRENT)) 356 echo "Error :editing";363 echo "Error|editing"; 357 364 elseif ($this->bo->vfs->mv(array( 358 365 'from' => $this->path.'/'.$this->file, … … 361 368 ))) 362 369 { 363 echo "True :".$this->file.":".$this->to;364 } 365 else 366 { 367 echo "Error :".$this->file.":".$this->to;370 echo "True|".$this->file."|".$this->to; 371 } 372 else 373 { 374 echo "Error|".$this->file."|".$this->to; 368 375 } 369 376 } -
sandbox/filemanager/inc/upload.php
r1838 r1869 18 18 $current_config = $c->config_data; 19 19 $upload_max_size = $current_config['filemanager_Max_file_size']; 20 $path = base64_decode($_POST['path']);20 $path = $_POST['path']; 21 21 $show_upload_boxes = count($_FILES['upload_file']['name'])-1; 22 22 … … 107 107 if($fileinfo['name'] && $fileinfo['deleteable'] != 'N') 108 108 { 109 $_FILES['upload_file']['name'][$i] = date('Ymd-H:i')."-".$_FILES['upload_file']['name'][$i]; 110 $tmp_arr=array( 111 'from' => $_FILES['upload_file']['tmp_name'][$i], 112 'to' => $_FILES['upload_file']['name'][$i], 113 'relatives' => array(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL) 114 115 ); 116 $bo->vfs->cp($tmp_arr); 109 117 $tmp_arr=array( 110 118 'string'=> $_FILES['upload_file']['name'][$i], … … 113 121 'owner_id' => $bo->userinfo['username'], 114 122 'modifiedby_id' => $bo->userinfo['username'], 115 'modified' => $now,116 123 'size' => $_FILES['upload_file']['size'][$i], 117 124 'mime_type' => $_FILES['upload_file']['type'][$i], … … 122 129 $bo->vfs->set_attributes($tmp_arr); 123 130 124 $tmp_arr=array( 125 'from' => $_FILES['upload_file']['tmp_name'][$i], 126 'to' => lang('new')."_".$_FILES['upload_file']['name'][$i], 127 'relatives' => array(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL) 128 ); 129 $bo->vfs->cp($tmp_arr); 131 $return[] = lang("There is a file %1, that was not replaced",$_FILES['upload_file']['name'][$i]); 130 132 } 131 133 else 132 134 { 133 135 134 136 if ($bo->vfs->cp(array( 135 137 'from'=> $_FILES['upload_file']['tmp_name'][$i], … … 142 144 'relatives' => array(RELATIVE_ALL), 143 145 'attributes'=> array( 144 'mime_type' => $_FILES['upload_file']['type'][$i], 145 'comment' => stripslashes($_POST['upload_comment'][$i]) 146 ) 147 )); 148 if (!(strpos(strtoupper($_FILES['upload_file']['type'][$i]),'IMAGE') === FALSE)) 149 { 150 $content = create_summaryImage($_FILES['upload_file']['tmp_name'][$i]); 151 if ($content){ 152 $bo->vfs->set_summary(array( 153 'string'=> $_FILES['upload_file']['name'][$i], 154 'relatives' => array(RELATIVE_ALL), 155 'summary'=> $content 156 )); 157 } 158 159 } 146 'mime_type' => $_FILES['upload_file']['type'][$i], 147 'comment' => stripslashes($_POST['upload_comment'][$i]) 148 ) 149 )); 160 150 } 161 151 else{ … … 177 167 'relatives' => array(RELATIVE_ALL), 178 168 'attributes'=> array( 179 'mime_type' => $_FILES['upload_file']['type'][$i],180 'comment' => stripslashes($_POST['upload_comment'][$i])169 'mime_type' => $_FILES['upload_file']['type'][$i], 170 'comment' => stripslashes($_POST['upload_comment'][$i]) 181 171 ) 182 172 )); 183 173 184 174 } 175 176 if (!(strpos(strtoupper($_FILES['upload_file']['type'][$i]),'IMAGE') === FALSE)) 177 { 178 $content = create_summaryImage($_FILES['upload_file']['tmp_name'][$i]); 179 if ($content){ 180 $bo->vfs->set_summary(array( 181 'string'=> $_FILES['upload_file']['name'][$i], 182 'relatives' => array(RELATIVE_ALL), 183 'summary'=> $content 184 )); 185 } 186 187 } 185 188 } 186 189 if (count($return) > 0) 187 190 $_SESSION['response'] = serialize($return); 188 191 else -
sandbox/filemanager/js/common_functions.js
r1865 r1869 160 160 if (el.value == oldValue) return; 161 161 var filename = base64_encode(el.id); 162 cExecute('./index.php?menuaction=filemanager.vfs_functions.editComment&file='+filename+'&comment='+base64_encode(el.value), updateComment);162 cExecute('./index.php?menuaction=filemanager.vfs_functions.editComment&file='+filename+'&comment='+base64_encode(el.value),handler.updateComment); 163 163 } 164 164 … … 168 168 } 169 169 170 function updateComment(data) { 171 var returnVal = data.split(':'); 172 if (data.indexOf("True") == 0){ 173 write_msg(get_lang('Updated comment for %1',returnVal[1])); 174 } 175 else 176 { 177 if (returnVal[1] == "badchar") 178 write_error(get_lang('Comments cannot contain "%1"',returnVal[2])); 179 else 180 write_error(get_lang('You have no permission to access this file')); 181 } 182 183 } 170 184 171 function EditColumns(param){ 185 172 if (param == 'close') -
sandbox/filemanager/js/draw_api.js
r1865 r1869 459 459 if (files[i].checked){ 460 460 one_checked = true; 461 filesUrl += "&fileman["+j+"]="+ files[i].value;461 filesUrl += "&fileman["+j+"]="+base64_encode(files[i].value); 462 462 j++; 463 463 } … … 479 479 if (files[i].checked){ 480 480 one_checked = true; 481 filesUrl += "&fileman["+j+"]="+ files[i].value;481 filesUrl += "&fileman["+j+"]="+base64_encode(files[i].value); 482 482 j++; 483 483 } -
sandbox/filemanager/js/handler.js
r1865 r1869 2 2 } 3 3 handler.prototype.del = function(data){ 4 var returnVal = data.split(' :');4 var returnVal = data.split('|'); 5 5 var deletedFiles = ""; 6 6 for (i=0; i < returnVal.length; i++) … … 16 16 pai.parentNode.removeChild(pai); 17 17 } 18 if (i > 3) //to avoid big message 19 { 20 deletedFiles = " " +returnVal.length + " " +get_lang("files"); 21 break; 22 } 18 23 } 19 24 write_msg(get_lang('Deleted %1',deletedFiles.substr(2))); … … 26 31 } 27 32 else 28 var returnVal = data.split(' :');33 var returnVal = data.split('|'); 29 34 if ( returnVal[0] == "True" ){ 30 35 if (returnVal[1] != returnVal[2]) write_msg(get_lang('Renamed %1 to %2',returnVal[1],returnVal[2])); … … 44 49 else 45 50 { 46 if (returnVal[1] == "badchar") 47 write_error(get_lang('File names cannot contain "%1"',returnVal[2])); 48 else 49 if (returnVal[1] == "slashes") 50 write_error(get_lang('File names cannot contain \\ or /')); 51 if (returnVal[1] == "editing") 52 write_error(get_lang('This file is being edited right now')); 53 else 54 write_error(get_lang('Could not rename %1 to %2', returnVal[1], returnVal[2])); 51 if (returnVal[1] == "badchar") 52 write_error(get_lang('File names cannot contain "%1"',returnVal[2])); 53 else if (returnVal[1] == "slashes") 54 write_error(get_lang('File names cannot contain \\ or /')); 55 else if (returnVal[1] == "editing") 56 write_error(get_lang('This file is being edited right now')); 57 else 58 write_error(get_lang('Could not rename %1 to %2', returnVal[1], returnVal[2])); 55 59 } 56 60 … … 69 73 handler.prototype.restricted = function(data){ 70 74 if (data.indexOf("True") == 0){ 71 returnVal = data.split(' :');75 returnVal = data.split('|'); 72 76 var img_lock = document.getElementById('restrict_'+returnVal[1]); 73 77 if (img_lock.src.indexOf('button_unlock') > 0) … … 86 90 } 87 91 handler.prototype.archive = function(data) { 88 returnVal = data.split(' :');92 returnVal = data.split('|'); 89 93 if (returnVal[0] == 'False') 90 94 { … … 102 106 103 107 } 108 handler.prototype.updateComment = function (data) { 109 var returnVal = data.split('|'); 110 if (data.indexOf("True") == 0) 111 { 112 write_msg(get_lang('Updated comment for %1',returnVal[1])); 113 } 114 else 115 { 116 if (returnVal[1] == "badchar") 117 write_error(get_lang('Comments cannot contain "%1"',returnVal[2])); 118 else 119 write_error(get_lang('You have no permission to access this file')); 120 } 121 122 } 104 123 105 124 var handler = new handler();
Note: See TracChangeset
for help on using the changeset viewer.