@@ -189,9 +189,12 @@ discard block |
||
189 | 189 | //error_log(__METHOD__."() size of request = ".bytes($id)); |
190 | 190 | } |
191 | 191 | } |
192 | - if (!$request) // eT2 request/session expired |
|
192 | + if (!$request) |
|
193 | + { |
|
194 | + // eT2 request/session expired |
|
193 | 195 | { |
194 | 196 | list($app) = explode('.', $_GET['menuaction']); |
197 | + } |
|
195 | 198 | $global = false; |
196 | 199 | if(isset($GLOBALS['egw_info']['apps'][$app])) |
197 | 200 | { |
@@ -275,7 +278,10 @@ discard block |
||
275 | 278 | */ |
276 | 279 | public function set_to_process($_form_name, $type, $data=array()) |
277 | 280 | { |
278 | - if (!$_form_name || !$type) return; |
|
281 | + if (!$_form_name || !$type) |
|
282 | + { |
|
283 | + return; |
|
284 | + } |
|
279 | 285 | |
280 | 286 | //echo '<p>'.__METHOD__."($form_name,$type,".array2string($data).")</p>\n"; |
281 | 287 | $data['type'] = $type; |
@@ -298,7 +304,10 @@ discard block |
||
298 | 304 | public function set_to_process_attribute($_form_name, $attribute, $value, $add_to_array=false) |
299 | 305 | { |
300 | 306 | //echo '<p>'.__METHOD__."($form_name,$attribute,$value,$add_to_array)</p>\n"; |
301 | - if (!$_form_name) return; |
|
307 | + if (!$_form_name) |
|
308 | + { |
|
309 | + return; |
|
310 | + } |
|
302 | 311 | |
303 | 312 | // unquote single and double quotes, as this is how they get returned in $_POST |
304 | 313 | $form_name = str_replace(array('\\\'','"'), array('\'','"'), $_form_name); |
@@ -393,7 +402,10 @@ discard block |
||
393 | 402 | */ |
394 | 403 | public function &__get($var) |
395 | 404 | { |
396 | - if ($var == 'data_modified') return $this->data_modified; |
|
405 | + if ($var == 'data_modified') |
|
406 | + { |
|
407 | + return $this->data_modified; |
|
408 | + } |
|
397 | 409 | |
398 | 410 | return $this->data[$var]; |
399 | 411 | } |
@@ -434,16 +446,25 @@ discard block |
||
434 | 446 | { |
435 | 447 | $len = strlen(is_array($val) ? serialize($val) : $val); |
436 | 448 | $len .= ' ('.sprintf('%2.1lf',($percent = 100.0 * $len / $total)).'%)'; |
437 | - if ($percent < $min_share) continue; |
|
449 | + if ($percent < $min_share) |
|
450 | + { |
|
451 | + continue; |
|
452 | + } |
|
438 | 453 | echo "<p><b>$key</b>: strlen(\$val)=$len</p>\n"; |
439 | - if ($percent >= $dump_share) _debug_array($val); |
|
454 | + if ($percent >= $dump_share) |
|
455 | + { |
|
456 | + _debug_array($val); |
|
457 | + } |
|
440 | 458 | if (is_array($val) && $len > 2000) |
441 | 459 | { |
442 | 460 | foreach($val as $k => $v) |
443 | 461 | { |
444 | 462 | $l = strlen(is_array($v) ? serialize($v) : $v); |
445 | 463 | $l .= ' ('.sprintf('%2.1lf',($p = 100.0 * $l / $total)).'%)'; |
446 | - if ($p < $min_share) continue; |
|
464 | + if ($p < $min_share) |
|
465 | + { |
|
466 | + continue; |
|
467 | + } |
|
447 | 468 | echo "<p> - {$key}[$k]: strlen(\$v)=$l</p>\n"; |
448 | 469 | } |
449 | 470 | } |
@@ -484,7 +505,10 @@ discard block |
||
484 | 505 | mcrypt_create_iv ($iv_size, MCRYPT_RAND) : substr($GLOBALS['egw_info']['server']['mcrypt_iv'],0,$iv_size); |
485 | 506 | |
486 | 507 | $key_size = mcrypt_enc_get_key_size(self::$mcrypt); |
487 | - if (bytes($key) > $key_size) $key = cut_bytes($key,0,$key_size-1); |
|
508 | + if (bytes($key) > $key_size) |
|
509 | + { |
|
510 | + $key = cut_bytes($key,0,$key_size-1); |
|
511 | + } |
|
488 | 512 | |
489 | 513 | if (mcrypt_generic_init(self::$mcrypt,$key, $iv) < 0) |
490 | 514 | { |
@@ -91,19 +91,19 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @var array |
93 | 93 | */ |
94 | - protected $data=array(); |
|
94 | + protected $data = array(); |
|
95 | 95 | /** |
96 | 96 | * Flag if data has been modified and therefor need to be stored again in the session |
97 | 97 | * |
98 | 98 | * @var boolean |
99 | 99 | */ |
100 | - protected $data_modified=false; |
|
100 | + protected $data_modified = false; |
|
101 | 101 | /** |
102 | 102 | * Flag that stored data should be removed by destructor, if not modified. |
103 | 103 | * |
104 | 104 | * @var boolean |
105 | 105 | */ |
106 | - protected $remove_if_not_modified=false; |
|
106 | + protected $remove_if_not_modified = false; |
|
107 | 107 | /** |
108 | 108 | * mcrypt resource |
109 | 109 | * |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @param string $id =null |
142 | 142 | * @return Request |
143 | 143 | */ |
144 | - public static function read($id=null) |
|
144 | + public static function read($id = null) |
|
145 | 145 | { |
146 | 146 | if (is_null(self::$request_class)) |
147 | 147 | { |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | // decrypt the data if available |
168 | 168 | if (self::init_crypt()) |
169 | 169 | { |
170 | - $id = mdecrypt_generic(self::$mcrypt,$id); |
|
170 | + $id = mdecrypt_generic(self::$mcrypt, $id); |
|
171 | 171 | } |
172 | 172 | // uncompress the data if available |
173 | 173 | if (self::$compression_level && function_exists('gzcompress')) |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | { |
194 | 194 | list($app) = explode('.', $_GET['menuaction']); |
195 | 195 | $global = false; |
196 | - if(isset($GLOBALS['egw_info']['apps'][$app])) |
|
196 | + if (isset($GLOBALS['egw_info']['apps'][$app])) |
|
197 | 197 | { |
198 | 198 | $index_url = isset($GLOBALS['egw_info']['apps'][$app]['index']) ? |
199 | 199 | '/index.php?menuaction='.$GLOBALS['egw_info']['apps'][$app]['index'] : '/'.$app.'/index.php'; |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * |
231 | 231 | * @param string $id =null |
232 | 232 | */ |
233 | - private function __construct($id=null) |
|
233 | + private function __construct($id = null) |
|
234 | 234 | { |
235 | 235 | unset($id); |
236 | 236 | } |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | { |
277 | 277 | if (is_array($this->data['content']['nm']['rows'])) |
278 | 278 | { |
279 | - foreach(array_keys($this->data['content']['nm']['rows']) as $n) |
|
279 | + foreach (array_keys($this->data['content']['nm']['rows']) as $n) |
|
280 | 280 | { |
281 | 281 | if (is_int($n)) |
282 | 282 | { |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @param string $type etemplate type |
298 | 298 | * @param array $data =array() optional extra data |
299 | 299 | */ |
300 | - public function set_to_process($_form_name, $type, $data=array()) |
|
300 | + public function set_to_process($_form_name, $type, $data = array()) |
|
301 | 301 | { |
302 | 302 | if (!$_form_name || !$type) return; |
303 | 303 | |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | $data['type'] = $type; |
306 | 306 | |
307 | 307 | // unquote single and double quotes, as this is how they get returned in $_POST |
308 | - $form_name = str_replace(array('\\\'','"'), array('\'','"'), $_form_name); |
|
308 | + $form_name = str_replace(array('\\\'', '"'), array('\'', '"'), $_form_name); |
|
309 | 309 | |
310 | 310 | $this->data['to_process'][$form_name] = $data; |
311 | 311 | $this->data_modified = true; |
@@ -319,13 +319,13 @@ discard block |
||
319 | 319 | * @param array $value |
320 | 320 | * @param boolean $add_to_array =false should $value be added to the attribute array |
321 | 321 | */ |
322 | - public function set_to_process_attribute($_form_name, $attribute, $value, $add_to_array=false) |
|
322 | + public function set_to_process_attribute($_form_name, $attribute, $value, $add_to_array = false) |
|
323 | 323 | { |
324 | 324 | //echo '<p>'.__METHOD__."($form_name,$attribute,$value,$add_to_array)</p>\n"; |
325 | 325 | if (!$_form_name) return; |
326 | 326 | |
327 | 327 | // unquote single and double quotes, as this is how they get returned in $_POST |
328 | - $form_name = str_replace(array('\\\'','"'), array('\'','"'), $_form_name); |
|
328 | + $form_name = str_replace(array('\\\'', '"'), array('\'', '"'), $_form_name); |
|
329 | 329 | |
330 | 330 | if ($add_to_array) |
331 | 331 | { |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | * @param string $form_name =null |
357 | 357 | * @return array |
358 | 358 | */ |
359 | - public function get_to_process($form_name=null) |
|
359 | + public function get_to_process($form_name = null) |
|
360 | 360 | { |
361 | 361 | //echo '<p>'.__METHOD__."($form_name)</p>\n"; |
362 | 362 | return $form_name ? $this->data['to_process'][$form_name] : $this->data['to_process']; |
@@ -387,8 +387,7 @@ discard block |
||
387 | 387 | // generate random token (using oppenssl if available otherwise mt_rand based Auth::randomstring) |
388 | 388 | $token = function_exists('openssl_random_pseudo_bytes') ? |
389 | 389 | // replace + with _ to not run into url-encoding issues when used in a url |
390 | - str_replace('+', '_', base64_encode(openssl_random_pseudo_bytes(32))) : |
|
391 | - \EGroupware\Api\Auth::randomstring(44); |
|
390 | + str_replace('+', '_', base64_encode(openssl_random_pseudo_bytes(32))) : \EGroupware\Api\Auth::randomstring(44); |
|
392 | 391 | |
393 | 392 | return $GLOBALS['egw_info']['flags']['currentapp'].'_'.$userID.'_'.$token; |
394 | 393 | } |
@@ -399,7 +398,7 @@ discard block |
||
399 | 398 | * @param string $var |
400 | 399 | * @param mixed $val |
401 | 400 | */ |
402 | - public function __set($var,$val) |
|
401 | + public function __set($var, $val) |
|
403 | 402 | { |
404 | 403 | if ($this->data[$var] !== $val) |
405 | 404 | { |
@@ -450,23 +449,23 @@ discard block |
||
450 | 449 | * @param double $min_share minimum share to be reported (in percent of the whole request) |
451 | 450 | * @param double $dump_share minimum share from which on a variable get output |
452 | 451 | */ |
453 | - public function debug($min_share=1.0,$dump_share=25.0) |
|
452 | + public function debug($min_share = 1.0, $dump_share = 25.0) |
|
454 | 453 | { |
455 | - echo "<p><b>total size request data = ".($total=strlen(serialize($this->data)))."</b></p>\n"; |
|
454 | + echo "<p><b>total size request data = ".($total = strlen(serialize($this->data)))."</b></p>\n"; |
|
456 | 455 | echo "<p>shares bigger then $min_share% percent of it:</p>\n"; |
457 | - foreach($this->data as $key => $val) |
|
456 | + foreach ($this->data as $key => $val) |
|
458 | 457 | { |
459 | 458 | $len = strlen(is_array($val) ? serialize($val) : $val); |
460 | - $len .= ' ('.sprintf('%2.1lf',($percent = 100.0 * $len / $total)).'%)'; |
|
459 | + $len .= ' ('.sprintf('%2.1lf', ($percent = 100.0 * $len / $total)).'%)'; |
|
461 | 460 | if ($percent < $min_share) continue; |
462 | 461 | echo "<p><b>$key</b>: strlen(\$val)=$len</p>\n"; |
463 | 462 | if ($percent >= $dump_share) _debug_array($val); |
464 | 463 | if (is_array($val) && $len > 2000) |
465 | 464 | { |
466 | - foreach($val as $k => $v) |
|
465 | + foreach ($val as $k => $v) |
|
467 | 466 | { |
468 | 467 | $l = strlen(is_array($v) ? serialize($v) : $v); |
469 | - $l .= ' ('.sprintf('%2.1lf',($p = 100.0 * $l / $total)).'%)'; |
|
468 | + $l .= ' ('.sprintf('%2.1lf', ($p = 100.0 * $l / $total)).'%)'; |
|
470 | 469 | if ($p < $min_share) continue; |
471 | 470 | echo "<p> - {$key}[$k]: strlen(\$v)=$l</p>\n"; |
472 | 471 | } |
@@ -481,7 +480,7 @@ discard block |
||
481 | 480 | * @param string $mode ='ecb' |
482 | 481 | * @return boolean true if encryption is used, false otherwise |
483 | 482 | */ |
484 | - static public function init_crypt($algo='tripledes',$mode='ecb') |
|
483 | + static public function init_crypt($algo = 'tripledes', $mode = 'ecb') |
|
485 | 484 | { |
486 | 485 | if (is_null(self::$mcrypt)) |
487 | 486 | { |
@@ -505,12 +504,12 @@ discard block |
||
505 | 504 | } |
506 | 505 | $iv_size = mcrypt_enc_get_iv_size(self::$mcrypt); |
507 | 506 | $iv = !isset($GLOBALS['egw_info']['server']['mcrypt_iv']) || strlen($GLOBALS['egw_info']['server']['mcrypt_iv']) < $iv_size ? |
508 | - mcrypt_create_iv ($iv_size, MCRYPT_RAND) : substr($GLOBALS['egw_info']['server']['mcrypt_iv'],0,$iv_size); |
|
507 | + mcrypt_create_iv ($iv_size, MCRYPT_RAND) : substr($GLOBALS['egw_info']['server']['mcrypt_iv'], 0, $iv_size); |
|
509 | 508 | |
510 | 509 | $key_size = mcrypt_enc_get_key_size(self::$mcrypt); |
511 | - if (bytes($key) > $key_size) $key = cut_bytes($key,0,$key_size-1); |
|
510 | + if (bytes($key) > $key_size) $key = cut_bytes($key, 0, $key_size - 1); |
|
512 | 511 | |
513 | - if (mcrypt_generic_init(self::$mcrypt,$key, $iv) < 0) |
|
512 | + if (mcrypt_generic_init(self::$mcrypt, $key, $iv) < 0) |
|
514 | 513 | { |
515 | 514 | error_log(__METHOD__."() could not initialise mcrypt, sessions get NOT encrypted!"); |
516 | 515 | return self::$mcrypt = false; |
@@ -45,7 +45,7 @@ |
||
45 | 45 | /** |
46 | 46 | * Primary mail address required as an alias too: true or false |
47 | 47 | */ |
48 | - const REQUIRE_MAIL_AS_ALIAS=false; |
|
48 | + const REQUIRE_MAIL_AS_ALIAS = false; |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Attribute for forwards OR false if not possible |
@@ -45,7 +45,7 @@ |
||
45 | 45 | /** |
46 | 46 | * Primary mail address required as an alias too: true or false |
47 | 47 | */ |
48 | - const REQUIRE_MAIL_AS_ALIAS=false; |
|
48 | + const REQUIRE_MAIL_AS_ALIAS = false; |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Attribute for forwards OR false if not possible |
@@ -45,7 +45,7 @@ |
||
45 | 45 | /** |
46 | 46 | * Primary mail address required as an alias too: true or false |
47 | 47 | */ |
48 | - const REQUIRE_MAIL_AS_ALIAS=false; |
|
48 | + const REQUIRE_MAIL_AS_ALIAS = false; |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Attribute for forwards OR false if not possible |
@@ -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 | /** |
@@ -1030,13 +1030,13 @@ discard block |
||
1030 | 1030 | } |
1031 | 1031 | |
1032 | 1032 | /** |
1033 | - * Compile entries for topmenu: |
|
1034 | - * - regular items: links |
|
1035 | - * - info items |
|
1036 | - * |
|
1037 | - * @param array $vars |
|
1038 | - * @param array $apps |
|
1039 | - */ |
|
1033 | + * Compile entries for topmenu: |
|
1034 | + * - regular items: links |
|
1035 | + * - info items |
|
1036 | + * |
|
1037 | + * @param array $vars |
|
1038 | + * @param array $apps |
|
1039 | + */ |
|
1040 | 1040 | function topmenu(array $vars,array $apps) |
1041 | 1041 | { |
1042 | 1042 | if($GLOBALS['egw_info']['user']['apps']['home'] && isset($apps['home'])) |
@@ -1140,39 +1140,39 @@ discard block |
||
1140 | 1140 | } |
1141 | 1141 | |
1142 | 1142 | /** |
1143 | - * Add menu items to the topmenu template class to be displayed |
|
1144 | - * |
|
1145 | - * @param array $app application data |
|
1146 | - * @param mixed $alt_label string with alternative menu item label default value = null |
|
1147 | - * @param string $urlextra string with alternate additional code inside <a>-tag |
|
1148 | - * @access protected |
|
1149 | - * @return void |
|
1150 | - */ |
|
1143 | + * Add menu items to the topmenu template class to be displayed |
|
1144 | + * |
|
1145 | + * @param array $app application data |
|
1146 | + * @param mixed $alt_label string with alternative menu item label default value = null |
|
1147 | + * @param string $urlextra string with alternate additional code inside <a>-tag |
|
1148 | + * @access protected |
|
1149 | + * @return void |
|
1150 | + */ |
|
1151 | 1151 | abstract function _add_topmenu_item(array $app_data,$alt_label=null); |
1152 | 1152 | |
1153 | 1153 | /** |
1154 | - * Add info items to the topmenu template class to be displayed |
|
1155 | - * |
|
1156 | - * @param string $content Html of item |
|
1157 | - * @param string $id =null |
|
1158 | - * @access protected |
|
1159 | - * @return void |
|
1160 | - */ |
|
1154 | + * Add info items to the topmenu template class to be displayed |
|
1155 | + * |
|
1156 | + * @param string $content Html of item |
|
1157 | + * @param string $id =null |
|
1158 | + * @access protected |
|
1159 | + * @return void |
|
1160 | + */ |
|
1161 | 1161 | abstract function _add_topmenu_info_item($content, $id=null); |
1162 | 1162 | |
1163 | 1163 | static $top_menu_extra = array(); |
1164 | 1164 | |
1165 | 1165 | /** |
1166 | - * Called by hooks to add an entry in the topmenu location. |
|
1167 | - * Extra entries will be added just before Logout. |
|
1168 | - * |
|
1169 | - * @param string $id unique element id |
|
1170 | - * @param string $url Address for the entry to link to |
|
1171 | - * @param string $title Text displayed for the entry |
|
1172 | - * @param string $target Optional, so the entry can open in a new page or popup |
|
1173 | - * @access public |
|
1174 | - * @return void |
|
1175 | - */ |
|
1166 | + * Called by hooks to add an entry in the topmenu location. |
|
1167 | + * Extra entries will be added just before Logout. |
|
1168 | + * |
|
1169 | + * @param string $id unique element id |
|
1170 | + * @param string $url Address for the entry to link to |
|
1171 | + * @param string $title Text displayed for the entry |
|
1172 | + * @param string $target Optional, so the entry can open in a new page or popup |
|
1173 | + * @access public |
|
1174 | + * @return void |
|
1175 | + */ |
|
1176 | 1176 | public static function add_topmenu_item($id,$url,$title,$target = '') |
1177 | 1177 | { |
1178 | 1178 | $entry['name'] = $id; |
@@ -1184,16 +1184,16 @@ discard block |
||
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | /** |
1187 | - * called by hooks to add an icon in the topmenu info location |
|
1188 | - * |
|
1189 | - * @param string $id unique element id |
|
1190 | - * @param string $icon_src src of the icon image. Make sure this nog height then 18pixels |
|
1191 | - * @param string $iconlink where the icon links to |
|
1192 | - * @param booleon $blink set true to make the icon blink |
|
1193 | - * @param mixed $tooltip string containing the tooltip html, or null of no tooltip |
|
1194 | - * @access public |
|
1195 | - * @return void |
|
1196 | - */ |
|
1187 | + * called by hooks to add an icon in the topmenu info location |
|
1188 | + * |
|
1189 | + * @param string $id unique element id |
|
1190 | + * @param string $icon_src src of the icon image. Make sure this nog height then 18pixels |
|
1191 | + * @param string $iconlink where the icon links to |
|
1192 | + * @param booleon $blink set true to make the icon blink |
|
1193 | + * @param mixed $tooltip string containing the tooltip html, or null of no tooltip |
|
1194 | + * @access public |
|
1195 | + * @return void |
|
1196 | + */ |
|
1197 | 1197 | abstract function topmenu_info_icon($id,$icon_src,$iconlink,$blink=false,$tooltip=null); |
1198 | 1198 | |
1199 | 1199 | /** |
@@ -1228,19 +1228,19 @@ discard block |
||
1228 | 1228 | protected static $js_include_mgr; |
1229 | 1229 | |
1230 | 1230 | /** |
1231 | - * Checks to make sure a valid package and file name is provided |
|
1232 | - * |
|
1233 | - * Example call syntax: |
|
1234 | - * a) Api\Framework::includeJS('jscalendar','calendar') |
|
1235 | - * --> /phpgwapi/js/jscalendar/calendar.js |
|
1236 | - * b) Api\Framework::includeJS('/phpgwapi/inc/calendar-setup.js',array('lang'=>'de')) |
|
1237 | - * --> /phpgwapi/inc/calendar-setup.js?lang=de |
|
1238 | - * |
|
1239 | - * @param string $package package or complete path (relative to EGW_SERVER_ROOT) to be included |
|
1240 | - * @param string|array $file =null file to be included - no ".js" on the end or array with get params |
|
1241 | - * @param string $app ='phpgwapi' application directory to search - default = phpgwapi |
|
1242 | - * @param boolean $append =true should the file be added |
|
1243 | - */ |
|
1231 | + * Checks to make sure a valid package and file name is provided |
|
1232 | + * |
|
1233 | + * Example call syntax: |
|
1234 | + * a) Api\Framework::includeJS('jscalendar','calendar') |
|
1235 | + * --> /phpgwapi/js/jscalendar/calendar.js |
|
1236 | + * b) Api\Framework::includeJS('/phpgwapi/inc/calendar-setup.js',array('lang'=>'de')) |
|
1237 | + * --> /phpgwapi/inc/calendar-setup.js?lang=de |
|
1238 | + * |
|
1239 | + * @param string $package package or complete path (relative to EGW_SERVER_ROOT) to be included |
|
1240 | + * @param string|array $file =null file to be included - no ".js" on the end or array with get params |
|
1241 | + * @param string $app ='phpgwapi' application directory to search - default = phpgwapi |
|
1242 | + * @param boolean $append =true should the file be added |
|
1243 | + */ |
|
1244 | 1244 | static function includeJS($package, $file=null, $app='phpgwapi', $append=true) |
1245 | 1245 | { |
1246 | 1246 | self::$js_include_mgr->include_js_file($package, $file, $app, $append); |
@@ -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 | { |
@@ -576,8 +577,9 @@ discard block |
||
576 | 577 | /** |
577 | 578 | * Get login logo or background image base on requested config type |
578 | 579 | * |
579 | - * @param type $type config type to fetch. e.g.: "login_logo_file" |
|
580 | - * @param type $find_type type of image to search on as alternative option. e.g.: "logo" |
|
580 | + * @param string $type config type to fetch. e.g.: "login_logo_file" |
|
581 | + * @param type string type of image to search on as alternative option. e.g.: "logo" |
|
582 | + * @param string $find_type |
|
581 | 583 | * |
582 | 584 | * @return string returns full url of the image |
583 | 585 | */ |
@@ -601,7 +603,7 @@ discard block |
||
601 | 603 | /** |
602 | 604 | * Returns Html with user and time |
603 | 605 | * |
604 | - * @return void |
|
606 | + * @return string |
|
605 | 607 | */ |
606 | 608 | protected static function _user_time_info() |
607 | 609 | { |
@@ -1032,7 +1034,6 @@ discard block |
||
1032 | 1034 | * |
1033 | 1035 | * Themes are css file in the template directory |
1034 | 1036 | * |
1035 | - * @param string $themes_dir ='css' |
|
1036 | 1037 | */ |
1037 | 1038 | function list_themes() |
1038 | 1039 | { |
@@ -1199,11 +1200,6 @@ discard block |
||
1199 | 1200 | /** |
1200 | 1201 | * Add menu items to the topmenu template class to be displayed |
1201 | 1202 | * |
1202 | - * @param array $app application data |
|
1203 | - * @param mixed $alt_label string with alternative menu item label default value = null |
|
1204 | - * @param string $urlextra string with alternate additional code inside <a>-tag |
|
1205 | - * @access protected |
|
1206 | - * @return void |
|
1207 | 1203 | */ |
1208 | 1204 | abstract function _add_topmenu_item(array $app_data,$alt_label=null); |
1209 | 1205 | |
@@ -1460,7 +1456,7 @@ discard block |
||
1460 | 1456 | * @param string $action "add" or "delete" |
1461 | 1457 | * @param boolean|int|string $group ID of the group to create the favorite for, or 'all' for all users |
1462 | 1458 | * @param array $filters =array() key => value pairs for the filter |
1463 | - * @return boolean Success |
|
1459 | + * @return boolean|null Success |
|
1464 | 1460 | */ |
1465 | 1461 | public static function ajax_set_favorite($app, $name, $action, $group, $filters = array()) |
1466 | 1462 | { |
@@ -255,7 +255,10 @@ discard block |
||
255 | 255 | } |
256 | 256 | |
257 | 257 | // commit session (if existing), to fix timing problems sometimes preventing session creation ("Your session can not be verified") |
258 | - if (isset($GLOBALS['egw']->session)) $GLOBALS['egw']->session->commit_session(); |
|
258 | + if (isset($GLOBALS['egw']->session)) |
|
259 | + { |
|
260 | + $GLOBALS['egw']->session->commit_session(); |
|
261 | + } |
|
259 | 262 | |
260 | 263 | exit; |
261 | 264 | } |
@@ -285,8 +288,14 @@ discard block |
||
285 | 288 | */ |
286 | 289 | function render($content,$app_header=null,$navbar=null) |
287 | 290 | { |
288 | - if (!is_null($app_header)) $GLOBALS['egw_info']['flags']['app_header'] = $app_header; |
|
289 | - if (!is_null($navbar)) $GLOBALS['egw_info']['flags']['nonavbar'] = !$navbar; |
|
291 | + if (!is_null($app_header)) |
|
292 | + { |
|
293 | + $GLOBALS['egw_info']['flags']['app_header'] = $app_header; |
|
294 | + } |
|
295 | + if (!is_null($navbar)) |
|
296 | + { |
|
297 | + $GLOBALS['egw_info']['flags']['nonavbar'] = !$navbar; |
|
298 | + } |
|
290 | 299 | |
291 | 300 | echo $this->header(); |
292 | 301 | |
@@ -483,7 +492,10 @@ discard block |
||
483 | 492 | // send appheader to clientside |
484 | 493 | $extra['app-header'] = $app_header; |
485 | 494 | |
486 | - if($GLOBALS['egw_info']['flags']['currentapp'] != 'wiki') $robots ='<meta name="robots" content="none" />'; |
|
495 | + if($GLOBALS['egw_info']['flags']['currentapp'] != 'wiki') |
|
496 | + { |
|
497 | + $robots ='<meta name="robots" content="none" />'; |
|
498 | + } |
|
487 | 499 | |
488 | 500 | $var['favicon_file'] = self::get_login_logo_or_bg_url('favicon_file', 'favicon.ico'); |
489 | 501 | |
@@ -741,13 +753,19 @@ discard block |
||
741 | 753 | $ind_b = isset($arr[$b['name']]) ? $arr[$b['name']] : null; |
742 | 754 | |
743 | 755 | if ($ind_a == $ind_b) |
744 | - return 0; |
|
756 | + { |
|
757 | + return 0; |
|
758 | + } |
|
745 | 759 | |
746 | 760 | if ($ind_a == null) |
747 | - return -1; |
|
761 | + { |
|
762 | + return -1; |
|
763 | + } |
|
748 | 764 | |
749 | 765 | if ($ind_b == null) |
750 | - return 1; |
|
766 | + { |
|
767 | + return 1; |
|
768 | + } |
|
751 | 769 | |
752 | 770 | return $ind_a > $ind_b ? 1 : -1; |
753 | 771 | } |
@@ -836,9 +854,12 @@ discard block |
||
836 | 854 | $app_title = $GLOBALS['egw_info']['apps'][$app]['title']; |
837 | 855 | } |
838 | 856 | |
839 | - if ($GLOBALS['egw_info']['user']['apps']['preferences']) // Preferences last |
|
857 | + if ($GLOBALS['egw_info']['user']['apps']['preferences']) |
|
858 | + { |
|
859 | + // Preferences last |
|
840 | 860 | { |
841 | 861 | $prefs = $apps['preferences']; |
862 | + } |
|
842 | 863 | unset($apps['preferences']); |
843 | 864 | $apps['preferences'] = $prefs; |
844 | 865 | } |
@@ -889,7 +910,10 @@ discard block |
||
889 | 910 | $themes_to_check[] = $this->template_dir.'/css/'.$this->template.'.css'; |
890 | 911 | foreach($themes_to_check as $theme_css) |
891 | 912 | { |
892 | - if (file_exists(EGW_SERVER_ROOT.$theme_css)) break; |
|
913 | + if (file_exists(EGW_SERVER_ROOT.$theme_css)) |
|
914 | + { |
|
915 | + break; |
|
916 | + } |
|
893 | 917 | } |
894 | 918 | $debug_minify = $GLOBALS['egw_info']['server']['debug_minify'] === 'True'; |
895 | 919 | if (!$debug_minify && file_exists(EGW_SERVER_ROOT.($theme_min_css = str_replace('.css', '.min.css', $theme_css)))) |
@@ -979,7 +1003,9 @@ discard block |
||
979 | 1003 | } |
980 | 1004 | |
981 | 1005 | $extra['url'] = $GLOBALS['egw_info']['server']['webserver_url']; |
982 | - $extra['include'] = array_map(function($str){return substr($str,1);}, self::get_script_links(true), array(1)); |
|
1006 | + $extra['include'] = array_map(function($str) |
|
1007 | + { |
|
1008 | +return substr($str,1);}, self::get_script_links(true), array(1)); |
|
983 | 1009 | $extra['app'] = $GLOBALS['egw_info']['flags']['currentapp']; |
984 | 1010 | |
985 | 1011 | // Load LABjs ONCE here |
@@ -991,7 +1017,10 @@ discard block |
||
991 | 1017 | // add values of extra parameter and class var as data attributes to script tag of egw.js |
992 | 1018 | foreach($extra+self::$extra as $name => $value) |
993 | 1019 | { |
994 | - if (is_array($value)) $value = json_encode($value); |
|
1020 | + if (is_array($value)) |
|
1021 | + { |
|
1022 | + $value = json_encode($value); |
|
1023 | + } |
|
995 | 1024 | // we need to double encode (Html::htmlspecialchars( , TRUE)), as otherwise we get invalid json, eg. for quotes |
996 | 1025 | $java_script .= ' data-'.$name."=\"". Html::htmlspecialchars($value, true)."\""; |
997 | 1026 | } |
@@ -1041,7 +1070,10 @@ discard block |
||
1041 | 1070 | if (preg_match('/'."\.css$".'/i', $file)) |
1042 | 1071 | { |
1043 | 1072 | list($name) = explode('.',$file); |
1044 | - if (!isset($list[$name])) $list[$name] = ucfirst ($name); |
|
1073 | + if (!isset($list[$name])) |
|
1074 | + { |
|
1075 | + $list[$name] = ucfirst ($name); |
|
1076 | + } |
|
1045 | 1077 | } |
1046 | 1078 | } |
1047 | 1079 | closedir($dh); |
@@ -1120,7 +1152,8 @@ discard block |
||
1120 | 1152 | |
1121 | 1153 | Hooks::process('topmenu_info',array(),true); |
1122 | 1154 | // Add extra items added by hooks |
1123 | - foreach(self::$top_menu_extra as $extra_item) { |
|
1155 | + foreach(self::$top_menu_extra as $extra_item) |
|
1156 | + { |
|
1124 | 1157 | $this->_add_topmenu_item($extra_item); |
1125 | 1158 | } |
1126 | 1159 | |
@@ -1145,7 +1178,10 @@ discard block |
||
1145 | 1178 | protected function add_preferences_topmenu($type='prefs') |
1146 | 1179 | { |
1147 | 1180 | static $memberships=null; |
1148 | - if (!isset($memberships)) $memberships = $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'], true); |
|
1181 | + if (!isset($memberships)) |
|
1182 | + { |
|
1183 | + $memberships = $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'], true); |
|
1184 | + } |
|
1149 | 1185 | static $types = array( |
1150 | 1186 | 'prefs' => array( |
1151 | 1187 | 'title' => 'Preferences', |
@@ -1173,7 +1209,10 @@ discard block |
||
1173 | 1209 | // as all apps answer, we need to remove none-true responses |
1174 | 1210 | foreach($apps as $app => $val) |
1175 | 1211 | { |
1176 | - if (!$val) unset($apps[$app]); |
|
1212 | + if (!$val) |
|
1213 | + { |
|
1214 | + unset($apps[$app]); |
|
1215 | + } |
|
1177 | 1216 | } |
1178 | 1217 | } |
1179 | 1218 | else |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | */ |
403 | 403 | public function _get_footer() |
404 | 404 | { |
405 | - $var = Array( |
|
405 | + $var = array( |
|
406 | 406 | 'img_root' => $GLOBALS['egw_info']['server']['webserver_url'] . $this->template_dir.'/images', |
407 | 407 | 'version' => $GLOBALS['egw_info']['server']['versions']['api'] |
408 | 408 | ); |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | |
834 | 834 | $icon = isset($data['icon']) ? $data['icon'] : 'navbar'; |
835 | 835 | $icon_app = isset($data['icon_app']) ? $data['icon_app'] : $app; |
836 | - $apps[$app]['icon'] = $apps[$app]['icon_hover'] = Image::find($icon_app,Array($icon,'nonav'),'',$svg); |
|
836 | + $apps[$app]['icon'] = $apps[$app]['icon_hover'] = Image::find($icon_app,array($icon,'nonav'),'',$svg); |
|
837 | 837 | } |
838 | 838 | } |
839 | 839 | |
@@ -866,13 +866,13 @@ discard block |
||
866 | 866 | // We handle this here because its special |
867 | 867 | $apps['about']['title'] = 'EGroupware'; |
868 | 868 | $apps['about']['url'] = self::link('/about.php'); |
869 | - $apps['about']['icon'] = $apps['about']['icon_hover'] = Image::find('api',Array('about','nonav')); |
|
869 | + $apps['about']['icon'] = $apps['about']['icon_hover'] = Image::find('api',array('about','nonav')); |
|
870 | 870 | $apps['about']['name'] = 'about'; |
871 | 871 | |
872 | 872 | $apps['logout']['title'] = lang('Logout'); |
873 | 873 | $apps['logout']['name'] = 'logout'; |
874 | 874 | $apps['logout']['url'] = self::link('/logout.php'); |
875 | - $apps['logout']['icon'] = $apps['logout']['icon_hover'] = Image::find('api',Array('logout','nonav')); |
|
875 | + $apps['logout']['icon'] = $apps['logout']['icon_hover'] = Image::find('api',array('logout','nonav')); |
|
876 | 876 | |
877 | 877 | return $apps; |
878 | 878 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $GLOBALS['egw_info']['server']['template_set'] = 'jdots'; |
117 | 117 | } |
118 | 118 | // eg. "default" is only used for login at the moment |
119 | - if (!class_exists($class=$GLOBALS['egw_info']['server']['template_set'].'_framework')) |
|
119 | + if (!class_exists($class = $GLOBALS['egw_info']['server']['template_set'].'_framework')) |
|
120 | 120 | { |
121 | 121 | $class = __CLASS__.'\\Minimal'; |
122 | 122 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | { |
136 | 136 | return preg_match('/^[A-Z0-9_-]+$/i', $template) && |
137 | 137 | file_exists(EGW_SERVER_ROOT.'/'.$template) && |
138 | - file_exists($file=EGW_SERVER_ROOT.'/'.$template.'/setup/setup.inc.php') && |
|
138 | + file_exists($file = EGW_SERVER_ROOT.'/'.$template.'/setup/setup.inc.php') && |
|
139 | 139 | include_once($file) && !empty($GLOBALS['egw_info']['template'][$template]); |
140 | 140 | } |
141 | 141 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | Header\ContentSecurityPolicy::send(); |
151 | 151 | |
152 | 152 | // allow client-side to detect first load aka just logged in |
153 | - $reload_count =& Cache::getSession(__CLASS__, 'framework-reload'); |
|
153 | + $reload_count = & Cache::getSession(__CLASS__, 'framework-reload'); |
|
154 | 154 | self::$extra['framework-reload'] = (int)(bool)$reload_count++; |
155 | 155 | } |
156 | 156 | |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | * @param string $link_app =null if appname or true, some templates generate a special link-handler url |
181 | 181 | * @return string The full url after processing |
182 | 182 | */ |
183 | - static function link($url, $extravars = '', $link_app=null) |
|
183 | + static function link($url, $extravars = '', $link_app = null) |
|
184 | 184 | { |
185 | - unset($link_app); // not used by required by function signature |
|
185 | + unset($link_app); // not used by required by function signature |
|
186 | 186 | return $GLOBALS['egw']->session->link($url, $extravars); |
187 | 187 | } |
188 | 188 | |
@@ -212,8 +212,7 @@ discard block |
||
212 | 212 | !empty($GLOBALS['egw_info']['server']['enforce_ssl']) || $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ? |
213 | 213 | 'https://' : 'http://'). |
214 | 214 | ($GLOBALS['egw_info']['server']['hostname'] && $GLOBALS['egw_info']['server']['hostname'] !== 'localhost' ? |
215 | - $GLOBALS['egw_info']['server']['hostname'] : |
|
216 | - (isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST'])). |
|
215 | + $GLOBALS['egw_info']['server']['hostname'] : (isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST'])). |
|
217 | 216 | $link; |
218 | 217 | } |
219 | 218 | return $link; |
@@ -227,7 +226,7 @@ discard block |
||
227 | 226 | * @param string $url url to redirect to |
228 | 227 | * @param string $link_app =null appname to redirect for, default currentapp |
229 | 228 | */ |
230 | - static function redirect($url, $link_app=null) |
|
229 | + static function redirect($url, $link_app = null) |
|
231 | 230 | { |
232 | 231 | // Determines whether the current output buffer should be flushed |
233 | 232 | $do_flush = true; |
@@ -249,7 +248,7 @@ discard block |
||
249 | 248 | else |
250 | 249 | { |
251 | 250 | $file = $line = null; |
252 | - if (headers_sent($file,$line)) |
|
251 | + if (headers_sent($file, $line)) |
|
253 | 252 | { |
254 | 253 | throw new Exception\AssertionFailed(__METHOD__."('".htmlspecialchars($url)."') can NOT redirect, output already started at $file line $line!"); |
255 | 254 | } |
@@ -284,7 +283,7 @@ discard block |
||
284 | 283 | * @param string $link_app =null if appname or true, some templates generate a special link-handler url |
285 | 284 | * @return string The full url after processing |
286 | 285 | */ |
287 | - static function redirect_link($url, $extravars='', $link_app=null) |
|
286 | + static function redirect_link($url, $extravars = '', $link_app = null) |
|
288 | 287 | { |
289 | 288 | self::redirect(self::link($url, $extravars), $link_app); |
290 | 289 | } |
@@ -299,7 +298,7 @@ discard block |
||
299 | 298 | * @param string $navbar =null show the navigation, default !$GLOBALS['egw_info']['flags']['nonavbar'], false gives a typical popu |
300 | 299 | * |
301 | 300 | */ |
302 | - function render($content,$app_header=null,$navbar=null) |
|
301 | + function render($content, $app_header = null, $navbar = null) |
|
303 | 302 | { |
304 | 303 | if (!is_null($app_header)) $GLOBALS['egw_info']['flags']['app_header'] = $app_header; |
305 | 304 | if (!is_null($navbar)) $GLOBALS['egw_info']['flags']['nonavbar'] = !$navbar; |
@@ -320,7 +319,7 @@ discard block |
||
320 | 319 | * |
321 | 320 | * @return string with Html |
322 | 321 | */ |
323 | - abstract function header(array $extra=array()); |
|
322 | + abstract function header(array $extra = array()); |
|
324 | 323 | |
325 | 324 | /** |
326 | 325 | * Returns the Html from the body-tag til the main application area (incl. opening div tag) |
@@ -340,7 +339,7 @@ discard block |
||
340 | 339 | * @return boolean $consider_navbar_not_yet_called_as_true=true |
341 | 340 | * @return boolean |
342 | 341 | */ |
343 | - abstract function isTop($consider_navbar_not_yet_called_as_true=true); |
|
342 | + abstract function isTop($consider_navbar_not_yet_called_as_true = true); |
|
344 | 343 | |
345 | 344 | /** |
346 | 345 | * Returns the content of one sidebox |
@@ -350,7 +349,7 @@ discard block |
||
350 | 349 | * @param array $file |
351 | 350 | * @param string $type =null 'admin', 'preferences', 'favorites', ... |
352 | 351 | */ |
353 | - abstract function sidebox($appname,$menu_title,$file,$type=null); |
|
352 | + abstract function sidebox($appname, $menu_title, $file, $type = null); |
|
354 | 353 | |
355 | 354 | /** |
356 | 355 | * Returns the Html from the closing div of the main application area to the closing html-tag |
@@ -365,7 +364,7 @@ discard block |
||
365 | 364 | * @param string $extra_vars for login url |
366 | 365 | * @param string $change_passwd =null string with message to render input fields for password change |
367 | 366 | */ |
368 | - function login_screen($extra_vars, $change_passwd=null) |
|
367 | + function login_screen($extra_vars, $change_passwd = null) |
|
369 | 368 | { |
370 | 369 | (new Framework\Login($this))->screen($extra_vars, $change_passwd); |
371 | 370 | } |
@@ -403,11 +402,11 @@ discard block |
||
403 | 402 | public function _get_footer() |
404 | 403 | { |
405 | 404 | $var = Array( |
406 | - 'img_root' => $GLOBALS['egw_info']['server']['webserver_url'] . $this->template_dir.'/images', |
|
405 | + 'img_root' => $GLOBALS['egw_info']['server']['webserver_url'].$this->template_dir.'/images', |
|
407 | 406 | 'version' => $GLOBALS['egw_info']['server']['versions']['api'] |
408 | 407 | ); |
409 | 408 | $var['page_generation_time'] = ''; |
410 | - if($GLOBALS['egw_info']['user']['preferences']['common']['show_generation_time']) |
|
409 | + if ($GLOBALS['egw_info']['user']['preferences']['common']['show_generation_time']) |
|
411 | 410 | { |
412 | 411 | $times = self::get_page_generation_time(); |
413 | 412 | |
@@ -451,16 +450,16 @@ discard block |
||
451 | 450 | static public function _get_body_attribs() |
452 | 451 | { |
453 | 452 | $js = ''; |
454 | - foreach(self::$body_tags as $what => $data) |
|
453 | + foreach (self::$body_tags as $what => $data) |
|
455 | 454 | { |
456 | 455 | if (!empty($data)) |
457 | 456 | { |
458 | - if($what == 'onLoad') |
|
457 | + if ($what == 'onLoad') |
|
459 | 458 | { |
460 | - $js .= 'onLoad="egw_LAB.wait(function() {'. htmlspecialchars($data).'})"'; |
|
459 | + $js .= 'onLoad="egw_LAB.wait(function() {'.htmlspecialchars($data).'})"'; |
|
461 | 460 | continue; |
462 | 461 | } |
463 | - $js .= ' '.$what.'="' . htmlspecialchars($data) . '"'; |
|
462 | + $js .= ' '.$what.'="'.htmlspecialchars($data).'"'; |
|
464 | 463 | } |
465 | 464 | } |
466 | 465 | return $js; |
@@ -472,7 +471,7 @@ discard block |
||
472 | 471 | * @param array $extra =array() extra attributes passed as data-attribute to egw.js |
473 | 472 | * @return array |
474 | 473 | */ |
475 | - protected function _get_header(array $extra=array()) |
|
474 | + protected function _get_header(array $extra = array()) |
|
476 | 475 | { |
477 | 476 | // display password expires in N days message once per session |
478 | 477 | $message = null; |
@@ -483,7 +482,7 @@ discard block |
||
483 | 482 | } |
484 | 483 | |
485 | 484 | // get used language code (with a little xss check, if someone tries to sneak something in) |
486 | - if (preg_match('/^[a-z]{2}(-[a-z]{2})?$/',$GLOBALS['egw_info']['user']['preferences']['common']['lang'])) |
|
485 | + if (preg_match('/^[a-z]{2}(-[a-z]{2})?$/', $GLOBALS['egw_info']['user']['preferences']['common']['lang'])) |
|
487 | 486 | { |
488 | 487 | $lang_code = $GLOBALS['egw_info']['user']['preferences']['common']['lang']; |
489 | 488 | } |
@@ -503,7 +502,7 @@ discard block |
||
503 | 502 | // send appheader to clientside |
504 | 503 | $extra['app-header'] = $app_header; |
505 | 504 | |
506 | - if($GLOBALS['egw_info']['flags']['currentapp'] != 'wiki') $robots ='<meta name="robots" content="none" />'; |
|
505 | + if ($GLOBALS['egw_info']['flags']['currentapp'] != 'wiki') $robots = '<meta name="robots" content="none" />'; |
|
507 | 506 | |
508 | 507 | $var['favicon_file'] = self::get_login_logo_or_bg_url('favicon_file', 'favicon.ico'); |
509 | 508 | |
@@ -513,7 +512,7 @@ discard block |
||
513 | 512 | $include_wz_tooltip = '<script src="'.$GLOBALS['egw_info']['server']['webserver_url']. |
514 | 513 | $wz_tooltip.'?'.filemtime(EGW_SERVER_ROOT.$wz_tooltip).'" type="text/javascript"></script>'; |
515 | 514 | } |
516 | - return $this->_get_css()+array( |
|
515 | + return $this->_get_css() + array( |
|
517 | 516 | 'img_icon' => $var['favicon_file'], |
518 | 517 | 'img_shortcut' => $var['favicon_file'], |
519 | 518 | 'pngfix' => $pngfix, |
@@ -537,15 +536,15 @@ discard block |
||
537 | 536 | */ |
538 | 537 | protected function _get_navbar($apps) |
539 | 538 | { |
540 | - $var['img_root'] = $GLOBALS['egw_info']['server']['webserver_url'] . '/phpgwapi/templates/'.$this->template.'/images'; |
|
539 | + $var['img_root'] = $GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/templates/'.$this->template.'/images'; |
|
541 | 540 | |
542 | - if(isset($GLOBALS['egw_info']['flags']['app_header'])) |
|
541 | + if (isset($GLOBALS['egw_info']['flags']['app_header'])) |
|
543 | 542 | { |
544 | 543 | $var['current_app_title'] = $GLOBALS['egw_info']['flags']['app_header']; |
545 | 544 | } |
546 | 545 | else |
547 | 546 | { |
548 | - $var['current_app_title']=$apps[$GLOBALS['egw_info']['flags']['currentapp']]['title']; |
|
547 | + $var['current_app_title'] = $apps[$GLOBALS['egw_info']['flags']['currentapp']]['title']; |
|
549 | 548 | } |
550 | 549 | $var['currentapp'] = $GLOBALS['egw_info']['flags']['currentapp']; |
551 | 550 | |
@@ -557,14 +556,14 @@ discard block |
||
557 | 556 | |
558 | 557 | $var['user_info'] = $this->_user_time_info(); |
559 | 558 | |
560 | - if($GLOBALS['egw_info']['user']['account_lastpwd_change'] == 0) |
|
559 | + if ($GLOBALS['egw_info']['user']['account_lastpwd_change'] == 0) |
|
561 | 560 | { |
562 | 561 | $api_messages = lang('You are required to change your password during your first login').'<br />'. |
563 | - lang('Click this image on the navbar: %1','<img src="'.Image::find('preferences','navbar.gif').'">'); |
|
562 | + lang('Click this image on the navbar: %1', '<img src="'.Image::find('preferences', 'navbar.gif').'">'); |
|
564 | 563 | } |
565 | - 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'])) |
|
564 | + 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'])) |
|
566 | 565 | { |
567 | - $api_messages = lang('it has been more then %1 days since you changed your password',$GLOBALS['egw_info']['server']['change_pwd_every_x_days']); |
|
566 | + $api_messages = lang('it has been more then %1 days since you changed your password', $GLOBALS['egw_info']['server']['change_pwd_every_x_days']); |
|
568 | 567 | } |
569 | 568 | |
570 | 569 | $var['logo_header'] = $var['logo_file'] = self::get_login_logo_or_bg_url('login_logo_file', 'logo'); |
@@ -574,13 +573,13 @@ discard block |
||
574 | 573 | $var['logo_header'] = self::get_login_logo_or_bg_url('login_logo_header', 'logo'); |
575 | 574 | } |
576 | 575 | |
577 | - $var['logo_url'] = $GLOBALS['egw_info']['server']['login_logo_url']?$GLOBALS['egw_info']['server']['login_logo_url']:'http://www.eGroupWare.org'; |
|
576 | + $var['logo_url'] = $GLOBALS['egw_info']['server']['login_logo_url'] ? $GLOBALS['egw_info']['server']['login_logo_url'] : 'http://www.eGroupWare.org'; |
|
578 | 577 | |
579 | - if (substr($var['logo_url'],0,4) != 'http') |
|
578 | + if (substr($var['logo_url'], 0, 4) != 'http') |
|
580 | 579 | { |
581 | 580 | $var['logo_url'] = 'http://'.$var['logo_url']; |
582 | 581 | } |
583 | - $var['logo_title'] = $GLOBALS['egw_info']['server']['login_logo_title']?$GLOBALS['egw_info']['server']['login_logo_title']:'www.eGroupWare.org'; |
|
582 | + $var['logo_title'] = $GLOBALS['egw_info']['server']['login_logo_title'] ? $GLOBALS['egw_info']['server']['login_logo_title'] : 'www.eGroupWare.org'; |
|
584 | 583 | |
585 | 584 | return $var; |
586 | 585 | } |
@@ -593,11 +592,10 @@ discard block |
||
593 | 592 | * |
594 | 593 | * @return string returns full url of the image |
595 | 594 | */ |
596 | - static function get_login_logo_or_bg_url ($type, $find_type) |
|
595 | + static function get_login_logo_or_bg_url($type, $find_type) |
|
597 | 596 | { |
598 | 597 | $url = is_array($GLOBALS['egw_info']['server'][$type]) ? |
599 | - $GLOBALS['egw_info']['server'][$type][0] : |
|
600 | - $GLOBALS['egw_info']['server'][$type]; |
|
598 | + $GLOBALS['egw_info']['server'][$type][0] : $GLOBALS['egw_info']['server'][$type]; |
|
601 | 599 | |
602 | 600 | if (substr($url, 0, 4) == 'http' || |
603 | 601 | $url[0] == '/') |
@@ -606,7 +604,7 @@ discard block |
||
606 | 604 | } |
607 | 605 | else |
608 | 606 | { |
609 | - return Image::find('api',$url ? $url : $find_type, '', null); |
|
607 | + return Image::find('api', $url ? $url : $find_type, '', null); |
|
610 | 608 | } |
611 | 609 | } |
612 | 610 | |
@@ -618,14 +616,14 @@ discard block |
||
618 | 616 | protected static function _user_time_info() |
619 | 617 | { |
620 | 618 | $now = new DateTime(); |
621 | - $user_info = '<b>'.Accounts::format_username() .'</b>'. ' - ' . lang($now->format('l')) . ' ' . $now->format(true); |
|
619 | + $user_info = '<b>'.Accounts::format_username().'</b>'.' - '.lang($now->format('l')).' '.$now->format(true); |
|
622 | 620 | |
623 | 621 | $user_tzs = DateTime::getUserTimezones(); |
624 | 622 | if (count($user_tzs) > 1) |
625 | 623 | { |
626 | 624 | $tz = $GLOBALS['egw_info']['user']['preferences']['common']['tz']; |
627 | - $user_info .= Html::form(Html::select('tz',$tz,$user_tzs,true),array(), |
|
628 | - '/index.php','','tz_selection',' style="display: inline;"','GET'); |
|
625 | + $user_info .= Html::form(Html::select('tz', $tz, $user_tzs, true), array(), |
|
626 | + '/index.php', '', 'tz_selection', ' style="display: inline;"', 'GET'); |
|
629 | 627 | } |
630 | 628 | return $user_info; |
631 | 629 | } |
@@ -637,10 +635,10 @@ discard block |
||
637 | 635 | */ |
638 | 636 | protected static function _current_users() |
639 | 637 | { |
640 | - if( $GLOBALS['egw_info']['user']['apps']['admin'] && $GLOBALS['egw_info']['user']['preferences']['common']['show_currentusers']) |
|
638 | + if ($GLOBALS['egw_info']['user']['apps']['admin'] && $GLOBALS['egw_info']['user']['preferences']['common']['show_currentusers']) |
|
641 | 639 | { |
642 | - $current_users = '<a href="' . self::link('/index.php','menuaction=admin.admin_accesslog.sessions') . '">' . |
|
643 | - lang('Current users') . ': <span id="currentusers">' . $GLOBALS['egw']->session->session_count() . '</span></a>'; |
|
640 | + $current_users = '<a href="'.self::link('/index.php', 'menuaction=admin.admin_accesslog.sessions').'">'. |
|
641 | + lang('Current users').': <span id="currentusers">'.$GLOBALS['egw']->session->session_count().'</span></a>'; |
|
644 | 642 | return $current_users; |
645 | 643 | } |
646 | 644 | } |
@@ -674,14 +672,14 @@ discard block |
||
674 | 672 | * @param array $opts =array() further params for http(s) context, eg. array('timeout' => 123) |
675 | 673 | * @return resource|null context to use with file_get_context/fopen or null if no proxy configured |
676 | 674 | */ |
677 | - public static function proxy_context($username=null, $password=null, array $opts = array()) |
|
675 | + public static function proxy_context($username = null, $password = null, array $opts = array()) |
|
678 | 676 | { |
679 | 677 | $opts += array( |
680 | 678 | 'method' => 'GET', |
681 | 679 | ); |
682 | 680 | if (!empty($GLOBALS['egw_info']['server']['httpproxy_server'])) |
683 | 681 | { |
684 | - $opts += array ( |
|
682 | + $opts += array( |
|
685 | 683 | 'proxy' => 'tcp://'.$GLOBALS['egw_info']['server']['httpproxy_server'].':'. |
686 | 684 | ($GLOBALS['egw_info']['server']['httpproxy_port'] ? $GLOBALS['egw_info']['server']['httpproxy_port'] : 8080), |
687 | 685 | 'request_fulluri' => true, |
@@ -710,7 +708,7 @@ discard block |
||
710 | 708 | * @param string &$changelog on return path to changelog |
711 | 709 | * @return string |
712 | 710 | */ |
713 | - public static function api_version(&$changelog=null) |
|
711 | + public static function api_version(&$changelog = null) |
|
714 | 712 | { |
715 | 713 | return Framework\Updates::api_version($changelog); |
716 | 714 | } |
@@ -723,7 +721,7 @@ discard block |
||
723 | 721 | */ |
724 | 722 | public static function index($app) |
725 | 723 | { |
726 | - $data =& $GLOBALS['egw_info']['user']['apps'][$app]; |
|
724 | + $data = & $GLOBALS['egw_info']['user']['apps'][$app]; |
|
727 | 725 | if (!isset($data)) |
728 | 726 | { |
729 | 727 | throw new Exception\WrongParameter("'$app' not a valid app for this user!"); |
@@ -740,7 +738,7 @@ discard block |
||
740 | 738 | $index = '/index.php?menuaction='.$data['index']; |
741 | 739 | } |
742 | 740 | } |
743 | - return self::link($index,$GLOBALS['egw_info']['flags']['params'][$app]); |
|
741 | + return self::link($index, $GLOBALS['egw_info']['flags']['params'][$app]); |
|
744 | 742 | } |
745 | 743 | |
746 | 744 | /** |
@@ -781,15 +779,15 @@ discard block |
||
781 | 779 | * true: always return svg, false: never return svg (current default), null: browser dependent, see svg_usable() |
782 | 780 | * @return array |
783 | 781 | */ |
784 | - protected static function _get_navbar_apps($svg=false) |
|
782 | + protected static function _get_navbar_apps($svg = false) |
|
785 | 783 | { |
786 | 784 | list($first) = each($GLOBALS['egw_info']['user']['apps']); |
787 | - if(is_array($GLOBALS['egw_info']['user']['apps']['admin']) && $first != 'admin') |
|
785 | + if (is_array($GLOBALS['egw_info']['user']['apps']['admin']) && $first != 'admin') |
|
788 | 786 | { |
789 | 787 | $newarray['admin'] = $GLOBALS['egw_info']['user']['apps']['admin']; |
790 | - foreach($GLOBALS['egw_info']['user']['apps'] as $index => $value) |
|
788 | + foreach ($GLOBALS['egw_info']['user']['apps'] as $index => $value) |
|
791 | 789 | { |
792 | - if($index != 'admin') |
|
790 | + if ($index != 'admin') |
|
793 | 791 | { |
794 | 792 | $newarray[$index] = $value; |
795 | 793 | } |
@@ -802,7 +800,7 @@ discard block |
||
802 | 800 | unset($newarray); |
803 | 801 | |
804 | 802 | $apps = array(); |
805 | - foreach($GLOBALS['egw_info']['user']['apps'] as $app => $data) |
|
803 | + foreach ($GLOBALS['egw_info']['user']['apps'] as $app => $data) |
|
806 | 804 | { |
807 | 805 | if (is_long($app)) |
808 | 806 | { |
@@ -819,21 +817,21 @@ discard block |
||
819 | 817 | if ($data['status'] == 4) |
820 | 818 | { |
821 | 819 | $apps[$app]['target'] = ' target="'.$app.'" onClick="'."if (this != '') { window.open(this+'". |
822 | - (strpos($apps[$app]['url'],'?') !== false ? '&' : '?'). |
|
820 | + (strpos($apps[$app]['url'], '?') !== false ? '&' : '?'). |
|
823 | 821 | "referer='+encodeURIComponent(location),this.target,'width=800,height=600,scrollbars=yes,resizable=yes'); return false; } else { return true; }".'"'; |
824 | 822 | } |
825 | - elseif(isset($GLOBALS['egw_info']['flags']['navbar_target']) && $GLOBALS['egw_info']['flags']['navbar_target']) |
|
823 | + elseif (isset($GLOBALS['egw_info']['flags']['navbar_target']) && $GLOBALS['egw_info']['flags']['navbar_target']) |
|
826 | 824 | { |
827 | - $apps[$app]['target'] = 'target="' . $GLOBALS['egw_info']['flags']['navbar_target'] . '"'; |
|
825 | + $apps[$app]['target'] = 'target="'.$GLOBALS['egw_info']['flags']['navbar_target'].'"'; |
|
828 | 826 | } |
829 | 827 | else |
830 | 828 | { |
831 | 829 | $apps[$app]['target'] = ''; |
832 | 830 | } |
833 | 831 | |
834 | - $icon = isset($data['icon']) ? $data['icon'] : 'navbar'; |
|
832 | + $icon = isset($data['icon']) ? $data['icon'] : 'navbar'; |
|
835 | 833 | $icon_app = isset($data['icon_app']) ? $data['icon_app'] : $app; |
836 | - $apps[$app]['icon'] = $apps[$app]['icon_hover'] = Image::find($icon_app,Array($icon,'nonav'),'',$svg); |
|
834 | + $apps[$app]['icon'] = $apps[$app]['icon_hover'] = Image::find($icon_app, Array($icon, 'nonav'), '', $svg); |
|
837 | 835 | } |
838 | 836 | } |
839 | 837 | |
@@ -866,13 +864,13 @@ discard block |
||
866 | 864 | // We handle this here because its special |
867 | 865 | $apps['about']['title'] = 'EGroupware'; |
868 | 866 | $apps['about']['url'] = self::link('/about.php'); |
869 | - $apps['about']['icon'] = $apps['about']['icon_hover'] = Image::find('api',Array('about','nonav')); |
|
867 | + $apps['about']['icon'] = $apps['about']['icon_hover'] = Image::find('api', Array('about', 'nonav')); |
|
870 | 868 | $apps['about']['name'] = 'about'; |
871 | 869 | |
872 | 870 | $apps['logout']['title'] = lang('Logout'); |
873 | 871 | $apps['logout']['name'] = 'logout'; |
874 | 872 | $apps['logout']['url'] = self::link('/logout.php'); |
875 | - $apps['logout']['icon'] = $apps['logout']['icon_hover'] = Image::find('api',Array('logout','nonav')); |
|
873 | + $apps['logout']['icon'] = $apps['logout']['icon_hover'] = Image::find('api', Array('logout', 'nonav')); |
|
876 | 874 | |
877 | 875 | return $apps; |
878 | 876 | } |
@@ -907,7 +905,7 @@ discard block |
||
907 | 905 | } |
908 | 906 | $themes_to_check[] = $this->template_dir.'/css/'.$GLOBALS['egw_info']['user']['preferences']['common']['theme'].'.css'; |
909 | 907 | $themes_to_check[] = $this->template_dir.'/css/'.$this->template.'.css'; |
910 | - foreach($themes_to_check as $theme_css) |
|
908 | + foreach ($themes_to_check as $theme_css) |
|
911 | 909 | { |
912 | 910 | if (file_exists(EGW_SERVER_ROOT.$theme_css)) break; |
913 | 911 | } |
@@ -941,7 +939,7 @@ discard block |
||
941 | 939 | |
942 | 940 | // sending print css last, so it can overwrite anything |
943 | 941 | $print_css = $this->template_dir.'/print.css'; |
944 | - if(!file_exists(EGW_SERVER_ROOT.$print_css)) |
|
942 | + if (!file_exists(EGW_SERVER_ROOT.$print_css)) |
|
945 | 943 | { |
946 | 944 | $print_css = '/api/templates/default/print.css'; |
947 | 945 | } |
@@ -967,7 +965,7 @@ discard block |
||
967 | 965 | * @param array $extra =array() extra data to pass to egw.js as data-parameter |
968 | 966 | * @return string the javascript to be included |
969 | 967 | */ |
970 | - public static function _get_js(array $extra=array()) |
|
968 | + public static function _get_js(array $extra = array()) |
|
971 | 969 | { |
972 | 970 | $java_script = ''; |
973 | 971 | |
@@ -975,7 +973,7 @@ discard block |
||
975 | 973 | Think of conf vars etc... ([email protected]) */ |
976 | 974 | if (isset($GLOBALS['egw_info']['flags']['java_script_thirst'])) |
977 | 975 | { |
978 | - $java_script .= $GLOBALS['egw_info']['flags']['java_script_thirst'] . "\n"; |
|
976 | + $java_script .= $GLOBALS['egw_info']['flags']['java_script_thirst']."\n"; |
|
979 | 977 | } |
980 | 978 | // add configuration, link-registry, images, user-data and -perferences for non-popup windows |
981 | 979 | // specifying etag in url to force reload, as we send expires header |
@@ -987,7 +985,7 @@ discard block |
||
987 | 985 | self::includeJS('/api/images.php', array( |
988 | 986 | 'template' => $GLOBALS['egw_info']['server']['template_set'], |
989 | 987 | 'etag' => md5(json_encode(Image::map($GLOBALS['egw_info']['server']['template_set']))), |
990 | - 'svg' => Header\UserAgent::mobile(), // always load non-svg image map, ATM we use svg icons only for mobile theme |
|
988 | + 'svg' => Header\UserAgent::mobile(), // always load non-svg image map, ATM we use svg icons only for mobile theme |
|
991 | 989 | )); |
992 | 990 | self::includeJS('/api/user.php', array( |
993 | 991 | 'user' => $GLOBALS['egw_info']['user']['account_lid'], |
@@ -999,7 +997,7 @@ discard block |
||
999 | 997 | } |
1000 | 998 | |
1001 | 999 | $extra['url'] = $GLOBALS['egw_info']['server']['webserver_url']; |
1002 | - $extra['include'] = array_map(function($str){return substr($str,1);}, self::get_script_links(true), array(1)); |
|
1000 | + $extra['include'] = array_map(function($str) {return substr($str, 1); }, self::get_script_links(true), array(1)); |
|
1003 | 1001 | $extra['app'] = $GLOBALS['egw_info']['flags']['currentapp']; |
1004 | 1002 | |
1005 | 1003 | // Load LABjs ONCE here |
@@ -1009,18 +1007,18 @@ discard block |
||
1009 | 1007 | '/api/js/jsapi/egw.js?'.filemtime(EGW_SERVER_ROOT.'/api/js/jsapi/egw.js').'" id="egw_script_id"'; |
1010 | 1008 | |
1011 | 1009 | // add values of extra parameter and class var as data attributes to script tag of egw.js |
1012 | - foreach($extra+self::$extra as $name => $value) |
|
1010 | + foreach ($extra + self::$extra as $name => $value) |
|
1013 | 1011 | { |
1014 | 1012 | if (is_array($value)) $value = json_encode($value); |
1015 | 1013 | // we need to double encode (Html::htmlspecialchars( , TRUE)), as otherwise we get invalid json, eg. for quotes |
1016 | - $java_script .= ' data-'.$name."=\"". Html::htmlspecialchars($value, true)."\""; |
|
1014 | + $java_script .= ' data-'.$name."=\"".Html::htmlspecialchars($value, true)."\""; |
|
1017 | 1015 | } |
1018 | 1016 | $java_script .= "></script>\n"; |
1019 | 1017 | |
1020 | - if(@isset($_GET['menuaction'])) |
|
1018 | + if (@isset($_GET['menuaction'])) |
|
1021 | 1019 | { |
1022 | - list(, $class) = explode('.',$_GET['menuaction']); |
|
1023 | - if(is_array($GLOBALS[$class]->public_functions) && |
|
1020 | + list(, $class) = explode('.', $_GET['menuaction']); |
|
1021 | + if (is_array($GLOBALS[$class]->public_functions) && |
|
1024 | 1022 | $GLOBALS[$class]->public_functions['java_script']) |
1025 | 1023 | { |
1026 | 1024 | $java_script .= $GLOBALS[$class]->java_script(); |
@@ -1029,10 +1027,10 @@ discard block |
||
1029 | 1027 | if (isset($GLOBALS['egw_info']['flags']['java_script'])) |
1030 | 1028 | { |
1031 | 1029 | // Strip out any script tags, this needs to be executed as anonymous function |
1032 | - $GLOBALS['egw_info']['flags']['java_script'] = preg_replace(array('/(<script[^>]*>)([^<]*)/is','/<\/script>/'),array('$2',''),$GLOBALS['egw_info']['flags']['java_script']); |
|
1033 | - if(trim($GLOBALS['egw_info']['flags']['java_script']) != '') |
|
1030 | + $GLOBALS['egw_info']['flags']['java_script'] = preg_replace(array('/(<script[^>]*>)([^<]*)/is', '/<\/script>/'), array('$2', ''), $GLOBALS['egw_info']['flags']['java_script']); |
|
1031 | + if (trim($GLOBALS['egw_info']['flags']['java_script']) != '') |
|
1034 | 1032 | { |
1035 | - $java_script .= '<script type="text/javascript">window.egw_LAB.wait(function() {'.$GLOBALS['egw_info']['flags']['java_script'] . "});</script>\n"; |
|
1033 | + $java_script .= '<script type="text/javascript">window.egw_LAB.wait(function() {'.$GLOBALS['egw_info']['flags']['java_script']."});</script>\n"; |
|
1036 | 1034 | } |
1037 | 1035 | } |
1038 | 1036 | |
@@ -1049,7 +1047,7 @@ discard block |
||
1049 | 1047 | function list_themes() |
1050 | 1048 | { |
1051 | 1049 | $list = array(); |
1052 | - if (file_exists($file=EGW_SERVER_ROOT.$this->template_dir.'/setup/setup.inc.php') && |
|
1050 | + if (file_exists($file = EGW_SERVER_ROOT.$this->template_dir.'/setup/setup.inc.php') && |
|
1053 | 1051 | (include $file) && isset($GLOBALS['egw_info']['template'][$this->template]['themes'])) |
1054 | 1052 | { |
1055 | 1053 | $list = $GLOBALS['egw_info']['template'][$this->template]['themes']; |
@@ -1060,8 +1058,8 @@ discard block |
||
1060 | 1058 | { |
1061 | 1059 | if (preg_match('/'."\.css$".'/i', $file)) |
1062 | 1060 | { |
1063 | - list($name) = explode('.',$file); |
|
1064 | - if (!isset($list[$name])) $list[$name] = ucfirst ($name); |
|
1061 | + list($name) = explode('.', $file); |
|
1062 | + if (!isset($list[$name])) $list[$name] = ucfirst($name); |
|
1065 | 1063 | } |
1066 | 1064 | } |
1067 | 1065 | closedir($dh); |
@@ -1075,21 +1073,20 @@ discard block |
||
1075 | 1073 | * @param boolean $full_data =false true: value is array with values for keys 'name', 'title', ... |
1076 | 1074 | * @returns array alphabetically sorted list of templates |
1077 | 1075 | */ |
1078 | - static function list_templates($full_data=false) |
|
1076 | + static function list_templates($full_data = false) |
|
1079 | 1077 | { |
1080 | 1078 | $list = array('pixelegg'=>null); |
1081 | 1079 | // templates packaged like apps in own directories (containing as setup/setup.inc.php file!) |
1082 | 1080 | $dr = dir(EGW_SERVER_ROOT); |
1083 | - while (($entry=$dr->read())) |
|
1081 | + while (($entry = $dr->read())) |
|
1084 | 1082 | { |
1085 | 1083 | if ($entry != '..' && !isset($GLOBALS['egw_info']['apps'][$entry]) && is_dir(EGW_SERVER_ROOT.'/'.$entry) && |
1086 | - file_exists($f = EGW_SERVER_ROOT . '/' . $entry .'/setup/setup.inc.php')) |
|
1084 | + file_exists($f = EGW_SERVER_ROOT.'/'.$entry.'/setup/setup.inc.php')) |
|
1087 | 1085 | { |
1088 | 1086 | include($f); |
1089 | 1087 | if (isset($GLOBALS['egw_info']['template'][$entry])) |
1090 | 1088 | { |
1091 | - $list[$entry] = $full_data ? $GLOBALS['egw_info']['template'][$entry] : |
|
1092 | - $GLOBALS['egw_info']['template'][$entry]['title']; |
|
1089 | + $list[$entry] = $full_data ? $GLOBALS['egw_info']['template'][$entry] : $GLOBALS['egw_info']['template'][$entry]['title']; |
|
1093 | 1090 | } |
1094 | 1091 | } |
1095 | 1092 | } |
@@ -1106,14 +1103,14 @@ discard block |
||
1106 | 1103 | * @param array $vars |
1107 | 1104 | * @param array $apps |
1108 | 1105 | */ |
1109 | - function topmenu(array $vars,array $apps) |
|
1106 | + function topmenu(array $vars, array $apps) |
|
1110 | 1107 | { |
1111 | - if($GLOBALS['egw_info']['user']['apps']['home'] && isset($apps['home'])) |
|
1108 | + if ($GLOBALS['egw_info']['user']['apps']['home'] && isset($apps['home'])) |
|
1112 | 1109 | { |
1113 | 1110 | $this->_add_topmenu_item($apps['home']); |
1114 | 1111 | } |
1115 | 1112 | |
1116 | - if($GLOBALS['egw_info']['user']['apps']['preferences']) |
|
1113 | + if ($GLOBALS['egw_info']['user']['apps']['preferences']) |
|
1117 | 1114 | { |
1118 | 1115 | $this->add_preferences_topmenu('prefs'); |
1119 | 1116 | $this->add_preferences_topmenu('acl'); |
@@ -1138,9 +1135,9 @@ discard block |
||
1138 | 1135 | $this->_add_topmenu_item(array_merge($apps['manual'],array('title' => lang('Help')))); |
1139 | 1136 | }*/ |
1140 | 1137 | |
1141 | - Hooks::process('topmenu_info',array(),true); |
|
1138 | + Hooks::process('topmenu_info', array(), true); |
|
1142 | 1139 | // Add extra items added by hooks |
1143 | - foreach(self::$top_menu_extra as $extra_item) { |
|
1140 | + foreach (self::$top_menu_extra as $extra_item) { |
|
1144 | 1141 | $this->_add_topmenu_item($extra_item); |
1145 | 1142 | } |
1146 | 1143 | |
@@ -1150,7 +1147,7 @@ discard block |
||
1150 | 1147 | { |
1151 | 1148 | $this->_add_topmenu_info_item($update, 'update'); |
1152 | 1149 | } |
1153 | - if($GLOBALS['egw_info']['user']['apps']['notifications']) |
|
1150 | + if ($GLOBALS['egw_info']['user']['apps']['notifications']) |
|
1154 | 1151 | { |
1155 | 1152 | $this->_add_topmenu_info_item(self::_get_notification_bell(), 'notifications'); |
1156 | 1153 | } |
@@ -1162,9 +1159,9 @@ discard block |
||
1162 | 1159 | /** |
1163 | 1160 | * Add Preferences link to topmenu using settings-hook to know if an app supports Preferences |
1164 | 1161 | */ |
1165 | - protected function add_preferences_topmenu($type='prefs') |
|
1162 | + protected function add_preferences_topmenu($type = 'prefs') |
|
1166 | 1163 | { |
1167 | - static $memberships=null; |
|
1164 | + static $memberships = null; |
|
1168 | 1165 | if (!isset($memberships)) $memberships = $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'], true); |
1169 | 1166 | static $types = array( |
1170 | 1167 | 'prefs' => array( |
@@ -1178,20 +1175,20 @@ discard block |
||
1178 | 1175 | 'cats' => array( |
1179 | 1176 | 'title' => 'Categories', |
1180 | 1177 | 'hook' => 'categories', |
1181 | - 'run_hook' => true, // acturally run hook, not just look it's implemented |
|
1178 | + 'run_hook' => true, // acturally run hook, not just look it's implemented |
|
1182 | 1179 | ), |
1183 | 1180 | ); |
1184 | 1181 | if (!$GLOBALS['egw_info']['user']['apps']['preferences'] || $GLOBALS['egw_info']['server']['deny_'.$type] && |
1185 | 1182 | array_intersect($memberships, (array)$GLOBALS['egw_info']['server']['deny_'.$type]) && |
1186 | 1183 | !$GLOBALS['egw_info']['user']['apps']['admin']) |
1187 | 1184 | { |
1188 | - return; // user has no access to Preferences app |
|
1185 | + return; // user has no access to Preferences app |
|
1189 | 1186 | } |
1190 | 1187 | if (isset($types[$type]['run_hook'])) |
1191 | 1188 | { |
1192 | 1189 | $apps = Hooks::process($types[$type]['hook']); |
1193 | 1190 | // as all apps answer, we need to remove none-true responses |
1194 | - foreach($apps as $app => $val) |
|
1191 | + foreach ($apps as $app => $val) |
|
1195 | 1192 | { |
1196 | 1193 | if (!$val) unset($apps[$app]); |
1197 | 1194 | } |
@@ -1217,7 +1214,7 @@ discard block |
||
1217 | 1214 | * @access protected |
1218 | 1215 | * @return void |
1219 | 1216 | */ |
1220 | - abstract function _add_topmenu_item(array $app_data,$alt_label=null); |
|
1217 | + abstract function _add_topmenu_item(array $app_data, $alt_label = null); |
|
1221 | 1218 | |
1222 | 1219 | /** |
1223 | 1220 | * Add info items to the topmenu template class to be displayed |
@@ -1227,7 +1224,7 @@ discard block |
||
1227 | 1224 | * @access protected |
1228 | 1225 | * @return void |
1229 | 1226 | */ |
1230 | - abstract function _add_topmenu_info_item($content, $id=null); |
|
1227 | + abstract function _add_topmenu_info_item($content, $id = null); |
|
1231 | 1228 | |
1232 | 1229 | static $top_menu_extra = array(); |
1233 | 1230 | |
@@ -1242,7 +1239,7 @@ discard block |
||
1242 | 1239 | * @access public |
1243 | 1240 | * @return void |
1244 | 1241 | */ |
1245 | - public static function add_topmenu_item($id,$url,$title,$target = '') |
|
1242 | + public static function add_topmenu_item($id, $url, $title, $target = '') |
|
1246 | 1243 | { |
1247 | 1244 | $entry['name'] = $id; |
1248 | 1245 | $entry['url'] = $url; |
@@ -1263,7 +1260,7 @@ discard block |
||
1263 | 1260 | * @access public |
1264 | 1261 | * @return void |
1265 | 1262 | */ |
1266 | - abstract function topmenu_info_icon($id,$icon_src,$iconlink,$blink=false,$tooltip=null); |
|
1263 | + abstract function topmenu_info_icon($id, $icon_src, $iconlink, $blink = false, $tooltip = null); |
|
1267 | 1264 | |
1268 | 1265 | /** |
1269 | 1266 | * Call and return content of 'after_navbar' hook |
@@ -1273,7 +1270,7 @@ discard block |
||
1273 | 1270 | protected function _get_after_navbar() |
1274 | 1271 | { |
1275 | 1272 | ob_start(); |
1276 | - Hooks::process('after_navbar',null,true); |
|
1273 | + Hooks::process('after_navbar', null, true); |
|
1277 | 1274 | $content = ob_get_contents(); |
1278 | 1275 | ob_end_clean(); |
1279 | 1276 | |
@@ -1310,7 +1307,7 @@ discard block |
||
1310 | 1307 | * @param string $app ='phpgwapi' application directory to search - default = phpgwapi |
1311 | 1308 | * @param boolean $append =true should the file be added |
1312 | 1309 | */ |
1313 | - static function includeJS($package, $file=null, $app='phpgwapi', $append=true) |
|
1310 | + static function includeJS($package, $file = null, $app = 'phpgwapi', $append = true) |
|
1314 | 1311 | { |
1315 | 1312 | self::$js_include_mgr->include_js_file($package, $file, $app, $append); |
1316 | 1313 | } |
@@ -1322,7 +1319,7 @@ discard block |
||
1322 | 1319 | * @param boolean $clear_files =false true clear files after returning them |
1323 | 1320 | * @return array with pathes relative to EGW_SERVER_ROOT |
1324 | 1321 | */ |
1325 | - static function js_files(array $files=null, $clear_files=false) |
|
1322 | + static function js_files(array $files = null, $clear_files = false) |
|
1326 | 1323 | { |
1327 | 1324 | if (isset($files) && is_array($files)) |
1328 | 1325 | { |
@@ -1341,7 +1338,7 @@ discard block |
||
1341 | 1338 | * @param boolean $clear_files =false true clear files after returning them |
1342 | 1339 | * @return string|array see $return_pathes parameter |
1343 | 1340 | */ |
1344 | - static public function get_script_links($return_pathes=false, $clear_files=false) |
|
1341 | + static public function get_script_links($return_pathes = false, $clear_files = false) |
|
1345 | 1342 | { |
1346 | 1343 | $to_include = Framework\Bundle::js_includes(self::$js_include_mgr->get_included_files($clear_files)); |
1347 | 1344 | |
@@ -1349,7 +1346,7 @@ discard block |
||
1349 | 1346 | { |
1350 | 1347 | return $to_include; |
1351 | 1348 | } |
1352 | - $start = '<script type="text/javascript" src="'. $GLOBALS['egw_info']['server']['webserver_url']; |
|
1349 | + $start = '<script type="text/javascript" src="'.$GLOBALS['egw_info']['server']['webserver_url']; |
|
1353 | 1350 | $end = '">'."</script>\n"; |
1354 | 1351 | return "\n".$start.implode($end.$start, $to_include).$end; |
1355 | 1352 | } |
@@ -1369,7 +1366,7 @@ discard block |
||
1369 | 1366 | * @param boolean $no_default_css =false true do NOT load any default css, only what app explicitly includes |
1370 | 1367 | * @return boolean false: css file not found, true: file found |
1371 | 1368 | */ |
1372 | - public static function includeCSS($app, $name=null, $append=true, $no_default_css=false) |
|
1369 | + public static function includeCSS($app, $name = null, $append = true, $no_default_css = false) |
|
1373 | 1370 | { |
1374 | 1371 | if ($no_default_css) |
1375 | 1372 | { |
@@ -1389,16 +1386,16 @@ discard block |
||
1389 | 1386 | |
1390 | 1387 | // try to add app specific css file |
1391 | 1388 | self::includeCSS($app, 'app-'.$GLOBALS['egw_info']['user']['preferences']['common']['theme']) || |
1392 | - self::includeCSS($app,'app'); |
|
1389 | + self::includeCSS($app, 'app'); |
|
1393 | 1390 | |
1394 | 1391 | // add all css files from Framework::includeCSS() |
1395 | 1392 | $query = null; |
1396 | 1393 | //error_log(__METHOD__."() Framework\CssIncludes::get()=".array2string(Framework\CssIncludes::get())); |
1397 | - foreach(Framework\CssIncludes::get() as $path) |
|
1394 | + foreach (Framework\CssIncludes::get() as $path) |
|
1398 | 1395 | { |
1399 | 1396 | unset($query); |
1400 | - list($path,$query) = explode('?',$path,2); |
|
1401 | - $path .= '?'. ($query ? $query : filemtime(EGW_SERVER_ROOT.$path)); |
|
1397 | + list($path, $query) = explode('?', $path, 2); |
|
1398 | + $path .= '?'.($query ? $query : filemtime(EGW_SERVER_ROOT.$path)); |
|
1402 | 1399 | $response->includeCSS($GLOBALS['egw_info']['server']['webserver_url'].$path); |
1403 | 1400 | } |
1404 | 1401 | |
@@ -1407,7 +1404,7 @@ discard block |
||
1407 | 1404 | |
1408 | 1405 | // add all js files from Framework::includeJS() |
1409 | 1406 | $files = Framework\Bundle::js_includes(self::$js_include_mgr->get_included_files()); |
1410 | - foreach($files as $path) |
|
1407 | + foreach ($files as $path) |
|
1411 | 1408 | { |
1412 | 1409 | $response->includeScript($GLOBALS['egw_info']['server']['webserver_url'].$path); |
1413 | 1410 | } |
@@ -1486,17 +1483,17 @@ discard block |
||
1486 | 1483 | */ |
1487 | 1484 | public static function ajax_user_list() |
1488 | 1485 | { |
1489 | - $list = array('accounts' => array(),'groups' => array(), 'owngroups' => array()); |
|
1490 | - if($GLOBALS['egw_info']['user']['preferences']['common']['account_selection'] == 'primary_group') |
|
1486 | + $list = array('accounts' => array(), 'groups' => array(), 'owngroups' => array()); |
|
1487 | + if ($GLOBALS['egw_info']['user']['preferences']['common']['account_selection'] == 'primary_group') |
|
1491 | 1488 | { |
1492 | 1489 | $list['accounts']['filter']['group'] = $GLOBALS['egw_info']['user']['account_primary_group']; |
1493 | 1490 | } |
1494 | - foreach($list as $type => &$accounts) |
|
1491 | + foreach ($list as $type => &$accounts) |
|
1495 | 1492 | { |
1496 | 1493 | $options = array('account_type' => $type) + $accounts; |
1497 | - $key_pair = Accounts::link_query('',$options); |
|
1494 | + $key_pair = Accounts::link_query('', $options); |
|
1498 | 1495 | $accounts = array(); |
1499 | - foreach($key_pair as $account_id => $name) |
|
1496 | + foreach ($key_pair as $account_id => $name) |
|
1500 | 1497 | { |
1501 | 1498 | $accounts[] = array('value' => $account_id, 'label' => $name); |
1502 | 1499 | } |
@@ -1514,16 +1511,16 @@ discard block |
||
1514 | 1511 | * @param boolean $_resolve_groups =false true: return attribute for all members, false return attribute for group itself |
1515 | 1512 | * @return array account_id => data pairs |
1516 | 1513 | */ |
1517 | - public static function ajax_account_data($_account_ids, $_field, $_resolve_groups=false) |
|
1514 | + public static function ajax_account_data($_account_ids, $_field, $_resolve_groups = false) |
|
1518 | 1515 | { |
1519 | 1516 | $list = array(); |
1520 | - foreach((array)$_account_ids as $account_id) |
|
1517 | + foreach ((array)$_account_ids as $account_id) |
|
1521 | 1518 | { |
1522 | - foreach($account_id < 0 && $_resolve_groups ? |
|
1519 | + foreach ($account_id < 0 && $_resolve_groups ? |
|
1523 | 1520 | $GLOBALS['egw']->accounts->members($account_id, true) : array($account_id) as $account_id) |
1524 | 1521 | { |
1525 | 1522 | // Make sure name is formatted according to preference |
1526 | - if($_field == 'account_fullname') |
|
1523 | + if ($_field == 'account_fullname') |
|
1527 | 1524 | { |
1528 | 1525 | $list[$account_id] = Accounts::format_username( |
1529 | 1526 | $GLOBALS['egw']->accounts->id2name($account_id, 'account_lid'), |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | function __construct() |
28 | 28 | { |
29 | - if (false) parent::__construct (); // parent constructor explicitly not called! |
|
29 | + if (false) parent::__construct(); // parent constructor explicitly not called! |
|
30 | 30 | |
31 | 31 | Framework::includeCSS('/admin/templates/default/app.css'); |
32 | 32 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @param array $content |
48 | 48 | */ |
49 | - public function index(array $content=null) |
|
49 | + public function index(array $content = null) |
|
50 | 50 | { |
51 | 51 | $GLOBALS['egw_info']['flags']['currentapp'] = $_GET['cats_app']; |
52 | 52 |
@@ -16,7 +16,8 @@ discard block |
||
16 | 16 | * Preference UI extends Admin class to give regular users restricted |
17 | 17 | * access to modify Api\Categories |
18 | 18 | */ |
19 | -class preferences_categories_ui extends admin_categories { |
|
19 | +class preferences_categories_ui extends admin_categories |
|
20 | +{ |
|
20 | 21 | |
21 | 22 | protected $appname = 'preferences'; |
22 | 23 | protected $get_rows = 'preferences.preferences_categories_ui.get_rows'; |
@@ -26,7 +27,11 @@ discard block |
||
26 | 27 | |
27 | 28 | function __construct() |
28 | 29 | { |
29 | - if (false) parent::__construct (); // parent constructor explicitly not called! |
|
30 | + if (false) |
|
31 | + { |
|
32 | + parent::__construct (); |
|
33 | + } |
|
34 | + // parent constructor explicitly not called! |
|
30 | 35 | |
31 | 36 | Framework::includeCSS('/admin/templates/default/app.css'); |
32 | 37 |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | $this->description = lang('This module displays the current month'); |
28 | 28 | } |
29 | 29 | |
30 | - function get_content(&$arguments,$properties) |
|
30 | + function get_content(&$arguments, $properties) |
|
31 | 31 | { |
32 | - $date = (int) (strtotime(get_var('date',array('POST','GET')))); |
|
32 | + $date = (int)(strtotime(get_var('date', array('POST', 'GET')))); |
|
33 | 33 | $redirect = $arguments['redirect'] ? $arguments['redirect'] : '#'; |
34 | 34 | |
35 | 35 | if (!file_exists(EGW_SERVER_ROOT.'/phpgwapi')) |
@@ -38,6 +38,6 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | return $GLOBALS['egw']->jscalendar->get_javascript(). |
41 | - $GLOBALS['egw']->jscalendar->flat($redirect,$date); |
|
41 | + $GLOBALS['egw']->jscalendar->flat($redirect, $date); |
|
42 | 42 | } |
43 | 43 | } |
@@ -83,7 +83,7 @@ |
||
83 | 83 | */ |
84 | 84 | static function admin() |
85 | 85 | { |
86 | - $file = Array( |
|
86 | + $file = array( |
|
87 | 87 | 'Site Configuration' => Egw::link('/index.php','menuaction=admin.admin_config.index&appname=calendar&ajax=true'), |
88 | 88 | 'Custom fields' => Egw::link('/index.php','menuaction=admin.admin_customfields.index&appname=calendar&ajax=true'), |
89 | 89 | 'Global Categories' => Egw::link('/index.php','menuaction=admin.admin_categories.index&appname=calendar&ajax=true'), |
@@ -107,9 +107,12 @@ discard block |
||
107 | 107 | */ |
108 | 108 | static function settings($hook_data) |
109 | 109 | { |
110 | - if (!$hook_data['setup']) // does not work on setup time |
|
110 | + if (!$hook_data['setup']) |
|
111 | + { |
|
112 | + // does not work on setup time |
|
111 | 113 | { |
112 | 114 | $bo = new calendar_bo(); |
115 | + } |
|
113 | 116 | $bo->check_set_default_prefs(); |
114 | 117 | } |
115 | 118 | $yesno = array( |
@@ -208,9 +211,12 @@ discard block |
||
208 | 211 | 1 => lang('Yes'), |
209 | 212 | 2 => lang('With credentials included'), |
210 | 213 | ); |
211 | - if (!$hook_data['setup']) // does not work at setup time |
|
214 | + if (!$hook_data['setup']) |
|
215 | + { |
|
216 | + // does not work at setup time |
|
212 | 217 | { |
213 | 218 | $options = array('0' => lang('none')); |
219 | + } |
|
214 | 220 | foreach($GLOBALS['egw']->accounts->search(array('type' => 'owngroups','app' => 'calendar')) as $group) |
215 | 221 | { |
216 | 222 | $options[$group['account_id']] = Api\Accounts::username($group['account_id']); |
@@ -374,9 +380,12 @@ discard block |
||
374 | 380 | 'default' => '', |
375 | 381 | ), |
376 | 382 | ); |
377 | - if (isset($bo)) // add custom time-spans set by CalDAV clients, not in our prefs |
|
383 | + if (isset($bo)) |
|
384 | + { |
|
385 | + // add custom time-spans set by CalDAV clients, not in our prefs |
|
378 | 386 | { |
379 | 387 | $prefs = $GLOBALS['egw_info']['user']['preferences']['calendar']; |
388 | + } |
|
380 | 389 | $data = array( |
381 | 390 | 'prefs' => &$prefs, // use reference to get preference value back |
382 | 391 | 'preprocess' => true, |
@@ -744,7 +753,10 @@ discard block |
||
744 | 753 | { |
745 | 754 | //error_log(__METHOD__."(".array2string($data).")"); |
746 | 755 | // caldav perfs are always user specific and cant by switched off |
747 | - if ($data['type'] != 'user') return; |
|
756 | + if ($data['type'] != 'user') |
|
757 | + { |
|
758 | + return; |
|
759 | + } |
|
748 | 760 | |
749 | 761 | $account_lid = $GLOBALS['egw_info']['user']['account_lid']; |
750 | 762 | foreach(array( |
@@ -753,16 +765,23 @@ discard block |
||
753 | 765 | ) as $name => $dav) |
754 | 766 | { |
755 | 767 | $pref =& $GLOBALS['egw_info']['user']['preferences']['groupdav'][$dav]; |
756 | - if (true) $pref = str_replace("\r", '', $pref); // remove CR messing up multiline preg_match |
|
768 | + if (true) |
|
769 | + { |
|
770 | + $pref = str_replace("\r", '', $pref); |
|
771 | + } |
|
772 | + // remove CR messing up multiline preg_match |
|
757 | 773 | $val =& $data['prefs'][$name]; |
758 | 774 | |
759 | 775 | //error_log(__METHOD__."() groupdav[$dav]=$pref, calendar[$name]=$val"); |
760 | 776 | |
761 | - if ($data['preprocess']) // showing preferences |
|
777 | + if ($data['preprocess']) |
|
778 | + { |
|
779 | + // showing preferences |
|
762 | 780 | { |
763 | 781 | if (!isset($val)) // no calendar pref --> read value from caldav |
764 | 782 | { |
765 | 783 | $matches = null; |
784 | + } |
|
766 | 785 | if (preg_match('/^ACTION:NONE$/mi', $pref)) |
767 | 786 | { |
768 | 787 | $val = ''; |
@@ -896,7 +915,10 @@ discard block |
||
896 | 915 | { |
897 | 916 | Api\Translation::add_app('calendar'); |
898 | 917 | // do not set actions for alarm type |
899 | - if ($params['data']['type'] == 6) return array(); |
|
918 | + if ($params['data']['type'] == 6) |
|
919 | + { |
|
920 | + return array(); |
|
921 | + } |
|
900 | 922 | return array( |
901 | 923 | array( |
902 | 924 | 'id' => 'A', |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | static function search_link($location) |
30 | 30 | { |
31 | - unset($location); // not used, but in function signature for hooks |
|
31 | + unset($location); // not used, but in function signature for hooks |
|
32 | 32 | return array( |
33 | 33 | 'query' => 'calendar.calendar_bo.link_query', |
34 | 34 | 'title' => 'calendar.calendar_bo.link_title', |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | 'add_id' => 'link_id', |
51 | 51 | 'add_popup' => '850x590', |
52 | 52 | 'file_access' => 'calendar.calendar_bo.file_access', |
53 | - 'file_access_user' => true, // file_access supports 4th parameter $user |
|
53 | + 'file_access_user' => true, // file_access supports 4th parameter $user |
|
54 | 54 | 'mime' => array( |
55 | 55 | 'text/calendar' => array( |
56 | 56 | 'menuaction' => 'calendar.calendar_uiforms.edit', |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | static function getAppExportLimit($location) |
83 | 83 | { |
84 | - unset($location); // not used, but in function signature for hooks |
|
84 | + unset($location); // not used, but in function signature for hooks |
|
85 | 85 | return $GLOBALS['egw_info']['server']['calendar_export_limit']; |
86 | 86 | } |
87 | 87 | |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | static function admin() |
92 | 92 | { |
93 | 93 | $file = Array( |
94 | - 'Site Configuration' => Egw::link('/index.php','menuaction=admin.admin_config.index&appname=calendar&ajax=true'), |
|
95 | - 'Custom fields' => Egw::link('/index.php','menuaction=admin.admin_customfields.index&appname=calendar&ajax=true'), |
|
96 | - 'Global Categories' => Egw::link('/index.php','menuaction=admin.admin_categories.index&appname=calendar&ajax=true'), |
|
97 | - 'Category ACL' => Egw::link('/index.php','menuaction=calendar.calendar_uiforms.cat_acl'), |
|
98 | - 'Update timezones' => Egw::link('/index.php','menuaction=calendar.calendar_timezones.update'), |
|
94 | + 'Site Configuration' => Egw::link('/index.php', 'menuaction=admin.admin_config.index&appname=calendar&ajax=true'), |
|
95 | + 'Custom fields' => Egw::link('/index.php', 'menuaction=admin.admin_customfields.index&appname=calendar&ajax=true'), |
|
96 | + 'Global Categories' => Egw::link('/index.php', 'menuaction=admin.admin_categories.index&appname=calendar&ajax=true'), |
|
97 | + 'Category ACL' => Egw::link('/index.php', 'menuaction=calendar.calendar_uiforms.cat_acl'), |
|
98 | + 'Update timezones' => Egw::link('/index.php', 'menuaction=calendar.calendar_timezones.update'), |
|
99 | 99 | ); |
100 | - display_section('calendar','calendar',$file); |
|
100 | + display_section('calendar', 'calendar', $file); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | } |
174 | 174 | for ($i = 2; $i <= 9; ++$i) |
175 | 175 | { |
176 | - $muliple_weeks[$i] = lang('%1 weeks',$i); |
|
176 | + $muliple_weeks[$i] = lang('%1 weeks', $i); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | for ($i = 2; $i <= 20; $i++) |
@@ -210,14 +210,14 @@ discard block |
||
210 | 210 | if (!$hook_data['setup']) // does not work at setup time |
211 | 211 | { |
212 | 212 | $options = array('0' => lang('none')); |
213 | - foreach($GLOBALS['egw']->accounts->search(array('type' => 'owngroups','app' => 'calendar')) as $group) |
|
213 | + foreach ($GLOBALS['egw']->accounts->search(array('type' => 'owngroups', 'app' => 'calendar')) as $group) |
|
214 | 214 | { |
215 | 215 | $options[$group['account_id']] = Api\Accounts::username($group['account_id']); |
216 | 216 | } |
217 | - $freebusy_url = calendar_bo::freebusy_url($GLOBALS['egw_info']['user']['account_lid'],$GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy_pw']); |
|
217 | + $freebusy_url = calendar_bo::freebusy_url($GLOBALS['egw_info']['user']['account_lid'], $GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy_pw']); |
|
218 | 218 | $freebusy_url = '<a href="'.$freebusy_url.'" target="_blank">'.$freebusy_url.'</a>'; |
219 | 219 | $freebusy_help = lang('Should not loged in persons be able to see your freebusy information? You can set an extra password, different from your normal password, to protect this informations. The freebusy information is in iCal format and only include the times when you are busy. It does not include the event-name, description or locations. The URL to your freebusy information is'); |
220 | - $freebusy_help .= ' ' . $freebusy_url; |
|
220 | + $freebusy_help .= ' '.$freebusy_url; |
|
221 | 221 | |
222 | 222 | // Timezone for file exports |
223 | 223 | $export_tzs = array('0' => 'Use Event TZ'); |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | 'admin' => False |
356 | 356 | ), |
357 | 357 | 'default-alarm' => array( |
358 | - 'type' => 'date-duration',//'select', |
|
358 | + 'type' => 'date-duration', //'select', |
|
359 | 359 | 'label' => lang('Default alarm for regular events').' ('.lang('empty = no alarm').')', |
360 | 360 | 'name' => 'default-alarm', |
361 | 361 | 'help' => 'Alarm added automatic to new events before event start-time', |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | 'default' => '', |
365 | 365 | ), |
366 | 366 | 'default-alarm-wholeday' => array( |
367 | - 'type' => 'date-duration',//'select', |
|
367 | + 'type' => 'date-duration', //'select', |
|
368 | 368 | 'label' => lang('Default alarm for whole-day events').' ('.lang('empty = no alarm').')', |
369 | 369 | 'name' => 'default-alarm-wholeday', |
370 | 370 | 'help' => lang('Alarm added automatic to new events before event start-time').' ('.lang('Midnight').')', |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | { |
378 | 378 | $prefs = $GLOBALS['egw_info']['user']['preferences']['calendar']; |
379 | 379 | $data = array( |
380 | - 'prefs' => &$prefs, // use reference to get preference value back |
|
380 | + 'prefs' => &$prefs, // use reference to get preference value back |
|
381 | 381 | 'preprocess' => true, |
382 | 382 | 'type' => 'user', |
383 | 383 | ); |
@@ -619,9 +619,9 @@ discard block |
||
619 | 619 | 'size' => 60, |
620 | 620 | 'label' => 'Default document to insert entries', |
621 | 621 | 'name' => 'default_document', |
622 | - 'help' => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.',lang('calendar')).' '. |
|
623 | - lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','calendar_title').' '. |
|
624 | - lang('The following document-types are supported:'). implode(',',Api\Storage\Merge::get_file_extensions()), |
|
622 | + 'help' => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.', lang('calendar')).' '. |
|
623 | + lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'calendar_title').' '. |
|
624 | + lang('The following document-types are supported:').implode(',', Api\Storage\Merge::get_file_extensions()), |
|
625 | 625 | 'run_lang' => false, |
626 | 626 | 'xmlrpc' => True, |
627 | 627 | 'admin' => False, |
@@ -631,9 +631,9 @@ discard block |
||
631 | 631 | 'size' => 60, |
632 | 632 | 'label' => 'Directory with documents to insert entries', |
633 | 633 | 'name' => 'document_dir', |
634 | - 'help' => lang('If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the data inserted.',lang('calendar')).' '. |
|
635 | - lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','calendar_title').' '. |
|
636 | - lang('The following document-types are supported:'). implode(',',Api\Storage\Merge::get_file_extensions()), |
|
634 | + 'help' => lang('If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the data inserted.', lang('calendar')).' '. |
|
635 | + lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'calendar_title').' '. |
|
636 | + lang('The following document-types are supported:').implode(',', Api\Storage\Merge::get_file_extensions()), |
|
637 | 637 | 'run_lang' => false, |
638 | 638 | 'xmlrpc' => True, |
639 | 639 | 'admin' => False, |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | } |
659 | 659 | catch (Exception $e) |
660 | 660 | { |
661 | - unset($e); // not used |
|
661 | + unset($e); // not used |
|
662 | 662 | // permission error |
663 | 663 | continue; |
664 | 664 | } |
@@ -746,14 +746,14 @@ discard block |
||
746 | 746 | if ($data['type'] != 'user') return; |
747 | 747 | |
748 | 748 | $account_lid = $GLOBALS['egw_info']['user']['account_lid']; |
749 | - foreach(array( |
|
749 | + foreach (array( |
|
750 | 750 | 'default-alarm' => 'default-alarm-vevent-datetime:/'.$account_lid.'/:urn:ietf:params:xml:ns:caldav', |
751 | 751 | 'default-alarm-wholeday' => 'default-alarm-vevent-date:/'.$account_lid.'/:urn:ietf:params:xml:ns:caldav', |
752 | 752 | ) as $name => $dav) |
753 | 753 | { |
754 | - $pref =& $GLOBALS['egw_info']['user']['preferences']['groupdav'][$dav]; |
|
755 | - if (true) $pref = str_replace("\r", '', $pref); // remove CR messing up multiline preg_match |
|
756 | - $val =& $data['prefs'][$name]; |
|
754 | + $pref = & $GLOBALS['egw_info']['user']['preferences']['groupdav'][$dav]; |
|
755 | + if (true) $pref = str_replace("\r", '', $pref); // remove CR messing up multiline preg_match |
|
756 | + $val = & $data['prefs'][$name]; |
|
757 | 757 | |
758 | 758 | //error_log(__METHOD__."() groupdav[$dav]=$pref, calendar[$name]=$val"); |
759 | 759 | |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | 'D' => 1440, |
775 | 775 | ); |
776 | 776 | $factor = $factors[strtoupper($matches[2])]; |
777 | - $val = $factor*(int)$matches[1]; |
|
777 | + $val = $factor * (int)$matches[1]; |
|
778 | 778 | } |
779 | 779 | else |
780 | 780 | { |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | } |
806 | 806 | else |
807 | 807 | { |
808 | - $pref = preg_replace('/^TRIGGER:.*$/m', $trigger.number_format(abs($val)/60, 0).'H', $pref); |
|
808 | + $pref = preg_replace('/^TRIGGER:.*$/m', $trigger.number_format(abs($val) / 60, 0).'H', $pref); |
|
809 | 809 | } |
810 | 810 | $GLOBALS['egw']->preferences->add('groupdav', $dav, $pref, 'user'); |
811 | 811 | //error_log(__METHOD__."() storing $name=$val --> $dav='$pref'"); |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | */ |
867 | 867 | public static function categories($data) |
868 | 868 | { |
869 | - unset($data); // not used, but in function signature for hooks |
|
869 | + unset($data); // not used, but in function signature for hooks |
|
870 | 870 | return true; |
871 | 871 | } |
872 | 872 | |
@@ -877,9 +877,9 @@ discard block |
||
877 | 877 | */ |
878 | 878 | public static function mail_import($args) |
879 | 879 | { |
880 | - unset($args); // not used, but required by function signature |
|
880 | + unset($args); // not used, but required by function signature |
|
881 | 881 | |
882 | - return array ( |
|
882 | + return array( |
|
883 | 883 | 'menuaction' => 'calendar.calendar_uiforms.mail_import', |
884 | 884 | 'popup' => Link::get_registry('calendar', 'edit_popup') |
885 | 885 | ); |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | * @param type $params |
892 | 892 | * @return type |
893 | 893 | */ |
894 | - public static function notifications_actions ($params) |
|
894 | + public static function notifications_actions($params) |
|
895 | 895 | { |
896 | 896 | Api\Translation::add_app('calendar'); |
897 | 897 | // do not set actions for alarm type |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | $async = new Api\Asyncservice(); |
929 | 929 | $async->cancel_timer($id); |
930 | 930 | |
931 | - if((float)$config > 0) |
|
931 | + if ((float)$config > 0) |
|
932 | 932 | { |
933 | 933 | $result = $async->set_timer( |
934 | 934 | array('month' => '*', 'day' => 1), |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | 'calendar.calendar_boupdate.purge', |
937 | 937 | (float)$config |
938 | 938 | ); |
939 | - if(!$result) |
|
939 | + if (!$result) |
|
940 | 940 | { |
941 | 941 | $GLOBALS['config_error'] = 'Unable to schedule purge'; |
942 | 942 | } |
@@ -25,7 +25,11 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function __construct() |
27 | 27 | { |
28 | - if (false) parent::__construct(); // can not be called, but gives IDE warning |
|
28 | + if (false) |
|
29 | + { |
|
30 | + parent::__construct(); |
|
31 | + } |
|
32 | + // can not be called, but gives IDE warning |
|
29 | 33 | |
30 | 34 | $this->datasource('calendar'); |
31 | 35 | |
@@ -94,16 +98,22 @@ discard block |
||
94 | 98 | if (!is_array($this->pm_config)) |
95 | 99 | { |
96 | 100 | $this->pm_config = Api\Config::read('projectmanager'); |
97 | - if (!$this->pm_config['hours_per_workday']) $this->pm_config['hours_per_workday'] = 8; |
|
101 | + if (!$this->pm_config['hours_per_workday']) |
|
102 | + { |
|
103 | + $this->pm_config['hours_per_workday'] = 8; |
|
104 | + } |
|
98 | 105 | } |
99 | 106 | $ds['pe_planned_time'] -= $nights * 60 * (24 - $this->pm_config['hours_per_workday']); |
100 | 107 | } |
101 | 108 | foreach($data['participants'] as $uid => $status) |
102 | 109 | { |
103 | - if ($status != 'R' && is_numeric($uid)) // only users for now |
|
110 | + if ($status != 'R' && is_numeric($uid)) |
|
111 | + { |
|
112 | + // only users for now |
|
104 | 113 | { |
105 | 114 | $ds['pe_resources'][] = $uid; |
106 | 115 | } |
116 | + } |
|
107 | 117 | } |
108 | 118 | // if we have multiple participants we have to multiply the time by the number of participants to get the total time |
109 | 119 | $ds['pe_planned_time'] *= count($ds['pe_resources']); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | function __construct() |
28 | 28 | { |
29 | - if (false) parent::__construct(); // can not be called, but gives IDE warning |
|
29 | + if (false) parent::__construct(); // can not be called, but gives IDE warning |
|
30 | 30 | |
31 | 31 | $this->datasource('calendar'); |
32 | 32 | |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | |
51 | 51 | if (!is_array($data_id)) |
52 | 52 | { |
53 | - if (!(int) $data_id || !($data = $cal->read((int) $data_id))) |
|
53 | + if (!(int)$data_id || !($data = $cal->read((int)$data_id))) |
|
54 | 54 | { |
55 | 55 | return false; |
56 | 56 | } |
57 | 57 | } |
58 | 58 | else |
59 | 59 | { |
60 | - $data =& $data_id; |
|
60 | + $data = & $data_id; |
|
61 | 61 | } |
62 | 62 | $ds = array( |
63 | 63 | 'pe_title' => $cal->link_title($data), |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | 'pe_details' => $data['description'] ? nl2br($data['description']) : '', |
68 | 68 | ); |
69 | 69 | // return first global category, as PM only supports one |
70 | - foreach($data['category'] ? explode(',', $data['category']) : array() as $cat_id) |
|
70 | + foreach ($data['category'] ? explode(',', $data['category']) : array() as $cat_id) |
|
71 | 71 | { |
72 | 72 | if (Api\Categories::is_global($cat_id)) |
73 | 73 | { |
@@ -76,13 +76,13 @@ discard block |
||
76 | 76 | } |
77 | 77 | } |
78 | 78 | // calculation of the time |
79 | - $ds['pe_planned_time'] = (int) (($ds['pe_planned_end'] - $ds['pe_planned_start'])/60); // time is in minutes |
|
79 | + $ds['pe_planned_time'] = (int)(($ds['pe_planned_end'] - $ds['pe_planned_start']) / 60); // time is in minutes |
|
80 | 80 | |
81 | 81 | // if the event spans multiple days, we have to substract the nights (24h - daily working time specified in PM) |
82 | - if (($ds['pe_planned_time']/ 60 > 24) && date('Y-m-d',$ds['pe_planned_end']) != date('Y-m-d',$ds['pe_planned_start'])) |
|
82 | + if (($ds['pe_planned_time'] / 60 > 24) && date('Y-m-d', $ds['pe_planned_end']) != date('Y-m-d', $ds['pe_planned_start'])) |
|
83 | 83 | { |
84 | 84 | $start = $end = null; |
85 | - foreach(array('start','end') as $name) |
|
85 | + foreach (array('start', 'end') as $name) |
|
86 | 86 | { |
87 | 87 | $arr = $cal->date2array($ds['pe_planned_'.$name]); |
88 | 88 | $arr['hour'] = 12; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | $ds['pe_planned_time'] -= $nights * 60 * (24 - $this->pm_config['hours_per_workday']); |
101 | 101 | } |
102 | - foreach($data['participants'] as $uid => $status) |
|
102 | + foreach ($data['participants'] as $uid => $status) |
|
103 | 103 | { |
104 | 104 | if ($status != 'R' && is_numeric($uid)) // only users for now |
105 | 105 | { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | function delete($id) |
135 | 135 | { |
136 | 136 | // dont delete entries which are linked to elements other than their project |
137 | - if (count(Link::get_links('calendar',$id)) > 1) |
|
137 | + if (count(Link::get_links('calendar', $id)) > 1) |
|
138 | 138 | { |
139 | 139 | return false; |
140 | 140 | } |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | * @param string $status |
150 | 150 | * @return boolean true if status changed, false otherwise |
151 | 151 | */ |
152 | - function change_status($id,$status) |
|
152 | + function change_status($id, $status) |
|
153 | 153 | { |
154 | 154 | $bo = new calendar_boupdate(); |
155 | 155 | if (($entry = $bo->read($id)) && ( |
156 | - $bo->check_perms(Acl::EDIT,$entry) |
|
156 | + $bo->check_perms(Acl::EDIT, $entry) |
|
157 | 157 | )) |
158 | 158 | { |
159 | 159 | // Restore from deleted |