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