[3019] | 1 | <?php |
---|
| 2 | /**************************************************************************\ |
---|
| 3 | * -------------------------------------------------------------------------* |
---|
| 4 | * This library is free software; you can redistribute it and/or modify it * |
---|
| 5 | * under the terms of the GNU Lesser General Public License as published by * |
---|
| 6 | * the Free Software Foundation; either version 2.1 of the License, * |
---|
| 7 | * or any later version. * |
---|
| 8 | \**************************************************************************/ |
---|
| 9 | |
---|
[3636] | 10 | require_once("class.notifications.inc.php"); |
---|
[3619] | 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, |
---|
[3873] | 22 | 'load_quota' => True, |
---|
[3619] | 23 | 'notifyUploads' => True, |
---|
| 24 | 'renameFolder' => True, |
---|
| 25 | 'removeFolder' => True, |
---|
| 26 | 'reconstructFolder' => True, |
---|
[3873] | 27 | 'search_dir' => True, |
---|
[3619] | 28 | 'set_owner' => True, |
---|
| 29 | 'search_user' => True, |
---|
[3873] | 30 | 'set_permission' => True, |
---|
[3619] | 31 | 'update_quota' => True, |
---|
| 32 | 'quota' => True |
---|
| 33 | ); |
---|
| 34 | |
---|
| 35 | function uiconfig() |
---|
[3019] | 36 | { |
---|
[3619] | 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 | } |
---|
[3019] | 50 | |
---|
[3619] | 51 | function vfs_functions(){} |
---|
| 52 | |
---|
| 53 | function folders() |
---|
| 54 | { |
---|
| 55 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
[3019] | 56 | |
---|
[3619] | 57 | $this->template->set_file(array('config_list' => 'config_folders.tpl')); |
---|
| 58 | $this->template->set_block('config_list','body','body'); |
---|
| 59 | |
---|
| 60 | $vars = array( |
---|
[3874] | 61 | 'lang_back' => lang('Back'), |
---|
| 62 | 'lang_directory' => lang('directory'), |
---|
[3632] | 63 | 'lang_search' => lang('search'), |
---|
| 64 | 'lang_remove' => lang('remove'), |
---|
| 65 | 'lang_rename' => lang('rename'), |
---|
| 66 | 'lang_create' => lang('create'), |
---|
[3873] | 67 | 'lang_reconstruct' => lang('reconstruct'), |
---|
[3874] | 68 | 'lang_Folder_ Management' => lang('Folder Management'), |
---|
[3873] | 69 | 'path_filemanager' => $GLOBALS['phpgw_info']['flags']['currentapp'] |
---|
[3632] | 70 | ); |
---|
[3019] | 71 | |
---|
[3619] | 72 | $this->template->set_var($vars); |
---|
| 73 | $this->template->pparse('out','body'); |
---|
| 74 | |
---|
| 75 | $GLOBALS['phpgw']->common->phpgw_footer(); |
---|
| 76 | $GLOBALS['phpgw']->common->phpgw_exit(); |
---|
| 77 | |
---|
| 78 | } |
---|
[3019] | 79 | |
---|
[3619] | 80 | function groups_users() |
---|
| 81 | { |
---|
| 82 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
[3019] | 83 | |
---|
[3619] | 84 | $this->template->set_file(array('config_list' => 'config_owner.tpl')); |
---|
| 85 | $this->template->set_block('config_list','body','body'); |
---|
[3632] | 86 | |
---|
| 87 | $vars = array( |
---|
[3873] | 88 | 'lang_Add' => lang('Add'), |
---|
[3875] | 89 | 'lang_back' => lang('Back'), |
---|
[3873] | 90 | 'lang_directory' => lang('directory'), |
---|
| 91 | 'lang_Delete' => lang('Delete'), |
---|
| 92 | 'lang_Edit' => lang('Edit'), |
---|
| 93 | 'lang_Read' => lang('Read'), |
---|
| 94 | 'lang_private' => lang('private'), |
---|
[3632] | 95 | 'lang_search' => lang('search'), |
---|
| 96 | 'lang_setowner' => lang('set owner'), |
---|
| 97 | 'lang_setperm' => lang('set permission'), |
---|
[3875] | 98 | 'lang_Search_Folders' => lang('Search Folders'), |
---|
| 99 | 'lang_Search_Users' => lang('Search Users'), |
---|
[3873] | 100 | 'lang_users_and_groups' => lang('Users and groups'), |
---|
[3875] | 101 | 'lang_permissions_groups_users' => lang('Permissions of groups and users'), |
---|
[3873] | 102 | 'path_filemanager' => $GLOBALS['phpgw_info']['flags']['currentapp'] |
---|
[3632] | 103 | ); |
---|
| 104 | |
---|
[3619] | 105 | $this->template->set_var($vars); |
---|
| 106 | $this->template->pparse('out','body'); |
---|
[3019] | 107 | |
---|
[3873] | 108 | $GLOBALS['phpgw']->common->phpgw_footer(); |
---|
| 109 | $GLOBALS['phpgw']->common->phpgw_exit(); |
---|
[3619] | 110 | } |
---|
[3019] | 111 | |
---|
[3619] | 112 | function createFolder() |
---|
| 113 | { |
---|
| 114 | $GLOBALS['phpgw_info']['flags']['noheader'] = True; |
---|
| 115 | $GLOBALS['phpgw_info']['flags']['nonavbar'] = True; |
---|
| 116 | $GLOBALS['phpgw_info']['flags']['nofooter'] = True; |
---|
| 117 | $GLOBALS['phpgw_info']['flags']['noappheader'] = True; |
---|
| 118 | |
---|
| 119 | $this->bo = CreateObject('filemanager.bofilemanager'); |
---|
| 120 | $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['name'])); |
---|
| 121 | if (strlen($name) < 2) |
---|
| 122 | return false; |
---|
| 123 | $c = CreateObject('phpgwapi.config','filemanager'); |
---|
| 124 | $c->read_repository(); |
---|
| 125 | $current_config = $c->config_data; |
---|
| 126 | |
---|
| 127 | $this->bo->vfs->override_acl = 1; |
---|
| 128 | |
---|
| 129 | if ( $this->bo->vfs->mkdir(array( |
---|
| 130 | 'string' => $name, |
---|
| 131 | 'relatives' => array(RELATIVE_NONE) |
---|
| 132 | )) ) |
---|
| 133 | if ( $this->bo->vfs->set_quota(array( |
---|
| 134 | 'string' => $name, |
---|
| 135 | 'relatives' => array(RELATIVE_NONE), |
---|
| 136 | 'new_quota' => $current_config['filemanager_quota_size'] |
---|
| 137 | )) ) |
---|
| 138 | $return = True; |
---|
| 139 | |
---|
| 140 | $this->bo->vfs->override_acl = 0; |
---|
| 141 | if ($return){ |
---|
| 142 | echo "Folder created"; |
---|
[3019] | 143 | } |
---|
[3619] | 144 | else |
---|
| 145 | echo "Error"; |
---|
| 146 | } |
---|
[3019] | 147 | |
---|
[3619] | 148 | function removeFolder() |
---|
| 149 | { |
---|
| 150 | $GLOBALS['phpgw_info']['flags']['noheader'] = True; |
---|
| 151 | $GLOBALS['phpgw_info']['flags']['nonavbar'] = True; |
---|
| 152 | $GLOBALS['phpgw_info']['flags']['nofooter'] = True; |
---|
| 153 | $GLOBALS['phpgw_info']['flags']['noappheader'] = True; |
---|
| 154 | |
---|
| 155 | $this->bo = CreateObject('filemanager.bofilemanager'); |
---|
[3873] | 156 | $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_POST['dir'])); |
---|
[3619] | 157 | if (strlen($name) < 2) |
---|
| 158 | return false; |
---|
| 159 | if ( $this->bo->vfs->delete(array( |
---|
| 160 | 'string' => $name, |
---|
| 161 | 'relatives' => array(RELATIVE_NONE) |
---|
| 162 | )) ) |
---|
| 163 | { |
---|
| 164 | /* Clean the log */ |
---|
| 165 | $GLOBALS['phpgw']->db->query('DELETE FROM phpgw_vfs WHERE directory = \''.$name.'\'',__LINE__,__FILE__); |
---|
| 166 | if ($GLOBALS['phpgw']->db->Error) |
---|
| 167 | echo "Erro"; |
---|
| 168 | else |
---|
| 169 | { |
---|
| 170 | $GLOBALS['phpgw']->db->query('DELETE FROM phpgw_vfs_quota WHERE directory = \''.$name.'\'',__LINE__,__FILE__); |
---|
| 171 | if (!$GLOBALS['phpgw']->db->Error) |
---|
| 172 | echo lang('directory removed sucessfully'); |
---|
[3019] | 173 | else |
---|
[3619] | 174 | echo "Erro"; |
---|
[3019] | 175 | } |
---|
| 176 | } |
---|
[3873] | 177 | else |
---|
| 178 | echo lang("No permission to delete the folder %1", $name ); |
---|
[3619] | 179 | |
---|
| 180 | } |
---|
| 181 | |
---|
| 182 | function reconstructFolder() |
---|
| 183 | { |
---|
| 184 | $GLOBALS['phpgw_info']['flags']['noheader'] = True; |
---|
| 185 | $GLOBALS['phpgw_info']['flags']['nonavbar'] = True; |
---|
| 186 | $GLOBALS['phpgw_info']['flags']['nofooter'] = True; |
---|
| 187 | $GLOBALS['phpgw_info']['flags']['noappheader'] = True; |
---|
| 188 | |
---|
| 189 | $this->bo = CreateObject('filemanager.bofilemanager'); |
---|
[3873] | 190 | $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_POST['dir'])); |
---|
[3619] | 191 | if (strlen($name) < 2) |
---|
| 192 | return false; |
---|
| 193 | $this->bo->vfs->update_real(array( |
---|
| 194 | 'string' => $name, |
---|
| 195 | 'relatives' => array(RELATIVE_NONE) |
---|
| 196 | ),True); |
---|
| 197 | $this->bo->vfs->flush_journal(array( |
---|
| 198 | 'string' => $name, |
---|
| 199 | 'relatives' => array(RELATIVE_NONE), |
---|
| 200 | 'deleteall' => True |
---|
| 201 | )); |
---|
| 202 | echo lang('Your operation was successfully executed'); |
---|
| 203 | } |
---|
| 204 | |
---|
| 205 | function renameFolder() |
---|
| 206 | { |
---|
| 207 | $GLOBALS['phpgw_info']['flags'] = array |
---|
| 208 | ( |
---|
| 209 | 'currentapp' => 'filemanager', |
---|
| 210 | 'noheader' => True, |
---|
| 211 | 'nonavbar' => True, |
---|
| 212 | 'nofooter' => True, |
---|
| 213 | 'noappheader' => True, |
---|
| 214 | 'enable_browser_class' => True |
---|
| 215 | ); |
---|
| 216 | $this->bo = CreateObject('filemanager.bofilemanager'); |
---|
| 217 | $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir'])); |
---|
| 218 | $to = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['to'])); |
---|
| 219 | if (strlen($name) < 2) |
---|
| 220 | return false; |
---|
| 221 | if ( $this->bo->vfs->mv(array( |
---|
| 222 | 'from' => $name, |
---|
| 223 | 'to' => $to, |
---|
| 224 | 'relatives' => array(RELATIVE_NONE) |
---|
| 225 | )) ){ |
---|
| 226 | $this->bo->vfs->flush_journal(array( |
---|
[3019] | 227 | 'string' => $name, |
---|
| 228 | 'relatives' => array(RELATIVE_NONE), |
---|
| 229 | 'deleteall' => True |
---|
| 230 | )); |
---|
| 231 | echo lang('Your operation was successfully executed'); |
---|
| 232 | } |
---|
[3619] | 233 | else |
---|
| 234 | echo lang('Error'); |
---|
| 235 | } |
---|
[3019] | 236 | |
---|
[3619] | 237 | function quota() |
---|
| 238 | { |
---|
| 239 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
[3632] | 240 | |
---|
[3619] | 241 | $this->template->set_file(array('config_list' => 'config_quota.tpl')); |
---|
| 242 | $this->template->set_block('config_list','body','body'); |
---|
| 243 | |
---|
[3632] | 244 | $vars = array( |
---|
[3874] | 245 | 'lang_back' => lang('Back'), |
---|
| 246 | 'lang_directory' => lang('directory'), |
---|
| 247 | 'lang_save' =>lang('save'), |
---|
| 248 | 'lang_search' => lang('search'), |
---|
| 249 | 'lang_Management_Quota' => lang('Management Quota'), |
---|
| 250 | 'path_filemanager' => $GLOBALS['phpgw_info']['flags']['currentapp'] |
---|
| 251 | ); |
---|
[3632] | 252 | |
---|
[3619] | 253 | $this->template->set_var($vars); |
---|
| 254 | $this->template->pparse('out','body'); |
---|
[3632] | 255 | |
---|
[3619] | 256 | $GLOBALS['phpgw']->common->phpgw_footer(); |
---|
[3874] | 257 | $GLOBALS['phpgw']->common->phpgw_exit(); |
---|
[3619] | 258 | } |
---|
| 259 | |
---|
| 260 | function notifyUploads() |
---|
| 261 | { |
---|
[3632] | 262 | $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Filemanager') ." - " . lang("Email notify uploads"); |
---|
[3619] | 263 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
| 264 | |
---|
[3636] | 265 | $notify = new notifications(); |
---|
| 266 | $value_email_to = ""; |
---|
| 267 | |
---|
| 268 | if( $_POST['button_add'] || $_GET['editUser'] ) |
---|
[3632] | 269 | { |
---|
[3636] | 270 | if( $_GET['editUser'] ) |
---|
| 271 | { |
---|
| 272 | $result = $notify->SearchId($_GET['editUser']); |
---|
| 273 | $emails_to = explode(",", $result[0]['email_to']); |
---|
[7673] | 274 | |
---|
| 275 | $emails_to_count = count($emails_to); |
---|
| 276 | for( $i = 0 ; $i < $emails_to_count; ++$i ) |
---|
[3636] | 277 | { |
---|
| 278 | $value_email_to .= "<tr>"; |
---|
| 279 | $value_email_to .= "<td>".$emails_to[$i]."</td>"; |
---|
| 280 | $value_email_to .= "<td align='center'>"; |
---|
| 281 | $value_email_to .= "<a href='javascript:void();' onclick='notify.deleteEmail(\"".$emails_to[$i]."\",this);'>Remover</a>"; |
---|
| 282 | $value_email_to .= "</td>"; |
---|
| 283 | $value_email_to .= "</tr>"; |
---|
| 284 | } |
---|
| 285 | } |
---|
| 286 | |
---|
[3632] | 287 | $vars = array( |
---|
| 288 | 'action_url_back' => "./index.php?menuaction=filemanager.uiconfig.notifyUploads", |
---|
[3636] | 289 | 'attr_readonly' => ( $result[0]['email_from'] ) ? 'readonly="readonly"' : "", |
---|
[3632] | 290 | 'lang_Add' => lang("Add"), |
---|
| 291 | 'lang_Back' => lang("Back"), |
---|
| 292 | 'lang_Email' => lang("Email"), |
---|
| 293 | 'lang_Excluir' => lang("Delete"), |
---|
| 294 | 'lang_legend1' => lang("When the user with the email send a file"), |
---|
| 295 | 'lang_legend2' => lang("Notify email"), |
---|
| 296 | 'lang_legend3' => lang("Emails reported"), |
---|
| 297 | 'lang_from' => lang("From"), |
---|
| 298 | 'lang_to' => lang("To"), |
---|
[3636] | 299 | 'value_email_from' => ( $result[0]['email_from'] ) ? $result[0]['email_from'] : "", |
---|
| 300 | 'value_email_to' => $value_email_to |
---|
| 301 | ); |
---|
[3632] | 302 | |
---|
| 303 | $handle = "AddEmail"; |
---|
| 304 | } |
---|
| 305 | else |
---|
| 306 | { |
---|
[3636] | 307 | if( trim( $_POST['search_email'] ) != "" ) |
---|
[3632] | 308 | { |
---|
[3636] | 309 | $limit = 10; |
---|
| 310 | $offset = 1; |
---|
| 311 | |
---|
| 312 | if( $_POST['bt_next'] ) |
---|
| 313 | $offset = $_POST['button_next'] + 1 ; |
---|
[3632] | 314 | |
---|
[3636] | 315 | if( $_POST['bt_previous'] && $_POST['button_next'] > 1) |
---|
| 316 | { |
---|
| 317 | $offset = $_POST['button_next'] - 1; |
---|
| 318 | } |
---|
| 319 | |
---|
| 320 | $result = $notify->SearchEmail( $_POST['search_email'], $limit, $offset ); |
---|
| 321 | |
---|
[3632] | 322 | foreach( $result as $tmp ) |
---|
| 323 | { |
---|
[3636] | 324 | $value_email_to .= '<tr>'; |
---|
| 325 | $value_email_to .= '<td align="left" width="40%">'.$tmp['email_from'].'</td>'; |
---|
| 326 | $value_email_to .= '<td align="left" width="40%">'.str_replace(",", "<br/>", $tmp['email_to']).'</td>'; |
---|
| 327 | $value_email_to .= '<td align="center" width="10%"><a href="./index.php?menuaction=filemanager.uiconfig.notifyUploads&editUser='.$tmp['filemanager_id'].'">'.lang("Edit").'</a></td>'; |
---|
| 328 | $value_email_to .= '<td align="center" width="10%"><a href="javascript:void();" onclick="notify.deleteEmailUser(\''.$tmp['filemanager_id'].'\', this);">'.lang("Delete").'</a></td>'; |
---|
| 329 | $value_email_to .= '</tr>'; |
---|
[3632] | 330 | } |
---|
| 331 | } |
---|
| 332 | |
---|
| 333 | $vars = array( |
---|
[3636] | 334 | 'action_url' => "./index.php?menuaction=filemanager.uiconfig.notifyUploads", |
---|
| 335 | 'action_url_back' => "./admin", |
---|
| 336 | 'display_bt_previous' => ( $offset > 1 ) ? "line" : "none", |
---|
| 337 | 'display_bt_next' => ( count($result) < $limit ) ? "none" : "line", |
---|
| 338 | 'lang_Add' => lang("Add"), |
---|
| 339 | 'lang_Back' => lang("Back"), |
---|
| 340 | 'lang_Delete' => lang("Delete"), |
---|
| 341 | 'lang_Edit' => lang("Edit"), |
---|
| 342 | 'lang_From' => lang("From"), |
---|
| 343 | 'lang_To' => lang("To"), |
---|
| 344 | 'lang_search' => lang("Search"), |
---|
| 345 | 'lang_next' => lang("Next"), |
---|
| 346 | 'lang_previous' => lang("Previous"), |
---|
| 347 | 'value_search_email' => $_POST['search_email'], |
---|
| 348 | 'value_email_to' => $value_email_to, |
---|
| 349 | 'value_next' => $offset, |
---|
| 350 | 'value_previous' => $limit |
---|
[3632] | 351 | ); |
---|
| 352 | |
---|
| 353 | $handle = "index"; |
---|
| 354 | } |
---|
| 355 | |
---|
[3619] | 356 | $this->template->set_file(array('config_email' => 'notify_upload.tpl')); |
---|
[3632] | 357 | $this->template->set_block('config_email',$handle); |
---|
[3619] | 358 | $this->template->set_var($vars); |
---|
[3632] | 359 | $this->template->pparse('out',$handle); |
---|
| 360 | |
---|
[3619] | 361 | $GLOBALS['phpgw']->common->phpgw_footer(); |
---|
| 362 | $GLOBALS['phpgw']->common->phpgw_exit(); |
---|
| 363 | } |
---|
| 364 | |
---|
| 365 | function search_dir() |
---|
| 366 | { |
---|
[3874] | 367 | $GLOBALS['phpgw_info']['flags']['noheader'] = True; |
---|
| 368 | $GLOBALS['phpgw_info']['flags']['nonavbar'] = True; |
---|
| 369 | $GLOBALS['phpgw_info']['flags']['nofooter'] = True; |
---|
| 370 | $GLOBALS['phpgw_info']['flags']['noappheader'] = True; |
---|
[3873] | 371 | |
---|
[3874] | 372 | $_options = ""; |
---|
| 373 | $query = ""; |
---|
[3873] | 374 | |
---|
[3874] | 375 | $name = $GLOBALS['phpgw']->db->db_addslashes($_POST['name']); |
---|
| 376 | |
---|
| 377 | $query = 'SELECT directory,name from phpgw_vfs WHERE directory = \'/home\' and name like \'%'.$name.'%\' LIMIT 1'; |
---|
| 378 | |
---|
| 379 | $GLOBALS['phpgw']->db->query( $query,__LINE__,__FILE__ ); |
---|
| 380 | |
---|
| 381 | while ( $GLOBALS['phpgw']->db->next_record() ) |
---|
[3873] | 382 | { |
---|
[3874] | 383 | $val = $GLOBALS['phpgw']->db->row(); |
---|
| 384 | $_options .= "<option>".$val['directory']."/".$val['name']."</option>"; |
---|
[3873] | 385 | } |
---|
[3019] | 386 | |
---|
[3873] | 387 | echo $_options; |
---|
[3619] | 388 | } |
---|
| 389 | |
---|
| 390 | function search_user() |
---|
| 391 | { |
---|
| 392 | $GLOBALS['phpgw_info']['flags']['noheader'] = True; |
---|
| 393 | $GLOBALS['phpgw_info']['flags']['nonavbar'] = True; |
---|
| 394 | $GLOBALS['phpgw_info']['flags']['nofooter'] = True; |
---|
| 395 | $GLOBALS['phpgw_info']['flags']['noappheader'] = True; |
---|
[3875] | 396 | |
---|
| 397 | $_options = ""; |
---|
| 398 | |
---|
| 399 | $account_info = $GLOBALS['phpgw']->accounts->get_list('both',0,'','',$_POST['name'],'all'); |
---|
[3019] | 400 | |
---|
[3619] | 401 | foreach($account_info as $val) |
---|
[3875] | 402 | $_options .= "<option value='".$val['account_id']."'>".$val['account_lid']."</option>"; |
---|
| 403 | |
---|
| 404 | echo $_options; |
---|
[3619] | 405 | } |
---|
| 406 | |
---|
| 407 | function set_permission() |
---|
| 408 | { |
---|
| 409 | $GLOBALS['phpgw_info']['flags']['noheader'] = True; |
---|
| 410 | $GLOBALS['phpgw_info']['flags']['nonavbar'] = True; |
---|
| 411 | $GLOBALS['phpgw_info']['flags']['nofooter'] = True; |
---|
| 412 | $GLOBALS['phpgw_info']['flags']['noappheader'] = True; |
---|
[3019] | 413 | |
---|
[3619] | 414 | $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir'])); |
---|
| 415 | $perms = ($_GET['perms'])*1; |
---|
| 416 | $owner = ($_GET['owner'])*1; |
---|
| 417 | $dirs=explode('/',$name); |
---|
| 418 | $GLOBALS['phpgw']->db->query('SELECT owner_id from phpgw_vfs WHERE directory = \'/'.$dirs[1].'\' and name=\''.$dirs[2].'\' LIMIT 1',__LINE__,__FILE__); |
---|
| 419 | if ($GLOBALS['phpgw']->db->next_record()){ |
---|
| 420 | $val = $GLOBALS['phpgw']->db->row(); |
---|
| 421 | $owner_id = $val['owner_id']; |
---|
[3019] | 422 | } |
---|
| 423 | |
---|
[3619] | 424 | $query = "SELECT count(*) FROM phpgw_acl WHERE acl_appname = 'filemanager' and acl_account = '".$owner_id."' and acl_location='".$owner."'"; |
---|
| 425 | if ($GLOBALS['phpgw']->db->query($query) && $GLOBALS['phpgw']->db->next_record()) |
---|
| 426 | $val = $GLOBALS['phpgw']->db->row(); |
---|
| 427 | else |
---|
| 428 | { |
---|
| 429 | echo $GLOBALS['phpgw']->db->error; |
---|
| 430 | return false; |
---|
[3019] | 431 | } |
---|
[3619] | 432 | if ($val['count'] == '1') |
---|
| 433 | $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__); |
---|
| 434 | else |
---|
| 435 | $GLOBALS['phpgw']->db->query("INSERT INTO phpgw_acl values('filemanager','".$owner."','".$owner_id."',".$perms.")",__LINE__,__FILE__); |
---|
| 436 | if ($GLOBALS['phpgw']->db->Error) |
---|
| 437 | echo "Erro"; |
---|
| 438 | else |
---|
| 439 | { |
---|
| 440 | echo lang('entry updated sucessfully'); |
---|
[3019] | 441 | } |
---|
[3619] | 442 | return; |
---|
| 443 | } |
---|
[3019] | 444 | |
---|
[3619] | 445 | |
---|
| 446 | function set_owner() |
---|
| 447 | { |
---|
| 448 | $GLOBALS['phpgw_info']['flags']['noheader'] = True; |
---|
| 449 | $GLOBALS['phpgw_info']['flags']['nonavbar'] = True; |
---|
| 450 | $GLOBALS['phpgw_info']['flags']['nofooter'] = True; |
---|
| 451 | $GLOBALS['phpgw_info']['flags']['noappheader'] = True; |
---|
| 452 | |
---|
| 453 | $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir'])); |
---|
| 454 | $owner = ($_GET['owner'])*1; |
---|
| 455 | |
---|
| 456 | $GLOBALS['phpgw']->db->query('UPDATE phpgw_vfs SET owner_id = '.$owner.' WHERE directory = \''.$name.'\'',__LINE__,__FILE__); |
---|
| 457 | if ($GLOBALS['phpgw']->db->Error) |
---|
| 458 | echo "Erro"; |
---|
| 459 | else |
---|
| 460 | { |
---|
| 461 | $dirs=explode('/',$name); |
---|
| 462 | $GLOBALS['phpgw']->db->query('UPDATE phpgw_vfs SET owner_id = '.$owner.' WHERE directory = \'/'.$dirs[1].'\' and name=\''.$dirs[2].'\'',__LINE__,__FILE__); |
---|
[3019] | 463 | if ($GLOBALS['phpgw']->db->Error) |
---|
| 464 | echo "Erro"; |
---|
| 465 | else |
---|
| 466 | { |
---|
[3619] | 467 | echo lang('entry updated sucessfully'); |
---|
[3019] | 468 | } |
---|
| 469 | } |
---|
[3619] | 470 | return; |
---|
| 471 | } |
---|
[3019] | 472 | |
---|
[3619] | 473 | function update_quota() |
---|
| 474 | { |
---|
| 475 | $GLOBALS['phpgw_info']['flags']['noheader'] = True; |
---|
| 476 | $GLOBALS['phpgw_info']['flags']['nonavbar'] = True; |
---|
| 477 | $GLOBALS['phpgw_info']['flags']['nofooter'] = True; |
---|
| 478 | $GLOBALS['phpgw_info']['flags']['noappheader'] = True; |
---|
[3019] | 479 | |
---|
[3874] | 480 | $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_POST['dir'])); |
---|
| 481 | $size = ($_POST['val']) * 1; |
---|
| 482 | |
---|
[3887] | 483 | $eAdminDbFunctions = CreateObject('expressoAdmin1_2.db_functions'); |
---|
| 484 | if($eAdminDbFunctions->use_cota_control()) { |
---|
| 485 | $eAdminFunctions = CreateObject('expressoAdmin1_2.functions'); |
---|
| 486 | |
---|
| 487 | if(!$eAdminFunctions->has_file_disk_quota($name,$size)){ |
---|
| 488 | echo lang("not enough quota"); |
---|
| 489 | return; |
---|
| 490 | } |
---|
| 491 | |
---|
| 492 | } |
---|
| 493 | |
---|
[3619] | 494 | /* See if quota exists or not */ |
---|
| 495 | $query = "SELECT count(directory) FROM phpgw_vfs_quota WHERE directory = '".$name."' LIMIT 1"; |
---|
| 496 | if ($GLOBALS['phpgw']->db->query($query) && $GLOBALS['phpgw']->db->next_record()) |
---|
| 497 | $val = $GLOBALS['phpgw']->db->row(); |
---|
| 498 | else |
---|
| 499 | { |
---|
| 500 | echo $GLOBALS['phpgw']->db->error; |
---|
| 501 | return false; |
---|
| 502 | } |
---|
| 503 | if ($val['count'] == '1') |
---|
| 504 | { |
---|
| 505 | $GLOBALS['phpgw']->db->query('UPDATE phpgw_vfs_quota SET quota_size = '.$size.' WHERE directory = \''.$name.'\'',__LINE__,__FILE__); |
---|
[3019] | 506 | if ($GLOBALS['phpgw']->db->Error) |
---|
| 507 | echo "Erro"; |
---|
| 508 | else |
---|
[3619] | 509 | echo lang('entry updated sucessfully'); |
---|
[3019] | 510 | } |
---|
[3619] | 511 | else |
---|
| 512 | { |
---|
| 513 | /*preferences does not exist*/ |
---|
| 514 | $query = "INSERT INTO phpgw_vfs_quota values ('".$name."',".$size.")"; |
---|
| 515 | if (!$GLOBALS['phpgw']->db->query($query)) |
---|
[3019] | 516 | echo $GLOBALS['phpgw']->db->error; |
---|
| 517 | else |
---|
[3619] | 518 | echo lang('entry updated sucessfully'); |
---|
[3019] | 519 | } |
---|
[3619] | 520 | } |
---|
| 521 | |
---|
| 522 | function load_quota() |
---|
| 523 | { |
---|
| 524 | $GLOBALS['phpgw_info']['flags']['noheader'] = True; |
---|
| 525 | $GLOBALS['phpgw_info']['flags']['nonavbar'] = True; |
---|
| 526 | $GLOBALS['phpgw_info']['flags']['nofooter'] = True; |
---|
| 527 | $GLOBALS['phpgw_info']['flags']['noappheader'] = True; |
---|
| 528 | |
---|
| 529 | $name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['name'])); |
---|
| 530 | $GLOBALS['phpgw']->db->query('SELECT quota_size FROM phpgw_vfs_quota WHERE directory = \''.$name.'\' LIMIT 1',__LINE__,__FILE__); |
---|
| 531 | $GLOBALS['phpgw']->db->next_record(); |
---|
| 532 | $val =$GLOBALS['phpgw']->db->row(); |
---|
| 533 | echo $val['quota_size']; |
---|
| 534 | return; |
---|
[3019] | 535 | |
---|
[3619] | 536 | } |
---|
| 537 | } |
---|
[3019] | 538 | |
---|
| 539 | ?> |
---|