@@ -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, |
@@ -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,29 +44,29 @@ 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')); |
|
69 | + $tmpl->set_var('lang_password', lang('password')); |
|
70 | 70 | |
71 | 71 | // display login-message depending on $_GET[cd] and what's in database/header for "login_message" |
72 | 72 | $cd_msg = self::check_logoutcode($_GET['cd']); |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | } |
88 | 88 | else |
89 | 89 | { |
90 | - $tmpl->set_var('lang_password',lang('Old password')); |
|
91 | - $tmpl->set_var('lang_new_password',lang('New password')); |
|
92 | - $tmpl->set_var('lang_repeat_password',lang('Repeat password')); |
|
90 | + $tmpl->set_var('lang_password', lang('Old password')); |
|
91 | + $tmpl->set_var('lang_new_password', lang('New password')); |
|
92 | + $tmpl->set_var('lang_repeat_password', lang('Repeat password')); |
|
93 | 93 | $tmpl->set_var('cd', $change_passwd); |
94 | 94 | $tmpl->set_var('cd_class', 'error'); |
95 | 95 | $last_loginid = $_POST['login']; |
@@ -98,55 +98,55 @@ discard block |
||
98 | 98 | $tmpl->set_var('autofocus_login', ''); |
99 | 99 | $tmpl->set_var('autofocus_new_passwd', 'autofocus'); |
100 | 100 | } |
101 | - if($GLOBALS['egw_info']['server']['show_domain_selectbox']) |
|
101 | + if ($GLOBALS['egw_info']['server']['show_domain_selectbox']) |
|
102 | 102 | { |
103 | - foreach(array_keys($GLOBALS['egw_domain']) as $domain) |
|
103 | + foreach (array_keys($GLOBALS['egw_domain']) as $domain) |
|
104 | 104 | { |
105 | 105 | $domains[$domain] = $domain; |
106 | 106 | } |
107 | 107 | $tmpl->set_var(array( |
108 | 108 | 'lang_domain' => lang('domain'), |
109 | - 'select_domain' => Api\Html::select('logindomain',$last_domain,$domains,true,'tabindex="2"',0,false), |
|
109 | + 'select_domain' => Api\Html::select('logindomain', $last_domain, $domains, true, 'tabindex="2"', 0, false), |
|
110 | 110 | )); |
111 | 111 | } |
112 | 112 | else |
113 | 113 | { |
114 | 114 | /* trick to make domain section disapear */ |
115 | - $tmpl->set_block('login_form','domain_selection'); |
|
116 | - $tmpl->set_var('domain_selection',$GLOBALS['egw_info']['user']['domain'] ? |
|
117 | - Api\Html::input_hidden('logindomain',$GLOBALS['egw_info']['user']['domain']) : ''); |
|
115 | + $tmpl->set_block('login_form', 'domain_selection'); |
|
116 | + $tmpl->set_var('domain_selection', $GLOBALS['egw_info']['user']['domain'] ? |
|
117 | + Api\Html::input_hidden('logindomain', $GLOBALS['egw_info']['user']['domain']) : ''); |
|
118 | 118 | |
119 | - if($last_loginid !== '') |
|
119 | + if ($last_loginid !== '') |
|
120 | 120 | { |
121 | 121 | reset($GLOBALS['egw_domain']); |
122 | 122 | list($default_domain) = each($GLOBALS['egw_domain']); |
123 | 123 | |
124 | - if(!empty ($last_domain) && $last_domain != $default_domain) |
|
124 | + if (!empty ($last_domain) && $last_domain != $default_domain) |
|
125 | 125 | { |
126 | - $last_loginid .= '@' . $last_domain; |
|
126 | + $last_loginid .= '@'.$last_domain; |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | 131 | $config_reg = Api\Config::read('registration'); |
132 | 132 | |
133 | - if($config_reg['enable_registration']) |
|
133 | + if ($config_reg['enable_registration']) |
|
134 | 134 | { |
135 | 135 | if ($config_reg['register_link']) |
136 | 136 | { |
137 | - $reg_link=' <a href="'. $this->framework->link('/registration/index.php','lang_code='.$_GET['lang']). '">'.lang('Not a user yet? Register now').'</a><br/>'; |
|
137 | + $reg_link = ' <a href="'.$this->framework->link('/registration/index.php', 'lang_code='.$_GET['lang']).'">'.lang('Not a user yet? Register now').'</a><br/>'; |
|
138 | 138 | } |
139 | 139 | if ($config_reg['lostpassword_link']) |
140 | 140 | { |
141 | - $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/>'; |
|
141 | + $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/>'; |
|
142 | 142 | } |
143 | 143 | if ($config_reg['lostid_link']) |
144 | 144 | { |
145 | - $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/>'; |
|
145 | + $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/>'; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /* if at least one option of "registration" is activated display the registration section */ |
149 | - if($config_reg['register_link'] || $config_reg['lostpassword_link'] || $config_reg['lostid_link'] ) |
|
149 | + if ($config_reg['register_link'] || $config_reg['lostpassword_link'] || $config_reg['lostid_link']) |
|
150 | 150 | { |
151 | 151 | $tmpl->set_var(array( |
152 | 152 | 'register_link' => $reg_link, |
@@ -157,20 +157,20 @@ discard block |
||
157 | 157 | else |
158 | 158 | { |
159 | 159 | /* trick to make registration section disapear */ |
160 | - $tmpl->set_block('login_form','registration'); |
|
161 | - $tmpl->set_var('registration',''); |
|
160 | + $tmpl->set_block('login_form', 'registration'); |
|
161 | + $tmpl->set_var('registration', ''); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | - $tmpl->set_var('login_url', $GLOBALS['egw_info']['server']['webserver_url'] . '/login.php' . $extra_vars); |
|
165 | + $tmpl->set_var('login_url', $GLOBALS['egw_info']['server']['webserver_url'].'/login.php'.$extra_vars); |
|
166 | 166 | $tmpl->set_var('version', $GLOBALS['egw_info']['server']['versions']['phpgwapi']); |
167 | 167 | $tmpl->set_var('login', $last_loginid); |
168 | 168 | |
169 | - $tmpl->set_var('lang_username',lang('username')); |
|
170 | - $tmpl->set_var('lang_login',lang('login')); |
|
169 | + $tmpl->set_var('lang_username', lang('username')); |
|
170 | + $tmpl->set_var('lang_login', lang('login')); |
|
171 | 171 | |
172 | 172 | $tmpl->set_var('website_title', $GLOBALS['egw_info']['server']['site_title']); |
173 | - $tmpl->set_var('template_set',$this->framework->template); |
|
173 | + $tmpl->set_var('template_set', $this->framework->template); |
|
174 | 174 | |
175 | 175 | if (substr($GLOBALS['egw_info']['server']['login_logo_file'], 0, 4) == 'http' || |
176 | 176 | $GLOBALS['egw_info']['server']['login_logo_file'][0] == '/') |
@@ -179,14 +179,14 @@ discard block |
||
179 | 179 | } |
180 | 180 | else |
181 | 181 | { |
182 | - $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 |
|
182 | + $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 |
|
183 | 183 | } |
184 | - $var['logo_url'] = $GLOBALS['egw_info']['server']['login_logo_url']?$GLOBALS['egw_info']['server']['login_logo_url']:'http://www.egroupware.org'; |
|
185 | - if (substr($var['logo_url'],0,4) != 'http') |
|
184 | + $var['logo_url'] = $GLOBALS['egw_info']['server']['login_logo_url'] ? $GLOBALS['egw_info']['server']['login_logo_url'] : 'http://www.egroupware.org'; |
|
185 | + if (substr($var['logo_url'], 0, 4) != 'http') |
|
186 | 186 | { |
187 | 187 | $var['logo_url'] = 'http://'.$var['logo_url']; |
188 | 188 | } |
189 | - $var['logo_title'] = $GLOBALS['egw_info']['server']['login_logo_title']?$GLOBALS['egw_info']['server']['login_logo_title']:'www.eGroupWare.org'; |
|
189 | + $var['logo_title'] = $GLOBALS['egw_info']['server']['login_logo_title'] ? $GLOBALS['egw_info']['server']['login_logo_title'] : 'www.eGroupWare.org'; |
|
190 | 190 | $tmpl->set_var($var); |
191 | 191 | |
192 | 192 | /* language section if activated in site Config */ |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | { |
195 | 195 | $tmpl->set_var(array( |
196 | 196 | 'lang_language' => lang('Language'), |
197 | - 'select_language' => Api\Html::select('lang',$GLOBALS['egw_info']['user']['preferences']['common']['lang'], |
|
198 | - Api\Translation::get_installed_langs(),true,'tabindex="1"',0,false), |
|
197 | + 'select_language' => Api\Html::select('lang', $GLOBALS['egw_info']['user']['preferences']['common']['lang'], |
|
198 | + Api\Translation::get_installed_langs(), true, 'tabindex="1"', 0, false), |
|
199 | 199 | )); |
200 | 200 | } |
201 | 201 | else |
202 | 202 | { |
203 | - $tmpl->set_block('login_form','language_select'); |
|
204 | - $tmpl->set_var('language_select',''); |
|
203 | + $tmpl->set_block('login_form', 'language_select'); |
|
204 | + $tmpl->set_var('language_select', ''); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /********************************************************\ |
@@ -209,31 +209,31 @@ discard block |
||
209 | 209 | * and place a time selectbox, how long cookie is valid * |
210 | 210 | \********************************************************/ |
211 | 211 | |
212 | - if($GLOBALS['egw_info']['server']['allow_cookie_auth']) |
|
212 | + if ($GLOBALS['egw_info']['server']['allow_cookie_auth']) |
|
213 | 213 | { |
214 | - $tmpl->set_block('login_form','remember_me_selection'); |
|
215 | - $tmpl->set_var('lang_remember_me',lang('Remember me')); |
|
216 | - $tmpl->set_var('select_remember_me',Api\Html::select('remember_me', '', array( |
|
214 | + $tmpl->set_block('login_form', 'remember_me_selection'); |
|
215 | + $tmpl->set_var('lang_remember_me', lang('Remember me')); |
|
216 | + $tmpl->set_var('select_remember_me', Api\Html::select('remember_me', '', array( |
|
217 | 217 | '' => lang('not'), |
218 | 218 | '1hour' => lang('1 Hour'), |
219 | 219 | '1day' => lang('1 Day'), |
220 | 220 | '1week'=> lang('1 Week'), |
221 | 221 | '1month' => lang('1 Month'), |
222 | 222 | 'forever' => lang('Forever'), |
223 | - ),true,'tabindex="3"',0,false)); |
|
223 | + ), true, 'tabindex="3"', 0, false)); |
|
224 | 224 | } |
225 | 225 | else |
226 | 226 | { |
227 | 227 | /* trick to make remember_me section disapear */ |
228 | - $tmpl->set_block('login_form','remember_me_selection'); |
|
229 | - $tmpl->set_var('remember_me_selection',''); |
|
228 | + $tmpl->set_block('login_form', 'remember_me_selection'); |
|
229 | + $tmpl->set_var('remember_me_selection', ''); |
|
230 | 230 | } |
231 | 231 | $tmpl->set_var('autocomplete', ($GLOBALS['egw_info']['server']['autocomplete_login'] ? 'autocomplete="off"' : '')); |
232 | 232 | |
233 | 233 | // load jquery for login screen too |
234 | 234 | Api\Framework::includeJS('jquery', 'jquery'); |
235 | 235 | |
236 | - $this->framework->render($tmpl->fp('loginout','login_form'),false,false); |
|
236 | + $this->framework->render($tmpl->fp('loginout', 'login_form'), false, false); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $tmpl = new Template(EGW_SERVER_ROOT.$this->framework->template_dir); |
246 | 246 | $tmpl->set_file(array('login_form' => 'login_denylogin.tpl')); |
247 | 247 | } |
248 | - catch(Api\Exception\WrongParameter $e) { |
|
248 | + catch (Api\Exception\WrongParameter $e) { |
|
249 | 249 | unset($e); |
250 | 250 | $tmpl = new Template(EGW_SERVER_ROOT.'/api/templates/default'); |
251 | 251 | $tmpl->set_file(array('login_form' => 'login_denylogin.tpl')); |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | // load jquery for deny-login screen too |
261 | 261 | Api\Framework::includeJS('jquery', 'jquery'); |
262 | 262 | |
263 | - $this->framework->render($tmpl->fp('loginout','login_form'),false,false); |
|
263 | + $this->framework->render($tmpl->fp('loginout', 'login_form'), false, false); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | */ |
272 | 272 | static function check_logoutcode($code) |
273 | 273 | { |
274 | - switch($code) |
|
274 | + switch ($code) |
|
275 | 275 | { |
276 | 276 | case 1: |
277 | 277 | return lang('You have been successfully logged out'); |
@@ -21,29 +21,29 @@ discard block |
||
21 | 21 | class Minimal extends Api\Framework |
22 | 22 | { |
23 | 23 | /** |
24 | - * Instance of the phplib Template class for the API's template dir (EGW_TEMPLATE_DIR) |
|
25 | - * |
|
26 | - * @var Template |
|
27 | - */ |
|
24 | + * Instance of the phplib Template class for the API's template dir (EGW_TEMPLATE_DIR) |
|
25 | + * |
|
26 | + * @var Template |
|
27 | + */ |
|
28 | 28 | var $tpl; |
29 | 29 | |
30 | 30 | /** |
31 | - * Constructor |
|
32 | - * |
|
33 | - * @param string $template ='default' name of the template |
|
34 | - * @return idots_framework |
|
35 | - */ |
|
31 | + * Constructor |
|
32 | + * |
|
33 | + * @param string $template ='default' name of the template |
|
34 | + * @return idots_framework |
|
35 | + */ |
|
36 | 36 | function __construct($template='default') |
37 | 37 | { |
38 | 38 | parent::__construct($template); // call the constructor of the extended class |
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
42 | - * Returns the html-header incl. the opening body tag |
|
43 | - * |
|
44 | - * @param array $extra =array() extra attributes passed as data-attribute to egw.js |
|
45 | - * @return string with html |
|
46 | - */ |
|
42 | + * Returns the html-header incl. the opening body tag |
|
43 | + * |
|
44 | + * @param array $extra =array() extra attributes passed as data-attribute to egw.js |
|
45 | + * @return string with html |
|
46 | + */ |
|
47 | 47 | function header(array $extra=array()) |
48 | 48 | { |
49 | 49 | // make sure header is output only once |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
79 | - * Returns the html from the body-tag til the main application area (incl. opening div tag) |
|
80 | - * |
|
81 | - * @return string with html |
|
82 | - */ |
|
79 | + * Returns the html from the body-tag til the main application area (incl. opening div tag) |
|
80 | + * |
|
81 | + * @return string with html |
|
82 | + */ |
|
83 | 83 | function navbar() |
84 | 84 | { |
85 | 85 | return ''; |
@@ -101,37 +101,37 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
104 | - * Add menu items to the topmenu template class to be displayed |
|
105 | - * |
|
106 | - * @param array $app application data |
|
107 | - * @param mixed $alt_label string with alternative menu item label default value = null |
|
108 | - * @param string $urlextra string with alternate additional code inside <a>-tag |
|
109 | - * @access protected |
|
110 | - * @return void |
|
111 | - */ |
|
104 | + * Add menu items to the topmenu template class to be displayed |
|
105 | + * |
|
106 | + * @param array $app application data |
|
107 | + * @param mixed $alt_label string with alternative menu item label default value = null |
|
108 | + * @param string $urlextra string with alternate additional code inside <a>-tag |
|
109 | + * @access protected |
|
110 | + * @return void |
|
111 | + */ |
|
112 | 112 | function _add_topmenu_item(array $app_data,$alt_label=null) |
113 | 113 | { |
114 | 114 | unset($app_data, $alt_label); |
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | - * Add info items to the topmenu template class to be displayed |
|
119 | - * |
|
120 | - * @param string $content html of item |
|
121 | - * @param string $id =null |
|
122 | - * @access protected |
|
123 | - * @return void |
|
124 | - */ |
|
118 | + * Add info items to the topmenu template class to be displayed |
|
119 | + * |
|
120 | + * @param string $content html of item |
|
121 | + * @param string $id =null |
|
122 | + * @access protected |
|
123 | + * @return void |
|
124 | + */ |
|
125 | 125 | function _add_topmenu_info_item($content, $id=null) |
126 | 126 | { |
127 | 127 | unset($content, $id); |
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
131 | - * Returns the html from the closing div of the main application area to the closing html-tag |
|
132 | - * |
|
133 | - * @return string html or null if no footer needed/wanted |
|
134 | - */ |
|
131 | + * Returns the html from the closing div of the main application area to the closing html-tag |
|
132 | + * |
|
133 | + * @return string html or null if no footer needed/wanted |
|
134 | + */ |
|
135 | 135 | function footer() |
136 | 136 | { |
137 | 137 | static $footer_done=0; |
@@ -141,29 +141,29 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
144 | - * Parses one sidebox menu and add's the html to $this->sidebox_content for later use by $this->navbar |
|
145 | - * |
|
146 | - * @param string $appname |
|
147 | - * @param string $menu_title |
|
148 | - * @param array $file |
|
149 | - * @param string $type =null 'admin', 'preferences', 'favorites', ... |
|
150 | - */ |
|
144 | + * Parses one sidebox menu and add's the html to $this->sidebox_content for later use by $this->navbar |
|
145 | + * |
|
146 | + * @param string $appname |
|
147 | + * @param string $menu_title |
|
148 | + * @param array $file |
|
149 | + * @param string $type =null 'admin', 'preferences', 'favorites', ... |
|
150 | + */ |
|
151 | 151 | function sidebox($appname,$menu_title,$file,$type=null) |
152 | 152 | { |
153 | 153 | unset($appname, $menu_title, $file, $type); |
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
157 | - * called by hooks to add an icon in the topmenu info location |
|
158 | - * |
|
159 | - * @param string $id unique element id |
|
160 | - * @param string $icon_src src of the icon image. Make sure this nog height then 18pixels |
|
161 | - * @param string $iconlink where the icon links to |
|
162 | - * @param booleon $blink set true to make the icon blink |
|
163 | - * @param mixed $tooltip string containing the tooltip html, or null of no tooltip |
|
164 | - * @access public |
|
165 | - * @return void |
|
166 | - */ |
|
157 | + * called by hooks to add an icon in the topmenu info location |
|
158 | + * |
|
159 | + * @param string $id unique element id |
|
160 | + * @param string $icon_src src of the icon image. Make sure this nog height then 18pixels |
|
161 | + * @param string $iconlink where the icon links to |
|
162 | + * @param booleon $blink set true to make the icon blink |
|
163 | + * @param mixed $tooltip string containing the tooltip html, or null of no tooltip |
|
164 | + * @access public |
|
165 | + * @return void |
|
166 | + */ |
|
167 | 167 | function topmenu_info_icon($id,$icon_src,$iconlink,$blink=false,$tooltip=null) |
168 | 168 | { |
169 | 169 | unset($id, $icon_src, $iconlink, $blink, $tooltip); |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | * @param string $template ='default' name of the template |
34 | 34 | * @return idots_framework |
35 | 35 | */ |
36 | - function __construct($template='default') |
|
36 | + function __construct($template = 'default') |
|
37 | 37 | { |
38 | - parent::__construct($template); // call the constructor of the extended class |
|
38 | + parent::__construct($template); // call the constructor of the extended class |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param array $extra =array() extra attributes passed as data-attribute to egw.js |
45 | 45 | * @return string with html |
46 | 46 | */ |
47 | - function header(array $extra=array()) |
|
47 | + function header(array $extra = array()) |
|
48 | 48 | { |
49 | 49 | // make sure header is output only once |
50 | 50 | if (self::$header_done) return ''; |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | // as the old Template class has problems if restored from the session (php-restore) |
67 | 67 | $this->tpl = new Template(EGW_SERVER_ROOT.$this->template_dir, 'keep'); |
68 | 68 | $this->tpl->set_file(array('_head' => 'head.tpl')); |
69 | - $this->tpl->set_block('_head','head'); |
|
69 | + $this->tpl->set_block('_head', 'head'); |
|
70 | 70 | |
71 | 71 | $this->tpl->set_var($this->_get_header($extra)); |
72 | 72 | |
73 | - $content .= $this->tpl->fp('out','head'); |
|
73 | + $content .= $this->tpl->fp('out', 'head'); |
|
74 | 74 | |
75 | 75 | return $content; |
76 | 76 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @return boolean $consider_navbar_not_yet_called_as_true=true |
94 | 94 | * @return boolean |
95 | 95 | */ |
96 | - public function isTop($consider_navbar_not_yet_called_as_true=true) |
|
96 | + public function isTop($consider_navbar_not_yet_called_as_true = true) |
|
97 | 97 | { |
98 | 98 | unset($consider_navbar_not_yet_called_as_true); |
99 | 99 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @access protected |
110 | 110 | * @return void |
111 | 111 | */ |
112 | - function _add_topmenu_item(array $app_data,$alt_label=null) |
|
112 | + function _add_topmenu_item(array $app_data, $alt_label = null) |
|
113 | 113 | { |
114 | 114 | unset($app_data, $alt_label); |
115 | 115 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @access protected |
123 | 123 | * @return void |
124 | 124 | */ |
125 | - function _add_topmenu_info_item($content, $id=null) |
|
125 | + function _add_topmenu_info_item($content, $id = null) |
|
126 | 126 | { |
127 | 127 | unset($content, $id); |
128 | 128 | } |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | */ |
135 | 135 | function footer() |
136 | 136 | { |
137 | - static $footer_done=0; |
|
138 | - if ($footer_done++) return; // prevent multiple footers, not sure we still need this (RalfBecker) |
|
137 | + static $footer_done = 0; |
|
138 | + if ($footer_done++) return; // prevent multiple footers, not sure we still need this (RalfBecker) |
|
139 | 139 | |
140 | - return "</body>\n</html>\n"; // close body and html tag, eg. for popups |
|
140 | + return "</body>\n</html>\n"; // close body and html tag, eg. for popups |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param array $file |
149 | 149 | * @param string $type =null 'admin', 'preferences', 'favorites', ... |
150 | 150 | */ |
151 | - function sidebox($appname,$menu_title,$file,$type=null) |
|
151 | + function sidebox($appname, $menu_title, $file, $type = null) |
|
152 | 152 | { |
153 | 153 | unset($appname, $menu_title, $file, $type); |
154 | 154 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @access public |
165 | 165 | * @return void |
166 | 166 | */ |
167 | - function topmenu_info_icon($id,$icon_src,$iconlink,$blink=false,$tooltip=null) |
|
167 | + function topmenu_info_icon($id, $icon_src, $iconlink, $blink = false, $tooltip = null) |
|
168 | 168 | { |
169 | 169 | unset($id, $icon_src, $iconlink, $blink, $tooltip); |
170 | 170 | } |
@@ -47,7 +47,10 @@ discard block |
||
47 | 47 | function header(array $extra=array()) |
48 | 48 | { |
49 | 49 | // make sure header is output only once |
50 | - if (self::$header_done) return ''; |
|
50 | + if (self::$header_done) |
|
51 | + { |
|
52 | + return ''; |
|
53 | + } |
|
51 | 54 | self::$header_done = true; |
52 | 55 | |
53 | 56 | // js stuff is not needed by login page or in popups |
@@ -135,7 +138,11 @@ discard block |
||
135 | 138 | function footer() |
136 | 139 | { |
137 | 140 | static $footer_done=0; |
138 | - if ($footer_done++) return; // prevent multiple footers, not sure we still need this (RalfBecker) |
|
141 | + if ($footer_done++) |
|
142 | + { |
|
143 | + return; |
|
144 | + } |
|
145 | + // prevent multiple footers, not sure we still need this (RalfBecker) |
|
139 | 146 | |
140 | 147 | return "</body>\n</html>\n"; // close body and html tag, eg. for popups |
141 | 148 | } |
@@ -356,11 +356,6 @@ |
||
356 | 356 | /** |
357 | 357 | * Add menu items to the topmenu template class to be displayed |
358 | 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 | 359 | */ |
365 | 360 | function _add_topmenu_item(array $app_data,$alt_label=null) |
366 | 361 | { |
@@ -59,7 +59,7 @@ |
||
59 | 59 | { |
60 | 60 | if (!isset(self::$backend)) |
61 | 61 | { |
62 | - foreach(self::$backends as $class) |
|
62 | + foreach (self::$backends as $class) |
|
63 | 63 | { |
64 | 64 | if (class_exists($class)) |
65 | 65 | { |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @param boolean $set =null |
40 | 40 | * @return boolean |
41 | 41 | */ |
42 | - public static function isJSONRequest($set=null) |
|
42 | + public static function isJSONRequest($set = null) |
|
43 | 43 | { |
44 | 44 | $ret = self::$_hadJSONRequest; |
45 | 45 | if (isset($set)) self::$_hadJSONRequest = $set; |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | |
63 | 63 | if (get_magic_quotes_gpc()) $input_data = stripslashes($input_data); |
64 | 64 | |
65 | - $json_data = json_decode($input_data,true); |
|
65 | + $json_data = json_decode($input_data, true); |
|
66 | 66 | if (is_array($json_data) && isset($json_data['request']) && isset($json_data['request']['parameters']) && is_array($json_data['request']['parameters'])) |
67 | 67 | { |
68 | 68 | //error_log(__METHOD__.__LINE__.array2string($json_data['request']).function_backtrace()); |
69 | - $parameters =& $json_data['request']['parameters']; |
|
69 | + $parameters = & $json_data['request']['parameters']; |
|
70 | 70 | } |
71 | 71 | else |
72 | 72 | { |
@@ -77,14 +77,14 @@ discard block |
||
77 | 77 | { |
78 | 78 | $responses = array(); |
79 | 79 | $response = Response::get(); |
80 | - foreach($parameters[0] as $uid => $data) |
|
80 | + foreach ($parameters[0] as $uid => $data) |
|
81 | 81 | { |
82 | 82 | //error_log("$uid: menuaction=$data[menuaction], parameters=".array2string($data['parameters'])); |
83 | 83 | $this->handleRequest($data['menuaction'], (array)$data['parameters']); |
84 | 84 | $responses[$uid] = $response->initResponseArray(); |
85 | 85 | //error_log("responses[$uid]=".array2string($responses[$uid])); |
86 | 86 | } |
87 | - $response->data($responses); // send all responses as data |
|
87 | + $response->data($responses); // send all responses as data |
|
88 | 88 | } |
89 | 89 | else |
90 | 90 | { |
@@ -100,32 +100,32 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function handleRequest($menuaction, array $parameters) |
102 | 102 | { |
103 | - if (strpos($menuaction,'::') !== false && strpos($menuaction,'.') === false) // static method name app_something::method |
|
103 | + if (strpos($menuaction, '::') !== false && strpos($menuaction, '.') === false) // static method name app_something::method |
|
104 | 104 | { |
105 | - @list($className,$functionName,$handler) = explode('::',$menuaction); |
|
105 | + @list($className, $functionName, $handler) = explode('::', $menuaction); |
|
106 | 106 | if (substr($className, 0, 11) == 'EGroupware\\') |
107 | 107 | { |
108 | 108 | list(,$appName) = explode('\\', strtolower($className)); |
109 | 109 | } |
110 | 110 | else |
111 | 111 | { |
112 | - list($appName) = explode('_',$className); |
|
112 | + list($appName) = explode('_', $className); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | // Check for a real static method, avoid instanciation if it is |
116 | 116 | $m = new ReflectionMethod($menuaction); |
117 | - if($m->isStatic()) |
|
117 | + if ($m->isStatic()) |
|
118 | 118 | { |
119 | 119 | $ajaxClass = $className; |
120 | 120 | } |
121 | 121 | } |
122 | 122 | else |
123 | 123 | { |
124 | - @list($appName, $className, $functionName, $handler) = explode('.',$menuaction); |
|
124 | + @list($appName, $className, $functionName, $handler) = explode('.', $menuaction); |
|
125 | 125 | } |
126 | 126 | //error_log("json.php: appName=$appName, className=$className, functionName=$functionName, handler=$handler"); |
127 | 127 | |
128 | - switch($handler) |
|
128 | + switch ($handler) |
|
129 | 129 | { |
130 | 130 | case '/etemplate/process_exec': |
131 | 131 | $_GET['menuaction'] = $appName.'.'.$className.'.'.$functionName; |
@@ -151,15 +151,15 @@ discard block |
||
151 | 151 | break; |
152 | 152 | } |
153 | 153 | |
154 | - if(substr($className,0,4) != 'ajax' && substr($className,-4) != 'ajax' && |
|
155 | - $menuaction != 'etemplate.etemplate.process_exec' && substr($functionName,0,4) != 'ajax' || |
|
156 | - !preg_match('/^[A-Za-z0-9_\\\\-]+(\.[A-Za-z0-9_\\\\]+\.|::)[A-Za-z0-9_]+$/',$menuaction)) |
|
154 | + if (substr($className, 0, 4) != 'ajax' && substr($className, -4) != 'ajax' && |
|
155 | + $menuaction != 'etemplate.etemplate.process_exec' && substr($functionName, 0, 4) != 'ajax' || |
|
156 | + !preg_match('/^[A-Za-z0-9_\\\\-]+(\.[A-Za-z0-9_\\\\]+\.|::)[A-Za-z0-9_]+$/', $menuaction)) |
|
157 | 157 | { |
158 | 158 | // stopped for security reasons |
159 | 159 | error_log("className='$className', functionName='$functionName', menuaction='$menuaction'"); |
160 | - error_log($_SERVER['PHP_SELF']. ' stopped for security reason. '.$menuaction.' is not valid. class- or function-name must start with ajax!!!'); |
|
160 | + error_log($_SERVER['PHP_SELF'].' stopped for security reason. '.$menuaction.' is not valid. class- or function-name must start with ajax!!!'); |
|
161 | 161 | // send message also to the user |
162 | - throw new Exception\InvalidName($_SERVER['PHP_SELF']. ' stopped for security reason. '.$menuaction.' is not valid. class- or function-name must start with ajax!!!'); |
|
162 | + throw new Exception\InvalidName($_SERVER['PHP_SELF'].' stopped for security reason. '.$menuaction.' is not valid. class- or function-name must start with ajax!!!'); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | if (isset($template)) |
@@ -42,7 +42,10 @@ discard block |
||
42 | 42 | public static function isJSONRequest($set=null) |
43 | 43 | { |
44 | 44 | $ret = self::$_hadJSONRequest; |
45 | - if (isset($set)) self::$_hadJSONRequest = $set; |
|
45 | + if (isset($set)) |
|
46 | + { |
|
47 | + self::$_hadJSONRequest = $set; |
|
48 | + } |
|
46 | 49 | return $ret; |
47 | 50 | } |
48 | 51 | |
@@ -60,7 +63,10 @@ discard block |
||
60 | 63 | // Remember that we currently are in a JSON request - e.g. used in the redirect code |
61 | 64 | self::$_hadJSONRequest = true; |
62 | 65 | |
63 | - if (get_magic_quotes_gpc()) $input_data = stripslashes($input_data); |
|
66 | + if (get_magic_quotes_gpc()) |
|
67 | + { |
|
68 | + $input_data = stripslashes($input_data); |
|
69 | + } |
|
64 | 70 | |
65 | 71 | $json_data = json_decode($input_data,true); |
66 | 72 | if (is_array($json_data) && isset($json_data['request']) && isset($json_data['request']['parameters']) && is_array($json_data['request']['parameters'])) |
@@ -100,9 +106,12 @@ discard block |
||
100 | 106 | */ |
101 | 107 | public function handleRequest($menuaction, array $parameters) |
102 | 108 | { |
103 | - if (strpos($menuaction,'::') !== false && strpos($menuaction,'.') === false) // static method name app_something::method |
|
109 | + if (strpos($menuaction,'::') !== false && strpos($menuaction,'.') === false) |
|
110 | + { |
|
111 | + // static method name app_something::method |
|
104 | 112 | { |
105 | 113 | @list($className,$functionName,$handler) = explode('::',$menuaction); |
114 | + } |
|
106 | 115 | if (substr($className, 0, 11) == 'EGroupware\\') |
107 | 116 | { |
108 | 117 | list(,$appName) = explode('\\', strtolower($className)); |
@@ -179,6 +188,9 @@ discard block |
||
179 | 188 | Api\Translation::convert($parameters, 'utf-8')); |
180 | 189 | |
181 | 190 | // check if we have push notifications, if notifications app available |
182 | - if (class_exists('notifications_push')) notifications_push::get(); |
|
191 | + if (class_exists('notifications_push')) |
|
192 | + { |
|
193 | + notifications_push::get(); |
|
194 | + } |
|
183 | 195 | } |
184 | 196 | } |
@@ -68,15 +68,15 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @param string $filename =null if not starting with as slash relative to EGw files dir (this is strongly prefered for security reasons) |
70 | 70 | */ |
71 | - public function __construct($filename=null) |
|
71 | + public function __construct($filename = null) |
|
72 | 72 | { |
73 | - $this->filenames =& Api\Cache::getSession('phpgwapi', __CLASS__); |
|
73 | + $this->filenames = & Api\Cache::getSession('phpgwapi', __CLASS__); |
|
74 | 74 | |
75 | 75 | if ($filename) |
76 | 76 | { |
77 | 77 | $this->filename = $filename; |
78 | 78 | |
79 | - if (!$this->filenames || !in_array($filename,$this->filenames)) $this->filenames[] = $filename; |
|
79 | + if (!$this->filenames || !in_array($filename, $this->filenames)) $this->filenames[] = $filename; |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | * @param int $start =0 last position in log-file |
88 | 88 | * @throws Api\Exception\WrongParameter |
89 | 89 | */ |
90 | - public function ajax_chunk($filename,$start=0) |
|
90 | + public function ajax_chunk($filename, $start = 0) |
|
91 | 91 | { |
92 | - if (!in_array($filename,$this->filenames)) |
|
92 | + if (!in_array($filename, $this->filenames)) |
|
93 | 93 | { |
94 | 94 | throw new Api\Exception\WrongParameter("Not allowed to view '$filename'!"); |
95 | 95 | } |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | if (file_exists($filename)) |
99 | 99 | { |
100 | 100 | $size = filesize($filename); |
101 | - if (!$start || $start < 0 || $start > $size || $size-$start > 4*self::MAX_CHUNK_SIZE) |
|
101 | + if (!$start || $start < 0 || $start > $size || $size - $start > 4 * self::MAX_CHUNK_SIZE) |
|
102 | 102 | { |
103 | - $start = $size - 4*self::MAX_CHUNK_SIZE; |
|
103 | + $start = $size - 4 * self::MAX_CHUNK_SIZE; |
|
104 | 104 | if ($start < 0) $start = 0; |
105 | 105 | } |
106 | 106 | $hsize = Api\Vfs::hsize($size); |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | * @param boolean $truncate =false true: truncate file, false: delete file |
132 | 132 | * @throws Api\Exception\WrongParameter |
133 | 133 | */ |
134 | - public function ajax_delete($filename,$truncate=false) |
|
134 | + public function ajax_delete($filename, $truncate = false) |
|
135 | 135 | { |
136 | - if (!in_array($filename,$this->filenames)) |
|
136 | + if (!in_array($filename, $this->filenames)) |
|
137 | 137 | { |
138 | 138 | throw new Api\Exception\WrongParameter("Not allowed to view '$filename'!"); |
139 | 139 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @return string |
156 | 156 | * @throws Api\Exception\WrongParameter |
157 | 157 | */ |
158 | - public function show($header=null) |
|
158 | + public function show($header = null) |
|
159 | 159 | { |
160 | 160 | if (!isset($this->filename)) |
161 | 161 | { |
@@ -167,11 +167,11 @@ discard block |
||
167 | 167 | <p style="float: left; margin: 5px"><b>'.htmlspecialchars($header).'</b></p> |
168 | 168 | <div style="float: right; margin: 2px; margin-right: 5px"> |
169 | 169 | '.Api\Html::form( |
170 | - Api\Html::input('clear_log',lang('Clear window'),'button','id="clear_log"')."\n". |
|
171 | - Api\Html::input('delete_log',lang('Delete file'),'button','id="purge_log"')."\n". |
|
172 | - Api\Html::input('empty_log',lang('Empty file'),'button','id="empty_log"')."\n". |
|
173 | - Api\Html::input('download_log',lang('Download'),'submit','id="download_log"'), |
|
174 | - '','/index.php',array( |
|
170 | + Api\Html::input('clear_log', lang('Clear window'), 'button', 'id="clear_log"')."\n". |
|
171 | + Api\Html::input('delete_log', lang('Delete file'), 'button', 'id="purge_log"')."\n". |
|
172 | + Api\Html::input('empty_log', lang('Empty file'), 'button', 'id="empty_log"')."\n". |
|
173 | + Api\Html::input('download_log', lang('Download'), 'submit', 'id="download_log"'), |
|
174 | + '', '/index.php', array( |
|
175 | 175 | 'menuaction' => 'api.'.__CLASS__.'.download', |
176 | 176 | 'filename' => $this->filename, |
177 | 177 | )).' |
@@ -187,15 +187,15 @@ discard block |
||
187 | 187 | public function download() |
188 | 188 | { |
189 | 189 | $filename = $_GET['filename']; |
190 | - if (!in_array($filename,$this->filenames)) |
|
190 | + if (!in_array($filename, $this->filenames)) |
|
191 | 191 | { |
192 | 192 | throw new Api\Exception\WrongParameter("Not allowed to download '$filename'!"); |
193 | 193 | } |
194 | 194 | Api\Header\Content::type(basename($filename), 'text/plain'); |
195 | 195 | if ($filename[0] != '/') $filename = $GLOBALS['egw_info']['server']['files_dir'].'/'.$filename; |
196 | - for($n=ob_get_level(); $n > 0; --$n) |
|
196 | + for ($n = ob_get_level(); $n > 0; --$n) |
|
197 | 197 | { |
198 | - ob_end_clean(); // stop all output buffering, to NOT run into memory_limit |
|
198 | + ob_end_clean(); // stop all output buffering, to NOT run into memory_limit |
|
199 | 199 | } |
200 | 200 | readfile($filename); |
201 | 201 | exit; |
@@ -76,7 +76,10 @@ discard block |
||
76 | 76 | { |
77 | 77 | $this->filename = $filename; |
78 | 78 | |
79 | - if (!$this->filenames || !in_array($filename,$this->filenames)) $this->filenames[] = $filename; |
|
79 | + if (!$this->filenames || !in_array($filename,$this->filenames)) |
|
80 | + { |
|
81 | + $this->filenames[] = $filename; |
|
82 | + } |
|
80 | 83 | } |
81 | 84 | } |
82 | 85 | |
@@ -93,7 +96,10 @@ discard block |
||
93 | 96 | { |
94 | 97 | throw new Api\Exception\WrongParameter("Not allowed to view '$filename'!"); |
95 | 98 | } |
96 | - if ($filename[0] != '/') $filename = $GLOBALS['egw_info']['server']['files_dir'].'/'.$filename; |
|
99 | + if ($filename[0] != '/') |
|
100 | + { |
|
101 | + $filename = $GLOBALS['egw_info']['server']['files_dir'].'/'.$filename; |
|
102 | + } |
|
97 | 103 | |
98 | 104 | if (file_exists($filename)) |
99 | 105 | { |
@@ -101,7 +107,10 @@ discard block |
||
101 | 107 | if (!$start || $start < 0 || $start > $size || $size-$start > 4*self::MAX_CHUNK_SIZE) |
102 | 108 | { |
103 | 109 | $start = $size - 4*self::MAX_CHUNK_SIZE; |
104 | - if ($start < 0) $start = 0; |
|
110 | + if ($start < 0) |
|
111 | + { |
|
112 | + $start = 0; |
|
113 | + } |
|
105 | 114 | } |
106 | 115 | $hsize = Api\Vfs::hsize($size); |
107 | 116 | $content = file_get_contents($filename, false, null, $start, self::MAX_CHUNK_SIZE); |
@@ -137,7 +146,10 @@ discard block |
||
137 | 146 | { |
138 | 147 | throw new Api\Exception\WrongParameter("Not allowed to view '$filename'!"); |
139 | 148 | } |
140 | - if ($filename[0] != '/') $filename = $GLOBALS['egw_info']['server']['files_dir'].'/'.$filename; |
|
149 | + if ($filename[0] != '/') |
|
150 | + { |
|
151 | + $filename = $GLOBALS['egw_info']['server']['files_dir'].'/'.$filename; |
|
152 | + } |
|
141 | 153 | if ($truncate) |
142 | 154 | { |
143 | 155 | file_put_contents($filename, ''); |
@@ -161,7 +173,10 @@ discard block |
||
161 | 173 | { |
162 | 174 | throw new Api\Exception\WrongParameter("Must be instanciated with filename!"); |
163 | 175 | } |
164 | - if (is_null($header)) $header = $this->filename; |
|
176 | + if (is_null($header)) |
|
177 | + { |
|
178 | + $header = $this->filename; |
|
179 | + } |
|
165 | 180 | |
166 | 181 | return ' |
167 | 182 | <p style="float: left; margin: 5px"><b>'.htmlspecialchars($header).'</b></p> |
@@ -192,7 +207,10 @@ discard block |
||
192 | 207 | throw new Api\Exception\WrongParameter("Not allowed to download '$filename'!"); |
193 | 208 | } |
194 | 209 | Api\Header\Content::type(basename($filename), 'text/plain'); |
195 | - if ($filename[0] != '/') $filename = $GLOBALS['egw_info']['server']['files_dir'].'/'.$filename; |
|
210 | + if ($filename[0] != '/') |
|
211 | + { |
|
212 | + $filename = $GLOBALS['egw_info']['server']['files_dir'].'/'.$filename; |
|
213 | + } |
|
196 | 214 | for($n=ob_get_level(); $n > 0; --$n) |
197 | 215 | { |
198 | 216 | ob_end_clean(); // stop all output buffering, to NOT run into memory_limit |
@@ -249,12 +249,12 @@ |
||
249 | 249 | |
250 | 250 | $this->component = Horde_Icalendar::newComponent($type, $this); |
251 | 251 | //error_log(__METHOD__."() this->component = Horde_Icalendar::newComponent('$type', \$this) = ".array2string($this->component)); |
252 | - if ($this->component === false) |
|
253 | - { |
|
254 | - error_log(__METHOD__."() Horde_Icalendar::newComponent('$type', \$this) returned FALSE"); |
|
255 | - return; |
|
256 | - //return PEAR::raiseError("Unable to create object for type $type"); |
|
257 | - } |
|
252 | + if ($this->component === false) |
|
253 | + { |
|
254 | + error_log(__METHOD__."() Horde_Icalendar::newComponent('$type', \$this) returned FALSE"); |
|
255 | + return; |
|
256 | + //return PEAR::raiseError("Unable to create object for type $type"); |
|
257 | + } |
|
258 | 258 | if ($this->charset && $this->charset != 'utf-8') |
259 | 259 | { |
260 | 260 | $data = Api\Translation::convert($data, $this->charset, 'utf-8'); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | * @param array $callback_params =array() further parameters for the callback, 1. parameter is component |
107 | 107 | * @param boolean $add_container =false true, add container / $this as last parameter to callback |
108 | 108 | */ |
109 | - public function __construct($ical_file,$base='VCALENDAR',$charset=null,$callback=null,array $callback_params=array(), $add_container=false) |
|
109 | + public function __construct($ical_file, $base = 'VCALENDAR', $charset = null, $callback = null, array $callback_params = array(), $add_container = false) |
|
110 | 110 | { |
111 | 111 | // call parent constructor |
112 | 112 | parent::__construct(); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | } |
132 | 132 | if (!is_resource($this->ical_file)) |
133 | 133 | { |
134 | - throw new Api\Exception\WrongParameter(__METHOD__.'($ical_file, ...) NO resource! $ical_file='.substr(array2string($ical_file),0,100)); |
|
134 | + throw new Api\Exception\WrongParameter(__METHOD__.'($ical_file, ...) NO resource! $ical_file='.substr(array2string($ical_file), 0, 100)); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | { |
156 | 156 | $line = array_shift($this->unread_lines); |
157 | 157 | } |
158 | - elseif(feof($this->ical_file)) |
|
158 | + elseif (feof($this->ical_file)) |
|
159 | 159 | { |
160 | 160 | $line = false; |
161 | 161 | } |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | $line = fgets($this->ical_file); |
165 | 165 | } |
166 | 166 | // check if end of container reached |
167 | - if ($this->container && $line && substr($line,0,4+strlen($this->base)) === 'END:'.$this->base) |
|
167 | + if ($this->container && $line && substr($line, 0, 4 + strlen($this->base)) === 'END:'.$this->base) |
|
168 | 168 | { |
169 | - $this->unread_line($line); // put back end-of-container, to continue to return false |
|
169 | + $this->unread_line($line); // put back end-of-container, to continue to return false |
|
170 | 170 | $line = false; |
171 | 171 | } |
172 | 172 | //error_log(__METHOD__."() returning ".($line === false ? 'FALSE' : "'$line'")); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | protected function unread_line($line) |
183 | 183 | { |
184 | 184 | //error_log(__METHOD__."('$line')"); |
185 | - array_unshift($this->unread_lines,$line); |
|
185 | + array_unshift($this->unread_lines, $line); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | //error_log(__METHOD__."() returning a ".gettype($this->component)); |
196 | 196 | if ($this->callback) |
197 | 197 | { |
198 | - $ret = is_a($this->component,'Horde_Icalendar'); |
|
198 | + $ret = is_a($this->component, 'Horde_Icalendar'); |
|
199 | 199 | do { |
200 | 200 | if ($ret === false) $this->next(); |
201 | - if (!is_a($this->component,'Horde_Icalendar')) return false; |
|
201 | + if (!is_a($this->component, 'Horde_Icalendar')) return false; |
|
202 | 202 | $params = $this->callback_params; |
203 | - array_unshift($params,$this->component); |
|
203 | + array_unshift($params, $this->component); |
|
204 | 204 | } |
205 | - while(($ret = call_user_func_array($this->callback,$params)) === false); |
|
205 | + while (($ret = call_user_func_array($this->callback, $params)) === false); |
|
206 | 206 | |
207 | 207 | return $ret; |
208 | 208 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | { |
228 | 228 | unset($this->component); |
229 | 229 | |
230 | - while (($line = $this->read_line()) && substr($line,0,6) !== 'BEGIN:') |
|
230 | + while (($line = $this->read_line()) && substr($line, 0, 6) !== 'BEGIN:') |
|
231 | 231 | { |
232 | 232 | // ignore it |
233 | 233 | } |
@@ -236,12 +236,12 @@ discard block |
||
236 | 236 | $this->component = false; |
237 | 237 | return; |
238 | 238 | } |
239 | - $type = substr(trim($line),6); |
|
239 | + $type = substr(trim($line), 6); |
|
240 | 240 | |
241 | 241 | //error_log(__METHOD__."() found $type component"); |
242 | 242 | |
243 | 243 | $data = $line; |
244 | - while (($line = $this->read_line()) && substr($line,0,4+strlen($type)) !== 'END:'.$type) |
|
244 | + while (($line = $this->read_line()) && substr($line, 0, 4 + strlen($type)) !== 'END:'.$type) |
|
245 | 245 | { |
246 | 246 | $data .= $line; |
247 | 247 | } |
@@ -276,23 +276,23 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function rewind() |
278 | 278 | { |
279 | - @fseek($this->ical_file,0,SEEK_SET); |
|
279 | + @fseek($this->ical_file, 0, SEEK_SET); |
|
280 | 280 | |
281 | 281 | // advance to begin of container |
282 | - while(($line = $this->read_line()) && substr($line,0,6+strlen($this->base)) !== 'BEGIN:'.$this->base) |
|
282 | + while (($line = $this->read_line()) && substr($line, 0, 6 + strlen($this->base)) !== 'BEGIN:'.$this->base) |
|
283 | 283 | { |
284 | 284 | |
285 | 285 | } |
286 | 286 | // if no container start found --> use whole file (rewind) and set container marker |
287 | 287 | if (!($this->container = $line !== false)) |
288 | 288 | { |
289 | - fseek($this->ical_file,0,SEEK_SET); |
|
289 | + fseek($this->ical_file, 0, SEEK_SET); |
|
290 | 290 | } |
291 | 291 | //error_log(__METHOD__."() $this->base container ".($this->container ? 'found' : 'NOT found')); |
292 | 292 | |
293 | 293 | $data = $line; |
294 | 294 | // advance to first component |
295 | - while (($line = $this->read_line()) && substr($line,0,6) !== 'BEGIN:') |
|
295 | + while (($line = $this->read_line()) && substr($line, 0, 6) !== 'BEGIN:') |
|
296 | 296 | { |
297 | 297 | $matches = null; |
298 | 298 | if (preg_match('/^VERSION:(\d\.\d)\s*$/ism', $line, $matches)) |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | { |
308 | 308 | $data .= "END:$this->base\n"; |
309 | 309 | //error_log(__METHOD__."() about to call this->parsevCalendar('$data','$this->base','$this->charset')"); |
310 | - $this->parsevCalendar($data,$this->base,$this->charset); |
|
310 | + $this->parsevCalendar($data, $this->base, $this->charset); |
|
311 | 311 | } |
312 | 312 | if ($line) $this->unread_line($line); |
313 | 313 | |
@@ -320,10 +320,10 @@ discard block |
||
320 | 320 | * |
321 | 321 | * @return boolean |
322 | 322 | */ |
323 | - public function valid () |
|
323 | + public function valid() |
|
324 | 324 | { |
325 | 325 | //error_log(__METHOD__."() returning ".(is_a($this->component,'Horde_Icalendar') ? 'TRUE' : 'FALSE').' get_class($this->component)='.get_class($this->component)); |
326 | - return is_a($this->component,'Horde_Icalendar'); |
|
326 | + return is_a($this->component, 'Horde_Icalendar'); |
|
327 | 327 | } |
328 | 328 | } |
329 | 329 | |
@@ -441,8 +441,8 @@ discard block |
||
441 | 441 | if (!is_resource($ical_file)) echo "<pre>$ical_file</pre>\n"; |
442 | 442 | //$calendar_ical = new calendar_ical(); |
443 | 443 | //$calendar_ical->setSupportedFields('file'); |
444 | - $ical_it = new IcalIterator($ical_file);//,'VCALENDAR','iso-8859-1',array($calendar_ical,'_ical2egw_callback'),array('Europe/Berlin')); |
|
445 | - foreach($ical_it as $uid => $vevent) |
|
444 | + $ical_it = new IcalIterator($ical_file); //,'VCALENDAR','iso-8859-1',array($calendar_ical,'_ical2egw_callback'),array('Europe/Berlin')); |
|
445 | + foreach ($ical_it as $uid => $vevent) |
|
446 | 446 | { |
447 | 447 | echo "$uid<pre>".print_r($vevent->toHash(), true)."</pre>\n"; |
448 | 448 | } |
@@ -116,7 +116,10 @@ discard block |
||
116 | 116 | if (is_callable($callback)) |
117 | 117 | { |
118 | 118 | $this->callback = $callback; |
119 | - if ($add_container) $callback_params[] = $this; |
|
119 | + if ($add_container) |
|
120 | + { |
|
121 | + $callback_params[] = $this; |
|
122 | + } |
|
120 | 123 | $this->callback_params = $callback_params; |
121 | 124 | } |
122 | 125 | if (is_string($ical_file)) |
@@ -197,8 +200,14 @@ discard block |
||
197 | 200 | { |
198 | 201 | $ret = is_a($this->component,'Horde_Icalendar'); |
199 | 202 | do { |
200 | - if ($ret === false) $this->next(); |
|
201 | - if (!is_a($this->component,'Horde_Icalendar')) return false; |
|
203 | + if ($ret === false) |
|
204 | + { |
|
205 | + $this->next(); |
|
206 | + } |
|
207 | + if (!is_a($this->component,'Horde_Icalendar')) |
|
208 | + { |
|
209 | + return false; |
|
210 | + } |
|
202 | 211 | $params = $this->callback_params; |
203 | 212 | array_unshift($params,$this->component); |
204 | 213 | } |
@@ -231,9 +240,12 @@ discard block |
||
231 | 240 | { |
232 | 241 | // ignore it |
233 | 242 | } |
234 | - if ($line === false) // end-of-file or end-of-container |
|
243 | + if ($line === false) |
|
244 | + { |
|
245 | + // end-of-file or end-of-container |
|
235 | 246 | { |
236 | 247 | $this->component = false; |
248 | + } |
|
237 | 249 | return; |
238 | 250 | } |
239 | 251 | $type = substr(trim($line),6); |
@@ -309,7 +321,10 @@ discard block |
||
309 | 321 | //error_log(__METHOD__."() about to call this->parsevCalendar('$data','$this->base','$this->charset')"); |
310 | 322 | $this->parsevCalendar($data,$this->base,$this->charset); |
311 | 323 | } |
312 | - if ($line) $this->unread_line($line); |
|
324 | + if ($line) |
|
325 | + { |
|
326 | + $this->unread_line($line); |
|
327 | + } |
|
313 | 328 | |
314 | 329 | // advance to first element |
315 | 330 | $this->next(); |
@@ -438,7 +453,10 @@ discard block |
||
438 | 453 | '; |
439 | 454 | echo $GLOBALS['egw']->framework->header(); |
440 | 455 | //$ical_file = fopen('/tmp/KalenderFelicitasKubala.ics'); |
441 | - if (!is_resource($ical_file)) echo "<pre>$ical_file</pre>\n"; |
|
456 | + if (!is_resource($ical_file)) |
|
457 | + { |
|
458 | + echo "<pre>$ical_file</pre>\n"; |
|
459 | + } |
|
442 | 460 | //$calendar_ical = new calendar_ical(); |
443 | 461 | //$calendar_ical->setSupportedFields('file'); |
444 | 462 | $ical_it = new IcalIterator($ical_file);//,'VCALENDAR','iso-8859-1',array($calendar_ical,'_ical2egw_callback'),array('Europe/Berlin')); |
@@ -446,5 +464,8 @@ discard block |
||
446 | 464 | { |
447 | 465 | echo "$uid<pre>".print_r($vevent->toHash(), true)."</pre>\n"; |
448 | 466 | } |
449 | - if (is_resource($ical_file)) fclose($ical_file); |
|
450 | -} |
|
451 | 467 | \ No newline at end of file |
468 | + if (is_resource($ical_file)) |
|
469 | + { |
|
470 | + fclose($ical_file); |
|
471 | + } |
|
472 | + } |
|
452 | 473 | \ No newline at end of file |