@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | use EGroupware\Api\Asyncservice; |
16 | 16 | |
17 | 17 | if (!isset($_REQUEST['domain'])) $_REQUEST['domain'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 'default'; |
18 | -$path_to_egroupware = realpath(__DIR__.'/..'); // need to be adapted if this script is moved somewhere else |
|
18 | +$path_to_egroupware = realpath(__DIR__.'/..'); // need to be adapted if this script is moved somewhere else |
|
19 | 19 | |
20 | 20 | // remove the comment from one of the following lines to enable loging |
21 | 21 | // define('ASYNC_LOG','C:\\async.log'); // Windows |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | if (defined('ASYNC_LOG')) |
26 | 26 | { |
27 | 27 | $msg = date('Y/m/d H:i:s ').$_REQUEST['domain'].": asyncservice started\n"; |
28 | - $f = fopen(ASYNC_LOG,'a+'); |
|
29 | - fwrite($f,$msg); |
|
28 | + $f = fopen(ASYNC_LOG, 'a+'); |
|
29 | + fwrite($f, $msg); |
|
30 | 30 | fclose($f); |
31 | 31 | } |
32 | 32 | $GLOBALS['egw_info']['flags'] = array( |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | } |
44 | 44 | if (defined('ASYNC_LOG')) |
45 | 45 | { |
46 | - $f = fopen(ASYNC_LOG,'a+'); |
|
47 | - fwrite($f,$msg); |
|
46 | + $f = fopen(ASYNC_LOG, 'a+'); |
|
47 | + fwrite($f, $msg); |
|
48 | 48 | fclose($f); |
49 | 49 | } |
50 | 50 | die($msg); |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | } |
64 | 64 | if (defined('ASYNC_LOG')) |
65 | 65 | { |
66 | - $f = fopen(ASYNC_LOG,'a+'); |
|
67 | - fwrite($f,$msg); |
|
66 | + $f = fopen(ASYNC_LOG, 'a+'); |
|
67 | + fwrite($f, $msg); |
|
68 | 68 | fclose($f); |
69 | 69 | } |
70 | 70 | die($msg); |
@@ -75,8 +75,7 @@ discard block |
||
75 | 75 | $async = new Asyncservice(); |
76 | 76 | $num = $async->check_run(isset($_REQUEST['run_by']) ? $_REQUEST['run_by'] : 'crontab'); |
77 | 77 | |
78 | -$msg = date('Y/m/d H:i:s ').$_REQUEST['domain'].': '.($num === false ? 'An error occured: can not obtain semaphore!' : |
|
79 | - ($num ? "$num job(s) executed" : 'Nothing to execute'))."\n\n"; |
|
78 | +$msg = date('Y/m/d H:i:s ').$_REQUEST['domain'].': '.($num === false ? 'An error occured: can not obtain semaphore!' : ($num ? "$num job(s) executed" : 'Nothing to execute'))."\n\n"; |
|
80 | 79 | |
81 | 80 | if (isset($_SERVER['HTTP_HOST'])) |
82 | 81 | { |
@@ -87,7 +86,7 @@ discard block |
||
87 | 86 | |
88 | 87 | if (defined('ASYNC_LOG')) |
89 | 88 | { |
90 | - $f = fopen(ASYNC_LOG,'a+'); |
|
91 | - fwrite($f,$msg); |
|
89 | + $f = fopen(ASYNC_LOG, 'a+'); |
|
90 | + fwrite($f, $msg); |
|
92 | 91 | fclose($f); |
93 | 92 | } |
@@ -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 |
@@ -28,17 +28,17 @@ discard block |
||
28 | 28 | |
29 | 29 | include '../header.inc.php'; |
30 | 30 | |
31 | -$content = json_encode(Api\Image::map(preg_match('/^[a-z0-9_-]+$/i',$_GET['template']) ? $_GET['template'] : null, $_GET['svg']), |
|
32 | - JSON_FORCE_OBJECT | // export empty php-arrays as empty objects, not empty arrays |
|
33 | - JSON_UNESCAPED_SLASHES | // do not escape slashes, smaller and better readable |
|
31 | +$content = json_encode(Api\Image::map(preg_match('/^[a-z0-9_-]+$/i', $_GET['template']) ? $_GET['template'] : null, $_GET['svg']), |
|
32 | + JSON_FORCE_OBJECT|// export empty php-arrays as empty objects, not empty arrays |
|
33 | + JSON_UNESCAPED_SLASHES|// do not escape slashes, smaller and better readable |
|
34 | 34 | (!empty($_GET['debug']) ? JSON_PRETTY_PRINT : 0)); |
35 | 35 | |
36 | 36 | // use an etag over the image mapp |
37 | 37 | $etag = '"'.md5($content).'"'; |
38 | 38 | |
39 | 39 | // headers to allow caching, egw_framework specifies etag on url to force reload, even with Expires header |
40 | -Api\Session::cache_control(86400); // cache for one day |
|
41 | -Header('Content-Type: '.(empty($_GET['debug'])?'text/javascript':'application/json').'; charset=utf-8'); |
|
40 | +Api\Session::cache_control(86400); // cache for one day |
|
41 | +Header('Content-Type: '.(empty($_GET['debug']) ? 'text/javascript' : 'application/json').'; charset=utf-8'); |
|
42 | 42 | Header('ETag: '.$etag); |
43 | 43 | |
44 | 44 | // if servers send a If-None-Match header, response with 304 Not Modified, if etag matches |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | if (empty($_GET['debug'])) $content = 'egw.set_images('.$content.", egw && egw.window !== window);\n"; |
52 | 52 | |
53 | 53 | // we run our own gzip compression, to set a correct Content-Length of the encoded content |
54 | -if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
|
54 | +if (in_array('gzip', explode(',', $_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
|
55 | 55 | { |
56 | 56 | $content = gzencode($content); |
57 | 57 | header('Content-Encoding: gzip'); |
@@ -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,7 @@ 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) list($file) = explode('?', $file); |
|
84 | 84 | |
85 | 85 | // Mark the file as parsed |
86 | 86 | $this->parsed_files[$file] = true; |
@@ -284,17 +284,17 @@ discard block |
||
284 | 284 | * @returns the correct path on the server if the file is found or false, if the |
285 | 285 | * file is not found or no further processing is needed. |
286 | 286 | */ |
287 | - private function translate_params($package, $file=null, $app='api') |
|
287 | + private function translate_params($package, $file = null, $app = 'api') |
|
288 | 288 | { |
289 | 289 | if ($package[0] == '/' && is_readable(EGW_SERVER_ROOT.parse_url($path = $package, PHP_URL_PATH)) || |
290 | 290 | // fix old /phpgwapi/js/ path by replacing it with /api/js/ |
291 | 291 | substr($package, 0, 13) == '/phpgwapi/js/' && is_readable(EGW_SERVER_ROOT.parse_url($path = str_replace('/phpgwapi/js/', '/api/js/', $package), PHP_URL_PATH)) || |
292 | 292 | $package[0] == '/' && is_readable(EGW_SERVER_ROOT.($path = $package)) || |
293 | - $package == '.' && is_readable(EGW_SERVER_ROOT.($path="/$app/js/$file.js")) || |
|
294 | - is_readable(EGW_SERVER_ROOT.($path="/$app/js/$package/$file.js")) || |
|
293 | + $package == '.' && is_readable(EGW_SERVER_ROOT.($path = "/$app/js/$file.js")) || |
|
294 | + is_readable(EGW_SERVER_ROOT.($path = "/$app/js/$package/$file.js")) || |
|
295 | 295 | // fix not found by using app='api' |
296 | - $app != 'api' && is_readable(EGW_SERVER_ROOT.($path="/api/js/$package/$file.js")) || |
|
297 | - $app != 'phpgwapi' && is_readable(EGW_SERVER_ROOT.($path="/phpgwapi/js/$package/$file.js"))) |
|
296 | + $app != 'api' && is_readable(EGW_SERVER_ROOT.($path = "/api/js/$package/$file.js")) || |
|
297 | + $app != 'phpgwapi' && is_readable(EGW_SERVER_ROOT.($path = "/phpgwapi/js/$package/$file.js"))) |
|
298 | 298 | { |
299 | 299 | // normalise /./ to / |
300 | 300 | $path = str_replace('/./', '/', $path); |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | // adding the ctime to all js files... |
306 | 306 | if (is_array($file)) |
307 | 307 | { |
308 | - foreach($file as $name => $val) |
|
308 | + foreach ($file as $name => $val) |
|
309 | 309 | { |
310 | 310 | $args .= (empty($args) ? '?' : '&').$name.'='.urlencode($val); |
311 | 311 | } |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | * @param array $files |
376 | 376 | * @param boolean $clear_files =false if true clear list of files, before including given ones |
377 | 377 | */ |
378 | - public function include_files(array $files, $clear_files=false) |
|
378 | + public function include_files(array $files, $clear_files = false) |
|
379 | 379 | { |
380 | 380 | if ($clear_files) $this->included_files = array(); |
381 | 381 | |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | * @param boolean $clear_files =false if true clear list of files after returning them |
392 | 392 | * @return array |
393 | 393 | */ |
394 | - public function get_included_files($clear_files=false) |
|
394 | + public function get_included_files($clear_files = false) |
|
395 | 395 | { |
396 | 396 | $ret = array_keys($this->included_files); |
397 | 397 | if ($clear_files) $this->included_files = array(); |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | |
425 | 425 | $paths = !empty($_GET['path']) ? (array)$_GET['path'] : (array)'/stylite/js/filemanager/filemanager.js'; |
426 | 426 | |
427 | - foreach($paths as $path) |
|
427 | + foreach ($paths as $path) |
|
428 | 428 | { |
429 | 429 | echo "\t<h1>".htmlspecialchars($path)."</h1>\n"; |
430 | 430 | $mgr->include_js_file($path); |
@@ -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 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @param array $content |
34 | 34 | */ |
35 | - function popup ($content=null) |
|
35 | + function popup($content = null) |
|
36 | 36 | { |
37 | 37 | // check and if not done register tutorial_menu hook |
38 | 38 | if (!Api\Hooks::exists('sidebox_all', 'api') || |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | if (!is_array($content)) |
49 | 49 | { |
50 | 50 | // Get tutorial object id |
51 | - $tuid_indx = explode('-',$_GET['tuid']); |
|
51 | + $tuid_indx = explode('-', $_GET['tuid']); |
|
52 | 52 | $appName = $tuid_indx[0]; |
53 | 53 | $lang = $tuid_indx[1]; |
54 | 54 | $id = $tuid_indx[2]; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | { |
58 | 58 | $appName = $content['list']['apps']; |
59 | 59 | $lang = $GLOBALS['egw_info']['user']['preferences']['common']['lang']; |
60 | - $id ="0"; |
|
60 | + $id = "0"; |
|
61 | 61 | } |
62 | 62 | // read tutorials json file to fetch data |
63 | 63 | $tutorials = json_decode(self::getJsonData(), true); |
@@ -74,8 +74,7 @@ discard block |
||
74 | 74 | if (in_array($appName, array_keys($GLOBALS['egw_info']['user']['apps'])) || $appName === "introduction") |
75 | 75 | { |
76 | 76 | // fallback to english video |
77 | - $tutorial = $tutorials[$appName][$lang][$id]? $tutorials[$appName][$lang][$id]: |
|
78 | - $tutorials[$appName]['en'][$id]; |
|
77 | + $tutorial = $tutorials[$appName][$lang][$id] ? $tutorials[$appName][$lang][$id] : $tutorials[$appName]['en'][$id]; |
|
79 | 78 | |
80 | 79 | $list = array( |
81 | 80 | 'apps' => $appName, |
@@ -86,7 +85,7 @@ discard block |
||
86 | 85 | $v ['onclick'] = 'app[egw.app_name()].tutorial_videoOnClick("'.$v['src'].'")'; |
87 | 86 | array_push($list, $v); |
88 | 87 | } |
89 | - $content = array ( |
|
88 | + $content = array( |
|
90 | 89 | 'src' => $tutorial['src'], |
91 | 90 | 'title' => $tutorial['title'], |
92 | 91 | 'desc' => $tutorial['desc'], |
@@ -137,13 +136,13 @@ discard block |
||
137 | 136 | public static function tutorial_menu() |
138 | 137 | { |
139 | 138 | if (Api\Header\UserAgent::mobile()) return; |
140 | - $tutorials = json_decode(self::getJsonData(),true); |
|
139 | + $tutorials = json_decode(self::getJsonData(), true); |
|
141 | 140 | $appname = $GLOBALS['egw_info']['flags']['currentapp']; |
142 | 141 | if (!is_array($tutorials[$appname])) return false; |
143 | 142 | if (!$GLOBALS['egw_info']['server']['egw_tutorial_disable'] |
144 | 143 | || $GLOBALS['egw_info']['server']['egw_tutorial_disable'] == 'intro') |
145 | 144 | { |
146 | - $file = Array ( |
|
145 | + $file = Array( |
|
147 | 146 | array( |
148 | 147 | 'text' => '<div id="egw_tutorial_'.$appname.'_sidebox" class="egwTutorial"/>', |
149 | 148 | 'no_lang' => true, |
@@ -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 | { |
@@ -143,7 +143,7 @@ |
||
143 | 143 | if (!$GLOBALS['egw_info']['server']['egw_tutorial_disable'] |
144 | 144 | || $GLOBALS['egw_info']['server']['egw_tutorial_disable'] == 'intro') |
145 | 145 | { |
146 | - $file = Array ( |
|
146 | + $file = array ( |
|
147 | 147 | array( |
148 | 148 | 'text' => '<div id="egw_tutorial_'.$appname.'_sidebox" class="egwTutorial"/>', |
149 | 149 | 'no_lang' => true, |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | function index() |
71 | 71 | { |
72 | - $text_content = str_replace('GPLLINK',self::$knownLicenses['GPL'][0],' |
|
72 | + $text_content = str_replace('GPLLINK', self::$knownLicenses['GPL'][0], ' |
|
73 | 73 | <p><b>EGroupware is a <a href="GPLLINK" title="read more about open source and the GPL" target="_blank">free</a> |
74 | 74 | enterprise ready groupware software</b> for your network. It enables you to manage contacts, appointments, todos |
75 | 75 | and many more for your whole business.</p> |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | { |
102 | 102 | return strcasecmp($a['title'], $b['title']); |
103 | 103 | }); |
104 | - array_unshift($apps, false); // first empty row for eTemplate |
|
104 | + array_unshift($apps, false); // first empty row for eTemplate |
|
105 | 105 | |
106 | 106 | // putting templates below apps |
107 | - foreach($GLOBALS['egw']->framework->list_templates(true) as $info) |
|
107 | + foreach ($GLOBALS['egw']->framework->list_templates(true) as $info) |
|
108 | 108 | { |
109 | 109 | $apps[] = $this->_getParsedTemplateInfo($info); |
110 | 110 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | function _getParsedTemplateInfo($info) |
137 | 137 | { |
138 | 138 | // define the return array |
139 | - $info['image'] = file_exists(EGW_SERVER_ROOT.'/'.$info['icon']) ? $GLOBALS['egw_info']['server']['webserver_url'].'/'.$info['icon'] : Api\Image::find('thisdoesnotexist',array('navbar','nonav')); |
|
139 | + $info['image'] = file_exists(EGW_SERVER_ROOT.'/'.$info['icon']) ? $GLOBALS['egw_info']['server']['webserver_url'].'/'.$info['icon'] : Api\Image::find('thisdoesnotexist', array('navbar', 'nonav')); |
|
140 | 140 | $info['author'] = $this->_getHtmlPersonalInfo($info, 'author'); |
141 | 141 | $info['maintainer'] = $this->_getHtmlPersonalInfo($info, 'maintainer'); |
142 | 142 | |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | function _getParsedAppInfo($app) |
158 | 158 | { |
159 | 159 | // we read all setup files once, as no every app has it's own file |
160 | - static $setup_info=null; |
|
160 | + static $setup_info = null; |
|
161 | 161 | if (is_null($setup_info)) |
162 | 162 | { |
163 | - foreach(array_keys($GLOBALS['egw_info']['apps']) as $_app) |
|
163 | + foreach (array_keys($GLOBALS['egw_info']['apps']) as $_app) |
|
164 | 164 | { |
165 | 165 | if (file_exists($file = EGW_INCLUDE_ROOT.'/'.$_app.'/setup/setup.inc.php')) |
166 | 166 | { |
@@ -168,14 +168,14 @@ 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])) return null; // app got eg. removed in filesystem |
|
172 | 172 | |
173 | - $app_info = array_merge($GLOBALS['egw_info']['apps'][$app], $setup_info[$app]); |
|
173 | + $app_info = array_merge($GLOBALS['egw_info']['apps'][$app], $setup_info[$app]); |
|
174 | 174 | |
175 | 175 | // define the return array |
176 | 176 | $icon_app = isset($app_info['icon_app']) ? $app_info['icon_app'] : $app; |
177 | 177 | $icon = isset($app_info['icon']) ? $app_info['icon'] : 'navbar'; |
178 | - $ret = $app_info+array( |
|
178 | + $ret = $app_info + array( |
|
179 | 179 | 'app' => $app, |
180 | 180 | 'title' => lang(!empty($app_info['title']) ? $app_info['title'] : $app), |
181 | 181 | 'image' => Api\Image::find($icon_app, $icon) ? $icon_app.'/'.$app : 'api/nonav', |
@@ -274,12 +274,12 @@ discard block |
||
274 | 274 | } |
275 | 275 | |
276 | 276 | static public $knownLicenses = array( |
277 | - 'GPL' => array('http://opensource.org/licenses/gpl-license.php','GNU General Public License version 2.0 or (at your option) any later version'), |
|
278 | - 'GPL2' => array('http://opensource.org/licenses/gpl-2.0.php','GNU General Public License version 2.0'), |
|
279 | - 'GPL3' => array('http://opensource.org/licenses/gpl-3.0.php','GNU General Public License version 3.0'), |
|
280 | - 'LGPL' => array('http://opensource.org/licenses/lgpl-2.1.php','GNU Lesser General Public License, version 2.1'), |
|
281 | - 'LGPL3' => array('http://opensource.org/licenses/lgpl-3.0.php','GNU Lesser General Public License, version 3.0'), |
|
282 | - 'PHP' => array('http://opensource.org/licenses/php.php','PHP License'), |
|
277 | + 'GPL' => array('http://opensource.org/licenses/gpl-license.php', 'GNU General Public License version 2.0 or (at your option) any later version'), |
|
278 | + 'GPL2' => array('http://opensource.org/licenses/gpl-2.0.php', 'GNU General Public License version 2.0'), |
|
279 | + 'GPL3' => array('http://opensource.org/licenses/gpl-3.0.php', 'GNU General Public License version 3.0'), |
|
280 | + 'LGPL' => array('http://opensource.org/licenses/lgpl-2.1.php', 'GNU Lesser General Public License, version 2.1'), |
|
281 | + 'LGPL3' => array('http://opensource.org/licenses/lgpl-3.0.php', 'GNU Lesser General Public License, version 3.0'), |
|
282 | + 'PHP' => array('http://opensource.org/licenses/php.php', 'PHP License'), |
|
283 | 283 | ); |
284 | 284 | |
285 | 285 | /** |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | |
301 | 301 | if (isset(self::$knownLicenses[strtoupper($name)])) |
302 | 302 | { |
303 | - if (empty($url)) $url = self::$knownLicenses[$name=strtoupper($name)][0]; |
|
304 | - if (empty($title)) $title = self::$knownLicenses[$name=strtoupper($name)][1]; |
|
303 | + if (empty($url)) $url = self::$knownLicenses[$name = strtoupper($name)][0]; |
|
304 | + if (empty($title)) $title = self::$knownLicenses[$name = strtoupper($name)][1]; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | return array( |
308 | 308 | 'license' => $name ? $name : 'none', |
309 | 309 | 'license_url' => $url, |
310 | 310 | 'license_title' => $title, |
311 | - )+$info; |
|
311 | + ) + $info; |
|
312 | 312 | } |
313 | 313 | } |
@@ -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( |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $bundles = Cache::getTree(__CLASS__, 'bundles', array(__CLASS__, 'all'), array(), 7200); |
52 | 52 | $bundles_ts = $bundles['.ts']; |
53 | 53 | unset($bundles['.ts']); |
54 | - foreach($bundles as $name => $files) |
|
54 | + foreach ($bundles as $name => $files) |
|
55 | 55 | { |
56 | 56 | // to facilitate move to new api/et2 location, can be removed after 16.1 release |
57 | 57 | if ($name == 'et21' && !in_array('/api/js/etemplate/etemplate2.js', $files) || |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | } |
73 | 73 | $to_include = $included_bundles = array(); |
74 | 74 | $query = null; |
75 | - foreach($js_includes as $file) |
|
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') continue; // loaded via own tag, and we must not load it twice! |
|
78 | 78 | |
79 | 79 | if (!isset($to_include[$file])) |
80 | 80 | { |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @param string $minurl =null url of minified bundle, to be used, if existing and recent |
130 | 130 | * @return array js-files (can be more then one, if one of given files can not be bundeled) |
131 | 131 | */ |
132 | - protected static function urls(array $js_includes, &$max_modified=null, $minurl=null) |
|
132 | + protected static function urls(array $js_includes, &$max_modified = null, $minurl = null) |
|
133 | 133 | { |
134 | 134 | $debug_minify = $GLOBALS['egw_info']['server']['debug_minify'] === 'True'; |
135 | 135 | // ignore not existing minurl |
@@ -137,28 +137,28 @@ discard block |
||
137 | 137 | $to_include_first = $to_include = $to_minify = array(); |
138 | 138 | $max_modified = 0; |
139 | 139 | $query = null; |
140 | - foreach($js_includes as $path) |
|
140 | + foreach ($js_includes as $path) |
|
141 | 141 | { |
142 | 142 | if ($path == '/api/js/jsapi/egw.js') continue; // Leave egw.js out of bundle |
143 | 143 | unset($query); |
144 | - list($path,$query) = explode('?',$path,2); |
|
144 | + list($path, $query) = explode('?', $path, 2); |
|
145 | 145 | $mod = filemtime(EGW_SERVER_ROOT.$path); |
146 | 146 | if ($mod > $max_modified) $max_modified = $mod; |
147 | 147 | |
148 | 148 | // ckeditor must be included before bundled files, as they depend on it! |
149 | - if (strpos($path,'/ckeditor/ckeditor.js') !== false) |
|
149 | + if (strpos($path, '/ckeditor/ckeditor.js') !== false) |
|
150 | 150 | { |
151 | - $to_include_first[] = $path . '?' . $mod; |
|
151 | + $to_include_first[] = $path.'?'.$mod; |
|
152 | 152 | } |
153 | 153 | // for now minify does NOT support query parameters, nor php files generating javascript |
154 | 154 | elseif ($debug_minify || $query || substr($path, -3) != '.js' || empty($minurl)) |
155 | 155 | { |
156 | - $path .= '?'. $mod.($query ? '&'.$query : ''); |
|
156 | + $path .= '?'.$mod.($query ? '&'.$query : ''); |
|
157 | 157 | $to_include[] = $path; |
158 | 158 | } |
159 | 159 | else |
160 | 160 | { |
161 | - $to_minify[] = substr($path,1); |
|
161 | + $to_minify[] = substr($path, 1); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | if (!$debug_minify && $to_minify) |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $stock_files = call_user_func_array('array_merge', $bundles); |
247 | 247 | |
248 | 248 | // generate template and app bundles, if installed |
249 | - foreach(array( |
|
249 | + foreach (array( |
|
250 | 250 | 'jdots' => '/jdots/js/fw_jdots.js', |
251 | 251 | 'mobile' => '/pixelegg/js/fw_mobile.js', |
252 | 252 | 'pixelegg' => '/pixelegg/js/fw_pixelegg.js', |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | { |
258 | 258 | if (@file_exists(EGW_SERVER_ROOT.$file)) |
259 | 259 | { |
260 | - $inc_mgr = new IncludeMgr($stock_files); // reset loaded files to stock files |
|
260 | + $inc_mgr = new IncludeMgr($stock_files); // reset loaded files to stock files |
|
261 | 261 | $inc_mgr->include_js_file($file); |
262 | 262 | $bundles[$bundle] = array_diff($inc_mgr->get_included_files(), $stock_files); |
263 | 263 | self::urls($bundles[$bundle], $max_mod[$bundle]); |
@@ -265,12 +265,12 @@ discard block |
||
265 | 265 | } |
266 | 266 | |
267 | 267 | // automatic split bundles with more then MAX_BUNDLE_FILES (=50) files |
268 | - foreach($bundles as $name => $files) |
|
268 | + foreach ($bundles as $name => $files) |
|
269 | 269 | { |
270 | 270 | $n = ''; |
271 | - while (count($files) > self::MAX_BUNDLE_FILES*(int)$n) |
|
271 | + while (count($files) > self::MAX_BUNDLE_FILES * (int)$n) |
|
272 | 272 | { |
273 | - $files80 = array_slice($files, self::MAX_BUNDLE_FILES*(int)$n, self::MAX_BUNDLE_FILES, true); |
|
273 | + $files80 = array_slice($files, self::MAX_BUNDLE_FILES * (int)$n, self::MAX_BUNDLE_FILES, true); |
|
274 | 274 | $bundles[$name.$n++] = $files80; |
275 | 275 | } |
276 | 276 | } |
@@ -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 | } |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | * @param string $with =null |
55 | 55 | * @param string $msg_type =null 'error', 'warning' or 'success' (default) |
56 | 56 | */ |
57 | - public static function refresh_opener($msg, $app, $id=null, $type=null, $targetapp=null, $replace=null, $with=null, $msg_type=null) |
|
57 | + public static function refresh_opener($msg, $app, $id = null, $type = null, $targetapp = null, $replace = null, $with = null, $msg_type = null) |
|
58 | 58 | { |
59 | 59 | //error_log(__METHOD__.'('.array2string(func_get_args()).')'); |
60 | 60 | self::$extra['refresh-opener'] = func_get_args(); |
61 | 61 | |
62 | - unset($msg, $app, $id, $type, $targetapp, $replace, $with, $msg_type); // used only via func_get_args(); |
|
62 | + unset($msg, $app, $id, $type, $targetapp, $replace, $with, $msg_type); // used only via func_get_args(); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | * @param string $msg message to show |
71 | 71 | * @param string $type ='success' 'error', 'warning' or 'success' (default) |
72 | 72 | */ |
73 | - public static function message($msg, $type='success') |
|
73 | + public static function message($msg, $type = 'success') |
|
74 | 74 | { |
75 | 75 | self::$extra['message'] = func_get_args(); |
76 | 76 | |
77 | - unset($msg, $type); // used only via func_get_args(); |
|
77 | + unset($msg, $type); // used only via func_get_args(); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -84,12 +84,12 @@ discard block |
||
84 | 84 | * @param string $target |
85 | 85 | * @param string $popup |
86 | 86 | */ |
87 | - public static function popup($link, $target='_blank', $popup='640x480') |
|
87 | + public static function popup($link, $target = '_blank', $popup = '640x480') |
|
88 | 88 | { |
89 | 89 | // default params are not returned by func_get_args! |
90 | - $args = func_get_args()+array(null, '_blank', '640x480'); |
|
90 | + $args = func_get_args() + array(null, '_blank', '640x480'); |
|
91 | 91 | |
92 | - unset($link, $target, $popup); // used only via func_get_args() |
|
92 | + unset($link, $target, $popup); // used only via func_get_args() |
|
93 | 93 | |
94 | 94 | if (Json\Request::isJSONRequest()) |
95 | 95 | { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @param string $alert_msg ='' optional message to display as alert, before closing the window |
108 | 108 | */ |
109 | - public static function window_close($alert_msg='') |
|
109 | + public static function window_close($alert_msg = '') |
|
110 | 110 | { |
111 | 111 | //error_log(__METHOD__."()"); |
112 | 112 | self::$extra['window-close'] = $alert_msg ? $alert_msg : true; |
@@ -163,12 +163,12 @@ discard block |
||
163 | 163 | public static function get_extra() |
164 | 164 | { |
165 | 165 | // adding links of refreshed entry, to give others apps more information about necessity to refresh |
166 | - if (isset(self::$extra['refresh-opener']) && count(self::$extra['refresh-opener']) <= 8 && // do not run twice |
|
166 | + if (isset(self::$extra['refresh-opener']) && count(self::$extra['refresh-opener']) <= 8 && // do not run twice |
|
167 | 167 | !empty(self::$extra['refresh-opener'][1]) && !empty(self::$extra['refresh-opener'][2])) // app/id given |
168 | 168 | { |
169 | 169 | $links = Link::get_links(self::$extra['refresh-opener'][1], self::$extra['refresh-opener'][2]); |
170 | 170 | $apps = array(); |
171 | - foreach($links as $link) |
|
171 | + foreach ($links as $link) |
|
172 | 172 | { |
173 | 173 | $apps[$link['app']][] = $link['id']; |
174 | 174 | } |
@@ -164,9 +164,12 @@ |
||
164 | 164 | { |
165 | 165 | // adding links of refreshed entry, to give others apps more information about necessity to refresh |
166 | 166 | if (isset(self::$extra['refresh-opener']) && count(self::$extra['refresh-opener']) <= 8 && // do not run twice |
167 | - !empty(self::$extra['refresh-opener'][1]) && !empty(self::$extra['refresh-opener'][2])) // app/id given |
|
167 | + !empty(self::$extra['refresh-opener'][1]) && !empty(self::$extra['refresh-opener'][2])) |
|
168 | + { |
|
169 | + // app/id given |
|
168 | 170 | { |
169 | 171 | $links = Link::get_links(self::$extra['refresh-opener'][1], self::$extra['refresh-opener'][2]); |
172 | + } |
|
170 | 173 | $apps = array(); |
171 | 174 | foreach($links as $link) |
172 | 175 | { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @param string $extra_vars for login url |
45 | 45 | * @param string $change_passwd =null string with message to render input fields for password change |
46 | - */ |
|
46 | + */ |
|
47 | 47 | function screen($extra_vars, $change_passwd=null) |
48 | 48 | { |
49 | 49 | Api\Header\ContentSecurityPolicy::add('frame-src', array()); // array() no external frame-sources |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
229 | - * displays a login denied message |
|
230 | - */ |
|
229 | + * displays a login denied message |
|
230 | + */ |
|
231 | 231 | function denylogin_screen() |
232 | 232 | { |
233 | 233 | try { |
@@ -44,30 +44,30 @@ discard block |
||
44 | 44 | * @param string $extra_vars for login url |
45 | 45 | * @param string $change_passwd =null string with message to render input fields for password change |
46 | 46 | */ |
47 | - function screen($extra_vars, $change_passwd=null) |
|
47 | + function screen($extra_vars, $change_passwd = null) |
|
48 | 48 | { |
49 | - Api\Header\ContentSecurityPolicy::add('frame-src', array()); // array() no external frame-sources |
|
49 | + Api\Header\ContentSecurityPolicy::add('frame-src', array()); // array() no external frame-sources |
|
50 | 50 | |
51 | 51 | //error_log(__METHOD__."() this->template=$this->framework->template, this->template_dir=$this->framework->template_dir, get_class(this)=".get_class($this)); |
52 | 52 | try { |
53 | 53 | $tmpl = new Template(EGW_SERVER_ROOT.$this->framework->template_dir); |
54 | - $tmpl->set_file(array('login_form' => Api\Header\UserAgent::mobile()?'login_mobile.tpl':'login.tpl')); |
|
54 | + $tmpl->set_file(array('login_form' => Api\Header\UserAgent::mobile() ? 'login_mobile.tpl' : 'login.tpl')); |
|
55 | 55 | } |
56 | - catch(Api\Exception\WrongParameter $e) { |
|
56 | + catch (Api\Exception\WrongParameter $e) { |
|
57 | 57 | unset($e); |
58 | 58 | $tmpl = new Template(EGW_SERVER_ROOT.'/api/templates/default'); |
59 | - $tmpl->set_file(array('login_form' => Api\Header\UserAgent::mobile()?'login_mobile.tpl':'login.tpl')); |
|
59 | + $tmpl->set_file(array('login_form' => Api\Header\UserAgent::mobile() ? 'login_mobile.tpl' : 'login.tpl')); |
|
60 | 60 | } |
61 | 61 | |
62 | - $tmpl->set_var('lang_message',$GLOBALS['loginscreenmessage']); |
|
62 | + $tmpl->set_var('lang_message', $GLOBALS['loginscreenmessage']); |
|
63 | 63 | |
64 | 64 | // hide change-password fields, if not requested |
65 | 65 | if (!$change_passwd) |
66 | 66 | { |
67 | - $tmpl->set_block('login_form','change_password'); |
|
67 | + $tmpl->set_block('login_form', 'change_password'); |
|
68 | 68 | $tmpl->set_var('change_password', ''); |
69 | - $tmpl->set_var('lang_password',lang('password')); |
|
70 | - $tmpl->set_var('cd',check_logoutcode($_GET['cd'])); |
|
69 | + $tmpl->set_var('lang_password', lang('password')); |
|
70 | + $tmpl->set_var('cd', check_logoutcode($_GET['cd'])); |
|
71 | 71 | $tmpl->set_var('cd_class', isset($_GET['cd']) && $_GET['cd'] != 1 ? 'error' : ''); |
72 | 72 | $last_loginid = $_COOKIE['last_loginid']; |
73 | 73 | $last_domain = $_COOKIE['last_domain']; |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | } |
77 | 77 | else |
78 | 78 | { |
79 | - $tmpl->set_var('lang_password',lang('Old password')); |
|
80 | - $tmpl->set_var('lang_new_password',lang('New password')); |
|
81 | - $tmpl->set_var('lang_repeat_password',lang('Repeat password')); |
|
79 | + $tmpl->set_var('lang_password', lang('Old password')); |
|
80 | + $tmpl->set_var('lang_new_password', lang('New password')); |
|
81 | + $tmpl->set_var('lang_repeat_password', lang('Repeat password')); |
|
82 | 82 | $tmpl->set_var('cd', $change_passwd); |
83 | 83 | $tmpl->set_var('cd_class', 'error'); |
84 | 84 | $last_loginid = $_POST['login']; |
@@ -87,55 +87,55 @@ discard block |
||
87 | 87 | $tmpl->set_var('autofocus_login', ''); |
88 | 88 | $tmpl->set_var('autofocus_new_passwd', 'autofocus'); |
89 | 89 | } |
90 | - if($GLOBALS['egw_info']['server']['show_domain_selectbox']) |
|
90 | + if ($GLOBALS['egw_info']['server']['show_domain_selectbox']) |
|
91 | 91 | { |
92 | - foreach(array_keys($GLOBALS['egw_domain']) as $domain) |
|
92 | + foreach (array_keys($GLOBALS['egw_domain']) as $domain) |
|
93 | 93 | { |
94 | 94 | $domains[$domain] = $domain; |
95 | 95 | } |
96 | 96 | $tmpl->set_var(array( |
97 | 97 | 'lang_domain' => lang('domain'), |
98 | - 'select_domain' => Api\Html::select('logindomain',$last_domain,$domains,true,'tabindex="2"',0,false), |
|
98 | + 'select_domain' => Api\Html::select('logindomain', $last_domain, $domains, true, 'tabindex="2"', 0, false), |
|
99 | 99 | )); |
100 | 100 | } |
101 | 101 | else |
102 | 102 | { |
103 | 103 | /* trick to make domain section disapear */ |
104 | - $tmpl->set_block('login_form','domain_selection'); |
|
105 | - $tmpl->set_var('domain_selection',$GLOBALS['egw_info']['user']['domain'] ? |
|
106 | - Api\Html::input_hidden('logindomain',$GLOBALS['egw_info']['user']['domain']) : ''); |
|
104 | + $tmpl->set_block('login_form', 'domain_selection'); |
|
105 | + $tmpl->set_var('domain_selection', $GLOBALS['egw_info']['user']['domain'] ? |
|
106 | + Api\Html::input_hidden('logindomain', $GLOBALS['egw_info']['user']['domain']) : ''); |
|
107 | 107 | |
108 | - if($last_loginid !== '') |
|
108 | + if ($last_loginid !== '') |
|
109 | 109 | { |
110 | 110 | reset($GLOBALS['egw_domain']); |
111 | 111 | list($default_domain) = each($GLOBALS['egw_domain']); |
112 | 112 | |
113 | - if(!empty ($last_domain) && $last_domain != $default_domain) |
|
113 | + if (!empty ($last_domain) && $last_domain != $default_domain) |
|
114 | 114 | { |
115 | - $last_loginid .= '@' . $last_domain; |
|
115 | + $last_loginid .= '@'.$last_domain; |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | 120 | $config_reg = Api\Config::read('registration'); |
121 | 121 | |
122 | - if($config_reg['enable_registration']) |
|
122 | + if ($config_reg['enable_registration']) |
|
123 | 123 | { |
124 | 124 | if ($config_reg['register_link']) |
125 | 125 | { |
126 | - $reg_link=' <a href="'. $this->framework->link('/registration/index.php','lang_code='.$_GET['lang']). '">'.lang('Not a user yet? Register now').'</a><br/>'; |
|
126 | + $reg_link = ' <a href="'.$this->framework->link('/registration/index.php', 'lang_code='.$_GET['lang']).'">'.lang('Not a user yet? Register now').'</a><br/>'; |
|
127 | 127 | } |
128 | 128 | if ($config_reg['lostpassword_link']) |
129 | 129 | { |
130 | - $lostpw_link=' <a href="'. $this->framework->link('/registration/index.php','menuaction=registration.registration_ui.lost_password&lang_code='.$_GET['lang']). '">'.lang('Lost password').'</a><br/>'; |
|
130 | + $lostpw_link = ' <a href="'.$this->framework->link('/registration/index.php', 'menuaction=registration.registration_ui.lost_password&lang_code='.$_GET['lang']).'">'.lang('Lost password').'</a><br/>'; |
|
131 | 131 | } |
132 | 132 | if ($config_reg['lostid_link']) |
133 | 133 | { |
134 | - $lostid_link=' <a href="'. $this->framework->link('/registration/index.php','menuaction=registration.registration_ui.lost_username&lang_code='.$_GET['lang']). '">'.lang('Lost Login Id').'</a><br/>'; |
|
134 | + $lostid_link = ' <a href="'.$this->framework->link('/registration/index.php', 'menuaction=registration.registration_ui.lost_username&lang_code='.$_GET['lang']).'">'.lang('Lost Login Id').'</a><br/>'; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /* if at least one option of "registration" is activated display the registration section */ |
138 | - if($config_reg['register_link'] || $config_reg['lostpassword_link'] || $config_reg['lostid_link'] ) |
|
138 | + if ($config_reg['register_link'] || $config_reg['lostpassword_link'] || $config_reg['lostid_link']) |
|
139 | 139 | { |
140 | 140 | $tmpl->set_var(array( |
141 | 141 | 'register_link' => $reg_link, |
@@ -146,20 +146,20 @@ discard block |
||
146 | 146 | else |
147 | 147 | { |
148 | 148 | /* trick to make registration section disapear */ |
149 | - $tmpl->set_block('login_form','registration'); |
|
150 | - $tmpl->set_var('registration',''); |
|
149 | + $tmpl->set_block('login_form', 'registration'); |
|
150 | + $tmpl->set_var('registration', ''); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | - $tmpl->set_var('login_url', $GLOBALS['egw_info']['server']['webserver_url'] . '/login.php' . $extra_vars); |
|
154 | + $tmpl->set_var('login_url', $GLOBALS['egw_info']['server']['webserver_url'].'/login.php'.$extra_vars); |
|
155 | 155 | $tmpl->set_var('version', $GLOBALS['egw_info']['server']['versions']['phpgwapi']); |
156 | 156 | $tmpl->set_var('login', $last_loginid); |
157 | 157 | |
158 | - $tmpl->set_var('lang_username',lang('username')); |
|
159 | - $tmpl->set_var('lang_login',lang('login')); |
|
158 | + $tmpl->set_var('lang_username', lang('username')); |
|
159 | + $tmpl->set_var('lang_login', lang('login')); |
|
160 | 160 | |
161 | 161 | $tmpl->set_var('website_title', $GLOBALS['egw_info']['server']['site_title']); |
162 | - $tmpl->set_var('template_set',$this->framework->template); |
|
162 | + $tmpl->set_var('template_set', $this->framework->template); |
|
163 | 163 | |
164 | 164 | if (substr($GLOBALS['egw_info']['server']['login_logo_file'], 0, 4) == 'http' || |
165 | 165 | $GLOBALS['egw_info']['server']['login_logo_file'][0] == '/') |
@@ -168,14 +168,14 @@ discard block |
||
168 | 168 | } |
169 | 169 | else |
170 | 170 | { |
171 | - $var['logo_file'] = Api\Image::find('api',$GLOBALS['egw_info']['server']['login_logo_file']?$GLOBALS['egw_info']['server']['login_logo_file']:'logo', '', null); // null=explicit allow svg |
|
171 | + $var['logo_file'] = Api\Image::find('api', $GLOBALS['egw_info']['server']['login_logo_file'] ? $GLOBALS['egw_info']['server']['login_logo_file'] : 'logo', '', null); // null=explicit allow svg |
|
172 | 172 | } |
173 | - $var['logo_url'] = $GLOBALS['egw_info']['server']['login_logo_url']?$GLOBALS['egw_info']['server']['login_logo_url']:'http://www.egroupware.org'; |
|
174 | - if (substr($var['logo_url'],0,4) != 'http') |
|
173 | + $var['logo_url'] = $GLOBALS['egw_info']['server']['login_logo_url'] ? $GLOBALS['egw_info']['server']['login_logo_url'] : 'http://www.egroupware.org'; |
|
174 | + if (substr($var['logo_url'], 0, 4) != 'http') |
|
175 | 175 | { |
176 | 176 | $var['logo_url'] = 'http://'.$var['logo_url']; |
177 | 177 | } |
178 | - $var['logo_title'] = $GLOBALS['egw_info']['server']['login_logo_title']?$GLOBALS['egw_info']['server']['login_logo_title']:'www.eGroupWare.org'; |
|
178 | + $var['logo_title'] = $GLOBALS['egw_info']['server']['login_logo_title'] ? $GLOBALS['egw_info']['server']['login_logo_title'] : 'www.eGroupWare.org'; |
|
179 | 179 | $tmpl->set_var($var); |
180 | 180 | |
181 | 181 | /* language section if activated in site Config */ |
@@ -183,14 +183,14 @@ discard block |
||
183 | 183 | { |
184 | 184 | $tmpl->set_var(array( |
185 | 185 | 'lang_language' => lang('Language'), |
186 | - 'select_language' => Api\Html::select('lang',$GLOBALS['egw_info']['user']['preferences']['common']['lang'], |
|
187 | - Api\Translation::get_installed_langs(),true,'tabindex="1"',0,false), |
|
186 | + 'select_language' => Api\Html::select('lang', $GLOBALS['egw_info']['user']['preferences']['common']['lang'], |
|
187 | + Api\Translation::get_installed_langs(), true, 'tabindex="1"', 0, false), |
|
188 | 188 | )); |
189 | 189 | } |
190 | 190 | else |
191 | 191 | { |
192 | - $tmpl->set_block('login_form','language_select'); |
|
193 | - $tmpl->set_var('language_select',''); |
|
192 | + $tmpl->set_block('login_form', 'language_select'); |
|
193 | + $tmpl->set_var('language_select', ''); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /********************************************************\ |
@@ -198,31 +198,31 @@ discard block |
||
198 | 198 | * and place a time selectbox, how long cookie is valid * |
199 | 199 | \********************************************************/ |
200 | 200 | |
201 | - if($GLOBALS['egw_info']['server']['allow_cookie_auth']) |
|
201 | + if ($GLOBALS['egw_info']['server']['allow_cookie_auth']) |
|
202 | 202 | { |
203 | - $tmpl->set_block('login_form','remember_me_selection'); |
|
204 | - $tmpl->set_var('lang_remember_me',lang('Remember me')); |
|
205 | - $tmpl->set_var('select_remember_me',Api\Html::select('remember_me', '', array( |
|
203 | + $tmpl->set_block('login_form', 'remember_me_selection'); |
|
204 | + $tmpl->set_var('lang_remember_me', lang('Remember me')); |
|
205 | + $tmpl->set_var('select_remember_me', Api\Html::select('remember_me', '', array( |
|
206 | 206 | '' => lang('not'), |
207 | 207 | '1hour' => lang('1 Hour'), |
208 | 208 | '1day' => lang('1 Day'), |
209 | 209 | '1week'=> lang('1 Week'), |
210 | 210 | '1month' => lang('1 Month'), |
211 | 211 | 'forever' => lang('Forever'), |
212 | - ),true,'tabindex="3"',0,false)); |
|
212 | + ), true, 'tabindex="3"', 0, false)); |
|
213 | 213 | } |
214 | 214 | else |
215 | 215 | { |
216 | 216 | /* trick to make remember_me section disapear */ |
217 | - $tmpl->set_block('login_form','remember_me_selection'); |
|
218 | - $tmpl->set_var('remember_me_selection',''); |
|
217 | + $tmpl->set_block('login_form', 'remember_me_selection'); |
|
218 | + $tmpl->set_var('remember_me_selection', ''); |
|
219 | 219 | } |
220 | 220 | $tmpl->set_var('autocomplete', ($GLOBALS['egw_info']['server']['autocomplete_login'] ? 'autocomplete="off"' : '')); |
221 | 221 | |
222 | 222 | // load jquery for login screen too |
223 | 223 | Api\Framework::includeJS('jquery', 'jquery'); |
224 | 224 | |
225 | - $this->framework->render($tmpl->fp('loginout','login_form'),false,false); |
|
225 | + $this->framework->render($tmpl->fp('loginout', 'login_form'), false, false); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $tmpl = new Template(EGW_SERVER_ROOT.$this->framework->template_dir); |
235 | 235 | $tmpl->set_file(array('login_form' => 'login_denylogin.tpl')); |
236 | 236 | } |
237 | - catch(Api\Exception\WrongParameter $e) { |
|
237 | + catch (Api\Exception\WrongParameter $e) { |
|
238 | 238 | unset($e); |
239 | 239 | $tmpl = new Template(EGW_SERVER_ROOT.'/api/templates/default'); |
240 | 240 | $tmpl->set_file(array('login_form' => 'login_denylogin.tpl')); |
@@ -249,6 +249,6 @@ discard block |
||
249 | 249 | // load jquery for deny-login screen too |
250 | 250 | Api\Framework::includeJS('jquery', 'jquery'); |
251 | 251 | |
252 | - $this->framework->render($tmpl->fp('loginout','login_form'),false,false); |
|
252 | + $this->framework->render($tmpl->fp('loginout', 'login_form'), false, false); |
|
253 | 253 | } |
254 | 254 | } |
@@ -337,16 +337,16 @@ discard block |
||
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
340 | - * called by hooks to add an icon in the topmenu info location |
|
341 | - * |
|
342 | - * @param string $id unique element id |
|
343 | - * @param string $icon_src src of the icon image. Make sure this nog height then 18pixels |
|
344 | - * @param string $iconlink where the icon links to |
|
345 | - * @param booleon $blink set true to make the icon blink |
|
346 | - * @param mixed $tooltip string containing the tooltip Api\Html, or null of no tooltip |
|
347 | - * @todo implement in a reasonable way for jdots |
|
348 | - * @return void |
|
349 | - */ |
|
340 | + * called by hooks to add an icon in the topmenu info location |
|
341 | + * |
|
342 | + * @param string $id unique element id |
|
343 | + * @param string $icon_src src of the icon image. Make sure this nog height then 18pixels |
|
344 | + * @param string $iconlink where the icon links to |
|
345 | + * @param booleon $blink set true to make the icon blink |
|
346 | + * @param mixed $tooltip string containing the tooltip Api\Html, or null of no tooltip |
|
347 | + * @todo implement in a reasonable way for jdots |
|
348 | + * @return void |
|
349 | + */ |
|
350 | 350 | function topmenu_info_icon($id,$icon_src,$iconlink,$blink=false,$tooltip=null) |
351 | 351 | { |
352 | 352 | unset($id,$icon_src,$iconlink,$blink,$tooltip); // not used |
@@ -354,14 +354,14 @@ discard block |
||
354 | 354 | } |
355 | 355 | |
356 | 356 | /** |
357 | - * Add menu items to the topmenu template class to be displayed |
|
358 | - * |
|
359 | - * @param array $app application data |
|
360 | - * @param mixed $alt_label string with alternative menu item label default value = null |
|
361 | - * @param string $urlextra string with alternate additional code inside <a>-tag |
|
362 | - * @access protected |
|
363 | - * @return void |
|
364 | - */ |
|
357 | + * Add menu items to the topmenu template class to be displayed |
|
358 | + * |
|
359 | + * @param array $app application data |
|
360 | + * @param mixed $alt_label string with alternative menu item label default value = null |
|
361 | + * @param string $urlextra string with alternate additional code inside <a>-tag |
|
362 | + * @access protected |
|
363 | + * @return void |
|
364 | + */ |
|
365 | 365 | function _add_topmenu_item(array $app_data,$alt_label=null) |
366 | 366 | { |
367 | 367 | switch($app_data['name']) |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @param string $template = '' name of the template |
59 | 59 | */ |
60 | - function __construct($template=self::APP) |
|
60 | + function __construct($template = self::APP) |
|
61 | 61 | { |
62 | - parent::__construct($template); // call the constructor of the extended class |
|
62 | + parent::__construct($template); // call the constructor of the extended class |
|
63 | 63 | |
64 | - $this->template_dir = '/'.$template; // we are packaged as an application |
|
64 | + $this->template_dir = '/'.$template; // we are packaged as an application |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -129,16 +129,16 @@ discard block |
||
129 | 129 | public static function app_from_url($url) |
130 | 130 | { |
131 | 131 | $matches = null; |
132 | - if (preg_match('/menuaction=([a-z0-9_-]+)\./i',$url,$matches)) |
|
132 | + if (preg_match('/menuaction=([a-z0-9_-]+)\./i', $url, $matches)) |
|
133 | 133 | { |
134 | 134 | return $matches[1]; |
135 | 135 | } |
136 | 136 | if ($GLOBALS['egw_info']['server']['webserver_url'] && |
137 | - ($webserver_path = parse_url($GLOBALS['egw_info']['server']['webserver_url'],PHP_URL_PATH))) |
|
137 | + ($webserver_path = parse_url($GLOBALS['egw_info']['server']['webserver_url'], PHP_URL_PATH))) |
|
138 | 138 | { |
139 | - list(,$url) = explode($webserver_path, parse_url($url,PHP_URL_PATH),2); |
|
139 | + list(,$url) = explode($webserver_path, parse_url($url, PHP_URL_PATH), 2); |
|
140 | 140 | } |
141 | - if (preg_match('/\/([^\/]+)\/([^\/]+\.php)?(\?|\/|$)/',$url,$matches)) |
|
141 | + if (preg_match('/\/([^\/]+)\/([^\/]+\.php)?(\?|\/|$)/', $url, $matches)) |
|
142 | 142 | { |
143 | 143 | return $matches[1]; |
144 | 144 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @param string $link_app = null if appname or true, some templates generate a special link-handler url |
155 | 155 | * @return string The full url after processing |
156 | 156 | */ |
157 | - static function link($url = '', $extravars = '', $link_app=null) |
|
157 | + static function link($url = '', $extravars = '', $link_app = null) |
|
158 | 158 | { |
159 | 159 | if (is_null($link_app)) $link_app = self::$link_app; |
160 | 160 | $link = parent::link($url, $extravars); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | // Link gets handled in JS, so quotes need slashes as well as url-encoded |
166 | 166 | // encoded ampersands in get parameters (%26) need to be encoded twise, |
167 | 167 | // so they are still encoded when assigned to window.location |
168 | - $link_with_slashes = str_replace(array('%27','%26'), array('\%27','%2526'), $link); |
|
168 | + $link_with_slashes = str_replace(array('%27', '%26'), array('\%27', '%2526'), $link); |
|
169 | 169 | |
170 | 170 | //$link = "javascript:window.egw_link_handler?egw_link_handler('$link','$link_app'):parent.egw_link_handler('$link','$link_app');"; |
171 | 171 | $link = "javascript:egw_link_handler('$link_with_slashes','$link_app')"; |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | protected function _get_csp_frame_src() |
184 | 184 | { |
185 | 185 | $srcs = array(); |
186 | - foreach(Api\Hooks::process('csp-frame-src') as $src) |
|
186 | + foreach (Api\Hooks::process('csp-frame-src') as $src) |
|
187 | 187 | { |
188 | 188 | if ($src) $srcs = array_merge($srcs, $src); |
189 | 189 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * @param array $extra = array() extra attributes passed as data-attribute to egw.js |
197 | 197 | * @return string with Api\Html |
198 | 198 | */ |
199 | - function header(array $extra=array()) |
|
199 | + function header(array $extra = array()) |
|
200 | 200 | { |
201 | 201 | // make sure header is output only once |
202 | 202 | if (self::$header_done) return ''; |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | { |
222 | 222 | $this->tpl->set_file(array('_head' => 'head.tpl')); |
223 | 223 | } |
224 | - $this->tpl->set_block('_head','head'); |
|
225 | - $this->tpl->set_block('_head','framework'); |
|
224 | + $this->tpl->set_block('_head', 'head'); |
|
225 | + $this->tpl->set_block('_head', 'framework'); |
|
226 | 226 | |
227 | 227 | // should we draw the framework, or just a header |
228 | 228 | $do_framework = isset($_GET['cd']) && $_GET['cd'] === 'yes'; |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | { |
248 | 248 | self::includeJS('.', 'fw_'.static::APP, static::JS_INCLUDE_APP); |
249 | 249 | } |
250 | - Api\Cache::unsetSession(__CLASS__,'sidebox_md5'); // sideboxes need to be send again |
|
250 | + Api\Cache::unsetSession(__CLASS__, 'sidebox_md5'); // sideboxes need to be send again |
|
251 | 251 | |
252 | 252 | $extra['navbar-apps'] = $this->get_navbar_apps($_SERVER['REQUEST_URI']); |
253 | 253 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | // - if not we need to check if we have an opener (are a popup window) |
257 | 257 | // - as popups can open further popups, we need to decend all the way down until we find a framework |
258 | 258 | // - only if we cant find a framework in all openers, we redirect to create a new framework |
259 | - if(!$do_framework) |
|
259 | + if (!$do_framework) |
|
260 | 260 | { |
261 | 261 | // fetch sidebox from application and set it in extra data, if we are no popup |
262 | 262 | if (!$GLOBALS['egw_info']['flags']['nonavbar']) |
@@ -266,12 +266,12 @@ discard block |
||
266 | 266 | // for remote manual never check/create framework |
267 | 267 | if (!in_array($GLOBALS['egw_info']['flags']['currentapp'], array('manual', 'login', 'logout', 'sitemgr'))) |
268 | 268 | { |
269 | - if (empty($GLOBALS['egw_info']['flags']['java_script'])) $GLOBALS['egw_info']['flags']['java_script']=''; |
|
269 | + if (empty($GLOBALS['egw_info']['flags']['java_script'])) $GLOBALS['egw_info']['flags']['java_script'] = ''; |
|
270 | 270 | $extra['check-framework'] = $_GET['cd'] !== 'no'; |
271 | 271 | } |
272 | 272 | } |
273 | 273 | $this->tpl->set_var($this->_get_header($extra)); |
274 | - $content = $this->tpl->fp('out','head').$content; |
|
274 | + $content = $this->tpl->fp('out', 'head').$content; |
|
275 | 275 | |
276 | 276 | if (!$do_framework) |
277 | 277 | { |
@@ -280,10 +280,10 @@ discard block |
||
280 | 280 | |
281 | 281 | // topmenu |
282 | 282 | $vars = $this->_get_navbar($apps = $this->_get_navbar_apps()); |
283 | - $this->tpl->set_var($this->topmenu($vars,$apps)); |
|
283 | + $this->tpl->set_var($this->topmenu($vars, $apps)); |
|
284 | 284 | |
285 | 285 | // hook after_navbar (eg. notifications) |
286 | - $this->tpl->set_var('hook_after_navbar',$this->_get_after_navbar()); |
|
286 | + $this->tpl->set_var('hook_after_navbar', $this->_get_after_navbar()); |
|
287 | 287 | |
288 | 288 | //Global sidebar width |
289 | 289 | $this->tpl->set_var('sidebox_width', self::get_global_sidebar_width()); |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | |
301 | 301 | // add framework div's |
302 | 302 | $this->tpl->set_var($this->_get_footer()); |
303 | - $content .= $this->tpl->fp('out','framework'); |
|
303 | + $content .= $this->tpl->fp('out', 'framework'); |
|
304 | 304 | $content .= self::footer(false); |
305 | 305 | |
306 | 306 | echo $content; |
@@ -319,14 +319,14 @@ discard block |
||
319 | 319 | * @param array $apps |
320 | 320 | * @return array |
321 | 321 | */ |
322 | - function topmenu(array $vars,array $apps) |
|
322 | + function topmenu(array $vars, array $apps) |
|
323 | 323 | { |
324 | 324 | $this->topmenu_items = $this->topmenu_info_items = array(); |
325 | 325 | |
326 | - parent::topmenu($vars,$apps); |
|
327 | - $vars['topmenu_items'] = "<ul>\n<li>".implode("</li>\n<li>",$this->topmenu_items)."</li>\n</ul>"; |
|
326 | + parent::topmenu($vars, $apps); |
|
327 | + $vars['topmenu_items'] = "<ul>\n<li>".implode("</li>\n<li>", $this->topmenu_items)."</li>\n</ul>"; |
|
328 | 328 | $vars['topmenu_info_items'] = ''; |
329 | - foreach($this->topmenu_info_items as $id => $item) |
|
329 | + foreach ($this->topmenu_info_items as $id => $item) |
|
330 | 330 | { |
331 | 331 | $vars['topmenu_info_items'] .= '<div class="topmenu_info_item"'. |
332 | 332 | (is_numeric($id) ? '' : ' id="topmenu_info_'.$id.'"').'>'.$item."</div>\n"; |
@@ -347,9 +347,9 @@ discard block |
||
347 | 347 | * @todo implement in a reasonable way for jdots |
348 | 348 | * @return void |
349 | 349 | */ |
350 | - function topmenu_info_icon($id,$icon_src,$iconlink,$blink=false,$tooltip=null) |
|
350 | + function topmenu_info_icon($id, $icon_src, $iconlink, $blink = false, $tooltip = null) |
|
351 | 351 | { |
352 | - unset($id,$icon_src,$iconlink,$blink,$tooltip); // not used |
|
352 | + unset($id, $icon_src, $iconlink, $blink, $tooltip); // not used |
|
353 | 353 | // not yet implemented, only used in admin/inc/hook_topmenu_info.inc.php to notify about pending updates |
354 | 354 | } |
355 | 355 | |
@@ -362,9 +362,9 @@ discard block |
||
362 | 362 | * @access protected |
363 | 363 | * @return void |
364 | 364 | */ |
365 | - function _add_topmenu_item(array $app_data,$alt_label=null) |
|
365 | + function _add_topmenu_item(array $app_data, $alt_label = null) |
|
366 | 366 | { |
367 | - switch($app_data['name']) |
|
367 | + switch ($app_data['name']) |
|
368 | 368 | { |
369 | 369 | case 'logout': |
370 | 370 | if (Api\Header\UserAgent::mobile() || $GLOBALS['egw_info']['user']['preferences']['common']['theme'] == 'mobile') |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | } |
374 | 374 | else |
375 | 375 | { |
376 | - return; // no need for logout in topmenu on jdots |
|
376 | + return; // no need for logout in topmenu on jdots |
|
377 | 377 | } |
378 | 378 | break; |
379 | 379 | |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | break; |
383 | 383 | |
384 | 384 | default: |
385 | - if (strpos($app_data['url'],'logout.php') === false && substr($app_data['url'], 0, 11) != 'javascript:') |
|
385 | + if (strpos($app_data['url'], 'logout.php') === false && substr($app_data['url'], 0, 11) != 'javascript:') |
|
386 | 386 | { |
387 | 387 | $app_data['url'] = "javascript:egw_link_handler('".$app_data['url']."','". |
388 | 388 | (isset($GLOBALS['egw_info']['user']['apps'][$app_data['name']]) ? |
@@ -390,8 +390,8 @@ discard block |
||
390 | 390 | } |
391 | 391 | } |
392 | 392 | $id = $app_data['id'] ? $app_data['id'] : ($app_data['name'] ? $app_data['name'] : $app_data['title']); |
393 | - $title = htmlspecialchars($alt_label ? $alt_label : $app_data['title']); |
|
394 | - $this->topmenu_items[] = '<a id="topmenu_' . $id . '" href="'.htmlspecialchars($app_data['url']).'" title="'.$app_data['title'].'">'.$title.'</a>'; |
|
393 | + $title = htmlspecialchars($alt_label ? $alt_label : $app_data['title']); |
|
394 | + $this->topmenu_items[] = '<a id="topmenu_'.$id.'" href="'.htmlspecialchars($app_data['url']).'" title="'.$app_data['title'].'">'.$title.'</a>'; |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | /** |
@@ -402,11 +402,11 @@ discard block |
||
402 | 402 | * @access protected |
403 | 403 | * @return void |
404 | 404 | */ |
405 | - function _add_topmenu_info_item($content, $id=null) |
|
405 | + function _add_topmenu_info_item($content, $id = null) |
|
406 | 406 | { |
407 | - if(strpos($content,'menuaction=admin.admin_accesslog.sessions') !== false) |
|
407 | + if (strpos($content, 'menuaction=admin.admin_accesslog.sessions') !== false) |
|
408 | 408 | { |
409 | - $content = preg_replace('/href="([^"]+)"/',"href=\"javascript:egw_link_handler('\\1','admin')\"",$content); |
|
409 | + $content = preg_replace('/href="([^"]+)"/', "href=\"javascript:egw_link_handler('\\1','admin')\"", $content); |
|
410 | 410 | } |
411 | 411 | if ($id) |
412 | 412 | { |
@@ -425,10 +425,10 @@ discard block |
||
425 | 425 | */ |
426 | 426 | static function ajax_tz_selection($tz) |
427 | 427 | { |
428 | - Api\DateTime::setUserPrefs($tz); // throws exception, if tz is invalid |
|
428 | + Api\DateTime::setUserPrefs($tz); // throws exception, if tz is invalid |
|
429 | 429 | |
430 | 430 | $GLOBALS['egw']->preferences->read_repository(); |
431 | - $GLOBALS['egw']->preferences->add('common','tz',$tz); |
|
431 | + $GLOBALS['egw']->preferences->add('common', 'tz', $tz); |
|
432 | 432 | $GLOBALS['egw']->preferences->save_repository(); |
433 | 433 | } |
434 | 434 | |
@@ -480,13 +480,13 @@ discard block |
||
480 | 480 | // only send admin sidebox, for admin index url (when clicked on admin), |
481 | 481 | // not for other admin pages, called eg. from sidebox menu of other apps |
482 | 482 | // --> that way we always stay in the app, and NOT open admin sidebox for an app tab!!! |
483 | - if ($app == 'admin' && substr($_SERVER['PHP_SELF'],-16) != '/admin/index.php' && |
|
483 | + if ($app == 'admin' && substr($_SERVER['PHP_SELF'], -16) != '/admin/index.php' && |
|
484 | 484 | $_GET['menuaction'] != 'admin.admin_ui.index') |
485 | 485 | { |
486 | 486 | //error_log(__METHOD__."() app=$app, menuaction=$_GET[menuaction], PHP_SELF=$_SERVER[PHP_SELF] --> sidebox request ignored"); |
487 | 487 | return; |
488 | 488 | } |
489 | - $md5_session =& Api\Cache::getSession(__CLASS__,'sidebox_md5'); |
|
489 | + $md5_session = & Api\Cache::getSession(__CLASS__, 'sidebox_md5'); |
|
490 | 490 | |
491 | 491 | //Set the sidebox content |
492 | 492 | $sidebox = $this->get_sidebox($app); |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | if ($md5_session[$app] !== $md5) |
496 | 496 | { |
497 | 497 | //error_log(__METHOD__."() header changed md5_session[$app]!=='$md5' --> setting it on self::\$extra[setSidebox]"); |
498 | - $md5_session[$app] = $md5; // update md5 in session |
|
498 | + $md5_session[$app] = $md5; // update md5 in session |
|
499 | 499 | self::$extra['setSidebox'] = array($app, $sidebox, $md5); |
500 | 500 | } |
501 | 501 | //else error_log(__METHOD__."() md5_session[$app]==='$md5' --> nothing to do"); |
@@ -509,9 +509,9 @@ discard block |
||
509 | 509 | * @return boolean $consider_navbar_not_yet_called_as_true=true ignored by jdots, we only care for cd=yes GET param |
510 | 510 | * @return boolean |
511 | 511 | */ |
512 | - public function isTop($consider_navbar_not_yet_called_as_true=true) |
|
512 | + public function isTop($consider_navbar_not_yet_called_as_true = true) |
|
513 | 513 | { |
514 | - unset($consider_navbar_not_yet_called_as_true); // not used |
|
514 | + unset($consider_navbar_not_yet_called_as_true); // not used |
|
515 | 515 | return isset($_GET['cd']) && $_GET['cd'] === 'yes'; |
516 | 516 | } |
517 | 517 | |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | * @param array $file |
538 | 538 | * @param string $type = null 'admin', 'preferences', 'favorites', ... |
539 | 539 | */ |
540 | - public function sidebox($appname,$menu_title,$file,$type=null) |
|
540 | + public function sidebox($appname, $menu_title, $file, $type = null) |
|
541 | 541 | { |
542 | 542 | if (!isset($file['menuOpened'])) $file['menuOpened'] = (boolean)$this->sidebox_menu_opened; |
543 | 543 | //error_log(__METHOD__."('$appname', '$menu_title', file[menuOpened]=$file[menuOpened], ...) this->sidebox_menu_opened=$this->sidebox_menu_opened"); |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | if (($type == 'admin' || $menu_title == lang('Admin')) && $appname != 'admin') |
548 | 548 | { |
549 | 549 | $file = preg_replace("/^(javascript:egw_link_handler\(')(.*)menuaction=([^&]+)(.*)(','[^']+'\))$/", |
550 | - '$1$2menuaction=admin.admin_ui.index&load=$3$4&ajax=true\',\'admin\')', $file_was=$file); |
|
550 | + '$1$2menuaction=admin.admin_ui.index&load=$3$4&ajax=true\',\'admin\')', $file_was = $file); |
|
551 | 551 | } |
552 | 552 | |
553 | 553 | $this->sideboxes[$appname][$menu_title] = $file; |
@@ -582,15 +582,15 @@ discard block |
||
582 | 582 | self::$link_app = $appname; |
583 | 583 | // allow other apps to hook into sidebox menu of an app, hook-name: sidebox_$appname |
584 | 584 | $this->sidebox_menu_opened = true; |
585 | - Api\Hooks::process('sidebox_'.$appname,array($appname),true); // true = call independent of app-permissions |
|
585 | + Api\Hooks::process('sidebox_'.$appname, array($appname), true); // true = call independent of app-permissions |
|
586 | 586 | |
587 | 587 | // calling the old hook |
588 | 588 | $this->sidebox_menu_opened = true; |
589 | - Api\Hooks::single('sidebox_menu',$appname); |
|
589 | + Api\Hooks::single('sidebox_menu', $appname); |
|
590 | 590 | self::$link_app = null; |
591 | 591 | |
592 | 592 | // allow other apps to hook into sidebox menu of every app: sidebox_all |
593 | - Api\Hooks::process('sidebox_all',array($GLOBALS['egw_info']['flags']['currentapp']),true); |
|
593 | + Api\Hooks::process('sidebox_all', array($GLOBALS['egw_info']['flags']['currentapp']), true); |
|
594 | 594 | } |
595 | 595 | //If there still is no sidebox content, return null here |
596 | 596 | if (!isset($this->sideboxes[$appname])) |
@@ -599,17 +599,17 @@ discard block |
||
599 | 599 | } |
600 | 600 | |
601 | 601 | $data = array(); |
602 | - foreach($this->sideboxes[$appname] as $menu_name => &$file) |
|
602 | + foreach ($this->sideboxes[$appname] as $menu_name => &$file) |
|
603 | 603 | { |
604 | 604 | $current_menu = array( |
605 | - 'menu_name' => md5($menu_name), // can contain Api\Html tags and javascript! |
|
605 | + 'menu_name' => md5($menu_name), // can contain Api\Html tags and javascript! |
|
606 | 606 | 'title' => $menu_name, |
607 | 607 | 'entries' => array(), |
608 | 608 | 'opened' => (boolean)$file['menuOpened'], |
609 | 609 | ); |
610 | - foreach($file as $item_text => $item_link) |
|
610 | + foreach ($file as $item_text => $item_link) |
|
611 | 611 | { |
612 | - if ($item_text === 'menuOpened' || // flag, not menu entry |
|
612 | + if ($item_text === 'menuOpened' || // flag, not menu entry |
|
613 | 613 | $item_text === '_NewLine_' || $item_link === '_NewLine_') |
614 | 614 | { |
615 | 615 | continue; |
@@ -620,14 +620,14 @@ discard block |
||
620 | 620 | } |
621 | 621 | |
622 | 622 | $var = array(); |
623 | - $var['icon_or_star'] = $GLOBALS['egw_info']['server']['webserver_url'] . $this->template_dir.'/images/bullet.png'; |
|
623 | + $var['icon_or_star'] = $GLOBALS['egw_info']['server']['webserver_url'].$this->template_dir.'/images/bullet.png'; |
|
624 | 624 | $var['target'] = ''; |
625 | - if(is_array($item_link)) |
|
625 | + if (is_array($item_link)) |
|
626 | 626 | { |
627 | - if(isset($item_link['icon'])) |
|
627 | + if (isset($item_link['icon'])) |
|
628 | 628 | { |
629 | 629 | $app = isset($item_link['app']) ? $item_link['app'] : $appname; |
630 | - $var['icon_or_star'] = $item_link['icon'] ? Api\Image::find($app,$item_link['icon']) : False; |
|
630 | + $var['icon_or_star'] = $item_link['icon'] ? Api\Image::find($app, $item_link['icon']) : False; |
|
631 | 631 | } |
632 | 632 | $var['lang_item'] = isset($item_link['no_lang']) && $item_link['no_lang'] ? $item_link['text'] : lang($item_link['text']); |
633 | 633 | $var['item_link'] = $item_link['link']; |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | public static function ajax_tab_changed_state($tablist) |
664 | 664 | { |
665 | 665 | $tabs = array(); |
666 | - foreach($tablist as $data) |
|
666 | + foreach ($tablist as $data) |
|
667 | 667 | { |
668 | 668 | $tabs[] = $data['appName']; |
669 | 669 | if ($data['active']) $active = $data['appName']; |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | // used eg. in phpFreeChat to leave the chat |
673 | 673 | if (($old_tabs = Api\Cache::getSession(__CLASS__, 'open_tabs'))) |
674 | 674 | { |
675 | - foreach(array_diff(explode(',',$old_tabs),$tabs) as $app) |
|
675 | + foreach (array_diff(explode(',', $old_tabs), $tabs) as $app) |
|
676 | 676 | { |
677 | 677 | //error_log("Tab '$app' closed, old_tabs=$old_tabs"); |
678 | 678 | Api\Hooks::single(array( |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | ), $app); |
682 | 682 | } |
683 | 683 | } |
684 | - $open = implode(',',$tabs); |
|
684 | + $open = implode(',', $tabs); |
|
685 | 685 | |
686 | 686 | if ($open != $GLOBALS['egw_info']['user']['preferences']['common']['open_tabs'] || |
687 | 687 | $active != $GLOBALS['egw_info']['user']['preferences']['common']['active_tab']) |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | $i = 0; |
749 | 749 | |
750 | 750 | //Parse the "$apps" array for valid content (security) |
751 | - foreach($apps as $app) |
|
751 | + foreach ($apps as $app) |
|
752 | 752 | { |
753 | 753 | //Check whether the app really exists and add it to the $app_arr var |
754 | 754 | if ($GLOBALS['egw_info']['user']['apps'][$app]) |
@@ -779,17 +779,17 @@ discard block |
||
779 | 779 | */ |
780 | 780 | public function navbar_apps() |
781 | 781 | { |
782 | - $apps = parent::_get_navbar_apps(Api\Image::svg_usable()); // use svg if usable in browser |
|
782 | + $apps = parent::_get_navbar_apps(Api\Image::svg_usable()); // use svg if usable in browser |
|
783 | 783 | |
784 | 784 | //Add its sidebox width to each app |
785 | 785 | foreach ($apps as $app => &$data) |
786 | 786 | { |
787 | 787 | $data['sideboxwidth'] = self::get_sidebar_width($app); |
788 | 788 | // overwrite icon with svg, if supported by browser |
789 | - unset($data['icon_hover']); // not used in jdots |
|
789 | + unset($data['icon_hover']); // not used in jdots |
|
790 | 790 | } |
791 | 791 | |
792 | - unset($apps['logout']); // never display it |
|
792 | + unset($apps['logout']); // never display it |
|
793 | 793 | if (isset($apps['about'])) $apps['about']['noNavbar'] = true; |
794 | 794 | if (isset($apps['preferences'])) $apps['preferences']['noNavbar'] = true; |
795 | 795 | if (isset($apps['manual'])) $apps['manual']['noNavbar'] = true; |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | } |
840 | 840 | |
841 | 841 | // check if user called a specific url --> open it as active tab |
842 | - $last_direct_url =& Api\Cache::getSession(__CLASS__, 'last_direct_url'); |
|
842 | + $last_direct_url = & Api\Cache::getSession(__CLASS__, 'last_direct_url'); |
|
843 | 843 | if ($url !== $last_direct_url) |
844 | 844 | { |
845 | 845 | $active_tab = $url_tab = self::app_from_url($url); |
@@ -852,9 +852,9 @@ discard block |
||
852 | 852 | if ($active_tab && array_key_exists($active_tab, $apps)) |
853 | 853 | { |
854 | 854 | // Do not remove cd=yes if it's an ajax=true app |
855 | - if (strpos( $apps[$active_tab]['url'],'ajax=true') !== False) |
|
855 | + if (strpos($apps[$active_tab]['url'], 'ajax=true') !== False) |
|
856 | 856 | { |
857 | - $url = preg_replace('/[&?]cd=yes/','',$url); |
|
857 | + $url = preg_replace('/[&?]cd=yes/', '', $url); |
|
858 | 858 | } |
859 | 859 | $apps[$active_tab]['openOnce'] = $url; |
860 | 860 | $store_prefs = true; |
@@ -869,8 +869,8 @@ discard block |
||
869 | 869 | { |
870 | 870 | $open_tabs = $GLOBALS['egw_info']['user']['preferences']['common']['open_tabs']; |
871 | 871 | } |
872 | - $open_tabs = $open_tabs ? explode(',',$open_tabs) : array(); |
|
873 | - if ($active_tab && !in_array($active_tab,$open_tabs)) |
|
872 | + $open_tabs = $open_tabs ? explode(',', $open_tabs) : array(); |
|
873 | + if ($active_tab && !in_array($active_tab, $open_tabs)) |
|
874 | 874 | { |
875 | 875 | $open_tabs[] = $active_tab; |
876 | 876 | $store_prefs = true; |
@@ -878,14 +878,14 @@ discard block |
||
878 | 878 | if ($store_prefs) |
879 | 879 | { |
880 | 880 | $GLOBALS['egw']->preferences->read_repository(); |
881 | - $GLOBALS['egw']->preferences->add('common', 'open_tabs', implode(',',$open_tabs)); |
|
881 | + $GLOBALS['egw']->preferences->add('common', 'open_tabs', implode(',', $open_tabs)); |
|
882 | 882 | $GLOBALS['egw']->preferences->add('common', 'active_tab', $active_tab); |
883 | 883 | $GLOBALS['egw']->preferences->save_repository(true); |
884 | 884 | } |
885 | 885 | |
886 | 886 | //error_log(__METHOD__."('$url') url_tab='$url_tab', active_tab=$active_tab, open_tabs=".array2string($open_tabs)); |
887 | 887 | // Restore Tabs |
888 | - foreach($open_tabs as $n => $app) |
|
888 | + foreach ($open_tabs as $n => $app) |
|
889 | 889 | { |
890 | 890 | if (isset($apps[$app])) // user might no longer have app rights |
891 | 891 | { |
@@ -912,10 +912,10 @@ discard block |
||
912 | 912 | * @param boolean $no_framework = true |
913 | 913 | * @return string |
914 | 914 | */ |
915 | - function footer($no_framework=true) |
|
915 | + function footer($no_framework = true) |
|
916 | 916 | { |
917 | 917 | //error_log(__METHOD__."($no_framework) footer_done=".array2string(self::$footer_done).' '.function_backtrace()); |
918 | - if (self::$footer_done) return; // prevent (multiple) footers |
|
918 | + if (self::$footer_done) return; // prevent (multiple) footers |
|
919 | 919 | self::$footer_done = true; |
920 | 920 | |
921 | 921 | if (!isset($GLOBALS['egw_info']['flags']['nofooter']) || !$GLOBALS['egw_info']['flags']['nofooter']) |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | } |
928 | 928 | } |
929 | 929 | return $footer. |
930 | - $GLOBALS['egw_info']['flags']['need_footer']."\n". // eg. javascript, which need to be at the end of the page |
|
930 | + $GLOBALS['egw_info']['flags']['need_footer']."\n".// eg. javascript, which need to be at the end of the page |
|
931 | 931 | "</body>\n</html>\n"; |
932 | 932 | } |
933 | 933 | |
@@ -965,15 +965,15 @@ discard block |
||
965 | 965 | if ($parts['query']) |
966 | 966 | { |
967 | 967 | $_SERVER['REQUEST_URI'] = '?'.$parts['query']; |
968 | - parse_str($parts['query'],$_GET); |
|
969 | - $_REQUEST = $_GET; // some apps use $_REQUEST to check $_GET or $_POST |
|
968 | + parse_str($parts['query'], $_GET); |
|
969 | + $_REQUEST = $_GET; // some apps use $_REQUEST to check $_GET or $_POST |
|
970 | 970 | } |
971 | 971 | |
972 | 972 | if (!isset($_GET['menuaction'])) |
973 | 973 | { |
974 | 974 | throw new Api\Exception\WrongParameter(__METHOD__."('$link') no menuaction set!"); |
975 | 975 | } |
976 | - list($app,$class,$method) = explode('.',$_GET['menuaction']); |
|
976 | + list($app, $class, $method) = explode('.', $_GET['menuaction']); |
|
977 | 977 | |
978 | 978 | if (!isset($GLOBALS['egw_info']['user']['apps'][$app])) |
979 | 979 | { |
@@ -985,7 +985,7 @@ discard block |
||
985 | 985 | |
986 | 986 | $GLOBALS[$class] = $obj = CreateObject($app.'.'.$class); |
987 | 987 | |
988 | - if(!is_array($obj->public_functions) || !$obj->public_functions[$method]) |
|
988 | + if (!is_array($obj->public_functions) || !$obj->public_functions[$method]) |
|
989 | 989 | { |
990 | 990 | throw new Api\Exception\NoPermission("Bad menuaction {$_GET['menuaction']}, not listed in public_functions!"); |
991 | 991 | } |
@@ -103,11 +103,6 @@ |
||
103 | 103 | /** |
104 | 104 | * Add menu items to the topmenu template class to be displayed |
105 | 105 | * |
106 | - * @param array $app application data |
|
107 | - * @param mixed $alt_label string with alternative menu item label default value = null |
|
108 | - * @param string $urlextra string with alternate additional code inside <a>-tag |
|
109 | - * @access protected |
|
110 | - * @return void |
|
111 | 106 | */ |
112 | 107 | function _add_topmenu_item(array $app_data,$alt_label=null) |
113 | 108 | { |
@@ -104,7 +104,9 @@ discard block |
||
104 | 104 | |
105 | 105 | //Width may not be smaller than MIN_SIDEBAR_WIDTH |
106 | 106 | if ($width < self::MIN_SIDEBAR_WIDTH) |
107 | - $width = self::MIN_SIDEBAR_WIDTH; |
|
107 | + { |
|
108 | + $width = self::MIN_SIDEBAR_WIDTH; |
|
109 | + } |
|
108 | 110 | |
109 | 111 | return $width; |
110 | 112 | } |
@@ -156,7 +158,10 @@ discard block |
||
156 | 158 | */ |
157 | 159 | static function link($url = '', $extravars = '', $link_app=null) |
158 | 160 | { |
159 | - if (is_null($link_app)) $link_app = self::$link_app; |
|
161 | + if (is_null($link_app)) |
|
162 | + { |
|
163 | + $link_app = self::$link_app; |
|
164 | + } |
|
160 | 165 | $link = parent::link($url, $extravars); |
161 | 166 | |
162 | 167 | // $link_app === true --> detect application, otherwise use given application |
@@ -185,7 +190,10 @@ discard block |
||
185 | 190 | $srcs = array(); |
186 | 191 | foreach(Api\Hooks::process('csp-frame-src') as $src) |
187 | 192 | { |
188 | - if ($src) $srcs = array_merge($srcs, $src); |
|
193 | + if ($src) |
|
194 | + { |
|
195 | + $srcs = array_merge($srcs, $src); |
|
196 | + } |
|
189 | 197 | } |
190 | 198 | return $srcs; |
191 | 199 | } |
@@ -199,7 +207,10 @@ discard block |
||
199 | 207 | function header(array $extra=array()) |
200 | 208 | { |
201 | 209 | // make sure header is output only once |
202 | - if (self::$header_done) return ''; |
|
210 | + if (self::$header_done) |
|
211 | + { |
|
212 | + return ''; |
|
213 | + } |
|
203 | 214 | self::$header_done = true; |
204 | 215 | |
205 | 216 | $this->send_headers(); |
@@ -266,7 +277,10 @@ discard block |
||
266 | 277 | // for remote manual never check/create framework |
267 | 278 | if (!in_array($GLOBALS['egw_info']['flags']['currentapp'], array('manual', 'login', 'logout', 'sitemgr'))) |
268 | 279 | { |
269 | - if (empty($GLOBALS['egw_info']['flags']['java_script'])) $GLOBALS['egw_info']['flags']['java_script']=''; |
|
280 | + if (empty($GLOBALS['egw_info']['flags']['java_script'])) |
|
281 | + { |
|
282 | + $GLOBALS['egw_info']['flags']['java_script']=''; |
|
283 | + } |
|
270 | 284 | $extra['check-framework'] = $_GET['cd'] !== 'no'; |
271 | 285 | } |
272 | 286 | } |
@@ -539,7 +553,10 @@ discard block |
||
539 | 553 | */ |
540 | 554 | public function sidebox($appname,$menu_title,$file,$type=null) |
541 | 555 | { |
542 | - if (!isset($file['menuOpened'])) $file['menuOpened'] = (boolean)$this->sidebox_menu_opened; |
|
556 | + if (!isset($file['menuOpened'])) |
|
557 | + { |
|
558 | + $file['menuOpened'] = (boolean)$this->sidebox_menu_opened; |
|
559 | + } |
|
543 | 560 | //error_log(__METHOD__."('$appname', '$menu_title', file[menuOpened]=$file[menuOpened], ...) this->sidebox_menu_opened=$this->sidebox_menu_opened"); |
544 | 561 | $this->sidebox_menu_opened = false; |
545 | 562 | |
@@ -666,7 +683,10 @@ discard block |
||
666 | 683 | foreach($tablist as $data) |
667 | 684 | { |
668 | 685 | $tabs[] = $data['appName']; |
669 | - if ($data['active']) $active = $data['appName']; |
|
686 | + if ($data['active']) |
|
687 | + { |
|
688 | + $active = $data['appName']; |
|
689 | + } |
|
670 | 690 | } |
671 | 691 | // send app a notification, that it's tab got closed |
672 | 692 | // used eg. in phpFreeChat to leave the chat |
@@ -790,10 +810,22 @@ discard block |
||
790 | 810 | } |
791 | 811 | |
792 | 812 | unset($apps['logout']); // never display it |
793 | - if (isset($apps['about'])) $apps['about']['noNavbar'] = true; |
|
794 | - if (isset($apps['preferences'])) $apps['preferences']['noNavbar'] = true; |
|
795 | - if (isset($apps['manual'])) $apps['manual']['noNavbar'] = true; |
|
796 | - if (isset($apps['home'])) $apps['home']['noNavbar'] = true; |
|
813 | + if (isset($apps['about'])) |
|
814 | + { |
|
815 | + $apps['about']['noNavbar'] = true; |
|
816 | + } |
|
817 | + if (isset($apps['preferences'])) |
|
818 | + { |
|
819 | + $apps['preferences']['noNavbar'] = true; |
|
820 | + } |
|
821 | + if (isset($apps['manual'])) |
|
822 | + { |
|
823 | + $apps['manual']['noNavbar'] = true; |
|
824 | + } |
|
825 | + if (isset($apps['home'])) |
|
826 | + { |
|
827 | + $apps['home']['noNavbar'] = true; |
|
828 | + } |
|
797 | 829 | |
798 | 830 | // no need for website icon, if we have sitemgr |
799 | 831 | if (isset($apps['sitemgr']) && isset($apps['sitemgr-link'])) |
@@ -862,7 +894,10 @@ discard block |
||
862 | 894 | else |
863 | 895 | { |
864 | 896 | $active_tab = $GLOBALS['egw_info']['user']['preferences']['common']['active_tab']; |
865 | - if (!$active_tab) $active_tab = $default_app; |
|
897 | + if (!$active_tab) |
|
898 | + { |
|
899 | + $active_tab = $default_app; |
|
900 | + } |
|
866 | 901 | } |
867 | 902 | // if we have the open tabs in the session, use it instead the maybe forced common prefs open_tabs |
868 | 903 | if (!($open_tabs = Api\Cache::getSession(__CLASS__, 'open_tabs'))) |
@@ -887,9 +922,12 @@ discard block |
||
887 | 922 | // Restore Tabs |
888 | 923 | foreach($open_tabs as $n => $app) |
889 | 924 | { |
890 | - if (isset($apps[$app])) // user might no longer have app rights |
|
925 | + if (isset($apps[$app])) |
|
926 | + { |
|
927 | + // user might no longer have app rights |
|
891 | 928 | { |
892 | 929 | $apps[$app]['opened'] = $n; |
930 | + } |
|
893 | 931 | if ($app == $active_tab) |
894 | 932 | { |
895 | 933 | $apps[$app]['active'] = true; |
@@ -915,7 +953,11 @@ discard block |
||
915 | 953 | function footer($no_framework=true) |
916 | 954 | { |
917 | 955 | //error_log(__METHOD__."($no_framework) footer_done=".array2string(self::$footer_done).' '.function_backtrace()); |
918 | - if (self::$footer_done) return; // prevent (multiple) footers |
|
956 | + if (self::$footer_done) |
|
957 | + { |
|
958 | + return; |
|
959 | + } |
|
960 | + // prevent (multiple) footers |
|
919 | 961 | self::$footer_done = true; |
920 | 962 | |
921 | 963 | if (!isset($GLOBALS['egw_info']['flags']['nofooter']) || !$GLOBALS['egw_info']['flags']['nofooter']) |