@@ -131,7 +131,10 @@ discard block |
||
131 | 131 | ($content['mounts']['enable'] || self::$is_setup && $content['mounts']['mount'])) |
132 | 132 | { |
133 | 133 | $url = str_replace('$path',$path,$content['mounts']['url']); |
134 | - if (empty($url) && $this->versioning) $url = Versioning\StreamWrapper::PREFIX.$path; |
|
134 | + if (empty($url) && $this->versioning) |
|
135 | + { |
|
136 | + $url = Versioning\StreamWrapper::PREFIX.$path; |
|
137 | + } |
|
135 | 138 | |
136 | 139 | if ($content['mounts']['enable'] && !$this->versioning) |
137 | 140 | { |
@@ -227,16 +230,25 @@ discard block |
||
227 | 230 | $content['versionedpath'] = '/'; |
228 | 231 | $content['mtime'] = 100; |
229 | 232 | } |
230 | - if (true) $content = array( |
|
233 | + if (true) |
|
234 | + { |
|
235 | + $content = array( |
|
231 | 236 | 'versionedpath' => $content['versionedpath'], |
232 | 237 | 'mtime' => $content['mtime'], |
233 | 238 | ); |
239 | + } |
|
234 | 240 | if ($this->versioning) |
235 | 241 | { |
236 | 242 | // statistical information |
237 | 243 | $content += Versioning\StreamWrapper::summary(); |
238 | - if ($content['total_files']) $content['percent_files'] = number_format(100.0*$content['version_files']/$content['total_files'],1).'%'; |
|
239 | - if ($content['total_size']) $content['percent_size'] = number_format(100.0*$content['version_size']/$content['total_size'],1).'%'; |
|
244 | + if ($content['total_files']) |
|
245 | + { |
|
246 | + $content['percent_files'] = number_format(100.0*$content['version_files']/$content['total_files'],1).'%'; |
|
247 | + } |
|
248 | + if ($content['total_size']) |
|
249 | + { |
|
250 | + $content['percent_size'] = number_format(100.0*$content['version_size']/$content['total_size'],1).'%'; |
|
251 | + } |
|
240 | 252 | } |
241 | 253 | if (!($content['is_root']=Vfs::$is_root)) |
242 | 254 | { |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | // Custom fields |
125 | 125 | if($content && strpos($content, '#') !== 0) |
126 | - { |
|
126 | + { |
|
127 | 127 | // Expand link-to custom fields |
128 | 128 | $this->cf_link_to_expand($file, $content, $info); |
129 | 129 | |
@@ -151,12 +151,14 @@ discard block |
||
151 | 151 | // Try this first - a normal path /apps/appname/id/file |
152 | 152 | list($app, $app_id) = explode('/', substr($file['path'], strpos($file['path'], 'apps/')+5)); |
153 | 153 | // Symlink? |
154 | - if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
154 | + if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) |
|
155 | + { |
|
155 | 156 | // Try resolving just app + ID - /apps/App Name/Record Title/file |
156 | 157 | $resolved = Vfs::resolve_url_symlinks(implode('/',array_slice(explode('/',$file['dir']),0,4))); |
157 | 158 | list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/')+5)); |
158 | 159 | |
159 | - if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
160 | + if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) |
|
161 | + { |
|
160 | 162 | // Get rid of any virtual folders (eg: All$) and symlinks |
161 | 163 | $resolved = Vfs::resolve_url_symlinks($file['path']); |
162 | 164 | list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/')+5)); |
@@ -190,7 +192,10 @@ discard block |
||
190 | 192 | if(is_array($link)) |
191 | 193 | { |
192 | 194 | // Directories have their internal protocol in path here |
193 | - if($link['path'] && strpos($link['path'], '://') !== false) $link['path'] = $file['path']; |
|
195 | + if($link['path'] && strpos($link['path'], '://') !== false) |
|
196 | + { |
|
197 | + $link['path'] = $file['path']; |
|
198 | + } |
|
194 | 199 | $link = Api\Session::link('/index.php', $link); |
195 | 200 | } |
196 | 201 | else |
@@ -211,7 +216,10 @@ discard block |
||
211 | 216 | // Add markers |
212 | 217 | foreach($file as $key => &$value) |
213 | 218 | { |
214 | - if(!$value) $value = ''; |
|
219 | + if(!$value) |
|
220 | + { |
|
221 | + $value = ''; |
|
222 | + } |
|
215 | 223 | $info['$$'.($prefix ? $prefix.'/':'').$key.'$$'] = $value; |
216 | 224 | } |
217 | 225 | if($app_placeholders) |
@@ -252,9 +260,15 @@ discard block |
||
252 | 260 | ); |
253 | 261 | foreach($fields as $name => $label) |
254 | 262 | { |
255 | - if (!($n&1)) echo '<tr>'; |
|
263 | + if (!($n&1)) |
|
264 | + { |
|
265 | + echo '<tr>'; |
|
266 | + } |
|
256 | 267 | echo '<td>{{'.$name.'}}</td><td>'.lang($label).'</td>'; |
257 | - if ($n&1) echo "</tr>\n"; |
|
268 | + if ($n&1) |
|
269 | + { |
|
270 | + echo "</tr>\n"; |
|
271 | + } |
|
258 | 272 | $n++; |
259 | 273 | } |
260 | 274 |
@@ -101,7 +101,10 @@ |
||
101 | 101 | $row['type'] = $row['share_writable'] ? Sharing::WRITABLE : Sharing::READONLY; |
102 | 102 | } |
103 | 103 | $row['share_passwd'] = (boolean)$row['share_passwd']; |
104 | - if ($row['share_with']) $row['share_with'] = preg_replace('/,([^ ])/', ', $1', $row['share_with']); |
|
104 | + if ($row['share_with']) |
|
105 | + { |
|
106 | + $row['share_with'] = preg_replace('/,([^ ])/', ', $1', $row['share_with']); |
|
107 | + } |
|
105 | 108 | } |
106 | 109 | return $total; |
107 | 110 | } |
@@ -12,9 +12,9 @@ |
||
12 | 12 | /** |
13 | 13 | * Calendar day selection for sitemgr |
14 | 14 | */ |
15 | -class module_calendar extends Module |
|
15 | +class module_calendar extends Module |
|
16 | 16 | { |
17 | - function module_calendar() |
|
17 | + function module_calendar() |
|
18 | 18 | { |
19 | 19 | $this->arguments = array( |
20 | 20 | 'redirect' => array( |
@@ -115,7 +115,8 @@ |
||
115 | 115 | $cat_ids[$category['id']] = $GLOBALS['egw']->strip_html($category['name']); |
116 | 116 | } |
117 | 117 | $this->arguments['category']['options'] = $cat_ids; |
118 | - if (count($cat_ids) > 5) { |
|
118 | + if (count($cat_ids) > 5) |
|
119 | + { |
|
119 | 120 | $this->arguments['category']['multiple'] = 5; |
120 | 121 | } |
121 | 122 |
@@ -1429,13 +1429,18 @@ discard block |
||
1429 | 1429 | function calendar_upgrade1_0_1_008() |
1430 | 1430 | { |
1431 | 1431 | $config_data = Api\Config::read('calendar'); |
1432 | - if (isset($config_data['fields'])) // old custom fields |
|
1432 | + if (isset($config_data['fields'])) |
|
1433 | + { |
|
1434 | + // old custom fields |
|
1433 | 1435 | { |
1434 | 1436 | $customfields = array(); |
1437 | + } |
|
1435 | 1438 | $order = 0; |
1436 | 1439 | foreach($config_data['fields'] as $name => $data) |
1437 | 1440 | { |
1438 | - if ($name{0} == '#' && !$data['disabled']) // real not-disabled custom field |
|
1441 | + if ($name{0} == '#' && !$data['disabled']) |
|
1442 | + { |
|
1443 | + // real not-disabled custom field |
|
1439 | 1444 | { |
1440 | 1445 | $customfields[substr($name,1)] = array( |
1441 | 1446 | 'type' => 'text', |
@@ -1444,6 +1449,7 @@ discard block |
||
1444 | 1449 | 'order' => ($order += 10), |
1445 | 1450 | ); |
1446 | 1451 | } |
1452 | + } |
|
1447 | 1453 | } |
1448 | 1454 | if (count($customfields)) |
1449 | 1455 | { |
@@ -2589,9 +2595,12 @@ discard block |
||
2589 | 2595 | 'cal_recur_date' => $row['cal_recur_date'], |
2590 | 2596 | 'cal_user_type' => 'e', |
2591 | 2597 | $email.'='.$GLOBALS['egw_setup']->db->quote($row['email']), |
2592 | - ), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user) // order A, T, U, X |
|
2598 | + ), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user) |
|
2599 | + { |
|
2600 | + // order A, T, U, X |
|
2593 | 2601 | { |
2594 | 2602 | if (strpos($user['email'], '@') !== false && !$n++) continue; |
2603 | + } |
|
2595 | 2604 | $GLOBALS['egw_setup']->db->delete('egw_cal_user', array_intersect_key($user, array_flip(array('cal_id','cal_recur_date','cal_user_type','cal_user_id','cal_status')))); |
2596 | 2605 | } |
2597 | 2606 | } |
@@ -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))) |
@@ -17,7 +17,8 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * class import_csv for calendar |
19 | 19 | */ |
20 | -class calendar_import_csv extends importexport_basic_import_csv { |
|
20 | +class calendar_import_csv extends importexport_basic_import_csv |
|
21 | +{ |
|
21 | 22 | |
22 | 23 | /** |
23 | 24 | * actions wich could be done to data entries |
@@ -83,8 +84,10 @@ discard block |
||
83 | 84 | $options['owner'] = $options['owner'] ? $options['owner'] : $this->user; |
84 | 85 | |
85 | 86 | // Set owner, unless it's supposed to come from CSV file |
86 | - if($options['owner_from_csv']) { |
|
87 | - if(!is_numeric($record['owner'])) { |
|
87 | + if($options['owner_from_csv']) |
|
88 | + { |
|
89 | + if(!is_numeric($record['owner'])) |
|
90 | + { |
|
88 | 91 | $this->errors[$import_csv->get_current_position()] = lang( |
89 | 92 | 'Invalid owner ID: %1. Might be a bad field translation. Used %2 instead.', |
90 | 93 | $record->owner, |
@@ -106,14 +109,16 @@ discard block |
||
106 | 109 | } |
107 | 110 | |
108 | 111 | // Parse particpants |
109 | - if ($record->participants && !is_array($record->participants)) { |
|
112 | + if ($record->participants && !is_array($record->participants)) |
|
113 | + { |
|
110 | 114 | // Importing participants in human friendly format: |
111 | 115 | // Name (quantity)? (status) Role[, Name (quantity)? (status) Role]+ |
112 | 116 | preg_match_all('/(([^(]+?)(?: \(([\d]+)\))? \(([^,)]+)\)(?: ([^ ,]+))?)(?:, )?/',$record->participants,$participants); |
113 | 117 | $p_participants = array(); |
114 | 118 | $missing = array(); |
115 | 119 | list($lines, $p, $names, $quantity, $status, $role) = $participants; |
116 | - foreach($names as $key => $name) { |
|
120 | + foreach($names as $key => $name) |
|
121 | + { |
|
117 | 122 | //error_log("Name: $name Quantity: {$quantity[$key]} Status: {$status[$key]} Role: {$role[$key]}"); |
118 | 123 | |
119 | 124 | // Search for direct account name, then user in accounts first |
@@ -121,9 +126,13 @@ discard block |
||
121 | 126 | $id = importexport_helper_functions::account_name2id($name); |
122 | 127 | |
123 | 128 | // If not found, or not an exact match to a user (account_name2id is pretty generous) |
124 | - if(!$id || $names[$key] !== $this->bo->participant_name($id)) { |
|
129 | + if(!$id || $names[$key] !== $this->bo->participant_name($id)) |
|
130 | + { |
|
125 | 131 | $contacts = ExecMethod2('addressbook.addressbook_bo.search', $search,array('contact_id','account_id'),'org_name,n_family,n_given,cat_id,contact_email','','%',false,'OR',array(0,1)); |
126 | - if($contacts) $id = $contacts[0]['account_id'] ? $contacts[0]['account_id'] : 'c'.$contacts[0]['contact_id']; |
|
132 | + if($contacts) |
|
133 | + { |
|
134 | + $id = $contacts[0]['account_id'] ? $contacts[0]['account_id'] : 'c'.$contacts[0]['contact_id']; |
|
135 | + } |
|
127 | 136 | } |
128 | 137 | if(!$id) |
129 | 138 | { |
@@ -131,7 +140,10 @@ discard block |
||
131 | 140 | foreach($this->bo->resources as $resource) |
132 | 141 | { |
133 | 142 | // Can't search for email |
134 | - if($resource['app'] == 'email') continue; |
|
143 | + if($resource['app'] == 'email') |
|
144 | + { |
|
145 | + continue; |
|
146 | + } |
|
135 | 147 | // Special resource search, since it does special stuff in link_query |
136 | 148 | if($resource['app'] == 'resources') |
137 | 149 | { |
@@ -140,7 +152,8 @@ discard block |
||
140 | 152 | $this->resource_so = new resources_so(); |
141 | 153 | } |
142 | 154 | $result = $this->resource_so->search($search,'res_id'); |
143 | - if(count($result) >= 1) { |
|
155 | + if(count($result) >= 1) |
|
156 | + { |
|
144 | 157 | $id = $resource['type'].$result[0]['res_id']; |
145 | 158 | break; |
146 | 159 | } |
@@ -158,7 +171,8 @@ discard block |
||
158 | 171 | } |
159 | 172 | } |
160 | 173 | } |
161 | - if($id) { |
|
174 | + if($id) |
|
175 | + { |
|
162 | 176 | $p_participants[$id] = calendar_so::combine_status( |
163 | 177 | $this->status_map[lang($status[$key])] ? $this->status_map[lang($status[$key])] : $status[$key][0], |
164 | 178 | $quantity[$key] ? $quantity[$key] : 1, |
@@ -187,27 +201,38 @@ discard block |
||
187 | 201 | } |
188 | 202 | $record->tzid = calendar_timezones::id2tz($record->tz_id); |
189 | 203 | |
190 | - if ( $options['conditions'] ) { |
|
191 | - foreach ( $options['conditions'] as $condition ) { |
|
204 | + if ( $options['conditions'] ) |
|
205 | + { |
|
206 | + foreach ( $options['conditions'] as $condition ) |
|
207 | + { |
|
192 | 208 | $records = array(); |
193 | - switch ( $condition['type'] ) { |
|
209 | + switch ( $condition['type'] ) |
|
210 | + { |
|
194 | 211 | // exists |
195 | 212 | case 'exists' : |
196 | 213 | // Check for that record |
197 | 214 | $result = $this->exists($record, $condition, $records); |
198 | 215 | |
199 | - if ( is_array( $records ) && count( $records ) >= 1) { |
|
216 | + if ( is_array( $records ) && count( $records ) >= 1) |
|
217 | + { |
|
200 | 218 | // apply action to all records matching this exists condition |
201 | 219 | $action = $condition['true']; |
202 | - foreach ( (array)$records as $event ) { |
|
220 | + foreach ( (array)$records as $event ) |
|
221 | + { |
|
203 | 222 | $record->id = $event['id']; |
204 | - if ( $this->definition->plugin_options['update_cats'] == 'add' ) { |
|
205 | - if ( !is_array( $record->category ) ) $record->category = explode( ',', $record->category ); |
|
223 | + if ( $this->definition->plugin_options['update_cats'] == 'add' ) |
|
224 | + { |
|
225 | + if ( !is_array( $record->category ) ) |
|
226 | + { |
|
227 | + $record->category = explode( ',', $record->category ); |
|
228 | + } |
|
206 | 229 | $record->category = implode( ',', array_unique( array_merge( $record->category, $event['category'] ) ) ); |
207 | 230 | } |
208 | 231 | $success = $this->action( $action['action'], $record, $import_csv->get_current_position() ); |
209 | 232 | } |
210 | - } else { |
|
233 | + } |
|
234 | + else |
|
235 | + { |
|
211 | 236 | $action = $condition['false']; |
212 | 237 | $success = ($this->action( $action['action'], $record, $import_csv->get_current_position() )); |
213 | 238 | } |
@@ -218,9 +243,14 @@ discard block |
||
218 | 243 | die('condition / action not supported!!!'); |
219 | 244 | break; |
220 | 245 | } |
221 | - if ($action['last']) break; |
|
246 | + if ($action['last']) |
|
247 | + { |
|
248 | + break; |
|
249 | + } |
|
222 | 250 | } |
223 | - } else { |
|
251 | + } |
|
252 | + else |
|
253 | + { |
|
224 | 254 | // unconditional insert |
225 | 255 | $success = $this->action( 'insert', $record, $import_csv->get_current_position() ); |
226 | 256 | } |
@@ -239,12 +269,14 @@ discard block |
||
239 | 269 | */ |
240 | 270 | protected function exists(importexport_iface_egw_record &$record, Array &$condition, &$records = array()) |
241 | 271 | { |
242 | - if($record->__get($condition['string']) && $condition['string'] == 'id') { |
|
272 | + if($record->__get($condition['string']) && $condition['string'] == 'id') |
|
273 | + { |
|
243 | 274 | $event = $this->bo->read($record->__get($condition['string'])); |
244 | 275 | $records = array($event); |
245 | 276 | } |
246 | 277 | |
247 | - if ( is_array( $records ) && count( $records ) >= 1) { |
|
278 | + if ( is_array( $records ) && count( $records ) >= 1) |
|
279 | + { |
|
248 | 280 | return true; |
249 | 281 | } |
250 | 282 | return false; |
@@ -260,7 +292,8 @@ discard block |
||
260 | 292 | protected function action ( $_action, importexport_iface_egw_record &$record, $record_num = 0 ) |
261 | 293 | { |
262 | 294 | $_data = $record->get_record_array(); |
263 | - switch ($_action) { |
|
295 | + switch ($_action) |
|
296 | + { |
|
264 | 297 | case 'none' : |
265 | 298 | return true; |
266 | 299 | case 'update' : |
@@ -268,7 +301,8 @@ discard block |
||
268 | 301 | $old = $this->bo->read($_data['id']); |
269 | 302 | |
270 | 303 | // Don't change a user account into a record |
271 | - if(!$this->definition->plugin_options['change_owner']) { |
|
304 | + if(!$this->definition->plugin_options['change_owner']) |
|
305 | + { |
|
272 | 306 | // Don't change owner of an existing record |
273 | 307 | unset($_data['owner']); |
274 | 308 | } |
@@ -276,31 +310,40 @@ discard block |
||
276 | 310 | // Merge to deal with fields not in import record |
277 | 311 | $_data = array_merge($old, $_data); |
278 | 312 | $changed = $this->tracking->changed_fields($_data, $old); |
279 | - if(count($changed) == 0) { |
|
313 | + if(count($changed) == 0) |
|
314 | + { |
|
280 | 315 | return true; |
281 | 316 | } |
282 | 317 | // Fall through |
283 | 318 | case 'insert' : |
284 | - if($_action == 'insert') { |
|
319 | + if($_action == 'insert') |
|
320 | + { |
|
285 | 321 | // Backend doesn't like inserting with ID specified, can overwrite existing |
286 | 322 | unset($_data['id']); |
287 | 323 | } |
288 | 324 | // Make sure participants are set |
289 | - if(!$_data['participants']) { |
|
325 | + if(!$_data['participants']) |
|
326 | + { |
|
290 | 327 | $user = $_data['owner'] ? $_data['owner'] : $this->user; |
291 | 328 | $_data['participants'] = array( |
292 | 329 | $user => 'U' |
293 | 330 | ); |
294 | 331 | } |
295 | - if ( $this->dry_run ) { |
|
332 | + if ( $this->dry_run ) |
|
333 | + { |
|
296 | 334 | //print_r($_data); |
297 | 335 | $this->results[$_action]++; |
298 | 336 | return true; |
299 | - } else { |
|
337 | + } |
|
338 | + else |
|
339 | + { |
|
300 | 340 | $result = $this->bo->save( $_data, $this->is_admin); |
301 | - if(!$result) { |
|
341 | + if(!$result) |
|
342 | + { |
|
302 | 343 | $this->errors[$record_num] = lang('Unable to save'); |
303 | - } else { |
|
344 | + } |
|
345 | + else |
|
346 | + { |
|
304 | 347 | $this->results[$_action]++; |
305 | 348 | // This does nothing (yet?) but update the identifier |
306 | 349 | $record->save($result); |
@@ -318,7 +361,8 @@ discard block |
||
318 | 361 | * |
319 | 362 | * @return string name |
320 | 363 | */ |
321 | - public static function get_name() { |
|
364 | + public static function get_name() |
|
365 | + { |
|
322 | 366 | return lang('Calendar CSV import'); |
323 | 367 | } |
324 | 368 | |
@@ -327,7 +371,8 @@ discard block |
||
327 | 371 | * |
328 | 372 | * @return string descriprion |
329 | 373 | */ |
330 | - public static function get_description() { |
|
374 | + public static function get_description() |
|
375 | + { |
|
331 | 376 | return lang("Imports events into your Calendar from a CSV File. CSV means 'Comma Seperated Values'. However in the options Tab you can also choose other seperators."); |
332 | 377 | } |
333 | 378 | |
@@ -336,7 +381,8 @@ discard block |
||
336 | 381 | * |
337 | 382 | * @return string suffix (comma seperated) |
338 | 383 | */ |
339 | - public static function get_filesuffix() { |
|
384 | + public static function get_filesuffix() |
|
385 | + { |
|
340 | 386 | return 'csv'; |
341 | 387 | } |
342 | 388 |
@@ -100,9 +100,12 @@ discard block |
||
100 | 100 | */ |
101 | 101 | static function settings($hook_data) |
102 | 102 | { |
103 | - if (!$hook_data['setup']) // does not work on setup time |
|
103 | + if (!$hook_data['setup']) |
|
104 | + { |
|
105 | + // does not work on setup time |
|
104 | 106 | { |
105 | 107 | $bo = new calendar_bo(); |
108 | + } |
|
106 | 109 | $bo->check_set_default_prefs(); |
107 | 110 | } |
108 | 111 | $yesno = array( |
@@ -195,9 +198,12 @@ discard block |
||
195 | 198 | 1 => lang('Yes'), |
196 | 199 | 2 => lang('With credentials included'), |
197 | 200 | ); |
198 | - if (!$hook_data['setup']) // does not work at setup time |
|
201 | + if (!$hook_data['setup']) |
|
202 | + { |
|
203 | + // does not work at setup time |
|
199 | 204 | { |
200 | 205 | $options = array('0' => lang('none')); |
206 | + } |
|
201 | 207 | foreach($GLOBALS['egw']->accounts->search(array('type' => 'owngroups','app' => 'calendar')) as $group) |
202 | 208 | { |
203 | 209 | $options[$group['account_id']] = Api\Accounts::username($group['account_id']); |
@@ -388,9 +394,12 @@ discard block |
||
388 | 394 | 'default' => '', |
389 | 395 | ), |
390 | 396 | ); |
391 | - if (isset($bo)) // add custom time-spans set by CalDAV clients, not in our prefs |
|
397 | + if (isset($bo)) |
|
398 | + { |
|
399 | + // add custom time-spans set by CalDAV clients, not in our prefs |
|
392 | 400 | { |
393 | 401 | $prefs = $GLOBALS['egw_info']['user']['preferences']['calendar']; |
402 | + } |
|
394 | 403 | $data = array( |
395 | 404 | 'prefs' => &$prefs, // use reference to get preference value back |
396 | 405 | 'preprocess' => true, |
@@ -689,7 +698,10 @@ discard block |
||
689 | 698 | { |
690 | 699 | //error_log(__METHOD__."(".array2string($data).")"); |
691 | 700 | // caldav perfs are always user specific and cant by switched off |
692 | - if ($data['type'] != 'user') return; |
|
701 | + if ($data['type'] != 'user') |
|
702 | + { |
|
703 | + return; |
|
704 | + } |
|
693 | 705 | |
694 | 706 | $account_lid = $GLOBALS['egw_info']['user']['account_lid']; |
695 | 707 | foreach(array( |
@@ -698,16 +710,23 @@ discard block |
||
698 | 710 | ) as $name => $dav) |
699 | 711 | { |
700 | 712 | $pref =& $GLOBALS['egw_info']['user']['preferences']['groupdav'][$dav]; |
701 | - if (true) $pref = str_replace("\r", '', $pref); // remove CR messing up multiline preg_match |
|
713 | + if (true) |
|
714 | + { |
|
715 | + $pref = str_replace("\r", '', $pref); |
|
716 | + } |
|
717 | + // remove CR messing up multiline preg_match |
|
702 | 718 | $val =& $data['prefs'][$name]; |
703 | 719 | |
704 | 720 | //error_log(__METHOD__."() groupdav[$dav]=$pref, calendar[$name]=$val"); |
705 | 721 | |
706 | - if ($data['preprocess']) // showing preferences |
|
722 | + if ($data['preprocess']) |
|
723 | + { |
|
724 | + // showing preferences |
|
707 | 725 | { |
708 | 726 | if (!isset($val)) // no calendar pref --> read value from caldav |
709 | 727 | { |
710 | 728 | $matches = null; |
729 | + } |
|
711 | 730 | if (preg_match('/^ACTION:NONE$/mi', $pref)) |
712 | 731 | { |
713 | 732 | $val = ''; |