@@ -14,7 +14,10 @@ |
||
| 14 | 14 | |
| 15 | 15 | use EGroupware\Api\Asyncservice; |
| 16 | 16 | |
| 17 | -if (!isset($_REQUEST['domain'])) $_REQUEST['domain'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 'default'; |
|
| 17 | +if (!isset($_REQUEST['domain'])) |
|
| 18 | +{ |
|
| 19 | + $_REQUEST['domain'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 'default'; |
|
| 20 | +} |
|
| 18 | 21 | $path_to_egroupware = realpath(__DIR__.'/..'); // need to be adapted if this script is moved somewhere else |
| 19 | 22 | |
| 20 | 23 | // remove the comment from one of the following lines to enable loging |
@@ -48,7 +48,10 @@ |
||
| 48 | 48 | exit; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | -if (empty($_GET['debug'])) $content = 'egw.set_images('.$content.", egw && egw.window !== window);\n"; |
|
| 51 | +if (empty($_GET['debug'])) |
|
| 52 | +{ |
|
| 53 | + $content = 'egw.set_images('.$content.", egw && egw.window !== window);\n"; |
|
| 54 | +} |
|
| 52 | 55 | |
| 53 | 56 | // we run our own gzip compression, to set a correct Content-Length of the encoded content |
| 54 | 57 | if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
@@ -80,7 +80,10 @@ discard block |
||
| 80 | 80 | private function parse_file($file) |
| 81 | 81 | { |
| 82 | 82 | // file is from url and can contain query-params, eg. /phpgwapi/inc/jscalendar-setup.php?dateformat=d.m.Y&lang=de |
| 83 | - if (strpos($file,'?') !== false) list($file) = explode('?',$file); |
|
| 83 | + if (strpos($file,'?') !== false) |
|
| 84 | + { |
|
| 85 | + list($file) = explode('?',$file); |
|
| 86 | + } |
|
| 84 | 87 | |
| 85 | 88 | // Mark the file as parsed |
| 86 | 89 | $this->parsed_files[$file] = true; |
@@ -326,12 +329,15 @@ discard block |
||
| 326 | 329 | } |
| 327 | 330 | } |
| 328 | 331 | |
| 329 | - if (self::$DEBUG_MODE) // DEBUG_MODE is currently ALWAYS true. Comment this code out if you don't want error messages. |
|
| 332 | + if (self::$DEBUG_MODE) |
|
| 333 | + { |
|
| 334 | + // DEBUG_MODE is currently ALWAYS true. Comment this code out if you don't want error messages. |
|
| 330 | 335 | { |
| 331 | 336 | //error_log(__METHOD__."($package,$file,$app) $path NOT found".($this->debug_processing_file ? " while processing file '{$this->debug_processing_file}'." : "!").' '.function_backtrace()); |
| 332 | 337 | } |
| 333 | 338 | |
| 334 | 339 | return false; |
| 340 | + } |
|
| 335 | 341 | } |
| 336 | 342 | |
| 337 | 343 | /** |
@@ -377,7 +383,10 @@ discard block |
||
| 377 | 383 | */ |
| 378 | 384 | public function include_files(array $files, $clear_files=false) |
| 379 | 385 | { |
| 380 | - if ($clear_files) $this->included_files = array(); |
|
| 386 | + if ($clear_files) |
|
| 387 | + { |
|
| 388 | + $this->included_files = array(); |
|
| 389 | + } |
|
| 381 | 390 | |
| 382 | 391 | foreach ($files as $file) |
| 383 | 392 | { |
@@ -394,7 +403,10 @@ discard block |
||
| 394 | 403 | public function get_included_files($clear_files=false) |
| 395 | 404 | { |
| 396 | 405 | $ret = array_keys($this->included_files); |
| 397 | - if ($clear_files) $this->included_files = array(); |
|
| 406 | + if ($clear_files) |
|
| 407 | + { |
|
| 408 | + $this->included_files = array(); |
|
| 409 | + } |
|
| 398 | 410 | return $ret; |
| 399 | 411 | } |
| 400 | 412 | |
@@ -547,7 +547,10 @@ |
||
| 547 | 547 | |
| 548 | 548 | function check_debug() |
| 549 | 549 | { |
| 550 | - if (!$this->debug) return False; |
|
| 550 | + if (!$this->debug) |
|
| 551 | + { |
|
| 552 | + return False; |
|
| 553 | + } |
|
| 551 | 554 | |
| 552 | 555 | foreach(func_get_args() as $arg) |
| 553 | 556 | { |
@@ -161,7 +161,11 @@ |
||
| 161 | 161 | { |
| 162 | 162 | if(strpos($pref_name, $pref_prefix) === 0) |
| 163 | 163 | { |
| 164 | - if(!is_array($pref)) continue; // old favorite |
|
| 164 | + if(!is_array($pref)) |
|
| 165 | + { |
|
| 166 | + continue; |
|
| 167 | + } |
|
| 168 | + // old favorite |
|
| 165 | 169 | |
| 166 | 170 | $favorites[(string)substr($pref_name,strlen($pref_prefix))] = $pref; |
| 167 | 171 | } |
@@ -107,14 +107,20 @@ |
||
| 107 | 107 | $max_modified = 0; |
| 108 | 108 | //no more dynamic minifying: $debug_minify = $GLOBALS['egw_info']['server']['debug_minify'] === 'True'; |
| 109 | 109 | $base_path = $GLOBALS['egw_info']['server']['webserver_url']; |
| 110 | - if ($base_path[0] != '/') $base_path = parse_url($base_path, PHP_URL_PATH); |
|
| 110 | + if ($base_path[0] != '/') |
|
| 111 | + { |
|
| 112 | + $base_path = parse_url($base_path, PHP_URL_PATH); |
|
| 113 | + } |
|
| 111 | 114 | $css_files = ''; |
| 112 | 115 | foreach(self::$files as $path) |
| 113 | 116 | { |
| 114 | 117 | foreach(self::resolve_css_includes($path) as $path) |
| 115 | 118 | { |
| 116 | 119 | list($file,$query) = explode('?',$path,2); |
| 117 | - if (($mod = filemtime(EGW_SERVER_ROOT.$file)) > $max_modified) $max_modified = $mod; |
|
| 120 | + if (($mod = filemtime(EGW_SERVER_ROOT.$file)) > $max_modified) |
|
| 121 | + { |
|
| 122 | + $max_modified = $mod; |
|
| 123 | + } |
|
| 118 | 124 | |
| 119 | 125 | // do NOT include app.css or categories.php, as it changes from app to app |
| 120 | 126 | //no more dynamic minifying: if ($debug_minify || substr($path, -8) == '/app.css' || substr($file,-14) == 'categories.php') |
@@ -65,7 +65,10 @@ discard block |
||
| 65 | 65 | foreach (array_keys($tutorials) as $app) |
| 66 | 66 | { |
| 67 | 67 | // show only apps user has access to them |
| 68 | - if (in_array($app, array_keys($GLOBALS['egw_info']['user']['apps']))) $apps [$app] = $app; |
|
| 68 | + if (in_array($app, array_keys($GLOBALS['egw_info']['user']['apps']))) |
|
| 69 | + { |
|
| 70 | + $apps [$app] = $app; |
|
| 71 | + } |
|
| 69 | 72 | } |
| 70 | 73 | $sel_options = array( |
| 71 | 74 | 'apps' => $apps, |
@@ -122,7 +125,10 @@ discard block |
||
| 122 | 125 | { |
| 123 | 126 | $json = file_get_contents('http://www.egroupware.de/videos/tutorials.json'); |
| 124 | 127 | // Fallback tutorials.json |
| 125 | - if (!$json) $json = file_get_contents('api/setup/tutorials.json'); |
|
| 128 | + if (!$json) |
|
| 129 | + { |
|
| 130 | + $json = file_get_contents('api/setup/tutorials.json'); |
|
| 131 | + } |
|
| 126 | 132 | // Cache the json object for two hours |
| 127 | 133 | Api\Cache::setCache(Api\Cache::TREE, __CLASS__, 'egw_tutorial_json', $json, 7200); |
| 128 | 134 | } |
@@ -136,10 +142,16 @@ discard block |
||
| 136 | 142 | */ |
| 137 | 143 | public static function tutorial_menu() |
| 138 | 144 | { |
| 139 | - if (Api\Header\UserAgent::mobile()) return; |
|
| 145 | + if (Api\Header\UserAgent::mobile()) |
|
| 146 | + { |
|
| 147 | + return; |
|
| 148 | + } |
|
| 140 | 149 | $tutorials = json_decode(self::getJsonData(),true); |
| 141 | 150 | $appname = $GLOBALS['egw_info']['flags']['currentapp']; |
| 142 | - if (!is_array($tutorials[$appname])) return false; |
|
| 151 | + if (!is_array($tutorials[$appname])) |
|
| 152 | + { |
|
| 153 | + return false; |
|
| 154 | + } |
|
| 143 | 155 | if (!$GLOBALS['egw_info']['server']['egw_tutorial_disable'] |
| 144 | 156 | || $GLOBALS['egw_info']['server']['egw_tutorial_disable'] == 'intro') |
| 145 | 157 | { |
@@ -168,7 +168,11 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | - if (!isset($setup_info[$app]) || !is_array($setup_info[$app])) return null; // app got eg. removed in filesystem |
|
| 171 | + if (!isset($setup_info[$app]) || !is_array($setup_info[$app])) |
|
| 172 | + { |
|
| 173 | + return null; |
|
| 174 | + } |
|
| 175 | + // app got eg. removed in filesystem |
|
| 172 | 176 | |
| 173 | 177 | $app_info = array_merge($GLOBALS['egw_info']['apps'][$app], $setup_info[$app]); |
| 174 | 178 | |
@@ -191,7 +195,10 @@ discard block |
||
| 191 | 195 | { |
| 192 | 196 | $ret['author'] = $this->_getHtmlPersonalInfo($setup_info[$app], 'author'); |
| 193 | 197 | $ret['maintainer'] = $this->_getHtmlPersonalInfo($setup_info[$app], 'maintainer'); |
| 194 | - if ($app_info['version'] != $setup_info[$app]['version']) $ret['version'] .= ' ('.$setup_info[$app]['version'].')'; |
|
| 198 | + if ($app_info['version'] != $setup_info[$app]['version']) |
|
| 199 | + { |
|
| 200 | + $ret['version'] .= ' ('.$setup_info[$app]['version'].')'; |
|
| 201 | + } |
|
| 195 | 202 | $ret['license'] = $setup_info[$app]['license']; |
| 196 | 203 | $ret['description'] = $setup_info[$app]['description']; |
| 197 | 204 | $ret['note'] = $setup_info[$app]['note']; |
@@ -216,39 +223,54 @@ discard block |
||
| 216 | 223 | { |
| 217 | 224 | $authors = array(); |
| 218 | 225 | // get the author(s) |
| 219 | - if ($setup_info[$f]) { |
|
| 226 | + if ($setup_info[$f]) |
|
| 227 | + { |
|
| 220 | 228 | // author is set |
| 221 | - if (!is_array($setup_info[$f])) { |
|
| 229 | + if (!is_array($setup_info[$f])) |
|
| 230 | + { |
|
| 222 | 231 | // author is no array |
| 223 | 232 | $authors[0]['name'] = $setup_info[$f]; |
| 224 | - if ($setup_info[$f.'_email']) { |
|
| 233 | + if ($setup_info[$f.'_email']) |
|
| 234 | + { |
|
| 225 | 235 | $authors[0]['email'] = $setup_info[$f.'_email']; |
| 226 | 236 | } |
| 227 | - if ($setup_info[$f.'_url']) { |
|
| 237 | + if ($setup_info[$f.'_url']) |
|
| 238 | + { |
|
| 228 | 239 | $authors[0]['url'] = $setup_info[$f.'_url']; |
| 229 | 240 | } |
| 230 | 241 | |
| 231 | - } else { |
|
| 242 | + } |
|
| 243 | + else |
|
| 244 | + { |
|
| 232 | 245 | // author is array |
| 233 | - if ($setup_info[$f]['name']) { |
|
| 246 | + if ($setup_info[$f]['name']) |
|
| 247 | + { |
|
| 234 | 248 | // only one author |
| 235 | 249 | $authors[0]['name'] = $setup_info[$f]['name']; |
| 236 | - if ($setup_info[$f]['email']) { |
|
| 250 | + if ($setup_info[$f]['email']) |
|
| 251 | + { |
|
| 237 | 252 | $authors[0]['email'] = $setup_info[$f]['email']; |
| 238 | 253 | } |
| 239 | - if ($setup_info[$f]['url']) { |
|
| 254 | + if ($setup_info[$f]['url']) |
|
| 255 | + { |
|
| 240 | 256 | $authors[0]['url'] = $setup_info[$f]['url']; |
| 241 | 257 | } |
| 242 | - } else { |
|
| 258 | + } |
|
| 259 | + else |
|
| 260 | + { |
|
| 243 | 261 | // may be more authors |
| 244 | - foreach (array_keys($setup_info[$f]) as $number) { |
|
| 245 | - if ($setup_info[$f][$number]['name']) { |
|
| 262 | + foreach (array_keys($setup_info[$f]) as $number) |
|
| 263 | + { |
|
| 264 | + if ($setup_info[$f][$number]['name']) |
|
| 265 | + { |
|
| 246 | 266 | $authors[$number]['name'] = $setup_info[$f][$number]['name']; |
| 247 | 267 | } |
| 248 | - if ($setup_info[$f][$number]['email']) { |
|
| 268 | + if ($setup_info[$f][$number]['email']) |
|
| 269 | + { |
|
| 249 | 270 | $authors[$number]['email'] = $setup_info[$f][$number]['email']; |
| 250 | 271 | } |
| 251 | - if ($setup_info[$f][$number]['url']) { |
|
| 272 | + if ($setup_info[$f][$number]['url']) |
|
| 273 | + { |
|
| 252 | 274 | $authors[$number]['url'] = $setup_info[$f][$number]['url']; |
| 253 | 275 | } |
| 254 | 276 | } |
@@ -258,15 +280,19 @@ discard block |
||
| 258 | 280 | |
| 259 | 281 | // html format authors |
| 260 | 282 | $s = ''; |
| 261 | - foreach ($authors as $author) { |
|
| 262 | - if ($s != '') { |
|
| 283 | + foreach ($authors as $author) |
|
| 284 | + { |
|
| 285 | + if ($s != '') |
|
| 286 | + { |
|
| 263 | 287 | $s .= '<br />'; |
| 264 | 288 | } |
| 265 | 289 | $s .= lang('name').': '.$author['name']; |
| 266 | - if ($author['email']) { |
|
| 290 | + if ($author['email']) |
|
| 291 | + { |
|
| 267 | 292 | $s .= '<br />'.lang('email').': <a href="mailto:'.$author['email'].'">'.$author['email'].'</a>'; |
| 268 | 293 | } |
| 269 | - if ($author['url']) { |
|
| 294 | + if ($author['url']) |
|
| 295 | + { |
|
| 270 | 296 | $s .= '<br />'.lang('url').': <a href="'.$author['url'].'" target="_blank">'.$author['url'].'</a>'; |
| 271 | 297 | } |
| 272 | 298 | } |
@@ -300,8 +326,14 @@ discard block |
||
| 300 | 326 | |
| 301 | 327 | if (isset(self::$knownLicenses[strtoupper($name)])) |
| 302 | 328 | { |
| 303 | - if (empty($url)) $url = self::$knownLicenses[$name=strtoupper($name)][0]; |
|
| 304 | - if (empty($title)) $title = self::$knownLicenses[$name=strtoupper($name)][1]; |
|
| 329 | + if (empty($url)) |
|
| 330 | + { |
|
| 331 | + $url = self::$knownLicenses[$name=strtoupper($name)][0]; |
|
| 332 | + } |
|
| 333 | + if (empty($title)) |
|
| 334 | + { |
|
| 335 | + $title = self::$knownLicenses[$name=strtoupper($name)][1]; |
|
| 336 | + } |
|
| 305 | 337 | } |
| 306 | 338 | |
| 307 | 339 | return array( |
@@ -74,7 +74,11 @@ discard block |
||
| 74 | 74 | $query = null; |
| 75 | 75 | foreach($js_includes as $file) |
| 76 | 76 | { |
| 77 | - if ($file == '/api/js/jsapi/egw.js') continue; // loaded via own tag, and we must not load it twice! |
|
| 77 | + if ($file == '/api/js/jsapi/egw.js') |
|
| 78 | + { |
|
| 79 | + continue; |
|
| 80 | + } |
|
| 81 | + // loaded via own tag, and we must not load it twice! |
|
| 78 | 82 | |
| 79 | 83 | if (!isset($to_include[$file])) |
| 80 | 84 | { |
@@ -133,17 +137,27 @@ discard block |
||
| 133 | 137 | { |
| 134 | 138 | $debug_minify = $GLOBALS['egw_info']['server']['debug_minify'] === 'True'; |
| 135 | 139 | // ignore not existing minurl |
| 136 | - if (!empty($minurl) && !file_exists(EGW_SERVER_ROOT.$minurl)) $minurl = null; |
|
| 140 | + if (!empty($minurl) && !file_exists(EGW_SERVER_ROOT.$minurl)) |
|
| 141 | + { |
|
| 142 | + $minurl = null; |
|
| 143 | + } |
|
| 137 | 144 | $to_include_first = $to_include = $to_minify = array(); |
| 138 | 145 | $max_modified = 0; |
| 139 | 146 | $query = null; |
| 140 | 147 | foreach($js_includes as $path) |
| 141 | 148 | { |
| 142 | - if ($path == '/api/js/jsapi/egw.js') continue; // Leave egw.js out of bundle |
|
| 149 | + if ($path == '/api/js/jsapi/egw.js') |
|
| 150 | + { |
|
| 151 | + continue; |
|
| 152 | + } |
|
| 153 | + // Leave egw.js out of bundle |
|
| 143 | 154 | unset($query); |
| 144 | 155 | list($path,$query) = explode('?',$path,2); |
| 145 | 156 | $mod = filemtime(EGW_SERVER_ROOT.$path); |
| 146 | - if ($mod > $max_modified) $max_modified = $mod; |
|
| 157 | + if ($mod > $max_modified) |
|
| 158 | + { |
|
| 159 | + $max_modified = $mod; |
|
| 160 | + } |
|
| 147 | 161 | |
| 148 | 162 | // ckeditor must be included before bundled files, as they depend on it! |
| 149 | 163 | if (strpos($path,'/ckeditor/ckeditor.js') !== false) |
@@ -182,7 +196,10 @@ discard block |
||
| 182 | 196 | // need to include minified javascript before not minified stuff like jscalendar-setup, as it might depend on it |
| 183 | 197 | array_unshift($to_include, $path); |
| 184 | 198 | } |
| 185 | - if ($to_include_first) $to_include = array_merge($to_include_first, $to_include); |
|
| 199 | + if ($to_include_first) |
|
| 200 | + { |
|
| 201 | + $to_include = array_merge($to_include_first, $to_include); |
|
| 202 | + } |
|
| 186 | 203 | //error_log(__METHOD__."("./*array2string($js_includes).*/", $max_modified, $minurl) returning ".array2string($to_include)); |
| 187 | 204 | return $to_include; |
| 188 | 205 | } |