@@ -47,7 +47,10 @@ discard block |
||
47 | 47 | function header(array $extra=array()) |
48 | 48 | { |
49 | 49 | // make sure header is output only once |
50 | - if (self::$header_done) return ''; |
|
50 | + if (self::$header_done) |
|
51 | + { |
|
52 | + return ''; |
|
53 | + } |
|
51 | 54 | self::$header_done = true; |
52 | 55 | |
53 | 56 | // js stuff is not needed by login page or in popups |
@@ -135,7 +138,11 @@ discard block |
||
135 | 138 | function footer() |
136 | 139 | { |
137 | 140 | static $footer_done=0; |
138 | - if ($footer_done++) return; // prevent multiple footers, not sure we still need this (RalfBecker) |
|
141 | + if ($footer_done++) |
|
142 | + { |
|
143 | + return; |
|
144 | + } |
|
145 | + // prevent multiple footers, not sure we still need this (RalfBecker) |
|
139 | 146 | |
140 | 147 | return "</body>\n</html>\n"; // close body and html tag, eg. for popups |
141 | 148 | } |
@@ -49,7 +49,10 @@ discard block |
||
49 | 49 | if (($remote = file_get_contents(self::CURRENT_VERSION_URL, false, Api\Framework::proxy_context()))) |
50 | 50 | { |
51 | 51 | list($current, $security) = explode("\n", $remote); |
52 | - if (empty($security)) $security = $current; |
|
52 | + if (empty($security)) |
|
53 | + { |
|
54 | + $security = $current; |
|
55 | + } |
|
53 | 56 | $versions = array( |
54 | 57 | 'current' => $current, // last maintenance update |
55 | 58 | 'security' => $security, // last security update |
@@ -114,7 +117,10 @@ discard block |
||
114 | 117 | protected static function update_older($version, $days) |
115 | 118 | { |
116 | 119 | list(,,$date) = explode('.', $version); |
117 | - if ($date < 20140000) return false; |
|
120 | + if ($date < 20140000) |
|
121 | + { |
|
122 | + return false; |
|
123 | + } |
|
118 | 124 | $version_timestamp = mktime(0, 0, 0, (int)substr($date, 4, 2), (int)substr($date, -2), (int)substr($date, 0, 4)); |
119 | 125 | |
120 | 126 | return (time() - $version_timestamp) / 86400 > $days; |
@@ -37,7 +37,11 @@ discard block |
||
37 | 37 | spl_autoload_register(function($class) |
38 | 38 | { |
39 | 39 | $parts = explode('\\', $class); |
40 | - if (array_shift($parts) != 'EGroupware') return; // not our prefix |
|
40 | + if (array_shift($parts) != 'EGroupware') |
|
41 | + { |
|
42 | + return; |
|
43 | + } |
|
44 | + // not our prefix |
|
41 | 45 | |
42 | 46 | $app = lcfirst(array_shift($parts)); |
43 | 47 | $base = EGW_INCLUDE_ROOT.'/'.$app.'/src/'; |
@@ -63,7 +67,10 @@ discard block |
||
63 | 67 | spl_autoload_register(function($class) |
64 | 68 | { |
65 | 69 | // fixing warnings generated by php 5.3.8 is_a($obj) trying to autoload huge strings |
66 | - if (strlen($class) > 64 || strpos($class, '.') !== false) return; |
|
70 | + if (strlen($class) > 64 || strpos($class, '.') !== false) |
|
71 | + { |
|
72 | + return; |
|
73 | + } |
|
67 | 74 | |
68 | 75 | $components = explode('_',$class); |
69 | 76 | $app = array_shift($components); |
@@ -218,7 +218,8 @@ |
||
218 | 218 | { |
219 | 219 | if(($info = ldap_get_entries($ds, $sr))) |
220 | 220 | { |
221 | - if($info[0]['objectclasses']) { |
|
221 | + if($info[0]['objectclasses']) |
|
222 | + { |
|
222 | 223 | for($i=0; $i<$info[0]['objectclasses']['count']; $i++) |
223 | 224 | { |
224 | 225 | $matches = null; |
@@ -196,7 +196,10 @@ discard block |
||
196 | 196 | foreach((array)$ids as $id) |
197 | 197 | { |
198 | 198 | // if prefs are not returned, null or not an array, read them from db |
199 | - if (!isset($prefs[$id]) && !is_array($prefs[$id])) $db_read[] = $id; |
|
199 | + if (!isset($prefs[$id]) && !is_array($prefs[$id])) |
|
200 | + { |
|
201 | + $db_read[] = $id; |
|
202 | + } |
|
200 | 203 | } |
201 | 204 | if ($db_read) |
202 | 205 | { |
@@ -209,7 +212,10 @@ discard block |
||
209 | 212 | } |
210 | 213 | foreach($db_read as $id) |
211 | 214 | { |
212 | - if (!isset($prefs[$id])) $prefs[$id] = array(); |
|
215 | + if (!isset($prefs[$id])) |
|
216 | + { |
|
217 | + $prefs[$id] = array(); |
|
218 | + } |
|
213 | 219 | Cache::setInstance(__CLASS__, $id, $prefs[$id]); |
214 | 220 | } |
215 | 221 | } |
@@ -237,7 +243,10 @@ discard block |
||
237 | 243 | $replace = $with = array(); |
238 | 244 | foreach($vals as $key => $val) |
239 | 245 | { |
240 | - if ($this->debug) error_log(__METHOD__." replacing \$\$$key\$\$ with $val "); |
|
246 | + if ($this->debug) |
|
247 | + { |
|
248 | + error_log(__METHOD__." replacing \$\$$key\$\$ with $val "); |
|
249 | + } |
|
241 | 250 | $replace[] = '$$'.$key.'$$'; |
242 | 251 | $with[] = $val; |
243 | 252 | } |
@@ -275,7 +284,10 @@ discard block |
||
275 | 284 | */ |
276 | 285 | function standard_substitutes() |
277 | 286 | { |
278 | - if ($this->debug) error_log(__METHOD__." is called "); |
|
287 | + if ($this->debug) |
|
288 | + { |
|
289 | + error_log(__METHOD__." is called "); |
|
290 | + } |
|
279 | 291 | if (!is_array(@$GLOBALS['egw_info']['user']['preferences'])) |
280 | 292 | { |
281 | 293 | $GLOBALS['egw_info']['user']['preferences'] = $this->data; // else no lang() |
@@ -301,12 +313,18 @@ discard block |
||
301 | 313 | 'email' => lang('email-address of the user, eg. "%1"',$this->values['email']), |
302 | 314 | 'date' => lang('todays date, eg. "%1"',$this->values['date']), |
303 | 315 | ); |
304 | - if ($this->debug) error_log(__METHOD__.print_r($this->vars,true)); |
|
316 | + if ($this->debug) |
|
317 | + { |
|
318 | + error_log(__METHOD__.print_r($this->vars,true)); |
|
319 | + } |
|
305 | 320 | // do the substituetion in the effective prefs (data) |
306 | 321 | // |
307 | 322 | foreach($this->data as $app => $data) |
308 | 323 | { |
309 | - if(!is_array($data)) continue; |
|
324 | + if(!is_array($data)) |
|
325 | + { |
|
326 | + continue; |
|
327 | + } |
|
310 | 328 | foreach($data as $key => $val) |
311 | 329 | { |
312 | 330 | if (!is_array($val) && strpos($val,'$$') !== False) |
@@ -401,7 +419,11 @@ discard block |
||
401 | 419 | $primary_group = Accounts::id2name($this->account_id, 'account_primary_group'); |
402 | 420 | foreach((array)$GLOBALS['egw']->accounts->memberships($this->account_id, true) as $gid) |
403 | 421 | { |
404 | - if ($gid != $primary_group) $to_read[] = $gid + self::DEFAULT_ID; // need to offset it with DEFAULT_ID = -2! |
|
422 | + if ($gid != $primary_group) |
|
423 | + { |
|
424 | + $to_read[] = $gid + self::DEFAULT_ID; |
|
425 | + } |
|
426 | + // need to offset it with DEFAULT_ID = -2! |
|
405 | 427 | } |
406 | 428 | $to_read[] = $primary_group + self::DEFAULT_ID; |
407 | 429 | } |
@@ -508,9 +530,15 @@ discard block |
||
508 | 530 | // Etemplate::complete_array_merge() is identical to PHP >= 5.3 array_replace_recursive() |
509 | 531 | $default = Etemplate::complete_array_merge($this->default, $this->forced); |
510 | 532 | |
511 | - if ($app) $default = $default[$app]; |
|
533 | + if ($app) |
|
534 | + { |
|
535 | + $default = $default[$app]; |
|
536 | + } |
|
512 | 537 | |
513 | - if ($name && is_array($default)) $default = $default[$name]; |
|
538 | + if ($name && is_array($default)) |
|
539 | + { |
|
540 | + $default = $default[$name]; |
|
541 | + } |
|
514 | 542 | |
515 | 543 | return $default; |
516 | 544 | } |
@@ -588,9 +616,13 @@ discard block |
||
588 | 616 | { |
589 | 617 | $this->session[$app_name][$var] = $this->data[$app_name][$var] = $value; |
590 | 618 | Cache::setSession('preferences','preferences',$this->session); |
591 | - if (method_exists($GLOBALS['egw'],'invalidate_session_cache')) // egw object in setup is limited |
|
619 | + if (method_exists($GLOBALS['egw'],'invalidate_session_cache')) |
|
620 | + { |
|
621 | + // egw object in setup is limited |
|
592 | 622 | { |
593 | - $GLOBALS['egw']->invalidate_session_cache(); // in case with cache the egw_info array in the session |
|
623 | + $GLOBALS['egw']->invalidate_session_cache(); |
|
624 | + } |
|
625 | + // in case with cache the egw_info array in the session |
|
594 | 626 | } |
595 | 627 | } |
596 | 628 | break; |
@@ -646,9 +678,12 @@ discard block |
||
646 | 678 | } |
647 | 679 | $pref = &$this->$type; |
648 | 680 | |
649 | - if (($all = empty($var))) // to check if $var is regarded as empty (false, 0, '', null, array() should do the trick |
|
681 | + if (($all = empty($var))) |
|
682 | + { |
|
683 | + // to check if $var is regarded as empty (false, 0, '', null, array() should do the trick |
|
650 | 684 | { |
651 | 685 | unset($pref[$app_name]); |
686 | + } |
|
652 | 687 | unset($this->data[$app_name]); |
653 | 688 | } |
654 | 689 | else |
@@ -727,7 +762,10 @@ discard block |
||
727 | 762 | $db = isset($GLOBALS['egw_setup']->db) ? $GLOBALS['egw_setup']->db : $GLOBALS['egw']->db; |
728 | 763 | |
729 | 764 | $where = array(); |
730 | - if ($app) $where['preference_app'] = $app; |
|
765 | + if ($app) |
|
766 | + { |
|
767 | + $where['preference_app'] = $app; |
|
768 | + } |
|
731 | 769 | |
732 | 770 | switch($type) |
733 | 771 | { |
@@ -747,7 +785,11 @@ discard block |
||
747 | 785 | foreach($db->select(self::TABLE, '*', $where, __LINE__, __FILE__) as $row) |
748 | 786 | { |
749 | 787 | $prefs = self::unserialize($row['preference_value']); |
750 | - if (!is_array($prefs)) $prefs = array(); // would stall update otherwise |
|
788 | + if (!is_array($prefs)) |
|
789 | + { |
|
790 | + $prefs = array(); |
|
791 | + } |
|
792 | + // would stall update otherwise |
|
751 | 793 | |
752 | 794 | if ($name[0] == '/' && substr($name, -1) == '/') |
753 | 795 | { |
@@ -764,10 +806,16 @@ discard block |
||
764 | 806 | $updated = false; |
765 | 807 | foreach($attrs as $attr) |
766 | 808 | { |
767 | - if (isset($old_value) && $prefs[$attr] != $old_value) continue; |
|
809 | + if (isset($old_value) && $prefs[$attr] != $old_value) |
|
810 | + { |
|
811 | + continue; |
|
812 | + } |
|
768 | 813 | |
769 | 814 | $val = is_callable($value) ? call_user_func($value, $attr, $prefs[$attr], $row['preference_owner']) : $value; |
770 | - if ($val === $prefs[$attr]) continue; |
|
815 | + if ($val === $prefs[$attr]) |
|
816 | + { |
|
817 | + continue; |
|
818 | + } |
|
771 | 819 | |
772 | 820 | $updated = true; |
773 | 821 | if ((string)$val !== '') |
@@ -832,7 +880,11 @@ discard block |
||
832 | 880 | { |
833 | 881 | $prefs = array_intersect_key($prefs, array_flip($names)); |
834 | 882 | } |
835 | - if (!$prefs) continue; // nothing to change, as nothing set |
|
883 | + if (!$prefs) |
|
884 | + { |
|
885 | + continue; |
|
886 | + } |
|
887 | + // nothing to change, as nothing set |
|
836 | 888 | |
837 | 889 | $row['preference_app'] = $to_app; |
838 | 890 | unset($row['preference_value']); |
@@ -898,9 +950,15 @@ discard block |
||
898 | 950 | foreach($prefs as $app => $value) |
899 | 951 | { |
900 | 952 | // check if app preferences have changed, if not no need to save them |
901 | - if ($old_prefs && $old_prefs[$app] == $value) continue; |
|
953 | + if ($old_prefs && $old_prefs[$app] == $value) |
|
954 | + { |
|
955 | + continue; |
|
956 | + } |
|
902 | 957 | |
903 | - if (!$changed++) $this->db->transaction_begin(); |
|
958 | + if (!$changed++) |
|
959 | + { |
|
960 | + $this->db->transaction_begin(); |
|
961 | + } |
|
904 | 962 | |
905 | 963 | if (!is_array($value) || !$value) |
906 | 964 | { |
@@ -986,7 +1044,10 @@ discard block |
||
986 | 1044 | list($lang,$lang2) = explode('-',$lang); |
987 | 1045 | $country_from_lang = strtoupper($lang2); |
988 | 1046 | } |
989 | - if (is_null($charset)) $charset = Translation::charset(); |
|
1047 | + if (is_null($charset)) |
|
1048 | + { |
|
1049 | + $charset = Translation::charset(); |
|
1050 | + } |
|
990 | 1051 | |
991 | 1052 | foreach(array( |
992 | 1053 | $lang.'_'.$country, |
@@ -20,4 +20,6 @@ |
||
20 | 20 | * |
21 | 21 | * As you get this only by an error in the code or during development, the message does not need to be translated |
22 | 22 | */ |
23 | -class InvalidName extends Exception\NoPermission { } |
|
23 | +class InvalidName extends Exception\NoPermission |
|
24 | +{ |
|
25 | +} |
@@ -42,7 +42,10 @@ discard block |
||
42 | 42 | public static function isJSONRequest($set=null) |
43 | 43 | { |
44 | 44 | $ret = self::$_hadJSONRequest; |
45 | - if (isset($set)) self::$_hadJSONRequest = $set; |
|
45 | + if (isset($set)) |
|
46 | + { |
|
47 | + self::$_hadJSONRequest = $set; |
|
48 | + } |
|
46 | 49 | return $ret; |
47 | 50 | } |
48 | 51 | |
@@ -60,7 +63,10 @@ discard block |
||
60 | 63 | // Remember that we currently are in a JSON request - e.g. used in the redirect code |
61 | 64 | self::$_hadJSONRequest = true; |
62 | 65 | |
63 | - if (get_magic_quotes_gpc()) $input_data = stripslashes($input_data); |
|
66 | + if (get_magic_quotes_gpc()) |
|
67 | + { |
|
68 | + $input_data = stripslashes($input_data); |
|
69 | + } |
|
64 | 70 | |
65 | 71 | $json_data = json_decode($input_data,true); |
66 | 72 | if (is_array($json_data) && isset($json_data['request']) && isset($json_data['request']['parameters']) && is_array($json_data['request']['parameters'])) |
@@ -100,9 +106,12 @@ discard block |
||
100 | 106 | */ |
101 | 107 | public function handleRequest($menuaction, array $parameters) |
102 | 108 | { |
103 | - if (strpos($menuaction,'::') !== false && strpos($menuaction,'.') === false) // static method name app_something::method |
|
109 | + if (strpos($menuaction,'::') !== false && strpos($menuaction,'.') === false) |
|
110 | + { |
|
111 | + // static method name app_something::method |
|
104 | 112 | { |
105 | 113 | @list($className,$functionName,$handler) = explode('::',$menuaction); |
114 | + } |
|
106 | 115 | if (substr($className, 0, 11) == 'EGroupware\\') |
107 | 116 | { |
108 | 117 | list(,$appName) = explode('\\', strtolower($className)); |
@@ -179,6 +188,9 @@ discard block |
||
179 | 188 | Api\Translation::convert($parameters, 'utf-8')); |
180 | 189 | |
181 | 190 | // check if we have push notifications, if notifications app available |
182 | - if (class_exists('notifications_push')) notifications_push::get(); |
|
191 | + if (class_exists('notifications_push')) |
|
192 | + { |
|
193 | + notifications_push::get(); |
|
194 | + } |
|
183 | 195 | } |
184 | 196 | } |
@@ -268,7 +268,10 @@ |
||
268 | 268 | */ |
269 | 269 | public static function fix_content($var, $prefix='') |
270 | 270 | { |
271 | - if (json_encode($var) !== false) return $var; |
|
271 | + if (json_encode($var) !== false) |
|
272 | + { |
|
273 | + return $var; |
|
274 | + } |
|
272 | 275 | |
273 | 276 | if (is_scalar($var)) |
274 | 277 | { |
@@ -76,7 +76,10 @@ discard block |
||
76 | 76 | { |
77 | 77 | $this->filename = $filename; |
78 | 78 | |
79 | - if (!$this->filenames || !in_array($filename,$this->filenames)) $this->filenames[] = $filename; |
|
79 | + if (!$this->filenames || !in_array($filename,$this->filenames)) |
|
80 | + { |
|
81 | + $this->filenames[] = $filename; |
|
82 | + } |
|
80 | 83 | } |
81 | 84 | } |
82 | 85 | |
@@ -93,7 +96,10 @@ discard block |
||
93 | 96 | { |
94 | 97 | throw new Api\Exception\WrongParameter("Not allowed to view '$filename'!"); |
95 | 98 | } |
96 | - if ($filename[0] != '/') $filename = $GLOBALS['egw_info']['server']['files_dir'].'/'.$filename; |
|
99 | + if ($filename[0] != '/') |
|
100 | + { |
|
101 | + $filename = $GLOBALS['egw_info']['server']['files_dir'].'/'.$filename; |
|
102 | + } |
|
97 | 103 | |
98 | 104 | if (file_exists($filename)) |
99 | 105 | { |
@@ -101,7 +107,10 @@ discard block |
||
101 | 107 | if (!$start || $start < 0 || $start > $size || $size-$start > 4*self::MAX_CHUNK_SIZE) |
102 | 108 | { |
103 | 109 | $start = $size - 4*self::MAX_CHUNK_SIZE; |
104 | - if ($start < 0) $start = 0; |
|
110 | + if ($start < 0) |
|
111 | + { |
|
112 | + $start = 0; |
|
113 | + } |
|
105 | 114 | } |
106 | 115 | $hsize = Api\Vfs::hsize($size); |
107 | 116 | $content = file_get_contents($filename, false, null, $start, self::MAX_CHUNK_SIZE); |
@@ -137,7 +146,10 @@ discard block |
||
137 | 146 | { |
138 | 147 | throw new Api\Exception\WrongParameter("Not allowed to view '$filename'!"); |
139 | 148 | } |
140 | - if ($filename[0] != '/') $filename = $GLOBALS['egw_info']['server']['files_dir'].'/'.$filename; |
|
149 | + if ($filename[0] != '/') |
|
150 | + { |
|
151 | + $filename = $GLOBALS['egw_info']['server']['files_dir'].'/'.$filename; |
|
152 | + } |
|
141 | 153 | if ($truncate) |
142 | 154 | { |
143 | 155 | file_put_contents($filename, ''); |
@@ -161,7 +173,10 @@ discard block |
||
161 | 173 | { |
162 | 174 | throw new Api\Exception\WrongParameter("Must be instanciated with filename!"); |
163 | 175 | } |
164 | - if (is_null($header)) $header = $this->filename; |
|
176 | + if (is_null($header)) |
|
177 | + { |
|
178 | + $header = $this->filename; |
|
179 | + } |
|
165 | 180 | |
166 | 181 | return ' |
167 | 182 | <p style="float: left; margin: 5px"><b>'.htmlspecialchars($header).'</b></p> |
@@ -192,7 +207,10 @@ discard block |
||
192 | 207 | throw new Api\Exception\WrongParameter("Not allowed to download '$filename'!"); |
193 | 208 | } |
194 | 209 | Api\Header\Content::type(basename($filename), 'text/plain'); |
195 | - if ($filename[0] != '/') $filename = $GLOBALS['egw_info']['server']['files_dir'].'/'.$filename; |
|
210 | + if ($filename[0] != '/') |
|
211 | + { |
|
212 | + $filename = $GLOBALS['egw_info']['server']['files_dir'].'/'.$filename; |
|
213 | + } |
|
196 | 214 | for($n=ob_get_level(); $n > 0; --$n) |
197 | 215 | { |
198 | 216 | ob_end_clean(); // stop all output buffering, to NOT run into memory_limit |