@@ -239,11 +239,11 @@ |
||
239 | 239 | unset($postdata[$name]); |
240 | 240 | } |
241 | 241 | $opts = array('http' => |
242 | - array( |
|
243 | - 'method' => 'POST', |
|
244 | - 'header' => 'Content-type: application/x-www-form-urlencoded', |
|
245 | - 'content' => http_build_query($postdata), |
|
246 | - ) |
|
242 | + array( |
|
243 | + 'method' => 'POST', |
|
244 | + 'header' => 'Content-type: application/x-www-form-urlencoded', |
|
245 | + 'content' => http_build_query($postdata), |
|
246 | + ) |
|
247 | 247 | ); |
248 | 248 | $url = $remote['remote_url'].'/admin/remote.php?domain='.urlencode($remote['remote_domain']).'&secret='.urlencode($secret); |
249 | 249 | //echo "sending command to $url\n"; _debug_array($opts); |
@@ -183,7 +183,10 @@ discard block |
||
183 | 183 | { |
184 | 184 | $ret = $this->remote_exec($dry_run); |
185 | 185 | } |
186 | - if (is_null($this->status)) $this->status = admin_cmd::successful; |
|
186 | + if (is_null($this->status)) |
|
187 | + { |
|
188 | + $this->status = admin_cmd::successful; |
|
189 | + } |
|
187 | 190 | } |
188 | 191 | catch (Exception $e) { |
189 | 192 | $this->error = $e->getMessage(); |
@@ -277,7 +280,10 @@ discard block |
||
277 | 280 | */ |
278 | 281 | function delete() |
279 | 282 | { |
280 | - if ($this->status != admin_cmd::scheduled) return false; |
|
283 | + if ($this->status != admin_cmd::scheduled) |
|
284 | + { |
|
285 | + return false; |
|
286 | + } |
|
281 | 287 | |
282 | 288 | $this->status = admin_cmd::deleted; |
283 | 289 | |
@@ -303,7 +309,10 @@ discard block |
||
303 | 309 | { |
304 | 310 | $this->modified = time(); |
305 | 311 | $this->modifier = $set_modifier ? $GLOBALS['egw_info']['user']['account_id'] : 0; |
306 | - if ($set_modifier) $this->modifier_email = admin_cmd::user_email(); |
|
312 | + if ($set_modifier) |
|
313 | + { |
|
314 | + $this->modifier_email = admin_cmd::user_email(); |
|
315 | + } |
|
307 | 316 | } |
308 | 317 | if (version_compare(PHP_VERSION,'5.1.2','>')) |
309 | 318 | { |
@@ -411,10 +420,13 @@ discard block |
||
411 | 420 | } |
412 | 421 | $cmd = new $class($data); |
413 | 422 | |
414 | - if ($cmd instanceof admin_cmd) // dont allow others classes to be executed that way! |
|
423 | + if ($cmd instanceof admin_cmd) |
|
424 | + { |
|
425 | + // dont allow others classes to be executed that way! |
|
415 | 426 | { |
416 | 427 | return $cmd; |
417 | 428 | } |
429 | + } |
|
418 | 430 | throw new Api\Exception\WrongParameter(lang('%1 is no command!',$class),0); |
419 | 431 | } |
420 | 432 | |
@@ -564,7 +576,10 @@ discard block |
||
564 | 576 | } |
565 | 577 | } |
566 | 578 | unset($vars['data']); |
567 | - if ($this->data) $vars = array_merge($this->data,$vars); |
|
579 | + if ($this->data) |
|
580 | + { |
|
581 | + $vars = array_merge($this->data,$vars); |
|
582 | + } |
|
568 | 583 | |
569 | 584 | return $vars; |
570 | 585 | } |
@@ -583,10 +598,13 @@ discard block |
||
583 | 598 | admin_cmd::_instanciate_acl($this->creator); |
584 | 599 | // todo: check only if and with $this->creator |
585 | 600 | if (!admin_cmd::$acl->check('run',1,'admin') && // creator is no longer admin |
586 | - $extra_acl && $extra_deny && admin_cmd::$acl->check($extra_acl,$extra_deny,'admin')) // creator is explicitly forbidden to do something |
|
601 | + $extra_acl && $extra_deny && admin_cmd::$acl->check($extra_acl,$extra_deny,'admin')) |
|
602 | + { |
|
603 | + // creator is explicitly forbidden to do something |
|
587 | 604 | { |
588 | 605 | throw new Api\Exception\NoPermission\Admin(); |
589 | 606 | } |
607 | + } |
|
590 | 608 | } |
591 | 609 | } |
592 | 610 | |
@@ -603,11 +621,14 @@ discard block |
||
603 | 621 | { |
604 | 622 | if (!isset($GLOBALS['egw_info']['apps'][$name])) |
605 | 623 | { |
606 | - foreach($GLOBALS['egw_info']['apps'] as $app => $data) // check against title and localised name |
|
624 | + foreach($GLOBALS['egw_info']['apps'] as $app => $data) |
|
625 | + { |
|
626 | + // check against title and localised name |
|
607 | 627 | { |
608 | 628 | if (!strcasecmp($name,$data['title']) || !strcasecmp($name,lang($app))) |
609 | 629 | { |
610 | 630 | $apps[$key] = $name = $app; |
631 | + } |
|
611 | 632 | break; |
612 | 633 | } |
613 | 634 | } |
@@ -642,7 +663,11 @@ discard block |
||
642 | 663 | { |
643 | 664 | throw new Api\Exception\WrongUserinput(lang("Wrong account type: %1 is NO %2 !!!",$account,$allow_only_user?lang('user'):lang('group')),15); |
644 | 665 | } |
645 | - if ($type == 2 && $id > 0) $id = -$id; // groups use negative id's internally, fix it, if user given the wrong sign |
|
666 | + if ($type == 2 && $id > 0) |
|
667 | + { |
|
668 | + $id = -$id; |
|
669 | + } |
|
670 | + // groups use negative id's internally, fix it, if user given the wrong sign |
|
646 | 671 | |
647 | 672 | return $id; |
648 | 673 | } |
@@ -658,7 +683,10 @@ discard block |
||
658 | 683 | */ |
659 | 684 | static function parse_accounts($accounts,$allow_only_user=null) |
660 | 685 | { |
661 | - if (!$accounts) return null; |
|
686 | + if (!$accounts) |
|
687 | + { |
|
688 | + return null; |
|
689 | + } |
|
662 | 690 | |
663 | 691 | $ids = array(); |
664 | 692 | foreach(is_array($accounts) ? $accounts : explode(',',$accounts) as $account) |
@@ -677,9 +705,12 @@ discard block |
||
677 | 705 | */ |
678 | 706 | static function parse_date($date) |
679 | 707 | { |
680 | - if (!is_numeric($date)) // we allow to input a timestamp |
|
708 | + if (!is_numeric($date)) |
|
709 | + { |
|
710 | + // we allow to input a timestamp |
|
681 | 711 | { |
682 | 712 | $datein = $date; |
713 | + } |
|
683 | 714 | // convert german DD.MM.YYYY format into ISO YYYY-MM-DD format |
684 | 715 | $date = preg_replace('/^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})$/','\3-\2-\1',$date); |
685 | 716 | |
@@ -837,10 +868,13 @@ discard block |
||
837 | 868 | return false; // no schduled command, no need to setup the job |
838 | 869 | } |
839 | 870 | $next = $jobs[0]; |
840 | - if (($time = $next['scheduled']) < time()) // should run immediatly |
|
871 | + if (($time = $next['scheduled']) < time()) |
|
872 | + { |
|
873 | + // should run immediatly |
|
841 | 874 | { |
842 | 875 | return admin_cmd::run_queued_jobs(); |
843 | 876 | } |
877 | + } |
|
844 | 878 | $async = new Api\Asyncservice(); |
845 | 879 | |
846 | 880 | // we cant use this class as callback, as it's abstract and ExecMethod used by the async service instanciated the class! |
@@ -944,10 +978,13 @@ discard block |
||
944 | 978 | { |
945 | 979 | admin_cmd::_instanciate_remote(); |
946 | 980 | |
947 | - if ($data['install_id'] && $data['config_passwd']) // calculate hash |
|
981 | + if ($data['install_id'] && $data['config_passwd']) |
|
982 | + { |
|
983 | + // calculate hash |
|
948 | 984 | { |
949 | 985 | $data['remote_hash'] = self::remote_hash($data['install_id'],$data['config_passwd']); |
950 | 986 | } |
987 | + } |
|
951 | 988 | elseif (!$data['remote_hash'] && !($data['install_id'] && $data['config_passwd'])) |
952 | 989 | { |
953 | 990 | throw new Api\Exception\WrongUserinput(lang('Either Install ID AND Api\Config password needed OR the remote hash!')); |
@@ -981,7 +1018,10 @@ discard block |
||
981 | 1018 | { |
982 | 1019 | throw new Api\Exception\WrongParameter(empty($config_passwd)?'Empty Api\Config password':'install_id no md5 hash'); |
983 | 1020 | } |
984 | - if (!self::is_md5($config_passwd)) $config_passwd = md5($config_passwd); |
|
1021 | + if (!self::is_md5($config_passwd)) |
|
1022 | + { |
|
1023 | + $config_passwd = md5($config_passwd); |
|
1024 | + } |
|
985 | 1025 | |
986 | 1026 | return md5($config_passwd.$install_id); |
987 | 1027 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | /** |
101 | 101 | * Executes the command |
102 | 102 | * |
103 | - * @param boolean $check_only=false only run the checks (and throw the exceptions), but not the command itself |
|
103 | + * @param boolean $check_only only run the checks (and throw the exceptions), but not the command itself |
|
104 | 104 | * @return string success message |
105 | 105 | * @throws Exception() |
106 | 106 | */ |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | * |
142 | 142 | * The command will be written to the database queue, incl. its scheduled start time or execution status |
143 | 143 | * |
144 | - * @param int $time=null timestamp to run the command or null to run it immediatly |
|
145 | - * @param boolean $set_modifier=null should the current user be set as modifier, default true |
|
146 | - * @param booelan $skip_checks=false do not yet run the checks for a scheduled command |
|
147 | - * @param boolean $dry_run=false only run checks, NOT command itself |
|
144 | + * @param boolean $set_modifier should the current user be set as modifier, default true |
|
145 | + * @param booelan $skip_checks do not yet run the checks for a scheduled command |
|
146 | + * @param boolean $dry_run only run checks, NOT command itself |
|
147 | + * @param integer $time |
|
148 | 148 | * @return mixed return value of the command |
149 | 149 | * @throws Exceptions on error |
150 | 150 | */ |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | /** |
283 | 283 | * Saving the object to the database |
284 | 284 | * |
285 | - * @param boolean $set_modifier=true set the current user as modifier or 0 (= run by the system) |
|
285 | + * @param boolean $set_modifier set the current user as modifier or 0 (= run by the system) |
|
286 | 286 | * @return boolean true on success, false otherwise |
287 | 287 | */ |
288 | 288 | function save($set_modifier=true) |
@@ -438,15 +438,12 @@ discard block |
||
438 | 438 | * |
439 | 439 | * @static |
440 | 440 | * @param array/string $criteria array of key and data cols, OR a SQL query (content for WHERE), fully quoted (!) |
441 | - * @param boolean/string/array $only_keys=true True returns only keys, False returns all cols. or |
|
441 | + * @param boolean/string/array $only_keys True returns only keys, False returns all cols. or |
|
442 | 442 | * comma seperated list or array of columns to return |
443 | 443 | * @param string $order_by='' fieldnames + {ASC|DESC} separated by colons ',', can also contain a GROUP BY (if it contains ORDER BY) |
444 | 444 | * @param string/array $extra_cols='' string or array of strings to be added to the SELECT, eg. "count(*) as num" |
445 | 445 | * @param string $wildcard='' appended befor and after each criteria |
446 | - * @param boolean $empty=false False=empty criteria are ignored in query, True=empty have to be empty in row |
|
447 | - * @param string $op='AND' defaults to 'AND', can be set to 'OR' too, then criteria's are OR'ed together |
|
448 | - * @param mixed $start=false if != false, return only maxmatch rows begining with start, or array($start,$num), or 'UNION' for a part of a union query |
|
449 | - * @param array $filter=null if set (!=null) col-data pairs, to be and-ed (!) into the query without wildcards |
|
446 | + * @param array $filter if set (!=null) col-data pairs, to be and-ed (!) into the query without wildcards |
|
450 | 447 | * @return array |
451 | 448 | */ |
452 | 449 | static function &search($criteria,$only_keys=True,$order_by='',$extra_cols='',$wildcard='',$empty=False,$op='AND',$start=false,$filter=null) |
@@ -567,8 +564,8 @@ discard block |
||
567 | 564 | /** |
568 | 565 | * Check if the creator is still admin and has the neccessary admin rights |
569 | 566 | * |
570 | - * @param string $extra_acl=null further admin rights to check, eg. 'account_access' |
|
571 | - * @param int $extra_deny=null further admin rights to check, eg. 16 = deny edit accounts |
|
567 | + * @param string $extra_acl further admin rights to check, eg. 'account_access' |
|
568 | + * @param integer $extra_deny further admin rights to check, eg. 16 = deny edit accounts |
|
572 | 569 | * @throws egw_exception_no_admin |
573 | 570 | */ |
574 | 571 | protected function _check_admin($extra_acl=null,$extra_deny=null) |
@@ -619,7 +616,7 @@ discard block |
||
619 | 616 | * parse account name or id |
620 | 617 | * |
621 | 618 | * @param string/int $account account_id or account_lid |
622 | - * @param boolean $allow_only_user=null true=only user, false=only groups, default both |
|
619 | + * @param boolean $allow_only_user true=only user, false=only groups, default both |
|
623 | 620 | * @return int/array account_id |
624 | 621 | * @throws egw_exception_wrong_userinput(lang("Unknown account: %1 !!!",$account),15); |
625 | 622 | * @throws egw_exception_wrong_userinput(lang("Wrong account type: %1 is NO %2 !!!",$account,$allow_only_user?lang('user'):lang('group')),15); |
@@ -646,7 +643,7 @@ discard block |
||
646 | 643 | * parse account names or ids |
647 | 644 | * |
648 | 645 | * @param string/int/array $accounts array or comma-separated account_id's or account_lid's |
649 | - * @param boolean $allow_only_user=null true=only user, false=only groups, default both |
|
646 | + * @param boolean $allow_only_user true=only user, false=only groups, default both |
|
650 | 647 | * @return array of account_id's or null if none specified |
651 | 648 | * @throws egw_exception_wrong_userinput(lang("Unknown account: %1 !!!",$account),15); |
652 | 649 | * @throws egw_exception_wrong_userinput(lang("Wrong account type: %1 is NO %2 !!!",$account,$allow_only?lang('user'):lang('group')),15); |
@@ -690,7 +687,7 @@ discard block |
||
690 | 687 | * Parse a boolean value |
691 | 688 | * |
692 | 689 | * @param string|boolean|int $value |
693 | - * @param boolean $default=null |
|
690 | + * @param boolean $default |
|
694 | 691 | * @return boolean |
695 | 692 | * @throws egw_exception_wrong_userinput(lang('Invalid value "%1" use yes or no!',$value),998); |
696 | 693 | */ |
@@ -759,7 +756,7 @@ discard block |
||
759 | 756 | * Instanciated acl class |
760 | 757 | * |
761 | 758 | * @todo acl class instanciation for setup |
762 | - * @param int $account=null account_id the class needs to be instanciated for, default need only account-independent methods |
|
759 | + * @param int $account account_id the class needs to be instanciated for, default need only account-independent methods |
|
763 | 760 | * @throws egw_exception_assertion_failed(lang('%1 class not instanciated','acl'),999); |
764 | 761 | */ |
765 | 762 | protected function _instanciate_acl($account=null) |
@@ -920,7 +917,7 @@ discard block |
||
920 | 917 | * Read data of a remote instance |
921 | 918 | * |
922 | 919 | * @param array/int $keys |
923 | - * @return array |
|
920 | + * @return string |
|
924 | 921 | */ |
925 | 922 | static function read_remote($keys) |
926 | 923 | { |
@@ -1000,7 +997,7 @@ discard block |
||
1000 | 997 | * Check if string is a md5 hash (32 chars of 0-9 or a-f) |
1001 | 998 | * |
1002 | 999 | * @param string $str |
1003 | - * @return boolean |
|
1000 | + * @return integer |
|
1004 | 1001 | */ |
1005 | 1002 | static function is_md5($str) |
1006 | 1003 | { |
@@ -1046,7 +1043,6 @@ discard block |
||
1046 | 1043 | /** |
1047 | 1044 | * Return a rand string, eg. to generate passwords |
1048 | 1045 | * |
1049 | - * @param int $len=16 |
|
1050 | 1046 | * @return string |
1051 | 1047 | */ |
1052 | 1048 | static function randomstring($len=16) |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | const successful = 2; |
21 | 21 | const failed = 3; |
22 | 22 | const pending = 4; |
23 | - const queued = 5; // command waits to be fetched from remote |
|
23 | + const queued = 5; // command waits to be fetched from remote |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Status which stil need passwords available |
27 | 27 | * |
28 | 28 | * @var array |
29 | 29 | */ |
30 | - static $require_pw_stati = array(self::scheduled,self::pending,self::queued); |
|
30 | + static $require_pw_stati = array(self::scheduled, self::pending, self::queued); |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * The status of the command, one of either scheduled, successful, failed or deleted |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @return string success message |
105 | 105 | * @throws Exception() |
106 | 106 | */ |
107 | - protected abstract function exec($check_only=false); |
|
107 | + protected abstract function exec($check_only = false); |
|
108 | 108 | |
109 | 109 | /** |
110 | 110 | * Return a title / string representation for a given command, eg. to display it |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | $this->type = get_class($this); |
131 | 131 | |
132 | - foreach($data as $name => $value) |
|
132 | + foreach ($data as $name => $value) |
|
133 | 133 | { |
134 | 134 | $this->$name = $name == 'data' && !is_array($value) ? json_php_unserialize($value) : $value; |
135 | 135 | } |
@@ -148,13 +148,13 @@ discard block |
||
148 | 148 | * @return mixed return value of the command |
149 | 149 | * @throws Exceptions on error |
150 | 150 | */ |
151 | - function run($time=null,$set_modifier=true,$skip_checks=false,$dry_run=false) |
|
151 | + function run($time = null, $set_modifier = true, $skip_checks = false, $dry_run = false) |
|
152 | 152 | { |
153 | 153 | if (!is_null($time)) |
154 | 154 | { |
155 | 155 | $this->scheduled = $time; |
156 | 156 | $this->status = admin_cmd::scheduled; |
157 | - $ret = lang('Command scheduled to run at %1',date('Y-m-d H:i',$time)); |
|
157 | + $ret = lang('Command scheduled to run at %1', date('Y-m-d H:i', $time)); |
|
158 | 158 | // running the checks of the arguments for local commands, if not explicitly requested to not run them |
159 | 159 | if (!$this->remote_id && !$skip_checks) |
160 | 160 | { |
@@ -217,21 +217,21 @@ discard block |
||
217 | 217 | { |
218 | 218 | if (!($remote = $this->read_remote($this->remote_id))) |
219 | 219 | { |
220 | - throw new egw_exception_wrong_userinput(lang('Invalid remote id or name "%1"!',$id_or_name),997); |
|
220 | + throw new egw_exception_wrong_userinput(lang('Invalid remote id or name "%1"!', $id_or_name), 997); |
|
221 | 221 | } |
222 | 222 | if (!$this->uid) |
223 | 223 | { |
224 | - $this->save(); // to get the uid |
|
224 | + $this->save(); // to get the uid |
|
225 | 225 | } |
226 | 226 | $secret = md5($this->uid.$remote['remote_hash']); |
227 | 227 | |
228 | 228 | $postdata = $this->as_array(); |
229 | 229 | if (is_object($GLOBALS['egw']->translation)) |
230 | 230 | { |
231 | - $postdata = $GLOBALS['egw']->translation->convert($postdata,$GLOBALS['egw']->translation->charset(),'utf-8'); |
|
231 | + $postdata = $GLOBALS['egw']->translation->convert($postdata, $GLOBALS['egw']->translation->charset(), 'utf-8'); |
|
232 | 232 | } |
233 | 233 | // dont send the id's which have no meaning on the remote install |
234 | - foreach(array('id','creator','modifier','requested','remote_id') as $name) |
|
234 | + foreach (array('id', 'creator', 'modifier', 'requested', 'remote_id') as $name) |
|
235 | 235 | { |
236 | 236 | unset($postdata[$name]); |
237 | 237 | } |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | } |
257 | 257 | if (is_object($GLOBALS['egw']->translation)) |
258 | 258 | { |
259 | - $message = $GLOBALS['egw']->translation->convert($message,'utf-8'); |
|
259 | + $message = $GLOBALS['egw']->translation->convert($message, 'utf-8'); |
|
260 | 260 | } |
261 | - if (is_string($message) && preg_match('/^([0-9]+) (.*)$/',$message,$matches)) |
|
261 | + if (is_string($message) && preg_match('/^([0-9]+) (.*)$/', $message, $matches)) |
|
262 | 262 | { |
263 | - throw new egw_exception($matches[2],(int)$matches[1]); |
|
263 | + throw new egw_exception($matches[2], (int)$matches[1]); |
|
264 | 264 | } |
265 | 265 | return $message; |
266 | 266 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @param boolean $set_modifier=true set the current user as modifier or 0 (= run by the system) |
286 | 286 | * @return boolean true on success, false otherwise |
287 | 287 | */ |
288 | - function save($set_modifier=true) |
|
288 | + function save($set_modifier = true) |
|
289 | 289 | { |
290 | 290 | admin_cmd::_instanciate_sql(); |
291 | 291 | |
@@ -300,13 +300,13 @@ discard block |
||
300 | 300 | $this->modifier = $set_modifier ? $GLOBALS['egw_info']['user']['account_id'] : 0; |
301 | 301 | if ($set_modifier) $this->modifier_email = admin_cmd::user_email(); |
302 | 302 | } |
303 | - if (version_compare(PHP_VERSION,'5.1.2','>')) |
|
303 | + if (version_compare(PHP_VERSION, '5.1.2', '>')) |
|
304 | 304 | { |
305 | - $vars = get_object_vars($this); // does not work in php5.1.2 due a bug |
|
305 | + $vars = get_object_vars($this); // does not work in php5.1.2 due a bug |
|
306 | 306 | } |
307 | 307 | else |
308 | 308 | { |
309 | - foreach(array_keys(get_class_vars(__CLASS__)) as $name) |
|
309 | + foreach (array_keys(get_class_vars(__CLASS__)) as $name) |
|
310 | 310 | { |
311 | 311 | $vars[$name] = $this->$name; |
312 | 312 | } |
@@ -346,13 +346,13 @@ discard block |
||
346 | 346 | * @param boolean $return_serialized =true true: return json serialized string, false: return array |
347 | 347 | * @return string|array see $return_serialized |
348 | 348 | */ |
349 | - static function mask_passwords($data, $return_serialized=true) |
|
349 | + static function mask_passwords($data, $return_serialized = true) |
|
350 | 350 | { |
351 | 351 | if (!is_array($data)) |
352 | 352 | { |
353 | 353 | $data = json_php_unserialize($data); |
354 | 354 | } |
355 | - foreach($data as $key => &$value) |
|
355 | + foreach ($data as $key => &$value) |
|
356 | 356 | { |
357 | 357 | if (is_array($value)) |
358 | 358 | { |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | } |
403 | 403 | if (!class_exists($class = $data['type']) || $class == 'admin_cmd') |
404 | 404 | { |
405 | - throw new egw_exception_wrong_parameter(lang('Unknown command %1!',$class),0); |
|
405 | + throw new egw_exception_wrong_parameter(lang('Unknown command %1!', $class), 0); |
|
406 | 406 | } |
407 | 407 | $cmd = new $class($data); |
408 | 408 | |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | { |
411 | 411 | return $cmd; |
412 | 412 | } |
413 | - throw new egw_exception_wrong_parameter(lang('%1 is no command!',$class),0); |
|
413 | + throw new egw_exception_wrong_parameter(lang('%1 is no command!', $class), 0); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | /** |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * @param array $readonlys |
423 | 423 | * @return int |
424 | 424 | */ |
425 | - static function get_rows($query,&$rows,$readonlys) |
|
425 | + static function get_rows($query, &$rows, $readonlys) |
|
426 | 426 | { |
427 | 427 | admin_cmd::_instanciate_sql(); |
428 | 428 | |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | { |
431 | 431 | $query['col_filter']['remote_id'] = null; |
432 | 432 | } |
433 | - return admin_cmd::$sql->get_rows($query,$rows,$readonlys); |
|
433 | + return admin_cmd::$sql->get_rows($query, $rows, $readonlys); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | /** |
@@ -449,11 +449,11 @@ discard block |
||
449 | 449 | * @param array $filter=null if set (!=null) col-data pairs, to be and-ed (!) into the query without wildcards |
450 | 450 | * @return array |
451 | 451 | */ |
452 | - static function &search($criteria,$only_keys=True,$order_by='',$extra_cols='',$wildcard='',$empty=False,$op='AND',$start=false,$filter=null) |
|
452 | + static function &search($criteria, $only_keys = True, $order_by = '', $extra_cols = '', $wildcard = '', $empty = False, $op = 'AND', $start = false, $filter = null) |
|
453 | 453 | { |
454 | 454 | admin_cmd::_instanciate_sql(); |
455 | 455 | |
456 | - return admin_cmd::$sql->search($criteria,$only_keys,$order_by,$extra_cols,$wildcard,$empty,$op,$start,$filter); |
|
456 | + return admin_cmd::$sql->search($criteria, $only_keys, $order_by, $extra_cols, $wildcard, $empty, $op, $start, $filter); |
|
457 | 457 | } |
458 | 458 | |
459 | 459 | /** |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | { |
466 | 466 | if (is_null(admin_cmd::$sql)) |
467 | 467 | { |
468 | - admin_cmd::$sql = new so_sql('admin','egw_admin_queue',null,'cmd_'); |
|
468 | + admin_cmd::$sql = new so_sql('admin', 'egw_admin_queue', null, 'cmd_'); |
|
469 | 469 | } |
470 | 470 | } |
471 | 471 | |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | { |
479 | 479 | if (is_null(admin_cmd::$remote)) |
480 | 480 | { |
481 | - admin_cmd::$remote = new so_sql('admin','egw_admin_remote'); |
|
481 | + admin_cmd::$remote = new so_sql('admin', 'egw_admin_remote'); |
|
482 | 482 | } |
483 | 483 | } |
484 | 484 | |
@@ -490,11 +490,11 @@ discard block |
||
490 | 490 | */ |
491 | 491 | function __get($property) |
492 | 492 | { |
493 | - if (property_exists('admin_cmd',$property)) |
|
493 | + if (property_exists('admin_cmd', $property)) |
|
494 | 494 | { |
495 | - return $this->$property; // making all (non static) class vars readonly available |
|
495 | + return $this->$property; // making all (non static) class vars readonly available |
|
496 | 496 | } |
497 | - switch($property) |
|
497 | + switch ($property) |
|
498 | 498 | { |
499 | 499 | case 'accounts': |
500 | 500 | self::_instanciate_accounts(); |
@@ -511,9 +511,9 @@ discard block |
||
511 | 511 | */ |
512 | 512 | function __isset($property) |
513 | 513 | { |
514 | - if (property_exists('admin_cmd',$property)) |
|
514 | + if (property_exists('admin_cmd', $property)) |
|
515 | 515 | { |
516 | - return isset($this->$property); // making all (non static) class vars readonly available |
|
516 | + return isset($this->$property); // making all (non static) class vars readonly available |
|
517 | 517 | } |
518 | 518 | return isset($this->data[$property]); |
519 | 519 | } |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | * @param mixed $value |
526 | 526 | * @return mixed |
527 | 527 | */ |
528 | - function __set($property,$value) |
|
528 | + function __set($property, $value) |
|
529 | 529 | { |
530 | 530 | $this->data[$property] = $value; |
531 | 531 | } |
@@ -547,19 +547,19 @@ discard block |
||
547 | 547 | */ |
548 | 548 | function as_array() |
549 | 549 | { |
550 | - if (version_compare(PHP_VERSION,'5.1.2','>')) |
|
550 | + if (version_compare(PHP_VERSION, '5.1.2', '>')) |
|
551 | 551 | { |
552 | - $vars = get_object_vars($this); // does not work in php5.1.2 due a bug |
|
552 | + $vars = get_object_vars($this); // does not work in php5.1.2 due a bug |
|
553 | 553 | } |
554 | 554 | else |
555 | 555 | { |
556 | - foreach(array_keys(get_class_vars(__CLASS__)) as $name) |
|
556 | + foreach (array_keys(get_class_vars(__CLASS__)) as $name) |
|
557 | 557 | { |
558 | 558 | $vars[$name] = $this->$name; |
559 | 559 | } |
560 | 560 | } |
561 | 561 | unset($vars['data']); |
562 | - if ($this->data) $vars = array_merge($this->data,$vars); |
|
562 | + if ($this->data) $vars = array_merge($this->data, $vars); |
|
563 | 563 | |
564 | 564 | return $vars; |
565 | 565 | } |
@@ -571,14 +571,14 @@ discard block |
||
571 | 571 | * @param int $extra_deny=null further admin rights to check, eg. 16 = deny edit accounts |
572 | 572 | * @throws egw_exception_no_admin |
573 | 573 | */ |
574 | - protected function _check_admin($extra_acl=null,$extra_deny=null) |
|
574 | + protected function _check_admin($extra_acl = null, $extra_deny = null) |
|
575 | 575 | { |
576 | 576 | if ($this->creator) |
577 | 577 | { |
578 | 578 | admin_cmd::_instanciate_acl($this->creator); |
579 | 579 | // todo: check only if and with $this->creator |
580 | - if (!admin_cmd::$acl->check('run',1,'admin') && // creator is no longer admin |
|
581 | - $extra_acl && $extra_deny && admin_cmd::$acl->check($extra_acl,$extra_deny,'admin')) // creator is explicitly forbidden to do something |
|
580 | + if (!admin_cmd::$acl->check('run', 1, 'admin') && // creator is no longer admin |
|
581 | + $extra_acl && $extra_deny && admin_cmd::$acl->check($extra_acl, $extra_deny, 'admin')) // creator is explicitly forbidden to do something |
|
582 | 582 | { |
583 | 583 | throw new egw_exception_no_permission_admin(); |
584 | 584 | } |
@@ -594,13 +594,13 @@ discard block |
||
594 | 594 | */ |
595 | 595 | static function parse_apps(array $apps) |
596 | 596 | { |
597 | - foreach($apps as $key => $name) |
|
597 | + foreach ($apps as $key => $name) |
|
598 | 598 | { |
599 | 599 | if (!isset($GLOBALS['egw_info']['apps'][$name])) |
600 | 600 | { |
601 | - foreach($GLOBALS['egw_info']['apps'] as $app => $data) // check against title and localised name |
|
601 | + foreach ($GLOBALS['egw_info']['apps'] as $app => $data) // check against title and localised name |
|
602 | 602 | { |
603 | - if (!strcasecmp($name,$data['title']) || !strcasecmp($name,lang($app))) |
|
603 | + if (!strcasecmp($name, $data['title']) || !strcasecmp($name, lang($app))) |
|
604 | 604 | { |
605 | 605 | $apps[$key] = $name = $app; |
606 | 606 | break; |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | } |
610 | 610 | if (!isset($GLOBALS['egw_info']['apps'][$name])) |
611 | 611 | { |
612 | - throw new egw_exception_wrong_userinput(lang("Application '%1' not found (maybe not installed or misspelled)!",$name),8); |
|
612 | + throw new egw_exception_wrong_userinput(lang("Application '%1' not found (maybe not installed or misspelled)!", $name), 8); |
|
613 | 613 | } |
614 | 614 | } |
615 | 615 | return $apps; |
@@ -624,20 +624,20 @@ discard block |
||
624 | 624 | * @throws egw_exception_wrong_userinput(lang("Unknown account: %1 !!!",$account),15); |
625 | 625 | * @throws egw_exception_wrong_userinput(lang("Wrong account type: %1 is NO %2 !!!",$account,$allow_only_user?lang('user'):lang('group')),15); |
626 | 626 | */ |
627 | - static function parse_account($account,$allow_only_user=null) |
|
627 | + static function parse_account($account, $allow_only_user = null) |
|
628 | 628 | { |
629 | 629 | admin_cmd::_instanciate_accounts(); |
630 | 630 | |
631 | 631 | if (!($type = admin_cmd::$accounts->exists($account)) || |
632 | - !is_numeric($id=$account) && !($id = admin_cmd::$accounts->name2id($account))) |
|
632 | + !is_numeric($id = $account) && !($id = admin_cmd::$accounts->name2id($account))) |
|
633 | 633 | { |
634 | - throw new egw_exception_wrong_userinput(lang("Unknown account: %1 !!!",$account),15); |
|
634 | + throw new egw_exception_wrong_userinput(lang("Unknown account: %1 !!!", $account), 15); |
|
635 | 635 | } |
636 | 636 | if (!is_null($allow_only_user) && $allow_only_user !== ($type == 1)) |
637 | 637 | { |
638 | - throw new egw_exception_wrong_userinput(lang("Wrong account type: %1 is NO %2 !!!",$account,$allow_only_user?lang('user'):lang('group')),15); |
|
638 | + throw new egw_exception_wrong_userinput(lang("Wrong account type: %1 is NO %2 !!!", $account, $allow_only_user ? lang('user') : lang('group')), 15); |
|
639 | 639 | } |
640 | - if ($type == 2 && $id > 0) $id = -$id; // groups use negative id's internally, fix it, if user given the wrong sign |
|
640 | + if ($type == 2 && $id > 0) $id = -$id; // groups use negative id's internally, fix it, if user given the wrong sign |
|
641 | 641 | |
642 | 642 | return $id; |
643 | 643 | } |
@@ -651,14 +651,14 @@ discard block |
||
651 | 651 | * @throws egw_exception_wrong_userinput(lang("Unknown account: %1 !!!",$account),15); |
652 | 652 | * @throws egw_exception_wrong_userinput(lang("Wrong account type: %1 is NO %2 !!!",$account,$allow_only?lang('user'):lang('group')),15); |
653 | 653 | */ |
654 | - static function parse_accounts($accounts,$allow_only_user=null) |
|
654 | + static function parse_accounts($accounts, $allow_only_user = null) |
|
655 | 655 | { |
656 | 656 | if (!$accounts) return null; |
657 | 657 | |
658 | 658 | $ids = array(); |
659 | - foreach(is_array($accounts) ? $accounts : explode(',',$accounts) as $account) |
|
659 | + foreach (is_array($accounts) ? $accounts : explode(',', $accounts) as $account) |
|
660 | 660 | { |
661 | - $ids[] = admin_cmd::parse_account($account,$allow_only_user); |
|
661 | + $ids[] = admin_cmd::parse_account($account, $allow_only_user); |
|
662 | 662 | } |
663 | 663 | return $ids; |
664 | 664 | } |
@@ -676,11 +676,11 @@ discard block |
||
676 | 676 | { |
677 | 677 | $datein = $date; |
678 | 678 | // convert german DD.MM.YYYY format into ISO YYYY-MM-DD format |
679 | - $date = preg_replace('/^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})$/','\3-\2-\1',$date); |
|
679 | + $date = preg_replace('/^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})$/', '\3-\2-\1', $date); |
|
680 | 680 | |
681 | - if (($date = strtotime($date)) === false) |
|
681 | + if (($date = strtotime($date)) === false) |
|
682 | 682 | { |
683 | - throw new egw_exception_wrong_userinput(lang('Invalid formated date "%1"!',$datein),6); |
|
683 | + throw new egw_exception_wrong_userinput(lang('Invalid formated date "%1"!', $datein), 6); |
|
684 | 684 | } |
685 | 685 | } |
686 | 686 | return (int)$date; |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | * @return boolean |
695 | 695 | * @throws egw_exception_wrong_userinput(lang('Invalid value "%1" use yes or no!',$value),998); |
696 | 696 | */ |
697 | - static function parse_boolean($value,$default=null) |
|
697 | + static function parse_boolean($value, $default = null) |
|
698 | 698 | { |
699 | 699 | if (is_bool($value) || is_int($value)) |
700 | 700 | { |
@@ -704,15 +704,15 @@ discard block |
||
704 | 704 | { |
705 | 705 | return $default; |
706 | 706 | } |
707 | - if (in_array($value,array('1','yes','true',lang('yes'),lang('true')))) |
|
707 | + if (in_array($value, array('1', 'yes', 'true', lang('yes'), lang('true')))) |
|
708 | 708 | { |
709 | 709 | return true; |
710 | 710 | } |
711 | - if (in_array($value,array('0','no','false',lang('no'),lang('false')))) |
|
711 | + if (in_array($value, array('0', 'no', 'false', lang('no'), lang('false')))) |
|
712 | 712 | { |
713 | 713 | return false; |
714 | 714 | } |
715 | - throw new egw_exception_wrong_userinput(lang('Invalid value "%1" use yes or no!',$value),998); |
|
715 | + throw new egw_exception_wrong_userinput(lang('Invalid value "%1" use yes or no!', $value), 998); |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | /** |
@@ -730,9 +730,9 @@ discard block |
||
730 | 730 | 'remote_id' => $id_or_name, |
731 | 731 | 'remote_name' => $id_or_name, |
732 | 732 | 'remote_domain' => $id_or_name, |
733 | - ),true,'','','',false,'OR')) || count($remotes) != 1) |
|
733 | + ), true, '', '', '', false, 'OR')) || count($remotes) != 1) |
|
734 | 734 | { |
735 | - throw new egw_exception_wrong_userinput(lang('Invalid remote id or name "%1"!',$id_or_name),997); |
|
735 | + throw new egw_exception_wrong_userinput(lang('Invalid remote id or name "%1"!', $id_or_name), 997); |
|
736 | 736 | } |
737 | 737 | return $remotes[0]['remote_id']; |
738 | 738 | } |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | { |
750 | 750 | if (!is_object($GLOBALS['egw']->accounts)) |
751 | 751 | { |
752 | - throw new egw_exception_assertion_failed(lang('%1 class not instanciated','accounts'),999); |
|
752 | + throw new egw_exception_assertion_failed(lang('%1 class not instanciated', 'accounts'), 999); |
|
753 | 753 | } |
754 | 754 | admin_cmd::$accounts = $GLOBALS['egw']->accounts; |
755 | 755 | } |
@@ -762,13 +762,13 @@ discard block |
||
762 | 762 | * @param int $account=null account_id the class needs to be instanciated for, default need only account-independent methods |
763 | 763 | * @throws egw_exception_assertion_failed(lang('%1 class not instanciated','acl'),999); |
764 | 764 | */ |
765 | - protected function _instanciate_acl($account=null) |
|
765 | + protected function _instanciate_acl($account = null) |
|
766 | 766 | { |
767 | 767 | if (!is_object(admin_cmd::$acl) || $account && admin_cmd::$acl->account_id != $account) |
768 | 768 | { |
769 | 769 | if (!is_object($GLOBALS['egw']->acl)) |
770 | 770 | { |
771 | - throw new egw_exception_assertion_failed(lang('%1 class not instanciated','acl'),999); |
|
771 | + throw new egw_exception_assertion_failed(lang('%1 class not instanciated', 'acl'), 999); |
|
772 | 772 | } |
773 | 773 | if ($account && $GLOBALS['egw']->acl->account_id != $account) |
774 | 774 | { |
@@ -788,20 +788,20 @@ discard block |
||
788 | 788 | * @param $account_id=null account_id, default current user |
789 | 789 | * @return string |
790 | 790 | */ |
791 | - static function user_email($account_id=null) |
|
791 | + static function user_email($account_id = null) |
|
792 | 792 | { |
793 | 793 | if ($account_id) |
794 | 794 | { |
795 | 795 | admin_cmd::_instanciate_accounts(); |
796 | - $fullname = admin_cmd::$accounts->id2name($account_id,'account_fullname'); |
|
797 | - $email = admin_cmd::$accounts->id2name($account_id,'account_email'); |
|
796 | + $fullname = admin_cmd::$accounts->id2name($account_id, 'account_fullname'); |
|
797 | + $email = admin_cmd::$accounts->id2name($account_id, 'account_email'); |
|
798 | 798 | } |
799 | 799 | else |
800 | 800 | { |
801 | 801 | $fullname = $GLOBALS['egw_info']['user']['account_fullname']; |
802 | 802 | $email = $GLOBALS['egw_info']['user']['account_email']; |
803 | 803 | } |
804 | - return $fullname . ($email ? ' <'.$email.'>' : ''); |
|
804 | + return $fullname.($email ? ' <'.$email.'>' : ''); |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | /** |
@@ -825,11 +825,11 @@ discard block |
||
825 | 825 | { |
826 | 826 | return false; |
827 | 827 | } |
828 | - if (!($jobs = admin_cmd::search(array(),false,'cmd_scheduled','','',false,'AND',array(0,1),array( |
|
828 | + if (!($jobs = admin_cmd::search(array(), false, 'cmd_scheduled', '', '', false, 'AND', array(0, 1), array( |
|
829 | 829 | 'cmd_status' => admin_cmd::scheduled, |
830 | 830 | )))) |
831 | 831 | { |
832 | - return false; // no schduled command, no need to setup the job |
|
832 | + return false; // no schduled command, no need to setup the job |
|
833 | 833 | } |
834 | 834 | $next = $jobs[0]; |
835 | 835 | if (($time = $next['scheduled']) < time()) // should run immediatly |
@@ -840,11 +840,11 @@ discard block |
||
840 | 840 | $async = new asyncservice(); |
841 | 841 | |
842 | 842 | // we cant use this class as callback, as it's abstract and ExecMethod used by the async service instanciated the class! |
843 | - list($app) = explode('_',$class=$next['type']); |
|
843 | + list($app) = explode('_', $class = $next['type']); |
|
844 | 844 | $callback = $app.'.'.$class.'.run_queued_jobs'; |
845 | 845 | |
846 | - $async->cancel_timer(admin_cmd::async_job_id); // we delete it in case a job already exists |
|
847 | - return $async->set_timer($time,admin_cmd::async_job_id,$callback,null,$next['creator']); |
|
846 | + $async->cancel_timer(admin_cmd::async_job_id); // we delete it in case a job already exists |
|
847 | + return $async->set_timer($time, admin_cmd::async_job_id, $callback, null, $next['creator']); |
|
848 | 848 | } |
849 | 849 | |
850 | 850 | /** |
@@ -854,26 +854,26 @@ discard block |
||
854 | 854 | */ |
855 | 855 | static function run_queued_jobs() |
856 | 856 | { |
857 | - if (!($jobs = admin_cmd::search(array(),false,'cmd_scheduled','','',false,'AND',false,array( |
|
857 | + if (!($jobs = admin_cmd::search(array(), false, 'cmd_scheduled', '', '', false, 'AND', false, array( |
|
858 | 858 | 'cmd_status' => admin_cmd::scheduled, |
859 | 859 | 'cmd_scheduled <= '.time(), |
860 | 860 | )))) |
861 | 861 | { |
862 | - return false; // no schduled commands, no need to setup the job |
|
862 | + return false; // no schduled commands, no need to setup the job |
|
863 | 863 | } |
864 | - admin_cmd::$running_queued_jobs = true; // stop admin_cmd::run() which calls admin_cmd::save() to install a new job |
|
864 | + admin_cmd::$running_queued_jobs = true; // stop admin_cmd::run() which calls admin_cmd::save() to install a new job |
|
865 | 865 | |
866 | - foreach($jobs as $job) |
|
866 | + foreach ($jobs as $job) |
|
867 | 867 | { |
868 | 868 | try { |
869 | 869 | $cmd = admin_cmd::instanciate($job); |
870 | - $cmd->run(null,false); // false = dont set current user as modifier, as job is run by the queue/system itself |
|
870 | + $cmd->run(null, false); // false = dont set current user as modifier, as job is run by the queue/system itself |
|
871 | 871 | } |
872 | 872 | catch (Exception $e) { // we need to mark that command as failed, to prevent further execution |
873 | 873 | admin_cmd::$sql->init($job); |
874 | 874 | admin_cmd::$sql->save(array( |
875 | 875 | 'status' => admin_cmd::failed, |
876 | - 'error' => lang('Unknown command %1!',$job['type']), |
|
876 | + 'error' => lang('Unknown command %1!', $job['type']), |
|
877 | 877 | 'errno' => 0, |
878 | 878 | 'data' => self::mask_passwords($job['data']), |
879 | 879 | )); |
@@ -894,9 +894,9 @@ discard block |
||
894 | 894 | admin_cmd::_instanciate_remote(); |
895 | 895 | |
896 | 896 | $sites = array(lang('local')); |
897 | - if ($remote = admin_cmd::$remote->query_list('remote_name','remote_id')) |
|
897 | + if ($remote = admin_cmd::$remote->query_list('remote_name', 'remote_id')) |
|
898 | 898 | { |
899 | - $sites = array_merge($sites,$remote); |
|
899 | + $sites = array_merge($sites, $remote); |
|
900 | 900 | } |
901 | 901 | return $sites; |
902 | 902 | } |
@@ -909,11 +909,11 @@ discard block |
||
909 | 909 | * @param array &$readonlys |
910 | 910 | * @return int |
911 | 911 | */ |
912 | - static function get_remotes($query,&$rows,&$readonlys) |
|
912 | + static function get_remotes($query, &$rows, &$readonlys) |
|
913 | 913 | { |
914 | 914 | admin_cmd::_instanciate_remote(); |
915 | 915 | |
916 | - return admin_cmd::$remote->get_rows($query,$rows,$readonlys); |
|
916 | + return admin_cmd::$remote->get_rows($query, $rows, $readonlys); |
|
917 | 917 | } |
918 | 918 | |
919 | 919 | /** |
@@ -941,7 +941,7 @@ discard block |
||
941 | 941 | |
942 | 942 | if ($data['install_id'] && $data['config_passwd']) // calculate hash |
943 | 943 | { |
944 | - $data['remote_hash'] = self::remote_hash($data['install_id'],$data['config_passwd']); |
|
944 | + $data['remote_hash'] = self::remote_hash($data['install_id'], $data['config_passwd']); |
|
945 | 945 | } |
946 | 946 | elseif (!$data['remote_hash'] && !($data['install_id'] && $data['config_passwd'])) |
947 | 947 | { |
@@ -953,12 +953,12 @@ discard block |
||
953 | 953 | // check if a unique key constrain would be violated by saving the entry |
954 | 954 | if (($num = admin_cmd::$remote->not_unique())) |
955 | 955 | { |
956 | - $col = admin_cmd::$remote->table_def['uc'][$num-1]; // $num is 1 based! |
|
957 | - throw new egw_exception_db_not_unique(lang('Value for column %1 is not unique!',$this->table_name.'.'.$col),$num); |
|
956 | + $col = admin_cmd::$remote->table_def['uc'][$num - 1]; // $num is 1 based! |
|
957 | + throw new egw_exception_db_not_unique(lang('Value for column %1 is not unique!', $this->table_name.'.'.$col), $num); |
|
958 | 958 | } |
959 | 959 | if (admin_cmd::$remote->save() != 0) |
960 | 960 | { |
961 | - throw new egw_exception_db(lang('Error saving to db:').' '.$this->sql->db->Error.' ('.$this->sql->db->Errno.')',$this->sql->db->Errno); |
|
961 | + throw new egw_exception_db(lang('Error saving to db:').' '.$this->sql->db->Error.' ('.$this->sql->db->Errno.')', $this->sql->db->Errno); |
|
962 | 962 | } |
963 | 963 | return admin_cmd::$remote->data['remote_id']; |
964 | 964 | } |
@@ -970,11 +970,11 @@ discard block |
||
970 | 970 | * @param string $config_passwd |
971 | 971 | * @return string 32char md5 hash |
972 | 972 | */ |
973 | - static function remote_hash($install_id,$config_passwd) |
|
973 | + static function remote_hash($install_id, $config_passwd) |
|
974 | 974 | { |
975 | 975 | if (empty($config_passwd) || !self::is_md5($install_id)) |
976 | 976 | { |
977 | - throw new egw_exception_wrong_parameter(empty($config_passwd)?'Empty config password':'install_id no md5 hash'); |
|
977 | + throw new egw_exception_wrong_parameter(empty($config_passwd) ? 'Empty config password' : 'install_id no md5 hash'); |
|
978 | 978 | } |
979 | 979 | if (!self::is_md5($config_passwd)) $config_passwd = md5($config_passwd); |
980 | 980 | |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | */ |
1005 | 1005 | static function is_md5($str) |
1006 | 1006 | { |
1007 | - return preg_match('/^[0-9a-f]{32}$/',$str); |
|
1007 | + return preg_match('/^[0-9a-f]{32}$/', $str); |
|
1008 | 1008 | } |
1009 | 1009 | |
1010 | 1010 | /** |
@@ -1021,25 +1021,25 @@ discard block |
||
1021 | 1021 | * @param string $config_passwd of the current domain |
1022 | 1022 | * @throws egw_exception_no_permission |
1023 | 1023 | */ |
1024 | - function check_remote_access($secret,$config_passwd) |
|
1024 | + function check_remote_access($secret, $config_passwd) |
|
1025 | 1025 | { |
1026 | 1026 | // as a security measure remote administration need to be enabled under Admin > Site configuration |
1027 | - list(,$remote_admin_install_id) = explode('-',$this->uid); |
|
1028 | - $allowed_remote_admin_ids = $GLOBALS['egw_info']['server']['allow_remote_admin'] ? explode(',',$GLOBALS['egw_info']['server']['allow_remote_admin']) : array(); |
|
1027 | + list(,$remote_admin_install_id) = explode('-', $this->uid); |
|
1028 | + $allowed_remote_admin_ids = $GLOBALS['egw_info']['server']['allow_remote_admin'] ? explode(',', $GLOBALS['egw_info']['server']['allow_remote_admin']) : array(); |
|
1029 | 1029 | |
1030 | 1030 | // to authenticate with the installation we use a secret, which is a md5 hash build from the uid |
1031 | 1031 | // of the command (to not allow to send new commands with an earsdroped secret) and the md5 hash |
1032 | 1032 | // of the md5 hash of the config password and the install_id (egw_admin_remote.remote_hash) |
1033 | - if (is_null($config_passwd) || is_numeric($this->uid) || !in_array($remote_admin_install_id,$allowed_remote_admin_ids) || |
|
1034 | - $secret != ($md5=md5($this->uid.$this->remote_hash($GLOBALS['egw_info']['server']['install_id'],$config_passwd)))) |
|
1033 | + if (is_null($config_passwd) || is_numeric($this->uid) || !in_array($remote_admin_install_id, $allowed_remote_admin_ids) || |
|
1034 | + $secret != ($md5 = md5($this->uid.$this->remote_hash($GLOBALS['egw_info']['server']['install_id'], $config_passwd)))) |
|
1035 | 1035 | { |
1036 | 1036 | //die("secret='$secret' != '$md5', is_null($config_passwd)=".is_null($config_passwd).", uid=$this->uid, remote_install_id=$remote_admin_install_id, allowed: ".implode(', ',$allowed_remote_admin_ids)); |
1037 | 1037 | $msg = lang('Permission denied!'); |
1038 | - if (!in_array($remote_admin_install_id,$allowed_remote_admin_ids)) |
|
1038 | + if (!in_array($remote_admin_install_id, $allowed_remote_admin_ids)) |
|
1039 | 1039 | { |
1040 | 1040 | $msg .= "\n".lang('Remote administration need to be enabled in the remote instance under Admin > Site configuration!'); |
1041 | 1041 | } |
1042 | - throw new egw_exception_no_permission($msg,0); |
|
1042 | + throw new egw_exception_no_permission($msg, 0); |
|
1043 | 1043 | } |
1044 | 1044 | } |
1045 | 1045 | |
@@ -1049,21 +1049,21 @@ discard block |
||
1049 | 1049 | * @param int $len=16 |
1050 | 1050 | * @return string |
1051 | 1051 | */ |
1052 | - static function randomstring($len=16) |
|
1052 | + static function randomstring($len = 16) |
|
1053 | 1053 | { |
1054 | 1054 | static $usedchars = array( |
1055 | - '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f', |
|
1056 | - 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', |
|
1057 | - 'w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L', |
|
1058 | - 'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z', |
|
1059 | - '@','!','$','%','&','/','(',')','=','?',';',':','#','_','-','<', |
|
1060 | - '>','|','{','[',']','}', // dont add \,'" as we have problems dealing with them |
|
1055 | + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', |
|
1056 | + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', |
|
1057 | + 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', |
|
1058 | + 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', |
|
1059 | + '@', '!', '$', '%', '&', '/', '(', ')', '=', '?', ';', ':', '#', '_', '-', '<', |
|
1060 | + '>', '|', '{', '[', ']', '}', // dont add \,'" as we have problems dealing with them |
|
1061 | 1061 | ); |
1062 | 1062 | |
1063 | 1063 | $str = ''; |
1064 | - for($i=0; $i < $len; $i++) |
|
1064 | + for ($i = 0; $i < $len; $i++) |
|
1065 | 1065 | { |
1066 | - $str .= $usedchars[mt_rand(0,count($usedchars)-1)]; |
|
1066 | + $str .= $usedchars[mt_rand(0, count($usedchars) - 1)]; |
|
1067 | 1067 | } |
1068 | 1068 | return $str; |
1069 | 1069 | } |
@@ -15,15 +15,15 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * class import_csv for admin (groups) |
17 | 17 | */ |
18 | -class admin_import_groups_csv implements importexport_iface_import_plugin { |
|
18 | +class admin_import_groups_csv implements importexport_iface_import_plugin { |
|
19 | 19 | |
20 | 20 | private static $plugin_options = array( |
21 | - 'fieldsep', // char |
|
22 | - 'charset', // string |
|
21 | + 'fieldsep', // char |
|
22 | + 'charset', // string |
|
23 | 23 | 'num_header_lines', // int number of header lines |
24 | 24 | 'field_conversion', // array( $csv_col_num => conversion) |
25 | - 'field_mapping', // array( $csv_col_num => adb_filed) |
|
26 | - 'conditions', /* => array containing condition arrays: |
|
25 | + 'field_mapping', // array( $csv_col_num => adb_filed) |
|
26 | + 'conditions', /* => array containing condition arrays: |
|
27 | 27 | 'type' => exists, // exists |
28 | 28 | 'string' => '#kundennummer', |
29 | 29 | 'true' => array( |
@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * actions which could be done to data entries |
42 | 42 | */ |
43 | - protected static $actions = array( 'none', 'update', 'create', 'delete'); |
|
43 | + protected static $actions = array('none', 'update', 'create', 'delete'); |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * conditions for actions |
47 | 47 | * |
48 | 48 | * @var array |
49 | 49 | */ |
50 | - protected static $conditions = array( 'exists' ); |
|
50 | + protected static $conditions = array('exists'); |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * @var definition |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @param string $_charset |
81 | 81 | * @param definition $_definition |
82 | 82 | */ |
83 | - public function import( $_stream, importexport_definition $_definition ) { |
|
84 | - $import_csv = new importexport_import_csv( $_stream, array( |
|
83 | + public function import($_stream, importexport_definition $_definition) { |
|
84 | + $import_csv = new importexport_import_csv($_stream, array( |
|
85 | 85 | 'fieldsep' => $_definition->plugin_options['fieldsep'], |
86 | 86 | 'charset' => $_definition->plugin_options['charset'], |
87 | 87 | )); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $this->definition = $_definition; |
90 | 90 | |
91 | 91 | // dry run? |
92 | - $this->dry_run = isset( $_definition->plugin_options['dry_run'] ) ? $_definition->plugin_options['dry_run'] : false; |
|
92 | + $this->dry_run = isset($_definition->plugin_options['dry_run']) ? $_definition->plugin_options['dry_run'] : false; |
|
93 | 93 | |
94 | 94 | // set FieldMapping. |
95 | 95 | $import_csv->mapping = $_definition->plugin_options['field_mapping']; |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | $import_csv->conversion = $_definition->plugin_options['field_conversion']; |
99 | 99 | |
100 | 100 | //check if file has a header lines |
101 | - if ( isset( $_definition->plugin_options['num_header_lines'] ) && $_definition->plugin_options['num_header_lines'] > 0) { |
|
101 | + if (isset($_definition->plugin_options['num_header_lines']) && $_definition->plugin_options['num_header_lines'] > 0) { |
|
102 | 102 | $import_csv->skip_records($_definition->plugin_options['num_header_lines']); |
103 | - } elseif(isset($_definition->plugin_options['has_header_line']) && $_definition->plugin_options['has_header_line']) { |
|
103 | + } elseif (isset($_definition->plugin_options['has_header_line']) && $_definition->plugin_options['has_header_line']) { |
|
104 | 104 | // First method is preferred |
105 | 105 | $import_csv->skip_records(1); |
106 | 106 | } |
@@ -112,22 +112,22 @@ discard block |
||
112 | 112 | // Failures |
113 | 113 | $this->errors = array(); |
114 | 114 | |
115 | - while ( $record = $import_csv->get_record() ) { |
|
115 | + while ($record = $import_csv->get_record()) { |
|
116 | 116 | $success = false; |
117 | 117 | // don't import empty records |
118 | - if( count( array_unique( $record ) ) < 2 ) continue; |
|
118 | + if (count(array_unique($record)) < 2) continue; |
|
119 | 119 | |
120 | 120 | importexport_import_csv::convert($record, admin_egw_group_record::$types, 'admin'); |
121 | 121 | |
122 | - if ( $_definition->plugin_options['conditions'] ) { |
|
123 | - foreach ( $_definition->plugin_options['conditions'] as $condition ) { |
|
124 | - switch ( $condition['type'] ) { |
|
122 | + if ($_definition->plugin_options['conditions']) { |
|
123 | + foreach ($_definition->plugin_options['conditions'] as $condition) { |
|
124 | + switch ($condition['type']) { |
|
125 | 125 | // exists |
126 | 126 | case 'exists' : |
127 | 127 | $accounts = array(); |
128 | 128 | |
129 | 129 | // Skip the search if the field is empty |
130 | - if($record[$condition['string']] !== '') { |
|
130 | + if ($record[$condition['string']] !== '') { |
|
131 | 131 | |
132 | 132 | $accounts = $GLOBALS['egw']->accounts->search(array( |
133 | 133 | 'type' => 'groups', |
@@ -136,25 +136,25 @@ discard block |
||
136 | 136 | )); |
137 | 137 | } |
138 | 138 | // Search looks in the given field, but doesn't do an exact match |
139 | - foreach ( (array)$accounts as $key => $account ) |
|
139 | + foreach ((array)$accounts as $key => $account) |
|
140 | 140 | { |
141 | - if($account[$condition['string']] != $record[$condition['string']]) unset($accounts[$key]); |
|
141 | + if ($account[$condition['string']] != $record[$condition['string']]) unset($accounts[$key]); |
|
142 | 142 | } |
143 | - if ( is_array( $accounts ) && count( $accounts ) >= 1 ) { |
|
143 | + if (is_array($accounts) && count($accounts) >= 1) { |
|
144 | 144 | $account = current($accounts); |
145 | 145 | // apply action to all contacts matching this exists condition |
146 | 146 | $action = $condition['true']; |
147 | - foreach ( (array)$accounts as $account ) { |
|
147 | + foreach ((array)$accounts as $account) { |
|
148 | 148 | // Read full account, and copy needed info for accounts->save() |
149 | 149 | $account = $GLOBALS['egw']->accounts->read($account['account_id']); |
150 | 150 | $record['account_id'] = $account['account_id']; |
151 | 151 | $record['account_firstname'] = $account['account_firstname']; |
152 | 152 | $record['account_lastname'] = $account['account_lastname']; |
153 | - $success = $this->action( $action['action'], $record, $import_csv->get_current_position() ); |
|
153 | + $success = $this->action($action['action'], $record, $import_csv->get_current_position()); |
|
154 | 154 | } |
155 | 155 | } else { |
156 | 156 | $action = $condition['false']; |
157 | - $success = ($this->action( $action['action'], $record, $import_csv->get_current_position() )); |
|
157 | + $success = ($this->action($action['action'], $record, $import_csv->get_current_position())); |
|
158 | 158 | } |
159 | 159 | break; |
160 | 160 | |
@@ -167,9 +167,9 @@ discard block |
||
167 | 167 | } |
168 | 168 | } else { |
169 | 169 | // unconditional insert |
170 | - $success = $this->action( 'insert', $record, $import_csv->get_current_position() ); |
|
170 | + $success = $this->action('insert', $record, $import_csv->get_current_position()); |
|
171 | 171 | } |
172 | - if($success) $count++; |
|
172 | + if ($success) $count++; |
|
173 | 173 | } |
174 | 174 | return $count; |
175 | 175 | } |
@@ -181,18 +181,18 @@ discard block |
||
181 | 181 | * @param array $_data contact data for the action |
182 | 182 | * @return bool success or not |
183 | 183 | */ |
184 | - private function action ( $_action, $_data, $record_num = 0 ) { |
|
184 | + private function action($_action, $_data, $record_num = 0) { |
|
185 | 185 | switch ($_action) { |
186 | 186 | case 'none' : |
187 | 187 | return true; |
188 | 188 | case 'update' : |
189 | 189 | case 'create' : |
190 | - if(count($_data['account_members']) < 1) { |
|
190 | + if (count($_data['account_members']) < 1) { |
|
191 | 191 | $this->errors[$record_num] = lang('You must select at least one group member.'); |
192 | 192 | return false; |
193 | 193 | } |
194 | 194 | $command = new admin_cmd_edit_group($_action == 'create' ? false : $_data['account_lid'], $_data); |
195 | - if($this->dry_run) { |
|
195 | + if ($this->dry_run) { |
|
196 | 196 | $this->results[$_action]++; |
197 | 197 | return true; |
198 | 198 | } |
@@ -104,8 +104,7 @@ |
||
104 | 104 | /** |
105 | 105 | * imports entries according to given definition object. |
106 | 106 | * @param resource $_stream |
107 | - * @param string $_charset |
|
108 | - * @param definition $_definition |
|
107 | + * @param importexport_definition $_definition |
|
109 | 108 | */ |
110 | 109 | public function import( $_stream, importexport_definition $_definition ) { |
111 | 110 | $import_csv = new importexport_import_csv( $_stream, array( |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | protected $errors = array(); |
70 | 70 | |
71 | 71 | /** |
72 | - * List of actions, and how many times that action was taken |
|
73 | - */ |
|
74 | - protected $results = array(); |
|
72 | + * List of actions, and how many times that action was taken |
|
73 | + */ |
|
74 | + protected $results = array(); |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * imports entries according to given definition object. |
@@ -262,39 +262,39 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
265 | - * Returns warnings that were encountered during importing |
|
266 | - * Maximum of one warning message per record, but you can concatenate them if you need to |
|
267 | - * |
|
268 | - * @return Array ( |
|
269 | - * record_# => warning message |
|
270 | - * ) |
|
271 | - */ |
|
265 | + * Returns warnings that were encountered during importing |
|
266 | + * Maximum of one warning message per record, but you can concatenate them if you need to |
|
267 | + * |
|
268 | + * @return Array ( |
|
269 | + * record_# => warning message |
|
270 | + * ) |
|
271 | + */ |
|
272 | 272 | public function get_warnings() { |
273 | 273 | return $this->warnings; |
274 | 274 | } |
275 | 275 | |
276 | 276 | /** |
277 | - * Returns errors that were encountered during importing |
|
278 | - * Maximum of one error message per record, but you can append if you need to |
|
279 | - * |
|
280 | - * @return Array ( |
|
281 | - * record_# => error message |
|
282 | - * ) |
|
283 | - */ |
|
284 | - public function get_errors() { |
|
277 | + * Returns errors that were encountered during importing |
|
278 | + * Maximum of one error message per record, but you can append if you need to |
|
279 | + * |
|
280 | + * @return Array ( |
|
281 | + * record_# => error message |
|
282 | + * ) |
|
283 | + */ |
|
284 | + public function get_errors() { |
|
285 | 285 | return $this->errors; |
286 | 286 | } |
287 | 287 | |
288 | 288 | /** |
289 | - * Returns a list of actions taken, and the number of records for that action. |
|
290 | - * Actions are things like 'insert', 'update', 'delete', and may be different for each plugin. |
|
291 | - * |
|
292 | - * @return Array ( |
|
293 | - * action => record count |
|
294 | - * ) |
|
295 | - */ |
|
296 | - public function get_results() { |
|
297 | - return $this->results; |
|
298 | - } |
|
289 | + * Returns a list of actions taken, and the number of records for that action. |
|
290 | + * Actions are things like 'insert', 'update', 'delete', and may be different for each plugin. |
|
291 | + * |
|
292 | + * @return Array ( |
|
293 | + * action => record count |
|
294 | + * ) |
|
295 | + */ |
|
296 | + public function get_results() { |
|
297 | + return $this->results; |
|
298 | + } |
|
299 | 299 | } // end of iface_export_plugin |
300 | 300 | ?> |
@@ -14,7 +14,8 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * class import_csv for admin (groups) |
16 | 16 | */ |
17 | -class admin_import_groups_csv implements importexport_iface_import_plugin { |
|
17 | +class admin_import_groups_csv implements importexport_iface_import_plugin |
|
18 | +{ |
|
18 | 19 | |
19 | 20 | private static $plugin_options = array( |
20 | 21 | 'fieldsep', // char |
@@ -79,7 +80,8 @@ discard block |
||
79 | 80 | * @param string $_charset |
80 | 81 | * @param definition $_definition |
81 | 82 | */ |
82 | - public function import( $_stream, importexport_definition $_definition ) { |
|
83 | + public function import( $_stream, importexport_definition $_definition ) |
|
84 | + { |
|
83 | 85 | $import_csv = new importexport_import_csv( $_stream, array( |
84 | 86 | 'fieldsep' => $_definition->plugin_options['fieldsep'], |
85 | 87 | 'charset' => $_definition->plugin_options['charset'], |
@@ -97,9 +99,12 @@ discard block |
||
97 | 99 | $import_csv->conversion = $_definition->plugin_options['field_conversion']; |
98 | 100 | |
99 | 101 | //check if file has a header lines |
100 | - if ( isset( $_definition->plugin_options['num_header_lines'] ) && $_definition->plugin_options['num_header_lines'] > 0) { |
|
102 | + if ( isset( $_definition->plugin_options['num_header_lines'] ) && $_definition->plugin_options['num_header_lines'] > 0) |
|
103 | + { |
|
101 | 104 | $import_csv->skip_records($_definition->plugin_options['num_header_lines']); |
102 | - } elseif(isset($_definition->plugin_options['has_header_line']) && $_definition->plugin_options['has_header_line']) { |
|
105 | + } |
|
106 | + elseif(isset($_definition->plugin_options['has_header_line']) && $_definition->plugin_options['has_header_line']) |
|
107 | + { |
|
103 | 108 | // First method is preferred |
104 | 109 | $import_csv->skip_records(1); |
105 | 110 | } |
@@ -111,22 +116,30 @@ discard block |
||
111 | 116 | // Failures |
112 | 117 | $this->errors = array(); |
113 | 118 | |
114 | - while ( $record = $import_csv->get_record() ) { |
|
119 | + while ( $record = $import_csv->get_record() ) |
|
120 | + { |
|
115 | 121 | $success = false; |
116 | 122 | // don't import empty records |
117 | - if( count( array_unique( $record ) ) < 2 ) continue; |
|
123 | + if( count( array_unique( $record ) ) < 2 ) |
|
124 | + { |
|
125 | + continue; |
|
126 | + } |
|
118 | 127 | |
119 | 128 | importexport_import_csv::convert($record, admin_egw_group_record::$types, 'admin'); |
120 | 129 | |
121 | - if ( $_definition->plugin_options['conditions'] ) { |
|
122 | - foreach ( $_definition->plugin_options['conditions'] as $condition ) { |
|
123 | - switch ( $condition['type'] ) { |
|
130 | + if ( $_definition->plugin_options['conditions'] ) |
|
131 | + { |
|
132 | + foreach ( $_definition->plugin_options['conditions'] as $condition ) |
|
133 | + { |
|
134 | + switch ( $condition['type'] ) |
|
135 | + { |
|
124 | 136 | // exists |
125 | 137 | case 'exists' : |
126 | 138 | $accounts = array(); |
127 | 139 | |
128 | 140 | // Skip the search if the field is empty |
129 | - if($record[$condition['string']] !== '') { |
|
141 | + if($record[$condition['string']] !== '') |
|
142 | + { |
|
130 | 143 | |
131 | 144 | $accounts = $GLOBALS['egw']->accounts->search(array( |
132 | 145 | 'type' => 'groups', |
@@ -137,13 +150,18 @@ discard block |
||
137 | 150 | // Search looks in the given field, but doesn't do an exact match |
138 | 151 | foreach ( (array)$accounts as $key => $account ) |
139 | 152 | { |
140 | - if($account[$condition['string']] != $record[$condition['string']]) unset($accounts[$key]); |
|
153 | + if($account[$condition['string']] != $record[$condition['string']]) |
|
154 | + { |
|
155 | + unset($accounts[$key]); |
|
156 | + } |
|
141 | 157 | } |
142 | - if ( is_array( $accounts ) && count( $accounts ) >= 1 ) { |
|
158 | + if ( is_array( $accounts ) && count( $accounts ) >= 1 ) |
|
159 | + { |
|
143 | 160 | $account = current($accounts); |
144 | 161 | // apply action to all contacts matching this exists condition |
145 | 162 | $action = $condition['true']; |
146 | - foreach ( (array)$accounts as $account ) { |
|
163 | + foreach ( (array)$accounts as $account ) |
|
164 | + { |
|
147 | 165 | // Read full account, and copy needed info for accounts->save() |
148 | 166 | $account = $GLOBALS['egw']->accounts->read($account['account_id']); |
149 | 167 | $record['account_id'] = $account['account_id']; |
@@ -151,7 +169,9 @@ discard block |
||
151 | 169 | $record['account_lastname'] = $account['account_lastname']; |
152 | 170 | $success = $this->action( $action['action'], $record, $import_csv->get_current_position() ); |
153 | 171 | } |
154 | - } else { |
|
172 | + } |
|
173 | + else |
|
174 | + { |
|
155 | 175 | $action = $condition['false']; |
156 | 176 | $success = ($this->action( $action['action'], $record, $import_csv->get_current_position() )); |
157 | 177 | } |
@@ -162,13 +182,21 @@ discard block |
||
162 | 182 | die('condition / action not supported!!!'); |
163 | 183 | break; |
164 | 184 | } |
165 | - if ($action['last']) break; |
|
185 | + if ($action['last']) |
|
186 | + { |
|
187 | + break; |
|
188 | + } |
|
166 | 189 | } |
167 | - } else { |
|
190 | + } |
|
191 | + else |
|
192 | + { |
|
168 | 193 | // unconditional insert |
169 | 194 | $success = $this->action( 'insert', $record, $import_csv->get_current_position() ); |
170 | 195 | } |
171 | - if($success) $count++; |
|
196 | + if($success) |
|
197 | + { |
|
198 | + $count++; |
|
199 | + } |
|
172 | 200 | } |
173 | 201 | return $count; |
174 | 202 | } |
@@ -180,24 +208,29 @@ discard block |
||
180 | 208 | * @param array $_data contact data for the action |
181 | 209 | * @return bool success or not |
182 | 210 | */ |
183 | - private function action ( $_action, $_data, $record_num = 0 ) { |
|
184 | - switch ($_action) { |
|
211 | + private function action ( $_action, $_data, $record_num = 0 ) |
|
212 | + { |
|
213 | + switch ($_action) |
|
214 | + { |
|
185 | 215 | case 'none' : |
186 | 216 | return true; |
187 | 217 | case 'update' : |
188 | 218 | case 'create' : |
189 | - if(count($_data['account_members']) < 1) { |
|
219 | + if(count($_data['account_members']) < 1) |
|
220 | + { |
|
190 | 221 | $this->errors[$record_num] = lang('You must select at least one group member.'); |
191 | 222 | return false; |
192 | 223 | } |
193 | 224 | $command = new admin_cmd_edit_group($_action == 'create' ? false : $_data['account_lid'], $_data); |
194 | - if($this->dry_run) { |
|
225 | + if($this->dry_run) |
|
226 | + { |
|
195 | 227 | $this->results[$_action]++; |
196 | 228 | return true; |
197 | 229 | } |
198 | 230 | try { |
199 | 231 | $command->run(); |
200 | - } catch (Exception $e) { |
|
232 | + } |
|
233 | + catch (Exception $e) { |
|
201 | 234 | $this->errors[$record_num] = $e->getMessage(); |
202 | 235 | return false; |
203 | 236 | } |
@@ -214,7 +247,8 @@ discard block |
||
214 | 247 | * |
215 | 248 | * @return string name |
216 | 249 | */ |
217 | - public static function get_name() { |
|
250 | + public static function get_name() |
|
251 | + { |
|
218 | 252 | return lang('Group CSV import'); |
219 | 253 | } |
220 | 254 | |
@@ -223,7 +257,8 @@ discard block |
||
223 | 257 | * |
224 | 258 | * @return string descriprion |
225 | 259 | */ |
226 | - public static function get_description() { |
|
260 | + public static function get_description() |
|
261 | + { |
|
227 | 262 | return lang("Creates / updates user groups from CSV file"); |
228 | 263 | } |
229 | 264 | |
@@ -232,7 +267,8 @@ discard block |
||
232 | 267 | * |
233 | 268 | * @return string suffix (comma seperated) |
234 | 269 | */ |
235 | - public static function get_filesuffix() { |
|
270 | + public static function get_filesuffix() |
|
271 | + { |
|
236 | 272 | return 'csv'; |
237 | 273 | } |
238 | 274 | |
@@ -248,7 +284,8 @@ discard block |
||
248 | 284 | * preserv => array, |
249 | 285 | * ) |
250 | 286 | */ |
251 | - public function get_options_etpl() { |
|
287 | + public function get_options_etpl() |
|
288 | + { |
|
252 | 289 | // lets do it! |
253 | 290 | } |
254 | 291 | |
@@ -257,7 +294,8 @@ discard block |
||
257 | 294 | * |
258 | 295 | * @return string etemplate name |
259 | 296 | */ |
260 | - public function get_selectors_etpl() { |
|
297 | + public function get_selectors_etpl() |
|
298 | + { |
|
261 | 299 | // lets do it! |
262 | 300 | } |
263 | 301 | |
@@ -269,7 +307,8 @@ discard block |
||
269 | 307 | * record_# => warning message |
270 | 308 | * ) |
271 | 309 | */ |
272 | - public function get_warnings() { |
|
310 | + public function get_warnings() |
|
311 | + { |
|
273 | 312 | return $this->warnings; |
274 | 313 | } |
275 | 314 | |
@@ -281,7 +320,8 @@ discard block |
||
281 | 320 | * record_# => error message |
282 | 321 | * ) |
283 | 322 | */ |
284 | - public function get_errors() { |
|
323 | + public function get_errors() |
|
324 | + { |
|
285 | 325 | return $this->errors; |
286 | 326 | } |
287 | 327 | |
@@ -293,7 +333,8 @@ discard block |
||
293 | 333 | * action => record count |
294 | 334 | * ) |
295 | 335 | */ |
296 | - public function get_results() { |
|
336 | + public function get_results() |
|
337 | + { |
|
297 | 338 | return $this->results; |
298 | 339 | } |
299 | 340 | } // end of iface_export_plugin |
@@ -59,7 +59,7 @@ |
||
59 | 59 | function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv) |
60 | 60 | { |
61 | 61 | $result = parent::wizard_step50($content, $sel_options, $readonlys, $preserv); |
62 | - $content['msg'] .= "\n*" ; |
|
62 | + $content['msg'] .= "\n*"; |
|
63 | 63 | |
64 | 64 | return $result; |
65 | 65 | } |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | |
14 | 14 | if (!defined('TIMESHEET_APP')) |
15 | 15 | { |
16 | - define('TIMESHEET_APP','timesheet'); |
|
16 | + define('TIMESHEET_APP', 'timesheet'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | $setup_info[TIMESHEET_APP]['name'] = TIMESHEET_APP; |
20 | 20 | $setup_info[TIMESHEET_APP]['version'] = '16.1'; |
21 | 21 | $setup_info[TIMESHEET_APP]['app_order'] = 5; |
22 | -$setup_info[TIMESHEET_APP]['tables'] = array('egw_timesheet','egw_timesheet_extra'); |
|
22 | +$setup_info[TIMESHEET_APP]['tables'] = array('egw_timesheet', 'egw_timesheet_extra'); |
|
23 | 23 | $setup_info[TIMESHEET_APP]['enable'] = 1; |
24 | 24 | $setup_info[TIMESHEET_APP]['index'] = 'timesheet.timesheet_ui.index&ajax=true'; |
25 | 25 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | 'name' => 'Ralf Becker', |
29 | 29 | 'email' => '[email protected]' |
30 | 30 | ); |
31 | -$setup_info[TIMESHEET_APP]['license'] = 'GPL'; |
|
31 | +$setup_info[TIMESHEET_APP]['license'] = 'GPL'; |
|
32 | 32 | $setup_info[TIMESHEET_APP]['description'] = |
33 | 33 | 'Tracking times and other activities for the Projectmanager.'; |
34 | 34 | $setup_info[TIMESHEET_APP]['note'] = |
@@ -37,11 +37,11 @@ |
||
37 | 37 | /* Dependencies for this app to work */ |
38 | 38 | $setup_info['importexport']['depends'][] = array( |
39 | 39 | 'appname' => 'phpgwapi', |
40 | - 'versions' => Array('14.1') |
|
40 | + 'versions' => array('14.1') |
|
41 | 41 | ); |
42 | 42 | $setup_info['importexport']['depends'][] = array( |
43 | 43 | 'appname' => 'etemplate', |
44 | - 'versions' => Array('14.1') |
|
44 | + 'versions' => array('14.1') |
|
45 | 45 | ); |
46 | 46 | |
47 | 47 | // installation checks for importexport |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | function timesheet_upgrade0_1_001() |
17 | 17 | { |
18 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_timesheet','pl_id',array( |
|
18 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_timesheet', 'pl_id', array( |
|
19 | 19 | 'type' => 'int', |
20 | 20 | 'precision' => '4', |
21 | 21 | 'default' => '0' |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | |
28 | 28 | function timesheet_upgrade0_2_001() |
29 | 29 | { |
30 | - $GLOBALS['egw_setup']->oProc->CreateTable('egw_timesheet_extra',array( |
|
30 | + $GLOBALS['egw_setup']->oProc->CreateTable('egw_timesheet_extra', array( |
|
31 | 31 | 'fd' => array( |
32 | - 'ts_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
33 | - 'ts_extra_name' => array('type' => 'varchar','precision' => '32','nullable' => False), |
|
34 | - 'ts_extra_value' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '') |
|
32 | + 'ts_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
33 | + 'ts_extra_name' => array('type' => 'varchar', 'precision' => '32', 'nullable' => False), |
|
34 | + 'ts_extra_value' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '') |
|
35 | 35 | ), |
36 | - 'pk' => array('ts_id','ts_extra_name'), |
|
36 | + 'pk' => array('ts_id', 'ts_extra_name'), |
|
37 | 37 | 'fk' => array(), |
38 | 38 | 'ix' => array(), |
39 | 39 | 'uc' => array() |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | function timesheet_upgrade1_4() |
53 | 53 | { |
54 | 54 | // delete empty cf's generated by 1.4 |
55 | - $GLOBALS['egw_setup']->db->delete('egw_timesheet_extra',"ts_extra_value=''",__LINE__,__FILE__,'timesheet'); |
|
55 | + $GLOBALS['egw_setup']->db->delete('egw_timesheet_extra', "ts_extra_value=''", __LINE__, __FILE__, 'timesheet'); |
|
56 | 56 | |
57 | 57 | return $GLOBALS['setup_info']['timesheet']['currentver'] = '1.6'; |
58 | 58 | } |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | |
61 | 61 | function timesheet_upgrade1_6() |
62 | 62 | { |
63 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_timesheet','ts_status',array( |
|
63 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_timesheet', 'ts_status', array( |
|
64 | 64 | 'type' => 'int', |
65 | 65 | 'precision' => '4' |
66 | 66 | )); |
67 | 67 | |
68 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_timesheet','ts_status'); |
|
68 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_timesheet', 'ts_status'); |
|
69 | 69 | |
70 | 70 | return $GLOBALS['setup_info']['timesheet']['currentver'] = '1.7.001'; |
71 | 71 | } |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | */ |
93 | 93 | function timesheet_upgrade1_9_001() |
94 | 94 | { |
95 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_timesheet','ts_project',array( |
|
95 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_timesheet', 'ts_project', array( |
|
96 | 96 | 'type' => 'varchar', |
97 | 97 | 'precision' => '255', |
98 | 98 | 'comment' => 'project title' |
99 | 99 | )); |
100 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_timesheet','ts_title',array( |
|
100 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_timesheet', 'ts_title', array( |
|
101 | 101 | 'type' => 'varchar', |
102 | 102 | 'precision' => '255', |
103 | 103 | 'nullable' => False, |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | // returns NULL, if there are no rows! |
109 | 109 | if ((int)$max_description_length <= 16384 && $GLOBALS['egw_setup']->oProc->max_varchar_length >= 16384) |
110 | 110 | { |
111 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_timesheet','ts_description',array( |
|
111 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_timesheet', 'ts_description', array( |
|
112 | 112 | 'type' => 'varchar', |
113 | 113 | 'precision' => '16384', |
114 | 114 | 'comment' => 'description of the timesheet entry' |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @version $Id$ |
10 | 10 | */ |
11 | 11 | |
12 | -foreach(array( |
|
12 | +foreach (array( |
|
13 | 13 | 'history' => 'history', |
14 | 14 | ) as $name => $value) |
15 | 15 | { |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | 'config_app' => 'timesheet', |
20 | 20 | 'config_name' => $name, |
21 | 21 | 'config_value' => $value, |
22 | - ),array( |
|
22 | + ), array( |
|
23 | 23 | 'config_app' => 'timesheet', |
24 | 24 | 'config_name' => $name, |
25 | - ),__LINE__,__FILE__ |
|
25 | + ), __LINE__, __FILE__ |
|
26 | 26 | ); |
27 | 27 | } |
28 | 28 |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | $this->mapping_fields = array('ts_id' => lang('Timesheet ID')) + $bo->field2label; |
36 | 36 | |
37 | 37 | // These aren't in the list |
38 | - $this->mapping_fields += array( |
|
39 | - 'ts_modified' => lang('Modified'), |
|
40 | - ); |
|
38 | + $this->mapping_fields += array( |
|
39 | + 'ts_modified' => lang('Modified'), |
|
40 | + ); |
|
41 | 41 | |
42 | 42 | // List each custom field |
43 | 43 | unset($this->mapping_fields['customfields']); |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | ); |
114 | 114 | } |
115 | 115 | $sel_options = array( |
116 | - 'translate_status' => $options + array($set_to => $ui->status_labels), |
|
117 | - 'translate_cat_id' => $options + array($set_to => $cat_list), |
|
118 | - ); |
|
116 | + 'translate_status' => $options + array($set_to => $ui->status_labels), |
|
117 | + 'translate_cat_id' => $options + array($set_to => $cat_list), |
|
118 | + ); |
|
119 | 119 | $preserv = $content; |
120 | 120 | foreach($sel_options as $field => $options) { |
121 | 121 | if(!array_key_exists($field,$content)) $content[$field] = $content['plugin_options'][$field]; |
@@ -42,7 +42,8 @@ discard block |
||
42 | 42 | // List each custom field |
43 | 43 | unset($this->mapping_fields['customfields']); |
44 | 44 | $custom = Api\Storage\Customfields::get('timesheet'); |
45 | - foreach($custom as $name => $data) { |
|
45 | + foreach($custom as $name => $data) |
|
46 | + { |
|
46 | 47 | $this->mapping_fields['#'.$name] = $data['label']; |
47 | 48 | } |
48 | 49 | |
@@ -72,7 +73,10 @@ discard block |
||
72 | 73 | |
73 | 74 | function wizard_step45(&$content, &$sel_options, &$readonlys, &$preserv) |
74 | 75 | { |
75 | - if($this->debug) error_log(__METHOD__.'->$content '.print_r($content,true)); |
|
76 | + if($this->debug) |
|
77 | + { |
|
78 | + error_log(__METHOD__.'->$content '.print_r($content,true)); |
|
79 | + } |
|
76 | 80 | |
77 | 81 | // return from step45 |
78 | 82 | if ($content['step'] == 'wizard_step45') |
@@ -104,7 +108,8 @@ discard block |
||
104 | 108 | $set_to = lang('Set to') . ':'; |
105 | 109 | $categories = new Api\Categories('','timesheet'); |
106 | 110 | $cat_list = array(); |
107 | - foreach((array)$categories->return_sorted_array(0,False,'','','',true) as $cat) { |
|
111 | + foreach((array)$categories->return_sorted_array(0,False,'','','',true) as $cat) |
|
112 | + { |
|
108 | 113 | $s = str_repeat(' ',$cat['level']) . stripslashes($cat['name']); |
109 | 114 | |
110 | 115 | $cat_list[$cat['id']] = empty($cat['description']) ? $s : array( |
@@ -117,8 +122,12 @@ discard block |
||
117 | 122 | 'translate_cat_id' => $options + array($set_to => $cat_list), |
118 | 123 | ); |
119 | 124 | $preserv = $content; |
120 | - foreach($sel_options as $field => $options) { |
|
121 | - if(!array_key_exists($field,$content)) $content[$field] = $content['plugin_options'][$field]; |
|
125 | + foreach($sel_options as $field => $options) |
|
126 | + { |
|
127 | + if(!array_key_exists($field,$content)) |
|
128 | + { |
|
129 | + $content[$field] = $content['plugin_options'][$field]; |
|
130 | + } |
|
122 | 131 | } |
123 | 132 | unset ($preserv['button']); |
124 | 133 | return $this->step_templates['wizard_step45']; |
@@ -134,7 +143,10 @@ discard block |
||
134 | 143 | |
135 | 144 | function wizard_step60(&$content, &$sel_options, &$readonlys, &$preserv) |
136 | 145 | { |
137 | - if($this->debug) error_log(__METHOD__.'->$content '.print_r($content,true)); |
|
146 | + if($this->debug) |
|
147 | + { |
|
148 | + error_log(__METHOD__.'->$content '.print_r($content,true)); |
|
149 | + } |
|
138 | 150 | unset($content['no_owner_map']); |
139 | 151 | |
140 | 152 | // return from step60 |
@@ -158,17 +170,21 @@ discard block |
||
158 | 170 | $content['msg'] = $this->steps['wizard_step60']; |
159 | 171 | $content['step'] = 'wizard_step60'; |
160 | 172 | $preserv = $content; |
161 | - if(!array_key_exists($content['record_owner']) && $content['plugin_options']) { |
|
173 | + if(!array_key_exists($content['record_owner']) && $content['plugin_options']) |
|
174 | + { |
|
162 | 175 | $content['record_owner'] = $content['plugin_options']['record_owner']; |
163 | 176 | } |
164 | - if(!array_key_exists($content['owner_from_csv']) && $content['plugin_options']) { |
|
177 | + if(!array_key_exists($content['owner_from_csv']) && $content['plugin_options']) |
|
178 | + { |
|
165 | 179 | $content['owner_from_csv'] = $content['plugin_options']['owner_from_csv']; |
166 | 180 | } |
167 | - if(!array_key_exists($content['change_owner']) && $content['plugin_options']) { |
|
181 | + if(!array_key_exists($content['change_owner']) && $content['plugin_options']) |
|
182 | + { |
|
168 | 183 | $content['change_owner'] = $content['plugin_options']['change_owner']; |
169 | 184 | } |
170 | 185 | |
171 | - if(!in_array('ts_owner', $content['field_mapping'])) { |
|
186 | + if(!in_array('ts_owner', $content['field_mapping'])) |
|
187 | + { |
|
172 | 188 | $content['no_owner_map'] = true; |
173 | 189 | } |
174 | 190 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | // List each custom field |
41 | 41 | unset($this->mapping_fields['customfields']); |
42 | 42 | $custom = config::get_customfields('timesheet'); |
43 | - foreach($custom as $name => $data) { |
|
43 | + foreach ($custom as $name => $data) { |
|
44 | 44 | $this->mapping_fields['#'.$name] = $data['label']; |
45 | 45 | } |
46 | 46 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | function wizard_step45(&$content, &$sel_options, &$readonlys, &$preserv) |
72 | 72 | { |
73 | - if($this->debug) error_log(__METHOD__.'->$content '.print_r($content,true)); |
|
73 | + if ($this->debug) error_log(__METHOD__.'->$content '.print_r($content, true)); |
|
74 | 74 | |
75 | 75 | // return from step45 |
76 | 76 | if ($content['step'] == 'wizard_step45') |
@@ -78,13 +78,13 @@ discard block |
||
78 | 78 | switch (array_search('pressed', $content['button'])) |
79 | 79 | { |
80 | 80 | case 'next': |
81 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1); |
|
81 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], 1); |
|
82 | 82 | case 'previous' : |
83 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1); |
|
83 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], -1); |
|
84 | 84 | case 'finish': |
85 | 85 | return 'wizard_finish'; |
86 | 86 | default : |
87 | - return $this->wizard_step45($content,$sel_options,$readonlys,$preserv); |
|
87 | + return $this->wizard_step45($content, $sel_options, $readonlys, $preserv); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | // init step45 |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | '~skip~' => lang('Skip record'), |
100 | 100 | 'add' => lang('Add'), |
101 | 101 | ); |
102 | - $set_to = lang('Set to') . ':'; |
|
103 | - $categories = new categories('','timesheet'); |
|
102 | + $set_to = lang('Set to').':'; |
|
103 | + $categories = new categories('', 'timesheet'); |
|
104 | 104 | $cat_list = array(); |
105 | - foreach((array)$categories->return_sorted_array(0,False,'','','',true) as $cat) { |
|
106 | - $s = str_repeat(' ',$cat['level']) . stripslashes($cat['name']); |
|
105 | + foreach ((array)$categories->return_sorted_array(0, False, '', '', '', true) as $cat) { |
|
106 | + $s = str_repeat(' ', $cat['level']).stripslashes($cat['name']); |
|
107 | 107 | |
108 | 108 | $cat_list[$cat['id']] = empty($cat['description']) ? $s : array( |
109 | 109 | 'label' => $s, |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | 'translate_cat_id' => $options + array($set_to => $cat_list), |
116 | 116 | ); |
117 | 117 | $preserv = $content; |
118 | - foreach($sel_options as $field => $options) { |
|
119 | - if(!array_key_exists($field,$content)) $content[$field] = $content['plugin_options'][$field]; |
|
118 | + foreach ($sel_options as $field => $options) { |
|
119 | + if (!array_key_exists($field, $content)) $content[$field] = $content['plugin_options'][$field]; |
|
120 | 120 | } |
121 | 121 | unset ($preserv['button']); |
122 | 122 | return $this->step_templates['wizard_step45']; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | function wizard_step60(&$content, &$sel_options, &$readonlys, &$preserv) |
134 | 134 | { |
135 | - if($this->debug) error_log(__METHOD__.'->$content '.print_r($content,true)); |
|
135 | + if ($this->debug) error_log(__METHOD__.'->$content '.print_r($content, true)); |
|
136 | 136 | unset($content['no_owner_map']); |
137 | 137 | |
138 | 138 | // return from step60 |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | switch (array_search('pressed', $content['button'])) |
142 | 142 | { |
143 | 143 | case 'next': |
144 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1); |
|
144 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], 1); |
|
145 | 145 | case 'previous' : |
146 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1); |
|
146 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], -1); |
|
147 | 147 | case 'finish': |
148 | 148 | return 'wizard_finish'; |
149 | 149 | default : |
150 | - return $this->wizard_step60($content,$sel_options,$readonlys,$preserv); |
|
150 | + return $this->wizard_step60($content, $sel_options, $readonlys, $preserv); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | // init step60 |
@@ -156,17 +156,17 @@ discard block |
||
156 | 156 | $content['msg'] = $this->steps['wizard_step60']; |
157 | 157 | $content['step'] = 'wizard_step60'; |
158 | 158 | $preserv = $content; |
159 | - if(!array_key_exists($content['record_owner']) && $content['plugin_options']) { |
|
159 | + if (!array_key_exists($content['record_owner']) && $content['plugin_options']) { |
|
160 | 160 | $content['record_owner'] = $content['plugin_options']['record_owner']; |
161 | 161 | } |
162 | - if(!array_key_exists($content['owner_from_csv']) && $content['plugin_options']) { |
|
162 | + if (!array_key_exists($content['owner_from_csv']) && $content['plugin_options']) { |
|
163 | 163 | $content['owner_from_csv'] = $content['plugin_options']['owner_from_csv']; |
164 | 164 | } |
165 | - if(!array_key_exists($content['change_owner']) && $content['plugin_options']) { |
|
165 | + if (!array_key_exists($content['change_owner']) && $content['plugin_options']) { |
|
166 | 166 | $content['change_owner'] = $content['plugin_options']['change_owner']; |
167 | 167 | } |
168 | 168 | |
169 | - if(!in_array('ts_owner', $content['field_mapping'])) { |
|
169 | + if (!in_array('ts_owner', $content['field_mapping'])) { |
|
170 | 170 | $content['no_owner_map'] = true; |
171 | 171 | } |
172 | 172 |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | |
74 | 74 | //set fields for tracking |
75 | 75 | $this->field2history = array_keys($this->bo->db_cols); |
76 | - $this->field2history = array_diff(array_combine($this->field2history,$this->field2history),array('ts_modified')); |
|
77 | - $this->field2history += array('customfields' => '#c'); // to display old customfield data in history |
|
76 | + $this->field2history = array_diff(array_combine($this->field2history, $this->field2history), array('ts_modified')); |
|
77 | + $this->field2history += array('customfields' => '#c'); // to display old customfield data in history |
|
78 | 78 | |
79 | 79 | // custom fields are now handled by parent::__construct('tracker') |
80 | 80 | parent::__construct('timesheet'); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @param array $old =null old/last state of the entry or null for a new entry |
92 | 92 | * @return mixed |
93 | 93 | */ |
94 | - function get_config($name,$data,$old=null) |
|
94 | + function get_config($name, $data, $old = null) |
|
95 | 95 | { |
96 | 96 | $timesheet = $data['ts_id']; |
97 | 97 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @param array $old |
110 | 110 | * @return string |
111 | 111 | */ |
112 | - function get_subject($data,$old) |
|
112 | + function get_subject($data, $old) |
|
113 | 113 | { |
114 | 114 | return '#'.$data['ts_id'].' - '.$data['ts_title']; |
115 | 115 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @param array $old |
122 | 122 | * @return string |
123 | 123 | */ |
124 | - function get_message($data,$old) |
|
124 | + function get_message($data, $old) |
|
125 | 125 | { |
126 | 126 | if (!$data['ts_modified'] || !$old) |
127 | 127 | { |
@@ -62,7 +62,6 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * Constructor |
64 | 64 | * |
65 | - * @param timesheet_bo $botimesheet |
|
66 | 65 | * @return timesheet_tracking |
67 | 66 | */ |
68 | 67 | function __construct(timesheet_bo $bo) |
@@ -81,12 +80,7 @@ discard block |
||
81 | 80 | /** |
82 | 81 | * Get a notification-config value |
83 | 82 | * |
84 | - * @param string $what |
|
85 | - * - 'copy' array of email addresses notifications should be copied too, can depend on $data |
|
86 | - * - 'lang' string lang code for copy mail |
|
87 | - * - 'sender' string send email address |
|
88 | 83 | * @param array $data current entry |
89 | - * @param array $old=null old/last state of the entry or null for a new entry |
|
90 | 84 | * @return mixed |
91 | 85 | */ |
92 | 86 | function get_config($name,$data,$old=null) |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | ) |
21 | 21 | ); |
22 | 22 | |
23 | -ini_set('zlib.output_compression',0); |
|
23 | +ini_set('zlib.output_compression', 0); |
|
24 | 24 | include('../header.inc.php'); |
25 | 25 | |
26 | 26 | ob_start(); |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | check_load_extension('zip', true); |
29 | 29 | |
30 | 30 | $document = EGW_SERVER_ROOT.'/notifications/java/full-eGwNotifier.jar'; |
31 | -$archive = tempnam($GLOBALS['egw_info']['server']['temp_dir'], basename($document,'.jar').'-').'.jar'; |
|
32 | -$ret=copy($document, $archive); |
|
31 | +$archive = tempnam($GLOBALS['egw_info']['server']['temp_dir'], basename($document, '.jar').'-').'.jar'; |
|
32 | +$ret = copy($document, $archive); |
|
33 | 33 | error_log("copy('$document', '$archive' returned ".array2string($ret)); |
34 | 34 | $document = 'zip://'.$archive.'#'.($config_file = 'lib/conf/egwnotifier.const.xml'); |
35 | 35 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | function replace_callback($matches) |
40 | 40 | { |
41 | 41 | $replacement = $matches[3]; |
42 | - switch($matches[1]) |
|
42 | + switch ($matches[1]) |
|
43 | 43 | { |
44 | 44 | case 'egw_dc_url': |
45 | 45 | $replacement = $GLOBALS['egw_info']['server']['webserver_url']; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | case 'egw_debuging_level': |
61 | 61 | break; |
62 | 62 | default: |
63 | - $replacement = lang($r=$replacement); |
|
63 | + $replacement = lang($r = $replacement); |
|
64 | 64 | /* uncomment this to have missing translations add to en langfile |
65 | 65 | // if no translation found, check if en langfile is writable and add phrase, if not already there |
66 | 66 | if ($r === $replacement) |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | if (is_string($htmlscflags)) |
91 | 91 | { |
92 | - $htmlscflags = 16; // #define ENT_XML1 16 |
|
92 | + $htmlscflags = 16; // #define ENT_XML1 16 |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | return '<'.$matches[1].'>'.htmlspecialchars($replacement, $htmlscflags, Api\Translation::charset()).'</'.$matches[1].'>'; |
@@ -118,6 +118,6 @@ discard block |
||
118 | 118 | ob_end_clean(); |
119 | 119 | |
120 | 120 | Api\Header\Content::type('egroupware-notifier-'.$GLOBALS['egw_info']['user']['account_lid'].'.jar', 'application/x-java-archive', filesize($archive)); |
121 | -readfile($archive,'rb'); |
|
121 | +readfile($archive, 'rb'); |
|
122 | 122 | |
123 | 123 | @unlink($archive); |