@@ -165,7 +165,8 @@ discard block |
||
165 | 165 | $cat_ids[$category['id']] = $GLOBALS['egw']->strip_html($category['name']); |
166 | 166 | } |
167 | 167 | $this->arguments['category']['options'] = $cat_ids; |
168 | - if (count($cat_ids) > 5) { |
|
168 | + if (count($cat_ids) > 5) |
|
169 | + { |
|
169 | 170 | $this->arguments['category']['multiple'] = 5; |
170 | 171 | } |
171 | 172 | |
@@ -310,8 +311,16 @@ discard block |
||
310 | 311 | foreach((array) $this->bo->search($search_params) as $event) |
311 | 312 | { |
312 | 313 | $event['date'] = $this->bo->date2string($event['start']); |
313 | - if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment |
|
314 | - if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment |
|
314 | + if (empty($event['description'])) |
|
315 | + { |
|
316 | + $event['description'] = ' '; |
|
317 | + } |
|
318 | + // no description screws the titles horz. alignment |
|
319 | + if (empty($event['location'])) |
|
320 | + { |
|
321 | + $event['location'] = ' '; |
|
322 | + } |
|
323 | + // no location screws the owner horz. alignment |
|
315 | 324 | $rows[] = $event; |
316 | 325 | } |
317 | 326 | if (($arguments['showWeeks']) && ((int)$arguments['offset'] == 0)) |
@@ -337,7 +346,8 @@ discard block |
||
337 | 346 | } |
338 | 347 | $last_week = adodb_date('W-Y',$event['start']); |
339 | 348 | $html .= " <!-- Event -->\n"; |
340 | - if ($event_count % 2 == 0) { |
|
349 | + if ($event_count % 2 == 0) |
|
350 | + { |
|
341 | 351 | $html .= ' <div class="cal_list_event cal_event_even">'."\n"; |
342 | 352 | } |
343 | 353 | else |
@@ -353,7 +363,8 @@ discard block |
||
353 | 363 | $html .= '<span class="cal_list_weekday">'.lang(adodb_date('D',$event['end'])).".".($this->bo->common_prefs['dateformat'][0] != 'd' ? ' ' : ', ')."</span>"; |
354 | 364 | $html .= $this->bo->format_date($event['end'])."</span></div>\n"; |
355 | 365 | $descr = trim($event['description']); |
356 | - if (! empty($descr)) { |
|
366 | + if (! empty($descr)) |
|
367 | + { |
|
357 | 368 | $html .= " <div class=\"cal_list_descr\">\n".preg_replace('/\\n/',"<br>\n",$event['description'])."</div>\n"; |
358 | 369 | } |
359 | 370 | $html .= " </div><!-- cal_list_event -->\n"; |
@@ -280,7 +280,7 @@ |
||
280 | 280 | } |
281 | 281 | |
282 | 282 | // set the search parameters |
283 | - $search_params = Array |
|
283 | + $search_params = array |
|
284 | 284 | ( |
285 | 285 | 'offset' => $arguments['entryOffset'] ? (int) $arguments['entryOffset'] : false, |
286 | 286 | 'order' => 'cal_start ASC', |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | 'category' => array( |
92 | 92 | 'type' => 'select', |
93 | 93 | 'label' => lang('Choose a category'), |
94 | - 'options' => array(), // specification of options is postponed into the get_user_interface function |
|
94 | + 'options' => array(), // specification of options is postponed into the get_user_interface function |
|
95 | 95 | 'multiple' => true, |
96 | 96 | ), |
97 | 97 | 'numWeeks' => array( |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | { |
158 | 158 | //_debug_array($GLOBALS['Common_BO']->sites->current_site); |
159 | 159 | // copied from bookmarks module. |
160 | - $cat = new Api\Categories('','calendar'); |
|
161 | - $cats = $cat->return_array('all',0,False,'','cat_name','',True); |
|
160 | + $cat = new Api\Categories('', 'calendar'); |
|
161 | + $cats = $cat->return_array('all', 0, False, '', 'cat_name', '', True); |
|
162 | 162 | $cat_ids = array(); |
163 | 163 | while (list(,$category) = @each($cats)) |
164 | 164 | { |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | { |
174 | 174 | $GLOBALS['egw']->accounts = new Api\Accounts(); |
175 | 175 | } |
176 | - $this->accounts =& $GLOBALS['egw']->accounts; |
|
176 | + $this->accounts = & $GLOBALS['egw']->accounts; |
|
177 | 177 | $search_params = array( |
178 | 178 | 'type' => 'both', |
179 | 179 | 'app' => 'calendar', |
@@ -182,8 +182,8 @@ discard block |
||
182 | 182 | $users = array(); |
183 | 183 | $groups = array(); |
184 | 184 | // sort users and groups separately. |
185 | - $anon_user = $this->accounts->name2id($GLOBALS['Common_BO']->sites->current_site['anonymous_user'],'account_lid','u'); |
|
186 | - $anon_groups = $this->accounts->memberships($anon_user,true); |
|
185 | + $anon_user = $this->accounts->name2id($GLOBALS['Common_BO']->sites->current_site['anonymous_user'], 'account_lid', 'u'); |
|
186 | + $anon_groups = $this->accounts->memberships($anon_user, true); |
|
187 | 187 | foreach ($accounts as $entry) |
188 | 188 | { |
189 | 189 | $is_group = false; |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | $acl = new Acl($entry['account_id']); |
192 | 192 | $acl->read_repository(); |
193 | 193 | // get the rights for each account to check whether the anon user has read permissions. |
194 | - $rights = $acl->get_rights($anon_user,'calendar'); |
|
194 | + $rights = $acl->get_rights($anon_user, 'calendar'); |
|
195 | 195 | // also add the anon user if it's his own calendar. |
196 | - if (($rights & Acl::READ) || ($entry['account_id'] == $anon_user)) |
|
196 | + if (($rights&Acl::READ) || ($entry['account_id'] == $anon_user)) |
|
197 | 197 | { |
198 | 198 | $has_read_permissions = true; |
199 | 199 | } |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | // or ass permissions if this is the anon group's calendar. |
204 | 204 | foreach ($anon_groups as $parent_group) |
205 | 205 | { |
206 | - $rights = $acl->get_rights($parent_group,'calendar'); |
|
207 | - if (($rights & Acl::READ) || ($entry['account_id'] == $parent_group)) |
|
206 | + $rights = $acl->get_rights($parent_group, 'calendar'); |
|
207 | + if (($rights&Acl::READ) || ($entry['account_id'] == $parent_group)) |
|
208 | 208 | { |
209 | 209 | $has_read_permissions = true; |
210 | 210 | break; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | } |
221 | 221 | else |
222 | 222 | { |
223 | - $users[$entry['account_id']] = Api\Accounts::format_username($entry['account_lid'],$entry['account_firstname'],$entry['account_lastname']); |
|
223 | + $users[$entry['account_id']] = Api\Accounts::format_username($entry['account_lid'], $entry['account_firstname'], $entry['account_lastname']); |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | return parent::get_user_interface(); |
241 | 241 | } |
242 | 242 | |
243 | - function get_content(&$arguments,$properties) |
|
243 | + function get_content(&$arguments, $properties) |
|
244 | 244 | { |
245 | 245 | $html = ""; |
246 | 246 | Api\Translation::add_app('calendar'); |
@@ -249,17 +249,17 @@ discard block |
||
249 | 249 | $this->ui->allowEdit = false; |
250 | 250 | $this->ui->use_time_grid = isset($arguments['grid']) ? $arguments['grid'] : false; |
251 | 251 | |
252 | - $weeks = $arguments['numWeeks'] ? (int) $arguments['numWeeks'] : 4; |
|
253 | - $dateOffset = $arguments['offset'] ? (int) $arguments['offset'] : 0; |
|
252 | + $weeks = $arguments['numWeeks'] ? (int)$arguments['numWeeks'] : 4; |
|
253 | + $dateOffset = $arguments['offset'] ? (int)$arguments['offset'] : 0; |
|
254 | 254 | |
255 | - if (($arguments['acceptDateParam']) && (get_var('date',array('POST','GET')))) |
|
255 | + if (($arguments['acceptDateParam']) && (get_var('date', array('POST', 'GET')))) |
|
256 | 256 | { |
257 | - $first = (int) (strtotime(get_var('date',array('POST','GET'))) + |
|
257 | + $first = (int)(strtotime(get_var('date', array('POST', 'GET'))) + |
|
258 | 258 | (60 * 60 * 24 * 7 * $dateOffset)); |
259 | 259 | } |
260 | 260 | else |
261 | 261 | { |
262 | - $first = (int) ($this->bo->now_su + |
|
262 | + $first = (int)($this->bo->now_su + |
|
263 | 263 | (60 * 60 * 24 * 7 * $dateOffset)); |
264 | 264 | } |
265 | 265 | if ($arguments['useWeekStart']) |
@@ -269,20 +269,19 @@ discard block |
||
269 | 269 | $first = $start->format('ts'); |
270 | 270 | } |
271 | 271 | |
272 | - $last = (int) ($first + |
|
272 | + $last = (int)($first + |
|
273 | 273 | (60 * 60 * 24 * 7 * $weeks)); |
274 | 274 | |
275 | 275 | if ($arguments['showTitle']) |
276 | 276 | { |
277 | 277 | $html .= '<div id="divAppboxHeader">'.$GLOBALS['egw_info']['apps']['calendar']['title'].' - '; |
278 | - $html .= lang('After %1',$this->bo->long_date($first)); |
|
278 | + $html .= lang('After %1', $this->bo->long_date($first)); |
|
279 | 279 | $html .= "</div>"; |
280 | 280 | } |
281 | 281 | |
282 | 282 | // set the search parameters |
283 | - $search_params = Array |
|
284 | - ( |
|
285 | - 'offset' => $arguments['entryOffset'] ? (int) $arguments['entryOffset'] : false, |
|
283 | + $search_params = Array( |
|
284 | + 'offset' => $arguments['entryOffset'] ? (int)$arguments['entryOffset'] : false, |
|
286 | 285 | 'order' => 'cal_start ASC', |
287 | 286 | 'start' => $first, |
288 | 287 | 'end' => $last, |
@@ -302,23 +301,23 @@ discard block |
||
302 | 301 | } |
303 | 302 | if ($arguments['numEntries']) |
304 | 303 | { |
305 | - $search_params['num_rows'] = (int) $arguments['numEntries']; |
|
306 | - $search_params['offset'] = $arguments['entryOffset'] ? (int) $arguments['entryOffset'] :0; |
|
304 | + $search_params['num_rows'] = (int)$arguments['numEntries']; |
|
305 | + $search_params['offset'] = $arguments['entryOffset'] ? (int)$arguments['entryOffset'] : 0; |
|
307 | 306 | } |
308 | 307 | $rows = array(); |
309 | 308 | |
310 | - foreach((array) $this->bo->search($search_params) as $event) |
|
309 | + foreach ((array)$this->bo->search($search_params) as $event) |
|
311 | 310 | { |
312 | 311 | $event['date'] = $this->bo->date2string($event['start']); |
313 | - if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment |
|
314 | - if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment |
|
312 | + if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment |
|
313 | + if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment |
|
315 | 314 | $rows[] = $event; |
316 | 315 | } |
317 | 316 | if (($arguments['showWeeks']) && ((int)$arguments['offset'] == 0)) |
318 | 317 | { |
319 | 318 | $html .= "<div>".lang('Next')." ".lang('%1 weeks', $weeks).":</div>\n"; |
320 | 319 | } |
321 | - if (($search_params['offset'] && $this->bo->total == 0) || count($rows)==0) |
|
320 | + if (($search_params['offset'] && $this->bo->total == 0) || count($rows) == 0) |
|
322 | 321 | { |
323 | 322 | $html .= "<div>".lang("no events found")."</div>"; |
324 | 323 | } |
@@ -331,11 +330,11 @@ discard block |
||
331 | 330 | $html .= ' <div class="cal_list_weektop"></div>'."\n"; |
332 | 331 | foreach ($rows as $event) |
333 | 332 | { |
334 | - if (($last_week != 0) && (adodb_date('W-Y',$event['start']) != $last_week)) |
|
333 | + if (($last_week != 0) && (adodb_date('W-Y', $event['start']) != $last_week)) |
|
335 | 334 | { |
336 | 335 | $html .= ' <div class="cal_list_weeksplit"></div>'."\n"; |
337 | 336 | } |
338 | - $last_week = adodb_date('W-Y',$event['start']); |
|
337 | + $last_week = adodb_date('W-Y', $event['start']); |
|
339 | 338 | $html .= " <!-- Event -->\n"; |
340 | 339 | if ($event_count % 2 == 0) { |
341 | 340 | $html .= ' <div class="cal_list_event cal_event_even">'."\n"; |
@@ -347,17 +346,17 @@ discard block |
||
347 | 346 | $html .= ' <div class="cal_list_title">'.$event['title']."</div>\n"; |
348 | 347 | $html .= ' <div class="cal_list_date">'; |
349 | 348 | $html .= '<span class="cal_list_start">'; |
350 | - $html .= '<span class="cal_list_weekday">'.lang(adodb_date('D',$event['start'])).".".($this->bo->common_prefs['dateformat'][0] != 'd' ? ' ' : ', ')."</span>"; |
|
349 | + $html .= '<span class="cal_list_weekday">'.lang(adodb_date('D', $event['start'])).".".($this->bo->common_prefs['dateformat'][0] != 'd' ? ' ' : ', ')."</span>"; |
|
351 | 350 | $html .= $this->bo->format_date($event['start'])."</span>"; |
352 | 351 | $html .= '<span class="cal_list_end"> - '; |
353 | - $html .= '<span class="cal_list_weekday">'.lang(adodb_date('D',$event['end'])).".".($this->bo->common_prefs['dateformat'][0] != 'd' ? ' ' : ', ')."</span>"; |
|
352 | + $html .= '<span class="cal_list_weekday">'.lang(adodb_date('D', $event['end'])).".".($this->bo->common_prefs['dateformat'][0] != 'd' ? ' ' : ', ')."</span>"; |
|
354 | 353 | $html .= $this->bo->format_date($event['end'])."</span></div>\n"; |
355 | 354 | $descr = trim($event['description']); |
356 | - if (! empty($descr)) { |
|
357 | - $html .= " <div class=\"cal_list_descr\">\n".preg_replace('/\\n/',"<br>\n",$event['description'])."</div>\n"; |
|
355 | + if (!empty($descr)) { |
|
356 | + $html .= " <div class=\"cal_list_descr\">\n".preg_replace('/\\n/', "<br>\n", $event['description'])."</div>\n"; |
|
358 | 357 | } |
359 | 358 | $html .= " </div><!-- cal_list_event -->\n"; |
360 | - $event_count ++; |
|
359 | + $event_count++; |
|
361 | 360 | } |
362 | 361 | $html .= ' <div class="cal_list_weekbottom"></div>'."\n"; |
363 | 362 | $html .= "<!-- End module -->\n"; |
@@ -44,15 +44,23 @@ |
||
44 | 44 | if (strpos($_SERVER['QUERY_STRING'],'=3D') !== false && substr($_GET['user'],0,2) == '3D') |
45 | 45 | { |
46 | 46 | $_GET['user'] = substr($_GET['user'],2); |
47 | - if (isset($_GET['password'])) $_GET['password'] = substr($_GET['password'],2); |
|
48 | - if (isset($_GET['cred'])) $_GET['cred'] = substr($_GET['cred'],2); |
|
49 | -} |
|
47 | + if (isset($_GET['password'])) |
|
48 | + { |
|
49 | + $_GET['password'] = substr($_GET['password'],2); |
|
50 | + } |
|
51 | + if (isset($_GET['cred'])) |
|
52 | + { |
|
53 | + $_GET['cred'] = substr($_GET['cred'],2); |
|
54 | + } |
|
55 | + } |
|
50 | 56 | if (!is_numeric($user = $_GET['user'])) |
51 | 57 | { |
52 | 58 | // check if user contains the current domain --> remove it |
53 | 59 | list(,$domain) = explode('@',$user); |
54 | 60 | if ($domain === $GLOBALS['egw_info']['user']['domain']) |
55 | - list($user) = explode('@',$user); |
|
61 | + { |
|
62 | + list($user) = explode('@',$user); |
|
63 | + } |
|
56 | 64 | $user = $GLOBALS['egw']->accounts->name2id($user,'account_lid','u'); |
57 | 65 | } |
58 | 66 | if ($user === false || !($username = $GLOBALS['egw']->accounts->id2name($user))) |
@@ -41,23 +41,23 @@ discard block |
||
41 | 41 | $GLOBALS['egw_info']['flags']['currentapp'] = 'calendar'; |
42 | 42 | } |
43 | 43 | // fix for SOGo connector, which does not decode the = in our f/b url |
44 | -if (strpos($_SERVER['QUERY_STRING'],'=3D') !== false && substr($_GET['user'],0,2) == '3D') |
|
44 | +if (strpos($_SERVER['QUERY_STRING'], '=3D') !== false && substr($_GET['user'], 0, 2) == '3D') |
|
45 | 45 | { |
46 | - $_GET['user'] = substr($_GET['user'],2); |
|
47 | - if (isset($_GET['password'])) $_GET['password'] = substr($_GET['password'],2); |
|
48 | - if (isset($_GET['cred'])) $_GET['cred'] = substr($_GET['cred'],2); |
|
46 | + $_GET['user'] = substr($_GET['user'], 2); |
|
47 | + if (isset($_GET['password'])) $_GET['password'] = substr($_GET['password'], 2); |
|
48 | + if (isset($_GET['cred'])) $_GET['cred'] = substr($_GET['cred'], 2); |
|
49 | 49 | } |
50 | 50 | if (!is_numeric($user = $_GET['user'])) |
51 | 51 | { |
52 | 52 | // check if user contains the current domain --> remove it |
53 | - list(,$domain) = explode('@',$user); |
|
53 | + list(,$domain) = explode('@', $user); |
|
54 | 54 | if ($domain === $GLOBALS['egw_info']['user']['domain']) |
55 | - list($user) = explode('@',$user); |
|
56 | - $user = $GLOBALS['egw']->accounts->name2id($user,'account_lid','u'); |
|
55 | + list($user) = explode('@', $user); |
|
56 | + $user = $GLOBALS['egw']->accounts->name2id($user, 'account_lid', 'u'); |
|
57 | 57 | } |
58 | 58 | if ($user === false || !($username = $GLOBALS['egw']->accounts->id2name($user))) |
59 | 59 | { |
60 | - fail_exit(lang("freebusy: unknown user '%1', wrong password or not available to not logged in users !!!"." $username($user)",$_GET['user'])); |
|
60 | + fail_exit(lang("freebusy: unknown user '%1', wrong password or not available to not logged in users !!!"." $username($user)", $_GET['user'])); |
|
61 | 61 | } |
62 | 62 | if (!$loged_in) |
63 | 63 | { |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | if (strpos($authuser, '@') === false) |
79 | 79 | { |
80 | 80 | $domain = $GLOBALS['egw_info']['server']['default_domain']; |
81 | - $authuser .= '@' . $domain; |
|
81 | + $authuser .= '@'.$domain; |
|
82 | 82 | } |
83 | 83 | else |
84 | 84 | { |
85 | - list(, $domain) = explode('@',$authuser, 2); |
|
85 | + list(, $domain) = explode('@', $authuser, 2); |
|
86 | 86 | } |
87 | 87 | if (array_key_exists($domain, $GLOBALS['egw_domain'])) |
88 | 88 | { |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | $GLOBALS['egw_info']['user']['domain'] = $domain; |
93 | 93 | $GLOBALS['egw_info']['flags']['currentapp'] = 'login'; |
94 | 94 | $GLOBALS['egw_info']['flags']['noapi'] = false; |
95 | - require_once(EGW_API_INC . '/functions.inc.php'); |
|
96 | - $loged_in = $GLOBALS['egw']->session->create($authuser, $password, 'text'); |
|
95 | + require_once(EGW_API_INC.'/functions.inc.php'); |
|
96 | + $loged_in = $GLOBALS['egw']->session->create($authuser, $password, 'text'); |
|
97 | 97 | session_unset(); |
98 | 98 | session_destroy(); |
99 | 99 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | else |
111 | 111 | { |
112 | - Api\Header\Content::type('freebusy.ifb','text/calendar'); |
|
112 | + Api\Header\Content::type('freebusy.ifb', 'text/calendar'); |
|
113 | 113 | } |
114 | 114 | $ical = new calendar_ical(); |
115 | 115 | echo $ical->freebusy($user, $_GET['end']); |
@@ -111,7 +111,7 @@ |
||
111 | 111 | $value = $value_in =& self::get_array($content, $form_name); |
112 | 112 | if(!is_array($value)) |
113 | 113 | { |
114 | - $value = Array($value); |
|
114 | + $value = array($value); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | $valid =& self::get_array($validated, $form_name, true); |
@@ -66,7 +66,8 @@ discard block |
||
66 | 66 | $accounts += $accounts_type; |
67 | 67 | } |
68 | 68 | $sel_options += array_map( |
69 | - function($account_id, $account_name) { |
|
69 | + function($account_id, $account_name) |
|
70 | + { |
|
70 | 71 | return array( |
71 | 72 | 'value' => ''.$account_id, |
72 | 73 | 'label' => $account_name, |
@@ -123,7 +124,10 @@ discard block |
||
123 | 124 | } |
124 | 125 | |
125 | 126 | $valid =& self::get_array($validated, $form_name, true); |
126 | - if (true) $valid = $value; |
|
127 | + if (true) |
|
128 | + { |
|
129 | + $valid = $value; |
|
130 | + } |
|
127 | 131 | } |
128 | 132 | } |
129 | 133 | /** |
@@ -192,7 +196,8 @@ discard block |
||
192 | 196 | $contacts_obj = new Api\Contacts(); |
193 | 197 | $lists = array_filter( |
194 | 198 | $contacts_obj->get_lists(Api\Acl::READ), |
195 | - function($element) use($query) { |
|
199 | + function($element) use($query) |
|
200 | + { |
|
196 | 201 | return (stripos($element, $query) !== false); |
197 | 202 | } |
198 | 203 | ); |
@@ -249,7 +254,10 @@ discard block |
||
249 | 254 | public static function get_owner_label($id) |
250 | 255 | { |
251 | 256 | static $bo; |
252 | - if(!$bo) $bo = new calendar_bo(); |
|
257 | + if(!$bo) |
|
258 | + { |
|
259 | + $bo = new calendar_bo(); |
|
260 | + } |
|
253 | 261 | |
254 | 262 | $id = ''.$id; |
255 | 263 | if(!is_numeric($id)) |
@@ -30,33 +30,33 @@ discard block |
||
30 | 30 | * @param string $cname |
31 | 31 | * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
32 | 32 | */ |
33 | - public function beforeSendToClient($cname, array $expand=null) |
|
33 | + public function beforeSendToClient($cname, array $expand = null) |
|
34 | 34 | { |
35 | 35 | |
36 | - Framework::includeJS('.','et2_widget_owner','calendar'); |
|
37 | - Framework::includeCSS('calendar','calendar'); |
|
36 | + Framework::includeJS('.', 'et2_widget_owner', 'calendar'); |
|
37 | + Framework::includeCSS('calendar', 'calendar'); |
|
38 | 38 | |
39 | 39 | $bo = new calendar_bo(); |
40 | 40 | |
41 | 41 | $form_name = self::form_name($cname, $this->id, $expand); |
42 | 42 | |
43 | - $value =& self::get_array(self::$request->content, $form_name); |
|
43 | + $value = & self::get_array(self::$request->content, $form_name); |
|
44 | 44 | |
45 | 45 | if (!is_array(self::$request->sel_options[$form_name])) |
46 | 46 | { |
47 | 47 | self::$request->sel_options[$form_name] = array(); |
48 | 48 | } |
49 | - $sel_options =& self::$request->sel_options[$form_name]; |
|
49 | + $sel_options = & self::$request->sel_options[$form_name]; |
|
50 | 50 | |
51 | 51 | // Get user accounts, formatted nicely for grouping and matching |
52 | 52 | // the ajax call calendar_uiforms->ajax_owner() - users first |
53 | 53 | $accounts = array(); |
54 | 54 | $list = array('accounts', 'owngroups'); |
55 | - foreach($list as $type) |
|
55 | + foreach ($list as $type) |
|
56 | 56 | { |
57 | 57 | $account_options = array('account_type' => $type); |
58 | - $accounts_type = Api\Accounts::link_query('',$account_options); |
|
59 | - if($type == 'accounts') |
|
58 | + $accounts_type = Api\Accounts::link_query('', $account_options); |
|
59 | + if ($type == 'accounts') |
|
60 | 60 | { |
61 | 61 | $accounts_type = array_intersect_key($accounts_type, $GLOBALS['egw']->acl->get_grants('calendar')); |
62 | 62 | } |
@@ -73,25 +73,25 @@ discard block |
||
73 | 73 | array_keys($accounts), $accounts |
74 | 74 | ); |
75 | 75 | |
76 | - if(!is_array($value)) |
|
76 | + if (!is_array($value)) |
|
77 | 77 | { |
78 | 78 | // set value with an empty string only if sel options are not |
79 | 79 | // loaded, for example: setting calendar owner via URL when |
80 | 80 | // calendar app is not yet loaded. |
81 | - $value = !empty($sel_options) ? array(): explode(',', $value); |
|
81 | + $value = !empty($sel_options) ? array() : explode(',', $value); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // Add external owners that a select account widget will not find |
85 | - foreach($value as &$owner) |
|
85 | + foreach ($value as &$owner) |
|
86 | 86 | { |
87 | 87 | $label = self::get_owner_label($owner); |
88 | 88 | $info = array(); |
89 | - if(!is_numeric($owner)) |
|
89 | + if (!is_numeric($owner)) |
|
90 | 90 | { |
91 | - $resource = $bo->resources[substr($owner, 0,1)]; |
|
92 | - if($resource['info'] && !($info = $bo->resource_info($owner))) |
|
91 | + $resource = $bo->resources[substr($owner, 0, 1)]; |
|
92 | + if ($resource['info'] && !($info = $bo->resource_info($owner))) |
|
93 | 93 | { |
94 | - continue; // ignore that resource, we would get a PHP Fatal: Unsupported operand types |
|
94 | + continue; // ignore that resource, we would get a PHP Fatal: Unsupported operand types |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | else if (!in_array($owner, array_keys($accounts))) |
@@ -114,19 +114,19 @@ discard block |
||
114 | 114 | * @param array $content |
115 | 115 | * @param array &$validated=array() validated content |
116 | 116 | */ |
117 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
117 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
118 | 118 | { |
119 | 119 | $form_name = self::form_name($cname, $this->id, $expand); |
120 | 120 | |
121 | 121 | if (!$this->is_readonly($cname, $form_name)) |
122 | 122 | { |
123 | - $value = $value_in =& self::get_array($content, $form_name); |
|
124 | - if(!is_array($value)) |
|
123 | + $value = $value_in = & self::get_array($content, $form_name); |
|
124 | + if (!is_array($value)) |
|
125 | 125 | { |
126 | 126 | $value = Array($value); |
127 | 127 | } |
128 | 128 | |
129 | - $valid =& self::get_array($validated, $form_name, true); |
|
129 | + $valid = & self::get_array($validated, $form_name, true); |
|
130 | 130 | if (true) $valid = $value; |
131 | 131 | } |
132 | 132 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | public static function ajax_owner($id = null) |
139 | 139 | { |
140 | 140 | // Handle a request for a single ID |
141 | - if($id) |
|
141 | + if ($id) |
|
142 | 142 | { |
143 | 143 | $label = self::get_owner_label($id); |
144 | 144 | Api\Json\Response::get()->data($label); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $options = array('start' => 0, 'num_rows' => 50, |
153 | 153 | // Filter accounts out of addressbook |
154 | 154 | 'filter' => array('account_id' => null)) + |
155 | - array_diff_key($_REQUEST, array_flip(array('menuaction','query'))); |
|
155 | + array_diff_key($_REQUEST, array_flip(array('menuaction', 'query'))); |
|
156 | 156 | $results = array(); |
157 | 157 | |
158 | 158 | // Contacts matching accounts the user does not have permission for cause |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | // we remove those contacts |
161 | 161 | $remove_contacts = array(); |
162 | 162 | |
163 | - $resources = array_merge(array('' => $bo->resources['']),$bo->resources); |
|
164 | - foreach($resources as $type => $data) |
|
163 | + $resources = array_merge(array('' => $bo->resources['']), $bo->resources); |
|
164 | + foreach ($resources as $type => $data) |
|
165 | 165 | { |
166 | 166 | $mapped = array(); |
167 | 167 | $_results = array(); |
168 | 168 | |
169 | 169 | // Handle Api\Accounts seperately |
170 | - if($type == '') |
|
170 | + if ($type == '') |
|
171 | 171 | { |
172 | 172 | $account_options = $options + array('account_type' => 'both'); |
173 | 173 | $_results += $remove_contacts = Api\Accounts::link_query($query, $account_options); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | // Use standard link registry |
186 | 186 | else if ($data['app'] && Link::get_registry($data['app'], 'query')) |
187 | 187 | { |
188 | - $_results = Link::query($data['app'], $query,$options); |
|
188 | + $_results = Link::query($data['app'], $query, $options); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | // There are always special cases |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | return (stripos($element, $query) !== false); |
201 | 201 | } |
202 | 202 | ); |
203 | - foreach($lists as $list_id => $list) |
|
203 | + foreach ($lists as $list_id => $list) |
|
204 | 204 | { |
205 | 205 | $_results[$list_id] = array( |
206 | 206 | 'label' => $list, |
@@ -209,14 +209,14 @@ discard block |
||
209 | 209 | } |
210 | 210 | break; |
211 | 211 | } |
212 | - if(!$_results) |
|
212 | + if (!$_results) |
|
213 | 213 | { |
214 | 214 | continue; |
215 | 215 | } |
216 | 216 | |
217 | - foreach(array_unique($_results, SORT_REGULAR) as $id => $title) |
|
217 | + foreach (array_unique($_results, SORT_REGULAR) as $id => $title) |
|
218 | 218 | { |
219 | - if($id && $title) |
|
219 | + if ($id && $title) |
|
220 | 220 | { |
221 | 221 | // Magicsuggest uses id, not value. |
222 | 222 | $value = array( |
@@ -225,14 +225,14 @@ discard block |
||
225 | 225 | 'label' => $title, |
226 | 226 | 'app' => lang($data['app']) |
227 | 227 | ); |
228 | - if(is_array($value['label'])) |
|
228 | + if (is_array($value['label'])) |
|
229 | 229 | { |
230 | 230 | $value = array_merge($value, $value['label']); |
231 | 231 | } |
232 | 232 | $mapped[] = $value; |
233 | 233 | } |
234 | 234 | } |
235 | - if(count($mapped)) |
|
235 | + if (count($mapped)) |
|
236 | 236 | { |
237 | 237 | $results = array_merge($results, $mapped); |
238 | 238 | } |
@@ -253,24 +253,24 @@ discard block |
||
253 | 253 | public static function get_owner_label($id) |
254 | 254 | { |
255 | 255 | static $bo; |
256 | - if(!$bo) $bo = new calendar_bo(); |
|
256 | + if (!$bo) $bo = new calendar_bo(); |
|
257 | 257 | |
258 | 258 | $id = ''.$id; |
259 | - if(!is_numeric($id)) |
|
259 | + if (!is_numeric($id)) |
|
260 | 260 | { |
261 | - $resource = $bo->resources[substr($id, 0,1)]; |
|
262 | - $label = Link::title($resource['app'], substr($id,1)); |
|
261 | + $resource = $bo->resources[substr($id, 0, 1)]; |
|
262 | + $label = Link::title($resource['app'], substr($id, 1)); |
|
263 | 263 | |
264 | 264 | // Could not get via link, try via resources info |
265 | - if($label === false) |
|
265 | + if ($label === false) |
|
266 | 266 | { |
267 | - $info = ExecMethod($resource['info'], substr($id,1)); |
|
267 | + $info = ExecMethod($resource['info'], substr($id, 1)); |
|
268 | 268 | $label = $info[0]['name']; |
269 | 269 | } |
270 | 270 | } |
271 | 271 | else |
272 | 272 | { |
273 | - $label = Link::title('api-accounts',$id) ?: Api\Accounts::username($id); |
|
273 | + $label = Link::title('api-accounts', $id) ?: Api\Accounts::username($id); |
|
274 | 274 | } |
275 | 275 | return $label; |
276 | 276 | } |
@@ -61,7 +61,7 @@ |
||
61 | 61 | * |
62 | 62 | * @var array |
63 | 63 | */ |
64 | - static public $types = Array( |
|
64 | + static public $types = array( |
|
65 | 65 | self::NONE => 'None', |
66 | 66 | self::DAILY => 'Daily', |
67 | 67 | self::WEEKLY => 'Weekly', |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | static private $recur_egw2ical_2_0 = array( |
77 | 77 | self::DAILY => 'DAILY', |
78 | 78 | self::WEEKLY => 'WEEKLY', |
79 | - self::MONTHLY_WDAY => 'MONTHLY', // BYDAY={1..7, -1}{MO..SO, last workday} |
|
80 | - self::MONTHLY_MDAY => 'MONTHLY', // BYMONHTDAY={1..31, -1 for last day of month} |
|
79 | + self::MONTHLY_WDAY => 'MONTHLY', // BYDAY={1..7, -1}{MO..SO, last workday} |
|
80 | + self::MONTHLY_MDAY => 'MONTHLY', // BYMONHTDAY={1..31, -1 for last day of month} |
|
81 | 81 | self::YEARLY => 'YEARLY', |
82 | 82 | ); |
83 | 83 | |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | static private $recur_egw2ical_1_0 = array( |
88 | 88 | self::DAILY => 'D', |
89 | 89 | self::WEEKLY => 'W', |
90 | - self::MONTHLY_WDAY => 'MP', // BYDAY={1..7,-1}{MO..SO, last workday} |
|
91 | - self::MONTHLY_MDAY => 'MD', // BYMONHTDAY={1..31,-1} |
|
90 | + self::MONTHLY_WDAY => 'MP', // BYDAY={1..7,-1}{MO..SO, last workday} |
|
91 | + self::MONTHLY_MDAY => 'MD', // BYMONHTDAY={1..31,-1} |
|
92 | 92 | self::YEARLY => 'YM', |
93 | 93 | ); |
94 | 94 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | const THURSDAY = 16; |
157 | 157 | const FRIDAY = 32; |
158 | 158 | const SATURDAY = 64; |
159 | - const WORKDAYS = 62; // Mo, ..., Fr |
|
159 | + const WORKDAYS = 62; // Mo, ..., Fr |
|
160 | 160 | const ALLDAYS = 127; |
161 | 161 | /** |
162 | 162 | * Translate weekday bitmasks to labels |
@@ -184,14 +184,14 @@ discard block |
||
184 | 184 | * |
185 | 185 | * @var array |
186 | 186 | */ |
187 | - public $exceptions=array(); |
|
187 | + public $exceptions = array(); |
|
188 | 188 | |
189 | 189 | /** |
190 | 190 | * Array of exceptions as DateTime/egw_time objects |
191 | 191 | * |
192 | 192 | * @var array |
193 | 193 | */ |
194 | - public $exceptions_objs=array(); |
|
194 | + public $exceptions_objs = array(); |
|
195 | 195 | |
196 | 196 | /** |
197 | 197 | * Starttime of series |
@@ -234,9 +234,9 @@ discard block |
||
234 | 234 | * @param int $weekdays =0 self::SUNDAY=1|self::MONDAY=2|...|self::SATURDAY=64 |
235 | 235 | * @param array $exceptions =null DateTime objects with exceptions |
236 | 236 | */ |
237 | - public function __construct(DateTime $time,$type,$interval=1,DateTime $enddate=null,$weekdays=0,array $exceptions=null) |
|
237 | + public function __construct(DateTime $time, $type, $interval = 1, DateTime $enddate = null, $weekdays = 0, array $exceptions = null) |
|
238 | 238 | { |
239 | - switch($GLOBALS['egw_info']['user']['preferences']['calendar']['weekdaystarts']) |
|
239 | + switch ($GLOBALS['egw_info']['user']['preferences']['calendar']['weekdaystarts']) |
|
240 | 240 | { |
241 | 241 | case 'Sunday': |
242 | 242 | $this->lastdayofweek = self::SATURDAY; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | |
251 | 251 | $this->time = $time instanceof Api\DateTime ? $time : new Api\DateTime($time); |
252 | 252 | |
253 | - if (!in_array($type,array(self::NONE, self::DAILY, self::WEEKLY, self::MONTHLY_MDAY, self::MONTHLY_WDAY, self::YEARLY))) |
|
253 | + if (!in_array($type, array(self::NONE, self::DAILY, self::WEEKLY, self::MONTHLY_MDAY, self::MONTHLY_WDAY, self::YEARLY))) |
|
254 | 254 | { |
255 | 255 | throw new Api\Exception\WrongParameter(__METHOD__."($time,$type,$interval,$enddate,$weekdays,...) type $type is NOT valid!"); |
256 | 256 | } |
@@ -260,16 +260,16 @@ discard block |
||
260 | 260 | if ($type == self::MONTHLY_WDAY) |
261 | 261 | { |
262 | 262 | // check for last week of month |
263 | - if (($day = $this->time->format('d')) >= 21 && $day > self::daysInMonth($this->time)-7) |
|
263 | + if (($day = $this->time->format('d')) >= 21 && $day > self::daysInMonth($this->time) - 7) |
|
264 | 264 | { |
265 | 265 | $this->monthly_byday_num = -1; |
266 | 266 | } |
267 | 267 | else |
268 | 268 | { |
269 | - $this->monthly_byday_num = 1 + floor(($this->time->format('d')-1) / 7); |
|
269 | + $this->monthly_byday_num = 1 + floor(($this->time->format('d') - 1) / 7); |
|
270 | 270 | } |
271 | 271 | } |
272 | - elseif($type == self::MONTHLY_MDAY) |
|
272 | + elseif ($type == self::MONTHLY_MDAY) |
|
273 | 273 | { |
274 | 274 | $this->monthly_bymonthday = (int)$this->time->format('d'); |
275 | 275 | // check for last day of month |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | |
287 | 287 | if ((int)$interval < 1) |
288 | 288 | { |
289 | - $interval = 1; // calendar stores no (extra) interval as null, so using default 1 here |
|
289 | + $interval = 1; // calendar stores no (extra) interval as null, so using default 1 here |
|
290 | 290 | } |
291 | 291 | $this->interval = (int)$interval; |
292 | 292 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | } |
318 | 318 | if ($exceptions) |
319 | 319 | { |
320 | - foreach($exceptions as $exception) |
|
320 | + foreach ($exceptions as $exception) |
|
321 | 321 | { |
322 | 322 | $exception->setTimezone($this->time->getTimezone()); |
323 | 323 | $this->exceptions[] = $exception->format('Ymd'); |
@@ -333,22 +333,22 @@ discard block |
||
333 | 333 | * @param int $interval =1 |
334 | 334 | * @return int |
335 | 335 | */ |
336 | - public static function recurrence_interval($type, $interval=1) |
|
336 | + public static function recurrence_interval($type, $interval = 1) |
|
337 | 337 | { |
338 | - switch($type) |
|
338 | + switch ($type) |
|
339 | 339 | { |
340 | 340 | case self::DAILY: |
341 | - $duration = 24*3600; |
|
341 | + $duration = 24 * 3600; |
|
342 | 342 | break; |
343 | 343 | case self::WEEKLY: |
344 | - $duration = 7*24*3600; |
|
344 | + $duration = 7 * 24 * 3600; |
|
345 | 345 | break; |
346 | 346 | case self::MONTHLY_MDAY: |
347 | 347 | case self::MONTHLY_WDAY: |
348 | - $duration = 31*24*3600; |
|
348 | + $duration = 31 * 24 * 3600; |
|
349 | 349 | break; |
350 | 350 | case self::YEARLY: |
351 | - $duration = 366*24*3600; |
|
351 | + $duration = 366 * 24 * 3600; |
|
352 | 352 | break; |
353 | 353 | } |
354 | 354 | if ($interval > 1) $duration *= $interval; |
@@ -364,9 +364,9 @@ discard block |
||
364 | 364 | */ |
365 | 365 | private static function daysInMonth(DateTime $time) |
366 | 366 | { |
367 | - list($year,$month) = explode('-',$time->format('Y-m')); |
|
367 | + list($year, $month) = explode('-', $time->format('Y-m')); |
|
368 | 368 | $last_day = new Api\DateTime(); |
369 | - $last_day->setDate($year,$month+1,0); |
|
369 | + $last_day->setDate($year, $month + 1, 0); |
|
370 | 370 | |
371 | 371 | return (int)$last_day->format('d'); |
372 | 372 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | */ |
397 | 397 | public function next_no_exception() |
398 | 398 | { |
399 | - switch($this->type) |
|
399 | + switch ($this->type) |
|
400 | 400 | { |
401 | 401 | case self::NONE: // need to add at least one day, to end "series", as enddate == current date |
402 | 402 | case self::DAILY: |
@@ -411,28 +411,28 @@ discard block |
||
411 | 411 | // --> on the last day of the week we have to additionally advance interval-1 weeks |
412 | 412 | if ($this->interval > 1 && self::getWeekday($this->current) == $this->lastdayofweek) |
413 | 413 | { |
414 | - $this->current->modify(($this->interval-1).' week'); |
|
414 | + $this->current->modify(($this->interval - 1).' week'); |
|
415 | 415 | } |
416 | 416 | $this->current->modify('1 day'); |
417 | 417 | //echo __METHOD__.'() '.$this->current->format('l').', '.$this->current.": $this->weekdays & ".self::getWeekday($this->current)."<br />\n"; |
418 | 418 | } |
419 | - while(!($this->weekdays & self::getWeekday($this->current))); |
|
419 | + while (!($this->weekdays & self::getWeekday($this->current))); |
|
420 | 420 | break; |
421 | 421 | |
422 | 422 | case self::MONTHLY_WDAY: // iCal: BYDAY={1, ..., 5, -1}{MO..SO} |
423 | 423 | // advance to start of next month |
424 | - list($year,$month) = explode('-',$this->current->format('Y-m')); |
|
425 | - $month += $this->interval+($this->monthly_byday_num < 0 ? 1 : 0); |
|
426 | - $this->current->setDate($year,$month,$this->monthly_byday_num < 0 ? 0 : 1); |
|
424 | + list($year, $month) = explode('-', $this->current->format('Y-m')); |
|
425 | + $month += $this->interval + ($this->monthly_byday_num < 0 ? 1 : 0); |
|
426 | + $this->current->setDate($year, $month, $this->monthly_byday_num < 0 ? 0 : 1); |
|
427 | 427 | //echo __METHOD__."() $this->monthly_byday_num".substr(self::$days[$this->monthly_byday_wday],0,2).": setDate($year,$month,1): ".$this->current->format('l').', '.$this->current."<br />\n"; |
428 | 428 | // now advance to n-th week |
429 | 429 | if ($this->monthly_byday_num > 1) |
430 | 430 | { |
431 | - $this->current->modify(($this->monthly_byday_num-1).' week'); |
|
431 | + $this->current->modify(($this->monthly_byday_num - 1).' week'); |
|
432 | 432 | //echo __METHOD__."() $this->monthly_byday_num".substr(self::$days[$this->monthly_byday_wday],0,2).': modify('.($this->monthly_byday_num-1).' week): '.$this->current->format('l').', '.$this->current."<br />\n"; |
433 | 433 | } |
434 | 434 | // advance to given weekday |
435 | - while(!($this->weekdays & self::getWeekday($this->current))) |
|
435 | + while (!($this->weekdays & self::getWeekday($this->current))) |
|
436 | 436 | { |
437 | 437 | $this->current->modify(($this->monthly_byday_num < 0 ? -1 : 1).' day'); |
438 | 438 | //echo __METHOD__."() $this->monthly_byday_num".substr(self::$days[$this->monthly_byday_wday],0,2).': modify(1 day): '.$this->current->format('l').', '.$this->current."<br />\n"; |
@@ -440,10 +440,10 @@ discard block |
||
440 | 440 | break; |
441 | 441 | |
442 | 442 | case self::MONTHLY_MDAY: // iCal: monthly_bymonthday={1, ..., 31, -1} |
443 | - list($year,$month) = explode('-',$this->current->format('Y-m')); |
|
444 | - $day = $this->monthly_bymonthday+($this->monthly_bymonthday < 0 ? 1 : 0); |
|
445 | - $month += $this->interval+($this->monthly_bymonthday < 0 ? 1 : 0); |
|
446 | - $this->current->setDate($year,$month,$day); |
|
443 | + list($year, $month) = explode('-', $this->current->format('Y-m')); |
|
444 | + $day = $this->monthly_bymonthday + ($this->monthly_bymonthday < 0 ? 1 : 0); |
|
445 | + $month += $this->interval + ($this->monthly_bymonthday < 0 ? 1 : 0); |
|
446 | + $this->current->setDate($year, $month, $day); |
|
447 | 447 | //echo __METHOD__."() setDate($year,$month,$day): ".$this->current->format('l').', '.$this->current."<br />\n"; |
448 | 448 | break; |
449 | 449 | |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | { |
466 | 466 | $this->next_no_exception(); |
467 | 467 | } |
468 | - while($this->exceptions && in_array($this->current->format('Ymd'),$this->exceptions)); |
|
468 | + while ($this->exceptions && in_array($this->current->format('Ymd'), $this->exceptions)); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | /** |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | if (isset($this->current)) $backup = $this->current; |
498 | 498 | $this->rewind(); |
499 | 499 | |
500 | - while(--$count > 0) |
|
500 | + while (--$count > 0) |
|
501 | 501 | { |
502 | 502 | $this->next_no_exception(); |
503 | 503 | } |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | // if enddate is now before next acurrence, but not on same day, we use previous recurrence |
523 | 523 | // this can happen if client gives an enddate which is NOT a recurrence date |
524 | 524 | // eg. for a on Monday recurring weekly event a Tuesday as enddate |
525 | - if ($this->enddate < $this->current && $this->current->format('Ymd') != $this->enddate->format('Ymd')) |
|
525 | + if ($this->enddate < $this->current && $this->current->format('Ymd') != $this->enddate->format('Ymd')) |
|
526 | 526 | { |
527 | 527 | $last = $previous; |
528 | 528 | } |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | $this->current = clone $this->time; |
542 | 542 | while ($this->valid() && |
543 | 543 | $this->exceptions && |
544 | - in_array($this->current->format('Ymd'),$this->exceptions)) |
|
544 | + in_array($this->current->format('Ymd'), $this->exceptions)) |
|
545 | 545 | { |
546 | 546 | $this->next_no_exception(); |
547 | 547 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | * @param boolean $use_just_date =false default use also time |
554 | 554 | * @return boolean |
555 | 555 | */ |
556 | - public function valid($use_just_date=false) |
|
556 | + public function valid($use_just_date = false) |
|
557 | 557 | { |
558 | 558 | if ($use_just_date) |
559 | 559 | { |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | { |
572 | 572 | $str = ''; |
573 | 573 | // Repeated Events |
574 | - if($this->type != self::NONE) |
|
574 | + if ($this->type != self::NONE) |
|
575 | 575 | { |
576 | 576 | $str = lang(self::$types[$this->type]); |
577 | 577 | |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | { |
590 | 590 | $repeat_days[] = $this->type == self::WEEKLY ? lang('all') : lang('day'); |
591 | 591 | } |
592 | - elseif($this->weekdays == self::WORKDAYS) |
|
592 | + elseif ($this->weekdays == self::WORKDAYS) |
|
593 | 593 | { |
594 | 594 | $repeat_days[] = $this->type == self::WEEKLY ? lang('workdays') : lang('workday'); |
595 | 595 | } |
@@ -603,18 +603,18 @@ discard block |
||
603 | 603 | } |
604 | 604 | } |
605 | 605 | } |
606 | - if($this->type == self::WEEKLY && count($repeat_days)) |
|
606 | + if ($this->type == self::WEEKLY && count($repeat_days)) |
|
607 | 607 | { |
608 | - $str_extra[] = lang('days repeated').': '.implode(', ',$repeat_days); |
|
608 | + $str_extra[] = lang('days repeated').': '.implode(', ', $repeat_days); |
|
609 | 609 | } |
610 | - elseif($this->type == self::MONTHLY_WDAY) |
|
610 | + elseif ($this->type == self::MONTHLY_WDAY) |
|
611 | 611 | { |
612 | - $str_extra[] = ($this->monthly_byday_num == -1 ? lang('last') : $this->monthly_byday_num.'.').' '.implode(', ',$repeat_days); |
|
612 | + $str_extra[] = ($this->monthly_byday_num == -1 ? lang('last') : $this->monthly_byday_num.'.').' '.implode(', ', $repeat_days); |
|
613 | 613 | } |
614 | 614 | break; |
615 | 615 | |
616 | 616 | } |
617 | - if($this->interval > 1) |
|
617 | + if ($this->interval > 1) |
|
618 | 618 | { |
619 | 619 | $str_extra[] = lang('Interval').': '.$this->interval; |
620 | 620 | } |
@@ -630,9 +630,9 @@ discard block |
||
630 | 630 | { |
631 | 631 | $str_extra[] = $this->time->getTimezone()->getName(); |
632 | 632 | } |
633 | - if(count($str_extra)) |
|
633 | + if (count($str_extra)) |
|
634 | 634 | { |
635 | - $str .= ' ('.implode(', ',$str_extra).')'; |
|
635 | + $str .= ' ('.implode(', ', $str_extra).')'; |
|
636 | 636 | } |
637 | 637 | } |
638 | 638 | return $str; |
@@ -644,16 +644,16 @@ discard block |
||
644 | 644 | * |
645 | 645 | * $return array vCalendar RRULE |
646 | 646 | */ |
647 | - public function generate_rrule($version='2.0') |
|
647 | + public function generate_rrule($version = '2.0') |
|
648 | 648 | { |
649 | 649 | $repeat_days = array(); |
650 | 650 | $rrule = array(); |
651 | 651 | |
652 | - if ($this->type == self::NONE) return false; // no recuring event |
|
652 | + if ($this->type == self::NONE) return false; // no recuring event |
|
653 | 653 | |
654 | 654 | if ($version == '1.0') |
655 | 655 | { |
656 | - $rrule['FREQ'] = self::$recur_egw2ical_1_0[$this->type] . $this->interval; |
|
656 | + $rrule['FREQ'] = self::$recur_egw2ical_1_0[$this->type].$this->interval; |
|
657 | 657 | switch ($this->type) |
658 | 658 | { |
659 | 659 | case self::WEEKLY: |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | { |
662 | 662 | if ($this->weekdays & $mask) |
663 | 663 | { |
664 | - $repeat_days[] = strtoupper(substr($label,0,2)); |
|
664 | + $repeat_days[] = strtoupper(substr($label, 0, 2)); |
|
665 | 665 | } |
666 | 666 | } |
667 | 667 | $rrule['BYDAY'] = implode(' ', $repeat_days); |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | case self::MONTHLY_WDAY: // weekday of the month: BDAY={1..5}+ {MO..SO} |
675 | 675 | $rrule['BYDAY'] = abs($this->monthly_byday_num); |
676 | 676 | $rrule['BYDAY'] .= ($this->monthly_byday_num < 0) ? '- ' : '+ '; |
677 | - $rrule['BYDAY'] .= strtoupper(substr($this->time->format('l'),0,2)); |
|
677 | + $rrule['BYDAY'] .= strtoupper(substr($this->time->format('l'), 0, 2)); |
|
678 | 678 | $rrule['FREQ'] = $rrule['FREQ'].' '.$rrule['BYDAY']; |
679 | 679 | break; |
680 | 680 | } |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | { |
695 | 695 | if ($this->weekdays & $mask) |
696 | 696 | { |
697 | - $repeat_days[] = strtoupper(substr($label,0,2)); |
|
697 | + $repeat_days[] = strtoupper(substr($label, 0, 2)); |
|
698 | 698 | } |
699 | 699 | } |
700 | 700 | $rrule['BYDAY'] = implode(',', $repeat_days); |
@@ -705,8 +705,8 @@ discard block |
||
705 | 705 | break; |
706 | 706 | |
707 | 707 | case self::MONTHLY_WDAY: // weekday of the month: BDAY={1..5}{MO..SO} |
708 | - $rrule['BYDAY'] = $this->monthly_byday_num . |
|
709 | - strtoupper(substr($this->time->format('l'),0,2)); |
|
708 | + $rrule['BYDAY'] = $this->monthly_byday_num. |
|
709 | + strtoupper(substr($this->time->format('l'), 0, 2)); |
|
710 | 710 | break; |
711 | 711 | } |
712 | 712 | if ($this->interval > 1) |
@@ -741,12 +741,12 @@ discard block |
||
741 | 741 | * |
742 | 742 | * @return calendar_rrule false on error |
743 | 743 | */ |
744 | - public static function event2rrule(array $event,$usertime=true,$to_tz=null) |
|
744 | + public static function event2rrule(array $event, $usertime = true, $to_tz = null) |
|
745 | 745 | { |
746 | - if (!is_array($event) || !isset($event['tzid'])) return false; |
|
746 | + if (!is_array($event) || !isset($event['tzid'])) return false; |
|
747 | 747 | if (!$to_tz) $to_tz = $event['tzid']; |
748 | 748 | $timestamp_tz = $usertime ? Api\DateTime::$user_timezone : Api\DateTime::$server_timezone; |
749 | - $time = is_a($event['start'],'DateTime') ? $event['start'] : new Api\DateTime($event['start'],$timestamp_tz); |
|
749 | + $time = is_a($event['start'], 'DateTime') ? $event['start'] : new Api\DateTime($event['start'], $timestamp_tz); |
|
750 | 750 | |
751 | 751 | if (!isset(self::$tz_cache[$to_tz])) |
752 | 752 | { |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | |
760 | 760 | if ($event['recur_enddate']) |
761 | 761 | { |
762 | - $enddate = is_a($event['recur_enddate'],'DateTime') ? clone $event['recur_enddate'] : new Api\DateTime($event['recur_enddate'],$timestamp_tz); |
|
762 | + $enddate = is_a($event['recur_enddate'], 'DateTime') ? clone $event['recur_enddate'] : new Api\DateTime($event['recur_enddate'], $timestamp_tz); |
|
763 | 763 | |
764 | 764 | // Check to see if switching timezones changes the date, we'll need to adjust for that |
765 | 765 | $enddate_event_timezone = clone $enddate; |
@@ -767,22 +767,22 @@ discard block |
||
767 | 767 | $delta = (int)$enddate_event_timezone->format('z') - (int)$enddate->format('z'); |
768 | 768 | $enddate->add("$delta days"); |
769 | 769 | |
770 | - $end = is_a($event['end'],'DateTime') ? clone $event['end'] : new Api\DateTime($event['end'],$timestamp_tz); |
|
770 | + $end = is_a($event['end'], 'DateTime') ? clone $event['end'] : new Api\DateTime($event['end'], $timestamp_tz); |
|
771 | 771 | $end->setTimezone($enddate->getTimezone()); |
772 | - $enddate->setTime($end->format('H'),$end->format('i'),0); |
|
773 | - if($event['whole_day']) |
|
772 | + $enddate->setTime($end->format('H'), $end->format('i'), 0); |
|
773 | + if ($event['whole_day']) |
|
774 | 774 | { |
775 | - $enddate->setTime(23,59,59); |
|
775 | + $enddate->setTime(23, 59, 59); |
|
776 | 776 | } |
777 | 777 | } |
778 | 778 | if (is_array($event['recur_exception'])) |
779 | 779 | { |
780 | - foreach($event['recur_exception'] as $exception) |
|
780 | + foreach ($event['recur_exception'] as $exception) |
|
781 | 781 | { |
782 | - $exceptions[] = is_a($exception,'DateTime') ? $exception : new Api\DateTime($exception,$timestamp_tz); |
|
782 | + $exceptions[] = is_a($exception, 'DateTime') ? $exception : new Api\DateTime($exception, $timestamp_tz); |
|
783 | 783 | } |
784 | 784 | } |
785 | - return new calendar_rrule($time,$event['recur_type'],$event['recur_interval'],$enddate,$event['recur_data'],$exceptions); |
|
785 | + return new calendar_rrule($time, $event['recur_type'], $event['recur_interval'], $enddate, $event['recur_data'], $exceptions); |
|
786 | 786 | } |
787 | 787 | |
788 | 788 | /** |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | $exceptions = array(); |
801 | 801 | |
802 | 802 | list($type, $sub, $conditions) = explode(' (', $rrule); |
803 | - if(!$conditions) |
|
803 | + if (!$conditions) |
|
804 | 804 | { |
805 | 805 | $conditions = $sub; |
806 | 806 | } |
@@ -810,10 +810,10 @@ discard block |
||
810 | 810 | } |
811 | 811 | $conditions = explode(', ', substr($conditions, 0, -1)); |
812 | 812 | |
813 | - foreach(static::$types as $id => $type_name) |
|
813 | + foreach (static::$types as $id => $type_name) |
|
814 | 814 | { |
815 | 815 | $str = lang($type_name); |
816 | - if($str == $type) |
|
816 | + if ($str == $type) |
|
817 | 817 | { |
818 | 818 | $type_id = $id; |
819 | 819 | break; |
@@ -821,25 +821,25 @@ discard block |
||
821 | 821 | } |
822 | 822 | |
823 | 823 | // Rejoin some extra splits for conditions with multiple values |
824 | - foreach($conditions as $condition_index => $condition) |
|
824 | + foreach ($conditions as $condition_index => $condition) |
|
825 | 825 | { |
826 | - if(((int)$condition || strpos($condition, lang('last')) === 0) && |
|
827 | - substr_compare( $condition, lang('day'), -strlen( lang('day') ) ) === 0) |
|
826 | + if (((int)$condition || strpos($condition, lang('last')) === 0) && |
|
827 | + substr_compare($condition, lang('day'), -strlen(lang('day'))) === 0) |
|
828 | 828 | { |
829 | 829 | $time->setDate($time->format('Y'), $time->format('m'), (int)($condition) ? (int)$condition : $time->format('t')); |
830 | 830 | unset($conditions[$condition_index]); |
831 | 831 | continue; |
832 | 832 | } |
833 | - if(!strpos($condition, ':') && strpos($conditions[$condition_index-1], ':')) |
|
833 | + if (!strpos($condition, ':') && strpos($conditions[$condition_index - 1], ':')) |
|
834 | 834 | { |
835 | - $conditions[$condition_index-1] .= ', ' . $condition; |
|
835 | + $conditions[$condition_index - 1] .= ', '.$condition; |
|
836 | 836 | unset($conditions[$condition_index]); |
837 | 837 | } |
838 | 838 | } |
839 | - foreach($conditions as $condition_index => $condition) |
|
839 | + foreach ($conditions as $condition_index => $condition) |
|
840 | 840 | { |
841 | 841 | list($condition_name, $value) = explode(': ', $condition); |
842 | - if($condition_name == lang('days repeated')) |
|
842 | + if ($condition_name == lang('days repeated')) |
|
843 | 843 | { |
844 | 844 | foreach (self::$days as $mask => $label) |
845 | 845 | { |
@@ -848,7 +848,7 @@ discard block |
||
848 | 848 | $weekdays += $mask; |
849 | 849 | } |
850 | 850 | } |
851 | - if(stripos($condition, lang('all')) !== false) |
|
851 | + if (stripos($condition, lang('all')) !== false) |
|
852 | 852 | { |
853 | 853 | $weekdays = self::ALLDAYS; |
854 | 854 | } |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | } |
865 | 865 | } |
866 | 866 | |
867 | - return new calendar_rrule($time,$type_id,$interval,$enddate,$weekdays,$exceptions); |
|
867 | + return new calendar_rrule($time, $type_id, $interval, $enddate, $weekdays, $exceptions); |
|
868 | 868 | } |
869 | 869 | /** |
870 | 870 | * Get recurrence data (keys 'recur_*') to merge into an event |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | * @param DateTime/string starttime of the event (in servertime) |
890 | 890 | * @param string $to_tz new timezone |
891 | 891 | */ |
892 | - public static function rrule2tz(array &$event,$starttime,$to_tz) |
|
892 | + public static function rrule2tz(array &$event, $starttime, $to_tz) |
|
893 | 893 | { |
894 | 894 | // We assume that the difference between timezones can result |
895 | 895 | // in a maximum of one day |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | self::$tz_cache[$to_tz] = calendar_timezones::DateTimeZone($to_tz); |
911 | 911 | } |
912 | 912 | |
913 | - $time = is_a($starttime,'DateTime') ? |
|
913 | + $time = is_a($starttime, 'DateTime') ? |
|
914 | 914 | $starttime : new Api\DateTime($starttime, Api\DateTime::$server_timezone); |
915 | 915 | $time->setTimezone(self::$tz_cache[$event['tzid']]); |
916 | 916 | $remote = clone $time; |
@@ -928,11 +928,11 @@ discard block |
||
928 | 928 | if ($delta == 1 || $delta == -6) |
929 | 929 | { |
930 | 930 | $mask = $mask << 1; |
931 | - if ($mask & 128) $mask = $mask - 127; // overflow |
|
931 | + if ($mask&128) $mask = $mask - 127; // overflow |
|
932 | 932 | } |
933 | 933 | else |
934 | 934 | { |
935 | - if ($mask & 1) $mask = $mask + 128; // underflow |
|
935 | + if ($mask&1) $mask = $mask + 128; // underflow |
|
936 | 936 | $mask = $mask >> 1; |
937 | 937 | } |
938 | 938 | $event['recur_data'] = $mask; |
@@ -943,7 +943,7 @@ discard block |
||
943 | 943 | |
944 | 944 | if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) // some tests |
945 | 945 | { |
946 | - ini_set('display_errors',1); |
|
946 | + ini_set('display_errors', 1); |
|
947 | 947 | error_reporting(E_ALL & ~E_NOTICE); |
948 | 948 | function lang($str) { return $str; } |
949 | 949 | $GLOBALS['egw_info']['user']['preferences']['common']['tz'] = $_REQUEST['user-tz'] ? $_REQUEST['user-tz'] : 'Europe/Berlin'; |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | |
952 | 952 | if (!isset($_REQUEST['time'])) |
953 | 953 | { |
954 | - $now = new Api\DateTime('now',new DateTimeZone($_REQUEST['tz'] = 'UTC')); |
|
954 | + $now = new Api\DateTime('now', new DateTimeZone($_REQUEST['tz'] = 'UTC')); |
|
955 | 955 | $_REQUEST['time'] = $now->format(); |
956 | 956 | $_REQUEST['type'] = calendar_rrule::WEEKLY; |
957 | 957 | $_REQUEST['interval'] = 2; |
@@ -960,29 +960,29 @@ discard block |
||
960 | 960 | $_REQUEST['user-tz'] = 'Europe/Berlin'; |
961 | 961 | } |
962 | 962 | echo "<html>\n<head>\n\t<title>Test calendar_rrule class</title>\n</head>\n<body>\n<form method='GET'>\n"; |
963 | - echo "<p>Date+Time: ".Api\Html::input('time',$_REQUEST['time']). |
|
964 | - Api\Html::select('tz',$_REQUEST['tz'],Api\DateTime::getTimezones())."</p>\n"; |
|
965 | - echo "<p>Type: ".Api\Html::select('type',$_REQUEST['type'],calendar_rrule::$types)."\n". |
|
966 | - "Interval: ".Api\Html::input('interval',$_REQUEST['interval'])."</p>\n"; |
|
963 | + echo "<p>Date+Time: ".Api\Html::input('time', $_REQUEST['time']). |
|
964 | + Api\Html::select('tz', $_REQUEST['tz'], Api\DateTime::getTimezones())."</p>\n"; |
|
965 | + echo "<p>Type: ".Api\Html::select('type', $_REQUEST['type'], calendar_rrule::$types)."\n". |
|
966 | + "Interval: ".Api\Html::input('interval', $_REQUEST['interval'])."</p>\n"; |
|
967 | 967 | echo "<table><tr><td>\n"; |
968 | - echo "Weekdays:<br />".Api\Html::checkbox_multiselect('weekdays',$_REQUEST['weekdays'],calendar_rrule::$days,false,'','7',false,'height: 150px;')."\n"; |
|
968 | + echo "Weekdays:<br />".Api\Html::checkbox_multiselect('weekdays', $_REQUEST['weekdays'], calendar_rrule::$days, false, '', '7', false, 'height: 150px;')."\n"; |
|
969 | 969 | echo "</td><td>\n"; |
970 | - echo "<p>Exceptions:<br />".Api\Html::textarea('exceptions',$_REQUEST['exceptions'],'style="height: 150px;"')."\n"; |
|
970 | + echo "<p>Exceptions:<br />".Api\Html::textarea('exceptions', $_REQUEST['exceptions'], 'style="height: 150px;"')."\n"; |
|
971 | 971 | echo "</td></tr></table>\n"; |
972 | - echo "<p>Enddate: ".Api\Html::input('enddate',$_REQUEST['enddate'])."</p>\n"; |
|
973 | - echo "<p>Display recurances in ".Api\Html::select('user-tz',$_REQUEST['user-tz'],Api\DateTime::getTimezones())."</p>\n"; |
|
974 | - echo "<p>".Api\Html::submit_button('calc','Calculate')."</p>\n"; |
|
972 | + echo "<p>Enddate: ".Api\Html::input('enddate', $_REQUEST['enddate'])."</p>\n"; |
|
973 | + echo "<p>Display recurances in ".Api\Html::select('user-tz', $_REQUEST['user-tz'], Api\DateTime::getTimezones())."</p>\n"; |
|
974 | + echo "<p>".Api\Html::submit_button('calc', 'Calculate')."</p>\n"; |
|
975 | 975 | echo "</form>\n"; |
976 | 976 | |
977 | 977 | $tz = new DateTimeZone($_REQUEST['tz']); |
978 | - $time = new Api\DateTime($_REQUEST['time'],$tz); |
|
979 | - if ($_REQUEST['enddate']) $enddate = new Api\DateTime($_REQUEST['enddate'],$tz); |
|
980 | - $weekdays = 0; foreach((array)$_REQUEST['weekdays'] as $mask) { $weekdays |= $mask; } |
|
981 | - if ($_REQUEST['exceptions']) foreach(preg_split("/[,\r\n]+ ?/",$_REQUEST['exceptions']) as $exception) { $exceptions[] = new Api\DateTime($exception); } |
|
978 | + $time = new Api\DateTime($_REQUEST['time'], $tz); |
|
979 | + if ($_REQUEST['enddate']) $enddate = new Api\DateTime($_REQUEST['enddate'], $tz); |
|
980 | + $weekdays = 0; foreach ((array)$_REQUEST['weekdays'] as $mask) { $weekdays |= $mask; } |
|
981 | + if ($_REQUEST['exceptions']) foreach (preg_split("/[,\r\n]+ ?/", $_REQUEST['exceptions']) as $exception) { $exceptions[] = new Api\DateTime($exception); } |
|
982 | 982 | |
983 | - $rrule = new calendar_rrule($time,$_REQUEST['type'],$_REQUEST['interval'],$enddate,$weekdays,$exceptions); |
|
983 | + $rrule = new calendar_rrule($time, $_REQUEST['type'], $_REQUEST['interval'], $enddate, $weekdays, $exceptions); |
|
984 | 984 | echo "<h3>".$time->format('l').', '.$time.' ('.$tz->getName().') '.$rrule."</h3>\n"; |
985 | - foreach($rrule as $rtime) |
|
985 | + foreach ($rrule as $rtime) |
|
986 | 986 | { |
987 | 987 | $rtime->setTimezone(Api\DateTime::$user_timezone); |
988 | 988 | echo ++$n.': '.$rtime->format('l').', '.$rtime."<br />\n"; |
@@ -351,7 +351,10 @@ discard block |
||
351 | 351 | $duration = 366*24*3600; |
352 | 352 | break; |
353 | 353 | } |
354 | - if ($interval > 1) $duration *= $interval; |
|
354 | + if ($interval > 1) |
|
355 | + { |
|
356 | + $duration *= $interval; |
|
357 | + } |
|
355 | 358 | |
356 | 359 | return $duration; |
357 | 360 | } |
@@ -494,7 +497,10 @@ discard block |
||
494 | 497 | { |
495 | 498 | return clone $this->time; |
496 | 499 | } |
497 | - if (isset($this->current)) $backup = $this->current; |
|
500 | + if (isset($this->current)) |
|
501 | + { |
|
502 | + $backup = $this->current; |
|
503 | + } |
|
498 | 504 | $this->rewind(); |
499 | 505 | |
500 | 506 | while(--$count > 0) |
@@ -502,7 +508,10 @@ discard block |
||
502 | 508 | $this->next_no_exception(); |
503 | 509 | } |
504 | 510 | $ret = clone $this->current; |
505 | - if ($backup) $this->current = $backup; |
|
511 | + if ($backup) |
|
512 | + { |
|
513 | + $this->current = $backup; |
|
514 | + } |
|
506 | 515 | return $ret; |
507 | 516 | } |
508 | 517 | |
@@ -649,7 +658,11 @@ discard block |
||
649 | 658 | $repeat_days = array(); |
650 | 659 | $rrule = array(); |
651 | 660 | |
652 | - if ($this->type == self::NONE) return false; // no recuring event |
|
661 | + if ($this->type == self::NONE) |
|
662 | + { |
|
663 | + return false; |
|
664 | + } |
|
665 | + // no recuring event |
|
653 | 666 | |
654 | 667 | if ($version == '1.0') |
655 | 668 | { |
@@ -743,8 +756,14 @@ discard block |
||
743 | 756 | */ |
744 | 757 | public static function event2rrule(array $event,$usertime=true,$to_tz=null) |
745 | 758 | { |
746 | - if (!is_array($event) || !isset($event['tzid'])) return false; |
|
747 | - if (!$to_tz) $to_tz = $event['tzid']; |
|
759 | + if (!is_array($event) || !isset($event['tzid'])) |
|
760 | + { |
|
761 | + return false; |
|
762 | + } |
|
763 | + if (!$to_tz) |
|
764 | + { |
|
765 | + $to_tz = $event['tzid']; |
|
766 | + } |
|
748 | 767 | $timestamp_tz = $usertime ? Api\DateTime::$user_timezone : Api\DateTime::$server_timezone; |
749 | 768 | $time = is_a($event['start'],'DateTime') ? $event['start'] : new Api\DateTime($event['start'],$timestamp_tz); |
750 | 769 | |
@@ -899,7 +918,10 @@ discard block |
||
899 | 918 | $event['recur_type'] == self::NONE || |
900 | 919 | empty($event['recur_data']) || $event['recur_data'] == self::ALLDAYS || |
901 | 920 | empty($event['tzid']) || empty($to_tz) || |
902 | - $event['tzid'] == $to_tz) return; |
|
921 | + $event['tzid'] == $to_tz) |
|
922 | + { |
|
923 | + return; |
|
924 | + } |
|
903 | 925 | |
904 | 926 | if (!isset(self::$tz_cache[$event['tzid']])) |
905 | 927 | { |
@@ -928,11 +950,19 @@ discard block |
||
928 | 950 | if ($delta == 1 || $delta == -6) |
929 | 951 | { |
930 | 952 | $mask = $mask << 1; |
931 | - if ($mask & 128) $mask = $mask - 127; // overflow |
|
953 | + if ($mask & 128) |
|
954 | + { |
|
955 | + $mask = $mask - 127; |
|
956 | + } |
|
957 | + // overflow |
|
932 | 958 | } |
933 | 959 | else |
934 | 960 | { |
935 | - if ($mask & 1) $mask = $mask + 128; // underflow |
|
961 | + if ($mask & 1) |
|
962 | + { |
|
963 | + $mask = $mask + 128; |
|
964 | + } |
|
965 | + // underflow |
|
936 | 966 | $mask = $mask >> 1; |
937 | 967 | } |
938 | 968 | $event['recur_data'] = $mask; |
@@ -941,11 +971,16 @@ discard block |
||
941 | 971 | } |
942 | 972 | } |
943 | 973 | |
944 | -if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) // some tests |
|
974 | +if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) |
|
975 | +{ |
|
976 | + // some tests |
|
945 | 977 | { |
946 | 978 | ini_set('display_errors',1); |
979 | +} |
|
947 | 980 | error_reporting(E_ALL & ~E_NOTICE); |
948 | - function lang($str) { return $str; } |
|
981 | + function lang($str) |
|
982 | + { |
|
983 | +return $str; } |
|
949 | 984 | $GLOBALS['egw_info']['user']['preferences']['common']['tz'] = $_REQUEST['user-tz'] ? $_REQUEST['user-tz'] : 'Europe/Berlin'; |
950 | 985 | require_once('../../api/src/autoload.php'); |
951 | 986 | |
@@ -976,9 +1011,18 @@ discard block |
||
976 | 1011 | |
977 | 1012 | $tz = new DateTimeZone($_REQUEST['tz']); |
978 | 1013 | $time = new Api\DateTime($_REQUEST['time'],$tz); |
979 | - if ($_REQUEST['enddate']) $enddate = new Api\DateTime($_REQUEST['enddate'],$tz); |
|
980 | - $weekdays = 0; foreach((array)$_REQUEST['weekdays'] as $mask) { $weekdays |= $mask; } |
|
981 | - if ($_REQUEST['exceptions']) foreach(preg_split("/[,\r\n]+ ?/",$_REQUEST['exceptions']) as $exception) { $exceptions[] = new Api\DateTime($exception); } |
|
1014 | + if ($_REQUEST['enddate']) |
|
1015 | + { |
|
1016 | + $enddate = new Api\DateTime($_REQUEST['enddate'],$tz); |
|
1017 | + } |
|
1018 | + $weekdays = 0; foreach((array)$_REQUEST['weekdays'] as $mask) |
|
1019 | + { |
|
1020 | +$weekdays |= $mask; } |
|
1021 | + if ($_REQUEST['exceptions']) |
|
1022 | + { |
|
1023 | + foreach(preg_split("/[,\r\n]+ ?/",$_REQUEST['exceptions']) as $exception) { $exceptions[] = new Api\DateTime($exception); |
|
1024 | + } |
|
1025 | + } |
|
982 | 1026 | |
983 | 1027 | $rrule = new calendar_rrule($time,$_REQUEST['type'],$_REQUEST['interval'],$enddate,$weekdays,$exceptions); |
984 | 1028 | echo "<h3>".$time->format('l').', '.$time.' ('.$tz->getName().') '.$rrule."</h3>\n"; |
@@ -33,7 +33,8 @@ |
||
33 | 33 | // List each custom field |
34 | 34 | unset($this->mapping_fields['customfields']); |
35 | 35 | $custom = Api\Storage\Customfields::get('calendar'); |
36 | - foreach($custom as $name => $data) { |
|
36 | + foreach($custom as $name => $data) |
|
37 | + { |
|
37 | 38 | $this->mapping_fields['#'.$name] = $data['label']; |
38 | 39 | } |
39 | 40 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | class calendar_wizard_import_csv extends importexport_wizard_basic_import_csv |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
18 | + /** |
|
19 | 19 | * constructor |
20 | 20 | */ |
21 | 21 | function __construct() |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | // List each custom field |
37 | 37 | unset($this->mapping_fields['customfields']); |
38 | 38 | $custom = Api\Storage\Customfields::get('calendar'); |
39 | - foreach($custom as $name => $data) { |
|
39 | + foreach ($custom as $name => $data) { |
|
40 | 40 | $this->mapping_fields['#'.$name] = $data['label']; |
41 | 41 | } |
42 | 42 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv) |
57 | 57 | { |
58 | 58 | $result = parent::wizard_step50($content, $sel_options, $readonlys, $preserv); |
59 | - $content['msg'] .= "\n*" ; |
|
59 | + $content['msg'] .= "\n*"; |
|
60 | 60 | |
61 | 61 | return $result; |
62 | 62 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | 'id' => 'Calendar ID' |
72 | 72 | ); |
73 | 73 | |
74 | - if(!$content['skip_conflicts'] && $content['plugin_options']['skip_conflicts']) |
|
74 | + if (!$content['skip_conflicts'] && $content['plugin_options']['skip_conflicts']) |
|
75 | 75 | { |
76 | 76 | $content['skip_conflicts'] = $content['plugin_options']['skip_conflicts']; |
77 | 77 | } |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | */ |
367 | 367 | protected function get_selects() |
368 | 368 | { |
369 | - $this->selects['priority'] = Array( |
|
369 | + $this->selects['priority'] = array( |
|
370 | 370 | 0 => lang('None'), |
371 | 371 | 1 => lang('Low'), |
372 | 372 | 2 => lang('Normal'), |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | /** |
395 | 395 | * Adjust automatically generated field filters |
396 | 396 | */ |
397 | - public function get_filter_fields(Array &$filters) |
|
397 | + public function get_filter_fields(array &$filters) |
|
398 | 398 | { |
399 | 399 | |
400 | 400 | // Calendar SO doesn't support filtering by column, so we have to remove pretty much everything |
@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @param egw_record $_definition |
31 | 31 | */ |
32 | - public function export( $_stream, importexport_definition $_definition) { |
|
32 | + public function export($_stream, importexport_definition $_definition) { |
|
33 | 33 | $options = $_definition->plugin_options; |
34 | 34 | |
35 | 35 | $limit_exception = Api\Storage\Merge::is_export_limit_excepted(); |
36 | 36 | if (!$limit_exception) $export_limit = Api\Storage\Merge::getExportLimit('calendar'); |
37 | 37 | // Custom fields need to be specifically requested |
38 | 38 | $cfs = array(); |
39 | - foreach($options['mapping'] + (array)$_definition->filter as $key => $label) { |
|
40 | - if($key[0] == '#') $cfs[] = substr($key,1); |
|
39 | + foreach ($options['mapping'] + (array)$_definition->filter as $key => $label) { |
|
40 | + if ($key[0] == '#') $cfs[] = substr($key, 1); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | $query = array( |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | 'num_rows' => -1, |
46 | 46 | 'csv_export' => true |
47 | 47 | ); |
48 | - switch($options['selection']) |
|
48 | + switch ($options['selection']) |
|
49 | 49 | { |
50 | 50 | case 'criteria': |
51 | 51 | $query = array( |
@@ -55,33 +55,33 @@ discard block |
||
55 | 55 | 'users' => $options['criteria']['owner'], |
56 | 56 | 'cfs' => $cfs // Otherwise we shouldn't get any custom fields |
57 | 57 | ); |
58 | - if($options['criteria']['start']) |
|
58 | + if ($options['criteria']['start']) |
|
59 | 59 | { |
60 | 60 | $query['start'] = $options['criteria']['start']; |
61 | 61 | } |
62 | - if($options['criteria']['end']) |
|
62 | + if ($options['criteria']['end']) |
|
63 | 63 | { |
64 | - $query['end'] = strtotime('+1 day',$options['criteria']['end'])-1; |
|
64 | + $query['end'] = strtotime('+1 day', $options['criteria']['end']) - 1; |
|
65 | 65 | } |
66 | - if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
66 | + if (Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
67 | 67 | $query['offset'] = 0; |
68 | 68 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
69 | 69 | } |
70 | - $events =& $this->bo->search($query); |
|
70 | + $events = & $this->bo->search($query); |
|
71 | 71 | break; |
72 | 72 | case 'search_results': |
73 | 73 | $states = $this->bo->cal_prefs['saved_states']; |
74 | 74 | $query = Api\Cache::getSession('calendar', 'calendar_list'); |
75 | - $query['num_rows'] = -1; // all |
|
76 | - $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
75 | + $query['num_rows'] = -1; // all |
|
76 | + $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
77 | 77 | $query['start'] = 0; |
78 | 78 | $query['cfs'] = $cfs; |
79 | - if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) |
|
79 | + if (Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) |
|
80 | 80 | { |
81 | 81 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
82 | 82 | } |
83 | 83 | $ui = new calendar_uilist(); |
84 | - if($states['view'] == 'listview') |
|
84 | + if ($states['view'] == 'listview') |
|
85 | 85 | { |
86 | 86 | $ui->get_rows($query, $events, $unused); |
87 | 87 | } |
@@ -98,35 +98,35 @@ discard block |
||
98 | 98 | $filter = $_definition->filter; |
99 | 99 | |
100 | 100 | // Handle ranges |
101 | - foreach($filter as $field => $value) |
|
101 | + foreach ($filter as $field => $value) |
|
102 | 102 | { |
103 | - if($field == 'filter' && $value) |
|
103 | + if ($field == 'filter' && $value) |
|
104 | 104 | { |
105 | 105 | $query['filter'] = $value; |
106 | 106 | continue; |
107 | 107 | } |
108 | - if(!is_array($value) || (!$value['from'] && !$value['to'])) |
|
108 | + if (!is_array($value) || (!$value['from'] && !$value['to'])) |
|
109 | 109 | { |
110 | 110 | $query['query']["cal_$field"] = $value; |
111 | 111 | continue; |
112 | 112 | } |
113 | 113 | |
114 | 114 | // Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10) |
115 | - if($value['from']) $query['sql_filter'][] = "cal_$field >= " . (int)$value['from']; |
|
116 | - if($value['to']) $query['sql_filter'][] = "cal_$field <= " . (int)$value['to']; |
|
115 | + if ($value['from']) $query['sql_filter'][] = "cal_$field >= ".(int)$value['from']; |
|
116 | + if ($value['to']) $query['sql_filter'][] = "cal_$field <= ".(int)$value['to']; |
|
117 | 117 | |
118 | 118 | } |
119 | - if($query['sql_filter'] && is_array($query['sql_filter'])) |
|
119 | + if ($query['sql_filter'] && is_array($query['sql_filter'])) |
|
120 | 120 | { |
121 | 121 | // Set as an extra parameter |
122 | - $sql_filter = implode(' AND ',$query['sql_filter']); |
|
122 | + $sql_filter = implode(' AND ', $query['sql_filter']); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | case 'all': |
126 | 126 | $events = $this->bo->search($query + array( |
127 | 127 | 'offset' => 0, |
128 | 128 | 'order' => 'cal_start', |
129 | - ),$sql_filter); |
|
129 | + ), $sql_filter); |
|
130 | 130 | break; |
131 | 131 | } |
132 | 132 | |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | // Get rid of yearly recurring events that don't belong |
146 | 146 | //if($options['selection']['select'] == 'criteria' && ($event['start'] > $query['end'] || $event['end'] < $query['start'])) continue; |
147 | 147 | // Add in participants |
148 | - if($options['mapping']['participants']) |
|
148 | + if ($options['mapping']['participants']) |
|
149 | 149 | { |
150 | - if(is_array($event['participants'])) |
|
150 | + if (is_array($event['participants'])) |
|
151 | 151 | { |
152 | - $event['participants'] = implode(", ",$this->bo->participants($event,true)); |
|
152 | + $event['participants'] = implode(", ", $this->bo->participants($event, true)); |
|
153 | 153 | } |
154 | 154 | else |
155 | 155 | { |
@@ -160,23 +160,23 @@ discard block |
||
160 | 160 | if (is_array($event)) |
161 | 161 | { |
162 | 162 | $record->set_record($event); |
163 | - if($options['mapping']['recurrence']) |
|
163 | + if ($options['mapping']['recurrence']) |
|
164 | 164 | { |
165 | 165 | $rrule = calendar_rrule::event2rrule($event); |
166 | 166 | $record->recurrence = $rrule->__toString(); |
167 | 167 | } |
168 | 168 | |
169 | 169 | // Standard stuff |
170 | - if($options['convert']) |
|
170 | + if ($options['convert']) |
|
171 | 171 | { |
172 | 172 | importexport_export_csv::convert($record, $convert_fields, 'calendar', $this->selects); |
173 | 173 | } |
174 | 174 | else |
175 | 175 | { |
176 | 176 | // Implode arrays, so they don't say 'Array' |
177 | - foreach($record->get_record_array() as $key => $value) |
|
177 | + foreach ($record->get_record_array() as $key => $value) |
|
178 | 178 | { |
179 | - if(is_array($value)) $record->$key = implode(',', $value); |
|
179 | + if (is_array($value)) $record->$key = implode(',', $value); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | $export_object->export_record($record); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $states = $this->bo->cal_prefs['saved_states']; |
239 | 239 | $list = Api\Cache::getSession('calendar', 'calendar_list'); |
240 | 240 | |
241 | - $start= new Api\DateTime($list['startdate']); |
|
241 | + $start = new Api\DateTime($list['startdate']); |
|
242 | 242 | $end = new Api\DateTime($list['enddate']); |
243 | 243 | |
244 | 244 | if ($states['view'] == 'listview') |
@@ -247,24 +247,24 @@ discard block |
||
247 | 247 | |
248 | 248 | // Use UI to get dates |
249 | 249 | $ui = new calendar_uilist(); |
250 | - $list['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
251 | - $ui->get_rows($list,$rows,$readonlys); |
|
250 | + $list['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
251 | + $ui->get_rows($list, $rows, $readonlys); |
|
252 | 252 | $start = $ui->first ? $ui->first : new Api\DateTime($ui->date); |
253 | 253 | $end = $ui->last; |
254 | 254 | |
255 | 255 | // Special handling |
256 | - if($list['filter'] == 'all') $start = $end = null; |
|
257 | - if($list['filter'] == 'before') |
|
256 | + if ($list['filter'] == 'all') $start = $end = null; |
|
257 | + if ($list['filter'] == 'before') |
|
258 | 258 | { |
259 | 259 | $end = $start; |
260 | 260 | $start = null; |
261 | 261 | } |
262 | 262 | $ui = null; |
263 | 263 | } |
264 | - else if(!$end) |
|
264 | + else if (!$end) |
|
265 | 265 | { |
266 | - $end = '+1 ' . $states['view']; |
|
267 | - $end = strtotime($end, $start->format('ts'))-1; |
|
266 | + $end = '+1 '.$states['view']; |
|
267 | + $end = strtotime($end, $start->format('ts')) - 1; |
|
268 | 268 | } |
269 | 269 | $prefs = unserialize($GLOBALS['egw_info']['user']['preferences']['importexport'][$definition->definition_id]); |
270 | 270 | $data = array( |
@@ -330,17 +330,17 @@ discard block |
||
330 | 330 | ); |
331 | 331 | $filters = array_reverse($filters, true); |
332 | 332 | |
333 | - foreach($filters as $field_name => &$settings) |
|
333 | + foreach ($filters as $field_name => &$settings) |
|
334 | 334 | { |
335 | 335 | // Can't filter on a custom field |
336 | - if(strpos($field_name, '#') === 0) |
|
336 | + if (strpos($field_name, '#') === 0) |
|
337 | 337 | { |
338 | 338 | unset($filters[$field_name]); |
339 | 339 | continue; |
340 | 340 | } |
341 | 341 | |
342 | 342 | // Pass on select options |
343 | - if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
343 | + if ($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | } |
@@ -16,9 +16,11 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * export CSV plugin of calendar |
18 | 18 | */ |
19 | -class calendar_export_csv implements importexport_iface_export_plugin { |
|
19 | +class calendar_export_csv implements importexport_iface_export_plugin |
|
20 | +{ |
|
20 | 21 | |
21 | - public function __construct() { |
|
22 | + public function __construct() |
|
23 | + { |
|
22 | 24 | Api\Translation::add_app('calendar'); |
23 | 25 | $this->bo = new calendar_bo(); |
24 | 26 | $this->get_selects(); |
@@ -29,15 +31,23 @@ discard block |
||
29 | 31 | * |
30 | 32 | * @param egw_record $_definition |
31 | 33 | */ |
32 | - public function export( $_stream, importexport_definition $_definition) { |
|
34 | + public function export( $_stream, importexport_definition $_definition) |
|
35 | + { |
|
33 | 36 | $options = $_definition->plugin_options; |
34 | 37 | |
35 | 38 | $limit_exception = Api\Storage\Merge::is_export_limit_excepted(); |
36 | - if (!$limit_exception) $export_limit = Api\Storage\Merge::getExportLimit('calendar'); |
|
39 | + if (!$limit_exception) |
|
40 | + { |
|
41 | + $export_limit = Api\Storage\Merge::getExportLimit('calendar'); |
|
42 | + } |
|
37 | 43 | // Custom fields need to be specifically requested |
38 | 44 | $cfs = array(); |
39 | - foreach($options['mapping'] + (array)$_definition->filter as $key => $label) { |
|
40 | - if($key[0] == '#') $cfs[] = substr($key,1); |
|
45 | + foreach($options['mapping'] + (array)$_definition->filter as $key => $label) |
|
46 | + { |
|
47 | + if($key[0] == '#') |
|
48 | + { |
|
49 | + $cfs[] = substr($key,1); |
|
50 | + } |
|
41 | 51 | } |
42 | 52 | |
43 | 53 | $query = array( |
@@ -63,7 +73,8 @@ discard block |
||
63 | 73 | { |
64 | 74 | $query['end'] = strtotime('+1 day',$options['criteria']['end'])-1; |
65 | 75 | } |
66 | - if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
76 | + if(Api\Storage\Merge::hasExportLimit($export_limit) && !$limit_exception) |
|
77 | + { |
|
67 | 78 | $query['offset'] = 0; |
68 | 79 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
69 | 80 | } |
@@ -112,8 +123,14 @@ discard block |
||
112 | 123 | } |
113 | 124 | |
114 | 125 | // Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10) |
115 | - if($value['from']) $query['sql_filter'][] = "cal_$field >= " . (int)$value['from']; |
|
116 | - if($value['to']) $query['sql_filter'][] = "cal_$field <= " . (int)$value['to']; |
|
126 | + if($value['from']) |
|
127 | + { |
|
128 | + $query['sql_filter'][] = "cal_$field >= " . (int)$value['from']; |
|
129 | + } |
|
130 | + if($value['to']) |
|
131 | + { |
|
132 | + $query['sql_filter'][] = "cal_$field <= " . (int)$value['to']; |
|
133 | + } |
|
117 | 134 | |
118 | 135 | } |
119 | 136 | if($query['sql_filter'] && is_array($query['sql_filter'])) |
@@ -176,7 +193,10 @@ discard block |
||
176 | 193 | // Implode arrays, so they don't say 'Array' |
177 | 194 | foreach($record->get_record_array() as $key => $value) |
178 | 195 | { |
179 | - if(is_array($value)) $record->$key = implode(',', $value); |
|
196 | + if(is_array($value)) |
|
197 | + { |
|
198 | + $record->$key = implode(',', $value); |
|
199 | + } |
|
180 | 200 | } |
181 | 201 | } |
182 | 202 | $export_object->export_record($record); |
@@ -253,7 +273,10 @@ discard block |
||
253 | 273 | $end = $ui->last; |
254 | 274 | |
255 | 275 | // Special handling |
256 | - if($list['filter'] == 'all') $start = $end = null; |
|
276 | + if($list['filter'] == 'all') |
|
277 | + { |
|
278 | + $start = $end = null; |
|
279 | + } |
|
257 | 280 | if($list['filter'] == 'before') |
258 | 281 | { |
259 | 282 | $end = $start; |
@@ -340,7 +363,10 @@ discard block |
||
340 | 363 | } |
341 | 364 | |
342 | 365 | // Pass on select options |
343 | - if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
366 | + if($this->selects[$field_name]) |
|
367 | + { |
|
368 | + $settings['values'] = $this->selects[$field_name]; |
|
369 | + } |
|
344 | 370 | } |
345 | 371 | |
346 | 372 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * Exports records as defined in $_definition |
29 | 29 | * |
30 | - * @param egw_record $_definition |
|
30 | + * @param importexport_definition $_definition |
|
31 | 31 | */ |
32 | 32 | public function export( $_stream, importexport_definition $_definition) { |
33 | 33 | $options = $_definition->plugin_options; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * |
229 | 229 | * @param $definition Specific definition |
230 | 230 | * |
231 | - * @return array ( |
|
231 | + * @return boolean ( |
|
232 | 232 | * name => string, |
233 | 233 | * content => array, |
234 | 234 | * sel_options => array, |
@@ -77,16 +77,31 @@ discard block |
||
77 | 77 | $ui = new calendar_uiviews(); |
78 | 78 | if ($this->favorite) |
79 | 79 | { |
80 | - if($this->favorite['state']['start']) $ui->search_params['start'] = $this->favorite['state']['start']; |
|
81 | - if($this->favorite['state']['cat_id']) $ui->search_params['cat_id'] = $this->favorite['state']['cat_id']; |
|
80 | + if($this->favorite['state']['start']) |
|
81 | + { |
|
82 | + $ui->search_params['start'] = $this->favorite['state']['start']; |
|
83 | + } |
|
84 | + if($this->favorite['state']['cat_id']) |
|
85 | + { |
|
86 | + $ui->search_params['cat_id'] = $this->favorite['state']['cat_id']; |
|
87 | + } |
|
82 | 88 | // Owner can be 0 for current user |
83 | - if(array_key_exists('owner',$this->favorite['state'])) $ui->search_params['users'] = $this->favorite['state']['owner']; |
|
89 | + if(array_key_exists('owner',$this->favorite['state'])) |
|
90 | + { |
|
91 | + $ui->search_params['users'] = $this->favorite['state']['owner']; |
|
92 | + } |
|
84 | 93 | if($ui->search_params['users'] && !is_array($ui->search_params['users'])) |
85 | 94 | { |
86 | 95 | $ui->search_params['users'] = explode(',',$ui->search_params['users']); |
87 | 96 | } |
88 | - if($this->favorite['state']['filter']) $ui->search_params['filter'] = $this->favorite['state']['filter']; |
|
89 | - if($this->favorite['state']['sortby']) $ui->search_params['sortby'] = $this->favorite['state']['sortby']; |
|
97 | + if($this->favorite['state']['filter']) |
|
98 | + { |
|
99 | + $ui->search_params['filter'] = $this->favorite['state']['filter']; |
|
100 | + } |
|
101 | + if($this->favorite['state']['sortby']) |
|
102 | + { |
|
103 | + $ui->search_params['sortby'] = $this->favorite['state']['sortby']; |
|
104 | + } |
|
90 | 105 | $ui->search_params['weekend'] = $this->favorite['state']['weekend']; |
91 | 106 | } |
92 | 107 | $etemplate->read('home.legacy'); |
@@ -246,7 +261,8 @@ discard block |
||
246 | 261 | return $properties; |
247 | 262 | } |
248 | 263 | |
249 | - public function get_actions() { |
|
264 | + public function get_actions() |
|
265 | + { |
|
250 | 266 | if($this->favorite['state']['view'] == 'listview' || !$this->actions) |
251 | 267 | { |
252 | 268 | return array(); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * Construct the portlet |
26 | 26 | * Calendar complicates things... |
27 | 27 | */ |
28 | - public function __construct(Array &$context = array(), &$need_reload = false) |
|
28 | + public function __construct(array &$context = array(), &$need_reload = false) |
|
29 | 29 | { |
30 | 30 | $context['appname'] = 'calendar'; |
31 | 31 | // Reload is NULL when changing properties via AJAX |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | $reload = !is_null($need_reload); |
33 | 33 | |
34 | 34 | // Let parent handle the basic stuff |
35 | - parent::__construct($context,$need_reload); |
|
35 | + parent::__construct($context, $need_reload); |
|
36 | 36 | |
37 | - if($this->favorite['state']['view'] == 'listview') |
|
37 | + if ($this->favorite['state']['view'] == 'listview') |
|
38 | 38 | { |
39 | 39 | $this->context['template'] = 'calendar.list.rows'; |
40 | 40 | $this->context['sel_options'] = array(); |
41 | 41 | $this->nm_settings += array( |
42 | 42 | 'csv_export' => True, |
43 | - 'filter_no_lang' => True, // I set no_lang for filter (=dont translate the options) |
|
44 | - 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
45 | - 'no_cat' => True, // I disable the cat-selectbox |
|
43 | + 'filter_no_lang' => True, // I set no_lang for filter (=dont translate the options) |
|
44 | + 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
45 | + 'no_cat' => True, // I disable the cat-selectbox |
|
46 | 46 | 'filter' => 'after', |
47 | - 'row_id' => 'row_id', // set in get rows "$event[id]:$event[recur_date]" |
|
47 | + 'row_id' => 'row_id', // set in get rows "$event[id]:$event[recur_date]" |
|
48 | 48 | 'row_modified' => 'modified', |
49 | 49 | 'get_rows' => 'calendar_favorite_portlet::get_rows', |
50 | 50 | // Use a different template so it can be accessed from client side |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | { |
63 | 63 | |
64 | 64 | // Always load app's javascript, so most actions have a chance of working |
65 | - Framework::includeJS('.','app',$this->context['appname']); |
|
65 | + Framework::includeJS('.', 'app', $this->context['appname']); |
|
66 | 66 | |
67 | 67 | // Always load app's css |
68 | 68 | Framework::includeCSS('calendar', 'app-'.$GLOBALS['egw_info']['user']['preferences']['common']['theme']) || |
69 | - Framework::includeCSS('calendar','app'); |
|
69 | + Framework::includeCSS('calendar', 'app'); |
|
70 | 70 | |
71 | - if($this->favorite['state']['view'] == 'listview' || is_array($this->favorite) && !$this->favorite['state']['view']) |
|
71 | + if ($this->favorite['state']['view'] == 'listview' || is_array($this->favorite) && !$this->favorite['state']['view']) |
|
72 | 72 | { |
73 | 73 | $ui = new calendar_uilist(); |
74 | 74 | } |
@@ -77,16 +77,16 @@ discard block |
||
77 | 77 | $ui = new calendar_uiviews(); |
78 | 78 | if ($this->favorite) |
79 | 79 | { |
80 | - if($this->favorite['state']['start']) $ui->search_params['start'] = $this->favorite['state']['start']; |
|
81 | - if($this->favorite['state']['cat_id']) $ui->search_params['cat_id'] = $this->favorite['state']['cat_id']; |
|
80 | + if ($this->favorite['state']['start']) $ui->search_params['start'] = $this->favorite['state']['start']; |
|
81 | + if ($this->favorite['state']['cat_id']) $ui->search_params['cat_id'] = $this->favorite['state']['cat_id']; |
|
82 | 82 | // Owner can be 0 for current user |
83 | - if(array_key_exists('owner',$this->favorite['state'])) $ui->search_params['users'] = $this->favorite['state']['owner']; |
|
84 | - if($ui->search_params['users'] && !is_array($ui->search_params['users'])) |
|
83 | + if (array_key_exists('owner', $this->favorite['state'])) $ui->search_params['users'] = $this->favorite['state']['owner']; |
|
84 | + if ($ui->search_params['users'] && !is_array($ui->search_params['users'])) |
|
85 | 85 | { |
86 | - $ui->search_params['users'] = explode(',',$ui->search_params['users']); |
|
86 | + $ui->search_params['users'] = explode(',', $ui->search_params['users']); |
|
87 | 87 | } |
88 | - if($this->favorite['state']['filter']) $ui->search_params['filter'] = $this->favorite['state']['filter']; |
|
89 | - if($this->favorite['state']['sortby']) $ui->search_params['sortby'] = $this->favorite['state']['sortby']; |
|
88 | + if ($this->favorite['state']['filter']) $ui->search_params['filter'] = $this->favorite['state']['filter']; |
|
89 | + if ($this->favorite['state']['sortby']) $ui->search_params['sortby'] = $this->favorite['state']['sortby']; |
|
90 | 90 | $ui->search_params['weekend'] = $this->favorite['state']['weekend']; |
91 | 91 | } |
92 | 92 | $etemplate->read('home.legacy'); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | $content = array('legacy' => ''); |
98 | 98 | |
99 | - switch($this->favorite['state']['view']) |
|
99 | + switch ($this->favorite['state']['view']) |
|
100 | 100 | { |
101 | 101 | case 'listview': |
102 | 102 | $this->context['sel_options']['filter'] = &$ui->date_filters; |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | $content = array(); |
111 | 111 | $etemplate->read('calendar.planner'); |
112 | 112 | $etemplate->set_dom_id($id); |
113 | - $this->actions =& $etemplate->getElementAttribute('planner', 'actions'); |
|
113 | + $this->actions = & $etemplate->getElementAttribute('planner', 'actions'); |
|
114 | 114 | // Don't notify the calendar app of date changes |
115 | - $etemplate->setElementAttribute('planner','onchange',false); |
|
115 | + $etemplate->setElementAttribute('planner', 'onchange', false); |
|
116 | 116 | $ui->planner_view = $this->favorite['state']['planner_view']; |
117 | 117 | $ui->planner(array(), $etemplate); |
118 | 118 | return; |
@@ -120,20 +120,19 @@ discard block |
||
120 | 120 | case 'weekN': |
121 | 121 | $etemplate->read('calendar.view'); |
122 | 122 | $etemplate->set_dom_id($id); |
123 | - $this->actions =& $etemplate->getElementAttribute('view', 'actions'); |
|
123 | + $this->actions = & $etemplate->getElementAttribute('view', 'actions'); |
|
124 | 124 | |
125 | 125 | $ui->month($this->favorite['state']['view'] == 'month' ? |
126 | - 0 : |
|
127 | - (int)$ui->cal_prefs['multiple_weeks'], |
|
126 | + 0 : (int)$ui->cal_prefs['multiple_weeks'], |
|
128 | 127 | $etemplate |
129 | 128 | ); |
130 | 129 | return; |
131 | 130 | case 'week': |
132 | 131 | $etemplate->read('calendar.view'); |
133 | 132 | $etemplate->set_dom_id($id); |
134 | - $this->actions =& $etemplate->getElementAttribute('view', 'actions'); |
|
133 | + $this->actions = & $etemplate->getElementAttribute('view', 'actions'); |
|
135 | 134 | // Don't notify the calendar app of date changes |
136 | - $etemplate->setElementAttribute('view[0]','onchange',false); |
|
135 | + $etemplate->setElementAttribute('view[0]', 'onchange', false); |
|
137 | 136 | $ui->week(array(), $etemplate); |
138 | 137 | return; |
139 | 138 | case 'day': |
@@ -143,7 +142,7 @@ discard block |
||
143 | 142 | $days = $this->favorite['state']['days'] ? $this->favorite['state']['days'] : ( |
144 | 143 | $this->favorite['state']['view'] == 'day' ? 1 : 4 |
145 | 144 | ); |
146 | - $this->actions =& $etemplate->getElementAttribute('view', 'actions'); |
|
145 | + $this->actions = & $etemplate->getElementAttribute('view', 'actions'); |
|
147 | 146 | $ui->week($days, $etemplate); |
148 | 147 | return; |
149 | 148 | } |
@@ -156,7 +155,7 @@ discard block |
||
156 | 155 | $old_app = $GLOBALS['egw_info']['flags']['currentapp']; |
157 | 156 | $GLOBALS['egw_info']['flags']['currentapp'] = 'calendar'; |
158 | 157 | |
159 | - $etemplate->exec(get_called_class() .'::process',$content); |
|
158 | + $etemplate->exec(get_called_class().'::process', $content); |
|
160 | 159 | $GLOBALS['egw_info']['flags']['currentapp'] = $old_app; |
161 | 160 | } |
162 | 161 | |
@@ -199,27 +198,27 @@ discard block |
||
199 | 198 | else |
200 | 199 | { |
201 | 200 | $success = $failed = $action_msg = $msg = null; |
202 | - if ($ui->action($values['nm']['action'],$values['nm']['selected'],$values['nm']['select_all'], |
|
203 | - $success,$failed,$action_msg,'calendar_list',$msg, $values['nm']['checkboxes']['no_notifications'])) |
|
201 | + if ($ui->action($values['nm']['action'], $values['nm']['selected'], $values['nm']['select_all'], |
|
202 | + $success, $failed, $action_msg, 'calendar_list', $msg, $values['nm']['checkboxes']['no_notifications'])) |
|
204 | 203 | { |
205 | - $msg .= lang('%1 event(s) %2',$success,$action_msg); |
|
206 | - Api\Json\Response::get()->apply('egw.message',array($msg,'success')); |
|
207 | - foreach($values['nm']['selected'] as &$id) |
|
204 | + $msg .= lang('%1 event(s) %2', $success, $action_msg); |
|
205 | + Api\Json\Response::get()->apply('egw.message', array($msg, 'success')); |
|
206 | + foreach ($values['nm']['selected'] as &$id) |
|
208 | 207 | { |
209 | 208 | $id = 'calendar::'.$id; |
210 | 209 | } |
211 | 210 | // Directly request an update - this will get addressbook tab too |
212 | - Api\Json\Response::get()->apply('egw.dataRefreshUIDs',array($values['nm']['selected'])); |
|
211 | + Api\Json\Response::get()->apply('egw.dataRefreshUIDs', array($values['nm']['selected'])); |
|
213 | 212 | } |
214 | - elseif(is_null($msg)) |
|
213 | + elseif (is_null($msg)) |
|
215 | 214 | { |
216 | - $msg .= lang('%1 entries %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed); |
|
217 | - Api\Json\Response::get()->apply('egw.message',array($msg,'error')); |
|
215 | + $msg .= lang('%1 entries %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed); |
|
216 | + Api\Json\Response::get()->apply('egw.message', array($msg, 'error')); |
|
218 | 217 | } |
219 | - elseif($msg) |
|
218 | + elseif ($msg) |
|
220 | 219 | { |
221 | - $msg .= "\n".lang('%1 entries %2, %3 failed.',$success,$action_msg,$failed); |
|
222 | - Api\Json\Response::get()->apply('egw.message',array($msg,'error')); |
|
220 | + $msg .= "\n".lang('%1 entries %2, %3 failed.', $success, $action_msg, $failed); |
|
221 | + Api\Json\Response::get()->apply('egw.message', array($msg, 'error')); |
|
223 | 222 | } |
224 | 223 | unset($values['nm']['action']); |
225 | 224 | unset($values['nm']['select_all']); |
@@ -235,9 +234,9 @@ discard block |
||
235 | 234 | public function get_properties() |
236 | 235 | { |
237 | 236 | $properties = parent::get_properties(); |
238 | - foreach($properties as &$property) |
|
237 | + foreach ($properties as &$property) |
|
239 | 238 | { |
240 | - if($property['name'] == 'favorite') |
|
239 | + if ($property['name'] == 'favorite') |
|
241 | 240 | { |
242 | 241 | unset($property['select_options']['blank']); |
243 | 242 | break; |
@@ -247,7 +246,7 @@ discard block |
||
247 | 246 | } |
248 | 247 | |
249 | 248 | public function get_actions() { |
250 | - if($this->favorite['state']['view'] == 'listview' || !$this->actions) |
|
249 | + if ($this->favorite['state']['view'] == 'listview' || !$this->actions) |
|
251 | 250 | { |
252 | 251 | return array(); |
253 | 252 | } |
@@ -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 |
@@ -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; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * @param array $modules pathes to include |
257 | 257 | * @param boolean $append =true false: prepend modules before already included ones, keeping their order |
258 | 258 | */ |
259 | - private function include_module(array $modules, $append=true) |
|
259 | + private function include_module(array $modules, $append = true) |
|
260 | 260 | { |
261 | 261 | if (self::$DEBUG_MODE) |
262 | 262 | { |
@@ -295,17 +295,17 @@ discard block |
||
295 | 295 | * @returns the correct path on the server if the file is found or false, if the |
296 | 296 | * file is not found or no further processing is needed. |
297 | 297 | */ |
298 | - private function translate_params($package, $file=null, $app='api') |
|
298 | + private function translate_params($package, $file = null, $app = 'api') |
|
299 | 299 | { |
300 | 300 | if ($package[0] == '/' && is_readable(EGW_SERVER_ROOT.parse_url($path = $package, PHP_URL_PATH)) || |
301 | 301 | // fix old /phpgwapi/js/ path by replacing it with /api/js/ |
302 | 302 | substr($package, 0, 13) == '/phpgwapi/js/' && is_readable(EGW_SERVER_ROOT.parse_url($path = str_replace('/phpgwapi/js/', '/api/js/', $package), PHP_URL_PATH)) || |
303 | 303 | $package[0] == '/' && is_readable(EGW_SERVER_ROOT.($path = $package)) || |
304 | - $package == '.' && is_readable(EGW_SERVER_ROOT.($path="/$app/js/$file.js")) || |
|
305 | - is_readable(EGW_SERVER_ROOT.($path="/$app/js/$package/$file.js")) || |
|
304 | + $package == '.' && is_readable(EGW_SERVER_ROOT.($path = "/$app/js/$file.js")) || |
|
305 | + is_readable(EGW_SERVER_ROOT.($path = "/$app/js/$package/$file.js")) || |
|
306 | 306 | // fix not found by using app='api' |
307 | - $app != 'api' && is_readable(EGW_SERVER_ROOT.($path="/api/js/$package/$file.js")) || |
|
308 | - $app != 'phpgwapi' && is_readable(EGW_SERVER_ROOT.($path="/phpgwapi/js/$package/$file.js"))) |
|
307 | + $app != 'api' && is_readable(EGW_SERVER_ROOT.($path = "/api/js/$package/$file.js")) || |
|
308 | + $app != 'phpgwapi' && is_readable(EGW_SERVER_ROOT.($path = "/phpgwapi/js/$package/$file.js"))) |
|
309 | 309 | { |
310 | 310 | // normalise /./ to / |
311 | 311 | $path = str_replace('/./', '/', $path); |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | // adding the ctime to all js files... |
317 | 317 | if (is_array($file)) |
318 | 318 | { |
319 | - foreach($file as $name => $val) |
|
319 | + foreach ($file as $name => $val) |
|
320 | 320 | { |
321 | 321 | $args .= (empty($args) ? '?' : '&').$name.'='.urlencode($val); |
322 | 322 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | * @param string $app ='phpgwapi' application directory to search - default = phpgwapi |
360 | 360 | * @param boolean $append =true true append file, false prepend (add as first) file used eg. for template itself |
361 | 361 | */ |
362 | - public function include_js_file($package, $file = null, $app = 'phpgwapi', $append=true) |
|
362 | + public function include_js_file($package, $file = null, $app = 'phpgwapi', $append = true) |
|
363 | 363 | { |
364 | 364 | // Translate the given parameters into a valid path - false is returned |
365 | 365 | // if the file is not found or the file is already included/has already |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | * @param array $files |
388 | 388 | * @param boolean $clear_files =false if true clear list of files, before including given ones |
389 | 389 | */ |
390 | - public function include_files(array $files, $clear_files=false) |
|
390 | + public function include_files(array $files, $clear_files = false) |
|
391 | 391 | { |
392 | 392 | if ($clear_files) $this->included_files = array(); |
393 | 393 | |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | * @param boolean $clear_files =false if true clear list of files after returning them |
404 | 404 | * @return array |
405 | 405 | */ |
406 | - public function get_included_files($clear_files=false) |
|
406 | + public function get_included_files($clear_files = false) |
|
407 | 407 | { |
408 | 408 | $ret = array_keys($this->included_files); |
409 | 409 | if ($clear_files) $this->included_files = array(); |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | |
437 | 437 | $paths = !empty($_GET['path']) ? (array)$_GET['path'] : (array)'/stylite/js/filemanager/filemanager.js'; |
438 | 438 | |
439 | - foreach($paths as $path) |
|
439 | + foreach ($paths as $path) |
|
440 | 440 | { |
441 | 441 | echo "\t<h1>".htmlspecialchars($path)."</h1>\n"; |
442 | 442 | $mgr->include_js_file($path); |
@@ -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( |
@@ -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 an enterprise ready multilingual groupware solution</b> for your team. |
74 | 74 | It enables you to manage and share your e-mail, contacts, appointments, tasks |
75 | 75 | and files within your organisation.</p> |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | { |
96 | 96 | return strcasecmp($a['title'], $b['title']); |
97 | 97 | }); |
98 | - array_unshift($apps, false); // first empty row for eTemplate |
|
98 | + array_unshift($apps, false); // first empty row for eTemplate |
|
99 | 99 | |
100 | 100 | // putting templates below apps |
101 | - foreach($GLOBALS['egw']->framework->list_templates(true) as $info) |
|
101 | + foreach ($GLOBALS['egw']->framework->list_templates(true) as $info) |
|
102 | 102 | { |
103 | 103 | $apps[] = $this->_getParsedTemplateInfo($info); |
104 | 104 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | function _getParsedTemplateInfo($info) |
131 | 131 | { |
132 | 132 | // define the return array |
133 | - $info['image'] = file_exists(EGW_SERVER_ROOT.'/'.$info['icon']) ? $GLOBALS['egw_info']['server']['webserver_url'].'/'.$info['icon'] : Api\Image::find('thisdoesnotexist',array('navbar','nonav')); |
|
133 | + $info['image'] = file_exists(EGW_SERVER_ROOT.'/'.$info['icon']) ? $GLOBALS['egw_info']['server']['webserver_url'].'/'.$info['icon'] : Api\Image::find('thisdoesnotexist', array('navbar', 'nonav')); |
|
134 | 134 | $info['author'] = $this->_getHtmlPersonalInfo($info, 'author'); |
135 | 135 | $info['maintainer'] = $this->_getHtmlPersonalInfo($info, 'maintainer'); |
136 | 136 | |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | function _getParsedAppInfo($app) |
152 | 152 | { |
153 | 153 | // we read all setup files once, as no every app has it's own file |
154 | - static $setup_info=null; |
|
154 | + static $setup_info = null; |
|
155 | 155 | if (is_null($setup_info)) |
156 | 156 | { |
157 | - foreach(array_keys($GLOBALS['egw_info']['apps']) as $_app) |
|
157 | + foreach (array_keys($GLOBALS['egw_info']['apps']) as $_app) |
|
158 | 158 | { |
159 | 159 | if (file_exists($file = EGW_INCLUDE_ROOT.'/'.$_app.'/setup/setup.inc.php')) |
160 | 160 | { |
@@ -162,14 +162,14 @@ discard block |
||
162 | 162 | } |
163 | 163 | } |
164 | 164 | } |
165 | - if (!isset($setup_info[$app]) || !is_array($setup_info[$app])) return null; // app got eg. removed in filesystem |
|
165 | + if (!isset($setup_info[$app]) || !is_array($setup_info[$app])) return null; // app got eg. removed in filesystem |
|
166 | 166 | |
167 | - $app_info = array_merge($GLOBALS['egw_info']['apps'][$app], $setup_info[$app]); |
|
167 | + $app_info = array_merge($GLOBALS['egw_info']['apps'][$app], $setup_info[$app]); |
|
168 | 168 | |
169 | 169 | // define the return array |
170 | 170 | $icon_app = isset($app_info['icon_app']) ? $app_info['icon_app'] : $app; |
171 | 171 | $icon = isset($app_info['icon']) ? $app_info['icon'] : 'navbar'; |
172 | - $ret = $app_info+array( |
|
172 | + $ret = $app_info + array( |
|
173 | 173 | 'app' => $app, |
174 | 174 | 'title' => lang(!empty($app_info['title']) ? $app_info['title'] : $app), |
175 | 175 | 'image' => Api\Image::find($icon_app, $icon) ? $icon_app.'/'.$app : 'api/nonav', |
@@ -268,12 +268,12 @@ discard block |
||
268 | 268 | } |
269 | 269 | |
270 | 270 | static public $knownLicenses = array( |
271 | - 'GPL' => array('http://opensource.org/licenses/gpl-license.php','GNU General Public License version 2.0 or (at your option) any later version'), |
|
272 | - 'GPL2' => array('http://opensource.org/licenses/gpl-2.0.php','GNU General Public License version 2.0'), |
|
273 | - 'GPL3' => array('http://opensource.org/licenses/gpl-3.0.php','GNU General Public License version 3.0'), |
|
274 | - 'LGPL' => array('http://opensource.org/licenses/lgpl-2.1.php','GNU Lesser General Public License, version 2.1'), |
|
275 | - 'LGPL3' => array('http://opensource.org/licenses/lgpl-3.0.php','GNU Lesser General Public License, version 3.0'), |
|
276 | - 'PHP' => array('http://opensource.org/licenses/php.php','PHP License'), |
|
271 | + 'GPL' => array('http://opensource.org/licenses/gpl-license.php', 'GNU General Public License version 2.0 or (at your option) any later version'), |
|
272 | + 'GPL2' => array('http://opensource.org/licenses/gpl-2.0.php', 'GNU General Public License version 2.0'), |
|
273 | + 'GPL3' => array('http://opensource.org/licenses/gpl-3.0.php', 'GNU General Public License version 3.0'), |
|
274 | + 'LGPL' => array('http://opensource.org/licenses/lgpl-2.1.php', 'GNU Lesser General Public License, version 2.1'), |
|
275 | + 'LGPL3' => array('http://opensource.org/licenses/lgpl-3.0.php', 'GNU Lesser General Public License, version 3.0'), |
|
276 | + 'PHP' => array('http://opensource.org/licenses/php.php', 'PHP License'), |
|
277 | 277 | ); |
278 | 278 | |
279 | 279 | /** |
@@ -294,14 +294,14 @@ discard block |
||
294 | 294 | |
295 | 295 | if (isset(self::$knownLicenses[strtoupper($name)])) |
296 | 296 | { |
297 | - if (empty($url)) $url = self::$knownLicenses[$name=strtoupper($name)][0]; |
|
298 | - if (empty($title)) $title = self::$knownLicenses[$name=strtoupper($name)][1]; |
|
297 | + if (empty($url)) $url = self::$knownLicenses[$name = strtoupper($name)][0]; |
|
298 | + if (empty($title)) $title = self::$knownLicenses[$name = strtoupper($name)][1]; |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | return array( |
302 | 302 | 'license' => $name ? $name : 'none', |
303 | 303 | 'license_url' => $url, |
304 | 304 | 'license_title' => $title, |
305 | - )+$info; |
|
305 | + ) + $info; |
|
306 | 306 | } |
307 | 307 | } |