@@ -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( |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | function __construct() |
29 | 29 | { |
30 | 30 | $this->account_id = (int)$_GET['account_id']; |
31 | - if (!$this->account_id || $GLOBALS['egw']->acl->check('account_access',64,'admin')) |
|
31 | + if (!$this->account_id || $GLOBALS['egw']->acl->check('account_access', 64, 'admin')) |
|
32 | 32 | { |
33 | 33 | $GLOBALS['egw']->redirect_link('/index.php'); |
34 | 34 | } |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | |
38 | 38 | function common_header() |
39 | 39 | { |
40 | - $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin') . ' - ' . lang('ACL Manager') . |
|
41 | - ': ' . Api\Accounts::username($this->account_id); |
|
40 | + $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('ACL Manager'). |
|
41 | + ': '.Api\Accounts::username($this->account_id); |
|
42 | 42 | echo $GLOBALS['egw']->framework->header(); |
43 | 43 | } |
44 | 44 | |
@@ -46,39 +46,39 @@ discard block |
||
46 | 46 | { |
47 | 47 | $this->common_header(); |
48 | 48 | |
49 | - Api\Hooks::process('acl_manager',array('preferences')); |
|
49 | + Api\Hooks::process('acl_manager', array('preferences')); |
|
50 | 50 | |
51 | 51 | $this->template->set_file(array( |
52 | 52 | 'app_list' => 'acl_applist.tpl' |
53 | 53 | )); |
54 | - $this->template->set_block('app_list','list'); |
|
55 | - $this->template->set_block('app_list','app_row'); |
|
56 | - $this->template->set_block('app_list','app_row_noicon'); |
|
57 | - $this->template->set_block('app_list','link_row'); |
|
58 | - $this->template->set_block('app_list','spacer_row'); |
|
54 | + $this->template->set_block('app_list', 'list'); |
|
55 | + $this->template->set_block('app_list', 'app_row'); |
|
56 | + $this->template->set_block('app_list', 'app_row_noicon'); |
|
57 | + $this->template->set_block('app_list', 'link_row'); |
|
58 | + $this->template->set_block('app_list', 'spacer_row'); |
|
59 | 59 | |
60 | 60 | if (is_array($GLOBALS['acl_manager'])) |
61 | 61 | { |
62 | - foreach($GLOBALS['acl_manager'] as $app => $locations) |
|
62 | + foreach ($GLOBALS['acl_manager'] as $app => $locations) |
|
63 | 63 | { |
64 | - $icon = Api\Image::find($app,array('navbar.png',$app.'png','navbar.gif',$app.'.gif')); |
|
65 | - $this->template->set_var('icon_backcolor',$GLOBALS['egw_info']['theme']['row_off']); |
|
66 | - $this->template->set_var('link_backcolor',$GLOBALS['egw_info']['theme']['row_off']); |
|
67 | - $this->template->set_var('app_name',$GLOBALS['egw_info']['apps'][$app]['title']); |
|
68 | - $this->template->set_var('app_icon',$icon); |
|
64 | + $icon = Api\Image::find($app, array('navbar.png', $app.'png', 'navbar.gif', $app.'.gif')); |
|
65 | + $this->template->set_var('icon_backcolor', $GLOBALS['egw_info']['theme']['row_off']); |
|
66 | + $this->template->set_var('link_backcolor', $GLOBALS['egw_info']['theme']['row_off']); |
|
67 | + $this->template->set_var('app_name', $GLOBALS['egw_info']['apps'][$app]['title']); |
|
68 | + $this->template->set_var('app_icon', $icon); |
|
69 | 69 | |
70 | 70 | if ($icon) |
71 | 71 | { |
72 | - $this->template->fp('rows','app_row',True); |
|
72 | + $this->template->fp('rows', 'app_row', True); |
|
73 | 73 | } |
74 | 74 | else |
75 | 75 | { |
76 | - $this->template->fp('rows','app_row_noicon',True); |
|
76 | + $this->template->fp('rows', 'app_row_noicon', True); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | if (is_array($locations)) |
80 | 80 | { |
81 | - foreach($locations as $loc => $value) |
|
81 | + foreach ($locations as $loc => $value) |
|
82 | 82 | { |
83 | 83 | $link_values = array( |
84 | 84 | 'menuaction' => 'admin.admin_denyaccess.access_form', |
@@ -87,20 +87,20 @@ discard block |
||
87 | 87 | 'account_id' => $this->account_id |
88 | 88 | ); |
89 | 89 | |
90 | - $this->template->set_var('link_location',$GLOBALS['egw']->link('/index.php',$link_values)); |
|
91 | - $this->template->set_var('lang_location',lang($value['name'])); |
|
92 | - $this->template->fp('rows','link_row',True); |
|
90 | + $this->template->set_var('link_location', $GLOBALS['egw']->link('/index.php', $link_values)); |
|
91 | + $this->template->set_var('lang_location', lang($value['name'])); |
|
92 | + $this->template->fp('rows', 'link_row', True); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | - $this->template->parse('rows','spacer_row',True); |
|
96 | + $this->template->parse('rows', 'spacer_row', True); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | $this->template->set_var(array( |
100 | 100 | 'cancel_action' => $GLOBALS['egw']->link('/admin/index.php'), |
101 | 101 | 'lang_cancel' => lang('Cancel') |
102 | 102 | )); |
103 | - $this->template->pfp('out','list'); |
|
103 | + $this->template->pfp('out', 'list'); |
|
104 | 104 | echo $GLOBALS['egw']->framework->footer(); |
105 | 105 | } |
106 | 106 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $total_rights = 0; |
116 | 116 | if (is_array($_POST['acl_rights'])) |
117 | 117 | { |
118 | - foreach($_POST['acl_rights'] as $rights) |
|
118 | + foreach ($_POST['acl_rights'] as $rights) |
|
119 | 119 | { |
120 | 120 | $total_rights += $rights; |
121 | 121 | } |
@@ -132,15 +132,15 @@ discard block |
||
132 | 132 | $this->list_apps(); |
133 | 133 | return; |
134 | 134 | } |
135 | - Api\Hooks::single('acl_manager',$_GET['acl_app']); |
|
135 | + Api\Hooks::single('acl_manager', $_GET['acl_app']); |
|
136 | 136 | $acl_manager = $GLOBALS['acl_manager'][$_GET['acl_app']][$location]; |
137 | 137 | |
138 | 138 | $this->common_header(); |
139 | - $this->template->set_file('form','acl_manager_form.tpl'); |
|
139 | + $this->template->set_file('form', 'acl_manager_form.tpl'); |
|
140 | 140 | |
141 | 141 | $afn = Api\Accounts::username($this->account_id); |
142 | 142 | |
143 | - $this->template->set_var('lang_message',lang('Check items to <b>%1</b> to %2 for %3',lang($acl_manager['name']),$GLOBALS['egw_info']['apps'][$_GET['acl_app']]['title'],$afn)); |
|
143 | + $this->template->set_var('lang_message', lang('Check items to <b>%1</b> to %2 for %3', lang($acl_manager['name']), $GLOBALS['egw_info']['apps'][$_GET['acl_app']]['title'], $afn)); |
|
144 | 144 | $link_values = array( |
145 | 145 | 'menuaction' => 'admin.admin_denyaccess.access_form', |
146 | 146 | 'acl_app' => $_GET['acl_app'], |
@@ -150,19 +150,19 @@ discard block |
||
150 | 150 | |
151 | 151 | $acl = new Api\Acl($this->account_id); |
152 | 152 | $acl->read_repository(); |
153 | - $grants = $acl->get_rights($location,$_GET['acl_app']); |
|
153 | + $grants = $acl->get_rights($location, $_GET['acl_app']); |
|
154 | 154 | |
155 | - $this->template->set_var('form_action',$GLOBALS['egw']->link('/index.php',$link_values)); |
|
155 | + $this->template->set_var('form_action', $GLOBALS['egw']->link('/index.php', $link_values)); |
|
156 | 156 | |
157 | - foreach($acl_manager['rights'] as $name => $value) |
|
157 | + foreach ($acl_manager['rights'] as $name => $value) |
|
158 | 158 | { |
159 | - $cb .= '<input type="checkbox" name="acl_rights[]" value="'.$value.'"'.($grants & $value ? ' checked' : '').'> '.lang($name)."<br>\n"; |
|
159 | + $cb .= '<input type="checkbox" name="acl_rights[]" value="'.$value.'"'.($grants&$value ? ' checked' : '').'> '.lang($name)."<br>\n"; |
|
160 | 160 | } |
161 | - $this->template->set_var('select_values',$cb); |
|
162 | - $this->template->set_var('lang_submit',lang('Save')); |
|
163 | - $this->template->set_var('lang_cancel',lang('Cancel')); |
|
161 | + $this->template->set_var('select_values', $cb); |
|
162 | + $this->template->set_var('lang_submit', lang('Save')); |
|
163 | + $this->template->set_var('lang_cancel', lang('Cancel')); |
|
164 | 164 | |
165 | - $this->template->pfp('out','form'); |
|
165 | + $this->template->pfp('out', 'form'); |
|
166 | 166 | echo $GLOBALS['egw']->framework->footer(); |
167 | 167 | } |
168 | 168 | } |
@@ -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 | } |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @param string $_identifier |
37 | 37 | */ |
38 | - public function __construct( $_identifier='' ) { |
|
39 | - if(is_array($_identifier)) { |
|
38 | + public function __construct($_identifier = '') { |
|
39 | + if (is_array($_identifier)) { |
|
40 | 40 | $this->identifier = $_identifier['account_id']; |
41 | 41 | } else { |
42 | 42 | $this->identifier = $_identifier; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @todo add some checks |
91 | 91 | * @return void |
92 | 92 | */ |
93 | - public function set_record(array $_record){ |
|
93 | + public function set_record(array $_record) { |
|
94 | 94 | $this->user = $_record; |
95 | 95 | $this->account_groups = $GLOBALS['egw']->accounts->memberships($this->identifier, true); |
96 | 96 | } |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @return string identifier |
121 | 121 | */ |
122 | - public function save ( $_dst_identifier ) { |
|
123 | - unset($_dst_identifier); // not used, but require by function signature |
|
122 | + public function save($_dst_identifier) { |
|
123 | + unset($_dst_identifier); // not used, but require by function signature |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | * @param string $_dst_identifier |
130 | 130 | * @return string dst_identifier |
131 | 131 | */ |
132 | - public function copy ( $_dst_identifier ) { |
|
133 | - unset($_dst_identifier); // not used, but require by function signature |
|
132 | + public function copy($_dst_identifier) { |
|
133 | + unset($_dst_identifier); // not used, but require by function signature |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -140,15 +140,15 @@ discard block |
||
140 | 140 | * @param string $_dst_identifier |
141 | 141 | * @return string dst_identifier |
142 | 142 | */ |
143 | - public function move ( $_dst_identifier ) { |
|
144 | - unset($_dst_identifier); // not used, but require by function signature |
|
143 | + public function move($_dst_identifier) { |
|
144 | + unset($_dst_identifier); // not used, but require by function signature |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
148 | 148 | * delets current record from backend |
149 | 149 | * |
150 | 150 | */ |
151 | - public function delete () { |
|
151 | + public function delete() { |
|
152 | 152 | |
153 | 153 | } |
154 | 154 |
@@ -34,10 +34,14 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @param string $_identifier |
36 | 36 | */ |
37 | - public function __construct( $_identifier='' ) { |
|
38 | - if(is_array($_identifier)) { |
|
37 | + public function __construct( $_identifier='' ) |
|
38 | + { |
|
39 | + if(is_array($_identifier)) |
|
40 | + { |
|
39 | 41 | $this->identifier = $_identifier['account_id']; |
40 | - } else { |
|
42 | + } |
|
43 | + else |
|
44 | + { |
|
41 | 45 | $this->identifier = $_identifier; |
42 | 46 | } |
43 | 47 | $this->set_record($GLOBALS['egw']->accounts->read($this->identifier)); |
@@ -48,7 +52,8 @@ discard block |
||
48 | 52 | * |
49 | 53 | * @param string $_attribute_name |
50 | 54 | */ |
51 | - public function __get($_attribute_name) { |
|
55 | + public function __get($_attribute_name) |
|
56 | + { |
|
52 | 57 | return $this->group[$_attribute_name]; |
53 | 58 | } |
54 | 59 | |
@@ -58,7 +63,8 @@ discard block |
||
58 | 63 | * @param string $_attribute_name |
59 | 64 | * @param data $data |
60 | 65 | */ |
61 | - public function __set($_attribute_name, $data) { |
|
66 | + public function __set($_attribute_name, $data) |
|
67 | + { |
|
62 | 68 | $this->group[$_attribute_name] = $data; |
63 | 69 | } |
64 | 70 | |
@@ -70,7 +76,8 @@ discard block |
||
70 | 76 | * |
71 | 77 | * @return array complete record as associative array |
72 | 78 | */ |
73 | - public function get_record_array() { |
|
79 | + public function get_record_array() |
|
80 | + { |
|
74 | 81 | return $this->group; |
75 | 82 | } |
76 | 83 | |
@@ -79,7 +86,8 @@ discard block |
||
79 | 86 | * |
80 | 87 | *@return string title |
81 | 88 | */ |
82 | - public function get_title() { |
|
89 | + public function get_title() |
|
90 | + { |
|
83 | 91 | return Api\Accounts::username($this->identifier); |
84 | 92 | } |
85 | 93 | |
@@ -89,7 +97,8 @@ discard block |
||
89 | 97 | * @todo add some checks |
90 | 98 | * @return void |
91 | 99 | */ |
92 | - public function set_record(array $_record){ |
|
100 | + public function set_record(array $_record) |
|
101 | + { |
|
93 | 102 | $this->group = $_record; |
94 | 103 | $this->group['account_members'] = $GLOBALS['egw']->accounts->members($this->group['account_id'],true); |
95 | 104 | } |
@@ -99,7 +108,8 @@ discard block |
||
99 | 108 | * |
100 | 109 | * @return string identifier of current record |
101 | 110 | */ |
102 | - public function get_identifier() { |
|
111 | + public function get_identifier() |
|
112 | + { |
|
103 | 113 | return $this->identifier; |
104 | 114 | } |
105 | 115 | |
@@ -109,7 +119,8 @@ discard block |
||
109 | 119 | * |
110 | 120 | * @return string Full URL of an icon, or appname/icon_name |
111 | 121 | */ |
112 | - public function get_icon() { |
|
122 | + public function get_icon() |
|
123 | + { |
|
113 | 124 | return 'group'; |
114 | 125 | } |
115 | 126 | |
@@ -118,7 +129,8 @@ discard block |
||
118 | 129 | * |
119 | 130 | * @return string identifier |
120 | 131 | */ |
121 | - public function save ( $_dst_identifier ) { |
|
132 | + public function save ( $_dst_identifier ) |
|
133 | + { |
|
122 | 134 | unset($_dst_identifier); // not used, but require by function signature |
123 | 135 | } |
124 | 136 | |
@@ -128,7 +140,8 @@ discard block |
||
128 | 140 | * @param string $_dst_identifier |
129 | 141 | * @return string dst_identifier |
130 | 142 | */ |
131 | - public function copy ( $_dst_identifier ) { |
|
143 | + public function copy ( $_dst_identifier ) |
|
144 | + { |
|
132 | 145 | unset($_dst_identifier); // not used, but require by function signature |
133 | 146 | } |
134 | 147 | |
@@ -139,7 +152,8 @@ discard block |
||
139 | 152 | * @param string $_dst_identifier |
140 | 153 | * @return string dst_identifier |
141 | 154 | */ |
142 | - public function move ( $_dst_identifier ) { |
|
155 | + public function move ( $_dst_identifier ) |
|
156 | + { |
|
143 | 157 | unset($_dst_identifier); // not used, but require by function signature |
144 | 158 | } |
145 | 159 | |
@@ -147,7 +161,8 @@ discard block |
||
147 | 161 | * delets current record from backend |
148 | 162 | * |
149 | 163 | */ |
150 | - public function delete () { |
|
164 | + public function delete () |
|
165 | + { |
|
151 | 166 | |
152 | 167 | } |
153 | 168 | |
@@ -155,7 +170,8 @@ discard block |
||
155 | 170 | * destructor |
156 | 171 | * |
157 | 172 | */ |
158 | - public function __destruct() { |
|
173 | + public function __destruct() |
|
174 | + { |
|
159 | 175 | unset ($this->group); |
160 | 176 | } |
161 | 177 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | function index() |
25 | 25 | { |
26 | - if ($GLOBALS['egw']->acl->check('asyncservice_acc',1,'admin')) |
|
26 | + if ($GLOBALS['egw']->acl->check('asyncservice_acc', 1, 'admin')) |
|
27 | 27 | { |
28 | 28 | Egw::redirect_link('/index.php'); |
29 | 29 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | echo $GLOBALS['egw']->framework->header(); |
33 | 33 | |
34 | - $async = $GLOBALS['egw']->asyncservice; // use an own instance, as we might set debug=True |
|
34 | + $async = $GLOBALS['egw']->asyncservice; // use an own instance, as we might set debug=True |
|
35 | 35 | |
36 | 36 | $async->debug = !!$_POST['debug']; |
37 | 37 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if ($_POST['send'] || $_POST['test'] || $_POST['cancel'] || $_POST['install'] || $_POST['deinstall'] || $_POST['update'] || isset($_POST['asyncservice'])) |
48 | 48 | { |
49 | 49 | $times = array(); |
50 | - foreach($units as $u => $ulabel) |
|
50 | + foreach ($units as $u => $ulabel) |
|
51 | 51 | { |
52 | 52 | if ($_POST[$u] !== '') |
53 | 53 | { |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | |
58 | 58 | if ($_POST['test']) |
59 | 59 | { |
60 | - if (strpos($GLOBALS['egw_info']['user']['account_email'],'@') === false) |
|
60 | + if (strpos($GLOBALS['egw_info']['user']['account_email'], '@') === false) |
|
61 | 61 | { |
62 | 62 | echo '<p><b>'.lang("You have no email address for your user set !!!")."</b></p>\n"; |
63 | 63 | } |
64 | - elseif (!$async->set_timer($times,'test','admin.admin_asyncservice.test',$GLOBALS['egw_info']['user']['account_email'])) |
|
64 | + elseif (!$async->set_timer($times, 'test', 'admin.admin_asyncservice.test', $GLOBALS['egw_info']['user']['account_email'])) |
|
65 | 65 | { |
66 | 66 | echo '<p><b>'.lang("Error setting timer, wrong syntax or maybe there's one already running !!!")."</b></p>\n"; |
67 | 67 | } |
@@ -77,25 +77,25 @@ discard block |
||
77 | 77 | { |
78 | 78 | if (!($install = $async->install($_POST['install'] ? $times : False))) |
79 | 79 | { |
80 | - echo '<p><b>'.lang('Error: %1 not found or other error !!!',$async->crontab)."</b></p>\n"; |
|
80 | + echo '<p><b>'.lang('Error: %1 not found or other error !!!', $async->crontab)."</b></p>\n"; |
|
81 | 81 | } |
82 | 82 | $_POST['asyncservice'] = $_POST['deinstall'] ? 'fallback' : 'crontab'; |
83 | 83 | } |
84 | 84 | } |
85 | 85 | else |
86 | 86 | { |
87 | - $times = array('min' => '*/5'); // set some default |
|
87 | + $times = array('min' => '*/5'); // set some default |
|
88 | 88 | } |
89 | - echo '<form action="'.$GLOBALS['egw']->link('/index.php',array('menuaction'=>'admin.admin_asyncservice.index')).'" method="POST">'."\n<p>"; |
|
89 | + echo '<form action="'.$GLOBALS['egw']->link('/index.php', array('menuaction'=>'admin.admin_asyncservice.index')).'" method="POST">'."\n<p>"; |
|
90 | 90 | echo '<div style="text-align: left; margin: 10px;">'."\n"; |
91 | 91 | |
92 | 92 | $last_run = $async->last_check_run(); |
93 | - $lr_date = $last_run['end'] ? Api\DateTime::server2user($last_run['end'],'') : lang('never'); |
|
93 | + $lr_date = $last_run['end'] ? Api\DateTime::server2user($last_run['end'], '') : lang('never'); |
|
94 | 94 | echo '<p><b>'.lang('Async services last executed').'</b>: '.$lr_date.' ('.$last_run['run_by'].")</p>\n<hr>\n"; |
95 | 95 | |
96 | 96 | if (isset($_POST['asyncservice']) && $_POST['asyncservice'] != $GLOBALS['egw_info']['server']['asyncservice']) |
97 | 97 | { |
98 | - Api\Config::save_value('asyncservice', $GLOBALS['egw_info']['server']['asyncservice']=$_POST['asyncservice'], 'phpgwapi'); |
|
98 | + Api\Config::save_value('asyncservice', $GLOBALS['egw_info']['server']['asyncservice'] = $_POST['asyncservice'], 'phpgwapi'); |
|
99 | 99 | } |
100 | 100 | if (!$async->only_fallback) |
101 | 101 | { |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | if ($async->only_fallback) |
126 | 126 | { |
127 | - echo '<p>'.lang('Under windows you need to install the asyncservice %1manually%2 or use the fallback mode. Fallback means the jobs get only checked after each page-view !!!','<a href="http://www.egroupware.org/wiki/TimedAsyncServicesWindows" target="_blank">','</a>')."</p>\n"; |
|
127 | + echo '<p>'.lang('Under windows you need to install the asyncservice %1manually%2 or use the fallback mode. Fallback means the jobs get only checked after each page-view !!!', '<a href="http://www.egroupware.org/wiki/TimedAsyncServicesWindows" target="_blank">', '</a>')."</p>\n"; |
|
128 | 128 | } |
129 | 129 | else |
130 | 130 | { |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | } |
137 | 137 | elseif ($installed === 0) |
138 | 138 | { |
139 | - echo '<b>'.lang('%1 not found or not executable !!!',$async->crontab)."</b></p>\n"; |
|
139 | + echo '<b>'.lang('%1 not found or not executable !!!', $async->crontab)."</b></p>\n"; |
|
140 | 140 | } |
141 | 141 | else |
142 | 142 | { |
143 | - echo '<b>'.lang('asyncservices not yet installed or other error (%1) !!!',$installed['error'])."</b></p>\n"; |
|
143 | + echo '<b>'.lang('asyncservices not yet installed or other error (%1) !!!', $installed['error'])."</b></p>\n"; |
|
144 | 144 | } |
145 | 145 | echo '<p><input type="submit" name="install" value="'.lang('Install crontab')."\">\n". |
146 | 146 | lang("for the times below (empty values count as '*', all empty = every minute)")."</p>\n"; |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | |
159 | 159 | if ($_POST['send']) |
160 | 160 | { |
161 | - $next = $async->next_run($times,True); |
|
161 | + $next = $async->next_run($times, True); |
|
162 | 162 | |
163 | - echo "<p>asyncservice::next_run(";print_r($times);echo")=".($next === False ? 'False':"'$next'=".Api\DateTime::server2user($next,''))."</p>\n"; |
|
163 | + echo "<p>asyncservice::next_run("; print_r($times); echo")=".($next === False ? 'False' : "'$next'=".Api\DateTime::server2user($next, ''))."</p>\n"; |
|
164 | 164 | } |
165 | 165 | echo '<hr><p><input type="submit" name="cancel" value="'.lang('Cancel TestJob!')."\"> \n"; |
166 | 166 | echo '<input type="submit" name="test" value="'.lang('Start TestJob!')."\">\n"; |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | if (($jobs = $async->read('%'))) |
172 | 172 | { |
173 | 173 | echo "<table border=1>\n<tr>\n<th>Id</th><th style='width:18ex;'>".lang('Next run').'</th><th>'.lang('Times').'</th><th>'.lang('Method').'</th><th>'.lang('Data')."</th><th>".lang('LoginID')."</th></tr>\n"; |
174 | - foreach($jobs as $job) |
|
174 | + foreach ($jobs as $job) |
|
175 | 175 | { |
176 | - echo "<tr>\n<td>$job[id]</td><td>".Api\DateTime::server2user($job['next'],'')."</td><td>"; |
|
176 | + echo "<tr>\n<td>$job[id]</td><td>".Api\DateTime::server2user($job['next'], '')."</td><td>"; |
|
177 | 177 | print_r($job['times']); |
178 | 178 | echo "</td><td>$job[method]</td><td>"; |
179 | 179 | print_r($job['data']); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | function test($to) |
194 | 194 | { |
195 | - $returncode = $GLOBALS['egw']->send->msg('email',$to,$subject='Asynchronous timed services','Greetings from cron ;-)'); |
|
195 | + $returncode = $GLOBALS['egw']->send->msg('email', $to, $subject = 'Asynchronous timed services', 'Greetings from cron ;-)'); |
|
196 | 196 | |
197 | 197 | if (!$returncode) // not nice, but better than failing silently |
198 | 198 | { |
@@ -194,9 +194,12 @@ |
||
194 | 194 | { |
195 | 195 | $returncode = $GLOBALS['egw']->send->msg('email',$to,$subject='Asynchronous timed services','Greetings from cron ;-)'); |
196 | 196 | |
197 | - if (!$returncode) // not nice, but better than failing silently |
|
197 | + if (!$returncode) |
|
198 | + { |
|
199 | + // not nice, but better than failing silently |
|
198 | 200 | { |
199 | 201 | echo "<p>bocalendar::send_update: sending message to '$to' subject='$subject' failed !!!<br>\n"; |
202 | + } |
|
200 | 203 | echo $GLOBALS['egw']->send->err['desc']."</p>\n"; |
201 | 204 | } |
202 | 205 | //print_r($GLOBALS['egw_info']['user']); |
@@ -18,20 +18,20 @@ |
||
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 | - 'account_lid' => lang('LoginID'), |
|
24 | - 'account_firstname' => lang('First Name'), |
|
25 | - 'account_lastname' => lang('Last Name'), |
|
26 | - 'account_email' => lang('email'), |
|
27 | - 'account_pwd' => lang('Password'), |
|
28 | - 'account_status' => lang('Status'), |
|
29 | - 'account_primary_group' => lang('Primary Group'), |
|
30 | - 'account_groups' => lang('Groups'), |
|
31 | - 'account_expires' => lang('Expires'), |
|
32 | - 'account_lastlogin' => lang('Last login'), |
|
33 | - 'account_lastpwd_change'=> lang('Last password change'), |
|
34 | - ); |
|
23 | + 'account_lid' => lang('LoginID'), |
|
24 | + 'account_firstname' => lang('First Name'), |
|
25 | + 'account_lastname' => lang('Last Name'), |
|
26 | + 'account_email' => lang('email'), |
|
27 | + 'account_pwd' => lang('Password'), |
|
28 | + 'account_status' => lang('Status'), |
|
29 | + 'account_primary_group' => lang('Primary Group'), |
|
30 | + 'account_groups' => lang('Groups'), |
|
31 | + 'account_expires' => lang('Expires'), |
|
32 | + 'account_lastlogin' => lang('Last login'), |
|
33 | + 'account_lastpwd_change'=> lang('Last password change'), |
|
34 | + ); |
|
35 | 35 | |
36 | 36 | // Custom fields - not really used in admin... |
37 | 37 | unset($this->export_fields['customfields']); |
@@ -47,7 +47,7 @@ |
||
47 | 47 | ); |
48 | 48 | |
49 | 49 | $custom = Api\Storage\Customfields::get('resources', true); |
50 | - foreach($custom as $name => $data) { |
|
50 | + foreach ($custom as $name => $data) { |
|
51 | 51 | $this->mapping_fields['#'.$name] = $data['label']; |
52 | 52 | } |
53 | 53 |
@@ -14,7 +14,8 @@ discard block |
||
14 | 14 | |
15 | 15 | class infolog_wizard_export_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 |
28 | 29 | unset($this->export_fields['custom']); // Heading, not a real field |
29 | 30 | $custom = Api\Storage\Customfields::get('infolog', 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 | } |