@@ -361,7 +361,6 @@ discard block |
||
361 | 361 | * Get options from $sel_options array for a given selectbox name |
362 | 362 | * |
363 | 363 | * @param string $name |
364 | - * @param boolean $no_lang=false value of no_lang attribute |
|
365 | 364 | * @return array |
366 | 365 | */ |
367 | 366 | public static function selOptions($name) |
@@ -400,7 +399,7 @@ discard block |
||
400 | 399 | * |
401 | 400 | * @param string $widget_type |
402 | 401 | * @param string $legacy_options options string of widget |
403 | - * @param boolean $no_lang=false initial value of no_lang attribute (some types set it to true) |
|
402 | + * @param boolean $no_lang initial value of no_lang attribute (some types set it to true) |
|
404 | 403 | * @param boolean $readonly =false |
405 | 404 | * @param mixed $value =null value for readonly |
406 | 405 | * @return array with value => label pairs |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @param boolean $cloned =true true: object does NOT need to be cloned, false: to set attribute, set them in cloned object |
121 | 121 | * @return Etempalte\Widget current object or clone, if any attribute was set |
122 | 122 | */ |
123 | - public function set_attrs($xml, $cloned=true) |
|
123 | + public function set_attrs($xml, $cloned = true) |
|
124 | 124 | { |
125 | 125 | $this->attrs['type'] = $xml->localName; |
126 | 126 | parent::set_attrs($xml, $cloned); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | if (isset($item['item']) && is_array($item['item'])) |
166 | 166 | { |
167 | - foreach($item['item'] as &$child) |
|
167 | + foreach ($item['item'] as &$child) |
|
168 | 168 | { |
169 | 169 | $child = self::htmlencode_node($child); |
170 | 170 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | { |
186 | 186 | return true; |
187 | 187 | } |
188 | - foreach((array)$item['item'] as $child) |
|
188 | + foreach ((array)$item['item'] as $child) |
|
189 | 189 | { |
190 | 190 | if (self::in_tree($id, $child)) return true; |
191 | 191 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * @param array $content |
216 | 216 | * @param array &$validated=array() validated content |
217 | 217 | */ |
218 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
218 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
219 | 219 | { |
220 | 220 | $form_name = self::form_name($cname, $this->id, $expand); |
221 | 221 | |
@@ -229,13 +229,13 @@ discard block |
||
229 | 229 | { |
230 | 230 | $allowed = $this->attrs['multiple'] ? array() : array('' => $this->attrs['options']); |
231 | 231 | $allowed += self::selOptions($form_name); |
232 | - foreach((array) $value as $val) |
|
232 | + foreach ((array)$value as $val) |
|
233 | 233 | { |
234 | 234 | if ($this->type == 'tree-cat' && !($this->attrs['multiple'] && !$val) && !self::in_cats($val, $allowed) || |
235 | 235 | $this->type == 'tree' && !self::in_tree($val, $allowed)) |
236 | 236 | { |
237 | - self::set_validation_error($form_name,lang("'%1' is NOT allowed%2)!", $val, |
|
238 | - $this->type == 'tree-cat' ? " ('".implode("','",array_keys($allowed)).')' : ''), ''); |
|
237 | + self::set_validation_error($form_name, lang("'%1' is NOT allowed%2)!", $val, |
|
238 | + $this->type == 'tree-cat' ? " ('".implode("','", array_keys($allowed)).')' : ''), ''); |
|
239 | 239 | $value = ''; |
240 | 240 | break; |
241 | 241 | } |
@@ -244,13 +244,13 @@ discard block |
||
244 | 244 | // return values for cat-tree as string, but not for regular tree as it can have id's with comma! |
245 | 245 | if (is_array($value) && $this->type == 'tree-cat') |
246 | 246 | { |
247 | - $value = implode(',',$value); |
|
247 | + $value = implode(',', $value); |
|
248 | 248 | } |
249 | 249 | if ($ok && $value === '' && $this->attrs['needed']) |
250 | 250 | { |
251 | - self::set_validation_error($form_name,lang('Field must not be empty !!!',$value),''); |
|
251 | + self::set_validation_error($form_name, lang('Field must not be empty !!!', $value), ''); |
|
252 | 252 | } |
253 | - $valid =& self::get_array($validated, $form_name, true); |
|
253 | + $valid = & self::get_array($validated, $form_name, true); |
|
254 | 254 | if (true) $valid = $value; |
255 | 255 | //error_log(__METHOD__."() $form_name: ".array2string($value_in).' --> '.array2string($value).', allowed='.array2string($allowed)); |
256 | 256 | } |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | { |
277 | 277 | // += to keep further options set by app code |
278 | 278 | self::$request->sel_options[$form_name] += self::typeOptions($this->attrs['type'], $this->attrs['options'], |
279 | - $no_lang=null, $this->attrs['readonly'], self::get_array(self::$request->content, $form_name)); |
|
279 | + $no_lang = null, $this->attrs['readonly'], self::get_array(self::$request->content, $form_name)); |
|
280 | 280 | |
281 | 281 | // if no_lang was modified, forward modification to the client |
282 | 282 | if ($no_lang != $this->attr['no_lang']) |
@@ -286,15 +286,15 @@ discard block |
||
286 | 286 | } |
287 | 287 | |
288 | 288 | // Make sure s, etc. are properly encoded when sent, and not double-encoded |
289 | - foreach(self::$request->sel_options[$form_name] as &$label) |
|
289 | + foreach (self::$request->sel_options[$form_name] as &$label) |
|
290 | 290 | { |
291 | - if(!is_array($label)) |
|
291 | + if (!is_array($label)) |
|
292 | 292 | { |
293 | - $label = html_entity_decode($label, ENT_NOQUOTES,'utf-8'); |
|
293 | + $label = html_entity_decode($label, ENT_NOQUOTES, 'utf-8'); |
|
294 | 294 | } |
295 | - elseif($label['label']) |
|
295 | + elseif ($label['label']) |
|
296 | 296 | { |
297 | - $label['label'] = html_entity_decode($label['label'], ENT_NOQUOTES,'utf-8'); |
|
297 | + $label['label'] = html_entity_decode($label['label'], ENT_NOQUOTES, 'utf-8'); |
|
298 | 298 | } |
299 | 299 | } |
300 | 300 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * @param string $image_path =null default path to use, or empty to use default of /phpgwapi/templates/default/images/dhtmlxtree |
307 | 307 | * @return string templated url if available, otherwise default path |
308 | 308 | */ |
309 | - public static function templateImagePath($image_path=null) |
|
309 | + public static function templateImagePath($image_path = null) |
|
310 | 310 | { |
311 | 311 | $webserver_url = $GLOBALS['egw_info']['server']['webserver_url']; |
312 | 312 | if (empty($image_path)) |
@@ -338,20 +338,20 @@ discard block |
||
338 | 338 | */ |
339 | 339 | public static function imagePath($image) |
340 | 340 | { |
341 | - static $image_path=null; |
|
342 | - if (!isset($image_path)) $image_path = self::templateImagePath (); |
|
341 | + static $image_path = null; |
|
342 | + if (!isset($image_path)) $image_path = self::templateImagePath(); |
|
343 | 343 | |
344 | 344 | $parts = explode('/', $image_path); |
345 | - $image_parts = explode('/', $image); |
|
345 | + $image_parts = explode('/', $image); |
|
346 | 346 | |
347 | 347 | // remove common parts |
348 | - while(isset($parts[0]) && $parts[0] === $image_parts[0]) |
|
348 | + while (isset($parts[0]) && $parts[0] === $image_parts[0]) |
|
349 | 349 | { |
350 | 350 | array_shift($parts); |
351 | 351 | array_shift($image_parts); |
352 | 352 | } |
353 | 353 | // add .. for different parts, except last image part |
354 | - $url = implode('/', array_merge(array_fill(0, count($parts)-1, '..'), $image_parts)); |
|
354 | + $url = implode('/', array_merge(array_fill(0, count($parts) - 1, '..'), $image_parts)); |
|
355 | 355 | |
356 | 356 | //error_log(__METHOD__."('$image') image_path=$image_path returning $url"); |
357 | 357 | return $url; |
@@ -373,10 +373,10 @@ discard block |
||
373 | 373 | } |
374 | 374 | else |
375 | 375 | { |
376 | - $name_parts = explode('[',str_replace(']','',$name)); |
|
376 | + $name_parts = explode('[', str_replace(']', '', $name)); |
|
377 | 377 | if (count($name_parts)) |
378 | 378 | { |
379 | - $org_name = $name_parts[count($name_parts)-1]; |
|
379 | + $org_name = $name_parts[count($name_parts) - 1]; |
|
380 | 380 | if (isset(self::$request->sel_options[$org_name]) && is_array(self::$request->sel_options[$org_name])) |
381 | 381 | { |
382 | 382 | $options += self::$request->sel_options[$org_name]; |
@@ -405,9 +405,9 @@ discard block |
||
405 | 405 | * @param mixed $value =null value for readonly |
406 | 406 | * @return array with value => label pairs |
407 | 407 | */ |
408 | - public static function typeOptions($widget_type, $legacy_options, &$no_lang=false, $readonly=false, $value=null) |
|
408 | + public static function typeOptions($widget_type, $legacy_options, &$no_lang = false, $readonly = false, $value = null) |
|
409 | 409 | { |
410 | - list($rows,$type,$type2,$type3) = explode(',',$legacy_options); |
|
410 | + list($rows, $type, $type2, $type3) = explode(',', $legacy_options); |
|
411 | 411 | |
412 | 412 | $no_lang = false; |
413 | 413 | $options = array(); |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | if ($readonly) // for readonly we dont need to fetch all cat's, nor do we need to indent them by level |
418 | 418 | { |
419 | 419 | $cell['no_lang'] = True; |
420 | - foreach(is_array($value) ? $value : (strpos($value,',') !== false ? explode(',',$value) : array($value)) as $id) |
|
420 | + foreach (is_array($value) ? $value : (strpos($value, ',') !== false ? explode(',', $value) : array($value)) as $id) |
|
421 | 421 | { |
422 | 422 | if ($id) $cell['sel_options'][$id] = stripslashes($GLOBALS['egw']->categories->id2name($id)); |
423 | 423 | } |
@@ -425,14 +425,14 @@ discard block |
||
425 | 425 | } |
426 | 426 | if (!$type3 || $type3 === $GLOBALS['egw']->categories->app_name) |
427 | 427 | { |
428 | - $categories =& $GLOBALS['egw']->categories; |
|
428 | + $categories = & $GLOBALS['egw']->categories; |
|
429 | 429 | } |
430 | 430 | else // we need to instanciate a new cat object for the correct application |
431 | 431 | { |
432 | - $categories = new Api\Categories('',$type3); |
|
432 | + $categories = new Api\Categories('', $type3); |
|
433 | 433 | } |
434 | - $cat2path=array(); |
|
435 | - foreach((array)$categories->return_sorted_array(0,False,'','','',!$type,0,true) as $cat) |
|
434 | + $cat2path = array(); |
|
435 | + foreach ((array)$categories->return_sorted_array(0, False, '', '', '', !$type, 0, true) as $cat) |
|
436 | 436 | { |
437 | 437 | $s = stripslashes($cat['name']); |
438 | 438 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | if ($value) |
464 | 464 | { |
465 | 465 | $pathes = $extension_data['unavailable'] = array(); |
466 | - foreach(is_array($value) ? $value : explode(',',$value) as $cat) |
|
466 | + foreach (is_array($value) ? $value : explode(',', $value) as $cat) |
|
467 | 467 | { |
468 | 468 | if (isset($cat2path[$cat])) |
469 | 469 | { |
@@ -187,7 +187,10 @@ discard block |
||
187 | 187 | } |
188 | 188 | foreach((array)$item['item'] as $child) |
189 | 189 | { |
190 | - if (self::in_tree($id, $child)) return true; |
|
190 | + if (self::in_tree($id, $child)) |
|
191 | + { |
|
192 | + return true; |
|
193 | + } |
|
191 | 194 | } |
192 | 195 | return false; |
193 | 196 | } |
@@ -251,7 +254,10 @@ discard block |
||
251 | 254 | self::set_validation_error($form_name,lang('Field must not be empty !!!',$value),''); |
252 | 255 | } |
253 | 256 | $valid =& self::get_array($validated, $form_name, true); |
254 | - if (true) $valid = $value; |
|
257 | + if (true) |
|
258 | + { |
|
259 | + $valid = $value; |
|
260 | + } |
|
255 | 261 | //error_log(__METHOD__."() $form_name: ".array2string($value_in).' --> '.array2string($value).', allowed='.array2string($allowed)); |
256 | 262 | } |
257 | 263 | } |
@@ -271,7 +277,10 @@ discard block |
||
271 | 277 | //error_log(__METHOD__."() setting templated image-path for $form_name: $templated_path"); |
272 | 278 | } |
273 | 279 | |
274 | - if (!is_array(self::$request->sel_options[$form_name])) self::$request->sel_options[$form_name] = array(); |
|
280 | + if (!is_array(self::$request->sel_options[$form_name])) |
|
281 | + { |
|
282 | + self::$request->sel_options[$form_name] = array(); |
|
283 | + } |
|
275 | 284 | if ($this->attrs['type']) |
276 | 285 | { |
277 | 286 | // += to keep further options set by app code |
@@ -339,7 +348,10 @@ discard block |
||
339 | 348 | public static function imagePath($image) |
340 | 349 | { |
341 | 350 | static $image_path=null; |
342 | - if (!isset($image_path)) $image_path = self::templateImagePath (); |
|
351 | + if (!isset($image_path)) |
|
352 | + { |
|
353 | + $image_path = self::templateImagePath (); |
|
354 | + } |
|
343 | 355 | |
344 | 356 | $parts = explode('/', $image_path); |
345 | 357 | $image_parts = explode('/', $image); |
@@ -414,12 +426,18 @@ discard block |
||
414 | 426 | switch ($widget_type) |
415 | 427 | { |
416 | 428 | case 'tree-cat': // !$type == globals cats too, $type2: extraStyleMultiselect, $type3: application, if not current-app, $type4: parent-id, $type5=owner (-1=global),$type6=show missing |
417 | - if ($readonly) // for readonly we dont need to fetch all cat's, nor do we need to indent them by level |
|
429 | + if ($readonly) |
|
430 | + { |
|
431 | + // for readonly we dont need to fetch all cat's, nor do we need to indent them by level |
|
418 | 432 | { |
419 | 433 | $cell['no_lang'] = True; |
434 | + } |
|
420 | 435 | foreach(is_array($value) ? $value : (strpos($value,',') !== false ? explode(',',$value) : array($value)) as $id) |
421 | 436 | { |
422 | - if ($id) $cell['sel_options'][$id] = stripslashes($GLOBALS['egw']->categories->id2name($id)); |
|
437 | + if ($id) |
|
438 | + { |
|
439 | + $cell['sel_options'][$id] = stripslashes($GLOBALS['egw']->categories->id2name($id)); |
|
440 | + } |
|
423 | 441 | } |
424 | 442 | break; |
425 | 443 | } |
@@ -52,7 +52,6 @@ |
||
52 | 52 | * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
53 | 53 | * @param array $content |
54 | 54 | * @param array &$validated=array() validated content |
55 | - * @param array $expand=array values for keys 'c', 'row', 'c_', 'row_', 'cont' |
|
56 | 55 | */ |
57 | 56 | public function validate($cname, array $expand, array $content, &$validated=array()) |
58 | 57 | { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param array &$validated=array() validated content |
55 | 55 | * @param array $expand=array values for keys 'c', 'row', 'c_', 'row_', 'cont' |
56 | 56 | */ |
57 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
57 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
58 | 58 | { |
59 | 59 | $form_name = self::form_name($cname, $this->id, $expand); |
60 | 60 | |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | |
65 | 65 | if ((string)$value === '' && $this->attrs['needed']) |
66 | 66 | { |
67 | - self::set_validation_error($form_name,lang('Field must not be empty !!!'),''); |
|
67 | + self::set_validation_error($form_name, lang('Field must not be empty !!!'), ''); |
|
68 | 68 | return; |
69 | 69 | } |
70 | 70 | elseif ((string)$value != '' && !isset($this->attrs['preg'])) |
71 | 71 | { |
72 | - switch($this->type) |
|
72 | + switch ($this->type) |
|
73 | 73 | { |
74 | 74 | case 'url': |
75 | 75 | // if no protocol given eg. "www.egroupware.org" prepend "http://" for validation |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } |
80 | 80 | $url_valid = filter_var($value, FILTER_VALIDATE_URL) || |
81 | 81 | // Remove intl chars & check again, but if it passes we'll keep the original |
82 | - filter_var(preg_replace('/[^[:print:]]/','',$value), FILTER_VALIDATE_URL); |
|
82 | + filter_var(preg_replace('/[^[:print:]]/', '', $value), FILTER_VALIDATE_URL); |
|
83 | 83 | //error_log(__METHOD__."() filter_var(value=".array2string($value).", FILTER_VALIDATE_URL)=".array2string(filter_var($value, FILTER_VALIDATE_URL))." --> url_valid=".array2string($url_valid)); |
84 | 84 | // remove http:// validation prefix again |
85 | 85 | if ($missing_protocol) |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | } |
89 | 89 | if (!$url_valid) |
90 | 90 | { |
91 | - self::set_validation_error($form_name,lang("'%1' has an invalid format !!!",$value),''); |
|
91 | + self::set_validation_error($form_name, lang("'%1' has an invalid format !!!", $value), ''); |
|
92 | 92 | return; |
93 | 93 | } |
94 | 94 | break; |
@@ -98,19 +98,19 @@ discard block |
||
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | - $valid =& self::get_array($validated, $form_name, true); |
|
101 | + $valid = & self::get_array($validated, $form_name, true); |
|
102 | 102 | |
103 | - if ((int) $this->attrs['maxlength'] > 0 && strlen($value) > (int) $this->attrs['maxlength']) |
|
103 | + if ((int)$this->attrs['maxlength'] > 0 && strlen($value) > (int)$this->attrs['maxlength']) |
|
104 | 104 | { |
105 | - $value = substr($value,0,(int) $this->attrs['maxlength']); |
|
105 | + $value = substr($value, 0, (int)$this->attrs['maxlength']); |
|
106 | 106 | } |
107 | - if ($this->attrs['preg'] && !preg_match($this->attrs['preg'],$value)) |
|
107 | + if ($this->attrs['preg'] && !preg_match($this->attrs['preg'], $value)) |
|
108 | 108 | { |
109 | - switch($this->type) |
|
109 | + switch ($this->type) |
|
110 | 110 | { |
111 | 111 | default: |
112 | 112 | //error_log("preg_match('{$this->attrs['preg']}', '$value')=".array2string(preg_match($this->attrs['preg'], $value))); |
113 | - self::set_validation_error($form_name,lang("'%1' has an invalid format !!!",$value)/*." !preg_match('$this->attrs[preg]', '$value')"*/,''); |
|
113 | + self::set_validation_error($form_name, lang("'%1' has an invalid format !!!", $value)/*." !preg_match('$this->attrs[preg]', '$value')"*/, ''); |
|
114 | 114 | break; |
115 | 115 | } |
116 | 116 | } |
@@ -37,7 +37,10 @@ |
||
37 | 37 | { |
38 | 38 | $value = self::get_array($content, $form_name); |
39 | 39 | $valid =& self::get_array($validated, $form_name, true); |
40 | - if (true) $valid = $value; |
|
40 | + if (true) |
|
41 | + { |
|
42 | + $valid = $value; |
|
43 | + } |
|
41 | 44 | } |
42 | 45 | } |
43 | 46 | } |
@@ -230,6 +230,7 @@ |
||
230 | 230 | * If the entry is not yet created, the file information is stored into the widget's value. |
231 | 231 | * When the form is submitted, the information for all files uploaded is available in the returned |
232 | 232 | * $content array and the application should deal with the file. |
233 | + * @return string |
|
233 | 234 | */ |
234 | 235 | public static function store_file($path, $file) |
235 | 236 | { |
@@ -224,13 +224,13 @@ |
||
224 | 224 | } |
225 | 225 | |
226 | 226 | /** |
227 | - * Ajax callback to receive an incoming file |
|
228 | - * |
|
229 | - * The incoming file is automatically placed into the appropriate VFS location. |
|
230 | - * If the entry is not yet created, the file information is stored into the widget's value. |
|
231 | - * When the form is submitted, the information for all files uploaded is available in the returned |
|
232 | - * $content array and the application should deal with the file. |
|
233 | - */ |
|
227 | + * Ajax callback to receive an incoming file |
|
228 | + * |
|
229 | + * The incoming file is automatically placed into the appropriate VFS location. |
|
230 | + * If the entry is not yet created, the file information is stored into the widget's value. |
|
231 | + * When the form is submitted, the information for all files uploaded is available in the returned |
|
232 | + * $content array and the application should deal with the file. |
|
233 | + */ |
|
234 | 234 | public static function store_file($path, $file) |
235 | 235 | { |
236 | 236 | $name = $_REQUEST['widget_id']; |
@@ -27,7 +27,10 @@ discard block |
||
27 | 27 | |
28 | 28 | public function __construct($xml='') |
29 | 29 | { |
30 | - if($xml) parent::__construct($xml); |
|
30 | + if($xml) |
|
31 | + { |
|
32 | + parent::__construct($xml); |
|
33 | + } |
|
31 | 34 | } |
32 | 35 | |
33 | 36 | /** |
@@ -64,9 +67,15 @@ discard block |
||
64 | 67 | } |
65 | 68 | $value =& self::get_array(self::$request->content, $form_name, true); |
66 | 69 | $path = Api\Link::vfs_path($app,$id,'',true); |
67 | - if (!empty($relpath)) $path .= '/'.$relpath; |
|
70 | + if (!empty($relpath)) |
|
71 | + { |
|
72 | + $path .= '/'.$relpath; |
|
73 | + } |
|
68 | 74 | |
69 | - if (true) $value = array(); |
|
75 | + if (true) |
|
76 | + { |
|
77 | + $value = array(); |
|
78 | + } |
|
70 | 79 | |
71 | 80 | // Single file, already existing |
72 | 81 | if (substr($path,-1) != '/' && Api\Vfs::file_exists($path) && !Api\Vfs::is_dir($path)) |
@@ -194,7 +203,10 @@ discard block |
||
194 | 203 | $replace[substr($link['id']['tmp_name'], strlen(Api\Vfs::PREFIX))] = |
195 | 204 | Api\Link::vfs_path($app, $id, Api\Vfs::basename($link['id']['tmp_name']), true); |
196 | 205 | |
197 | - if (!in_array($matches[1], $remove_dir)) $remove_dir[] = $matches[1]; |
|
206 | + if (!in_array($matches[1], $remove_dir)) |
|
207 | + { |
|
208 | + $remove_dir[] = $matches[1]; |
|
209 | + } |
|
198 | 210 | } |
199 | 211 | } |
200 | 212 | if ($replace) |
@@ -218,7 +230,10 @@ discard block |
||
218 | 230 | */ |
219 | 231 | static function get_temp_dir($app, $postfix=null) |
220 | 232 | { |
221 | - if (!isset($postfix)) $postfix = md5(time().session_id()); |
|
233 | + if (!isset($postfix)) |
|
234 | + { |
|
235 | + $postfix = md5(time().session_id()); |
|
236 | + } |
|
222 | 237 | |
223 | 238 | return '/home/'.$GLOBALS['egw_info']['user']['account_lid'].'/.tmp/'.$app.'_'.$postfix; |
224 | 239 | } |
@@ -245,10 +260,13 @@ discard block |
||
245 | 260 | { |
246 | 261 | // add extension to path |
247 | 262 | $parts = explode('.',$filename); |
248 | - if (($extension = array_pop($parts)) && Api\MimeMagic::ext2mime($extension)) // really an extension --> add it to path |
|
263 | + if (($extension = array_pop($parts)) && Api\MimeMagic::ext2mime($extension)) |
|
264 | + { |
|
265 | + // really an extension --> add it to path |
|
249 | 266 | { |
250 | 267 | $path .= '.'.$extension; |
251 | 268 | } |
269 | + } |
|
252 | 270 | } |
253 | 271 | else // multiple upload with dir given (trailing slash) |
254 | 272 | { |
@@ -294,7 +312,10 @@ discard block |
||
294 | 312 | switch($this->type) |
295 | 313 | { |
296 | 314 | case 'vfs-upload': |
297 | - if(!is_array($value)) $value = array(); |
|
315 | + if(!is_array($value)) |
|
316 | + { |
|
317 | + $value = array(); |
|
318 | + } |
|
298 | 319 | /* Check & skip files that made it asyncronously |
299 | 320 | list($app,$id,$relpath) = explode(':',$this->id,3); |
300 | 321 | //... |
@@ -305,7 +326,10 @@ discard block |
||
305 | 326 | parent::validate($cname, $content, $validated); |
306 | 327 | break; |
307 | 328 | } |
308 | - if (true) $valid = $value; |
|
329 | + if (true) |
|
330 | + { |
|
331 | + $valid = $value; |
|
332 | + } |
|
309 | 333 | } |
310 | 334 | |
311 | 335 | /** |
@@ -317,14 +341,20 @@ discard block |
||
317 | 341 | if (empty($id) || $id == 'undefined') |
318 | 342 | { |
319 | 343 | static $tmppath = array(); // static var, so all vfs-uploads get created in the same temporary dir |
320 | - if (!isset($tmppath[$app])) $tmppath[$app] = self::get_temp_dir ($app); |
|
344 | + if (!isset($tmppath[$app])) |
|
345 | + { |
|
346 | + $tmppath[$app] = self::get_temp_dir ($app); |
|
347 | + } |
|
321 | 348 | $path = $tmppath[$app]; |
322 | 349 | } |
323 | 350 | else |
324 | 351 | { |
325 | 352 | $path = Api\Link::vfs_path($app,$id,'',true); |
326 | 353 | } |
327 | - if (!empty($relpath)) $path .= '/'.$relpath; |
|
354 | + if (!empty($relpath)) |
|
355 | + { |
|
356 | + $path .= '/'.$relpath; |
|
357 | + } |
|
328 | 358 | return $path; |
329 | 359 | } |
330 | 360 | } |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | // Legacy option for vfs-upload |
26 | 26 | protected $legacy_options = "mime"; |
27 | 27 | |
28 | - public function __construct($xml='') |
|
28 | + public function __construct($xml = '') |
|
29 | 29 | { |
30 | - if($xml) parent::__construct($xml); |
|
30 | + if ($xml) parent::__construct($xml); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function beforeSendToClient($cname, $expand = array()) |
38 | 38 | { |
39 | - if($this->type == 'vfs-upload' || $this->attrs['type'] == 'vfs-upload') |
|
39 | + if ($this->type == 'vfs-upload' || $this->attrs['type'] == 'vfs-upload') |
|
40 | 40 | { |
41 | 41 | $form_name = self::form_name($cname, $this->id, $expand ? $expand : array('cont'=>self::$request->content)); |
42 | - if($this->attrs['path']) |
|
42 | + if ($this->attrs['path']) |
|
43 | 43 | { |
44 | 44 | $path = $this->attrs['path']; |
45 | 45 | } |
@@ -50,26 +50,26 @@ discard block |
||
50 | 50 | |
51 | 51 | $this->setElementAttribute($form_name, 'path', $path); |
52 | 52 | // ID maps to path - check there for any existing files |
53 | - list($app,$id,$relpath) = explode(':',$path,3); |
|
54 | - if($app && $id) |
|
53 | + list($app, $id, $relpath) = explode(':', $path, 3); |
|
54 | + if ($app && $id) |
|
55 | 55 | { |
56 | - if(!is_numeric($id)) |
|
56 | + if (!is_numeric($id)) |
|
57 | 57 | { |
58 | - $_id = self::expand_name($id,0,0,0,0,self::$request->content); |
|
59 | - if($_id != $id) |
|
58 | + $_id = self::expand_name($id, 0, 0, 0, 0, self::$request->content); |
|
59 | + if ($_id != $id) |
|
60 | 60 | { |
61 | 61 | $id = $_id; |
62 | 62 | $form_name = "$app:$id:$relpath"; |
63 | 63 | } |
64 | 64 | } |
65 | - $value =& self::get_array(self::$request->content, $form_name, true); |
|
66 | - $path = Api\Link::vfs_path($app,$id,'',true); |
|
65 | + $value = & self::get_array(self::$request->content, $form_name, true); |
|
66 | + $path = Api\Link::vfs_path($app, $id, '', true); |
|
67 | 67 | if (!empty($relpath)) $path .= '/'.$relpath; |
68 | 68 | |
69 | 69 | if (true) $value = array(); |
70 | 70 | |
71 | 71 | // Single file, already existing |
72 | - if (substr($path,-1) != '/' && Api\Vfs::file_exists($path) && !Api\Vfs::is_dir($path)) |
|
72 | + if (substr($path, -1) != '/' && Api\Vfs::file_exists($path) && !Api\Vfs::is_dir($path)) |
|
73 | 73 | { |
74 | 74 | $file = Api\Vfs::stat($path); |
75 | 75 | $file['path'] = $path; |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | $value = array($file); |
79 | 79 | } |
80 | 80 | // Single file, missing extension in path |
81 | - else if (substr($path, -1) != '/' && !Api\Vfs::file_exists($path) && $relpath && substr($relpath,-4,1) !== '.') |
|
81 | + else if (substr($path, -1) != '/' && !Api\Vfs::file_exists($path) && $relpath && substr($relpath, -4, 1) !== '.') |
|
82 | 82 | { |
83 | - $find = Api\Vfs::find(substr($path,0, - strlen($relpath)), array( |
|
83 | + $find = Api\Vfs::find(substr($path, 0, - strlen($relpath)), array( |
|
84 | 84 | 'type' => 'f', |
85 | 85 | 'maxdepth' => 1, |
86 | - 'name' => $relpath . '*' |
|
86 | + 'name' => $relpath.'*' |
|
87 | 87 | )); |
88 | - foreach($find as $file) |
|
88 | + foreach ($find as $file) |
|
89 | 89 | { |
90 | 90 | $file_info = Api\Vfs::stat($file); |
91 | 91 | $file_info['path'] = $file; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | else if (substr($path, -1) == '/' && Api\Vfs::is_dir($path)) |
98 | 98 | { |
99 | 99 | $scan = Api\Vfs::scandir($path); |
100 | - foreach($scan as $file) |
|
100 | + foreach ($scan as $file) |
|
101 | 101 | { |
102 | 102 | $file_info = Api\Vfs::stat("$path$file"); |
103 | 103 | $file_info['path'] = "$path$file"; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | public static function ajax_upload() |
114 | 114 | { |
115 | 115 | parent::ajax_upload(); |
116 | - foreach($_FILES as $file) |
|
116 | + foreach ($_FILES as $file) |
|
117 | 117 | { |
118 | 118 | self::store_file($_REQUEST['path'] ? $_REQUEST['path'] : $_REQUEST['widget_id'], $file); |
119 | 119 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | { |
127 | 127 | $request_id = urldecode($_REQUEST['request_id']); |
128 | 128 | $widget_id = $_REQUEST['widget_id']; |
129 | - if(!self::$request = Etemplate\Request::read($request_id)) |
|
129 | + if (!self::$request = Etemplate\Request::read($request_id)) |
|
130 | 130 | { |
131 | 131 | $error = lang("Could not read session"); |
132 | 132 | } |
@@ -186,10 +186,10 @@ discard block |
||
186 | 186 | static function fix_html_dragins($app, $id, array $links, &$html) |
187 | 187 | { |
188 | 188 | $replace = $remove_dir = array(); |
189 | - foreach($links as $link) |
|
189 | + foreach ($links as $link) |
|
190 | 190 | { |
191 | 191 | $matches = null; |
192 | - if (is_array($link) && preg_match('|^'.preg_quote(Api\Vfs::PREFIX,'|').'('.preg_quote(self::get_temp_dir($app, ''), '|').'[^/]+)/|', $link['id']['tmp_name'], $matches)) |
|
192 | + if (is_array($link) && preg_match('|^'.preg_quote(Api\Vfs::PREFIX, '|').'('.preg_quote(self::get_temp_dir($app, ''), '|').'[^/]+)/|', $link['id']['tmp_name'], $matches)) |
|
193 | 193 | { |
194 | 194 | $replace[substr($link['id']['tmp_name'], strlen(Api\Vfs::PREFIX))] = |
195 | 195 | Api\Link::vfs_path($app, $id, Api\Vfs::basename($link['id']['tmp_name']), true); |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | { |
202 | 202 | $html = strtr($old = $html, $replace); |
203 | 203 | // remove all dirs |
204 | - foreach($remove_dir as $dir) |
|
204 | + foreach ($remove_dir as $dir) |
|
205 | 205 | { |
206 | 206 | Api\Vfs::remove($dir); |
207 | 207 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @param string $postfix =null default random id |
217 | 217 | * @return string vfs path |
218 | 218 | */ |
219 | - static function get_temp_dir($app, $postfix=null) |
|
219 | + static function get_temp_dir($app, $postfix = null) |
|
220 | 220 | { |
221 | 221 | if (!isset($postfix)) $postfix = md5(time().session_id()); |
222 | 222 | |
@@ -236,15 +236,15 @@ discard block |
||
236 | 236 | $name = $_REQUEST['widget_id']; |
237 | 237 | |
238 | 238 | // Find real path |
239 | - if($path[0] != '/') |
|
239 | + if ($path[0] != '/') |
|
240 | 240 | { |
241 | 241 | $path = self::get_vfs_path($path); |
242 | 242 | } |
243 | 243 | $filename = $file['name']; |
244 | - if (substr($path,-1) != '/') |
|
244 | + if (substr($path, -1) != '/') |
|
245 | 245 | { |
246 | 246 | // add extension to path |
247 | - $parts = explode('.',$filename); |
|
247 | + $parts = explode('.', $filename); |
|
248 | 248 | if (($extension = array_pop($parts)) && Api\MimeMagic::ext2mime($extension)) // really an extension --> add it to path |
249 | 249 | { |
250 | 250 | $path .= '.'.$extension; |
@@ -256,17 +256,17 @@ discard block |
||
256 | 256 | } |
257 | 257 | if (!($dir = Api\Vfs::dirname($path))) |
258 | 258 | { |
259 | - self::set_validation_error($name,lang('Error create parent directory %1!', "dirname('$path') === false")); |
|
259 | + self::set_validation_error($name, lang('Error create parent directory %1!', "dirname('$path') === false")); |
|
260 | 260 | return false; |
261 | 261 | } |
262 | - if (!Api\Vfs::file_exists($dir) && !Api\Vfs::mkdir($dir,null,STREAM_MKDIR_RECURSIVE)) |
|
262 | + if (!Api\Vfs::file_exists($dir) && !Api\Vfs::mkdir($dir, null, STREAM_MKDIR_RECURSIVE)) |
|
263 | 263 | { |
264 | - self::set_validation_error($name,lang('Error create parent directory %1!',Api\Vfs::decodePath($dir))); |
|
264 | + self::set_validation_error($name, lang('Error create parent directory %1!', Api\Vfs::decodePath($dir))); |
|
265 | 265 | return false; |
266 | 266 | } |
267 | - if (!copy($file['tmp_name'],Api\Vfs::PREFIX.$path)) |
|
267 | + if (!copy($file['tmp_name'], Api\Vfs::PREFIX.$path)) |
|
268 | 268 | { |
269 | - self::set_validation_error($name,lang('Error copying uploaded file to vfs!')); |
|
269 | + self::set_validation_error($name, lang('Error copying uploaded file to vfs!')); |
|
270 | 270 | return false; |
271 | 271 | } |
272 | 272 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @param array $content |
286 | 286 | * @param array &$validated=array() validated content |
287 | 287 | */ |
288 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
288 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
289 | 289 | { |
290 | 290 | // do not validate, as it would overwrite preserved values with null! |
291 | 291 | if (in_array($this->type, array('vfs-size', 'vfs-uid', 'vfs-gid', 'vfs', 'vfs-mime'))) |
@@ -294,12 +294,12 @@ discard block |
||
294 | 294 | } |
295 | 295 | $form_name = self::form_name($cname, $this->id, $expand); |
296 | 296 | $value = $value_in = self::get_array($content, $form_name); |
297 | - $valid =& self::get_array($validated, $form_name, true); |
|
297 | + $valid = & self::get_array($validated, $form_name, true); |
|
298 | 298 | |
299 | - switch($this->type) |
|
299 | + switch ($this->type) |
|
300 | 300 | { |
301 | 301 | case 'vfs-upload': |
302 | - if(!is_array($value)) $value = array(); |
|
302 | + if (!is_array($value)) $value = array(); |
|
303 | 303 | /* Check & skip files that made it asyncronously |
304 | 304 | list($app,$id,$relpath) = explode(':',$this->id,3); |
305 | 305 | //... |
@@ -318,16 +318,16 @@ discard block |
||
318 | 318 | */ |
319 | 319 | public static function get_vfs_path($path) |
320 | 320 | { |
321 | - list($app,$id,$relpath) = explode(':',$path,3); |
|
321 | + list($app, $id, $relpath) = explode(':', $path, 3); |
|
322 | 322 | if (empty($id) || $id == 'undefined') |
323 | 323 | { |
324 | - static $tmppath = array(); // static var, so all vfs-uploads get created in the same temporary dir |
|
325 | - if (!isset($tmppath[$app])) $tmppath[$app] = self::get_temp_dir ($app); |
|
324 | + static $tmppath = array(); // static var, so all vfs-uploads get created in the same temporary dir |
|
325 | + if (!isset($tmppath[$app])) $tmppath[$app] = self::get_temp_dir($app); |
|
326 | 326 | $path = $tmppath[$app]; |
327 | 327 | } |
328 | 328 | else |
329 | 329 | { |
330 | - $path = Api\Link::vfs_path($app,$id,'',true); |
|
330 | + $path = Api\Link::vfs_path($app, $id, '', true); |
|
331 | 331 | } |
332 | 332 | if (!empty($relpath)) $path .= '/'.$relpath; |
333 | 333 | return $path; |
@@ -19,6 +19,9 @@ |
||
19 | 19 | */ |
20 | 20 | class Admin extends App |
21 | 21 | { |
22 | + /** |
|
23 | + * @param string $msg |
|
24 | + */ |
|
22 | 25 | function __construct($msg=null,$code=102) |
23 | 26 | { |
24 | 27 | if (is_null($msg)) $msg = 'admin'; |
@@ -19,10 +19,10 @@ |
||
19 | 19 | */ |
20 | 20 | class Admin extends App |
21 | 21 | { |
22 | - function __construct($msg=null,$code=102) |
|
22 | + function __construct($msg = null, $code = 102) |
|
23 | 23 | { |
24 | 24 | if (is_null($msg)) $msg = 'admin'; |
25 | 25 | |
26 | - parent::__construct($msg,$code); |
|
26 | + parent::__construct($msg, $code); |
|
27 | 27 | } |
28 | 28 | } |
@@ -21,7 +21,10 @@ |
||
21 | 21 | { |
22 | 22 | function __construct($msg=null,$code=102) |
23 | 23 | { |
24 | - if (is_null($msg)) $msg = 'admin'; |
|
24 | + if (is_null($msg)) |
|
25 | + { |
|
26 | + $msg = 'admin'; |
|
27 | + } |
|
25 | 28 | |
26 | 29 | parent::__construct($msg,$code); |
27 | 30 | } |
@@ -78,6 +78,7 @@ discard block |
||
78 | 78 | * Constructor |
79 | 79 | * |
80 | 80 | * The constructor instanciates the class in $GLOBALS['egw']->framework, from where it should be used |
81 | + * @param string $template |
|
81 | 82 | */ |
82 | 83 | function __construct($template) |
83 | 84 | { |
@@ -544,7 +545,7 @@ discard block |
||
544 | 545 | /** |
545 | 546 | * Returns Html with user and time |
546 | 547 | * |
547 | - * @return void |
|
548 | + * @return string |
|
548 | 549 | */ |
549 | 550 | protected static function _user_time_info() |
550 | 551 | { |
@@ -602,7 +603,7 @@ discard block |
||
602 | 603 | * |
603 | 604 | * @param string $username =null username for regular basic Auth |
604 | 605 | * @param string $password =null password --------- " ---------- |
605 | - * @return resource|null context to use with file_get_context/fopen or null if no proxy configured |
|
606 | + * @return resource context to use with file_get_context/fopen or null if no proxy configured |
|
606 | 607 | */ |
607 | 608 | public static function proxy_context($username=null, $password=null) |
608 | 609 | { |
@@ -970,7 +971,6 @@ discard block |
||
970 | 971 | * |
971 | 972 | * Themes are css file in the template directory |
972 | 973 | * |
973 | - * @param string $themes_dir ='css' |
|
974 | 974 | */ |
975 | 975 | function list_themes() |
976 | 976 | { |
@@ -1156,11 +1156,6 @@ discard block |
||
1156 | 1156 | /** |
1157 | 1157 | * Add menu items to the topmenu template class to be displayed |
1158 | 1158 | * |
1159 | - * @param array $app application data |
|
1160 | - * @param mixed $alt_label string with alternative menu item label default value = null |
|
1161 | - * @param string $urlextra string with alternate additional code inside <a>-tag |
|
1162 | - * @access protected |
|
1163 | - * @return void |
|
1164 | 1159 | */ |
1165 | 1160 | abstract function _add_topmenu_item(array $app_data,$alt_label=null); |
1166 | 1161 | |
@@ -1253,7 +1248,6 @@ discard block |
||
1253 | 1248 | * @param string $package package or complete path (relative to EGW_SERVER_ROOT) to be included |
1254 | 1249 | * @param string|array $file =null file to be included - no ".js" on the end or array with get params |
1255 | 1250 | * @param string $app ='phpgwapi' application directory to search - default = phpgwapi |
1256 | - * @param boolean $append =true should the file be added |
|
1257 | 1251 | */ |
1258 | 1252 | static function includeJS($package, $file=null, $app='phpgwapi') |
1259 | 1253 | { |
@@ -1414,7 +1408,7 @@ discard block |
||
1414 | 1408 | * @param string $action "add" or "delete" |
1415 | 1409 | * @param boolean|int|string $group ID of the group to create the favorite for, or 'all' for all users |
1416 | 1410 | * @param array $filters =array() key => value pairs for the filter |
1417 | - * @return boolean Success |
|
1411 | + * @return boolean|null Success |
|
1418 | 1412 | */ |
1419 | 1413 | public static function ajax_set_favorite($app, $name, $action, $group, $filters = array()) |
1420 | 1414 | { |
@@ -62,16 +62,16 @@ discard block |
||
62 | 62 | var $template_dirs = array(); |
63 | 63 | |
64 | 64 | /** |
65 | - * true if $this->header() was called |
|
66 | - * |
|
67 | - * @var boolean |
|
68 | - */ |
|
65 | + * true if $this->header() was called |
|
66 | + * |
|
67 | + * @var boolean |
|
68 | + */ |
|
69 | 69 | static $header_done = false; |
70 | 70 | /** |
71 | - * true if $this->navbar() was called |
|
72 | - * |
|
73 | - * @var boolean |
|
74 | - */ |
|
71 | + * true if $this->navbar() was called |
|
72 | + * |
|
73 | + * @var boolean |
|
74 | + */ |
|
75 | 75 | static $navbar_done = false; |
76 | 76 | |
77 | 77 | /** |
@@ -1044,13 +1044,13 @@ discard block |
||
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | /** |
1047 | - * Compile entries for topmenu: |
|
1048 | - * - regular items: links |
|
1049 | - * - info items |
|
1050 | - * |
|
1051 | - * @param array $vars |
|
1052 | - * @param array $apps |
|
1053 | - */ |
|
1047 | + * Compile entries for topmenu: |
|
1048 | + * - regular items: links |
|
1049 | + * - info items |
|
1050 | + * |
|
1051 | + * @param array $vars |
|
1052 | + * @param array $apps |
|
1053 | + */ |
|
1054 | 1054 | function topmenu(array $vars,array $apps) |
1055 | 1055 | { |
1056 | 1056 | if($GLOBALS['egw_info']['user']['apps']['home'] && isset($apps['home'])) |
@@ -1154,39 +1154,39 @@ discard block |
||
1154 | 1154 | } |
1155 | 1155 | |
1156 | 1156 | /** |
1157 | - * Add menu items to the topmenu template class to be displayed |
|
1158 | - * |
|
1159 | - * @param array $app application data |
|
1160 | - * @param mixed $alt_label string with alternative menu item label default value = null |
|
1161 | - * @param string $urlextra string with alternate additional code inside <a>-tag |
|
1162 | - * @access protected |
|
1163 | - * @return void |
|
1164 | - */ |
|
1157 | + * Add menu items to the topmenu template class to be displayed |
|
1158 | + * |
|
1159 | + * @param array $app application data |
|
1160 | + * @param mixed $alt_label string with alternative menu item label default value = null |
|
1161 | + * @param string $urlextra string with alternate additional code inside <a>-tag |
|
1162 | + * @access protected |
|
1163 | + * @return void |
|
1164 | + */ |
|
1165 | 1165 | abstract function _add_topmenu_item(array $app_data,$alt_label=null); |
1166 | 1166 | |
1167 | 1167 | /** |
1168 | - * Add info items to the topmenu template class to be displayed |
|
1169 | - * |
|
1170 | - * @param string $content Html of item |
|
1171 | - * @param string $id =null |
|
1172 | - * @access protected |
|
1173 | - * @return void |
|
1174 | - */ |
|
1168 | + * Add info items to the topmenu template class to be displayed |
|
1169 | + * |
|
1170 | + * @param string $content Html of item |
|
1171 | + * @param string $id =null |
|
1172 | + * @access protected |
|
1173 | + * @return void |
|
1174 | + */ |
|
1175 | 1175 | abstract function _add_topmenu_info_item($content, $id=null); |
1176 | 1176 | |
1177 | 1177 | static $top_menu_extra = array(); |
1178 | 1178 | |
1179 | 1179 | /** |
1180 | - * Called by hooks to add an entry in the topmenu location. |
|
1181 | - * Extra entries will be added just before Logout. |
|
1182 | - * |
|
1183 | - * @param string $id unique element id |
|
1184 | - * @param string $url Address for the entry to link to |
|
1185 | - * @param string $title Text displayed for the entry |
|
1186 | - * @param string $target Optional, so the entry can open in a new page or popup |
|
1187 | - * @access public |
|
1188 | - * @return void |
|
1189 | - */ |
|
1180 | + * Called by hooks to add an entry in the topmenu location. |
|
1181 | + * Extra entries will be added just before Logout. |
|
1182 | + * |
|
1183 | + * @param string $id unique element id |
|
1184 | + * @param string $url Address for the entry to link to |
|
1185 | + * @param string $title Text displayed for the entry |
|
1186 | + * @param string $target Optional, so the entry can open in a new page or popup |
|
1187 | + * @access public |
|
1188 | + * @return void |
|
1189 | + */ |
|
1190 | 1190 | public static function add_topmenu_item($id,$url,$title,$target = '') |
1191 | 1191 | { |
1192 | 1192 | $entry['name'] = $id; |
@@ -1198,16 +1198,16 @@ discard block |
||
1198 | 1198 | } |
1199 | 1199 | |
1200 | 1200 | /** |
1201 | - * called by hooks to add an icon in the topmenu info location |
|
1202 | - * |
|
1203 | - * @param string $id unique element id |
|
1204 | - * @param string $icon_src src of the icon image. Make sure this nog height then 18pixels |
|
1205 | - * @param string $iconlink where the icon links to |
|
1206 | - * @param booleon $blink set true to make the icon blink |
|
1207 | - * @param mixed $tooltip string containing the tooltip html, or null of no tooltip |
|
1208 | - * @access public |
|
1209 | - * @return void |
|
1210 | - */ |
|
1201 | + * called by hooks to add an icon in the topmenu info location |
|
1202 | + * |
|
1203 | + * @param string $id unique element id |
|
1204 | + * @param string $icon_src src of the icon image. Make sure this nog height then 18pixels |
|
1205 | + * @param string $iconlink where the icon links to |
|
1206 | + * @param booleon $blink set true to make the icon blink |
|
1207 | + * @param mixed $tooltip string containing the tooltip html, or null of no tooltip |
|
1208 | + * @access public |
|
1209 | + * @return void |
|
1210 | + */ |
|
1211 | 1211 | abstract function topmenu_info_icon($id,$icon_src,$iconlink,$blink=false,$tooltip=null); |
1212 | 1212 | |
1213 | 1213 | /** |
@@ -1242,19 +1242,19 @@ discard block |
||
1242 | 1242 | protected static $js_include_mgr; |
1243 | 1243 | |
1244 | 1244 | /** |
1245 | - * Checks to make sure a valid package and file name is provided |
|
1246 | - * |
|
1247 | - * Example call syntax: |
|
1248 | - * a) Api\Framework::includeJS('jscalendar','calendar') |
|
1249 | - * --> /phpgwapi/js/jscalendar/calendar.js |
|
1250 | - * b) Api\Framework::includeJS('/phpgwapi/inc/calendar-setup.js',array('lang'=>'de')) |
|
1251 | - * --> /phpgwapi/inc/calendar-setup.js?lang=de |
|
1252 | - * |
|
1253 | - * @param string $package package or complete path (relative to EGW_SERVER_ROOT) to be included |
|
1254 | - * @param string|array $file =null file to be included - no ".js" on the end or array with get params |
|
1255 | - * @param string $app ='phpgwapi' application directory to search - default = phpgwapi |
|
1256 | - * @param boolean $append =true should the file be added |
|
1257 | - */ |
|
1245 | + * Checks to make sure a valid package and file name is provided |
|
1246 | + * |
|
1247 | + * Example call syntax: |
|
1248 | + * a) Api\Framework::includeJS('jscalendar','calendar') |
|
1249 | + * --> /phpgwapi/js/jscalendar/calendar.js |
|
1250 | + * b) Api\Framework::includeJS('/phpgwapi/inc/calendar-setup.js',array('lang'=>'de')) |
|
1251 | + * --> /phpgwapi/inc/calendar-setup.js?lang=de |
|
1252 | + * |
|
1253 | + * @param string $package package or complete path (relative to EGW_SERVER_ROOT) to be included |
|
1254 | + * @param string|array $file =null file to be included - no ".js" on the end or array with get params |
|
1255 | + * @param string $app ='phpgwapi' application directory to search - default = phpgwapi |
|
1256 | + * @param boolean $append =true should the file be added |
|
1257 | + */ |
|
1258 | 1258 | static function includeJS($package, $file=null, $app='phpgwapi') |
1259 | 1259 | { |
1260 | 1260 | self::$js_include_mgr->include_js_file($package, $file, $app); |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | */ |
355 | 355 | public function _get_footer() |
356 | 356 | { |
357 | - $var = Array( |
|
357 | + $var = array( |
|
358 | 358 | 'img_root' => $GLOBALS['egw_info']['server']['webserver_url'] . $this->template_dir.'/images', |
359 | 359 | 'version' => $GLOBALS['egw_info']['server']['versions']['phpgwapi'] |
360 | 360 | ); |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | |
764 | 764 | $icon = isset($data['icon']) ? $data['icon'] : 'navbar'; |
765 | 765 | $icon_app = isset($data['icon_app']) ? $data['icon_app'] : $app; |
766 | - $apps[$app]['icon'] = $apps[$app]['icon_hover'] = Image::find($icon_app,Array($icon,'nonav'),'',$svg); |
|
766 | + $apps[$app]['icon'] = $apps[$app]['icon_hover'] = Image::find($icon_app,array($icon,'nonav'),'',$svg); |
|
767 | 767 | } |
768 | 768 | } |
769 | 769 | |
@@ -796,13 +796,13 @@ discard block |
||
796 | 796 | // We handle this here because its special |
797 | 797 | $apps['about']['title'] = 'EGroupware'; |
798 | 798 | $apps['about']['url'] = self::link('/about.php'); |
799 | - $apps['about']['icon'] = $apps['about']['icon_hover'] = Image::find('api',Array('about','nonav')); |
|
799 | + $apps['about']['icon'] = $apps['about']['icon_hover'] = Image::find('api',array('about','nonav')); |
|
800 | 800 | $apps['about']['name'] = 'about'; |
801 | 801 | |
802 | 802 | $apps['logout']['title'] = lang('Logout'); |
803 | 803 | $apps['logout']['name'] = 'logout'; |
804 | 804 | $apps['logout']['url'] = self::link('/logout.php'); |
805 | - $apps['logout']['icon'] = $apps['logout']['icon_hover'] = Image::find('api',Array('logout','nonav')); |
|
805 | + $apps['logout']['icon'] = $apps['logout']['icon_hover'] = Image::find('api',array('logout','nonav')); |
|
806 | 806 | |
807 | 807 | return $apps; |
808 | 808 | } |
@@ -117,7 +117,10 @@ discard block |
||
117 | 117 | if (file_exists(EGW_SERVER_ROOT.'/phpgwapi')) |
118 | 118 | { |
119 | 119 | // default to idots, if no template_set set, to eg. not stall installations if settings use self::link |
120 | - if (empty($GLOBALS['egw_info']['server']['template_set'])) $GLOBALS['egw_info']['server']['template_set'] = 'idots'; |
|
120 | + if (empty($GLOBALS['egw_info']['server']['template_set'])) |
|
121 | + { |
|
122 | + $GLOBALS['egw_info']['server']['template_set'] = 'idots'; |
|
123 | + } |
|
121 | 124 | // setup the new eGW framework (template sets) |
122 | 125 | $class = $GLOBALS['egw_info']['server']['template_set'].'_framework'; |
123 | 126 | if (!class_exists($class) && // first try to autoload the class |
@@ -241,7 +244,10 @@ discard block |
||
241 | 244 | } |
242 | 245 | |
243 | 246 | // commit session (if existing), to fix timing problems sometimes preventing session creation ("Your session can not be verified") |
244 | - if (isset($GLOBALS['egw']->session)) $GLOBALS['egw']->session->commit_session(); |
|
247 | + if (isset($GLOBALS['egw']->session)) |
|
248 | + { |
|
249 | + $GLOBALS['egw']->session->commit_session(); |
|
250 | + } |
|
245 | 251 | |
246 | 252 | exit; |
247 | 253 | } |
@@ -271,8 +277,14 @@ discard block |
||
271 | 277 | */ |
272 | 278 | function render($content,$app_header=null,$navbar=null) |
273 | 279 | { |
274 | - if (!is_null($app_header)) $GLOBALS['egw_info']['flags']['app_header'] = $app_header; |
|
275 | - if (!is_null($navbar)) $GLOBALS['egw_info']['flags']['nonavbar'] = !$navbar; |
|
280 | + if (!is_null($app_header)) |
|
281 | + { |
|
282 | + $GLOBALS['egw_info']['flags']['app_header'] = $app_header; |
|
283 | + } |
|
284 | + if (!is_null($navbar)) |
|
285 | + { |
|
286 | + $GLOBALS['egw_info']['flags']['nonavbar'] = !$navbar; |
|
287 | + } |
|
276 | 288 | |
277 | 289 | echo $this->header(); |
278 | 290 | |
@@ -450,7 +462,10 @@ discard block |
||
450 | 462 | // send appheader to clientside |
451 | 463 | $extra['app-header'] = $app_header; |
452 | 464 | |
453 | - if($GLOBALS['egw_info']['flags']['currentapp'] != 'wiki') $robots ='<meta name="robots" content="none" />'; |
|
465 | + if($GLOBALS['egw_info']['flags']['currentapp'] != 'wiki') |
|
466 | + { |
|
467 | + $robots ='<meta name="robots" content="none" />'; |
|
468 | + } |
|
454 | 469 | |
455 | 470 | if (substr($GLOBALS['egw_info']['server']['favicon_file'],0,4) == 'http') |
456 | 471 | { |
@@ -692,13 +707,19 @@ discard block |
||
692 | 707 | $ind_b = isset($arr[$b['name']]) ? $arr[$b['name']] : null; |
693 | 708 | |
694 | 709 | if ($ind_a == $ind_b) |
695 | - return 0; |
|
710 | + { |
|
711 | + return 0; |
|
712 | + } |
|
696 | 713 | |
697 | 714 | if ($ind_a == null) |
698 | - return -1; |
|
715 | + { |
|
716 | + return -1; |
|
717 | + } |
|
699 | 718 | |
700 | 719 | if ($ind_b == null) |
701 | - return 1; |
|
720 | + { |
|
721 | + return 1; |
|
722 | + } |
|
702 | 723 | |
703 | 724 | return $ind_a > $ind_b ? 1 : -1; |
704 | 725 | } |
@@ -787,9 +808,12 @@ discard block |
||
787 | 808 | $app_title = $GLOBALS['egw_info']['apps'][$app]['title']; |
788 | 809 | } |
789 | 810 | |
790 | - if ($GLOBALS['egw_info']['user']['apps']['preferences']) // Preferences last |
|
811 | + if ($GLOBALS['egw_info']['user']['apps']['preferences']) |
|
812 | + { |
|
813 | + // Preferences last |
|
791 | 814 | { |
792 | 815 | $prefs = $apps['preferences']; |
816 | + } |
|
793 | 817 | unset($apps['preferences']); |
794 | 818 | $apps['preferences'] = $prefs; |
795 | 819 | } |
@@ -839,7 +863,10 @@ discard block |
||
839 | 863 | $themes_to_check[] = $this->template_dir.'/css/'.$this->template.'.css'; |
840 | 864 | foreach($themes_to_check as $theme_css) |
841 | 865 | { |
842 | - if (file_exists(EGW_SERVER_ROOT.$theme_css)) break; |
|
866 | + if (file_exists(EGW_SERVER_ROOT.$theme_css)) |
|
867 | + { |
|
868 | + break; |
|
869 | + } |
|
843 | 870 | } |
844 | 871 | $debug_minify = $GLOBALS['egw_info']['server']['debug_minify'] === 'True'; |
845 | 872 | if (!$debug_minify && file_exists(EGW_SERVER_ROOT.($theme_min_css = str_replace('.css', '.min.css', $theme_css)))) |
@@ -929,7 +956,9 @@ discard block |
||
929 | 956 | } |
930 | 957 | |
931 | 958 | $extra['url'] = $GLOBALS['egw_info']['server']['webserver_url']; |
932 | - $extra['include'] = array_map(function($str){return substr($str,1);}, self::get_script_links(true), array(1)); |
|
959 | + $extra['include'] = array_map(function($str) |
|
960 | + { |
|
961 | +return substr($str,1);}, self::get_script_links(true), array(1)); |
|
933 | 962 | $extra['app'] = $GLOBALS['egw_info']['flags']['currentapp']; |
934 | 963 | |
935 | 964 | // Load LABjs ONCE here |
@@ -941,7 +970,10 @@ discard block |
||
941 | 970 | // add values of extra parameter and class var as data attributes to script tag of egw.js |
942 | 971 | foreach($extra+self::$extra as $name => $value) |
943 | 972 | { |
944 | - if (is_array($value)) $value = json_encode($value); |
|
973 | + if (is_array($value)) |
|
974 | + { |
|
975 | + $value = json_encode($value); |
|
976 | + } |
|
945 | 977 | // we need to double encode (Html::htmlspecialchars( , TRUE)), as otherwise we get invalid json, eg. for quotes |
946 | 978 | $java_script .= ' data-'.$name."=\"". Html::htmlspecialchars($value, true)."\""; |
947 | 979 | } |
@@ -991,7 +1023,10 @@ discard block |
||
991 | 1023 | if (preg_match('/'."\.css$".'/i', $file)) |
992 | 1024 | { |
993 | 1025 | list($name) = explode('.',$file); |
994 | - if (!isset($list[$name])) $list[$name] = ucfirst ($name); |
|
1026 | + if (!isset($list[$name])) |
|
1027 | + { |
|
1028 | + $list[$name] = ucfirst ($name); |
|
1029 | + } |
|
995 | 1030 | } |
996 | 1031 | } |
997 | 1032 | closedir($dh); |
@@ -1094,7 +1129,8 @@ discard block |
||
1094 | 1129 | |
1095 | 1130 | Hooks::process('topmenu_info',array(),true); |
1096 | 1131 | // Add extra items added by hooks |
1097 | - foreach(self::$top_menu_extra as $extra_item) { |
|
1132 | + foreach(self::$top_menu_extra as $extra_item) |
|
1133 | + { |
|
1098 | 1134 | $this->_add_topmenu_item($extra_item); |
1099 | 1135 | } |
1100 | 1136 | |
@@ -1119,7 +1155,10 @@ discard block |
||
1119 | 1155 | protected function add_preferences_topmenu($type='prefs') |
1120 | 1156 | { |
1121 | 1157 | static $memberships=null; |
1122 | - if (!isset($memberships)) $memberships = $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'], true); |
|
1158 | + if (!isset($memberships)) |
|
1159 | + { |
|
1160 | + $memberships = $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'], true); |
|
1161 | + } |
|
1123 | 1162 | static $types = array( |
1124 | 1163 | 'prefs' => array( |
1125 | 1164 | 'title' => 'Preferences', |
@@ -1147,7 +1186,10 @@ discard block |
||
1147 | 1186 | // as all apps answer, we need to remove none-true responses |
1148 | 1187 | foreach($apps as $app => $val) |
1149 | 1188 | { |
1150 | - if (!$val) unset($apps[$app]); |
|
1189 | + if (!$val) |
|
1190 | + { |
|
1191 | + unset($apps[$app]); |
|
1192 | + } |
|
1151 | 1193 | } |
1152 | 1194 | } |
1153 | 1195 | else |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | if (empty($GLOBALS['egw_info']['server']['template_set'])) $GLOBALS['egw_info']['server']['template_set'] = 'idots'; |
121 | 121 | // setup the new eGW framework (template sets) |
122 | 122 | $class = $GLOBALS['egw_info']['server']['template_set'].'_framework'; |
123 | - if (!class_exists($class) && // first try to autoload the class |
|
124 | - file_exists($file=EGW_INCLUDE_ROOT.'/phpgwapi/templates/'.$GLOBALS['egw_info']['server']['template_set'].'/class.'.$class.'.inc.php')) |
|
123 | + if (!class_exists($class) && // first try to autoload the class |
|
124 | + file_exists($file = EGW_INCLUDE_ROOT.'/phpgwapi/templates/'.$GLOBALS['egw_info']['server']['template_set'].'/class.'.$class.'.inc.php')) |
|
125 | 125 | { |
126 | 126 | require_once($file); |
127 | - if (!in_array($file,(array)$_SESSION['egw_required_files'])) |
|
127 | + if (!in_array($file, (array)$_SESSION['egw_required_files'])) |
|
128 | 128 | { |
129 | - $_SESSION['egw_required_files'][] = $file; // automatic load the used framework class, when the object get's restored |
|
129 | + $_SESSION['egw_required_files'][] = $file; // automatic load the used framework class, when the object get's restored |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | Header\ContentSecurityPolicy::send(); |
154 | 154 | |
155 | 155 | // allow client-side to detect first load aka just logged in |
156 | - $reload_count =& Cache::getSession(__CLASS__, 'framework-reload'); |
|
156 | + $reload_count = & Cache::getSession(__CLASS__, 'framework-reload'); |
|
157 | 157 | self::$extra['framework-reload'] = (int)(bool)$reload_count++; |
158 | 158 | } |
159 | 159 | |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | * @param string $link_app =null if appname or true, some templates generate a special link-handler url |
184 | 184 | * @return string The full url after processing |
185 | 185 | */ |
186 | - static function link($url, $extravars = '', $link_app=null) |
|
186 | + static function link($url, $extravars = '', $link_app = null) |
|
187 | 187 | { |
188 | - unset($link_app); // not used by required by function signature |
|
188 | + unset($link_app); // not used by required by function signature |
|
189 | 189 | return $GLOBALS['egw']->session->link($url, $extravars); |
190 | 190 | } |
191 | 191 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @param string $url url to redirect to |
198 | 198 | * @param string $link_app =null appname to redirect for, default currentapp |
199 | 199 | */ |
200 | - static function redirect($url, $link_app=null) |
|
200 | + static function redirect($url, $link_app = null) |
|
201 | 201 | { |
202 | 202 | // Determines whether the current output buffer should be flushed |
203 | 203 | $do_flush = true; |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | else |
220 | 220 | { |
221 | 221 | $file = $line = null; |
222 | - if (headers_sent($file,$line)) |
|
222 | + if (headers_sent($file, $line)) |
|
223 | 223 | { |
224 | 224 | throw new Exception\AssertionFailed(__METHOD__."('".htmlspecialchars($url)."') can NOT redirect, output already started at $file line $line!"); |
225 | 225 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * @param string $link_app =null if appname or true, some templates generate a special link-handler url |
255 | 255 | * @return string The full url after processing |
256 | 256 | */ |
257 | - static function redirect_link($url, $extravars='', $link_app=null) |
|
257 | + static function redirect_link($url, $extravars = '', $link_app = null) |
|
258 | 258 | { |
259 | 259 | self::redirect(self::link($url, $extravars), $link_app); |
260 | 260 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * @param string $navbar =null show the navigation, default !$GLOBALS['egw_info']['flags']['nonavbar'], false gives a typical popu |
270 | 270 | * |
271 | 271 | */ |
272 | - function render($content,$app_header=null,$navbar=null) |
|
272 | + function render($content, $app_header = null, $navbar = null) |
|
273 | 273 | { |
274 | 274 | if (!is_null($app_header)) $GLOBALS['egw_info']['flags']['app_header'] = $app_header; |
275 | 275 | if (!is_null($navbar)) $GLOBALS['egw_info']['flags']['nonavbar'] = !$navbar; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * |
291 | 291 | * @return string with Html |
292 | 292 | */ |
293 | - abstract function header(array $extra=array()); |
|
293 | + abstract function header(array $extra = array()); |
|
294 | 294 | |
295 | 295 | /** |
296 | 296 | * Returns the Html from the body-tag til the main application area (incl. opening div tag) |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * @return boolean $consider_navbar_not_yet_called_as_true=true |
311 | 311 | * @return boolean |
312 | 312 | */ |
313 | - abstract function isTop($consider_navbar_not_yet_called_as_true=true); |
|
313 | + abstract function isTop($consider_navbar_not_yet_called_as_true = true); |
|
314 | 314 | |
315 | 315 | /** |
316 | 316 | * Returns the content of one sidebox |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * @param array $file |
321 | 321 | * @param string $type =null 'admin', 'preferences', 'favorites', ... |
322 | 322 | */ |
323 | - abstract function sidebox($appname,$menu_title,$file,$type=null); |
|
323 | + abstract function sidebox($appname, $menu_title, $file, $type = null); |
|
324 | 324 | |
325 | 325 | /** |
326 | 326 | * Returns the Html from the closing div of the main application area to the closing html-tag |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | * @param string $extra_vars for login url |
336 | 336 | * @param string $change_passwd =null string with message to render input fields for password change |
337 | 337 | */ |
338 | - function login_screen($extra_vars, $change_passwd=null) |
|
338 | + function login_screen($extra_vars, $change_passwd = null) |
|
339 | 339 | { |
340 | 340 | (new Framework\Login($this))->screen($extra_vars, $change_passwd); |
341 | 341 | } |
@@ -373,11 +373,11 @@ discard block |
||
373 | 373 | public function _get_footer() |
374 | 374 | { |
375 | 375 | $var = Array( |
376 | - 'img_root' => $GLOBALS['egw_info']['server']['webserver_url'] . $this->template_dir.'/images', |
|
376 | + 'img_root' => $GLOBALS['egw_info']['server']['webserver_url'].$this->template_dir.'/images', |
|
377 | 377 | 'version' => $GLOBALS['egw_info']['server']['versions']['phpgwapi'] |
378 | 378 | ); |
379 | 379 | $var['page_generation_time'] = ''; |
380 | - if($GLOBALS['egw_info']['user']['preferences']['common']['show_generation_time']) |
|
380 | + if ($GLOBALS['egw_info']['user']['preferences']['common']['show_generation_time']) |
|
381 | 381 | { |
382 | 382 | $times = self::get_page_generation_time(); |
383 | 383 | |
@@ -417,16 +417,16 @@ discard block |
||
417 | 417 | static public function _get_body_attribs() |
418 | 418 | { |
419 | 419 | $js = ''; |
420 | - foreach(self::$body_tags as $what => $data) |
|
420 | + foreach (self::$body_tags as $what => $data) |
|
421 | 421 | { |
422 | 422 | if (!empty($data)) |
423 | 423 | { |
424 | - if($what == 'onLoad') |
|
424 | + if ($what == 'onLoad') |
|
425 | 425 | { |
426 | - $js .= 'onLoad="egw_LAB.wait(function() {'. htmlspecialchars($data).'})"'; |
|
426 | + $js .= 'onLoad="egw_LAB.wait(function() {'.htmlspecialchars($data).'})"'; |
|
427 | 427 | continue; |
428 | 428 | } |
429 | - $js .= ' '.$what.'="' . htmlspecialchars($data) . '"'; |
|
429 | + $js .= ' '.$what.'="'.htmlspecialchars($data).'"'; |
|
430 | 430 | } |
431 | 431 | } |
432 | 432 | return $js; |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | * @param array $extra =array() extra attributes passed as data-attribute to egw.js |
439 | 439 | * @return array |
440 | 440 | */ |
441 | - protected function _get_header(array $extra=array()) |
|
441 | + protected function _get_header(array $extra = array()) |
|
442 | 442 | { |
443 | 443 | // display password expires in N days message once per session |
444 | 444 | $message = null; |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | } |
450 | 450 | |
451 | 451 | // get used language code (with a little xss check, if someone tries to sneak something in) |
452 | - if (preg_match('/^[a-z]{2}(-[a-z]{2})?$/',$GLOBALS['egw_info']['user']['preferences']['common']['lang'])) |
|
452 | + if (preg_match('/^[a-z]{2}(-[a-z]{2})?$/', $GLOBALS['egw_info']['user']['preferences']['common']['lang'])) |
|
453 | 453 | { |
454 | 454 | $lang_code = $GLOBALS['egw_info']['user']['preferences']['common']['lang']; |
455 | 455 | } |
@@ -469,9 +469,9 @@ discard block |
||
469 | 469 | // send appheader to clientside |
470 | 470 | $extra['app-header'] = $app_header; |
471 | 471 | |
472 | - if($GLOBALS['egw_info']['flags']['currentapp'] != 'wiki') $robots ='<meta name="robots" content="none" />'; |
|
472 | + if ($GLOBALS['egw_info']['flags']['currentapp'] != 'wiki') $robots = '<meta name="robots" content="none" />'; |
|
473 | 473 | |
474 | - if (substr($GLOBALS['egw_info']['server']['favicon_file'],0,4) == 'http') |
|
474 | + if (substr($GLOBALS['egw_info']['server']['favicon_file'], 0, 4) == 'http') |
|
475 | 475 | { |
476 | 476 | $var['favicon_file'] = $GLOBALS['egw_info']['server']['favicon_file']; |
477 | 477 | } |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | $include_wz_tooltip = '<script src="'.$GLOBALS['egw_info']['server']['webserver_url']. |
488 | 488 | $wz_tooltip.'?'.filemtime(EGW_SERVER_ROOT.$wz_tooltip).'" type="text/javascript"></script>'; |
489 | 489 | } |
490 | - return $this->_get_css()+array( |
|
490 | + return $this->_get_css() + array( |
|
491 | 491 | 'img_icon' => $var['favicon_file'], |
492 | 492 | 'img_shortcut' => $var['favicon_file'], |
493 | 493 | 'pngfix' => $pngfix, |
@@ -511,15 +511,15 @@ discard block |
||
511 | 511 | */ |
512 | 512 | protected function _get_navbar($apps) |
513 | 513 | { |
514 | - $var['img_root'] = $GLOBALS['egw_info']['server']['webserver_url'] . '/phpgwapi/templates/'.$this->template.'/images'; |
|
514 | + $var['img_root'] = $GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/templates/'.$this->template.'/images'; |
|
515 | 515 | |
516 | - if(isset($GLOBALS['egw_info']['flags']['app_header'])) |
|
516 | + if (isset($GLOBALS['egw_info']['flags']['app_header'])) |
|
517 | 517 | { |
518 | 518 | $var['current_app_title'] = $GLOBALS['egw_info']['flags']['app_header']; |
519 | 519 | } |
520 | 520 | else |
521 | 521 | { |
522 | - $var['current_app_title']=$apps[$GLOBALS['egw_info']['flags']['currentapp']]['title']; |
|
522 | + $var['current_app_title'] = $apps[$GLOBALS['egw_info']['flags']['currentapp']]['title']; |
|
523 | 523 | } |
524 | 524 | $var['currentapp'] = $GLOBALS['egw_info']['flags']['currentapp']; |
525 | 525 | |
@@ -531,32 +531,32 @@ discard block |
||
531 | 531 | |
532 | 532 | $var['user_info'] = $this->_user_time_info(); |
533 | 533 | |
534 | - if($GLOBALS['egw_info']['user']['account_lastpwd_change'] == 0) |
|
534 | + if ($GLOBALS['egw_info']['user']['account_lastpwd_change'] == 0) |
|
535 | 535 | { |
536 | 536 | $api_messages = lang('You are required to change your password during your first login').'<br />'. |
537 | - lang('Click this image on the navbar: %1','<img src="'.Image::find('preferences','navbar.gif').'">'); |
|
537 | + lang('Click this image on the navbar: %1', '<img src="'.Image::find('preferences', 'navbar.gif').'">'); |
|
538 | 538 | } |
539 | - elseif($GLOBALS['egw_info']['server']['change_pwd_every_x_days'] && $GLOBALS['egw_info']['user']['account_lastpwd_change'] < time() - (86400*$GLOBALS['egw_info']['server']['change_pwd_every_x_days'])) |
|
539 | + elseif ($GLOBALS['egw_info']['server']['change_pwd_every_x_days'] && $GLOBALS['egw_info']['user']['account_lastpwd_change'] < time() - (86400 * $GLOBALS['egw_info']['server']['change_pwd_every_x_days'])) |
|
540 | 540 | { |
541 | - $api_messages = lang('it has been more then %1 days since you changed your password',$GLOBALS['egw_info']['server']['change_pwd_every_x_days']); |
|
541 | + $api_messages = lang('it has been more then %1 days since you changed your password', $GLOBALS['egw_info']['server']['change_pwd_every_x_days']); |
|
542 | 542 | } |
543 | 543 | |
544 | - if (substr($GLOBALS['egw_info']['server']['login_logo_file'],0,4) == 'http' || |
|
544 | + if (substr($GLOBALS['egw_info']['server']['login_logo_file'], 0, 4) == 'http' || |
|
545 | 545 | $GLOBALS['egw_info']['server']['login_logo_file'][0] == '/') |
546 | 546 | { |
547 | 547 | $var['logo_file'] = $GLOBALS['egw_info']['server']['login_logo_file']; |
548 | 548 | } |
549 | 549 | else |
550 | 550 | { |
551 | - $var['logo_file'] = Image::find('phpgwapi',$GLOBALS['egw_info']['server']['login_logo_file']?$GLOBALS['egw_info']['server']['login_logo_file']:'logo', '', null); // null=explicit allow svg |
|
551 | + $var['logo_file'] = Image::find('phpgwapi', $GLOBALS['egw_info']['server']['login_logo_file'] ? $GLOBALS['egw_info']['server']['login_logo_file'] : 'logo', '', null); // null=explicit allow svg |
|
552 | 552 | } |
553 | - $var['logo_url'] = $GLOBALS['egw_info']['server']['login_logo_url']?$GLOBALS['egw_info']['server']['login_logo_url']:'http://www.eGroupWare.org'; |
|
553 | + $var['logo_url'] = $GLOBALS['egw_info']['server']['login_logo_url'] ? $GLOBALS['egw_info']['server']['login_logo_url'] : 'http://www.eGroupWare.org'; |
|
554 | 554 | |
555 | - if (substr($var['logo_url'],0,4) != 'http') |
|
555 | + if (substr($var['logo_url'], 0, 4) != 'http') |
|
556 | 556 | { |
557 | 557 | $var['logo_url'] = 'http://'.$var['logo_url']; |
558 | 558 | } |
559 | - $var['logo_title'] = $GLOBALS['egw_info']['server']['login_logo_title']?$GLOBALS['egw_info']['server']['login_logo_title']:'www.eGroupWare.org'; |
|
559 | + $var['logo_title'] = $GLOBALS['egw_info']['server']['login_logo_title'] ? $GLOBALS['egw_info']['server']['login_logo_title'] : 'www.eGroupWare.org'; |
|
560 | 560 | |
561 | 561 | return $var; |
562 | 562 | } |
@@ -569,14 +569,14 @@ discard block |
||
569 | 569 | protected static function _user_time_info() |
570 | 570 | { |
571 | 571 | $now = new DateTime(); |
572 | - $user_info = '<b>'.Accounts::format_username() .'</b>'. ' - ' . lang($now->format('l')) . ' ' . $now->format(true); |
|
572 | + $user_info = '<b>'.Accounts::format_username().'</b>'.' - '.lang($now->format('l')).' '.$now->format(true); |
|
573 | 573 | |
574 | 574 | $user_tzs = DateTime::getUserTimezones(); |
575 | 575 | if (count($user_tzs) > 1) |
576 | 576 | { |
577 | 577 | $tz = $GLOBALS['egw_info']['user']['preferences']['common']['tz']; |
578 | - $user_info .= Html::form(Html::select('tz',$tz,$user_tzs,true),array(), |
|
579 | - '/index.php','','tz_selection',' style="display: inline;"','GET'); |
|
578 | + $user_info .= Html::form(Html::select('tz', $tz, $user_tzs, true), array(), |
|
579 | + '/index.php', '', 'tz_selection', ' style="display: inline;"', 'GET'); |
|
580 | 580 | } |
581 | 581 | return $user_info; |
582 | 582 | } |
@@ -588,10 +588,10 @@ discard block |
||
588 | 588 | */ |
589 | 589 | protected static function _current_users() |
590 | 590 | { |
591 | - if( $GLOBALS['egw_info']['user']['apps']['admin'] && $GLOBALS['egw_info']['user']['preferences']['common']['show_currentusers']) |
|
591 | + if ($GLOBALS['egw_info']['user']['apps']['admin'] && $GLOBALS['egw_info']['user']['preferences']['common']['show_currentusers']) |
|
592 | 592 | { |
593 | - $current_users = '<a href="' . self::link('/index.php','menuaction=admin.admin_accesslog.sessions') . '">' . |
|
594 | - lang('Current users') . ': <span id="currentusers">' . $GLOBALS['egw']->session->session_count() . '</span></a>'; |
|
593 | + $current_users = '<a href="'.self::link('/index.php', 'menuaction=admin.admin_accesslog.sessions').'">'. |
|
594 | + lang('Current users').': <span id="currentusers">'.$GLOBALS['egw']->session->session_count().'</span></a>'; |
|
595 | 595 | return $current_users; |
596 | 596 | } |
597 | 597 | } |
@@ -624,14 +624,14 @@ discard block |
||
624 | 624 | * @param string $password =null password --------- " ---------- |
625 | 625 | * @return resource|null context to use with file_get_context/fopen or null if no proxy configured |
626 | 626 | */ |
627 | - public static function proxy_context($username=null, $password=null) |
|
627 | + public static function proxy_context($username = null, $password = null) |
|
628 | 628 | { |
629 | 629 | $opts = array( |
630 | 630 | 'method' => 'GET', |
631 | 631 | ); |
632 | 632 | if (!empty($GLOBALS['egw_info']['server']['httpproxy_server'])) |
633 | 633 | { |
634 | - $opts += array ( |
|
634 | + $opts += array( |
|
635 | 635 | 'proxy' => 'tcp://'.$GLOBALS['egw_info']['server']['httpproxy_server'].':'. |
636 | 636 | ($GLOBALS['egw_info']['server']['httpproxy_port'] ? $GLOBALS['egw_info']['server']['httpproxy_port'] : 8080), |
637 | 637 | 'request_fulluri' => true, |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | * @param string &$changelog on return path to changelog |
661 | 661 | * @return string |
662 | 662 | */ |
663 | - public static function api_version(&$changelog=null) |
|
663 | + public static function api_version(&$changelog = null) |
|
664 | 664 | { |
665 | 665 | return Framework\Updates::api_version($changelog); |
666 | 666 | } |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | */ |
674 | 674 | public static function index($app) |
675 | 675 | { |
676 | - $data =& $GLOBALS['egw_info']['user']['apps'][$app]; |
|
676 | + $data = & $GLOBALS['egw_info']['user']['apps'][$app]; |
|
677 | 677 | if (!isset($data)) |
678 | 678 | { |
679 | 679 | throw new Exception\WrongParameter("'$app' not a valid app for this user!"); |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | $index = '/index.php?menuaction='.$data['index']; |
691 | 691 | } |
692 | 692 | } |
693 | - return self::link($index,$GLOBALS['egw_info']['flags']['params'][$app]); |
|
693 | + return self::link($index, $GLOBALS['egw_info']['flags']['params'][$app]); |
|
694 | 694 | } |
695 | 695 | |
696 | 696 | /** |
@@ -731,15 +731,15 @@ discard block |
||
731 | 731 | * true: always return svg, false: never return svg (current default), null: browser dependent, see svg_usable() |
732 | 732 | * @return array |
733 | 733 | */ |
734 | - protected static function _get_navbar_apps($svg=false) |
|
734 | + protected static function _get_navbar_apps($svg = false) |
|
735 | 735 | { |
736 | 736 | list($first) = each($GLOBALS['egw_info']['user']['apps']); |
737 | - if(is_array($GLOBALS['egw_info']['user']['apps']['admin']) && $first != 'admin') |
|
737 | + if (is_array($GLOBALS['egw_info']['user']['apps']['admin']) && $first != 'admin') |
|
738 | 738 | { |
739 | 739 | $newarray['admin'] = $GLOBALS['egw_info']['user']['apps']['admin']; |
740 | - foreach($GLOBALS['egw_info']['user']['apps'] as $index => $value) |
|
740 | + foreach ($GLOBALS['egw_info']['user']['apps'] as $index => $value) |
|
741 | 741 | { |
742 | - if($index != 'admin') |
|
742 | + if ($index != 'admin') |
|
743 | 743 | { |
744 | 744 | $newarray[$index] = $value; |
745 | 745 | } |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | unset($newarray); |
753 | 753 | |
754 | 754 | $apps = array(); |
755 | - foreach($GLOBALS['egw_info']['user']['apps'] as $app => $data) |
|
755 | + foreach ($GLOBALS['egw_info']['user']['apps'] as $app => $data) |
|
756 | 756 | { |
757 | 757 | if (is_long($app)) |
758 | 758 | { |
@@ -769,21 +769,21 @@ discard block |
||
769 | 769 | if ($data['status'] == 4) |
770 | 770 | { |
771 | 771 | $apps[$app]['target'] = ' target="'.$app.'" onClick="'."if (this != '') { window.open(this+'". |
772 | - (strpos($apps[$app]['url'],'?') !== false ? '&' : '?'). |
|
772 | + (strpos($apps[$app]['url'], '?') !== false ? '&' : '?'). |
|
773 | 773 | "referer='+encodeURIComponent(location),this.target,'width=800,height=600,scrollbars=yes,resizable=yes'); return false; } else { return true; }".'"'; |
774 | 774 | } |
775 | - elseif(isset($GLOBALS['egw_info']['flags']['navbar_target']) && $GLOBALS['egw_info']['flags']['navbar_target']) |
|
775 | + elseif (isset($GLOBALS['egw_info']['flags']['navbar_target']) && $GLOBALS['egw_info']['flags']['navbar_target']) |
|
776 | 776 | { |
777 | - $apps[$app]['target'] = 'target="' . $GLOBALS['egw_info']['flags']['navbar_target'] . '"'; |
|
777 | + $apps[$app]['target'] = 'target="'.$GLOBALS['egw_info']['flags']['navbar_target'].'"'; |
|
778 | 778 | } |
779 | 779 | else |
780 | 780 | { |
781 | 781 | $apps[$app]['target'] = ''; |
782 | 782 | } |
783 | 783 | |
784 | - $icon = isset($data['icon']) ? $data['icon'] : 'navbar'; |
|
784 | + $icon = isset($data['icon']) ? $data['icon'] : 'navbar'; |
|
785 | 785 | $icon_app = isset($data['icon_app']) ? $data['icon_app'] : $app; |
786 | - $apps[$app]['icon'] = $apps[$app]['icon_hover'] = Image::find($icon_app,Array($icon,'nonav'),'',$svg); |
|
786 | + $apps[$app]['icon'] = $apps[$app]['icon_hover'] = Image::find($icon_app, Array($icon, 'nonav'), '', $svg); |
|
787 | 787 | } |
788 | 788 | } |
789 | 789 | |
@@ -816,13 +816,13 @@ discard block |
||
816 | 816 | // We handle this here because its special |
817 | 817 | $apps['about']['title'] = 'EGroupware'; |
818 | 818 | $apps['about']['url'] = self::link('/about.php'); |
819 | - $apps['about']['icon'] = $apps['about']['icon_hover'] = Image::find('api',Array('about','nonav')); |
|
819 | + $apps['about']['icon'] = $apps['about']['icon_hover'] = Image::find('api', Array('about', 'nonav')); |
|
820 | 820 | $apps['about']['name'] = 'about'; |
821 | 821 | |
822 | 822 | $apps['logout']['title'] = lang('Logout'); |
823 | 823 | $apps['logout']['name'] = 'logout'; |
824 | 824 | $apps['logout']['url'] = self::link('/logout.php'); |
825 | - $apps['logout']['icon'] = $apps['logout']['icon_hover'] = Image::find('api',Array('logout','nonav')); |
|
825 | + $apps['logout']['icon'] = $apps['logout']['icon_hover'] = Image::find('api', Array('logout', 'nonav')); |
|
826 | 826 | |
827 | 827 | return $apps; |
828 | 828 | } |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | } |
857 | 857 | $themes_to_check[] = $this->template_dir.'/css/'.$GLOBALS['egw_info']['user']['preferences']['common']['theme'].'.css'; |
858 | 858 | $themes_to_check[] = $this->template_dir.'/css/'.$this->template.'.css'; |
859 | - foreach($themes_to_check as $theme_css) |
|
859 | + foreach ($themes_to_check as $theme_css) |
|
860 | 860 | { |
861 | 861 | if (file_exists(EGW_SERVER_ROOT.$theme_css)) break; |
862 | 862 | } |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | |
891 | 891 | // sending print css last, so it can overwrite anything |
892 | 892 | $print_css = $this->template_dir.'/print.css'; |
893 | - if(!file_exists(EGW_SERVER_ROOT.$print_css)) |
|
893 | + if (!file_exists(EGW_SERVER_ROOT.$print_css)) |
|
894 | 894 | { |
895 | 895 | $print_css = '/api/templates/default/print.css'; |
896 | 896 | } |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | * @param array $extra =array() extra data to pass to egw.js as data-parameter |
917 | 917 | * @return string the javascript to be included |
918 | 918 | */ |
919 | - public static function _get_js(array $extra=array()) |
|
919 | + public static function _get_js(array $extra = array()) |
|
920 | 920 | { |
921 | 921 | $java_script = ''; |
922 | 922 | |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | Think of conf vars etc... ([email protected]) */ |
925 | 925 | if (isset($GLOBALS['egw_info']['flags']['java_script_thirst'])) |
926 | 926 | { |
927 | - $java_script .= $GLOBALS['egw_info']['flags']['java_script_thirst'] . "\n"; |
|
927 | + $java_script .= $GLOBALS['egw_info']['flags']['java_script_thirst']."\n"; |
|
928 | 928 | } |
929 | 929 | // add configuration, link-registry, images, user-data and -perferences for non-popup windows |
930 | 930 | // specifying etag in url to force reload, as we send expires header |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | self::includeJS('/api/images.php', array( |
937 | 937 | 'template' => $GLOBALS['egw_info']['server']['template_set'], |
938 | 938 | 'etag' => md5(json_encode(Image::map($GLOBALS['egw_info']['server']['template_set']))), |
939 | - 'svg' => Header\UserAgent::mobile(), // always load non-svg image map, ATM we use svg icons only for mobile theme |
|
939 | + 'svg' => Header\UserAgent::mobile(), // always load non-svg image map, ATM we use svg icons only for mobile theme |
|
940 | 940 | )); |
941 | 941 | self::includeJS('/api/user.php', array( |
942 | 942 | 'user' => $GLOBALS['egw_info']['user']['account_lid'], |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | } |
949 | 949 | |
950 | 950 | $extra['url'] = $GLOBALS['egw_info']['server']['webserver_url']; |
951 | - $extra['include'] = array_map(function($str){return substr($str,1);}, self::get_script_links(true), array(1)); |
|
951 | + $extra['include'] = array_map(function($str) {return substr($str, 1); }, self::get_script_links(true), array(1)); |
|
952 | 952 | $extra['app'] = $GLOBALS['egw_info']['flags']['currentapp']; |
953 | 953 | |
954 | 954 | // Load LABjs ONCE here |
@@ -958,18 +958,18 @@ discard block |
||
958 | 958 | '/api/js/jsapi/egw.js?'.filemtime(EGW_SERVER_ROOT.'/api/js/jsapi/egw.js').'" id="egw_script_id"'; |
959 | 959 | |
960 | 960 | // add values of extra parameter and class var as data attributes to script tag of egw.js |
961 | - foreach($extra+self::$extra as $name => $value) |
|
961 | + foreach ($extra + self::$extra as $name => $value) |
|
962 | 962 | { |
963 | 963 | if (is_array($value)) $value = json_encode($value); |
964 | 964 | // we need to double encode (Html::htmlspecialchars( , TRUE)), as otherwise we get invalid json, eg. for quotes |
965 | - $java_script .= ' data-'.$name."=\"". Html::htmlspecialchars($value, true)."\""; |
|
965 | + $java_script .= ' data-'.$name."=\"".Html::htmlspecialchars($value, true)."\""; |
|
966 | 966 | } |
967 | 967 | $java_script .= "></script>\n"; |
968 | 968 | |
969 | - if(@isset($_GET['menuaction'])) |
|
969 | + if (@isset($_GET['menuaction'])) |
|
970 | 970 | { |
971 | - list(, $class) = explode('.',$_GET['menuaction']); |
|
972 | - if(is_array($GLOBALS[$class]->public_functions) && |
|
971 | + list(, $class) = explode('.', $_GET['menuaction']); |
|
972 | + if (is_array($GLOBALS[$class]->public_functions) && |
|
973 | 973 | $GLOBALS[$class]->public_functions['java_script']) |
974 | 974 | { |
975 | 975 | $java_script .= $GLOBALS[$class]->java_script(); |
@@ -978,10 +978,10 @@ discard block |
||
978 | 978 | if (isset($GLOBALS['egw_info']['flags']['java_script'])) |
979 | 979 | { |
980 | 980 | // Strip out any script tags, this needs to be executed as anonymous function |
981 | - $GLOBALS['egw_info']['flags']['java_script'] = preg_replace(array('/(<script[^>]*>)([^<]*)/is','/<\/script>/'),array('$2',''),$GLOBALS['egw_info']['flags']['java_script']); |
|
982 | - if(trim($GLOBALS['egw_info']['flags']['java_script']) != '') |
|
981 | + $GLOBALS['egw_info']['flags']['java_script'] = preg_replace(array('/(<script[^>]*>)([^<]*)/is', '/<\/script>/'), array('$2', ''), $GLOBALS['egw_info']['flags']['java_script']); |
|
982 | + if (trim($GLOBALS['egw_info']['flags']['java_script']) != '') |
|
983 | 983 | { |
984 | - $java_script .= '<script type="text/javascript">window.egw_LAB.wait(function() {'.$GLOBALS['egw_info']['flags']['java_script'] . "});</script>\n"; |
|
984 | + $java_script .= '<script type="text/javascript">window.egw_LAB.wait(function() {'.$GLOBALS['egw_info']['flags']['java_script']."});</script>\n"; |
|
985 | 985 | } |
986 | 986 | } |
987 | 987 | |
@@ -998,7 +998,7 @@ discard block |
||
998 | 998 | function list_themes() |
999 | 999 | { |
1000 | 1000 | $list = array(); |
1001 | - if (file_exists($file=EGW_SERVER_ROOT.$this->template_dir.'/setup/setup.inc.php') && |
|
1001 | + if (file_exists($file = EGW_SERVER_ROOT.$this->template_dir.'/setup/setup.inc.php') && |
|
1002 | 1002 | (include $file) && isset($GLOBALS['egw_info']['template'][$this->template]['themes'])) |
1003 | 1003 | { |
1004 | 1004 | $list = $GLOBALS['egw_info']['template'][$this->template]['themes']; |
@@ -1009,8 +1009,8 @@ discard block |
||
1009 | 1009 | { |
1010 | 1010 | if (preg_match('/'."\.css$".'/i', $file)) |
1011 | 1011 | { |
1012 | - list($name) = explode('.',$file); |
|
1013 | - if (!isset($list[$name])) $list[$name] = ucfirst ($name); |
|
1012 | + list($name) = explode('.', $file); |
|
1013 | + if (!isset($list[$name])) $list[$name] = ucfirst($name); |
|
1014 | 1014 | } |
1015 | 1015 | } |
1016 | 1016 | closedir($dh); |
@@ -1024,21 +1024,20 @@ discard block |
||
1024 | 1024 | * @param boolean $full_data =false true: value is array with values for keys 'name', 'title', ... |
1025 | 1025 | * @returns array alphabetically sorted list of templates |
1026 | 1026 | */ |
1027 | - static function list_templates($full_data=false) |
|
1027 | + static function list_templates($full_data = false) |
|
1028 | 1028 | { |
1029 | - $list = array('pixelegg'=>null,'jdots'=>null,'idots'=>null); |
|
1029 | + $list = array('pixelegg'=>null, 'jdots'=>null, 'idots'=>null); |
|
1030 | 1030 | // templates packaged in old phpgwapi |
1031 | - if (file_exists(EGW_SERVER_ROOT . '/phpgwapi') && ($d = dir(EGW_SERVER_ROOT . '/phpgwapi/templates'))) |
|
1031 | + if (file_exists(EGW_SERVER_ROOT.'/phpgwapi') && ($d = dir(EGW_SERVER_ROOT.'/phpgwapi/templates'))) |
|
1032 | 1032 | { |
1033 | - while (($entry=$d->read())) |
|
1033 | + while (($entry = $d->read())) |
|
1034 | 1034 | { |
1035 | - if ($entry != '..' && file_exists(EGW_SERVER_ROOT . '/phpgwapi/templates/' . $entry .'/class.'.$entry.'_framework.inc.php')) |
|
1035 | + if ($entry != '..' && file_exists(EGW_SERVER_ROOT.'/phpgwapi/templates/'.$entry.'/class.'.$entry.'_framework.inc.php')) |
|
1036 | 1036 | { |
1037 | - if (file_exists ($f = EGW_SERVER_ROOT . '/phpgwapi/templates/' . $entry . '/setup/setup.inc.php')) |
|
1037 | + if (file_exists($f = EGW_SERVER_ROOT.'/phpgwapi/templates/'.$entry.'/setup/setup.inc.php')) |
|
1038 | 1038 | { |
1039 | 1039 | include($f); |
1040 | - $list[$entry] = $full_data ? $GLOBALS['egw_info']['template'][$entry] : |
|
1041 | - $GLOBALS['egw_info']['template'][$entry]['title']; |
|
1040 | + $list[$entry] = $full_data ? $GLOBALS['egw_info']['template'][$entry] : $GLOBALS['egw_info']['template'][$entry]['title']; |
|
1042 | 1041 | } |
1043 | 1042 | else |
1044 | 1043 | { |
@@ -1053,16 +1052,15 @@ discard block |
||
1053 | 1052 | } |
1054 | 1053 | // templates packaged like apps in own directories (containing as setup/setup.inc.php file!) |
1055 | 1054 | $dr = dir(EGW_SERVER_ROOT); |
1056 | - while (($entry=$dr->read())) |
|
1055 | + while (($entry = $dr->read())) |
|
1057 | 1056 | { |
1058 | 1057 | if ($entry != '..' && !isset($GLOBALS['egw_info']['apps'][$entry]) && is_dir(EGW_SERVER_ROOT.'/'.$entry) && |
1059 | - file_exists($f = EGW_SERVER_ROOT . '/' . $entry .'/setup/setup.inc.php')) |
|
1058 | + file_exists($f = EGW_SERVER_ROOT.'/'.$entry.'/setup/setup.inc.php')) |
|
1060 | 1059 | { |
1061 | 1060 | include($f); |
1062 | 1061 | if (isset($GLOBALS['egw_info']['template'][$entry])) |
1063 | 1062 | { |
1064 | - $list[$entry] = $full_data ? $GLOBALS['egw_info']['template'][$entry] : |
|
1065 | - $GLOBALS['egw_info']['template'][$entry]['title']; |
|
1063 | + $list[$entry] = $full_data ? $GLOBALS['egw_info']['template'][$entry] : $GLOBALS['egw_info']['template'][$entry]['title']; |
|
1066 | 1064 | } |
1067 | 1065 | } |
1068 | 1066 | } |
@@ -1079,14 +1077,14 @@ discard block |
||
1079 | 1077 | * @param array $vars |
1080 | 1078 | * @param array $apps |
1081 | 1079 | */ |
1082 | - function topmenu(array $vars,array $apps) |
|
1080 | + function topmenu(array $vars, array $apps) |
|
1083 | 1081 | { |
1084 | - if($GLOBALS['egw_info']['user']['apps']['home'] && isset($apps['home'])) |
|
1082 | + if ($GLOBALS['egw_info']['user']['apps']['home'] && isset($apps['home'])) |
|
1085 | 1083 | { |
1086 | 1084 | $this->_add_topmenu_item($apps['home']); |
1087 | 1085 | } |
1088 | 1086 | |
1089 | - if($GLOBALS['egw_info']['user']['apps']['preferences']) |
|
1087 | + if ($GLOBALS['egw_info']['user']['apps']['preferences']) |
|
1090 | 1088 | { |
1091 | 1089 | $this->add_preferences_topmenu('prefs'); |
1092 | 1090 | $this->add_preferences_topmenu('acl'); |
@@ -1111,9 +1109,9 @@ discard block |
||
1111 | 1109 | $this->_add_topmenu_item(array_merge($apps['manual'],array('title' => lang('Help')))); |
1112 | 1110 | }*/ |
1113 | 1111 | |
1114 | - Hooks::process('topmenu_info',array(),true); |
|
1112 | + Hooks::process('topmenu_info', array(), true); |
|
1115 | 1113 | // Add extra items added by hooks |
1116 | - foreach(self::$top_menu_extra as $extra_item) { |
|
1114 | + foreach (self::$top_menu_extra as $extra_item) { |
|
1117 | 1115 | $this->_add_topmenu_item($extra_item); |
1118 | 1116 | } |
1119 | 1117 | |
@@ -1123,7 +1121,7 @@ discard block |
||
1123 | 1121 | { |
1124 | 1122 | $this->_add_topmenu_info_item($update, 'update'); |
1125 | 1123 | } |
1126 | - if($GLOBALS['egw_info']['user']['apps']['notifications']) |
|
1124 | + if ($GLOBALS['egw_info']['user']['apps']['notifications']) |
|
1127 | 1125 | { |
1128 | 1126 | $this->_add_topmenu_info_item(self::_get_notification_bell(), 'notifications'); |
1129 | 1127 | } |
@@ -1135,9 +1133,9 @@ discard block |
||
1135 | 1133 | /** |
1136 | 1134 | * Add Preferences link to topmenu using settings-hook to know if an app supports Preferences |
1137 | 1135 | */ |
1138 | - protected function add_preferences_topmenu($type='prefs') |
|
1136 | + protected function add_preferences_topmenu($type = 'prefs') |
|
1139 | 1137 | { |
1140 | - static $memberships=null; |
|
1138 | + static $memberships = null; |
|
1141 | 1139 | if (!isset($memberships)) $memberships = $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'], true); |
1142 | 1140 | static $types = array( |
1143 | 1141 | 'prefs' => array( |
@@ -1151,20 +1149,20 @@ discard block |
||
1151 | 1149 | 'cats' => array( |
1152 | 1150 | 'title' => 'Categories', |
1153 | 1151 | 'hook' => 'categories', |
1154 | - 'run_hook' => true, // acturally run hook, not just look it's implemented |
|
1152 | + 'run_hook' => true, // acturally run hook, not just look it's implemented |
|
1155 | 1153 | ), |
1156 | 1154 | ); |
1157 | 1155 | if (!$GLOBALS['egw_info']['user']['apps']['preferences'] || $GLOBALS['egw_info']['server']['deny_'.$type] && |
1158 | 1156 | array_intersect($memberships, (array)$GLOBALS['egw_info']['server']['deny_'.$type]) && |
1159 | 1157 | !$GLOBALS['egw_info']['user']['apps']['admin']) |
1160 | 1158 | { |
1161 | - return; // user has no access to Preferences app |
|
1159 | + return; // user has no access to Preferences app |
|
1162 | 1160 | } |
1163 | 1161 | if (isset($types[$type]['run_hook'])) |
1164 | 1162 | { |
1165 | 1163 | $apps = Hooks::process($types[$type]['hook']); |
1166 | 1164 | // as all apps answer, we need to remove none-true responses |
1167 | - foreach($apps as $app => $val) |
|
1165 | + foreach ($apps as $app => $val) |
|
1168 | 1166 | { |
1169 | 1167 | if (!$val) unset($apps[$app]); |
1170 | 1168 | } |
@@ -1190,7 +1188,7 @@ discard block |
||
1190 | 1188 | * @access protected |
1191 | 1189 | * @return void |
1192 | 1190 | */ |
1193 | - abstract function _add_topmenu_item(array $app_data,$alt_label=null); |
|
1191 | + abstract function _add_topmenu_item(array $app_data, $alt_label = null); |
|
1194 | 1192 | |
1195 | 1193 | /** |
1196 | 1194 | * Add info items to the topmenu template class to be displayed |
@@ -1200,7 +1198,7 @@ discard block |
||
1200 | 1198 | * @access protected |
1201 | 1199 | * @return void |
1202 | 1200 | */ |
1203 | - abstract function _add_topmenu_info_item($content, $id=null); |
|
1201 | + abstract function _add_topmenu_info_item($content, $id = null); |
|
1204 | 1202 | |
1205 | 1203 | static $top_menu_extra = array(); |
1206 | 1204 | |
@@ -1215,7 +1213,7 @@ discard block |
||
1215 | 1213 | * @access public |
1216 | 1214 | * @return void |
1217 | 1215 | */ |
1218 | - public static function add_topmenu_item($id,$url,$title,$target = '') |
|
1216 | + public static function add_topmenu_item($id, $url, $title, $target = '') |
|
1219 | 1217 | { |
1220 | 1218 | $entry['name'] = $id; |
1221 | 1219 | $entry['url'] = $url; |
@@ -1236,7 +1234,7 @@ discard block |
||
1236 | 1234 | * @access public |
1237 | 1235 | * @return void |
1238 | 1236 | */ |
1239 | - abstract function topmenu_info_icon($id,$icon_src,$iconlink,$blink=false,$tooltip=null); |
|
1237 | + abstract function topmenu_info_icon($id, $icon_src, $iconlink, $blink = false, $tooltip = null); |
|
1240 | 1238 | |
1241 | 1239 | /** |
1242 | 1240 | * Call and return content of 'after_navbar' hook |
@@ -1246,7 +1244,7 @@ discard block |
||
1246 | 1244 | protected function _get_after_navbar() |
1247 | 1245 | { |
1248 | 1246 | ob_start(); |
1249 | - Hooks::process('after_navbar',null,true); |
|
1247 | + Hooks::process('after_navbar', null, true); |
|
1250 | 1248 | $content = ob_get_contents(); |
1251 | 1249 | ob_end_clean(); |
1252 | 1250 | |
@@ -1283,7 +1281,7 @@ discard block |
||
1283 | 1281 | * @param string $app ='phpgwapi' application directory to search - default = phpgwapi |
1284 | 1282 | * @param boolean $append =true should the file be added |
1285 | 1283 | */ |
1286 | - static function includeJS($package, $file=null, $app='phpgwapi') |
|
1284 | + static function includeJS($package, $file = null, $app = 'phpgwapi') |
|
1287 | 1285 | { |
1288 | 1286 | self::$js_include_mgr->include_js_file($package, $file, $app); |
1289 | 1287 | } |
@@ -1295,7 +1293,7 @@ discard block |
||
1295 | 1293 | * @param boolean $clear_files =false true clear files after returning them |
1296 | 1294 | * @return array with pathes relative to EGW_SERVER_ROOT |
1297 | 1295 | */ |
1298 | - static function js_files(array $files=null, $clear_files=false) |
|
1296 | + static function js_files(array $files = null, $clear_files = false) |
|
1299 | 1297 | { |
1300 | 1298 | if (isset($files) && is_array($files)) |
1301 | 1299 | { |
@@ -1314,7 +1312,7 @@ discard block |
||
1314 | 1312 | * @param boolean $clear_files =false true clear files after returning them |
1315 | 1313 | * @return string|array see $return_pathes parameter |
1316 | 1314 | */ |
1317 | - static public function get_script_links($return_pathes=false, $clear_files=false) |
|
1315 | + static public function get_script_links($return_pathes = false, $clear_files = false) |
|
1318 | 1316 | { |
1319 | 1317 | $to_include = Framework\Bundle::js_includes(self::$js_include_mgr->get_included_files($clear_files)); |
1320 | 1318 | |
@@ -1322,7 +1320,7 @@ discard block |
||
1322 | 1320 | { |
1323 | 1321 | return $to_include; |
1324 | 1322 | } |
1325 | - $start = '<script type="text/javascript" src="'. $GLOBALS['egw_info']['server']['webserver_url']; |
|
1323 | + $start = '<script type="text/javascript" src="'.$GLOBALS['egw_info']['server']['webserver_url']; |
|
1326 | 1324 | $end = '">'."</script>\n"; |
1327 | 1325 | return "\n".$start.implode($end.$start, $to_include).$end; |
1328 | 1326 | } |
@@ -1342,7 +1340,7 @@ discard block |
||
1342 | 1340 | * @param boolean $no_default_css =false true do NOT load any default css, only what app explicitly includes |
1343 | 1341 | * @return boolean false: css file not found, true: file found |
1344 | 1342 | */ |
1345 | - public static function includeCSS($app, $name=null, $append=true, $no_default_css=false) |
|
1343 | + public static function includeCSS($app, $name = null, $append = true, $no_default_css = false) |
|
1346 | 1344 | { |
1347 | 1345 | if ($no_default_css) |
1348 | 1346 | { |
@@ -1362,16 +1360,16 @@ discard block |
||
1362 | 1360 | |
1363 | 1361 | // try to add app specific css file |
1364 | 1362 | self::includeCSS($app, 'app-'.$GLOBALS['egw_info']['user']['preferences']['common']['theme']) || |
1365 | - self::includeCSS($app,'app'); |
|
1363 | + self::includeCSS($app, 'app'); |
|
1366 | 1364 | |
1367 | 1365 | // add all css files from Framework::includeCSS() |
1368 | 1366 | $query = null; |
1369 | 1367 | //error_log(__METHOD__."() Framework\CssIncludes::get()=".array2string(Framework\CssIncludes::get())); |
1370 | - foreach(Framework\CssIncludes::get() as $path) |
|
1368 | + foreach (Framework\CssIncludes::get() as $path) |
|
1371 | 1369 | { |
1372 | 1370 | unset($query); |
1373 | - list($path,$query) = explode('?',$path,2); |
|
1374 | - $path .= '?'. ($query ? $query : filemtime(EGW_SERVER_ROOT.$path)); |
|
1371 | + list($path, $query) = explode('?', $path, 2); |
|
1372 | + $path .= '?'.($query ? $query : filemtime(EGW_SERVER_ROOT.$path)); |
|
1375 | 1373 | $response->includeCSS($GLOBALS['egw_info']['server']['webserver_url'].$path); |
1376 | 1374 | } |
1377 | 1375 | |
@@ -1380,7 +1378,7 @@ discard block |
||
1380 | 1378 | |
1381 | 1379 | // add all js files from Framework::includeJS() |
1382 | 1380 | $files = Framework\Bundle::js_includes(self::$js_include_mgr->get_included_files()); |
1383 | - foreach($files as $path) |
|
1381 | + foreach ($files as $path) |
|
1384 | 1382 | { |
1385 | 1383 | $response->includeScript($GLOBALS['egw_info']['server']['webserver_url'].$path); |
1386 | 1384 | } |
@@ -1456,17 +1454,17 @@ discard block |
||
1456 | 1454 | */ |
1457 | 1455 | public static function ajax_user_list() |
1458 | 1456 | { |
1459 | - $list = array('accounts' => array(),'groups' => array(), 'owngroups' => array()); |
|
1460 | - if($GLOBALS['egw_info']['user']['preferences']['common']['account_selection'] == 'primary_group') |
|
1457 | + $list = array('accounts' => array(), 'groups' => array(), 'owngroups' => array()); |
|
1458 | + if ($GLOBALS['egw_info']['user']['preferences']['common']['account_selection'] == 'primary_group') |
|
1461 | 1459 | { |
1462 | 1460 | $list['accounts']['filter']['group'] = $GLOBALS['egw_info']['user']['account_primary_group']; |
1463 | 1461 | } |
1464 | - foreach($list as $type => &$accounts) |
|
1462 | + foreach ($list as $type => &$accounts) |
|
1465 | 1463 | { |
1466 | 1464 | $options = array('account_type' => $type) + $accounts; |
1467 | - $key_pair = Accounts::link_query('',$options); |
|
1465 | + $key_pair = Accounts::link_query('', $options); |
|
1468 | 1466 | $accounts = array(); |
1469 | - foreach($key_pair as $account_id => $name) |
|
1467 | + foreach ($key_pair as $account_id => $name) |
|
1470 | 1468 | { |
1471 | 1469 | $accounts[] = array('value' => $account_id, 'label' => $name); |
1472 | 1470 | } |
@@ -1484,16 +1482,16 @@ discard block |
||
1484 | 1482 | * @param boolean $_resolve_groups =false true: return attribute for all members, false return attribute for group itself |
1485 | 1483 | * @return array account_id => data pairs |
1486 | 1484 | */ |
1487 | - public static function ajax_account_data($_account_ids, $_field, $_resolve_groups=false) |
|
1485 | + public static function ajax_account_data($_account_ids, $_field, $_resolve_groups = false) |
|
1488 | 1486 | { |
1489 | 1487 | $list = array(); |
1490 | - foreach((array)$_account_ids as $account_id) |
|
1488 | + foreach ((array)$_account_ids as $account_id) |
|
1491 | 1489 | { |
1492 | - foreach($account_id < 0 && $_resolve_groups ? |
|
1490 | + foreach ($account_id < 0 && $_resolve_groups ? |
|
1493 | 1491 | $GLOBALS['egw']->accounts->members($account_id, true) : array($account_id) as $account_id) |
1494 | 1492 | { |
1495 | 1493 | // Make sure name is formatted according to preference |
1496 | - if($_field == 'account_fullname') |
|
1494 | + if ($_field == 'account_fullname') |
|
1497 | 1495 | { |
1498 | 1496 | $list[$account_id] = Accounts::format_username( |
1499 | 1497 | $GLOBALS['egw']->accounts->id2name($account_id, 'account_lid'), |
@@ -145,7 +145,7 @@ |
||
145 | 145 | * Parse beginning of given CSS file for /*@import url("...") statements |
146 | 146 | * |
147 | 147 | * @param string $path EGroupware relative path eg. /phpgwapi/templates/default/some.css |
148 | - * @return array parsed pathes (EGroupware relative) including $path itself |
|
148 | + * @return string[] parsed pathes (EGroupware relative) including $path itself |
|
149 | 149 | */ |
150 | 150 | protected static function resolve_css_includes($path, &$pathes=array()) |
151 | 151 | { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param boolean $clear_includes =false true: clear all previous includes |
35 | 35 | * @return boolean false: css file not found, true: file found |
36 | 36 | */ |
37 | - public static function add($app, $name=null, $append=true, $clear_includes=false) |
|
37 | + public static function add($app, $name = null, $append = true, $clear_includes = false) |
|
38 | 38 | { |
39 | 39 | if ($clear_includes) |
40 | 40 | { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | if (!is_null($name)) |
45 | 45 | { |
46 | - foreach($GLOBALS['egw']->framework->template_dirs as $dir) |
|
46 | + foreach ($GLOBALS['egw']->framework->template_dirs as $dir) |
|
47 | 47 | { |
48 | 48 | if (file_exists(EGW_SERVER_ROOT.($path = '/'.$app.'/templates/'.$dir.'/'.$name.'.css'))) |
49 | 49 | { |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | { |
56 | 56 | $path = $app; |
57 | 57 | } |
58 | - if (!file_exists(EGW_SERVER_ROOT.$path) && !file_exists(EGW_SERVER_ROOT . parse_url($path,PHP_URL_PATH))) |
|
58 | + if (!file_exists(EGW_SERVER_ROOT.$path) && !file_exists(EGW_SERVER_ROOT.parse_url($path, PHP_URL_PATH))) |
|
59 | 59 | { |
60 | 60 | //error_log(__METHOD__."($app,$name) $path NOT found!"); |
61 | 61 | return false; |
62 | 62 | } |
63 | - if (!in_array($path,self::$files)) |
|
63 | + if (!in_array($path, self::$files)) |
|
64 | 64 | { |
65 | 65 | if ($append) |
66 | 66 | { |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @return string |
81 | 81 | */ |
82 | - public static function get($resolve=false) |
|
82 | + public static function get($resolve = false) |
|
83 | 83 | { |
84 | 84 | if (!$resolve) |
85 | 85 | { |
86 | 86 | return self::$files; |
87 | 87 | } |
88 | 88 | $files = array(); |
89 | - foreach(self::$files as $path) |
|
89 | + foreach (self::$files as $path) |
|
90 | 90 | { |
91 | - foreach(self::resolve_css_includes($path) as $path) |
|
91 | + foreach (self::resolve_css_includes($path) as $path) |
|
92 | 92 | { |
93 | 93 | $files[] = $path; |
94 | 94 | } |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | $base_path = $GLOBALS['egw_info']['server']['webserver_url']; |
110 | 110 | if ($base_path[0] != '/') $base_path = parse_url($base_path, PHP_URL_PATH); |
111 | 111 | $css_files = ''; |
112 | - foreach(self::$files as $path) |
|
112 | + foreach (self::$files as $path) |
|
113 | 113 | { |
114 | - foreach(self::resolve_css_includes($path) as $path) |
|
114 | + foreach (self::resolve_css_includes($path) as $path) |
|
115 | 115 | { |
116 | - list($file,$query) = explode('?',$path,2); |
|
116 | + list($file, $query) = explode('?', $path, 2); |
|
117 | 117 | if (($mod = filemtime(EGW_SERVER_ROOT.$file)) > $max_modified) $max_modified = $mod; |
118 | 118 | |
119 | 119 | // do NOT include app.css or categories.php, as it changes from app to app |
@@ -147,20 +147,20 @@ discard block |
||
147 | 147 | * @param string $path EGroupware relative path eg. /phpgwapi/templates/default/some.css |
148 | 148 | * @return array parsed pathes (EGroupware relative) including $path itself |
149 | 149 | */ |
150 | - protected static function resolve_css_includes($path, &$pathes=array()) |
|
150 | + protected static function resolve_css_includes($path, &$pathes = array()) |
|
151 | 151 | { |
152 | 152 | $matches = null; |
153 | 153 | |
154 | - list($file) = explode('?',$path,2); |
|
155 | - if (($to_check = file_get_contents (EGW_SERVER_ROOT.$file, false, null, -1, 1024)) && |
|
154 | + list($file) = explode('?', $path, 2); |
|
155 | + if (($to_check = file_get_contents(EGW_SERVER_ROOT.$file, false, null, -1, 1024)) && |
|
156 | 156 | stripos($to_check, '/*@import') !== false && preg_match_all('|/\*@import url\("([^"]+)"|i', $to_check, $matches)) |
157 | 157 | { |
158 | - foreach($matches[1] as $import_path) |
|
158 | + foreach ($matches[1] as $import_path) |
|
159 | 159 | { |
160 | 160 | if ($import_path[0] != '/') |
161 | 161 | { |
162 | 162 | $dir = dirname($path); |
163 | - while(substr($import_path,0,3) == '../') |
|
163 | + while (substr($import_path, 0, 3) == '../') |
|
164 | 164 | { |
165 | 165 | $dir = dirname($dir); |
166 | 166 | $import_path = substr($import_path, 3); |
@@ -107,14 +107,20 @@ |
||
107 | 107 | $max_modified = 0; |
108 | 108 | //no more dynamic minifying: $debug_minify = $GLOBALS['egw_info']['server']['debug_minify'] === 'True'; |
109 | 109 | $base_path = $GLOBALS['egw_info']['server']['webserver_url']; |
110 | - if ($base_path[0] != '/') $base_path = parse_url($base_path, PHP_URL_PATH); |
|
110 | + if ($base_path[0] != '/') |
|
111 | + { |
|
112 | + $base_path = parse_url($base_path, PHP_URL_PATH); |
|
113 | + } |
|
111 | 114 | $css_files = ''; |
112 | 115 | foreach(self::$files as $path) |
113 | 116 | { |
114 | 117 | foreach(self::resolve_css_includes($path) as $path) |
115 | 118 | { |
116 | 119 | list($file,$query) = explode('?',$path,2); |
117 | - if (($mod = filemtime(EGW_SERVER_ROOT.$file)) > $max_modified) $max_modified = $mod; |
|
120 | + if (($mod = filemtime(EGW_SERVER_ROOT.$file)) > $max_modified) |
|
121 | + { |
|
122 | + $max_modified = $mod; |
|
123 | + } |
|
118 | 124 | |
119 | 125 | // do NOT include app.css or categories.php, as it changes from app to app |
120 | 126 | //no more dynamic minifying: if ($debug_minify || substr($path, -8) == '/app.css' || substr($file,-14) == 'categories.php') |
@@ -187,7 +187,7 @@ |
||
187 | 187 | * @param string $action "add" or "delete" |
188 | 188 | * @param boolean|int|String $group ID of the group to create the favorite for, or 'all' for all users |
189 | 189 | * @param array $filters key => value pairs for the filter |
190 | - * @return boolean Success |
|
190 | + * @return boolean|null Success |
|
191 | 191 | */ |
192 | 192 | public static function set_favorite($app, $_name, $action, $group, $filters = array()) |
193 | 193 | { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return array with a single sidebox menu item (array) containing html for favorites |
44 | 44 | */ |
45 | - public static function list_favorites($app, $default=null) |
|
45 | + public static function list_favorites($app, $default = null) |
|
46 | 46 | { |
47 | 47 | if (!$app) |
48 | 48 | { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $target = 'favorite_sidebox_'.$app; |
59 | 59 | |
60 | 60 | /* @var $filters array an array of favorites*/ |
61 | - $filters = self::get_favorites($app); |
|
61 | + $filters = self::get_favorites($app); |
|
62 | 62 | $is_admin = $GLOBALS['egw_info']['user']['apps']['admin']; |
63 | 63 | $html = "<span id='$target' class='ui-helper-clearfix sidebox-favorites'><ul class='ui-menu ui-widget-content ui-corner-all favorites' role='listbox'>\n"; |
64 | 64 | |
@@ -69,25 +69,24 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | // Get link for if there is no nextmatch - this is the fallback |
72 | - $registry = Api\Link::get_registry($app,'list'); |
|
72 | + $registry = Api\Link::get_registry($app, 'list'); |
|
73 | 73 | if (!$registry) |
74 | 74 | { |
75 | 75 | $registry = Api\Link::get_registry($app, 'index'); |
76 | 76 | } |
77 | - foreach($filters as $name => $filter) |
|
77 | + foreach ($filters as $name => $filter) |
|
78 | 78 | { |
79 | 79 | //filter must not be empty if there's one, ignore it at the moment but it need to be checked how it got there in database |
80 | 80 | if (!$filter) |
81 | 81 | { |
82 | - error_log(__METHOD__.'Favorite filter "'.$name.'" is not supposed to be empty, it should be an array. Skipping, more investigation needed. filter = '. array2string($filters[$name])); |
|
82 | + error_log(__METHOD__.'Favorite filter "'.$name.'" is not supposed to be empty, it should be an array. Skipping, more investigation needed. filter = '.array2string($filters[$name])); |
|
83 | 83 | continue; |
84 | 84 | } |
85 | 85 | $li = "<li data-id='$name' data-group='{$filter['group']}' class='ui-menu-item' role='menuitem'>\n"; |
86 | 86 | $li .= '<a href="#" class="ui-corner-all" tabindex="-1">'; |
87 | - $li .= "<div class='" . ((string)$name === (string)$default_filter ? 'ui-icon ui-icon-heart' : 'sideboxstar') . "'></div>". |
|
87 | + $li .= "<div class='".((string)$name === (string)$default_filter ? 'ui-icon ui-icon-heart' : 'sideboxstar')."'></div>". |
|
88 | 88 | $filter['name']; |
89 | - $li .= ($filter['group'] != false && !$is_admin || $name === 'blank' ? "" : |
|
90 | - "<div class='ui-icon ui-icon-trash' title='" . lang('Delete') . "'></div>"); |
|
89 | + $li .= ($filter['group'] != false && !$is_admin || $name === 'blank' ? "" : "<div class='ui-icon ui-icon-trash' title='".lang('Delete')."'></div>"); |
|
91 | 90 | $li .= "</a></li>\n"; |
92 | 91 | //error_log(__METHOD__."() $name, filter=".array2string($filter)." --> ".$li); |
93 | 92 | $html .= $li; |
@@ -95,7 +94,7 @@ discard block |
||
95 | 94 | |
96 | 95 | // If were're here, the app supports favorites, so add a 'Add' link too |
97 | 96 | $html .= "<li data-id='add' class='ui-menu-item' role='menuitem'><a href='javascript:app.$app.add_favorite()' class='ui-corner-all'>"; |
98 | - $html .= Api\Html::image($app, 'new') . lang('Add current'). '</a></li>'; |
|
97 | + $html .= Api\Html::image($app, 'new').lang('Add current').'</a></li>'; |
|
99 | 98 | |
100 | 99 | $html .= '</ul></span>'; |
101 | 100 | |
@@ -117,7 +116,7 @@ discard block |
||
117 | 116 | * @return (array|boolean) An array of sorted favorites or False if there's no preferenced sorted list |
118 | 117 | * |
119 | 118 | */ |
120 | - public static function get_fav_sort_pref ($app) |
|
119 | + public static function get_fav_sort_pref($app) |
|
121 | 120 | { |
122 | 121 | $fav_sorted_list = array(); |
123 | 122 | |
@@ -157,13 +156,13 @@ discard block |
||
157 | 156 | $fav_sort_pref = self::get_fav_sort_pref($app); |
158 | 157 | |
159 | 158 | // Look through all preferences & pull out favorites |
160 | - foreach((array)$GLOBALS['egw_info']['user']['preferences'][$app] as $pref_name => $pref) |
|
159 | + foreach ((array)$GLOBALS['egw_info']['user']['preferences'][$app] as $pref_name => $pref) |
|
161 | 160 | { |
162 | - if(strpos($pref_name, $pref_prefix) === 0) |
|
161 | + if (strpos($pref_name, $pref_prefix) === 0) |
|
163 | 162 | { |
164 | - if(!is_array($pref)) continue; // old favorite |
|
163 | + if (!is_array($pref)) continue; // old favorite |
|
165 | 164 | |
166 | - $favorites[(string)substr($pref_name,strlen($pref_prefix))] = $pref; |
|
165 | + $favorites[(string)substr($pref_name, strlen($pref_prefix))] = $pref; |
|
167 | 166 | } |
168 | 167 | } |
169 | 168 | if (is_array($fav_sort_pref)) |
@@ -172,7 +171,7 @@ discard block |
||
172 | 171 | { |
173 | 172 | $sorted_list[$key] = $favorites[$key]; |
174 | 173 | } |
175 | - $favorites = array_merge($sorted_list,$favorites); |
|
174 | + $favorites = array_merge($sorted_list, $favorites); |
|
176 | 175 | } |
177 | 176 | return $favorites; |
178 | 177 | } |
@@ -204,7 +203,7 @@ discard block |
||
204 | 203 | } |
205 | 204 | else |
206 | 205 | { |
207 | - foreach($GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'], true) as $gid) |
|
206 | + foreach ($GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'], true) as $gid) |
|
208 | 207 | { |
209 | 208 | $prefs = new Api\Preferences($gid); |
210 | 209 | $prefs->read_repository(); |
@@ -216,7 +215,7 @@ discard block |
||
216 | 215 | } |
217 | 216 | } |
218 | 217 | } |
219 | - if($group && $GLOBALS['egw_info']['apps']['admin'] && $group !== 'all') |
|
218 | + if ($group && $GLOBALS['egw_info']['apps']['admin'] && $group !== 'all') |
|
220 | 219 | { |
221 | 220 | $prefs = new Api\Preferences(is_numeric($group) ? $group : $GLOBALS['egw_info']['user']['account_id']); |
222 | 221 | } |
@@ -227,7 +226,7 @@ discard block |
||
227 | 226 | $prefs->read_repository(); |
228 | 227 | $type = $group === "all" ? "default" : "user"; |
229 | 228 | //error_log(__METHOD__."('$app', '$name', '$action', ".array2string($group).", ...) pref_name=$pref_name, type=$type"); |
230 | - if($action == "add") |
|
229 | + if ($action == "add") |
|
231 | 230 | { |
232 | 231 | $filters = array( |
233 | 232 | // This is the name as user entered it, minus tags |
@@ -235,9 +234,9 @@ discard block |
||
235 | 234 | 'group' => $group ? $group : false, |
236 | 235 | 'state' => $filters |
237 | 236 | ); |
238 | - $pref_name = "favorite_".preg_replace('/[^A-Za-z0-9-_]/','_',$name); |
|
239 | - $result = $prefs->add($app,$pref_name,$filters,$type); |
|
240 | - $pref = $prefs->save_repository(false,$type); |
|
237 | + $pref_name = "favorite_".preg_replace('/[^A-Za-z0-9-_]/', '_', $name); |
|
238 | + $result = $prefs->add($app, $pref_name, $filters, $type); |
|
239 | + $pref = $prefs->save_repository(false, $type); |
|
241 | 240 | |
242 | 241 | // Update preferences client side, or it could disappear |
243 | 242 | Api\Json\Response::get()->call('egw.set_preferences', (array)$pref[$app], $app); |
@@ -247,8 +246,8 @@ discard block |
||
247 | 246 | } |
248 | 247 | else if ($action == "delete") |
249 | 248 | { |
250 | - $result = $prefs->delete($app,$pref_name, $type); |
|
251 | - $pref = $prefs->save_repository(false,$type); |
|
249 | + $result = $prefs->delete($app, $pref_name, $type); |
|
250 | + $pref = $prefs->save_repository(false, $type); |
|
252 | 251 | |
253 | 252 | // Update preferences client side, or it could come back |
254 | 253 | Api\Json\Response::get()->call('egw.set_preferences', (array)$pref[$app], $app); |
@@ -161,7 +161,11 @@ |
||
161 | 161 | { |
162 | 162 | if(strpos($pref_name, $pref_prefix) === 0) |
163 | 163 | { |
164 | - if(!is_array($pref)) continue; // old favorite |
|
164 | + if(!is_array($pref)) |
|
165 | + { |
|
166 | + continue; |
|
167 | + } |
|
168 | + // old favorite |
|
165 | 169 | |
166 | 170 | $favorites[(string)substr($pref_name,strlen($pref_prefix))] = $pref; |
167 | 171 | } |
@@ -103,11 +103,6 @@ |
||
103 | 103 | /** |
104 | 104 | * Add menu items to the topmenu template class to be displayed |
105 | 105 | * |
106 | - * @param array $app application data |
|
107 | - * @param mixed $alt_label string with alternative menu item label default value = null |
|
108 | - * @param string $urlextra string with alternate additional code inside <a>-tag |
|
109 | - * @access protected |
|
110 | - * @return void |
|
111 | 106 | */ |
112 | 107 | function _add_topmenu_item(array $app_data,$alt_label=null) |
113 | 108 | { |
@@ -21,29 +21,29 @@ discard block |
||
21 | 21 | class Minimal extends Api\Framework |
22 | 22 | { |
23 | 23 | /** |
24 | - * Instance of the phplib Template class for the API's template dir (EGW_TEMPLATE_DIR) |
|
25 | - * |
|
26 | - * @var Template |
|
27 | - */ |
|
24 | + * Instance of the phplib Template class for the API's template dir (EGW_TEMPLATE_DIR) |
|
25 | + * |
|
26 | + * @var Template |
|
27 | + */ |
|
28 | 28 | var $tpl; |
29 | 29 | |
30 | 30 | /** |
31 | - * Constructor |
|
32 | - * |
|
33 | - * @param string $template ='default' name of the template |
|
34 | - * @return idots_framework |
|
35 | - */ |
|
31 | + * Constructor |
|
32 | + * |
|
33 | + * @param string $template ='default' name of the template |
|
34 | + * @return idots_framework |
|
35 | + */ |
|
36 | 36 | function __construct($template='default') |
37 | 37 | { |
38 | 38 | parent::__construct($template); // call the constructor of the extended class |
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
42 | - * Returns the html-header incl. the opening body tag |
|
43 | - * |
|
44 | - * @param array $extra =array() extra attributes passed as data-attribute to egw.js |
|
45 | - * @return string with html |
|
46 | - */ |
|
42 | + * Returns the html-header incl. the opening body tag |
|
43 | + * |
|
44 | + * @param array $extra =array() extra attributes passed as data-attribute to egw.js |
|
45 | + * @return string with html |
|
46 | + */ |
|
47 | 47 | function header(array $extra=array()) |
48 | 48 | { |
49 | 49 | // make sure header is output only once |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
79 | - * Returns the html from the body-tag til the main application area (incl. opening div tag) |
|
80 | - * |
|
81 | - * @return string with html |
|
82 | - */ |
|
79 | + * Returns the html from the body-tag til the main application area (incl. opening div tag) |
|
80 | + * |
|
81 | + * @return string with html |
|
82 | + */ |
|
83 | 83 | function navbar() |
84 | 84 | { |
85 | 85 | return ''; |
@@ -101,37 +101,37 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
104 | - * Add menu items to the topmenu template class to be displayed |
|
105 | - * |
|
106 | - * @param array $app application data |
|
107 | - * @param mixed $alt_label string with alternative menu item label default value = null |
|
108 | - * @param string $urlextra string with alternate additional code inside <a>-tag |
|
109 | - * @access protected |
|
110 | - * @return void |
|
111 | - */ |
|
104 | + * Add menu items to the topmenu template class to be displayed |
|
105 | + * |
|
106 | + * @param array $app application data |
|
107 | + * @param mixed $alt_label string with alternative menu item label default value = null |
|
108 | + * @param string $urlextra string with alternate additional code inside <a>-tag |
|
109 | + * @access protected |
|
110 | + * @return void |
|
111 | + */ |
|
112 | 112 | function _add_topmenu_item(array $app_data,$alt_label=null) |
113 | 113 | { |
114 | 114 | unset($app_data, $alt_label); |
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | - * Add info items to the topmenu template class to be displayed |
|
119 | - * |
|
120 | - * @param string $content html of item |
|
121 | - * @param string $id =null |
|
122 | - * @access protected |
|
123 | - * @return void |
|
124 | - */ |
|
118 | + * Add info items to the topmenu template class to be displayed |
|
119 | + * |
|
120 | + * @param string $content html of item |
|
121 | + * @param string $id =null |
|
122 | + * @access protected |
|
123 | + * @return void |
|
124 | + */ |
|
125 | 125 | function _add_topmenu_info_item($content, $id=null) |
126 | 126 | { |
127 | 127 | unset($content, $id); |
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
131 | - * Returns the html from the closing div of the main application area to the closing html-tag |
|
132 | - * |
|
133 | - * @return string html or null if no footer needed/wanted |
|
134 | - */ |
|
131 | + * Returns the html from the closing div of the main application area to the closing html-tag |
|
132 | + * |
|
133 | + * @return string html or null if no footer needed/wanted |
|
134 | + */ |
|
135 | 135 | function footer() |
136 | 136 | { |
137 | 137 | static $footer_done=0; |
@@ -141,29 +141,29 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
144 | - * Parses one sidebox menu and add's the html to $this->sidebox_content for later use by $this->navbar |
|
145 | - * |
|
146 | - * @param string $appname |
|
147 | - * @param string $menu_title |
|
148 | - * @param array $file |
|
149 | - * @param string $type =null 'admin', 'preferences', 'favorites', ... |
|
150 | - */ |
|
144 | + * Parses one sidebox menu and add's the html to $this->sidebox_content for later use by $this->navbar |
|
145 | + * |
|
146 | + * @param string $appname |
|
147 | + * @param string $menu_title |
|
148 | + * @param array $file |
|
149 | + * @param string $type =null 'admin', 'preferences', 'favorites', ... |
|
150 | + */ |
|
151 | 151 | function sidebox($appname,$menu_title,$file,$type=null) |
152 | 152 | { |
153 | 153 | unset($appname, $menu_title, $file, $type); |
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
157 | - * called by hooks to add an icon in the topmenu info location |
|
158 | - * |
|
159 | - * @param string $id unique element id |
|
160 | - * @param string $icon_src src of the icon image. Make sure this nog height then 18pixels |
|
161 | - * @param string $iconlink where the icon links to |
|
162 | - * @param booleon $blink set true to make the icon blink |
|
163 | - * @param mixed $tooltip string containing the tooltip html, or null of no tooltip |
|
164 | - * @access public |
|
165 | - * @return void |
|
166 | - */ |
|
157 | + * called by hooks to add an icon in the topmenu info location |
|
158 | + * |
|
159 | + * @param string $id unique element id |
|
160 | + * @param string $icon_src src of the icon image. Make sure this nog height then 18pixels |
|
161 | + * @param string $iconlink where the icon links to |
|
162 | + * @param booleon $blink set true to make the icon blink |
|
163 | + * @param mixed $tooltip string containing the tooltip html, or null of no tooltip |
|
164 | + * @access public |
|
165 | + * @return void |
|
166 | + */ |
|
167 | 167 | function topmenu_info_icon($id,$icon_src,$iconlink,$blink=false,$tooltip=null) |
168 | 168 | { |
169 | 169 | unset($id, $icon_src, $iconlink, $blink, $tooltip); |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | * @param string $template ='default' name of the template |
34 | 34 | * @return idots_framework |
35 | 35 | */ |
36 | - function __construct($template='default') |
|
36 | + function __construct($template = 'default') |
|
37 | 37 | { |
38 | - parent::__construct($template); // call the constructor of the extended class |
|
38 | + parent::__construct($template); // call the constructor of the extended class |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param array $extra =array() extra attributes passed as data-attribute to egw.js |
45 | 45 | * @return string with html |
46 | 46 | */ |
47 | - function header(array $extra=array()) |
|
47 | + function header(array $extra = array()) |
|
48 | 48 | { |
49 | 49 | // make sure header is output only once |
50 | 50 | if (self::$header_done) return ''; |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | // as the old Template class has problems if restored from the session (php-restore) |
67 | 67 | $this->tpl = new Template(EGW_SERVER_ROOT.$this->template_dir, 'keep'); |
68 | 68 | $this->tpl->set_file(array('_head' => 'head.tpl')); |
69 | - $this->tpl->set_block('_head','head'); |
|
69 | + $this->tpl->set_block('_head', 'head'); |
|
70 | 70 | |
71 | 71 | $this->tpl->set_var($this->_get_header($extra)); |
72 | 72 | |
73 | - $content .= $this->tpl->fp('out','head'); |
|
73 | + $content .= $this->tpl->fp('out', 'head'); |
|
74 | 74 | |
75 | 75 | return $content; |
76 | 76 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @return boolean $consider_navbar_not_yet_called_as_true=true |
94 | 94 | * @return boolean |
95 | 95 | */ |
96 | - public function isTop($consider_navbar_not_yet_called_as_true=true) |
|
96 | + public function isTop($consider_navbar_not_yet_called_as_true = true) |
|
97 | 97 | { |
98 | 98 | unset($consider_navbar_not_yet_called_as_true); |
99 | 99 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @access protected |
110 | 110 | * @return void |
111 | 111 | */ |
112 | - function _add_topmenu_item(array $app_data,$alt_label=null) |
|
112 | + function _add_topmenu_item(array $app_data, $alt_label = null) |
|
113 | 113 | { |
114 | 114 | unset($app_data, $alt_label); |
115 | 115 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @access protected |
123 | 123 | * @return void |
124 | 124 | */ |
125 | - function _add_topmenu_info_item($content, $id=null) |
|
125 | + function _add_topmenu_info_item($content, $id = null) |
|
126 | 126 | { |
127 | 127 | unset($content, $id); |
128 | 128 | } |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | */ |
135 | 135 | function footer() |
136 | 136 | { |
137 | - static $footer_done=0; |
|
138 | - if ($footer_done++) return; // prevent multiple footers, not sure we still need this (RalfBecker) |
|
137 | + static $footer_done = 0; |
|
138 | + if ($footer_done++) return; // prevent multiple footers, not sure we still need this (RalfBecker) |
|
139 | 139 | |
140 | - return "</body>\n</html>\n"; // close body and html tag, eg. for popups |
|
140 | + return "</body>\n</html>\n"; // close body and html tag, eg. for popups |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param array $file |
149 | 149 | * @param string $type =null 'admin', 'preferences', 'favorites', ... |
150 | 150 | */ |
151 | - function sidebox($appname,$menu_title,$file,$type=null) |
|
151 | + function sidebox($appname, $menu_title, $file, $type = null) |
|
152 | 152 | { |
153 | 153 | unset($appname, $menu_title, $file, $type); |
154 | 154 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @access public |
165 | 165 | * @return void |
166 | 166 | */ |
167 | - function topmenu_info_icon($id,$icon_src,$iconlink,$blink=false,$tooltip=null) |
|
167 | + function topmenu_info_icon($id, $icon_src, $iconlink, $blink = false, $tooltip = null) |
|
168 | 168 | { |
169 | 169 | unset($id, $icon_src, $iconlink, $blink, $tooltip); |
170 | 170 | } |
@@ -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 | } |
@@ -38,7 +38,7 @@ |
||
38 | 38 | /** |
39 | 39 | * Get versions of available updates |
40 | 40 | * |
41 | - * @return array verions for keys "current" and "security" |
|
41 | + * @return string verions for keys "current" and "security" |
|
42 | 42 | */ |
43 | 43 | public static function available() |
44 | 44 | { |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | list($current, $security) = explode("\n", $remote); |
52 | 52 | if (empty($security)) $security = $current; |
53 | 53 | $versions = array( |
54 | - 'current' => $current, // last maintenance update |
|
55 | - 'security' => $security, // last security update |
|
54 | + 'current' => $current, // last maintenance update |
|
55 | + 'security' => $security, // last security update |
|
56 | 56 | ); |
57 | 57 | } |
58 | 58 | return $versions; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | protected static function update_older($version, $days) |
115 | 115 | { |
116 | - list(,,$date) = explode('.', $version); |
|
116 | + list(,, $date) = explode('.', $version); |
|
117 | 117 | if ($date < 20140000) return false; |
118 | 118 | $version_timestamp = mktime(0, 0, 0, (int)substr($date, 4, 2), (int)substr($date, -2), (int)substr($date, 0, 4)); |
119 | 119 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param string &$changelog on return path to changelog |
127 | 127 | * @return string |
128 | 128 | */ |
129 | - public static function api_version(&$changelog=null) |
|
129 | + public static function api_version(&$changelog = null) |
|
130 | 130 | { |
131 | 131 | $changelog = EGW_SERVER_ROOT.'/doc/rpm-build/debian.changes'; |
132 | 132 |
@@ -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; |