@@ -40,11 +40,10 @@ discard block |
||
40 | 40 | { |
41 | 41 | if ((string)$content['owner'] === '0' && $GLOBALS['egw_info']['user']['apps']['admin']) |
42 | 42 | { |
43 | - $deny_edit = $content['account_id'] ? $GLOBALS['egw']->acl->check('account_access', 16, 'admin') : |
|
44 | - $GLOBALS['egw']->acl->check('account_access', 4, 'admin'); |
|
43 | + $deny_edit = $content['account_id'] ? $GLOBALS['egw']->acl->check('account_access', 16, 'admin') : $GLOBALS['egw']->acl->check('account_access', 4, 'admin'); |
|
45 | 44 | //error_log(__METHOD__."() contact_id=$content[contact_id], account_id=$content[account_id], deny_edit=".array2string($deny_edit)); |
46 | 45 | |
47 | - if (!$content['account_id'] && $deny_edit) return; // no right to add new Api\Accounts, should not happen by AB ACL |
|
46 | + if (!$content['account_id'] && $deny_edit) return; // no right to add new Api\Accounts, should not happen by AB ACL |
|
48 | 47 | |
49 | 48 | // load our translations |
50 | 49 | Api\Translation::add_app('admin'); |
@@ -58,7 +57,7 @@ discard block |
||
58 | 57 | throw new Api\Exception\NotFound('Account data NOT found!'); |
59 | 58 | } |
60 | 59 | if ($account['account_expires'] == -1) $account['account_expires'] = ''; |
61 | - unset($account['account_pwd']); // do NOT send to client |
|
60 | + unset($account['account_pwd']); // do NOT send to client |
|
62 | 61 | $account['memberships'] = array_keys($account['memberships']); |
63 | 62 | $acl = new Acl($content['account_id']); |
64 | 63 | $acl->read_repository(); |
@@ -78,7 +77,7 @@ discard block |
||
78 | 77 | 'account_status' => 'A', |
79 | 78 | 'memberships' => array(), |
80 | 79 | 'anonymous' => false, |
81 | - 'changepassword' => true, //old default: (bool)$GLOBALS['egw_info']['server']['change_pwd_every_x_days'], |
|
80 | + 'changepassword' => true, //old default: (bool)$GLOBALS['egw_info']['server']['change_pwd_every_x_days'], |
|
82 | 81 | 'mustchangepassword' => false, |
83 | 82 | 'account_primary_group' => $GLOBALS['egw']->accounts->name2id('Default'), |
84 | 83 | 'homedirectory' => $GLOBALS['egw_info']['server']['ldap_account_home'], |
@@ -99,7 +98,7 @@ discard block |
||
99 | 98 | |
100 | 99 | if ($deny_edit) |
101 | 100 | { |
102 | - foreach(array_keys($account) as $key) |
|
101 | + foreach (array_keys($account) as $key) |
|
103 | 102 | { |
104 | 103 | $readonlys[$key] = true; |
105 | 104 | } |
@@ -131,11 +130,11 @@ discard block |
||
131 | 130 | { |
132 | 131 | if ($content['old_account'] && $content['old_account'] == array_diff_key($content, $content['old_account'])) |
133 | 132 | { |
134 | - return ''; // no need to save account data, if nothing changed |
|
133 | + return ''; // no need to save account data, if nothing changed |
|
135 | 134 | } |
136 | 135 | //error_log(__METHOD__."(".array2string($content).")"); |
137 | 136 | $account = array(); |
138 | - foreach(array( |
|
137 | + foreach (array( |
|
139 | 138 | // need to copy/rename some fields named different in account and contact |
140 | 139 | 'n_given' => 'account_firstname', |
141 | 140 | 'n_family' => 'account_lastname', |
@@ -152,11 +151,10 @@ discard block |
||
152 | 151 | { |
153 | 152 | if (is_int($c_name)) $c_name = $a_name; |
154 | 153 | |
155 | - switch($a_name) |
|
154 | + switch ($a_name) |
|
156 | 155 | { |
157 | 156 | case 'account_expires': |
158 | - $account[$a_name] = $content[$c_name] ? $content[$c_name] : |
|
159 | - ($content['account_status'] ? 'never' : 'already'); |
|
157 | + $account[$a_name] = $content[$c_name] ? $content[$c_name] : ($content['account_status'] ? 'never' : 'already'); |
|
160 | 158 | break; |
161 | 159 | |
162 | 160 | case 'changepassword': // boolean values: admin_cmd_edit_user understands '' as NOT set |
@@ -171,7 +169,7 @@ discard block |
||
171 | 169 | } |
172 | 170 | } |
173 | 171 | // Make sure primary group is in account groups |
174 | - if($account['account_primary_group'] && !array_search($account['account_primary_group'], (array)$account['account_groups'])) |
|
172 | + if ($account['account_primary_group'] && !array_search($account['account_primary_group'], (array)$account['account_groups'])) |
|
175 | 173 | { |
176 | 174 | $account['account_groups'][] = $account['account_primary_group']; |
177 | 175 | } |
@@ -204,7 +202,7 @@ discard block |
||
204 | 202 | * |
205 | 203 | * @param array $content =null |
206 | 204 | */ |
207 | - public static function delete(array $content=null) |
|
205 | + public static function delete(array $content = null) |
|
208 | 206 | { |
209 | 207 | if (!is_array($content)) |
210 | 208 | { |
@@ -221,7 +219,7 @@ discard block |
||
221 | 219 | } |
222 | 220 | //error_log(__METHOD__."() \$_GET[account_id]=$_GET[account_id], \$_GET[contact_id]=$_GET[contact_id] content=".array2string($content)); |
223 | 221 | } |
224 | - if ($GLOBALS['egw']->acl->check('account_access',32,'admin') || !($content['account_id'] > 0) || |
|
222 | + if ($GLOBALS['egw']->acl->check('account_access', 32, 'admin') || !($content['account_id'] > 0) || |
|
225 | 223 | $GLOBALS['egw_info']['user']['account_id'] == $content['account_id']) |
226 | 224 | { |
227 | 225 | Framework::window_close(lang('Permission denied!!!')); |
@@ -275,7 +273,7 @@ discard block |
||
275 | 273 | } |
276 | 274 | } |
277 | 275 | |
278 | - if (!$data['account_lid'] && !$data['account_id']) return; // makes no sense to check before |
|
276 | + if (!$data['account_lid'] && !$data['account_id']) return; // makes no sense to check before |
|
279 | 277 | |
280 | 278 | // set home-directory when account_lid is entered, but only for new Api\Accounts |
281 | 279 | if ($changed == 'account_lid' && !$data['account_id'] && |
@@ -294,7 +292,7 @@ discard block |
||
294 | 292 | $cmd = new admin_cmd_edit_user($data['account_id'], $data); |
295 | 293 | $cmd->run(null, false, false, true); |
296 | 294 | } |
297 | - catch(Exception $e) |
|
295 | + catch (Exception $e) |
|
298 | 296 | { |
299 | 297 | Api\Json\Response::get()->data($e->getMessage()); |
300 | 298 | } |
@@ -44,20 +44,30 @@ discard block |
||
44 | 44 | $GLOBALS['egw']->acl->check('account_access', 4, 'admin'); |
45 | 45 | //error_log(__METHOD__."() contact_id=$content[contact_id], account_id=$content[account_id], deny_edit=".array2string($deny_edit)); |
46 | 46 | |
47 | - if (!$content['account_id'] && $deny_edit) return; // no right to add new Api\Accounts, should not happen by AB ACL |
|
47 | + if (!$content['account_id'] && $deny_edit) |
|
48 | + { |
|
49 | + return; |
|
50 | + } |
|
51 | + // no right to add new Api\Accounts, should not happen by AB ACL |
|
48 | 52 | |
49 | 53 | // load our translations |
50 | 54 | Api\Translation::add_app('admin'); |
51 | 55 | |
52 | - if ($content['id']) // existing account |
|
56 | + if ($content['id']) |
|
57 | + { |
|
58 | + // existing account |
|
53 | 59 | { |
54 | 60 | // invalidate account, before reading it, to code with changed to DB or LDAP outside EGw |
55 | 61 | Api\Accounts::cache_invalidate((int)$content['account_id']); |
62 | + } |
|
56 | 63 | if (!($account = $GLOBALS['egw']->accounts->read($content['account_id']))) |
57 | 64 | { |
58 | 65 | throw new Api\Exception\NotFound('Account data NOT found!'); |
59 | 66 | } |
60 | - if ($account['account_expires'] == -1) $account['account_expires'] = ''; |
|
67 | + if ($account['account_expires'] == -1) |
|
68 | + { |
|
69 | + $account['account_expires'] = ''; |
|
70 | + } |
|
61 | 71 | unset($account['account_pwd']); // do NOT send to client |
62 | 72 | $account['memberships'] = array_keys($account['memberships']); |
63 | 73 | $acl = new Acl($content['account_id']); |
@@ -150,7 +160,10 @@ discard block |
||
150 | 160 | 'homedirectory', 'loginshell', |
151 | 161 | ) as $c_name => $a_name) |
152 | 162 | { |
153 | - if (is_int($c_name)) $c_name = $a_name; |
|
163 | + if (is_int($c_name)) |
|
164 | + { |
|
165 | + $c_name = $a_name; |
|
166 | + } |
|
154 | 167 | |
155 | 168 | switch($a_name) |
156 | 169 | { |
@@ -269,13 +282,20 @@ discard block |
||
269 | 282 | if (!$data['account_id'] && in_array($changed, array('n_given', 'n_family', 'account_lid'))) |
270 | 283 | { |
271 | 284 | $email = Api\Accounts::email($data['account_firstname'], $data['account_lastname'], $data['account_lid']); |
272 | - if ($email && $email[0] != '@' && strpos($email, '@')) // only add valid email addresses |
|
285 | + if ($email && $email[0] != '@' && strpos($email, '@')) |
|
286 | + { |
|
287 | + // only add valid email addresses |
|
273 | 288 | { |
274 | 289 | Api\Json\Response::get()->assign('addressbook-edit_email', 'value', $email); |
275 | 290 | } |
291 | + } |
|
276 | 292 | } |
277 | 293 | |
278 | - if (!$data['account_lid'] && !$data['account_id']) return; // makes no sense to check before |
|
294 | + if (!$data['account_lid'] && !$data['account_id']) |
|
295 | + { |
|
296 | + return; |
|
297 | + } |
|
298 | + // makes no sense to check before |
|
279 | 299 | |
280 | 300 | // set home-directory when account_lid is entered, but only for new Api\Accounts |
281 | 301 | if ($changed == 'account_lid' && !$data['account_id'] && |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | 'List config settings' => 1, |
15 | 15 | 'Change config settings' => 2 |
16 | 16 | ) |
17 | -); // added and working ralfbecker |
|
17 | +); // added and working ralfbecker |
|
18 | 18 | |
19 | 19 | $GLOBALS['acl_manager']['admin']['account_access'] = array( |
20 | 20 | 'name' => 'Deny access to user accounts', |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | 'Delete account' => 32, |
28 | 28 | 'change ACL Rights' => 64 |
29 | 29 | ) |
30 | -); // was already there and seems to work ralfbecker |
|
30 | +); // was already there and seems to work ralfbecker |
|
31 | 31 | |
32 | 32 | $GLOBALS['acl_manager']['admin']['group_access'] = array( |
33 | 33 | 'name' => 'Deny access to groups', |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | 'Edit group' => 16, |
40 | 40 | 'Delete group' => 32 |
41 | 41 | ) |
42 | -); // was already there and seems to work ralfbecker |
|
42 | +); // was already there and seems to work ralfbecker |
|
43 | 43 | |
44 | 44 | $GLOBALS['acl_manager']['admin']['applications_acc'] = array( |
45 | 45 | 'name' => 'Deny access to applications', |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | 'Register application hooks' => 16 |
54 | 54 | ) |
55 | -); // added and working ralfbecker |
|
55 | +); // added and working ralfbecker |
|
56 | 56 | |
57 | 57 | $GLOBALS['acl_manager']['admin']['global_categorie'] = array( |
58 | 58 | 'name' => 'Deny access to global categories', |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | 'Delete category' => 32, |
66 | 66 | 'Add sub-category' => 64 |
67 | 67 | ) |
68 | -); // added and working ralfbecker |
|
68 | +); // added and working ralfbecker |
|
69 | 69 | |
70 | 70 | $GLOBALS['acl_manager']['admin']['mainscreen_messa'] = array( |
71 | 71 | 'name' => 'Deny access to mainscreen message', |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | 'Main screen message' => 1, |
74 | 74 | 'Login message' => 2 |
75 | 75 | ) |
76 | -); // added and working ralfbecker |
|
76 | +); // added and working ralfbecker |
|
77 | 77 | |
78 | 78 | $GLOBALS['acl_manager']['admin']['current_sessions'] = array( |
79 | 79 | 'name' => 'Deny access to current sessions', |
@@ -83,40 +83,40 @@ discard block |
||
83 | 83 | 'Show session IP address' => 4, |
84 | 84 | 'Kill session' => 8 |
85 | 85 | ) |
86 | -); // checked and working ralfbecker |
|
86 | +); // checked and working ralfbecker |
|
87 | 87 | |
88 | 88 | $GLOBALS['acl_manager']['admin']['access_log_acces'] = array( |
89 | 89 | 'name' => 'Deny access to access log', |
90 | 90 | 'rights' => array( |
91 | 91 | 'Show access log' => 1 |
92 | 92 | ) |
93 | -); // added and working ralfbecker |
|
93 | +); // added and working ralfbecker |
|
94 | 94 | |
95 | 95 | $GLOBALS['acl_manager']['admin']['error_log_access'] = array( |
96 | 96 | 'name' => 'Deny access to error log', |
97 | 97 | 'rights' => array( |
98 | 98 | 'Show error log' => 1 |
99 | 99 | ) |
100 | -); // added and working ralfbecker |
|
100 | +); // added and working ralfbecker |
|
101 | 101 | |
102 | 102 | $GLOBALS['acl_manager']['admin']['asyncservice_acc'] = array( |
103 | 103 | 'name' => 'Deny access to asynchronous timed services', |
104 | 104 | 'rights' => array( |
105 | 105 | 'Asynchronous timed services' => 1 |
106 | 106 | ) |
107 | -); // added and working ralfbecker |
|
107 | +); // added and working ralfbecker |
|
108 | 108 | |
109 | 109 | $GLOBALS['acl_manager']['admin']['db_backup_access'] = array( |
110 | 110 | 'name' => 'Deny access to DB backup and restore', |
111 | 111 | 'rights' => array( |
112 | 112 | 'DB backup and restore' => 1 |
113 | 113 | ) |
114 | -); // added and working ralfbecker |
|
114 | +); // added and working ralfbecker |
|
115 | 115 | |
116 | 116 | $GLOBALS['acl_manager']['admin']['info_access'] = array( |
117 | 117 | 'name' => 'Deny access to phpinfo', |
118 | 118 | 'rights' => array( |
119 | 119 | 'Show phpinfo()' => 1 |
120 | 120 | ) |
121 | -); // added and working ralfbecker |
|
121 | +); // added and working ralfbecker |
|
122 | 122 |
@@ -18,11 +18,11 @@ |
||
18 | 18 | parent::__construct(); |
19 | 19 | |
20 | 20 | // Field mapping |
21 | - $this->export_fields = array( |
|
21 | + $this->export_fields = array( |
|
22 | 22 | 'account_id' => lang('Account ID'), |
23 | 23 | 'account_lid' => lang('Group Name'), |
24 | 24 | 'account_members' => lang('Members'), |
25 | - ); |
|
25 | + ); |
|
26 | 26 | |
27 | 27 | // Custom fields - not really used in admin... |
28 | 28 | unset($this->export_fields['customfields']); |
@@ -27,7 +27,7 @@ |
||
27 | 27 | // Custom fields - not really used in admin... |
28 | 28 | unset($this->export_fields['customfields']); |
29 | 29 | $custom = Api\Storage\Customfields::get('admin', true); |
30 | - foreach($custom as $name => $data) { |
|
30 | + foreach ($custom as $name => $data) { |
|
31 | 31 | $this->export_fields['#'.$name] = $data['label']; |
32 | 32 | } |
33 | 33 | } |
@@ -14,7 +14,8 @@ discard block |
||
14 | 14 | |
15 | 15 | class admin_wizard_export_groups_csv extends importexport_wizard_basic_export_csv |
16 | 16 | { |
17 | - public function __construct() { |
|
17 | + public function __construct() |
|
18 | + { |
|
18 | 19 | parent::__construct(); |
19 | 20 | |
20 | 21 | // Field mapping |
@@ -27,7 +28,8 @@ discard block |
||
27 | 28 | // Custom fields - not really used in admin... |
28 | 29 | unset($this->export_fields['customfields']); |
29 | 30 | $custom = Api\Storage\Customfields::get('admin', true); |
30 | - foreach($custom as $name => $data) { |
|
31 | + foreach($custom as $name => $data) |
|
32 | + { |
|
31 | 33 | $this->export_fields['#'.$name] = $data['label']; |
32 | 34 | } |
33 | 35 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @param array $data =array() default parm from parent class, no real parameters |
26 | 26 | */ |
27 | - function __construct($data=array()) |
|
27 | + function __construct($data = array()) |
|
28 | 28 | { |
29 | 29 | admin_cmd::__construct($data); |
30 | 30 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @param boolean $check_only =false only run the checks (and throw the exceptions), but not the command itself |
36 | 36 | * @return string success message |
37 | 37 | */ |
38 | - protected function exec($check_only=false) |
|
38 | + protected function exec($check_only = false) |
|
39 | 39 | { |
40 | 40 | if ($check_only) return true; |
41 | 41 |
@@ -37,7 +37,10 @@ |
||
37 | 37 | */ |
38 | 38 | protected function exec($check_only=false) |
39 | 39 | { |
40 | - if ($check_only) return true; |
|
40 | + if ($check_only) |
|
41 | + { |
|
42 | + return true; |
|
43 | + } |
|
41 | 44 | |
42 | 45 | admin_cmd::_instanciate_accounts(); |
43 | 46 |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | $old_apps = array_keys($this->acl->get_user_applications($content['acl_account'], false, false)); |
56 | 56 | // add new apps |
57 | 57 | $added_apps = array_diff($content['apps'], $old_apps); |
58 | - foreach($added_apps as $app) |
|
58 | + foreach ($added_apps as $app) |
|
59 | 59 | { |
60 | 60 | $this->acl->add_repository($app, 'run', $content['acl_account'], 1); |
61 | 61 | } |
62 | 62 | // remove no longer checked apps |
63 | 63 | $removed_apps = array_diff($old_apps, $content['apps']); |
64 | 64 | $deleted_ids = array(); |
65 | - foreach($removed_apps as $app) |
|
65 | + foreach ($removed_apps as $app) |
|
66 | 66 | { |
67 | 67 | $this->acl->delete_repository($app, 'run', $content['acl_account']); |
68 | 68 | $deleted_ids[] = $app.':'.$content['acl_account'].':run'; |
@@ -96,12 +96,11 @@ discard block |
||
96 | 96 | { |
97 | 97 | // assamble rights again |
98 | 98 | $rights = (int)$content['preserve_rights']; |
99 | - foreach($content['acl'] as $right) |
|
99 | + foreach ($content['acl'] as $right) |
|
100 | 100 | { |
101 | 101 | $rights |= $right; |
102 | 102 | } |
103 | - $id = !empty($content['id']) ? $content['id'] : |
|
104 | - $content['acl_appname'].':'.$content['acl_account'].':'.$content['acl_location']; |
|
103 | + $id = !empty($content['id']) ? $content['id'] : $content['acl_appname'].':'.$content['acl_account'].':'.$content['acl_location']; |
|
105 | 104 | //error_log(__METHOD__."() id=$id, acl=".array2string($content['acl'])." --> rights=$rights"); |
106 | 105 | |
107 | 106 | if ($this->acl->get_specific_rights_for_account($content['acl_account'], $content['acl_location'], $content['acl_appname']) == $rights) |
@@ -134,14 +133,14 @@ discard block |
||
134 | 133 | * @param array &$rows=null |
135 | 134 | * @return int total number of rows available |
136 | 135 | */ |
137 | - public static function get_rows(array $query, array &$rows=null) |
|
136 | + public static function get_rows(array $query, array &$rows = null) |
|
138 | 137 | { |
139 | 138 | $so_sql = new Api\Storage\Base('phpgwapi', Acl::TABLE, null, '', true); |
140 | 139 | |
141 | 140 | // client queries destinct rows by their row-id |
142 | 141 | if (isset($query['col_filter']['id'])) |
143 | 142 | { |
144 | - $query['col_filter'][] = $GLOBALS['egw']->db->concat('acl_appname',"':'",'acl_account',"':'",'acl_location'). |
|
143 | + $query['col_filter'][] = $GLOBALS['egw']->db->concat('acl_appname', "':'", 'acl_account', "':'", 'acl_location'). |
|
145 | 144 | ' IN ('.implode(',', array_map(array($GLOBALS['egw']->db, 'quote'), (array)$query['col_filter']['id'])).')'; |
146 | 145 | unset($query['col_filter']['id']); |
147 | 146 | } |
@@ -159,9 +158,9 @@ discard block |
||
159 | 158 | if ($GLOBALS['egw_info']['user']['preferences']['admin']['acl_filter'] != $query['filter']) |
160 | 159 | { |
161 | 160 | $GLOBALS['egw']->preferences->add('admin', 'acl_filter', $query['filter']); |
162 | - $GLOBALS['egw']->preferences->save_repository(false,'user',false); |
|
161 | + $GLOBALS['egw']->preferences->save_repository(false, 'user', false); |
|
163 | 162 | } |
164 | - switch($query['filter']) |
|
163 | + switch ($query['filter']) |
|
165 | 164 | { |
166 | 165 | case 'run': |
167 | 166 | $query['col_filter']['acl_location'] = 'run'; |
@@ -185,7 +184,7 @@ discard block |
||
185 | 184 | if ($not_enum_group_acls) |
186 | 185 | { |
187 | 186 | $sql = '(CASE acl_appname'; |
188 | - foreach($not_enum_group_acls as $app => $groups) |
|
187 | + foreach ($not_enum_group_acls as $app => $groups) |
|
189 | 188 | { |
190 | 189 | if ($groups === true) |
191 | 190 | { |
@@ -195,7 +194,7 @@ discard block |
||
195 | 194 | { |
196 | 195 | $check = array_diff($memberships, $groups); |
197 | 196 | //error_log(__METHOD__."() app=$app, array_diff(memberships=".array2string($memberships).", groups=".array2string($groups).")=".array2string($check)); |
198 | - if (!$check) continue; // would give sql error otherwise! |
|
197 | + if (!$check) continue; // would give sql error otherwise! |
|
199 | 198 | } |
200 | 199 | $sql .= ' WHEN '.$GLOBALS['egw']->db->quote($app).' THEN '.$GLOBALS['egw']->db->expression(Acl::TABLE, array( |
201 | 200 | 'acl_account' => $check, |
@@ -225,7 +224,7 @@ discard block |
||
225 | 224 | $readonlys = array(); |
226 | 225 | $total = $so_sql->get_rows($query, $rows, $readonlys); |
227 | 226 | |
228 | - foreach($rows as &$row) |
|
227 | + foreach ($rows as &$row) |
|
229 | 228 | { |
230 | 229 | // generate a row-id |
231 | 230 | $row['id'] = $row['acl_appname'].':'.$row['acl_account'].':'.$row['acl_location']; |
@@ -237,9 +236,9 @@ discard block |
||
237 | 236 | else |
238 | 237 | { |
239 | 238 | if ($app !== $row['acl_appname']) Api\Translation::add_app($row['app_name']); |
240 | - foreach($query['acl_rights'][$row['acl_appname']] as $val => $label) |
|
239 | + foreach ($query['acl_rights'][$row['acl_appname']] as $val => $label) |
|
241 | 240 | { |
242 | - if ($row['acl_rights'] & $val) |
|
241 | + if ($row['acl_rights']&$val) |
|
243 | 242 | { |
244 | 243 | $row['acl'.$val] = lang($label); |
245 | 244 | } |
@@ -254,11 +253,11 @@ discard block |
||
254 | 253 | //error_log(__METHOD__."(".array2string($query).") returning ".$total); |
255 | 254 | |
256 | 255 | // Get supporting or all apps for filter2 depending on filter |
257 | - if($query['filter'] == 'run') |
|
256 | + if ($query['filter'] == 'run') |
|
258 | 257 | { |
259 | 258 | $rows['sel_options']['filter2'] = array( |
260 | 259 | '' => lang('All applications'), |
261 | - )+Etemplate\Widget\Select::app_options('enabled'); |
|
260 | + ) + Etemplate\Widget\Select::app_options('enabled'); |
|
262 | 261 | } |
263 | 262 | else |
264 | 263 | { |
@@ -269,14 +268,14 @@ discard block |
||
269 | 268 | 'location' => 'acl_rights', |
270 | 269 | 'owner' => $query['account_id'], |
271 | 270 | ), array(), true); |
272 | - foreach(array_keys($apps) as $appname) |
|
271 | + foreach (array_keys($apps) as $appname) |
|
273 | 272 | { |
274 | 273 | $rows['sel_options']['filter2'][] = array( |
275 | 274 | 'value' => $appname, |
276 | 275 | 'label' => lang($appname) |
277 | 276 | ); |
278 | 277 | } |
279 | - usort($rows['sel_options']['filter2'], function($a,$b) { |
|
278 | + usort($rows['sel_options']['filter2'], function($a, $b) { |
|
280 | 279 | return strcasecmp($a['label'], $b['label']); |
281 | 280 | }); |
282 | 281 | } |
@@ -293,14 +292,14 @@ discard block |
||
293 | 292 | * @return boolean true if access is granted, false if notification_bo |
294 | 293 | * @throws Api\Exception\NoPermission |
295 | 294 | */ |
296 | - public static function check_access($account_id, $location=null, $throw=true) |
|
295 | + public static function check_access($account_id, $location = null, $throw = true) |
|
297 | 296 | { |
298 | - static $admin_access=null; |
|
299 | - static $own_access=null; |
|
297 | + static $admin_access = null; |
|
298 | + static $own_access = null; |
|
300 | 299 | if (is_null($admin_access)) |
301 | 300 | { |
302 | 301 | $admin_access = isset($GLOBALS['egw_info']['user']['apps']['admin']) && |
303 | - !$GLOBALS['egw']->acl->check('account_access', 64, 'admin'); // ! because this denies access! |
|
302 | + !$GLOBALS['egw']->acl->check('account_access', 64, 'admin'); // ! because this denies access! |
|
304 | 303 | $own_access = $admin_access || isset($GLOBALS['egw_info']['user']['apps']['preferences']); |
305 | 304 | } |
306 | 305 | if (!(int)$account_id || !((int)$account_id == (int)$GLOBALS['egw_info']['user']['account_id'] && $location !== 'run' ? |
@@ -322,9 +321,9 @@ discard block |
||
322 | 321 | public static function ajax_get_app_list($account_id) |
323 | 322 | { |
324 | 323 | $list = array(); |
325 | - if(self::check_access((int)$account_id,'run',false)) |
|
324 | + if (self::check_access((int)$account_id, 'run', false)) |
|
326 | 325 | { |
327 | - $list = array_keys($GLOBALS['egw']->acl->get_user_applications((int)$account_id,false,false)); |
|
326 | + $list = array_keys($GLOBALS['egw']->acl->get_user_applications((int)$account_id, false, false)); |
|
328 | 327 | } |
329 | 328 | Api\Json\Response::get()->data($list); |
330 | 329 | } |
@@ -338,14 +337,14 @@ discard block |
||
338 | 337 | * @param int $rights =null null to delete, or new rights |
339 | 338 | * @throws Api\Exception\NoPermission |
340 | 339 | */ |
341 | - public static function ajax_change_acl($ids, $rights=null) |
|
340 | + public static function ajax_change_acl($ids, $rights = null) |
|
342 | 341 | { |
343 | 342 | try { |
344 | - foreach((array)$ids as $id) |
|
343 | + foreach ((array)$ids as $id) |
|
345 | 344 | { |
346 | 345 | list($app, $account_id, $location) = explode(':', $id, 3); |
347 | 346 | |
348 | - self::check_access($account_id, $location); // throws exception, if no rights |
|
347 | + self::check_access($account_id, $location); // throws exception, if no rights |
|
349 | 348 | |
350 | 349 | $acl = $GLOBALS['egw']->acl; |
351 | 350 | |
@@ -389,9 +388,9 @@ discard block |
||
389 | 388 | * |
390 | 389 | * @param array $_content =null |
391 | 390 | */ |
392 | - public function index(array $_content=null) |
|
391 | + public function index(array $_content = null) |
|
393 | 392 | { |
394 | - unset($_content); // not used, required by function signature |
|
393 | + unset($_content); // not used, required by function signature |
|
395 | 394 | |
396 | 395 | $tpl = new Etemplate('admin.acl'); |
397 | 396 | |
@@ -401,9 +400,7 @@ discard block |
||
401 | 400 | $content['nm'] = array( |
402 | 401 | 'get_rows' => 'admin_acl::get_rows', |
403 | 402 | 'no_cat' => true, |
404 | - 'filter' => !empty($_GET['acl_filter']) ? $_GET['acl_filter'] : |
|
405 | - ($GLOBALS['egw_info']['flags']['currentapp'] != 'admin' ? 'other' : |
|
406 | - $GLOBALS['egw_info']['user']['preferences']['admin']['acl_filter']), |
|
403 | + 'filter' => !empty($_GET['acl_filter']) ? $_GET['acl_filter'] : ($GLOBALS['egw_info']['flags']['currentapp'] != 'admin' ? 'other' : $GLOBALS['egw_info']['user']['preferences']['admin']['acl_filter']), |
|
407 | 404 | 'filter2' => !empty($_GET['acl_app']) ? $_GET['acl_app'] : '', |
408 | 405 | 'lettersearch' => false, |
409 | 406 | 'order' => 'acl_appname', |
@@ -108,9 +108,12 @@ discard block |
||
108 | 108 | { |
109 | 109 | // nothing changed --> nothing to do |
110 | 110 | } |
111 | - elseif (!$rights) // all rights removed --> delete it |
|
111 | + elseif (!$rights) |
|
112 | + { |
|
113 | + // all rights removed --> delete it |
|
112 | 114 | { |
113 | 115 | $this->acl->delete_repository($content['acl_appname'], $content['acl_location'], $content['acl_account']); |
116 | + } |
|
114 | 117 | Framework::refresh_opener(lang('ACL deleted.'), 'admin', $id, 'delete'); |
115 | 118 | } |
116 | 119 | else |
@@ -195,7 +198,11 @@ discard block |
||
195 | 198 | { |
196 | 199 | $check = array_diff($memberships, $groups); |
197 | 200 | //error_log(__METHOD__."() app=$app, array_diff(memberships=".array2string($memberships).", groups=".array2string($groups).")=".array2string($check)); |
198 | - if (!$check) continue; // would give sql error otherwise! |
|
201 | + if (!$check) |
|
202 | + { |
|
203 | + continue; |
|
204 | + } |
|
205 | + // would give sql error otherwise! |
|
199 | 206 | } |
200 | 207 | $sql .= ' WHEN '.$GLOBALS['egw']->db->quote($app).' THEN '.$GLOBALS['egw']->db->expression(Acl::TABLE, array( |
201 | 208 | 'acl_account' => $check, |
@@ -206,7 +213,10 @@ discard block |
||
206 | 213 | $sql .= $GLOBALS['egw']->db->expression(Acl::TABLE, array( |
207 | 214 | 'acl_account' => $memberships, |
208 | 215 | )); |
209 | - if ($not_enum_group_acls) $sql .= ' END)'; |
|
216 | + if ($not_enum_group_acls) |
|
217 | + { |
|
218 | + $sql .= ' END)'; |
|
219 | + } |
|
210 | 220 | $query['col_filter'][] = $sql; |
211 | 221 | break; |
212 | 222 | |
@@ -236,7 +246,10 @@ discard block |
||
236 | 246 | } |
237 | 247 | else |
238 | 248 | { |
239 | - if ($app !== $row['acl_appname']) Api\Translation::add_app($row['app_name']); |
|
249 | + if ($app !== $row['acl_appname']) |
|
250 | + { |
|
251 | + Api\Translation::add_app($row['app_name']); |
|
252 | + } |
|
240 | 253 | foreach($query['acl_rights'][$row['acl_appname']] as $val => $label) |
241 | 254 | { |
242 | 255 | if ($row['acl_rights'] & $val) |
@@ -245,10 +258,13 @@ discard block |
||
245 | 258 | } |
246 | 259 | } |
247 | 260 | } |
248 | - if (!self::check_access($row['acl_account'], $row['acl_location'], false)) // false: do NOT throw an exception! |
|
261 | + if (!self::check_access($row['acl_account'], $row['acl_location'], false)) |
|
262 | + { |
|
263 | + // false: do NOT throw an exception! |
|
249 | 264 | { |
250 | 265 | $row['class'] = 'rowNoEdit'; |
251 | 266 | } |
267 | + } |
|
252 | 268 | //error_log(__METHOD__."() $n: ".array2string($row)); |
253 | 269 | } |
254 | 270 | //error_log(__METHOD__."(".array2string($query).") returning ".$total); |
@@ -276,7 +292,8 @@ discard block |
||
276 | 292 | 'label' => lang($appname) |
277 | 293 | ); |
278 | 294 | } |
279 | - usort($rows['sel_options']['filter2'], function($a,$b) { |
|
295 | + usort($rows['sel_options']['filter2'], function($a,$b) |
|
296 | + { |
|
280 | 297 | return strcasecmp($a['label'], $b['label']); |
281 | 298 | }); |
282 | 299 | } |
@@ -306,7 +323,10 @@ discard block |
||
306 | 323 | if (!(int)$account_id || !((int)$account_id == (int)$GLOBALS['egw_info']['user']['account_id'] && $location !== 'run' ? |
307 | 324 | $own_access : $admin_access)) |
308 | 325 | { |
309 | - if ($throw) throw new Api\Exception\NoPermission(lang('Permission denied!!!')); |
|
326 | + if ($throw) |
|
327 | + { |
|
328 | + throw new Api\Exception\NoPermission(lang('Permission denied!!!')); |
|
329 | + } |
|
310 | 330 | return false; |
311 | 331 | } |
312 | 332 | return true; |
@@ -349,10 +369,13 @@ discard block |
||
349 | 369 | |
350 | 370 | $acl = $GLOBALS['egw']->acl; |
351 | 371 | |
352 | - if (!(int)$rights) // this also handles taking away all rights as delete |
|
372 | + if (!(int)$rights) |
|
373 | + { |
|
374 | + // this also handles taking away all rights as delete |
|
353 | 375 | { |
354 | 376 | $acl->delete_repository($app, $location, $account_id); |
355 | 377 | } |
378 | + } |
|
356 | 379 | else |
357 | 380 | { |
358 | 381 | $acl->add_repository($app, $location, $account_id, $rights); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @param string|int|array $account account name or id (!$account to add a new account), or array with all parameters |
24 | 24 | * @param array $set =null array with all data to change |
25 | 25 | */ |
26 | - function __construct($account,$set=null) |
|
26 | + function __construct($account, $set = null) |
|
27 | 27 | { |
28 | 28 | if (!is_array($account)) |
29 | 29 | { |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | * @throws Api\Exception\NoPermission\Admin |
44 | 44 | * @throws Api\Exception\WrongUserinput(lang("Unknown account: %1 !!!",$this->account),15); |
45 | 45 | */ |
46 | - protected function exec($check_only=false) |
|
46 | + protected function exec($check_only = false) |
|
47 | 47 | { |
48 | 48 | // check creator is still admin and not explicitly forbidden to edit accounts/groups |
49 | - if ($this->creator) $this->_check_admin('group_access',$this->account ? 16 : 4); |
|
49 | + if ($this->creator) $this->_check_admin('group_access', $this->account ? 16 : 4); |
|
50 | 50 | |
51 | 51 | admin_cmd::_instanciate_accounts(); |
52 | 52 | |
@@ -54,32 +54,32 @@ discard block |
||
54 | 54 | |
55 | 55 | if ($this->account) // existing account |
56 | 56 | { |
57 | - $data['account_id'] = admin_cmd::parse_account($this->account,false); |
|
57 | + $data['account_id'] = admin_cmd::parse_account($this->account, false); |
|
58 | 58 | } |
59 | 59 | else |
60 | 60 | { |
61 | 61 | $data += array( |
62 | 62 | 'account_type' => 'g', |
63 | - 'account_status' => 'A', // not used, but so we do the same thing as the web-interface |
|
63 | + 'account_status' => 'A', // not used, but so we do the same thing as the web-interface |
|
64 | 64 | 'account_expires' => -1, |
65 | 65 | ); |
66 | 66 | } |
67 | 67 | if (!$data['account_lid'] && (!$this->account || !is_null($data['account_lid']))) |
68 | 68 | { |
69 | - throw new Api\Exception\WrongUserinput(lang('You must enter a group name.'),9); |
|
69 | + throw new Api\Exception\WrongUserinput(lang('You must enter a group name.'), 9); |
|
70 | 70 | } |
71 | - if (!is_null($data['account_lid']) && ($id = admin_cmd::$accounts->name2id($data['account_lid'],'account_lid','g')) && |
|
71 | + if (!is_null($data['account_lid']) && ($id = admin_cmd::$accounts->name2id($data['account_lid'], 'account_lid', 'g')) && |
|
72 | 72 | $id !== $data['account_id']) |
73 | 73 | { |
74 | - throw new Api\Exception\WrongUserinput(lang('That loginid has already been taken'),999); |
|
74 | + throw new Api\Exception\WrongUserinput(lang('That loginid has already been taken'), 999); |
|
75 | 75 | } |
76 | 76 | if (!$data['account_members'] && !$this->account) |
77 | 77 | { |
78 | - throw new Api\Exception\WrongUserinput(lang('You must select at least one group member.'),9); |
|
78 | + throw new Api\Exception\WrongUserinput(lang('You must select at least one group member.'), 9); |
|
79 | 79 | } |
80 | 80 | if ($data['account_members']) |
81 | 81 | { |
82 | - $data['account_members'] = admin_cmd::parse_accounts($data['account_members'],true); |
|
82 | + $data['account_members'] = admin_cmd::parse_accounts($data['account_members'], true); |
|
83 | 83 | } |
84 | 84 | if ($check_only) return true; |
85 | 85 | |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | Api\Accounts::cache_invalidate($data['account_id']); |
90 | 90 | if (!($old = admin_cmd::$accounts->read($data['account_id']))) |
91 | 91 | { |
92 | - throw new Api\Exception\WrongUserinput(lang("Unknown account: %1 !!!",$this->account),15); |
|
92 | + throw new Api\Exception\WrongUserinput(lang("Unknown account: %1 !!!", $this->account), 15); |
|
93 | 93 | } |
94 | 94 | // as the current account class always sets all values, we have to add the not specified ones |
95 | - foreach($data as $name => &$value) |
|
95 | + foreach ($data as $name => &$value) |
|
96 | 96 | { |
97 | 97 | if (is_null($value)) $value = $old[$name]; |
98 | 98 | } |
@@ -100,18 +100,18 @@ discard block |
||
100 | 100 | if (!($data['account_id'] = admin_cmd::$accounts->save($data))) |
101 | 101 | { |
102 | 102 | //_debug_array($data); |
103 | - throw new Api\Db\Exception(lang("Error saving account!"),11); |
|
103 | + throw new Api\Db\Exception(lang("Error saving account!"), 11); |
|
104 | 104 | } |
105 | - $data['account_name'] = $data['account_lid']; // also set deprecated name |
|
106 | - if ($update) $data['old_name'] = $old['account_lid']; // make old name available for hooks |
|
107 | - $GLOBALS['hook_values'] =& $data; |
|
108 | - Api\Hooks::process($GLOBALS['hook_values']+array( |
|
105 | + $data['account_name'] = $data['account_lid']; // also set deprecated name |
|
106 | + if ($update) $data['old_name'] = $old['account_lid']; // make old name available for hooks |
|
107 | + $GLOBALS['hook_values'] = & $data; |
|
108 | + Api\Hooks::process($GLOBALS['hook_values'] + array( |
|
109 | 109 | 'location' => $update ? 'editgroup' : 'addgroup' |
110 | - ),False,True); // called for every app now, not only enabled ones) |
|
110 | + ), False, True); // called for every app now, not only enabled ones) |
|
111 | 111 | |
112 | 112 | if ($data['account_members']) |
113 | 113 | { |
114 | - admin_cmd::$accounts->set_members($data['account_members'],$data['account_id']); |
|
114 | + admin_cmd::$accounts->set_members($data['account_members'], $data['account_id']); |
|
115 | 115 | } |
116 | 116 | // make new account_id available to caller |
117 | 117 | $this->account = $data['account_id']; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | function __tostring() |
129 | 129 | { |
130 | - return lang('%1 group %2',$this->account ? lang('Edit') : lang('Add'), |
|
130 | + return lang('%1 group %2', $this->account ? lang('Edit') : lang('Add'), |
|
131 | 131 | admin_cmd::display_account($this->account ? $this->account : $this->set['account_lid'])); |
132 | 132 | } |
133 | 133 | } |
@@ -46,16 +46,22 @@ discard block |
||
46 | 46 | protected function exec($check_only=false) |
47 | 47 | { |
48 | 48 | // check creator is still admin and not explicitly forbidden to edit accounts/groups |
49 | - if ($this->creator) $this->_check_admin('group_access',$this->account ? 16 : 4); |
|
49 | + if ($this->creator) |
|
50 | + { |
|
51 | + $this->_check_admin('group_access',$this->account ? 16 : 4); |
|
52 | + } |
|
50 | 53 | |
51 | 54 | admin_cmd::_instanciate_accounts(); |
52 | 55 | |
53 | 56 | $data = $this->set; |
54 | 57 | |
55 | - if ($this->account) // existing account |
|
58 | + if ($this->account) |
|
59 | + { |
|
60 | + // existing account |
|
56 | 61 | { |
57 | 62 | $data['account_id'] = admin_cmd::parse_account($this->account,false); |
58 | 63 | } |
64 | + } |
|
59 | 65 | else |
60 | 66 | { |
61 | 67 | $data += array( |
@@ -81,7 +87,10 @@ discard block |
||
81 | 87 | { |
82 | 88 | $data['account_members'] = admin_cmd::parse_accounts($data['account_members'],true); |
83 | 89 | } |
84 | - if ($check_only) return true; |
|
90 | + if ($check_only) |
|
91 | + { |
|
92 | + return true; |
|
93 | + } |
|
85 | 94 | |
86 | 95 | if (($update = $this->account)) |
87 | 96 | { |
@@ -94,7 +103,10 @@ discard block |
||
94 | 103 | // as the current account class always sets all values, we have to add the not specified ones |
95 | 104 | foreach($data as $name => &$value) |
96 | 105 | { |
97 | - if (is_null($value)) $value = $old[$name]; |
|
106 | + if (is_null($value)) |
|
107 | + { |
|
108 | + $value = $old[$name]; |
|
109 | + } |
|
98 | 110 | } |
99 | 111 | } |
100 | 112 | if (!($data['account_id'] = admin_cmd::$accounts->save($data))) |
@@ -103,7 +115,11 @@ discard block |
||
103 | 115 | throw new Api\Db\Exception(lang("Error saving account!"),11); |
104 | 116 | } |
105 | 117 | $data['account_name'] = $data['account_lid']; // also set deprecated name |
106 | - if ($update) $data['old_name'] = $old['account_lid']; // make old name available for hooks |
|
118 | + if ($update) |
|
119 | + { |
|
120 | + $data['old_name'] = $old['account_lid']; |
|
121 | + } |
|
122 | + // make old name available for hooks |
|
107 | 123 | $GLOBALS['hook_values'] =& $data; |
108 | 124 | Api\Hooks::process($GLOBALS['hook_values']+array( |
109 | 125 | 'location' => $update ? 'editgroup' : 'addgroup' |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @param string $new_user =null if specified, account to transfer the data to (users only) |
25 | 25 | * @param string $is_user =true type of the account: true=user, false=group |
26 | 26 | */ |
27 | - function __construct($account,$new_user=null,$is_user=true) |
|
27 | + function __construct($account, $new_user = null, $is_user = true) |
|
28 | 28 | { |
29 | 29 | if (!is_array($account)) |
30 | 30 | { |
@@ -46,18 +46,18 @@ discard block |
||
46 | 46 | * @throws Api\Exception\WrongUserinput(lang("Unknown account: %1 !!!",$this->account),15); |
47 | 47 | * @throws Api\Exception\WrongUserinput(lang('Error changing the password for %1 !!!',$this->account),99); |
48 | 48 | */ |
49 | - protected function exec($check_only=false) |
|
49 | + protected function exec($check_only = false) |
|
50 | 50 | { |
51 | - $account_id = admin_cmd::parse_account($this->account,$this->is_user); |
|
51 | + $account_id = admin_cmd::parse_account($this->account, $this->is_user); |
|
52 | 52 | admin_cmd::_instanciate_accounts(); |
53 | 53 | $account_lid = admin_cmd::$accounts->id2name($account_id); |
54 | 54 | |
55 | 55 | if ($this->is_user && $this->new_user) |
56 | 56 | { |
57 | - $new_user = admin_cmd::parse_account($this->new_user,true); // true = user, no group |
|
57 | + $new_user = admin_cmd::parse_account($this->new_user, true); // true = user, no group |
|
58 | 58 | } |
59 | 59 | // check creator is still admin and not explicitly forbidden to edit accounts |
60 | - if ($this->creator) $this->_check_admin($this->is_user ? 'account_access' : 'group_access',32); |
|
60 | + if ($this->creator) $this->_check_admin($this->is_user ? 'account_access' : 'group_access', 32); |
|
61 | 61 | |
62 | 62 | if ($check_only) return true; |
63 | 63 | |
@@ -65,22 +65,22 @@ discard block |
||
65 | 65 | $GLOBALS['hook_values'] = array( |
66 | 66 | 'account_id' => $account_id, |
67 | 67 | 'account_lid' => $account_lid, |
68 | - 'account_name'=> $account_lid, // depericated name for deletegroup hook |
|
69 | - 'new_owner' => (int)$new_user, // deleteaccount only |
|
68 | + 'account_name'=> $account_lid, // depericated name for deletegroup hook |
|
69 | + 'new_owner' => (int)$new_user, // deleteaccount only |
|
70 | 70 | 'location' => $this->is_user ? 'deleteaccount' : 'deletegroup', |
71 | 71 | ); |
72 | 72 | // first all other apps, then preferences and admin |
73 | - foreach(array_merge(array_diff(array_keys($GLOBALS['egw_info']['apps']),array('preferences','admin')),array('preferences','admin')) as $app) |
|
73 | + foreach (array_merge(array_diff(array_keys($GLOBALS['egw_info']['apps']), array('preferences', 'admin')), array('preferences', 'admin')) as $app) |
|
74 | 74 | { |
75 | - Api\Hooks::single($GLOBALS['hook_values'],$app); |
|
75 | + Api\Hooks::single($GLOBALS['hook_values'], $app); |
|
76 | 76 | } |
77 | 77 | $GLOBALS['egw']->accounts->delete($account_id); |
78 | 78 | |
79 | 79 | if ($account_id < 0) |
80 | 80 | { |
81 | - return lang("Group '%1' deleted.",$account_lid)."\n\n"; |
|
81 | + return lang("Group '%1' deleted.", $account_lid)."\n\n"; |
|
82 | 82 | } |
83 | - return lang("Account '%1' deleted.",$account_lid)."\n\n"; |
|
83 | + return lang("Account '%1' deleted.", $account_lid)."\n\n"; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -90,6 +90,6 @@ discard block |
||
90 | 90 | */ |
91 | 91 | function __tostring() |
92 | 92 | { |
93 | - return lang('Delete account %1',admin_cmd::display_account($this->account)); |
|
93 | + return lang('Delete account %1', admin_cmd::display_account($this->account)); |
|
94 | 94 | } |
95 | 95 | } |
@@ -57,9 +57,15 @@ |
||
57 | 57 | $new_user = admin_cmd::parse_account($this->new_user,true); // true = user, no group |
58 | 58 | } |
59 | 59 | // check creator is still admin and not explicitly forbidden to edit accounts |
60 | - if ($this->creator) $this->_check_admin($this->is_user ? 'account_access' : 'group_access',32); |
|
60 | + if ($this->creator) |
|
61 | + { |
|
62 | + $this->_check_admin($this->is_user ? 'account_access' : 'group_access',32); |
|
63 | + } |
|
61 | 64 | |
62 | - if ($check_only) return true; |
|
65 | + if ($check_only) |
|
66 | + { |
|
67 | + return true; |
|
68 | + } |
|
63 | 69 | |
64 | 70 | // delete the account |
65 | 71 | $GLOBALS['hook_values'] = array( |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | /* |
16 | 16 | Set global flag to indicate for which config settings we have equally named validation methods |
17 | 17 | */ |
18 | -$GLOBALS['egw_info']['server']['found_validation_hook'] = array('vfs_image_dir','fw_mobile_app_list'); |
|
18 | +$GLOBALS['egw_info']['server']['found_validation_hook'] = array('vfs_image_dir', 'fw_mobile_app_list'); |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Check VFS dir exists and delete image map to recreate it, if vfs-image-dir changes |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | if (!Vfs::file_exists($vfs_image_dir) || !Vfs::is_dir($vfs_image_dir)) |
31 | 31 | { |
32 | - $GLOBALS['config_error'] = lang('VFS directory "%1" NOT found!',$vfs_image_dir); |
|
32 | + $GLOBALS['config_error'] = lang('VFS directory "%1" NOT found!', $vfs_image_dir); |
|
33 | 33 | return; |
34 | 34 | } |
35 | 35 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | if (($f = $this->db_backup->fopen_backup())) |
29 | 29 | { |
30 | 30 | $this->db_backup->backup($f); |
31 | - if(is_resource($f)) |
|
31 | + if (is_resource($f)) |
|
32 | 32 | fclose($f); |
33 | 33 | /* Remove old backups. */ |
34 | 34 | $this->db_backup->housekeeping(); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | function index() |
42 | 42 | { |
43 | 43 | $tpl_root = EGW_SERVER_ROOT.'/setup/templates/default'; |
44 | - $self = $GLOBALS['egw']->link('/index.php',array('menuaction'=>'admin.admin_db_backup.index')); |
|
44 | + $self = $GLOBALS['egw']->link('/index.php', array('menuaction'=>'admin.admin_db_backup.index')); |
|
45 | 45 | Api\Translation::add_app('setup'); |
46 | 46 | Api\Header\ContentSecurityPolicy::add('script-src', 'unsafe-inline'); |
47 | 47 |
@@ -29,7 +29,9 @@ |
||
29 | 29 | { |
30 | 30 | $this->db_backup->backup($f); |
31 | 31 | if(is_resource($f)) |
32 | - fclose($f); |
|
32 | + { |
|
33 | + fclose($f); |
|
34 | + } |
|
33 | 35 | /* Remove old backups. */ |
34 | 36 | $this->db_backup->housekeeping(); |
35 | 37 | } |