Changeset 1590 for sandbox/filemanager/inc
- Timestamp:
- 11/05/09 14:17:02 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/filemanager/inc/class.uifilemanager.inc.php
r1575 r1590 297 297 # Some hacks to set and display directory paths correctly 298 298 ### 299 /* 300 if($this->goto || $this->goto_x) 301 { 302 $this->path = $this->cdtodir; 303 } 304 */ 305 if(!$this->bo->vfs->acl_check(array( 299 if(!($this->edit_x || $this->edit_save_x || $this->edit_save_done_x) && !$this->bo->vfs->acl_check(array( 306 300 'string' => $this->path, 307 301 'relatives' => array(RELATIVE_NONE), … … 765 759 $link=$this->encode_href('/index.php','menuaction=filemanager.uifilemanager.export','file='.$files['name'].'&path='.$this->path); 766 760 $image=$GLOBALS['phpgw']->common->image('filemanager','button_export'); 767 $col_data.='<a href="'.$link.'"><img alt="'.lang("export").'" src="'.$image.'"></a>';761 $col_data.='<a href="'.$link.'"><img alt="'.lang("export").'" title="'.lang("export").'" src="'.$image.'"></a>'; 768 762 } 769 763 } … … 1347 1341 $this->messages[]=$GLOBALS['phpgw']->common->error_list(array(lang("File names cannot contain \\ or /"))); 1348 1342 } 1349 elseif( !$this->bo->vfs->mv(array(1343 elseif($this->verifyLock($from,RELATIVE_ALL) && $this->bo->vfs->mv(array( 1350 1344 'from' => $from, 1351 1345 'to' => $to 1352 1346 ))) 1353 1347 { 1348 $this->messages[]=lang('Renamed %1 to %2', $this->disppath.'/'.$from, $this->disppath.'/'.$to); 1349 } 1350 else 1351 { 1354 1352 $this->messages[]= $GLOBALS['phpgw']->common->error_list(array(lang('Could not rename %1 to %2', $this->disppath.'/'.$from, $this->disppath.'/'.$to))); 1355 }1356 else1357 {1358 $this->messages[]=lang('Renamed %1 to %2', $this->disppath.'/'.$from, $this->disppath.'/'.$to);1359 1353 } 1360 1354 } … … 1420 1414 { 1421 1415 $copied++; 1422 $this->messages[] .= lang('Copied %1 to %2', $this->disppath.'/'.$file, $this->todir.'/'.$file);1416 $this->messages[] = lang('Copied %1 to %2', $this->disppath.'/'.$file, $this->todir.'/'.$file); 1423 1417 } 1424 1418 else 1425 1419 { 1426 $this->messages[] .= lang('Could not copy %1 to %2', $this->disppath.'/'.$file, $this->todir.'/'.$file);1420 $this->messages[] = lang('Could not copy %1 to %2', $this->disppath.'/'.$file, $this->todir.'/'.$file); 1427 1421 } 1428 1422 } … … 1491 1485 } 1492 1486 } 1493 1487 function verifyLock($file,$relative){ 1488 $ls_array = $this->bo->vfs->ls(array( 1489 'string' => $file, 1490 'relatives' => array($relative), 1491 'checksubdirs' => False, 1492 'nofiles' => True 1493 )); 1494 $timestamp = $this->dateString2timeStamp($ls_array[0]['modified']); 1495 if (time() - $timestamp < 60 && $ls_array[0]['modifiedby_id'] != $GLOBALS['phpgw_info']['user']['account_id']) // recently than last minute: someone is editing 1496 { 1497 $this->messages[]=$GLOBALS['phpgw']->common->error_list(array(lang('This file is being edited right now by:').$GLOBALS['phpgw']->accounts->id2name($ls_array[0]['modifiedby_id']))); 1498 return False; 1499 1500 } 1501 else 1502 return True; 1503 } 1494 1504 function delete() 1495 1505 { … … 1498 1508 foreach($this->fileman as $filename) 1499 1509 { 1500 if($this-> bo->vfs->delete(array('string' => $filename)))1510 if($this->verifyLock($filename,RELATIVE_ALL) && $this->bo->vfs->delete(array('string' => $filename))) 1501 1511 { 1502 1512 $this->messages[]= lang('Deleted %1', $this->disppath.'/'.$filename).'<br/>'; … … 1639 1649 if($this->file) 1640 1650 { 1651 if (! $this->verifyLock($this->path.'/'.$this->file,RELATIVE_NONE)){ 1652 echo $this->messages['0']; 1653 $GLOBALS['phpgw']->redirect('/index.php'); 1654 1655 //$GLOBALS['phpgw']->common->phpgw_exit(); 1656 } 1641 1657 $ls_array = $this->bo->vfs->ls(array( 1642 1658 'string' => $this->path.'/'.$this->file, … … 1645 1661 'nofiles' => True 1646 1662 )); 1647 $timestamp = $this->dateString2timeStamp($ls_array[0]['modified']); 1648 if (time() - $timestamp < 60 && $ls_array[0]['modifiedby_id'] != $GLOBALS['phpgw_info']['user']['account_id']) // recently than last minute: someone is editing 1649 { 1650 echo lang('This file is being edited right now by:').$GLOBALS['phpgw']->accounts->id2name($ls_array[0]['modifiedby_id']); 1651 return False; 1652 1653 } 1663 1654 1664 $this->bo->vfs->touch(array( 1655 1665 'string'=> $this->path.'/'.$this->file, … … 1712 1722 //die( $content); 1713 1723 if($this->bo->vfs->write(array( 1714 'string' => $this-> edit_file,1715 'relatives' => array(RELATIVE_ ALL),1724 'string' => $this->path.'/'.$this->edit_file, 1725 'relatives' => array(RELATIVE_NONE), 1716 1726 'content' => $content 1717 1727 )))
Note: See TracChangeset
for help on using the changeset viewer.