Changeset 1648 for trunk/phpgwapi/inc/class.vfs_sql.inc.php
- Timestamp:
- 11/13/09 17:16:13 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpgwapi/inc/class.vfs_sql.inc.php
r1627 r1648 620 620 $data = array (); 621 621 } 622 623 /* ExpressoLivre principle: In your home you do what you want*/ 624 if (strpos($data['string'],$this->my_home) === 0) 625 return True; 626 622 627 623 $default_values = array 628 624 ( … … 639 635 return True; 640 636 } 637 638 /* ExpressoLivre principle: In your home you do what you want*/ 639 if (strpos($data['string'],$this->my_home) === 0) 640 return True; 641 if ($data['relatives'][0] == RELATIVE_NONE || $data['relatives'][0] == RELATIVE_ALL) 642 { 643 $path = explode('/',$data['string']); 644 $data['string'] = '/'.$path[1].'/'.$path[2]; 645 } 646 647 641 648 642 649 if (!$data['owner_id']) … … 703 710 We don't use ls () to get owner_id as we normally would, 704 711 because ls () calls acl_check (), which would create an infinite loop 705 */ 706 $query = $GLOBALS['phpgw']->db->query ("SELECT owner_id FROM phpgw_vfs WHERE directory='". 707 $GLOBALS['phpgw']->db->db_addslashes($p2->fake_leading_dirs_clean)."' AND name='". 708 $GLOBALS['phpgw']->db->db_addslashes($p2->fake_name_clean)."'" . $this->extra_sql (array ('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__); 709 $GLOBALS['phpgw']->db->next_record (); 710 711 $owner_id = $GLOBALS['phpgw']->db->Record['owner_id']; 712 */ 713 $owner_id = $this->ownerOf($p2->fake_leading_dirs_clean,$p2->fake_name_clean); 712 714 } 713 715 else 714 716 { 715 717 $owner_id = $data['owner_id']; 716 }717 718 /* This is correct. The ACL currently doesn't handle undefined values correctly */719 if (!$owner_id)720 {721 $owner_id = 0;722 718 } 723 719 … … 781 777 return False; 782 778 } 779 } 780 function ownerOf($base,$path){ 781 $query = $GLOBALS['phpgw']->db->query ("SELECT owner_id FROM phpgw_vfs WHERE directory='". 782 $GLOBALS['phpgw']->db->db_addslashes($base)."' AND name='". 783 $GLOBALS['phpgw']->db->db_addslashes($path)."' ".$this->extra_sql (array ('query_type' => VFS_SQL_SELECT)), __LINE__, __FILE__); 784 $GLOBALS['phpgw']->db->next_record(); 785 $owner_id = $GLOBALS['phpgw']->db->Record['owner_id']; 786 if (!$owner_id) 787 { 788 $owner_id = 0; 789 } 790 return $owner_id; 783 791 } 784 792 … … 856 864 $path = explode('/',$data['string']); 857 865 $quota = $this->get_quota(array('string' => '/'.$path[1].'/'.$path[2])); 858 if ($quota > 0 && $this->get_size( $data) >= $quota * 1024 * 1024)866 if ($quota > 0 && $this->get_size('/'.$path[1].'/'.$path[2]) >= $quota * 1024 * 1024) 859 867 return false; 860 868 … … 887 895 $acl_operation = PHPGW_ACL_ADD; 888 896 } 889 // In your dir you can do anything you want890 $path = explode('/',$p->fake_full_path);891 if (!$this->acl_check (array(892 'string' => '/'.$path[1].'/'.$path[2],893 'relatives' => array ($p->mask),894 'operation' => $acl_operation895 ))896 )897 {898 return False;899 }900 901 897 umask(0177); 902 898 … … 1098 1094 $path = explode('/',$data['to']); 1099 1095 $quota = $this->get_quota(array('string' => '/'.$path[1].'/'.$path[2])); 1100 $size = $this->get_size(array('string' => $data['to'], 'relatives' => $data['relatives'][1]));1096 $size = $this->get_size(array('string' => '/'.$path[1].'/'.$path[2], 'relatives' => $data['relatives'][1])); 1101 1097 if ($quota > 0 && $size >= $quota * 1024 * 1024) 1102 1098 return false; … … 1363 1359 $data = array (); 1364 1360 } 1365 1366 $path = explode('/',$data['to']); 1367 $quota = $this->get_quota(array('string' => '/'.$path[1].'/'.$path[2])); 1368 $size = $this->get_size(array('string' => $data['to'], 'relatives' => $data['relatives'][1])); 1361 if ($data['relatives'][1] == RELATIVE_NONE) 1362 { 1363 $path = explode('/',$data['to']); 1364 $quota = $this->get_quota(array('string' => '/'.$path[1].'/'.$path[2])); 1365 $size = $this->get_size(array('string' => '/'.$path[1].'/'.$path[2], 'relatives' => $data['relatives'][1])); 1366 } 1367 else 1368 { 1369 $quota = $this->get_quota(array('string' => $this->my_home)); 1370 $size = $this->get_size(array('string' => $this->my_home, 'relatives' => $data['relatives'][1])); 1371 } 1369 1372 if ($quota > 0 && $size >= $quota * 1024 * 1024) 1370 1373 return false; … … 1391 1394 ) 1392 1395 ); 1393 // In your dir you can do anything you want 1394 $path = explode('/',$t->fake_full_path); 1396 1395 1397 if (!$this->acl_check (array( 1396 'string' => '/'.$path[1].'/'.$path[2], 1397 'relatives' => array ($f->mask), 1398 'operation' => PHPGW_ACL_READ 1399 )) 1400 || !$this->acl_check (array( 1401 'string' => '/'.$path[1].'/'.$path[2], 1402 'relatives' => array ($f->mask), 1403 'operation' => PHPGW_ACL_DELETE 1404 )) 1405 ) 1406 { 1407 return False; 1408 } 1409 1410 if (!$this->acl_check (array( 1411 'string' => '/'.$path[1].'/'.$path[2], 1398 'string' => $data['to'], 1412 1399 'relatives' => array ($t->mask), 1413 1400 'operation' => PHPGW_ACL_ADD … … 1425 1412 { 1426 1413 if (!$this->acl_check (array( 1427 'string' => '/'.$path[1].'/'.$path[2],1414 'string' => $data['to'], 1428 1415 'relatives' => array ($t->mask), 1429 1416 'operation' => PHPGW_ACL_EDIT … … 1615 1602 ) 1616 1603 ); 1617 // Inside the folder that you have pemission you can do anything you want1618 $path = explode('/',$p->fake_full_path);1619 if (!$this->acl_check (array(1620 'string' => '/'.$path[1].'/'.$path[2],1621 'relatives' => array ($p->mask),1622 'operation' => PHPGW_ACL_DELETE1623 ))1624 )1625 {1626 return False;1627 }1628 1629 1604 if (!$this->file_exists (array( 1630 1605 'string' => $data['string'],
Note: See TracChangeset
for help on using the changeset viewer.