Changeset 3619 for branches/2.2/filemanager/inc/class.uiconfig.inc.php
- Timestamp:
- 12/21/10 17:15:26 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/filemanager/inc/class.uiconfig.inc.php
r3534 r3619 8 8 \**************************************************************************/ 9 9 10 class uiconfig 11 { 12 var $public_functions = array( 13 'search_dir' => True, 14 'search_user' => True, 15 'update_quota' => True, 16 'load_quota' => True, 17 'quota' => True, 18 'removeFolder' => True, 19 'reconstructFolder' => True, 20 'set_owner' => True, 21 'set_permission' => True, 22 'renameFolder' => True, 23 'createFolder' => True, 24 'groups_users' => True, 25 'folders' => True 26 ); 27 28 function vfs_functions(){ 29 } 30 function folders(){ 31 $GLOBALS['phpgw_info']['flags'] = array 32 ( 33 'currentapp' => 'filemanager', 34 'noheader' => False, 35 'nonavbar' => False, 36 'nofooter' => False, 37 'noappheader' => False, 38 'enable_browser_class' => True 39 ); 40 41 $GLOBALS['phpgw']->common->phpgw_header(); 42 include('load_lang.php'); 43 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/connector.js'></script>"; 44 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/common_functions.js'></script>"; 45 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/config.js'></script>"; 46 $t = $GLOBALS['phpgw']->template; 47 $t->set_file(array('config_list' => 'config_folders.tpl')); 48 $t->set_block('config_list','body','body'); 49 $vars[lang_directory]=lang('directory'); 50 $vars[lang_search]=lang('search'); 51 $vars[lang_remove]=lang('remove'); 52 $vars[lang_rename]=lang('rename'); 53 $vars[lang_create]=lang('create'); 54 $vars[lang_reconstruct]=lang('reconstruct'); 55 56 $t->set_var($vars); 57 $t->pparse('out','body'); 58 $GLOBALS['phpgw']->common->phpgw_footer(); 59 $GLOBALS['phpgw']->common->phpgw_exit(); 60 61 } 62 function groups_users(){ 63 $GLOBALS['phpgw_info']['flags'] = array 64 ( 65 'currentapp' => 'filemanager', 66 'noheader' => False, 67 'nonavbar' => False, 68 'nofooter' => False, 69 'noappheader' => False, 70 'enable_browser_class' => True 71 ); 72 73 $GLOBALS['phpgw']->common->phpgw_header(); 74 include('load_lang.php'); 75 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/connector.js'></script>"; 76 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/common_functions.js'></script>"; 77 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/config.js'></script>"; 78 $t = $GLOBALS['phpgw']->template; 79 $t->set_file(array('config_list' => 'config_owner.tpl')); 80 $t->set_block('config_list','body','body'); 81 $vars[lang_users_and_groups]=lang('Users and groups'); 82 $vars[lang_search]=lang('search'); 83 $vars[lang_directory]=lang('directory'); 84 $vars[lang_setowner]=lang('set owner'); 85 $vars[lang_setperm]=lang('set permission'); 86 87 $t->set_var($vars); 88 $t->pparse('out','body'); 89 $GLOBALS['phpgw']->common->phpgw_footer(); 90 $GLOBALS['phpgw']->common->phpgw_exit(); 91 92 } 93 94 function createFolder(){ 95 $GLOBALS['phpgw_info']['flags'] = array 96 ( 97 'currentapp' => 'filemanager', 98 'noheader' => True, 99 'nonavbar' => True, 100 'nofooter' => True, 101 'noappheader' => True, 102 'enable_browser_class' => True 103 ); 104 $bo = CreateObject('filemanager.bofilemanager'); 105 $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['name'])); 106 if (strlen($name) < 2) 107 return false; 108 $c = CreateObject('phpgwapi.config','filemanager'); 109 $c->read_repository(); 110 $current_config = $c->config_data; 111 112 $bo->vfs->override_acl = 1; 113 114 if ( $bo->vfs->mkdir(array( 115 'string' => $name, 116 'relatives' => array(RELATIVE_NONE) 117 )) ) 118 if ( $bo->vfs->set_quota(array( 119 'string' => $name, 120 'relatives' => array(RELATIVE_NONE), 121 'new_quota' => $current_config['filemanager_quota_size'] 122 )) ) 123 $return = True; 124 125 $bo->vfs->override_acl = 0; 126 if ($return){ 127 echo "Folder created"; 10 require_once("load_lang.php"); 11 12 class uiconfig 13 { 14 private $bo; 15 private $template; 16 17 var $public_functions = array 18 ( 19 'createFolder' => True, 20 'folders' => True, 21 'groups_users' => True, 22 'load_quota' => True, 23 'notifyUploads' => True, 24 'renameFolder' => True, 25 'removeFolder' => True, 26 'reconstructFolder' => True, 27 'search_dir' => True, 28 'set_owner' => True, 29 'search_user' => True, 30 'set_permission' => True, 31 'update_quota' => True, 32 'quota' => True 33 ); 34 35 function uiconfig() 36 { 37 $this->bo = CreateObject('filemanager.bofilemanager'); 38 $this->template = $GLOBALS['phpgw']->template; 39 40 $GLOBALS['phpgw_info']['flags'] = array 41 ( 42 'currentapp' => 'filemanager', 43 'noheader' => False, 44 'nonavbar' => False, 45 'nofooter' => False, 46 'noappheader' => False, 47 'enable_browser_class' => True 48 ); 49 } 50 51 function vfs_functions(){} 52 53 function folders() 54 { 55 $GLOBALS['phpgw']->common->phpgw_header(); 56 57 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/connector.js'></script>"; 58 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/common_functions.js'></script>"; 59 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/config.js'></script>"; 60 61 62 $this->template->set_file(array('config_list' => 'config_folders.tpl')); 63 $this->template->set_block('config_list','body','body'); 64 65 $vars = array( 66 'lang_directory' => lang('directory'), 67 'lang_search' => lang('search'), 68 'lang_remove' => lang('remove'), 69 'lang_rename' =>lang('rename'), 70 'lang_create' => lang('create'), 71 'lang_reconstruct' => lang('reconstruct') 72 ); 73 74 $this->template->set_var($vars); 75 $this->template->pparse('out','body'); 76 77 $GLOBALS['phpgw']->common->phpgw_footer(); 78 $GLOBALS['phpgw']->common->phpgw_exit(); 79 80 } 81 82 function groups_users() 83 { 84 $GLOBALS['phpgw']->common->phpgw_header(); 85 86 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/connector.js'></script>"; 87 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/common_functions.js'></script>"; 88 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/config.js'></script>"; 89 90 $this->template->set_file(array('config_list' => 'config_owner.tpl')); 91 $this->template->set_block('config_list','body','body'); 92 $vars[lang_users_and_groups]=lang('Users and groups'); 93 $vars[lang_search]=lang('search'); 94 $vars[lang_directory]=lang('directory'); 95 $vars[lang_setowner]=lang('set owner'); 96 $vars[lang_setperm]=lang('set permission'); 97 98 $this->template->set_var($vars); 99 $this->template->pparse('out','body'); 100 $GLOBALS['phpgw']->common->phpgw_footer(); 101 $GLOBALS['phpgw']->common->phpgw_exit(); 102 103 } 104 105 function createFolder() 106 { 107 $GLOBALS['phpgw_info']['flags']['noheader'] = True; 108 $GLOBALS['phpgw_info']['flags']['nonavbar'] = True; 109 $GLOBALS['phpgw_info']['flags']['nofooter'] = True; 110 $GLOBALS['phpgw_info']['flags']['noappheader'] = True; 111 112 $this->bo = CreateObject('filemanager.bofilemanager'); 113 $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['name'])); 114 if (strlen($name) < 2) 115 return false; 116 $c = CreateObject('phpgwapi.config','filemanager'); 117 $c->read_repository(); 118 $current_config = $c->config_data; 119 120 $this->bo->vfs->override_acl = 1; 121 122 if ( $this->bo->vfs->mkdir(array( 123 'string' => $name, 124 'relatives' => array(RELATIVE_NONE) 125 )) ) 126 if ( $this->bo->vfs->set_quota(array( 127 'string' => $name, 128 'relatives' => array(RELATIVE_NONE), 129 'new_quota' => $current_config['filemanager_quota_size'] 130 )) ) 131 $return = True; 132 133 $this->bo->vfs->override_acl = 0; 134 if ($return){ 135 echo "Folder created"; 136 } 137 else 138 echo "Error"; 139 } 140 141 function removeFolder() 142 { 143 $GLOBALS['phpgw_info']['flags']['noheader'] = True; 144 $GLOBALS['phpgw_info']['flags']['nonavbar'] = True; 145 $GLOBALS['phpgw_info']['flags']['nofooter'] = True; 146 $GLOBALS['phpgw_info']['flags']['noappheader'] = True; 147 148 $this->bo = CreateObject('filemanager.bofilemanager'); 149 $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir'])); 150 if (strlen($name) < 2) 151 return false; 152 if ( $this->bo->vfs->delete(array( 153 'string' => $name, 154 'relatives' => array(RELATIVE_NONE) 155 )) ) 156 { 157 /* Clean the log */ 158 $GLOBALS['phpgw']->db->query('DELETE FROM phpgw_vfs WHERE directory = \''.$name.'\'',__LINE__,__FILE__); 159 if ($GLOBALS['phpgw']->db->Error) 160 echo "Erro"; 161 else 162 { 163 $GLOBALS['phpgw']->db->query('DELETE FROM phpgw_vfs_quota WHERE directory = \''.$name.'\'',__LINE__,__FILE__); 164 if (!$GLOBALS['phpgw']->db->Error) 165 echo lang('directory removed sucessfully'); 166 else 167 echo "Erro"; 128 168 } 129 else 130 echo "Error"; 131 } 132 133 function removeFolder(){ 134 $GLOBALS['phpgw_info']['flags'] = array 135 ( 136 'currentapp' => 'filemanager', 137 'noheader' => True, 138 'nonavbar' => True, 139 'nofooter' => True, 140 'noappheader' => True, 141 'enable_browser_class' => True 142 ); 143 $bo = CreateObject('filemanager.bofilemanager'); 144 $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir'])); 145 if (strlen($name) < 2) 146 return false; 147 if ( $bo->vfs->delete(array( 148 'string' => $name, 149 'relatives' => array(RELATIVE_NONE) 150 )) ) 151 { 152 /* Clean the log */ 153 $GLOBALS['phpgw']->db->query('DELETE FROM phpgw_vfs WHERE directory = \''.$name.'\'',__LINE__,__FILE__); 154 if ($GLOBALS['phpgw']->db->Error) 155 echo "Erro"; 156 else 157 { 158 $GLOBALS['phpgw']->db->query('DELETE FROM phpgw_vfs_quota WHERE directory = \''.$name.'\'',__LINE__,__FILE__); 159 if (!$GLOBALS['phpgw']->db->Error) 160 echo lang('directory removed sucessfully'); 161 else 162 echo "Erro"; 163 } 164 } 165 return; 166 167 } 168 function reconstructFolder(){ 169 $GLOBALS['phpgw_info']['flags'] = array 170 ( 171 'currentapp' => 'filemanager', 172 'noheader' => True, 173 'nonavbar' => True, 174 'nofooter' => True, 175 'noappheader' => True, 176 'enable_browser_class' => True 177 ); 178 $bo = CreateObject('filemanager.bofilemanager'); 179 $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir'])); 180 if (strlen($name) < 2) 181 return false; 182 $bo->vfs->update_real(array( 183 'string' => $name, 184 'relatives' => array(RELATIVE_NONE) 185 ),True); 186 $bo->vfs->flush_journal(array( 169 } 170 return; 171 172 } 173 174 function reconstructFolder() 175 { 176 $GLOBALS['phpgw_info']['flags']['noheader'] = True; 177 $GLOBALS['phpgw_info']['flags']['nonavbar'] = True; 178 $GLOBALS['phpgw_info']['flags']['nofooter'] = True; 179 $GLOBALS['phpgw_info']['flags']['noappheader'] = True; 180 181 $this->bo = CreateObject('filemanager.bofilemanager'); 182 $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir'])); 183 if (strlen($name) < 2) 184 return false; 185 $this->bo->vfs->update_real(array( 186 'string' => $name, 187 'relatives' => array(RELATIVE_NONE) 188 ),True); 189 $this->bo->vfs->flush_journal(array( 190 'string' => $name, 191 'relatives' => array(RELATIVE_NONE), 192 'deleteall' => True 193 )); 194 echo lang('Your operation was successfully executed'); 195 } 196 197 function renameFolder() 198 { 199 $GLOBALS['phpgw_info']['flags'] = array 200 ( 201 'currentapp' => 'filemanager', 202 'noheader' => True, 203 'nonavbar' => True, 204 'nofooter' => True, 205 'noappheader' => True, 206 'enable_browser_class' => True 207 ); 208 $this->bo = CreateObject('filemanager.bofilemanager'); 209 $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir'])); 210 $to = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['to'])); 211 if (strlen($name) < 2) 212 return false; 213 if ( $this->bo->vfs->mv(array( 214 'from' => $name, 215 'to' => $to, 216 'relatives' => array(RELATIVE_NONE) 217 )) ){ 218 $this->bo->vfs->flush_journal(array( 187 219 'string' => $name, 188 220 'relatives' => array(RELATIVE_NONE), … … 191 223 echo lang('Your operation was successfully executed'); 192 224 } 193 194 function renameFolder(){ 195 $GLOBALS['phpgw_info']['flags'] = array 196 ( 197 'currentapp' => 'filemanager', 198 'noheader' => True, 199 'nonavbar' => True, 200 'nofooter' => True, 201 'noappheader' => True, 202 'enable_browser_class' => True 203 ); 204 $bo = CreateObject('filemanager.bofilemanager'); 205 $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir'])); 206 $to = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['to'])); 207 if (strlen($name) < 2) 208 return false; 209 if ( $bo->vfs->mv(array( 210 'from' => $name, 211 'to' => $to, 212 'relatives' => array(RELATIVE_NONE) 213 )) ){ 214 $bo->vfs->flush_journal(array( 215 'string' => $name, 216 'relatives' => array(RELATIVE_NONE), 217 'deleteall' => True 218 )); 219 echo lang('Your operation was successfully executed'); 220 } 221 else 222 echo lang('Error'); 223 } 224 225 function quota(){ 226 $GLOBALS['phpgw_info']['flags'] = array 227 ( 228 'currentapp' => 'filemanager', 229 'noheader' => False, 230 'nonavbar' => False, 231 'nofooter' => False, 232 'noappheader' => False, 233 'enable_browser_class' => True 234 ); 235 236 $GLOBALS['phpgw']->common->phpgw_header(); 237 include('load_lang.php'); 238 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/connector.js'></script>"; 239 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/common_functions.js'></script>"; 240 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/config.js'></script>"; 241 $t = $GLOBALS['phpgw']->template; 242 $t->set_file(array('config_list' => 'config_quota.tpl')); 243 $t->set_block('config_list','body','body'); 244 $vars[lang_directory]=lang('directory'); 245 $vars[lang_search]=lang('search'); 246 $vars[lang_save]=lang('save'); 247 248 $t->set_var($vars); 249 $t->pparse('out','body'); 250 $GLOBALS['phpgw']->common->phpgw_footer(); 251 $GLOBALS['phpgw']->common->phpgw_exit(); 252 253 } 254 function search_dir(){ 255 $GLOBALS['phpgw_info']['flags'] = array 256 ( 257 'currentapp' => 'filemanager', 258 'noheader' => True, 259 'nonavbar' => True, 260 'nofooter' => True, 261 'noappheader' => True, 262 'enable_browser_class' => True 263 ); 264 $name = $GLOBALS['phpgw']->db->db_addslashes($_GET['name']); 265 $GLOBALS['phpgw']->db->query('SELECT DISTINCT directory FROM phpgw_vfs WHERE (directory like \'%'.$name.'%\') LIMIT 20',__LINE__,__FILE__); 266 while ($GLOBALS['phpgw']->db->next_record()){ 267 $val = $GLOBALS['phpgw']->db->row(); 268 echo "<option>".$val['directory']."</option>"; 269 } 270 $GLOBALS['phpgw']->db->query('SELECT directory,name from phpgw_vfs WHERE directory = \'/home\' and name like \'%'.$name.'%\' LIMIT 1',__LINE__,__FILE__); 271 if ($GLOBALS['phpgw']->db->next_record()){ 272 $val = $GLOBALS['phpgw']->db->row(); 273 echo "<option>".$val['directory']."/".$val['name']."</option>"; 274 } 275 276 277 } 278 function search_user(){ 279 $GLOBALS['phpgw_info']['flags'] = array 280 ( 281 'currentapp' => 'filemanager', 282 'noheader' => True, 283 'nonavbar' => True, 284 'nofooter' => True, 285 'noappheader' => True, 286 'enable_browser_class' => True 287 ); 288 $account_info = $GLOBALS['phpgw']->accounts->get_list('both',0,'','',$_GET['name'],'all'); 289 290 foreach($account_info as $val) 291 echo "<option value='".$val['account_id']."'>".$val['account_lid']."</option>"; 292 } 293 function set_permission(){ 294 $GLOBALS['phpgw_info']['flags'] = array 295 ( 296 'currentapp' => 'filemanager', 297 'noheader' => True, 298 'nonavbar' => True, 299 'nofooter' => True, 300 'noappheader' => True, 301 'enable_browser_class' => True 302 ); 303 $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir'])); 304 $perms = ($_GET['perms'])*1; 305 $owner = ($_GET['owner'])*1; 225 else 226 echo lang('Error'); 227 } 228 229 function quota() 230 { 231 $GLOBALS['phpgw']->common->phpgw_header(); 232 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/connector.js'></script>"; 233 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/common_functions.js'></script>"; 234 echo "<script src='".$GLOBALS['phpgw_info']['flags']['currentapp']."/js/config.js'></script>"; 235 236 $this->template->set_file(array('config_list' => 'config_quota.tpl')); 237 $this->template->set_block('config_list','body','body'); 238 $vars[lang_directory]=lang('directory'); 239 $vars[lang_search]=lang('search'); 240 $vars[lang_save]=lang('save'); 241 242 $this->template->set_var($vars); 243 $this->template->pparse('out','body'); 244 $GLOBALS['phpgw']->common->phpgw_footer(); 245 $GLOBALS['phpgw']->common->phpgw_exit(); 246 247 } 248 249 function notifyUploads() 250 { 251 $GLOBALS['phpgw']->common->phpgw_header(); 252 253 $this->template->set_file(array('config_email' => 'notify_upload.tpl')); 254 $this->template->set_block('config_email','body','body'); 255 256 $vars = array( 257 'action_url_back' => './admin', 258 'bt_previous' => '<input type="submit" name="bt_previous" value="Anterior" />', 259 'bt_next' => '<input type="submit" name="bt_next" value="Proximo" />', 260 ); 261 262 $this->template->set_var($vars); 263 $this->template->pparse('out','body'); 264 265 $GLOBALS['phpgw']->common->phpgw_footer(); 266 $GLOBALS['phpgw']->common->phpgw_exit(); 267 } 268 269 function search_dir() 270 { 271 $GLOBALS['phpgw_info']['flags']['noheader'] = True; 272 $GLOBALS['phpgw_info']['flags']['nonavbar'] = True; 273 $GLOBALS['phpgw_info']['flags']['nofooter'] = True; 274 $GLOBALS['phpgw_info']['flags']['noappheader'] = True; 275 276 $name = $GLOBALS['phpgw']->db->db_addslashes($_GET['name']); 277 $GLOBALS['phpgw']->db->query('SELECT DISTINCT directory FROM phpgw_vfs WHERE (directory like \'%'.$name.'%\') LIMIT 20',__LINE__,__FILE__); 278 while ($GLOBALS['phpgw']->db->next_record()){ 279 $val = $GLOBALS['phpgw']->db->row(); 280 echo "<option>".$val['directory']."</option>"; 281 } 282 $GLOBALS['phpgw']->db->query('SELECT directory,name from phpgw_vfs WHERE directory = \'/home\' and name like \'%'.$name.'%\' LIMIT 1',__LINE__,__FILE__); 283 if ($GLOBALS['phpgw']->db->next_record()){ 284 $val = $GLOBALS['phpgw']->db->row(); 285 echo "<option>".$val['directory']."/".$val['name']."</option>"; 286 } 287 288 289 } 290 291 function search_user() 292 { 293 $GLOBALS['phpgw_info']['flags']['noheader'] = True; 294 $GLOBALS['phpgw_info']['flags']['nonavbar'] = True; 295 $GLOBALS['phpgw_info']['flags']['nofooter'] = True; 296 $GLOBALS['phpgw_info']['flags']['noappheader'] = True; 297 298 $account_info = $GLOBALS['phpgw']->accounts->get_list('both',0,'','',$_GET['name'],'all'); 299 300 foreach($account_info as $val) 301 echo "<option value='".$val['account_id']."'>".$val['account_lid']."</option>"; 302 } 303 304 function set_permission() 305 { 306 $GLOBALS['phpgw_info']['flags']['noheader'] = True; 307 $GLOBALS['phpgw_info']['flags']['nonavbar'] = True; 308 $GLOBALS['phpgw_info']['flags']['nofooter'] = True; 309 $GLOBALS['phpgw_info']['flags']['noappheader'] = True; 310 311 $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir'])); 312 $perms = ($_GET['perms'])*1; 313 $owner = ($_GET['owner'])*1; 314 $dirs=explode('/',$name); 315 $GLOBALS['phpgw']->db->query('SELECT owner_id from phpgw_vfs WHERE directory = \'/'.$dirs[1].'\' and name=\''.$dirs[2].'\' LIMIT 1',__LINE__,__FILE__); 316 if ($GLOBALS['phpgw']->db->next_record()){ 317 $val = $GLOBALS['phpgw']->db->row(); 318 $owner_id = $val['owner_id']; 319 } 320 321 $query = "SELECT count(*) FROM phpgw_acl WHERE acl_appname = 'filemanager' and acl_account = '".$owner_id."' and acl_location='".$owner."'"; 322 if ($GLOBALS['phpgw']->db->query($query) && $GLOBALS['phpgw']->db->next_record()) 323 $val = $GLOBALS['phpgw']->db->row(); 324 else 325 { 326 echo $GLOBALS['phpgw']->db->error; 327 return false; 328 } 329 if ($val['count'] == '1') 330 $GLOBALS['phpgw']->db->query("UPDATE phpgw_acl SET acl_rights = ".$perms." where acl_appname = 'filemanager' and acl_account = '".$owner_id."' AND acl_location = '".$owner."'",__LINE__,__FILE__); 331 else 332 $GLOBALS['phpgw']->db->query("INSERT INTO phpgw_acl values('filemanager','".$owner."','".$owner_id."',".$perms.")",__LINE__,__FILE__); 333 if ($GLOBALS['phpgw']->db->Error) 334 echo "Erro"; 335 else 336 { 337 echo lang('entry updated sucessfully'); 338 } 339 return; 340 } 341 342 343 function set_owner() 344 { 345 $GLOBALS['phpgw_info']['flags']['noheader'] = True; 346 $GLOBALS['phpgw_info']['flags']['nonavbar'] = True; 347 $GLOBALS['phpgw_info']['flags']['nofooter'] = True; 348 $GLOBALS['phpgw_info']['flags']['noappheader'] = True; 349 350 $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir'])); 351 $owner = ($_GET['owner'])*1; 352 353 $GLOBALS['phpgw']->db->query('UPDATE phpgw_vfs SET owner_id = '.$owner.' WHERE directory = \''.$name.'\'',__LINE__,__FILE__); 354 if ($GLOBALS['phpgw']->db->Error) 355 echo "Erro"; 356 else 357 { 306 358 $dirs=explode('/',$name); 307 $GLOBALS['phpgw']->db->query('SELECT owner_id from phpgw_vfs WHERE directory = \'/'.$dirs[1].'\' and name=\''.$dirs[2].'\' LIMIT 1',__LINE__,__FILE__); 308 if ($GLOBALS['phpgw']->db->next_record()){ 309 $val = $GLOBALS['phpgw']->db->row(); 310 $owner_id = $val['owner_id']; 311 } 312 313 $query = "SELECT count(*) FROM phpgw_acl WHERE acl_appname = 'filemanager' and acl_account = '".$owner_id."' and acl_location='".$owner."'"; 314 if ($GLOBALS['phpgw']->db->query($query) && $GLOBALS['phpgw']->db->next_record()) 315 $val = $GLOBALS['phpgw']->db->row(); 316 else 317 { 318 echo $GLOBALS['phpgw']->db->error; 319 return false; 320 } 321 if ($val['count'] == '1') 322 $GLOBALS['phpgw']->db->query("UPDATE phpgw_acl SET acl_rights = ".$perms." where acl_appname = 'filemanager' and acl_account = '".$owner_id."' AND acl_location = '".$owner."'",__LINE__,__FILE__); 323 else 324 $GLOBALS['phpgw']->db->query("INSERT INTO phpgw_acl values('filemanager','".$owner."','".$owner_id."',".$perms.")",__LINE__,__FILE__); 359 $GLOBALS['phpgw']->db->query('UPDATE phpgw_vfs SET owner_id = '.$owner.' WHERE directory = \'/'.$dirs[1].'\' and name=\''.$dirs[2].'\'',__LINE__,__FILE__); 325 360 if ($GLOBALS['phpgw']->db->Error) 326 361 echo "Erro"; 327 362 else 328 363 { 329 echo lang('entry updated sucessfully');364 echo lang('entry updated sucessfully'); 330 365 } 331 return; 332 } 333 334 335 function set_owner(){ 336 $GLOBALS['phpgw_info']['flags'] = array 337 ( 338 'currentapp' => 'filemanager', 339 'noheader' => True, 340 'nonavbar' => True, 341 'nofooter' => True, 342 'noappheader' => True, 343 'enable_browser_class' => True 344 ); 345 $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir'])); 346 $owner = ($_GET['owner'])*1; 347 348 $GLOBALS['phpgw']->db->query('UPDATE phpgw_vfs SET owner_id = '.$owner.' WHERE directory = \''.$name.'\'',__LINE__,__FILE__); 366 } 367 return; 368 } 369 370 function update_quota() 371 { 372 $GLOBALS['phpgw_info']['flags']['noheader'] = True; 373 $GLOBALS['phpgw_info']['flags']['nonavbar'] = True; 374 $GLOBALS['phpgw_info']['flags']['nofooter'] = True; 375 $GLOBALS['phpgw_info']['flags']['noappheader'] = True; 376 377 $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir'])); 378 $size = ($_GET['val'])*1; 379 380 /* See if quota exists or not */ 381 $query = "SELECT count(directory) FROM phpgw_vfs_quota WHERE directory = '".$name."' LIMIT 1"; 382 if ($GLOBALS['phpgw']->db->query($query) && $GLOBALS['phpgw']->db->next_record()) 383 $val = $GLOBALS['phpgw']->db->row(); 384 else 385 { 386 echo $GLOBALS['phpgw']->db->error; 387 return false; 388 } 389 if ($val['count'] == '1') 390 { 391 $GLOBALS['phpgw']->db->query('UPDATE phpgw_vfs_quota SET quota_size = '.$size.' WHERE directory = \''.$name.'\'',__LINE__,__FILE__); 349 392 if ($GLOBALS['phpgw']->db->Error) 350 393 echo "Erro"; 351 394 else 352 { 353 $dirs=explode('/',$name); 354 $GLOBALS['phpgw']->db->query('UPDATE phpgw_vfs SET owner_id = '.$owner.' WHERE directory = \'/'.$dirs[1].'\' and name=\''.$dirs[2].'\'',__LINE__,__FILE__); 355 if ($GLOBALS['phpgw']->db->Error) 356 echo "Erro"; 357 else 358 { 359 echo lang('entry updated sucessfully'); 360 } 361 } 362 return; 363 } 364 365 function update_quota(){ 366 $GLOBALS['phpgw_info']['flags'] = array 367 ( 368 'currentapp' => 'filemanager', 369 'noheader' => True, 370 'nonavbar' => True, 371 'nofooter' => True, 372 'noappheader' => True, 373 'enable_browser_class' => True 374 ); 375 $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir'])); 376 $size = ($_GET['val'])*1; 377 378 /* See if quota exists or not */ 379 $query = "SELECT count(directory) FROM phpgw_vfs_quota WHERE directory = '".$name."' LIMIT 1"; 380 if ($GLOBALS['phpgw']->db->query($query) && $GLOBALS['phpgw']->db->next_record()) 381 $val = $GLOBALS['phpgw']->db->row(); 395 echo lang('entry updated sucessfully'); 396 } 397 else 398 { 399 /*preferences does not exist*/ 400 $query = "INSERT INTO phpgw_vfs_quota values ('".$name."',".$size.")"; 401 if (!$GLOBALS['phpgw']->db->query($query)) 402 echo $GLOBALS['phpgw']->db->error; 382 403 else 383 { 384 echo $GLOBALS['phpgw']->db->error; 385 return false; 386 } 387 if ($val['count'] == '1') 388 { 389 $GLOBALS['phpgw']->db->query('UPDATE phpgw_vfs_quota SET quota_size = '.$size.' WHERE directory = \''.$name.'\'',__LINE__,__FILE__); 390 if ($GLOBALS['phpgw']->db->Error) 391 echo "Erro"; 392 else 393 echo lang('entry updated sucessfully'); 394 } 395 else 396 { 397 /*preferences does not exist*/ 398 $query = "INSERT INTO phpgw_vfs_quota values ('".$name."',".$size.")"; 399 if (!$GLOBALS['phpgw']->db->query($query)) 400 echo $GLOBALS['phpgw']->db->error; 401 else 402 echo lang('entry updated sucessfully'); 403 } 404 return; 405 } 406 function load_quota(){ 407 $GLOBALS['phpgw_info']['flags'] = array 408 ( 409 'currentapp' => 'filemanager', 410 'noheader' => True, 411 'nonavbar' => True, 412 'nofooter' => True, 413 'noappheader' => True, 414 'enable_browser_class' => True 415 ); 416 $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['name'])); 417 $GLOBALS['phpgw']->db->query('SELECT quota_size FROM phpgw_vfs_quota WHERE directory = \''.$name.'\' LIMIT 1',__LINE__,__FILE__); 418 $GLOBALS['phpgw']->db->next_record(); 419 $val =$GLOBALS['phpgw']->db->row(); 420 echo $val['quota_size']; 421 return; 422 423 } 424 425 426 } 404 echo lang('entry updated sucessfully'); 405 } 406 return; 407 } 408 409 function load_quota() 410 { 411 $GLOBALS['phpgw_info']['flags']['noheader'] = True; 412 $GLOBALS['phpgw_info']['flags']['nonavbar'] = True; 413 $GLOBALS['phpgw_info']['flags']['nofooter'] = True; 414 $GLOBALS['phpgw_info']['flags']['noappheader'] = True; 415 416 $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['name'])); 417 $GLOBALS['phpgw']->db->query('SELECT quota_size FROM phpgw_vfs_quota WHERE directory = \''.$name.'\' LIMIT 1',__LINE__,__FILE__); 418 $GLOBALS['phpgw']->db->next_record(); 419 $val =$GLOBALS['phpgw']->db->row(); 420 echo $val['quota_size']; 421 return; 422 423 } 424 } 425 427 426 ?>
Note: See TracChangeset
for help on using the changeset viewer.