Changeset 1830
- Timestamp:
- 12/15/09 09:14:15 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpgwapi/inc/class.vfs_sql.inc.php
r1820 r1830 1994 1994 return True; 1995 1995 } 1996 function summary ($data) 1997 { 1998 1999 if (!$this->acl_check (array( 2000 'string' => $data['path'].'/'.$data['string'], 2001 'relatives' => array (RELATIVE_NONE), 2002 'operation' => PHPGW_ACL_READ 2003 )) 2004 ) 2005 { 2006 return False; 2007 } 2008 2009 $query = "SELECT summary FROM phpgw_vfs WHERE directory = '" 2010 .$data['path']."' AND name = '".$data['string']."' and mime_type != 'journal' and mime_type != 'journal-deleted' LIMIT 1"; 2011 if ($GLOBALS['phpgw']->db->query($query) && $GLOBALS['phpgw']->db->next_record()){ 2012 $val = $GLOBALS['phpgw']->db->row(); 2013 echo $val['summary']; 2014 2015 } 2016 else 2017 { 2018 echo $GLOBALS['phpgw']->db->error; 2019 return false; 2020 } 2021 } 2022 2023 function set_summary($data){ 2024 if (!is_array ($data)) 2025 { 2026 $data = array (); 2027 } 2028 2029 $default_values = array 2030 ( 2031 'relatives' => array (RELATIVE_CURRENT), 2032 'attributes' => array () 2033 ); 2034 2035 $data = array_merge ($this->default_values ($data, $default_values), $data); 2036 2037 $p = $this->path_parts (array( 2038 'string' => $data['string'], 2039 'relatives' => array ($data['relatives'][0]) 2040 ) 2041 ); 2042 if (!$this->acl_check (array( 2043 'string' => $p->fake_full_path, 2044 'relatives' => array ($p->mask), 2045 'operation' => PHPGW_ACL_EDIT 2046 )) 2047 ) 2048 { 2049 return False; 2050 } 2051 if (!$this->file_exists (array( 2052 'string' => $data['string'], 2053 'relatives' => array ($data['relatives'][0]) 2054 )) 2055 ) 2056 { 2057 return False; 2058 } 2059 $ls_array = $this->ls (array( 2060 'string' => $p->fake_full_path, 2061 'relatives' => array ($p->mask), 2062 'checksubdirs' => False, 2063 'nofiles' => True 2064 ) 2065 ); 2066 $record = $ls_array[0]; 2067 $data['summary'] = pg_escape_bytea($data['summary']); 2068 $sql = 'UPDATE phpgw_vfs SET summary = \''.$data['summary'].'\''; 2069 $sql .= ' WHERE file_id='.(int) $ls_array[0]['file_id']; 2070 $sql .= $this->extra_sql (array ('query_type' => VFS_SQL_UPDATE)); 2071 $query = $GLOBALS['phpgw']->db->query ($sql, __LINE__, __FILE__); 2072 } 1996 2073 1997 2074 /*
Note: See TracChangeset
for help on using the changeset viewer.