@@ -123,7 +123,7 @@ |
||
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 |
@@ -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 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | { |
57 | 57 | parent::__construct(); |
58 | 58 | |
59 | - if($_dir) |
|
59 | + if ($_dir) |
|
60 | 60 | { |
61 | 61 | $this->dir = $_dir; |
62 | 62 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param string &$content=null content to create some replacements only if they are use |
73 | 73 | * @return array|boolean |
74 | 74 | */ |
75 | - protected function get_replacements($id,&$content=null) |
|
75 | + protected function get_replacements($id, &$content = null) |
|
76 | 76 | { |
77 | 77 | if (!($replacements = $this->filemanager_replacements($id, '', $content))) |
78 | 78 | { |
@@ -88,27 +88,27 @@ discard block |
||
88 | 88 | * @param string $prefix='' prefix like eg. 'erole' |
89 | 89 | * @return array|boolean |
90 | 90 | */ |
91 | - public function filemanager_replacements($id,$prefix='', &$content = null) |
|
91 | + public function filemanager_replacements($id, $prefix = '', &$content = null) |
|
92 | 92 | { |
93 | 93 | $info = array(); |
94 | - $file = egw_vfs::lstat($id,true); |
|
94 | + $file = egw_vfs::lstat($id, true); |
|
95 | 95 | |
96 | 96 | $file['mtime'] = egw_time::to($file['mtime']); |
97 | 97 | $file['ctime'] = egw_time::to($file['ctime']); |
98 | 98 | |
99 | 99 | $file['name'] = egw_vfs::basename($id); |
100 | 100 | $file['dir'] = egw_vfs::decodePath(egw_vfs::dirname($id)); |
101 | - $dirlist = explode('/',$file['dir']); |
|
101 | + $dirlist = explode('/', $file['dir']); |
|
102 | 102 | $file['folder'] = array_pop($dirlist); |
103 | - $file['folder_file'] = $file['folder'] . '/'.$file['name']; |
|
103 | + $file['folder_file'] = $file['folder'].'/'.$file['name']; |
|
104 | 104 | $file['path'] = $id; |
105 | 105 | $file['rel_path'] = str_replace($this->dir.'/', '', $id); |
106 | 106 | $file['hsize'] = egw_vfs::hsize($file['size']); |
107 | 107 | $file['mime'] = egw_vfs::mime_content_type($id); |
108 | - $file['gid'] *= -1; // our widgets use negative gid's |
|
108 | + $file['gid'] *= -1; // our widgets use negative gid's |
|
109 | 109 | if (($props = egw_vfs::propfind($id))) |
110 | 110 | { |
111 | - foreach($props as $prop) |
|
111 | + foreach ($props as $prop) |
|
112 | 112 | { |
113 | 113 | $file[$prop['name']] = $prop['val']; |
114 | 114 | } |
@@ -118,22 +118,22 @@ discard block |
||
118 | 118 | $file['symlink'] = egw_vfs::readlink($id); |
119 | 119 | } |
120 | 120 | // Custom fields |
121 | - if($content && strpos($content, '#') !== 0) |
|
121 | + if ($content && strpos($content, '#') !== 0) |
|
122 | 122 | { |
123 | 123 | // Expand link-to custom fields |
124 | 124 | $this->cf_link_to_expand($file, $content, $info); |
125 | 125 | |
126 | - foreach(config::get_customfields('filemanager') as $name => $field) |
|
126 | + foreach (config::get_customfields('filemanager') as $name => $field) |
|
127 | 127 | { |
128 | 128 | // Set any missing custom fields, or the marker will stay |
129 | - if(!$file['#'.$name]) |
|
129 | + if (!$file['#'.$name]) |
|
130 | 130 | { |
131 | 131 | $file['#'.$name] = ''; |
132 | 132 | continue; |
133 | 133 | } |
134 | 134 | |
135 | 135 | // Format date cfs per user preferences |
136 | - if($field['type'] == 'date' || $field['type'] == 'date-time') |
|
136 | + if ($field['type'] == 'date' || $field['type'] == 'date-time') |
|
137 | 137 | { |
138 | 138 | $this->date_fields[] = '#'.$name; |
139 | 139 | $file['#'.$name] = egw_time::to($file['#'.$name], $field['type'] == 'date' ? true : ''); |
@@ -142,51 +142,51 @@ discard block |
||
142 | 142 | } |
143 | 143 | |
144 | 144 | // If in apps folder, try for app-specific placeholders |
145 | - if($dirlist[1] == 'apps' && count($dirlist) > 1) |
|
145 | + if ($dirlist[1] == 'apps' && count($dirlist) > 1) |
|
146 | 146 | { |
147 | 147 | // Try this first - a normal path /apps/appname/id/file |
148 | - list($app, $app_id) = explode('/', substr($file['path'], strpos($file['path'], 'apps/')+5)); |
|
148 | + list($app, $app_id) = explode('/', substr($file['path'], strpos($file['path'], 'apps/') + 5)); |
|
149 | 149 | // Symlink? |
150 | - if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
150 | + if (!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
151 | 151 | // Try resolving just app + ID - /apps/App Name/Record Title/file |
152 | - $resolved = egw_vfs::resolve_url_symlinks(implode('/',array_slice(explode('/',$file['dir']),0,4))); |
|
153 | - list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/')+5)); |
|
152 | + $resolved = egw_vfs::resolve_url_symlinks(implode('/', array_slice(explode('/', $file['dir']), 0, 4))); |
|
153 | + list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/') + 5)); |
|
154 | 154 | |
155 | - if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
155 | + if (!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
156 | 156 | // Get rid of any virtual folders (eg: All$) and symlinks |
157 | 157 | $resolved = egw_vfs::resolve_url_symlinks($file['path']); |
158 | - list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/')+5)); |
|
158 | + list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/') + 5)); |
|
159 | 159 | } |
160 | 160 | } |
161 | - if($app && $app_id) |
|
161 | + if ($app && $app_id) |
|
162 | 162 | { |
163 | - if($app && $GLOBALS['egw_info']['user']['apps'][$app]) |
|
163 | + if ($app && $GLOBALS['egw_info']['user']['apps'][$app]) |
|
164 | 164 | { |
165 | 165 | $app_merge = null; |
166 | 166 | try |
167 | 167 | { |
168 | - $classname = $app .'_merge'; |
|
169 | - if(class_exists($classname)) |
|
168 | + $classname = $app.'_merge'; |
|
169 | + if (class_exists($classname)) |
|
170 | 170 | { |
171 | 171 | $app_merge = new $classname(); |
172 | - if($app_merge && method_exists($app_merge, 'get_replacements')) |
|
172 | + if ($app_merge && method_exists($app_merge, 'get_replacements')) |
|
173 | 173 | { |
174 | 174 | $app_placeholders = $app_merge->get_replacements($app_id, $content); |
175 | 175 | } |
176 | 176 | } |
177 | 177 | } |
178 | 178 | // Silently discard & continue |
179 | - catch(Exception $e) { |
|
180 | - unset($e); // not used |
|
179 | + catch (Exception $e) { |
|
180 | + unset($e); // not used |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | } |
184 | 184 | } |
185 | 185 | $link = egw_link::mime_open($file['url'], $file['mime']); |
186 | - if(is_array($link)) |
|
186 | + if (is_array($link)) |
|
187 | 187 | { |
188 | 188 | // Directories have their internal protocol in path here |
189 | - if($link['path'] && strpos($link['path'], '://') !== false) $link['path'] = $file['path']; |
|
189 | + if ($link['path'] && strpos($link['path'], '://') !== false) $link['path'] = $file['path']; |
|
190 | 190 | $link = egw_session::link('/index.php', $link); |
191 | 191 | } |
192 | 192 | else |
@@ -205,12 +205,12 @@ discard block |
||
205 | 205 | $file['url'] = $link; |
206 | 206 | |
207 | 207 | // Add markers |
208 | - foreach($file as $key => &$value) |
|
208 | + foreach ($file as $key => &$value) |
|
209 | 209 | { |
210 | - if(!$value) $value = ''; |
|
211 | - $info['$$'.($prefix ? $prefix.'/':'').$key.'$$'] = $value; |
|
210 | + if (!$value) $value = ''; |
|
211 | + $info['$$'.($prefix ? $prefix.'/' : '').$key.'$$'] = $value; |
|
212 | 212 | } |
213 | - if($app_placeholders) |
|
213 | + if ($app_placeholders) |
|
214 | 214 | { |
215 | 215 | $info = array_merge($app_placeholders, $info); |
216 | 216 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | 'hsize' => 'Size', |
247 | 247 | 'size' => 'Size (in bytes)', |
248 | 248 | ); |
249 | - foreach($fields as $name => $label) |
|
249 | + foreach ($fields as $name => $label) |
|
250 | 250 | { |
251 | 251 | if (!($n&1)) echo '<tr>'; |
252 | 252 | echo '<td>{{'.$name.'}}</td><td>'.lang($label).'</td>'; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | } |
256 | 256 | |
257 | 257 | echo '<tr><td colspan="4"><h3>'.lang('Custom fields').":</h3></td></tr>"; |
258 | - foreach(config::get_customfields('filemanager') as $name => $field) |
|
258 | + foreach (config::get_customfields('filemanager') as $name => $field) |
|
259 | 259 | { |
260 | 260 | echo '<tr><td>{{#'.$name.'}}</td><td colspan="3">'.$field['label']."</td></tr>\n"; |
261 | 261 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | echo '<tr><td colspan="4">'.lang('For files linked to an application entry (inside /apps/appname/id/) the placeholders for that application are also available. See the specific application for a list of available placeholders.').'</td></tr>'; |
265 | 265 | |
266 | 266 | echo '<tr><td colspan="4"><h3>'.lang('General fields:')."</h3></td></tr>"; |
267 | - foreach(array( |
|
267 | + foreach (array( |
|
268 | 268 | 'date' => lang('Date'), |
269 | 269 | 'user/n_fn' => lang('Name of current user, all other contact fields are valid too'), |
270 | 270 | 'user/account_lid' => lang('Username'), |
@@ -27,12 +27,12 @@ |
||
27 | 27 | $this->description = lang('This module displays the current month'); |
28 | 28 | } |
29 | 29 | |
30 | - function get_content(&$arguments,$properties) |
|
30 | + function get_content(&$arguments, $properties) |
|
31 | 31 | { |
32 | - $date = (int) (strtotime(get_var('date',array('POST','GET')))); |
|
32 | + $date = (int)(strtotime(get_var('date', array('POST', 'GET')))); |
|
33 | 33 | $redirect = $arguments['redirect'] ? $arguments['redirect'] : '#'; |
34 | 34 | |
35 | 35 | return $GLOBALS['egw']->jscalendar->get_javascript(). |
36 | - $GLOBALS['egw']->jscalendar->flat($redirect,$date); |
|
36 | + $GLOBALS['egw']->jscalendar->flat($redirect, $date); |
|
37 | 37 | } |
38 | 38 | } |
@@ -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( |
@@ -15,7 +15,7 @@ |
||
15 | 15 | $setup_info['calendar']['enable'] = 1; |
16 | 16 | $setup_info['calendar']['index'] = 'calendar.calendar_uiviews.index&ajax=true'; |
17 | 17 | |
18 | -$setup_info['calendar']['license'] = 'GPL'; |
|
18 | +$setup_info['calendar']['license'] = 'GPL'; |
|
19 | 19 | $setup_info['calendar']['description'] = |
20 | 20 | 'Powerful group calendar with meeting request system and ACL security.'; |
21 | 21 | $setup_info['calendar']['note'] = |
@@ -37,11 +37,11 @@ |
||
37 | 37 | /* Dependencies for this app to work */ |
38 | 38 | $setup_info['importexport']['depends'][] = array( |
39 | 39 | 'appname' => 'phpgwapi', |
40 | - 'versions' => Array('14.1') |
|
40 | + 'versions' => array('14.1') |
|
41 | 41 | ); |
42 | 42 | $setup_info['importexport']['depends'][] = array( |
43 | 43 | 'appname' => 'etemplate', |
44 | - 'versions' => Array('14.1') |
|
44 | + 'versions' => array('14.1') |
|
45 | 45 | ); |
46 | 46 | |
47 | 47 | // installation checks for importexport |
@@ -1909,7 +1909,7 @@ |
||
1909 | 1909 | WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__); |
1910 | 1910 | } |
1911 | 1911 | |
1912 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1 |
|
1912 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1 |
|
1913 | 1913 | WHERE recur_interval=0',__LINE__,__FILE__); |
1914 | 1914 | |
1915 | 1915 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.007'; |
@@ -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 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | { |
33 | 33 | $GLOBALS['egw_setup']->oProc->query("SELECT account_id FROM $acctstbl WHERE account_lid='".$owner[$i]."'"); |
34 | 34 | $GLOBALS['egw_setup']->oProc->next_record(); |
35 | - $GLOBALS['egw_setup']->oProc->query("UPDATE $table SET $field=".$GLOBALS['egw_setup']->oProc->f('account_id')." WHERE $field='".$owner[$i]."'"); |
|
35 | + $GLOBALS['egw_setup']->oProc->query("update $table SET $field=".$GLOBALS['egw_setup']->oProc->f('account_id')." WHERE $field='".$owner[$i]."'"); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | $GLOBALS['egw_setup']->oProc->AlterColumn($table, $field, array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => 0)); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $db2 = clone($GLOBALS['egw_setup']->db); |
189 | 189 | |
190 | 190 | $GLOBALS['egw_setup']->oProc->CreateTable('calendar_entry', |
191 | - Array( |
|
191 | + array( |
|
192 | 192 | 'fd' => array( |
193 | 193 | 'cal_id' => array('type' => 'auto', 'nullable' => false), |
194 | 194 | 'cal_owner' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $GLOBALS['egw_setup']->oProc->DropTable('webcal_entry'); |
239 | 239 | |
240 | 240 | $GLOBALS['egw_setup']->oProc->CreateTable('calendar_entry_user', |
241 | - Array( |
|
241 | + array( |
|
242 | 242 | 'fd' => array( |
243 | 243 | 'cal_id' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), |
244 | 244 | 'cal_login' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | $GLOBALS['egw_setup']->oProc->DropTable('webcal_entry_user'); |
269 | 269 | |
270 | 270 | $GLOBALS['egw_setup']->oProc->CreateTable('calendar_entry_repeats', |
271 | - Array( |
|
271 | + array( |
|
272 | 272 | 'fd' => array( |
273 | 273 | 'cal_id' => array('type' => 'int', 'precision' => 4, 'default' => '0', 'nullable' => false), |
274 | 274 | 'cal_type' => array('type' => 'varchar', 'precision' => 20, 'default' => 'daily', 'nullable' => false), |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | } |
311 | 311 | |
312 | 312 | $GLOBALS['egw_setup']->oProc->DropTable('webcal_entry_repeats'); |
313 | - $GLOBALS['egw_setup']->oProc->query("UPDATE {$GLOBALS['egw_setup']->applications_table} SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'",__LINE__,__FILE__); |
|
313 | + $GLOBALS['egw_setup']->oProc->query("update {$GLOBALS['egw_setup']->applications_table} SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'",__LINE__,__FILE__); |
|
314 | 314 | |
315 | 315 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.7pre2'; |
316 | 316 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | |
603 | 603 | // calendar_entry => phpgw_cal |
604 | 604 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal', |
605 | - Array( |
|
605 | + array( |
|
606 | 606 | 'fd' => array( |
607 | 607 | 'cal_id' => array('type' => 'auto', 'nullable' => False), |
608 | 608 | 'owner' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | |
659 | 659 | // calendar_entry_repeats => phpgw_cal_repeats |
660 | 660 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_repeats', |
661 | - Array( |
|
661 | + array( |
|
662 | 662 | 'fd' => array( |
663 | 663 | 'cal_id' => array('type' => 'int', 'precision' => 8,'nullable' => False), |
664 | 664 | 'recur_type' => array('type' => 'int', 'precision' => 8,'nullable' => False), |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | function calendar_upgrade0_9_11_003() |
732 | 732 | { |
733 | 733 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', |
734 | - Array( |
|
734 | + array( |
|
735 | 735 | 'fd' => array( |
736 | 736 | 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), |
737 | 737 | 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | { |
768 | 768 | $GLOBALS['egw_setup']->oProc->DropTable('phpgw_cal_holidays'); |
769 | 769 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', |
770 | - Array( |
|
770 | + array( |
|
771 | 771 | 'fd' => array( |
772 | 772 | 'hol_id' => array('type' => 'auto','nullable' => False), |
773 | 773 | 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | function calendar_upgrade0_9_13_003() |
855 | 855 | { |
856 | 856 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_alarm', |
857 | - Array( |
|
857 | + array( |
|
858 | 858 | 'fd' => array( |
859 | 859 | 'alarm_id' => array('type' => 'auto','nullable' => False), |
860 | 860 | 'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | |
889 | 889 | function calendar_upgrade0_9_13_005() |
890 | 890 | { |
891 | - $calendar_data = Array(); |
|
891 | + $calendar_data = array(); |
|
892 | 892 | $GLOBALS['egw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal',__LINE__,__FILE__); |
893 | 893 | while($GLOBALS['egw_setup']->oProc->next_record()) |
894 | 894 | { |
@@ -7,6 +7,8 @@ discard block |
||
7 | 7 | * @author Ralf Becker <RalfBecker-AT-outdoor-training.de> |
8 | 8 | * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License |
9 | 9 | * @version $Id$ |
10 | + * @param string $table |
|
11 | + * @param string $field |
|
10 | 12 | */ |
11 | 13 | |
12 | 14 | function calendar_v0_9_2to0_9_3update_owner($table, $field) |
@@ -2304,7 +2306,7 @@ discard block |
||
2304 | 2306 | * |
2305 | 2307 | * Also fix recurring events containing a reference to an other master, created when an exception is made a recurring event. |
2306 | 2308 | * |
2307 | - * @return type |
|
2309 | + * @return string |
|
2308 | 2310 | */ |
2309 | 2311 | function calendar_upgrade14_1() |
2310 | 2312 | { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | { |
19 | 19 | $owner[count($owner)] = $GLOBALS['egw_setup']->oProc->f($field); |
20 | 20 | } |
21 | - if($GLOBALS['egw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'],'0.9.10pre4')) |
|
21 | + if ($GLOBALS['egw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'], '0.9.10pre4')) |
|
22 | 22 | { |
23 | 23 | $acctstbl = 'accounts'; |
24 | 24 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | { |
27 | 27 | $acctstbl = 'phpgw_accounts'; |
28 | 28 | } |
29 | - for($i=0;$i<count($owner);$i++) |
|
29 | + for ($i = 0; $i < count($owner); $i++) |
|
30 | 30 | { |
31 | 31 | $GLOBALS['egw_setup']->oProc->query("SELECT account_id FROM $acctstbl WHERE account_lid='".$owner[$i]."'"); |
32 | 32 | $GLOBALS['egw_setup']->oProc->next_record(); |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | |
40 | 40 | function calendar_upgrade0_9_3pre1() |
41 | 41 | { |
42 | - calendar_v0_9_2to0_9_3update_owner('webcal_entry','cal_create_by'); |
|
43 | - calendar_v0_9_2to0_9_3update_owner('webcal_entry_user','cal_login'); |
|
42 | + calendar_v0_9_2to0_9_3update_owner('webcal_entry', 'cal_create_by'); |
|
43 | + calendar_v0_9_2to0_9_3update_owner('webcal_entry_user', 'cal_login'); |
|
44 | 44 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre2'; |
45 | 45 | return $GLOBALS['setup_info']['calendar']['currentver']; |
46 | 46 | } |
@@ -207,12 +207,12 @@ discard block |
||
207 | 207 | ) |
208 | 208 | ); |
209 | 209 | |
210 | - $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry',__LINE__,__FILE__); |
|
210 | + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry', __LINE__, __FILE__); |
|
211 | 211 | $GLOBALS['egw_setup']->oProc->next_record(); |
212 | - if($GLOBALS['egw_setup']->oProc->f(0)) |
|
212 | + if ($GLOBALS['egw_setup']->oProc->f(0)) |
|
213 | 213 | { |
214 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_owner,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description,cal_id,cal_date,cal_time,cal_mod_date,cal_mod_time FROM webcal_entry ORDER BY cal_id',__LINE__,__FILE__); |
|
215 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
214 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_owner,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description,cal_id,cal_date,cal_time,cal_mod_date,cal_mod_time FROM webcal_entry ORDER BY cal_id', __LINE__, __FILE__); |
|
215 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
216 | 216 | { |
217 | 217 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
218 | 218 | $cal_owner = $GLOBALS['egw_setup']->oProc->f('cal_owner'); |
@@ -222,13 +222,13 @@ discard block |
||
222 | 222 | $cal_access = $GLOBALS['egw_setup']->oProc->f('cal_access'); |
223 | 223 | $cal_name = $GLOBALS['egw_setup']->oProc->f('cal_name'); |
224 | 224 | $cal_description = $GLOBALS['egw_setup']->oProc->f('cal_description'); |
225 | - $datetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')),4))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')),2,2))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')),0,2))),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'),4,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'),6,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'),0,4))); |
|
226 | - $moddatetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')),4))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')),2,2))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')),0,2))),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'),4,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'),6,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'),0,4))); |
|
227 | - $db2->query('SELECT groups FROM webcal_entry_groups WHERE cal_id='.$cal_id,__LINE__,__FILE__); |
|
225 | + $datetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')), 4))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')), 2, 2))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')), 0, 2))), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'), 4, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'), 6, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'), 0, 4))); |
|
226 | + $moddatetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')), 4))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')), 2, 2))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')), 0, 2))), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'), 4, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'), 6, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'), 0, 4))); |
|
227 | + $db2->query('SELECT groups FROM webcal_entry_groups WHERE cal_id='.$cal_id, __LINE__, __FILE__); |
|
228 | 228 | $db2->next_record(); |
229 | 229 | $cal_group = $db2->f('groups'); |
230 | 230 | $db2->query('INSERT INTO calendar_entry(cal_id,cal_owner,cal_group,cal_datetime,cal_mdatetime,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description) ' |
231 | - .'VALUES('.$cal_id.",'".$cal_owner."','".$cal_group."',".$datetime.",".$moddatetime.",".$cal_duration.",".$cal_priority.",'".$cal_type."','".$cal_access."','".$cal_name."','".$cal_description."')",__LINE__,__FILE__); |
|
231 | + .'VALUES('.$cal_id.",'".$cal_owner."','".$cal_group."',".$datetime.",".$moddatetime.",".$cal_duration.",".$cal_priority.",'".$cal_type."','".$cal_access."','".$cal_name."','".$cal_description."')", __LINE__, __FILE__); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
@@ -249,17 +249,17 @@ discard block |
||
249 | 249 | ) |
250 | 250 | ); |
251 | 251 | |
252 | - $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_user',__LINE__,__FILE__); |
|
252 | + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_user', __LINE__, __FILE__); |
|
253 | 253 | $GLOBALS['egw_setup']->oProc->next_record(); |
254 | - if($GLOBALS['egw_setup']->oProc->f(0)) |
|
254 | + if ($GLOBALS['egw_setup']->oProc->f(0)) |
|
255 | 255 | { |
256 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_login,cal_status FROM webcal_entry_user ORDER BY cal_id',__LINE__,__FILE__); |
|
257 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
256 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_login,cal_status FROM webcal_entry_user ORDER BY cal_id', __LINE__, __FILE__); |
|
257 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
258 | 258 | { |
259 | 259 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
260 | 260 | $cal_login = $GLOBALS['egw_setup']->oProc->f('cal_login'); |
261 | 261 | $cal_status = $GLOBALS['egw_setup']->oProc->f('cal_status'); |
262 | - $db2->query('INSERT INTO calendar_entry_user(cal_id,cal_login,cal_status) VALUES('.$cal_id.','.$cal_login.",'".$cal_status."')",__LINE__,__FILE__); |
|
262 | + $db2->query('INSERT INTO calendar_entry_user(cal_id,cal_login,cal_status) VALUES('.$cal_id.','.$cal_login.",'".$cal_status."')", __LINE__, __FILE__); |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
@@ -282,18 +282,18 @@ discard block |
||
282 | 282 | ) |
283 | 283 | ); |
284 | 284 | |
285 | - $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_repeats',__LINE__,__FILE__); |
|
285 | + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_repeats', __LINE__, __FILE__); |
|
286 | 286 | $GLOBALS['egw_setup']->oProc->next_record(); |
287 | - if($GLOBALS['egw_setup']->oProc->f(0)) |
|
287 | + if ($GLOBALS['egw_setup']->oProc->f(0)) |
|
288 | 288 | { |
289 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_type,cal_end,cal_frequency,cal_days FROM webcal_entry_repeats ORDER BY cal_id',__LINE__,__FILE__); |
|
290 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
289 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_type,cal_end,cal_frequency,cal_days FROM webcal_entry_repeats ORDER BY cal_id', __LINE__, __FILE__); |
|
290 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
291 | 291 | { |
292 | 292 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
293 | 293 | $cal_type = $GLOBALS['egw_setup']->oProc->f('cal_type'); |
294 | - if(isset($GLOBALS['egw_setup']->oProc->Record['cal_end'])) |
|
294 | + if (isset($GLOBALS['egw_setup']->oProc->Record['cal_end'])) |
|
295 | 295 | { |
296 | - $enddate = mktime(0,0,0,intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'),4,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'),6,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'),0,4))); |
|
296 | + $enddate = mktime(0, 0, 0, intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'), 4, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'), 6, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'), 0, 4))); |
|
297 | 297 | $useend = 1; |
298 | 298 | } |
299 | 299 | else |
@@ -303,12 +303,12 @@ discard block |
||
303 | 303 | } |
304 | 304 | $cal_frequency = $GLOBALS['egw_setup']->oProc->f('cal_frequency'); |
305 | 305 | $cal_days = $GLOBALS['egw_setup']->oProc->f('cal_days'); |
306 | - $db2->query('INSERT INTO calendar_entry_repeats(cal_id,cal_type,cal_use_end,cal_end,cal_frequency,cal_days) VALUES('.$cal_id.",'".$cal_type."',".$useend.",".$enddate.",".$cal_frequency.",'".$cal_days."')",__LINE__,__FILE__); |
|
306 | + $db2->query('INSERT INTO calendar_entry_repeats(cal_id,cal_type,cal_use_end,cal_end,cal_frequency,cal_days) VALUES('.$cal_id.",'".$cal_type."',".$useend.",".$enddate.",".$cal_frequency.",'".$cal_days."')", __LINE__, __FILE__); |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | |
310 | 310 | $GLOBALS['egw_setup']->oProc->DropTable('webcal_entry_repeats'); |
311 | - $GLOBALS['egw_setup']->oProc->query("UPDATE {$GLOBALS['egw_setup']->applications_table} SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'",__LINE__,__FILE__); |
|
311 | + $GLOBALS['egw_setup']->oProc->query("UPDATE {$GLOBALS['egw_setup']->applications_table} SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'", __LINE__, __FILE__); |
|
312 | 312 | |
313 | 313 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.7pre2'; |
314 | 314 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -320,19 +320,19 @@ discard block |
||
320 | 320 | $db2 = $GLOBALS['egw_setup']->db; |
321 | 321 | |
322 | 322 | $GLOBALS['egw_setup']->oProc->RenameColumn('calendar_entry', 'cal_duration', 'cal_edatetime'); |
323 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_datetime,cal_owner,cal_edatetime,cal_mdatetime FROM calendar_entry ORDER BY cal_id',__LINE__,__FILE__); |
|
324 | - if($GLOBALS['egw_setup']->oProc->num_rows()) |
|
323 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_datetime,cal_owner,cal_edatetime,cal_mdatetime FROM calendar_entry ORDER BY cal_id', __LINE__, __FILE__); |
|
324 | + if ($GLOBALS['egw_setup']->oProc->num_rows()) |
|
325 | 325 | { |
326 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
326 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
327 | 327 | { |
328 | - $db2->query("SELECT preference_value FROM preferences WHERE preference_name='tz_offset' AND preference_appname='common' AND preference_owner=".$GLOBALS['egw_setup']->db->f('cal_owner'),__LINE__,__FILE__); |
|
328 | + $db2->query("SELECT preference_value FROM preferences WHERE preference_name='tz_offset' AND preference_appname='common' AND preference_owner=".$GLOBALS['egw_setup']->db->f('cal_owner'), __LINE__, __FILE__); |
|
329 | 329 | $db2->next_record(); |
330 | 330 | $tz = $db2->f('preference_value'); |
331 | 331 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
332 | 332 | $datetime = $GLOBALS['egw_setup']->oProc->f('cal_datetime') - ((60 * 60) * $tz); |
333 | 333 | $mdatetime = $GLOBALS['egw_setup']->oProc->f('cal_mdatetime') - ((60 * 60) * $tz); |
334 | 334 | $edatetime = $datetime + (60 * $GLOBALS['egw_setup']->oProc->f('cal_edatetime')); |
335 | - $db2->query('UPDATE calendar_entry SET cal_datetime='.$datetime.', cal_edatetime='.$edatetime.', cal_mdatetime='.$mdatetime.' WHERE cal_id='.$cal_id,__LINE__,__FILE__); |
|
335 | + $db2->query('UPDATE calendar_entry SET cal_datetime='.$datetime.', cal_edatetime='.$edatetime.', cal_mdatetime='.$mdatetime.' WHERE cal_id='.$cal_id, __LINE__, __FILE__); |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 | |
@@ -580,22 +580,22 @@ discard block |
||
580 | 580 | { |
581 | 581 | $db2 = $GLOBALS['egw_setup']->db; |
582 | 582 | |
583 | - if(extension_loaded('mcal') == False) |
|
583 | + if (extension_loaded('mcal') == False) |
|
584 | 584 | { |
585 | - define(RECUR_NONE,0); |
|
586 | - define(RECUR_DAILY,1); |
|
587 | - define(RECUR_WEEKLY,2); |
|
588 | - define(RECUR_MONTHLY_MDAY,3); |
|
589 | - define(RECUR_MONTHLY_WDAY,4); |
|
590 | - define(RECUR_YEARLY,5); |
|
591 | - |
|
592 | - define(M_SUNDAY,1); |
|
593 | - define(M_MONDAY,2); |
|
594 | - define(M_TUESDAY,4); |
|
595 | - define(M_WEDNESDAY,8); |
|
596 | - define(M_THURSDAY,16); |
|
597 | - define(M_FRIDAY,32); |
|
598 | - define(M_SATURDAY,64); |
|
585 | + define(RECUR_NONE, 0); |
|
586 | + define(RECUR_DAILY, 1); |
|
587 | + define(RECUR_WEEKLY, 2); |
|
588 | + define(RECUR_MONTHLY_MDAY, 3); |
|
589 | + define(RECUR_MONTHLY_WDAY, 4); |
|
590 | + define(RECUR_YEARLY, 5); |
|
591 | + |
|
592 | + define(M_SUNDAY, 1); |
|
593 | + define(M_MONDAY, 2); |
|
594 | + define(M_TUESDAY, 4); |
|
595 | + define(M_WEDNESDAY, 8); |
|
596 | + define(M_THURSDAY, 16); |
|
597 | + define(M_FRIDAY, 32); |
|
598 | + define(M_SATURDAY, 64); |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | // calendar_entry => phpgw_cal |
@@ -622,13 +622,13 @@ discard block |
||
622 | 622 | ) |
623 | 623 | ); |
624 | 624 | |
625 | - $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry',__LINE__,__FILE__); |
|
626 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
625 | + $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry', __LINE__, __FILE__); |
|
626 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
627 | 627 | { |
628 | 628 | $id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
629 | 629 | $owner = $GLOBALS['egw_setup']->oProc->f('cal_owner'); |
630 | 630 | $access = $GLOBALS['egw_setup']->oProc->f('cal_access'); |
631 | - switch($access) |
|
631 | + switch ($access) |
|
632 | 632 | { |
633 | 633 | case 'private': |
634 | 634 | $is_public = 0; |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | $description = $GLOBALS['egw_setup']->oProc->f('cal_description'); |
651 | 651 | |
652 | 652 | $db2->query("INSERT INTO phpgw_cal(cal_id,owner,groups,datetime,mdatetime,edatetime,priority,cal_type,is_public,title,description) " |
653 | - . "VALUES($id,$owner,'$groups',$datetime,$mdatetime,$edatetime,$priority,'$type',$is_public,'$title','$description')",__LINE__,__FILE__); |
|
653 | + . "VALUES($id,$owner,'$groups',$datetime,$mdatetime,$edatetime,$priority,'$type',$is_public,'$title','$description')", __LINE__, __FILE__); |
|
654 | 654 | } |
655 | 655 | $GLOBALS['egw_setup']->oProc->DropTable('calendar_entry'); |
656 | 656 | |
@@ -658,12 +658,12 @@ discard block |
||
658 | 658 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_repeats', |
659 | 659 | Array( |
660 | 660 | 'fd' => array( |
661 | - 'cal_id' => array('type' => 'int', 'precision' => 8,'nullable' => False), |
|
662 | - 'recur_type' => array('type' => 'int', 'precision' => 8,'nullable' => False), |
|
663 | - 'recur_use_end' => array('type' => 'int', 'precision' => 8,'nullable' => True), |
|
664 | - 'recur_enddate' => array('type' => 'int', 'precision' => 8,'nullable' => True), |
|
665 | - 'recur_interval' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1'), |
|
666 | - 'recur_data' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1') |
|
661 | + 'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
|
662 | + 'recur_type' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
|
663 | + 'recur_use_end' => array('type' => 'int', 'precision' => 8, 'nullable' => True), |
|
664 | + 'recur_enddate' => array('type' => 'int', 'precision' => 8, 'nullable' => True), |
|
665 | + 'recur_interval' => array('type' => 'int', 'precision' => 8, 'nullable' => True, 'default' => '1'), |
|
666 | + 'recur_data' => array('type' => 'int', 'precision' => 8, 'nullable' => True, 'default' => '1') |
|
667 | 667 | ), |
668 | 668 | 'pk' => array(), |
669 | 669 | 'fk' => array(), |
@@ -671,12 +671,12 @@ discard block |
||
671 | 671 | 'uc' => array() |
672 | 672 | ) |
673 | 673 | ); |
674 | - $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry_repeats',__LINE__,__FILE__); |
|
675 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
674 | + $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry_repeats', __LINE__, __FILE__); |
|
675 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
676 | 676 | { |
677 | 677 | $id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
678 | 678 | $recur_type = $GLOBALS['egw_setup']->oProc->f('cal_type'); |
679 | - switch($recur_type) |
|
679 | + switch ($recur_type) |
|
680 | 680 | { |
681 | 681 | case 'daily': |
682 | 682 | $recur_type_num = RECUR_DAILY; |
@@ -699,20 +699,20 @@ discard block |
||
699 | 699 | $recur_interval = $GLOBALS['egw_setup']->oProc->f('cal_frequency'); |
700 | 700 | $days = strtoupper($GLOBALS['egw_setup']->oProc->f('cal_days')); |
701 | 701 | $recur_data = 0; |
702 | - $recur_data += (substr($days,0,1)=='Y'?M_SUNDAY:0); |
|
703 | - $recur_data += (substr($days,1,1)=='Y'?M_MONDAY:0); |
|
704 | - $recur_data += (substr($days,2,1)=='Y'?M_TUESDAY:0); |
|
705 | - $recur_data += (substr($days,3,1)=='Y'?M_WEDNESDAY:0); |
|
706 | - $recur_data += (substr($days,4,1)=='Y'?M_THURSDAY:0); |
|
707 | - $recur_data += (substr($days,5,1)=='Y'?M_FRIDAY:0); |
|
708 | - $recur_data += (substr($days,6,1)=='Y'?M_SATURDAY:0); |
|
702 | + $recur_data += (substr($days, 0, 1) == 'Y' ? M_SUNDAY : 0); |
|
703 | + $recur_data += (substr($days, 1, 1) == 'Y' ? M_MONDAY : 0); |
|
704 | + $recur_data += (substr($days, 2, 1) == 'Y' ? M_TUESDAY : 0); |
|
705 | + $recur_data += (substr($days, 3, 1) == 'Y' ? M_WEDNESDAY : 0); |
|
706 | + $recur_data += (substr($days, 4, 1) == 'Y' ? M_THURSDAY : 0); |
|
707 | + $recur_data += (substr($days, 5, 1) == 'Y' ? M_FRIDAY : 0); |
|
708 | + $recur_data += (substr($days, 6, 1) == 'Y' ? M_SATURDAY : 0); |
|
709 | 709 | $db2->query("INSERT INTO phpgw_cal_repeats(cal_id,recur_type,recur_use_end,recur_enddate,recur_interval,recur_data) " |
710 | - . "VALUES($id,$recur_type_num,$recur_use_end,$recur_end,$recur_interval,$recur_data)",__LINE__,__FILE__); |
|
710 | + . "VALUES($id,$recur_type_num,$recur_use_end,$recur_end,$recur_interval,$recur_data)", __LINE__, __FILE__); |
|
711 | 711 | } |
712 | 712 | $GLOBALS['egw_setup']->oProc->DropTable('calendar_entry_repeats'); |
713 | 713 | |
714 | 714 | // calendar_entry_user => phpgw_cal_user |
715 | - $GLOBALS['egw_setup']->oProc->RenameTable('calendar_entry_user','phpgw_cal_user'); |
|
715 | + $GLOBALS['egw_setup']->oProc->RenameTable('calendar_entry_user', 'phpgw_cal_user'); |
|
716 | 716 | |
717 | 717 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.002'; |
718 | 718 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -731,11 +731,11 @@ discard block |
||
731 | 731 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', |
732 | 732 | Array( |
733 | 733 | 'fd' => array( |
734 | - 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), |
|
735 | - 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), |
|
736 | - 'date_time' => array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0') |
|
734 | + 'locale' => array('type' => 'char', 'precision' => 2, 'nullable' => False), |
|
735 | + 'name' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False), |
|
736 | + 'date_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0') |
|
737 | 737 | ), |
738 | - 'pk' => array('locale','name'), |
|
738 | + 'pk' => array('locale', 'name'), |
|
739 | 739 | 'fk' => array(), |
740 | 740 | 'ix' => array(), |
741 | 741 | 'uc' => array() |
@@ -767,10 +767,10 @@ discard block |
||
767 | 767 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', |
768 | 768 | Array( |
769 | 769 | 'fd' => array( |
770 | - 'hol_id' => array('type' => 'auto','nullable' => False), |
|
771 | - 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), |
|
772 | - 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), |
|
773 | - 'date_time' => array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0') |
|
770 | + 'hol_id' => array('type' => 'auto', 'nullable' => False), |
|
771 | + 'locale' => array('type' => 'char', 'precision' => 2, 'nullable' => False), |
|
772 | + 'name' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False), |
|
773 | + 'date_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0') |
|
774 | 774 | ), |
775 | 775 | 'pk' => array('hol_id'), |
776 | 776 | 'fk' => array(), |
@@ -787,10 +787,10 @@ discard block |
||
787 | 787 | function calendar_upgrade0_9_11_007() |
788 | 788 | { |
789 | 789 | $GLOBALS['egw_setup']->oProc->query('DELETE FROM phpgw_cal_holidays'); |
790 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','mday',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
791 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','month_num',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
792 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','occurence',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
793 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','dow',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
790 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'mday', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
791 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'month_num', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
792 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'occurence', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
793 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'dow', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
794 | 794 | |
795 | 795 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.008'; |
796 | 796 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | function calendar_upgrade0_9_11_009() |
808 | 808 | { |
809 | 809 | $GLOBALS['egw_setup']->oProc->query('DELETE FROM phpgw_cal_holidays'); |
810 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','observance_rule',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
810 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'observance_rule', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
811 | 811 | |
812 | 812 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.010'; |
813 | 813 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | |
843 | 843 | function calendar_upgrade0_9_13_002() |
844 | 844 | { |
845 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','reference',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
845 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'reference', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
846 | 846 | |
847 | 847 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.003'; |
848 | 848 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_alarm', |
855 | 855 | Array( |
856 | 856 | 'fd' => array( |
857 | - 'alarm_id' => array('type' => 'auto','nullable' => False), |
|
857 | + 'alarm_id' => array('type' => 'auto', 'nullable' => False), |
|
858 | 858 | 'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
859 | 859 | 'cal_owner' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
860 | 860 | 'cal_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
@@ -867,8 +867,8 @@ discard block |
||
867 | 867 | ) |
868 | 868 | ); |
869 | 869 | |
870 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','uid',array('type' => 'varchar', 'precision' => 255,'nullable' => False)); |
|
871 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','location',array('type' => 'varchar', 'precision' => 255,'nullable' => True)); |
|
870 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'uid', array('type' => 'varchar', 'precision' => 255, 'nullable' => False)); |
|
871 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'location', array('type' => 'varchar', 'precision' => 255, 'nullable' => True)); |
|
872 | 872 | |
873 | 873 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.004'; |
874 | 874 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -877,7 +877,7 @@ discard block |
||
877 | 877 | |
878 | 878 | function calendar_upgrade0_9_13_004() |
879 | 879 | { |
880 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_alarm','alarm_enabled',array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => '1')); |
|
880 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_alarm', 'alarm_enabled', array('type' => 'int', 'precision' => 4, 'nullable' => False, 'default' => '1')); |
|
881 | 881 | |
882 | 882 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.005'; |
883 | 883 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -887,18 +887,18 @@ discard block |
||
887 | 887 | function calendar_upgrade0_9_13_005() |
888 | 888 | { |
889 | 889 | $calendar_data = Array(); |
890 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal',__LINE__,__FILE__); |
|
891 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
890 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal', __LINE__, __FILE__); |
|
891 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
892 | 892 | { |
893 | 893 | $calendar_data[$GLOBALS['egw_setup']->oProc->f('cal_id')] = $GLOBALS['egw_setup']->oProc->f('category'); |
894 | 894 | } |
895 | 895 | |
896 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal','category',array('type' => 'varchar', 'precision' => 30,'nullable' => True)); |
|
896 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal', 'category', array('type' => 'varchar', 'precision' => 30, 'nullable' => True)); |
|
897 | 897 | |
898 | 898 | @reset($calendar_data); |
899 | - while($calendar_data && list($cal_id,$category) = each($calendar_data)) |
|
899 | + while ($calendar_data && list($cal_id, $category) = each($calendar_data)) |
|
900 | 900 | { |
901 | - $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_cal SET category='".$category."' WHERE cal_id=".$cal_id,__LINE__,__FILE__); |
|
901 | + $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_cal SET category='".$category."' WHERE cal_id=".$cal_id, __LINE__, __FILE__); |
|
902 | 902 | } |
903 | 903 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.006'; |
904 | 904 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | |
908 | 908 | function calendar_upgrade0_9_13_006() |
909 | 909 | { |
910 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_repeats','recur_exception',array('type' => 'varchar', 'precision' => 255, 'nullable' => True, 'default' => '')); |
|
910 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_repeats', 'recur_exception', array('type' => 'varchar', 'precision' => 255, 'nullable' => True, 'default' => '')); |
|
911 | 911 | |
912 | 912 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.007'; |
913 | 913 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -917,20 +917,20 @@ discard block |
||
917 | 917 | |
918 | 918 | function calendar_upgrade0_9_13_007() |
919 | 919 | { |
920 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_user','cal_type',array( |
|
920 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_user', 'cal_type', array( |
|
921 | 921 | 'type' => 'varchar', |
922 | 922 | 'precision' => '1', |
923 | 923 | 'nullable' => False, |
924 | 924 | 'default' => 'u' |
925 | 925 | )); |
926 | 926 | |
927 | - $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_extra',array( |
|
927 | + $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_extra', array( |
|
928 | 928 | 'fd' => array( |
929 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
930 | - 'cal_extra_name' => array('type' => 'varchar','precision' => '40','nullable' => False), |
|
931 | - 'cal_extra_value' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '') |
|
929 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
930 | + 'cal_extra_name' => array('type' => 'varchar', 'precision' => '40', 'nullable' => False), |
|
931 | + 'cal_extra_value' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '') |
|
932 | 932 | ), |
933 | - 'pk' => array('cal_id','cal_extra_name'), |
|
933 | + 'pk' => array('cal_id', 'cal_extra_name'), |
|
934 | 934 | 'fk' => array(), |
935 | 935 | 'ix' => array(), |
936 | 936 | 'uc' => array() |
@@ -947,7 +947,7 @@ discard block |
||
947 | 947 | function calendar_upgrade0_9_16_001() |
948 | 948 | { |
949 | 949 | // this is to set the default as schema_proc was not setting an empty default |
950 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal_user','cal_type',array( |
|
950 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal_user', 'cal_type', array( |
|
951 | 951 | 'type' => 'varchar', |
952 | 952 | 'precision' => '1', |
953 | 953 | 'nullable' => False, |
@@ -964,15 +964,15 @@ discard block |
||
964 | 964 | |
965 | 965 | function calendar_upgrade0_9_16_002() |
966 | 966 | { |
967 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats',array( |
|
967 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats', array( |
|
968 | 968 | 'fd' => array( |
969 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), |
|
970 | - 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), |
|
971 | - 'recur_use_end' => array('type' => 'int','precision' => '8','default' => '0'), |
|
972 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
973 | - 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), |
|
974 | - 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), |
|
975 | - 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') |
|
969 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
970 | + 'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
971 | + 'recur_use_end' => array('type' => 'int', 'precision' => '8', 'default' => '0'), |
|
972 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
973 | + 'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
974 | + 'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
975 | + 'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '') |
|
976 | 976 | ), |
977 | 977 | 'pk' => array(), |
978 | 978 | 'fk' => array(), |
@@ -988,14 +988,14 @@ discard block |
||
988 | 988 | |
989 | 989 | function calendar_upgrade0_9_16_003() |
990 | 990 | { |
991 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_user',array( |
|
991 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_user', array( |
|
992 | 992 | 'fd' => array( |
993 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
994 | - 'cal_login' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
995 | - 'cal_status' => array('type' => 'char','precision' => '1','default' => 'A'), |
|
996 | - 'cal_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u') |
|
993 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
994 | + 'cal_login' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
995 | + 'cal_status' => array('type' => 'char', 'precision' => '1', 'default' => 'A'), |
|
996 | + 'cal_type' => array('type' => 'varchar', 'precision' => '1', 'nullable' => False, 'default' => 'u') |
|
997 | 997 | ), |
998 | - 'pk' => array('cal_id','cal_login','cal_type'), |
|
998 | + 'pk' => array('cal_id', 'cal_login', 'cal_type'), |
|
999 | 999 | 'fk' => array(), |
1000 | 1000 | 'ix' => array(), |
1001 | 1001 | 'uc' => array() |
@@ -1009,16 +1009,16 @@ discard block |
||
1009 | 1009 | |
1010 | 1010 | function calendar_upgrade0_9_16_004() |
1011 | 1011 | { |
1012 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_holidays',array( |
|
1012 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_holidays', array( |
|
1013 | 1013 | 'fd' => array( |
1014 | - 'hol_id' => array('type' => 'auto','nullable' => False), |
|
1015 | - 'locale' => array('type' => 'char','precision' => '2','nullable' => False), |
|
1016 | - 'name' => array('type' => 'varchar','precision' => '50','nullable' => False), |
|
1017 | - 'mday' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1018 | - 'month_num' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1019 | - 'occurence' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1020 | - 'dow' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1021 | - 'observance_rule' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
1014 | + 'hol_id' => array('type' => 'auto', 'nullable' => False), |
|
1015 | + 'locale' => array('type' => 'char', 'precision' => '2', 'nullable' => False), |
|
1016 | + 'name' => array('type' => 'varchar', 'precision' => '50', 'nullable' => False), |
|
1017 | + 'mday' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1018 | + 'month_num' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1019 | + 'occurence' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1020 | + 'dow' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1021 | + 'observance_rule' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
1022 | 1022 | ), |
1023 | 1023 | 'pk' => array('hol_id'), |
1024 | 1024 | 'fk' => array(), |
@@ -1036,13 +1036,13 @@ discard block |
||
1036 | 1036 | { |
1037 | 1037 | // creates uid's for all entries which do not have unique ones, they are '[email protected]' |
1038 | 1038 | // very old entries even have an empty uid, see 0.9.16.006 update |
1039 | - $GLOBALS['egw_setup']->oProc->query("SELECT config_name,config_value FROM {$GLOBALS['egw_setup']->config_table} WHERE config_name IN ('install_id','mail_suffix') AND config_app='phpgwapi'",__LINE__,__FILE__); |
|
1039 | + $GLOBALS['egw_setup']->oProc->query("SELECT config_name,config_value FROM {$GLOBALS['egw_setup']->config_table} WHERE config_name IN ('install_id','mail_suffix') AND config_app='phpgwapi'", __LINE__, __FILE__); |
|
1040 | 1040 | while ($GLOBALS['egw_setup']->oProc->next_record()) |
1041 | 1041 | { |
1042 | 1042 | $config[$GLOBALS['egw_setup']->oProc->f(0)] = $GLOBALS['egw_setup']->oProc->f(1); |
1043 | 1043 | } |
1044 | 1044 | $GLOBALS['egw_setup']->oProc->query('UPDATE phpgw_cal SET uid='. |
1045 | - $GLOBALS['egw_setup']->db->concat($GLOBALS['egw_setup']->db->quote('cal-'),'cal_id', |
|
1045 | + $GLOBALS['egw_setup']->db->concat($GLOBALS['egw_setup']->db->quote('cal-'), 'cal_id', |
|
1046 | 1046 | $GLOBALS['egw_setup']->db->quote('-'.$config['install_id'].'@'. |
1047 | 1047 | ($config['mail_suffix'] ? $config['mail_suffix'] : 'local'))). |
1048 | 1048 | " WHERE uid LIKE '-@%' OR uid=''"); |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | function calendar_upgrade0_9_16_007() |
1066 | 1066 | { |
1067 | 1067 | // update the sequenzes for refreshed tables (postgres only) |
1068 | - $GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_cal_holidays','hol_id'); |
|
1068 | + $GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_cal_holidays', 'hol_id'); |
|
1069 | 1069 | |
1070 | 1070 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0'; |
1071 | 1071 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1075,19 +1075,19 @@ discard block |
||
1075 | 1075 | |
1076 | 1076 | function calendar_upgrade1_0_0() |
1077 | 1077 | { |
1078 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','uid','cal_uid'); |
|
1079 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','owner','cal_owner'); |
|
1080 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','category','cal_category'); |
|
1081 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','groups','cal_groups'); |
|
1082 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','datetime','cal_starttime'); |
|
1083 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','mdatetime','cal_modified'); |
|
1084 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','edatetime','cal_endtime'); |
|
1085 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','priority','cal_priority'); |
|
1086 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','is_public','cal_public'); |
|
1087 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','title','cal_title'); |
|
1088 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','description','cal_description'); |
|
1089 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','location','cal_location'); |
|
1090 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','reference','cal_reference'); |
|
1078 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'uid', 'cal_uid'); |
|
1079 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'owner', 'cal_owner'); |
|
1080 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'category', 'cal_category'); |
|
1081 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'groups', 'cal_groups'); |
|
1082 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'datetime', 'cal_starttime'); |
|
1083 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'mdatetime', 'cal_modified'); |
|
1084 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'edatetime', 'cal_endtime'); |
|
1085 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'priority', 'cal_priority'); |
|
1086 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'is_public', 'cal_public'); |
|
1087 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'title', 'cal_title'); |
|
1088 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'description', 'cal_description'); |
|
1089 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'location', 'cal_location'); |
|
1090 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'reference', 'cal_reference'); |
|
1091 | 1091 | |
1092 | 1092 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.001'; |
1093 | 1093 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1097,13 +1097,13 @@ discard block |
||
1097 | 1097 | |
1098 | 1098 | function calendar_upgrade1_0_0_001() |
1099 | 1099 | { |
1100 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','locale','hol_locale'); |
|
1101 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','name','hol_name'); |
|
1102 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','mday','hol_mday'); |
|
1103 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','month_num','hol_month_num'); |
|
1104 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','occurence','hol_occurence'); |
|
1105 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','dow','hol_dow'); |
|
1106 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','observance_rule','hol_observance_rule'); |
|
1100 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'locale', 'hol_locale'); |
|
1101 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'name', 'hol_name'); |
|
1102 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'mday', 'hol_mday'); |
|
1103 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'month_num', 'hol_month_num'); |
|
1104 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'occurence', 'hol_occurence'); |
|
1105 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'dow', 'hol_dow'); |
|
1106 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'observance_rule', 'hol_observance_rule'); |
|
1107 | 1107 | |
1108 | 1108 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.002'; |
1109 | 1109 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1113,8 +1113,8 @@ discard block |
||
1113 | 1113 | |
1114 | 1114 | function calendar_upgrade1_0_0_002() |
1115 | 1115 | { |
1116 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user','cal_login','cal_user_id'); |
|
1117 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user','cal_type','cal_user_type'); |
|
1116 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user', 'cal_login', 'cal_user_id'); |
|
1117 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user', 'cal_type', 'cal_user_type'); |
|
1118 | 1118 | |
1119 | 1119 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.003'; |
1120 | 1120 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1124,7 +1124,7 @@ discard block |
||
1124 | 1124 | |
1125 | 1125 | function calendar_upgrade1_0_0_003() |
1126 | 1126 | { |
1127 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal','cal_title',array( |
|
1127 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal', 'cal_title', array( |
|
1128 | 1128 | 'type' => 'varchar', |
1129 | 1129 | 'precision' => '255', |
1130 | 1130 | 'nullable' => False, |
@@ -1139,15 +1139,15 @@ discard block |
||
1139 | 1139 | |
1140 | 1140 | function calendar_upgrade1_0_0_004() |
1141 | 1141 | { |
1142 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats',array( |
|
1142 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats', array( |
|
1143 | 1143 | 'fd' => array( |
1144 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1145 | - 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1146 | - 'recur_use_end' => array('type' => 'int','precision' => '8','default' => '0'), |
|
1147 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
1148 | - 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), |
|
1149 | - 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), |
|
1150 | - 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') |
|
1144 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1145 | + 'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1146 | + 'recur_use_end' => array('type' => 'int', 'precision' => '8', 'default' => '0'), |
|
1147 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
1148 | + 'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
1149 | + 'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
1150 | + 'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '') |
|
1151 | 1151 | ), |
1152 | 1152 | 'pk' => array('cal_id'), |
1153 | 1153 | 'fk' => array(), |
@@ -1164,19 +1164,19 @@ discard block |
||
1164 | 1164 | function calendar_upgrade1_0_0_005() |
1165 | 1165 | { |
1166 | 1166 | // change prefix of all calendar tables to egw_ |
1167 | - foreach(array('cal_user','cal_repeats','cal_extra','cal_holidays','cal') as $name) |
|
1167 | + foreach (array('cal_user', 'cal_repeats', 'cal_extra', 'cal_holidays', 'cal') as $name) |
|
1168 | 1168 | { |
1169 | - $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_'.$name,'egw_'.$name); |
|
1169 | + $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_'.$name, 'egw_'.$name); |
|
1170 | 1170 | } |
1171 | 1171 | |
1172 | 1172 | // create new dates table, with content from the egw_cal table |
1173 | - $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_dates',array( |
|
1173 | + $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_dates', array( |
|
1174 | 1174 | 'fd' => array( |
1175 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
1176 | - 'cal_start' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1177 | - 'cal_end' => array('type' => 'int','precision' => '8','nullable' => False) |
|
1175 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
1176 | + 'cal_start' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1177 | + 'cal_end' => array('type' => 'int', 'precision' => '8', 'nullable' => False) |
|
1178 | 1178 | ), |
1179 | - 'pk' => array('cal_id','cal_start'), |
|
1179 | + 'pk' => array('cal_id', 'cal_start'), |
|
1180 | 1180 | 'fk' => array(), |
1181 | 1181 | 'ix' => array(), |
1182 | 1182 | 'uc' => array() |
@@ -1184,49 +1184,49 @@ discard block |
||
1184 | 1184 | $GLOBALS['egw_setup']->oProc->query("INSERT INTO egw_cal_dates SELECT cal_id,cal_starttime,cal_endtime FROM egw_cal"); |
1185 | 1185 | |
1186 | 1186 | // drop the fields transfered to the dates table |
1187 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1187 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1188 | 1188 | 'fd' => array( |
1189 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1190 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1191 | - 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1192 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1193 | - 'cal_groups' => array('type' => 'varchar','precision' => '255'), |
|
1194 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1195 | - 'cal_endtime' => array('type' => 'int','precision' => '8'), |
|
1196 | - 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), |
|
1197 | - 'cal_type' => array('type' => 'varchar','precision' => '10'), |
|
1198 | - 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), |
|
1199 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1189 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1190 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1191 | + 'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1192 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1193 | + 'cal_groups' => array('type' => 'varchar', 'precision' => '255'), |
|
1194 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1195 | + 'cal_endtime' => array('type' => 'int', 'precision' => '8'), |
|
1196 | + 'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'), |
|
1197 | + 'cal_type' => array('type' => 'varchar', 'precision' => '10'), |
|
1198 | + 'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'), |
|
1199 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1200 | 1200 | 'cal_description' => array('type' => 'text'), |
1201 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1202 | - 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
1201 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1202 | + 'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
1203 | 1203 | ), |
1204 | 1204 | 'pk' => array('cal_id'), |
1205 | 1205 | 'fk' => array(), |
1206 | 1206 | 'ix' => array(), |
1207 | 1207 | 'uc' => array() |
1208 | - ),'cal_starttime'); |
|
1209 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1208 | + ), 'cal_starttime'); |
|
1209 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1210 | 1210 | 'fd' => array( |
1211 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1212 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1213 | - 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1214 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1215 | - 'cal_groups' => array('type' => 'varchar','precision' => '255'), |
|
1216 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1217 | - 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), |
|
1218 | - 'cal_type' => array('type' => 'varchar','precision' => '10'), |
|
1219 | - 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), |
|
1220 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1211 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1212 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1213 | + 'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1214 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1215 | + 'cal_groups' => array('type' => 'varchar', 'precision' => '255'), |
|
1216 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1217 | + 'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'), |
|
1218 | + 'cal_type' => array('type' => 'varchar', 'precision' => '10'), |
|
1219 | + 'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'), |
|
1220 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1221 | 1221 | 'cal_description' => array('type' => 'text'), |
1222 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1223 | - 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
1222 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1223 | + 'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
1224 | 1224 | ), |
1225 | 1225 | 'pk' => array('cal_id'), |
1226 | 1226 | 'fk' => array(), |
1227 | 1227 | 'ix' => array(), |
1228 | 1228 | 'uc' => array() |
1229 | - ),'cal_endtime'); |
|
1229 | + ), 'cal_endtime'); |
|
1230 | 1230 | |
1231 | 1231 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.1.001'; |
1232 | 1232 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1242,15 +1242,15 @@ discard block |
||
1242 | 1242 | 'precision' => '8', |
1243 | 1243 | 'default' => '0' |
1244 | 1244 | ));*/ |
1245 | - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user',array( |
|
1245 | + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user', array( |
|
1246 | 1246 | 'fd' => array( |
1247 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1248 | - 'cal_recur_date' => array('type' => 'int','precision' => '8','default' => '0'), |
|
1249 | - 'cal_user_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u'), |
|
1250 | - 'cal_user_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1251 | - 'cal_status' => array('type' => 'char','precision' => '1','default' => 'A') |
|
1247 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1248 | + 'cal_recur_date' => array('type' => 'int', 'precision' => '8', 'default' => '0'), |
|
1249 | + 'cal_user_type' => array('type' => 'varchar', 'precision' => '1', 'nullable' => False, 'default' => 'u'), |
|
1250 | + 'cal_user_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1251 | + 'cal_status' => array('type' => 'char', 'precision' => '1', 'default' => 'A') |
|
1252 | 1252 | ), |
1253 | - 'pk' => array('cal_id','cal_recur_date','cal_user_type','cal_user_id'), |
|
1253 | + 'pk' => array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id'), |
|
1254 | 1254 | 'fk' => array(), |
1255 | 1255 | 'ix' => array(), |
1256 | 1256 | 'uc' => array() |
@@ -1264,50 +1264,50 @@ discard block |
||
1264 | 1264 | |
1265 | 1265 | function calendar_upgrade1_0_1_002() |
1266 | 1266 | { |
1267 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1267 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1268 | 1268 | 'fd' => array( |
1269 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1270 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1271 | - 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1272 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1273 | - 'cal_groups' => array('type' => 'varchar','precision' => '255'), |
|
1274 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1275 | - 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), |
|
1276 | - 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), |
|
1277 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1269 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1270 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1271 | + 'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1272 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1273 | + 'cal_groups' => array('type' => 'varchar', 'precision' => '255'), |
|
1274 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1275 | + 'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'), |
|
1276 | + 'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'), |
|
1277 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1278 | 1278 | 'cal_description' => array('type' => 'text'), |
1279 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1280 | - 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
1279 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1280 | + 'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
1281 | 1281 | ), |
1282 | 1282 | 'pk' => array('cal_id'), |
1283 | 1283 | 'fk' => array(), |
1284 | 1284 | 'ix' => array(), |
1285 | 1285 | 'uc' => array() |
1286 | - ),'cal_type'); |
|
1287 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_owner',array( |
|
1286 | + ), 'cal_type'); |
|
1287 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_owner', array( |
|
1288 | 1288 | 'type' => 'int', |
1289 | 1289 | 'precision' => '4', |
1290 | 1290 | 'nullable' => False |
1291 | 1291 | )); |
1292 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_priority',array( |
|
1292 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_priority', array( |
|
1293 | 1293 | 'type' => 'int', |
1294 | 1294 | 'precision' => '2', |
1295 | 1295 | 'nullable' => False, |
1296 | 1296 | 'default' => '2' |
1297 | 1297 | )); |
1298 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_public',array( |
|
1298 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_public', array( |
|
1299 | 1299 | 'type' => 'int', |
1300 | 1300 | 'precision' => '2', |
1301 | 1301 | 'nullable' => False, |
1302 | 1302 | 'default' => '1' |
1303 | 1303 | )); |
1304 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_reference',array( |
|
1304 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_reference', array( |
|
1305 | 1305 | 'type' => 'int', |
1306 | 1306 | 'precision' => '4', |
1307 | 1307 | 'nullable' => False, |
1308 | 1308 | 'default' => '0' |
1309 | 1309 | )); |
1310 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_modifier',array( |
|
1310 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_modifier', array( |
|
1311 | 1311 | 'type' => 'int', |
1312 | 1312 | 'precision' => '4' |
1313 | 1313 | )); |
@@ -1320,36 +1320,36 @@ discard block |
||
1320 | 1320 | |
1321 | 1321 | function calendar_upgrade1_0_1_003() |
1322 | 1322 | { |
1323 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats',array( |
|
1323 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array( |
|
1324 | 1324 | 'fd' => array( |
1325 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1326 | - 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1327 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
1328 | - 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), |
|
1329 | - 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), |
|
1330 | - 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') |
|
1325 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1326 | + 'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1327 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
1328 | + 'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
1329 | + 'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
1330 | + 'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '') |
|
1331 | 1331 | ), |
1332 | 1332 | 'pk' => array('cal_id'), |
1333 | 1333 | 'fk' => array(), |
1334 | 1334 | 'ix' => array(), |
1335 | 1335 | 'uc' => array() |
1336 | - ),'recur_use_end'); |
|
1337 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','cal_id',array( |
|
1336 | + ), 'recur_use_end'); |
|
1337 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'cal_id', array( |
|
1338 | 1338 | 'type' => 'int', |
1339 | 1339 | 'precision' => '4', |
1340 | 1340 | 'nullable' => False |
1341 | 1341 | )); |
1342 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_type',array( |
|
1342 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_type', array( |
|
1343 | 1343 | 'type' => 'int', |
1344 | 1344 | 'precision' => '2', |
1345 | 1345 | 'nullable' => False |
1346 | 1346 | )); |
1347 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_interval',array( |
|
1347 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_interval', array( |
|
1348 | 1348 | 'type' => 'int', |
1349 | 1349 | 'precision' => '2', |
1350 | 1350 | 'default' => '1' |
1351 | 1351 | )); |
1352 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_data',array( |
|
1352 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_data', array( |
|
1353 | 1353 | 'type' => 'int', |
1354 | 1354 | 'precision' => '2', |
1355 | 1355 | 'default' => '1' |
@@ -1363,13 +1363,13 @@ discard block |
||
1363 | 1363 | |
1364 | 1364 | function calendar_upgrade1_0_1_004() |
1365 | 1365 | { |
1366 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_id',array( |
|
1366 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_id', array( |
|
1367 | 1367 | 'type' => 'int', |
1368 | 1368 | 'precision' => '4', |
1369 | 1369 | 'nullable' => False, |
1370 | 1370 | 'default' => '0' |
1371 | 1371 | )); |
1372 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
1372 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
1373 | 1373 | 'type' => 'int', |
1374 | 1374 | 'precision' => '4', |
1375 | 1375 | 'nullable' => False, |
@@ -1384,7 +1384,7 @@ discard block |
||
1384 | 1384 | |
1385 | 1385 | function calendar_upgrade1_0_1_005() |
1386 | 1386 | { |
1387 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_quantity',array( |
|
1387 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_quantity', array( |
|
1388 | 1388 | 'type' => 'int', |
1389 | 1389 | 'precision' => '4', |
1390 | 1390 | 'default' => '1' |
@@ -1398,7 +1398,7 @@ discard block |
||
1398 | 1398 | |
1399 | 1399 | function calendar_upgrade1_0_1_006() |
1400 | 1400 | { |
1401 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_non_blocking',array( |
|
1401 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_non_blocking', array( |
|
1402 | 1402 | 'type' => 'int', |
1403 | 1403 | 'precision' => '2', |
1404 | 1404 | 'default' => '0' |
@@ -1412,9 +1412,9 @@ discard block |
||
1412 | 1412 | |
1413 | 1413 | function calendar_upgrade1_0_1_007() |
1414 | 1414 | { |
1415 | - $GLOBALS['egw_setup']->db->update('egw_cal_repeats',array('recur_exception' => null),array('recur_exception' => ''),__LINE__,__FILE__,'calendar'); |
|
1415 | + $GLOBALS['egw_setup']->db->update('egw_cal_repeats', array('recur_exception' => null), array('recur_exception' => ''), __LINE__, __FILE__, 'calendar'); |
|
1416 | 1416 | |
1417 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_exception',array( |
|
1417 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_exception', array( |
|
1418 | 1418 | 'type' => 'text' |
1419 | 1419 | )); |
1420 | 1420 | |
@@ -1431,11 +1431,11 @@ discard block |
||
1431 | 1431 | { |
1432 | 1432 | $customfields = array(); |
1433 | 1433 | $order = 0; |
1434 | - foreach($config_data['fields'] as $name => $data) |
|
1434 | + foreach ($config_data['fields'] as $name => $data) |
|
1435 | 1435 | { |
1436 | 1436 | if ($name{0} == '#' && !$data['disabled']) // real not-disabled custom field |
1437 | 1437 | { |
1438 | - $customfields[substr($name,1)] = array( |
|
1438 | + $customfields[substr($name, 1)] = array( |
|
1439 | 1439 | 'type' => 'text', |
1440 | 1440 | 'len' => $data['length'].($data['shown'] ? ','.$data['shown'] : ''), |
1441 | 1441 | 'label' => $data['name'], |
@@ -1458,38 +1458,38 @@ discard block |
||
1458 | 1458 | function calendar_upgrade1_0_1_009() |
1459 | 1459 | { |
1460 | 1460 | $db2 = clone($GLOBALS['egw_setup']->db); |
1461 | - $GLOBALS['egw_setup']->db->select('egw_cal','DISTINCT egw_cal.cal_id,cal_groups,cal_recur_date',"cal_groups != ''",__LINE__,__FILE__, |
|
1462 | - False,'','calendar',0,',egw_cal_user WHERE egw_cal.cal_id=egw_cal_user.cal_id'); |
|
1463 | - while(($row = $GLOBALS['egw_setup']->db->row(true))) |
|
1461 | + $GLOBALS['egw_setup']->db->select('egw_cal', 'DISTINCT egw_cal.cal_id,cal_groups,cal_recur_date', "cal_groups != ''", __LINE__, __FILE__, |
|
1462 | + False, '', 'calendar', 0, ',egw_cal_user WHERE egw_cal.cal_id=egw_cal_user.cal_id'); |
|
1463 | + while (($row = $GLOBALS['egw_setup']->db->row(true))) |
|
1464 | 1464 | { |
1465 | 1465 | $row['cal_user_type'] = 'u'; |
1466 | - foreach(explode(',',$row['cal_groups']) as $group) |
|
1466 | + foreach (explode(',', $row['cal_groups']) as $group) |
|
1467 | 1467 | { |
1468 | 1468 | $row['cal_user_id'] = $group; |
1469 | - $db2->insert('egw_cal_user',array('cal_status' => 'U'),$row,__LINE__,__FILE__,'calendar'); |
|
1469 | + $db2->insert('egw_cal_user', array('cal_status' => 'U'), $row, __LINE__, __FILE__, 'calendar'); |
|
1470 | 1470 | } |
1471 | 1471 | } |
1472 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1472 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1473 | 1473 | 'fd' => array( |
1474 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1475 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1476 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
1477 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1478 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1479 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
1480 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), |
|
1481 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1474 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1475 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1476 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
1477 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1478 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1479 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
1480 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'), |
|
1481 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1482 | 1482 | 'cal_description' => array('type' => 'text'), |
1483 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1484 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
1485 | - 'cal_modifier' => array('type' => 'int','precision' => '4'), |
|
1486 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0') |
|
1483 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1484 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
1485 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4'), |
|
1486 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0') |
|
1487 | 1487 | ), |
1488 | 1488 | 'pk' => array('cal_id'), |
1489 | 1489 | 'fk' => array(), |
1490 | 1490 | 'ix' => array(), |
1491 | 1491 | 'uc' => array() |
1492 | - ),'cal_groups'); |
|
1492 | + ), 'cal_groups'); |
|
1493 | 1493 | |
1494 | 1494 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.2'; |
1495 | 1495 | } |
@@ -1499,7 +1499,7 @@ discard block |
||
1499 | 1499 | function calendar_upgrade1_2() |
1500 | 1500 | { |
1501 | 1501 | // get old alarms (saved before 1.2) working again |
1502 | - $GLOBALS['egw_setup']->db->query("UPDATE egw_async SET async_method ='calendar.bocalupdate.send_alarm' WHERE async_method ='calendar.bocalendar.send_alarm'",__LINE__,__FILE__); |
|
1502 | + $GLOBALS['egw_setup']->db->query("UPDATE egw_async SET async_method ='calendar.bocalupdate.send_alarm' WHERE async_method ='calendar.bocalendar.send_alarm'", __LINE__, __FILE__); |
|
1503 | 1503 | |
1504 | 1504 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.2.001'; |
1505 | 1505 | } |
@@ -1507,7 +1507,7 @@ discard block |
||
1507 | 1507 | |
1508 | 1508 | function calendar_upgrade1_2_001() |
1509 | 1509 | { |
1510 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_special',array( |
|
1510 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_special', array( |
|
1511 | 1511 | 'type' => 'int', |
1512 | 1512 | 'precision' => '2', |
1513 | 1513 | 'default' => '0' |
@@ -1525,7 +1525,7 @@ discard block |
||
1525 | 1525 | |
1526 | 1526 | function calendar_upgrade1_4() |
1527 | 1527 | { |
1528 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_etag',array( |
|
1528 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_etag', array( |
|
1529 | 1529 | 'type' => 'int', |
1530 | 1530 | 'precision' => '4', |
1531 | 1531 | 'default' => '0' |
@@ -1537,59 +1537,59 @@ discard block |
||
1537 | 1537 | |
1538 | 1538 | function calendar_upgrade1_5() |
1539 | 1539 | { |
1540 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1540 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1541 | 1541 | 'fd' => array( |
1542 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1543 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1544 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
1545 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1546 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1547 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
1548 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), |
|
1549 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1542 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1543 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1544 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
1545 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1546 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1547 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
1548 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'), |
|
1549 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1550 | 1550 | 'cal_description' => array('type' => 'text'), |
1551 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1552 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
1553 | - 'cal_modifier' => array('type' => 'int','precision' => '4'), |
|
1554 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0'), |
|
1555 | - 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), |
|
1556 | - 'cal_etag' => array('type' => 'int','precision' => '4'), |
|
1557 | - 'cal_edit_time' => array('type' => 'int','precision' => '8') |
|
1551 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1552 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
1553 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4'), |
|
1554 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
1555 | + 'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
1556 | + 'cal_etag' => array('type' => 'int', 'precision' => '4'), |
|
1557 | + 'cal_edit_time' => array('type' => 'int', 'precision' => '8') |
|
1558 | 1558 | ), |
1559 | 1559 | 'pk' => array('cal_id'), |
1560 | 1560 | 'fk' => array(), |
1561 | 1561 | 'ix' => array(), |
1562 | 1562 | 'uc' => array() |
1563 | - ),'cal_edit_user'); |
|
1564 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1563 | + ), 'cal_edit_user'); |
|
1564 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1565 | 1565 | 'fd' => array( |
1566 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1567 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1568 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
1569 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1570 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1571 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
1572 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), |
|
1573 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1566 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1567 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1568 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
1569 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1570 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1571 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
1572 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'), |
|
1573 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1574 | 1574 | 'cal_description' => array('type' => 'text'), |
1575 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1576 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
1577 | - 'cal_modifier' => array('type' => 'int','precision' => '4'), |
|
1578 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0'), |
|
1579 | - 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), |
|
1580 | - 'cal_etag' => array('type' => 'int','precision' => '4') |
|
1575 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1576 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
1577 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4'), |
|
1578 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
1579 | + 'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
1580 | + 'cal_etag' => array('type' => 'int', 'precision' => '4') |
|
1581 | 1581 | ), |
1582 | 1582 | 'pk' => array('cal_id'), |
1583 | 1583 | 'fk' => array(), |
1584 | 1584 | 'ix' => array(), |
1585 | 1585 | 'uc' => array() |
1586 | - ),'cal_edit_time'); |
|
1587 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_etag',array( |
|
1586 | + ), 'cal_edit_time'); |
|
1587 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_etag', array( |
|
1588 | 1588 | 'type' => 'int', |
1589 | 1589 | 'precision' => '4', |
1590 | 1590 | 'default' => '0' |
1591 | 1591 | )); |
1592 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_etag=0 WHERE cal_etag IS NULL',__LINE__,__FILE__); |
|
1592 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_etag=0 WHERE cal_etag IS NULL', __LINE__, __FILE__); |
|
1593 | 1593 | |
1594 | 1594 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.5.001'; |
1595 | 1595 | } |
@@ -1597,12 +1597,12 @@ discard block |
||
1597 | 1597 | |
1598 | 1598 | function calendar_upgrade1_5_001() |
1599 | 1599 | { |
1600 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_id',array( |
|
1600 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_id', array( |
|
1601 | 1601 | 'type' => 'int', |
1602 | 1602 | 'precision' => '4', |
1603 | 1603 | 'nullable' => False |
1604 | 1604 | )); |
1605 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
1605 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
1606 | 1606 | 'type' => 'varchar', |
1607 | 1607 | 'precision' => '128', |
1608 | 1608 | 'nullable' => False |
@@ -1616,12 +1616,12 @@ discard block |
||
1616 | 1616 | { |
1617 | 1617 | // update the alarm methods |
1618 | 1618 | $async = new asyncservice(); |
1619 | - foreach((array)$async->read('cal:%') as $job) |
|
1619 | + foreach ((array)$async->read('cal:%') as $job) |
|
1620 | 1620 | { |
1621 | 1621 | if ($job['method'] == 'calendar.bocalupdate.send_alarm') |
1622 | 1622 | { |
1623 | 1623 | $job['method'] = 'calendar.calendar_boupdate.send_alarm'; |
1624 | - $async->write($job,true); |
|
1624 | + $async->write($job, true); |
|
1625 | 1625 | } |
1626 | 1626 | } |
1627 | 1627 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.6'; |
@@ -1638,48 +1638,48 @@ discard block |
||
1638 | 1638 | { |
1639 | 1639 | // Set UID of series exception to UID of series master |
1640 | 1640 | // update cal_etag, cal_modified and cal_modifier to distribute changes on GroupDAV devices |
1641 | - foreach($GLOBALS['egw_setup']->db->query(' |
|
1641 | + foreach ($GLOBALS['egw_setup']->db->query(' |
|
1642 | 1642 | SELECT cal_ex.cal_id,cal_ex.cal_uid AS cal_uid_ex,cal_master.cal_uid AS cal_uid_master |
1643 | 1643 | FROM egw_cal cal_ex |
1644 | 1644 | JOIN egw_cal cal_master ON cal_ex.cal_reference=cal_master.cal_id |
1645 | - WHERE cal_ex.cal_reference != 0',__LINE__,__FILE__) as $row) |
|
1645 | + WHERE cal_ex.cal_reference != 0',__LINE__, __FILE__) as $row) |
|
1646 | 1646 | { |
1647 | 1647 | if (strlen($row['cal_uid_master']) > 0 && $row['cal_uid_ex'] != $row['cal_uid_master']) |
1648 | 1648 | { |
1649 | 1649 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_uid=\''.$row['cal_uid_master']. |
1650 | 1650 | '\',cal_etag=cal_etag+1,cal_modified='.time(). |
1651 | - ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
1651 | + ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
1652 | 1652 | } |
1653 | 1653 | } |
1654 | 1654 | |
1655 | 1655 | // Search series exception for nearest exception in series master and add that RECURRENCE-ID |
1656 | 1656 | // as cal_reference (for 1.6.003 and move it to new field cal_recurrence in 1.7.001) |
1657 | 1657 | $diff = null; |
1658 | - foreach($GLOBALS['egw_setup']->db->query('SELECT egw_cal.cal_id,cal_start,recur_exception FROM egw_cal |
|
1658 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT egw_cal.cal_id,cal_start,recur_exception FROM egw_cal |
|
1659 | 1659 | JOIN egw_cal_dates ON egw_cal.cal_id=egw_cal_dates.cal_id |
1660 | 1660 | JOIN egw_cal_repeats ON cal_reference=egw_cal_repeats.cal_id |
1661 | - WHERE cal_reference != 0',__LINE__,__FILE__) as $row) |
|
1661 | + WHERE cal_reference != 0',__LINE__, __FILE__) as $row) |
|
1662 | 1662 | { |
1663 | 1663 | $recurrence = null; |
1664 | - foreach(explode(',',$row['recur_exception']) as $ts) |
|
1664 | + foreach (explode(',', $row['recur_exception']) as $ts) |
|
1665 | 1665 | { |
1666 | - if (is_null($recurrence) || abs($ts-$row['cal_start']) < $diff) |
|
1666 | + if (is_null($recurrence) || abs($ts - $row['cal_start']) < $diff) |
|
1667 | 1667 | { |
1668 | 1668 | $recurrence = $ts; |
1669 | - $diff = abs($ts-$row['cal_start']); |
|
1669 | + $diff = abs($ts - $row['cal_start']); |
|
1670 | 1670 | } |
1671 | 1671 | } |
1672 | 1672 | if ($recurrence) |
1673 | 1673 | { |
1674 | 1674 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_reference='.(int)$recurrence. |
1675 | - ' WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
1675 | + ' WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
1676 | 1676 | } |
1677 | 1677 | else |
1678 | 1678 | { |
1679 | 1679 | // if we cannot determine the RECURRENCE-ID use cal_start |
1680 | 1680 | // because RECURRENCE-ID must be present |
1681 | 1681 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_reference='.(int)$row['cal_start']. |
1682 | - ' WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
1682 | + ' WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
1683 | 1683 | } |
1684 | 1684 | } |
1685 | 1685 | |
@@ -1694,33 +1694,33 @@ discard block |
||
1694 | 1694 | */ |
1695 | 1695 | function calendar_upgrade1_6_003() |
1696 | 1696 | { |
1697 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_creator',array( |
|
1697 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_creator', array( |
|
1698 | 1698 | 'type' => 'int', |
1699 | 1699 | 'precision' => '4', |
1700 | 1700 | 'comment' => 'creating user' |
1701 | 1701 | )); |
1702 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_creator=cal_owner',__LINE__,__FILE__); |
|
1703 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_creator',array( |
|
1702 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_creator=cal_owner', __LINE__, __FILE__); |
|
1703 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_creator', array( |
|
1704 | 1704 | 'type' => 'int', |
1705 | 1705 | 'precision' => '4', |
1706 | 1706 | 'nullable' => False, |
1707 | 1707 | 'comment' => 'creating user' |
1708 | 1708 | )); |
1709 | 1709 | |
1710 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_created',array( |
|
1710 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_created', array( |
|
1711 | 1711 | 'type' => 'int', |
1712 | 1712 | 'precision' => '8', |
1713 | 1713 | 'comment' => 'creation time of event' |
1714 | 1714 | )); |
1715 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_created=cal_modified',__LINE__,__FILE__); |
|
1716 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_created',array( |
|
1715 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_created=cal_modified', __LINE__, __FILE__); |
|
1716 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_created', array( |
|
1717 | 1717 | 'type' => 'int', |
1718 | 1718 | 'precision' => '8', |
1719 | 1719 | 'nullable' => False, |
1720 | 1720 | 'comment' => 'creation time of event' |
1721 | 1721 | )); |
1722 | 1722 | |
1723 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_recurrence',array( |
|
1723 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_recurrence', array( |
|
1724 | 1724 | 'type' => 'int', |
1725 | 1725 | 'precision' => '8', |
1726 | 1726 | 'nullable' => False, |
@@ -1731,14 +1731,14 @@ discard block |
||
1731 | 1731 | // move RECURRENCE-ID from temporarily (1.6.003) |
1732 | 1732 | // used field cal_reference to new field cal_recurrence |
1733 | 1733 | // and restore cal_reference field of series exceptions with id of the series master |
1734 | - foreach($GLOBALS['egw_setup']->db->query(' |
|
1734 | + foreach ($GLOBALS['egw_setup']->db->query(' |
|
1735 | 1735 | SELECT cal_ex.cal_id AS cal_id_ex,cal_master.cal_id AS cal_id_master, |
1736 | 1736 | cal_ex.cal_reference AS cal_reference_ex,cal_ex.cal_uid AS cal_uid_ex, |
1737 | 1737 | cal_master.cal_uid AS cal_uid_master |
1738 | 1738 | FROM egw_cal cal_ex |
1739 | 1739 | JOIN egw_cal cal_master |
1740 | 1740 | ON cal_ex.cal_uid=cal_master.cal_uid AND cal_master.cal_reference = 0 AND cal_ex.cal_owner = cal_master.cal_owner |
1741 | - WHERE cal_ex.cal_reference !=0 AND cal_master.cal_id IS NOT NULL',__LINE__,__FILE__) as $row) |
|
1741 | + WHERE cal_ex.cal_reference !=0 AND cal_master.cal_id IS NOT NULL',__LINE__, __FILE__) as $row) |
|
1742 | 1742 | { |
1743 | 1743 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_recurrence='.(int)$row['cal_reference_ex']. |
1744 | 1744 | ', cal_reference='.(int)$row['cal_id_master']. |
@@ -1755,7 +1755,7 @@ discard block |
||
1755 | 1755 | */ |
1756 | 1756 | function calendar_upgrade1_7_001() |
1757 | 1757 | { |
1758 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_role',array( |
|
1758 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_role', array( |
|
1759 | 1759 | 'type' => 'varchar', |
1760 | 1760 | 'precision' => '64', |
1761 | 1761 | 'default' => 'REQ-PARTICIPANT' |
@@ -1771,14 +1771,14 @@ discard block |
||
1771 | 1771 | */ |
1772 | 1772 | function calendar_upgrade1_7_002() |
1773 | 1773 | { |
1774 | - $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_timezones',array( |
|
1774 | + $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_timezones', array( |
|
1775 | 1775 | 'fd' => array( |
1776 | - 'tz_id' => array('type' => 'auto','nullable' => False), |
|
1777 | - 'tz_tzid' => array('type' => 'varchar','precision' => '128','nullable' => False), |
|
1778 | - 'tz_alias' => array('type' => 'int','precision' => '4','comment' => 'tz_id for data'), |
|
1779 | - 'tz_latitude' => array('type' => 'int','precision' => '4'), |
|
1780 | - 'tz_longitude' => array('type' => 'int','precision' => '4'), |
|
1781 | - 'tz_component' => array('type' => 'text','comment' => 'iCal VTIMEZONE component') |
|
1776 | + 'tz_id' => array('type' => 'auto', 'nullable' => False), |
|
1777 | + 'tz_tzid' => array('type' => 'varchar', 'precision' => '128', 'nullable' => False), |
|
1778 | + 'tz_alias' => array('type' => 'int', 'precision' => '4', 'comment' => 'tz_id for data'), |
|
1779 | + 'tz_latitude' => array('type' => 'int', 'precision' => '4'), |
|
1780 | + 'tz_longitude' => array('type' => 'int', 'precision' => '4'), |
|
1781 | + 'tz_component' => array('type' => 'text', 'comment' => 'iCal VTIMEZONE component') |
|
1782 | 1782 | ), |
1783 | 1783 | 'pk' => array('tz_id'), |
1784 | 1784 | 'fk' => array(), |
@@ -1798,38 +1798,38 @@ discard block |
||
1798 | 1798 | */ |
1799 | 1799 | function calendar_upgrade1_7_003() |
1800 | 1800 | { |
1801 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_type',array( |
|
1801 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_type', array( |
|
1802 | 1802 | 'type' => 'varchar', |
1803 | 1803 | 'precision' => '1', |
1804 | 1804 | 'nullable' => False, |
1805 | 1805 | 'default' => 'u', |
1806 | 1806 | 'comment' => 'u=user, g=group, c=contact, r=resource, e=email' |
1807 | 1807 | )); |
1808 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
1808 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
1809 | 1809 | 'type' => 'varchar', |
1810 | 1810 | 'precision' => '128', |
1811 | 1811 | 'nullable' => False, |
1812 | 1812 | 'comment' => 'id or email-address for type=e' |
1813 | 1813 | )); |
1814 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_status',array( |
|
1814 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_status', array( |
|
1815 | 1815 | 'type' => 'char', |
1816 | 1816 | 'precision' => '1', |
1817 | 1817 | 'default' => 'A', |
1818 | 1818 | 'comment' => 'U=unknown, A=accepted, R=rejected, T=tentative' |
1819 | 1819 | )); |
1820 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_quantity',array( |
|
1820 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_quantity', array( |
|
1821 | 1821 | 'type' => 'int', |
1822 | 1822 | 'precision' => '4', |
1823 | 1823 | 'default' => '1', |
1824 | 1824 | 'comment' => 'only for certain types (eg. resources)' |
1825 | 1825 | )); |
1826 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_role',array( |
|
1826 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_role', array( |
|
1827 | 1827 | 'type' => 'varchar', |
1828 | 1828 | 'precision' => '64', |
1829 | 1829 | 'default' => 'REQ-PARTICIPANT', |
1830 | 1830 | 'comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id' |
1831 | 1831 | )); |
1832 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_user_modified',array( |
|
1832 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_user_modified', array( |
|
1833 | 1833 | 'type' => 'timestamp', |
1834 | 1834 | 'default' => 'current_timestamp', |
1835 | 1835 | 'comment' => 'automatic timestamp of last update' |
@@ -1845,19 +1845,19 @@ discard block |
||
1845 | 1845 | */ |
1846 | 1846 | function calendar_upgrade1_7_004() |
1847 | 1847 | { |
1848 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates','cal_start',array( |
|
1848 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates', 'cal_start', array( |
|
1849 | 1849 | 'type' => 'int', |
1850 | 1850 | 'precision' => '8', |
1851 | 1851 | 'nullable' => False, |
1852 | 1852 | 'comment' => 'starttime in server time' |
1853 | 1853 | )); |
1854 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates','cal_end',array( |
|
1854 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates', 'cal_end', array( |
|
1855 | 1855 | 'type' => 'int', |
1856 | 1856 | 'precision' => '8', |
1857 | 1857 | 'nullable' => False, |
1858 | 1858 | 'comment' => 'endtime in server time' |
1859 | 1859 | )); |
1860 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','tz_id',array( |
|
1860 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'tz_id', array( |
|
1861 | 1861 | 'type' => 'int', |
1862 | 1862 | 'precision' => '4', |
1863 | 1863 | 'comment' => 'key into egw_cal_timezones' |
@@ -1866,7 +1866,7 @@ discard block |
||
1866 | 1866 | // set id of server timezone for existing events, as that's the timezone their recurrences are using |
1867 | 1867 | if (($tzid = date_default_timezone_get()) && ($tz_id = calendar_timezones::tz2id($tzid))) |
1868 | 1868 | { |
1869 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET tz_id='.(int)$tz_id,__LINE__,__FILE__); |
|
1869 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET tz_id='.(int)$tz_id, __LINE__, __FILE__); |
|
1870 | 1870 | } |
1871 | 1871 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.005'; |
1872 | 1872 | } |
@@ -1893,22 +1893,22 @@ discard block |
||
1893 | 1893 | */ |
1894 | 1894 | function calendar_upgrade1_7_006() |
1895 | 1895 | { |
1896 | - foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
1897 | - WHERE (cal_end-cal_start)%86400=86340',__LINE__,__FILE__) as $row) |
|
1896 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
1897 | + WHERE (cal_end-cal_start)%86400=86340',__LINE__, __FILE__) as $row) |
|
1898 | 1898 | { |
1899 | 1899 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end+59 |
1900 | - WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__); |
|
1900 | + WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'], __LINE__, __FILE__); |
|
1901 | 1901 | } |
1902 | 1902 | |
1903 | - foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
1904 | - WHERE cal_end-cal_start>0 AND (cal_end-cal_start)%86400=0',__LINE__,__FILE__) as $row) |
|
1903 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
1904 | + WHERE cal_end-cal_start>0 AND (cal_end-cal_start)%86400=0',__LINE__, __FILE__) as $row) |
|
1905 | 1905 | { |
1906 | 1906 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end-1 |
1907 | - WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__); |
|
1907 | + WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'], __LINE__, __FILE__); |
|
1908 | 1908 | } |
1909 | 1909 | |
1910 | 1910 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1 |
1911 | - WHERE recur_interval=0',__LINE__,__FILE__); |
|
1911 | + WHERE recur_interval=0',__LINE__, __FILE__); |
|
1912 | 1912 | |
1913 | 1913 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.007'; |
1914 | 1914 | } |
@@ -1924,17 +1924,17 @@ discard block |
||
1924 | 1924 | { |
1925 | 1925 | // Set UID of series exception to UID of series master |
1926 | 1926 | // update cal_etag,cal_modified and cal_modifier to distribute changes on GroupDAV devices |
1927 | - foreach($GLOBALS['egw_setup']->db->query(' |
|
1927 | + foreach ($GLOBALS['egw_setup']->db->query(' |
|
1928 | 1928 | SELECT cal_ex.cal_id,cal_ex.cal_uid AS cal_uid_ex,cal_master.cal_uid AS cal_uid_master |
1929 | 1929 | FROM egw_cal cal_ex |
1930 | 1930 | JOIN egw_cal cal_master ON cal_ex.cal_reference=cal_master.cal_id |
1931 | - WHERE cal_ex.cal_reference != 0',__LINE__,__FILE__) as $row) |
|
1931 | + WHERE cal_ex.cal_reference != 0',__LINE__, __FILE__) as $row) |
|
1932 | 1932 | { |
1933 | 1933 | if (strlen($row['cal_uid_master']) > 0 && $row['cal_uid_ex'] != $row['cal_uid_master']) |
1934 | 1934 | { |
1935 | 1935 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_uid=\''.$row['cal_uid_master']. |
1936 | 1936 | '\',cal_etag=cal_etag+1,cal_modified='.time(). |
1937 | - ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
1937 | + ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
1938 | 1938 | } |
1939 | 1939 | } |
1940 | 1940 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.008'; |
@@ -1947,7 +1947,7 @@ discard block |
||
1947 | 1947 | */ |
1948 | 1948 | function calendar_upgrade1_7_008() |
1949 | 1949 | { |
1950 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user',array('cal_user_type','cal_user_id')); |
|
1950 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user', array('cal_user_type', 'cal_user_id')); |
|
1951 | 1951 | |
1952 | 1952 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.009'; |
1953 | 1953 | } |
@@ -1959,22 +1959,22 @@ discard block |
||
1959 | 1959 | */ |
1960 | 1960 | function calendar_upgrade1_7_009() |
1961 | 1961 | { |
1962 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_uid'); |
|
1963 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_owner'); |
|
1962 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_uid'); |
|
1963 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_owner'); |
|
1964 | 1964 | |
1965 | 1965 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.010'; |
1966 | 1966 | } |
1967 | 1967 | |
1968 | 1968 | function calendar_upgrade1_7_010() |
1969 | 1969 | { |
1970 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_deleted',array( |
|
1970 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_deleted', array( |
|
1971 | 1971 | 'type' => 'bool', |
1972 | 1972 | 'nullable' => False, |
1973 | 1973 | 'default' => '0', |
1974 | 1974 | 'comment' => '1 if the event has been deleted, but you want to keep it around' |
1975 | 1975 | )); |
1976 | 1976 | |
1977 | - return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.001'; // was 1.7.011 |
|
1977 | + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.001'; // was 1.7.011 |
|
1978 | 1978 | } |
1979 | 1979 | |
1980 | 1980 | function calendar_upgrade1_7_011() |
@@ -1999,7 +1999,7 @@ discard block |
||
1999 | 1999 | function calendar_upgrade1_9_001() |
2000 | 2000 | { |
2001 | 2001 | // delete in the past wrongly created entries for a single recurrence, which mess up the update, beside being wrong anyway |
2002 | - $GLOBALS['egw_setup']->db->delete('egw_api_content_history',array( |
|
2002 | + $GLOBALS['egw_setup']->db->delete('egw_api_content_history', array( |
|
2003 | 2003 | 'sync_appname' => 'calendar', |
2004 | 2004 | "sync_contentid LIKE '%:%'", |
2005 | 2005 | ), __LINE__, __FILE__); |
@@ -2010,36 +2010,36 @@ discard block |
||
2010 | 2010 | 'precision' => '8', |
2011 | 2011 | 'comment' => 'ts when event was deleted' |
2012 | 2012 | ));*/ |
2013 | - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal',array( |
|
2013 | + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal', array( |
|
2014 | 2014 | 'fd' => array( |
2015 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
2016 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False,'comment' => 'unique id of event(-series)'), |
|
2017 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'event owner / calendar'), |
|
2018 | - 'cal_category' => array('type' => 'varchar','precision' => '30','comment' => 'category id'), |
|
2019 | - 'cal_modified' => array('type' => 'int','precision' => '8','comment' => 'ts of last modification'), |
|
2020 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
2021 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1','comment' => '1=public, 0=private event'), |
|
2022 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
2015 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
2016 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'comment' => 'unique id of event(-series)'), |
|
2017 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'event owner / calendar'), |
|
2018 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30', 'comment' => 'category id'), |
|
2019 | + 'cal_modified' => array('type' => 'int', 'precision' => '8', 'comment' => 'ts of last modification'), |
|
2020 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
2021 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1', 'comment' => '1=public, 0=private event'), |
|
2022 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
2023 | 2023 | 'cal_description' => array('type' => 'text'), |
2024 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
2025 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'cal_id of series for exception'), |
|
2026 | - 'cal_modifier' => array('type' => 'int','precision' => '4','comment' => 'user who last modified event'), |
|
2027 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0','comment' => '1 for non-blocking events'), |
|
2028 | - 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), |
|
2029 | - 'cal_etag' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'etag for optimistic locking'), |
|
2030 | - 'cal_creator' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'creating user'), |
|
2031 | - 'cal_created' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'creation time of event'), |
|
2032 | - 'cal_recurrence' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0','comment' => 'cal_start of original recurrence for exception'), |
|
2033 | - 'tz_id' => array('type' => 'int','precision' => '4','comment' => 'key into egw_cal_timezones'), |
|
2034 | - 'cal_deleted' => array('type' => 'int','precision' => '8','comment' => 'ts when event was deleted') |
|
2024 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
2025 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'cal_id of series for exception'), |
|
2026 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4', 'comment' => 'user who last modified event'), |
|
2027 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0', 'comment' => '1 for non-blocking events'), |
|
2028 | + 'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
2029 | + 'cal_etag' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'comment' => 'etag for optimistic locking'), |
|
2030 | + 'cal_creator' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'creating user'), |
|
2031 | + 'cal_created' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'comment' => 'creation time of event'), |
|
2032 | + 'cal_recurrence' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0', 'comment' => 'cal_start of original recurrence for exception'), |
|
2033 | + 'tz_id' => array('type' => 'int', 'precision' => '4', 'comment' => 'key into egw_cal_timezones'), |
|
2034 | + 'cal_deleted' => array('type' => 'int', 'precision' => '8', 'comment' => 'ts when event was deleted') |
|
2035 | 2035 | ), |
2036 | 2036 | 'pk' => array('cal_id'), |
2037 | 2037 | 'fk' => array(), |
2038 | - 'ix' => array('cal_uid','cal_owner','cal_deleted'), |
|
2038 | + 'ix' => array('cal_uid', 'cal_owner', 'cal_deleted'), |
|
2039 | 2039 | 'uc' => array() |
2040 | - ),array( |
|
2040 | + ), array( |
|
2041 | 2041 | // for deleted rows use cal_modified as deleted date, NULL for not deleted ones |
2042 | - 'cal_deleted' => 'CASE cal_deleted WHEN '.$GLOBALS['egw_setup']->db->quote(true,'bool').' THEN cal_modified ELSE NULL END', |
|
2042 | + 'cal_deleted' => 'CASE cal_deleted WHEN '.$GLOBALS['egw_setup']->db->quote(true, 'bool').' THEN cal_modified ELSE NULL END', |
|
2043 | 2043 | )); |
2044 | 2044 | |
2045 | 2045 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.002'; |
@@ -2051,16 +2051,16 @@ discard block |
||
2051 | 2051 | */ |
2052 | 2052 | function calendar_upgrade1_9_002() |
2053 | 2053 | { |
2054 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','caldav_name',array( |
|
2054 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'caldav_name', array( |
|
2055 | 2055 | 'type' => 'varchar', |
2056 | 2056 | 'precision' => '64', |
2057 | 2057 | 'comment' => 'name part of CalDAV URL, if specified by client' |
2058 | 2058 | )); |
2059 | - $GLOBALS['egw_setup']->db->query($sql='UPDATE egw_cal SET caldav_name='. |
|
2059 | + $GLOBALS['egw_setup']->db->query($sql = 'UPDATE egw_cal SET caldav_name='. |
|
2060 | 2060 | $GLOBALS['egw_setup']->db->concat( |
2061 | - $GLOBALS['egw_setup']->db->to_varchar('cal_id'),"'.ics'"),__LINE__,__FILE__); |
|
2061 | + $GLOBALS['egw_setup']->db->to_varchar('cal_id'), "'.ics'"), __LINE__, __FILE__); |
|
2062 | 2062 | |
2063 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','caldav_name'); |
|
2063 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'caldav_name'); |
|
2064 | 2064 | |
2065 | 2065 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.003'; |
2066 | 2066 | } |
@@ -2071,8 +2071,8 @@ discard block |
||
2071 | 2071 | */ |
2072 | 2072 | function calendar_upgrade1_9_003() |
2073 | 2073 | { |
2074 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_modified'); |
|
2075 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user','cal_user_modified'); |
|
2074 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_modified'); |
|
2075 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user', 'cal_user_modified'); |
|
2076 | 2076 | |
2077 | 2077 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.004'; |
2078 | 2078 | } |
@@ -2084,7 +2084,7 @@ discard block |
||
2084 | 2084 | */ |
2085 | 2085 | function calendar_upgrade1_9_004() |
2086 | 2086 | { |
2087 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_dates','recur_exception',array( |
|
2087 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_dates', 'recur_exception', array( |
|
2088 | 2088 | 'type' => 'bool', |
2089 | 2089 | 'default' => '', |
2090 | 2090 | 'null' => false, |
@@ -2092,16 +2092,16 @@ discard block |
||
2092 | 2092 | )); |
2093 | 2093 | |
2094 | 2094 | // migrate existing exceptions to egw_cal_dates |
2095 | - foreach($GLOBALS['egw_setup']->db->select('egw_cal_repeats', |
|
2095 | + foreach ($GLOBALS['egw_setup']->db->select('egw_cal_repeats', |
|
2096 | 2096 | 'egw_cal_repeats.cal_id AS cal_id,egw_cal_repeats.recur_exception AS recur_exception,MIN(cal_start) AS cal_start,MIN(cal_end) AS cal_end', |
2097 | 2097 | 'egw_cal_repeats.recur_exception IS NOT NULL', __LINE__, __FILE__, false, |
2098 | 2098 | 'GROUP BY egw_cal_repeats.cal_id,egw_cal_repeats.recur_exception', 'calendar', '', |
2099 | 2099 | 'JOIN egw_cal_dates ON egw_cal_repeats.cal_id=egw_cal_dates.cal_id') as $row) |
2100 | 2100 | { |
2101 | - foreach($row['recur_exception'] ? array_unique(explode(',', $row['recur_exception'])) : array() as $recur_exception) |
|
2101 | + foreach ($row['recur_exception'] ? array_unique(explode(',', $row['recur_exception'])) : array() as $recur_exception) |
|
2102 | 2102 | { |
2103 | 2103 | $GLOBALS['egw_setup']->db->insert('egw_cal_dates', array( |
2104 | - 'cal_end' => $recur_exception+$row['cal_end']-$row['cal_start'], |
|
2104 | + 'cal_end' => $recur_exception + $row['cal_end'] - $row['cal_start'], |
|
2105 | 2105 | 'recur_exception' => true, |
2106 | 2106 | ), array( |
2107 | 2107 | 'cal_id' => $row['cal_id'], |
@@ -2113,11 +2113,11 @@ discard block |
||
2113 | 2113 | |
2114 | 2114 | $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array( |
2115 | 2115 | 'fd' => array( |
2116 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
2117 | - 'recur_type' => array('type' => 'int','precision' => '2','nullable' => False), |
|
2118 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
2119 | - 'recur_interval' => array('type' => 'int','precision' => '2','default' => '1'), |
|
2120 | - 'recur_data' => array('type' => 'int','precision' => '2','default' => '1'), |
|
2116 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
2117 | + 'recur_type' => array('type' => 'int', 'precision' => '2', 'nullable' => False), |
|
2118 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
2119 | + 'recur_interval' => array('type' => 'int', 'precision' => '2', 'default' => '1'), |
|
2120 | + 'recur_data' => array('type' => 'int', 'precision' => '2', 'default' => '1'), |
|
2121 | 2121 | ), |
2122 | 2122 | 'pk' => array('cal_id'), |
2123 | 2123 | 'fk' => array(), |
@@ -2138,19 +2138,19 @@ discard block |
||
2138 | 2138 | // returns NULL, if there are no rows! |
2139 | 2139 | if ((int)$max_description_length <= 16384 && $GLOBALS['egw_setup']->oProc->max_varchar_length >= 16384) |
2140 | 2140 | { |
2141 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_description',array( |
|
2141 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_description', array( |
|
2142 | 2142 | 'type' => 'varchar', |
2143 | 2143 | 'precision' => '16384' |
2144 | 2144 | )); |
2145 | 2145 | } |
2146 | 2146 | // allow more categories |
2147 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_category',array( |
|
2147 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_category', array( |
|
2148 | 2148 | 'type' => 'varchar', |
2149 | 2149 | 'precision' => '64', |
2150 | 2150 | 'comment' => 'category id(s)' |
2151 | 2151 | )); |
2152 | 2152 | // remove silly default of 1 |
2153 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_title',array( |
|
2153 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_title', array( |
|
2154 | 2154 | 'type' => 'varchar', |
2155 | 2155 | 'precision' => '255', |
2156 | 2156 | 'nullable' => False |
@@ -2165,14 +2165,14 @@ discard block |
||
2165 | 2165 | { |
2166 | 2166 | // PostgreSQL needs temporary a nullable column, to not stall on broken events without dates! |
2167 | 2167 | // We add that constrain in 1.9.007, after deleting all rows with range_start=0 OR range_start IS NULL |
2168 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','range_start',array( |
|
2168 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'range_start', array( |
|
2169 | 2169 | 'type' => 'int', |
2170 | 2170 | 'precision' => '8', |
2171 | 2171 | 'comment' => 'startdate (of range)' |
2172 | 2172 | )); |
2173 | 2173 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET range_start = (SELECT MIN(cal_start) FROM egw_cal_dates WHERE egw_cal_dates.cal_id=egw_cal.cal_id)', __LINE__, __FILE__); |
2174 | 2174 | |
2175 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','range_end',array( |
|
2175 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'range_end', array( |
|
2176 | 2176 | 'type' => 'int', |
2177 | 2177 | 'precision' => '8', |
2178 | 2178 | 'comment' => 'enddate (of range, UNTIL of RRULE)' |
@@ -2188,18 +2188,18 @@ discard block |
||
2188 | 2188 | { |
2189 | 2189 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET range_end=recur_enddate FROM egw_cal_repeats WHERE egw_cal.cal_id=egw_cal_repeats.cal_id', __LINE__, __FILE__); |
2190 | 2190 | } |
2191 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats',array( |
|
2191 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array( |
|
2192 | 2192 | 'fd' => array( |
2193 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
2194 | - 'recur_type' => array('type' => 'int','precision' => '2','nullable' => False), |
|
2195 | - 'recur_interval' => array('type' => 'int','precision' => '2','default' => '1'), |
|
2196 | - 'recur_data' => array('type' => 'int','precision' => '2','default' => '1') |
|
2193 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
2194 | + 'recur_type' => array('type' => 'int', 'precision' => '2', 'nullable' => False), |
|
2195 | + 'recur_interval' => array('type' => 'int', 'precision' => '2', 'default' => '1'), |
|
2196 | + 'recur_data' => array('type' => 'int', 'precision' => '2', 'default' => '1') |
|
2197 | 2197 | ), |
2198 | 2198 | 'pk' => array('cal_id'), |
2199 | 2199 | 'fk' => array(), |
2200 | 2200 | 'ix' => array(), |
2201 | 2201 | 'uc' => array() |
2202 | - ),'recur_enddate'); |
|
2202 | + ), 'recur_enddate'); |
|
2203 | 2203 | |
2204 | 2204 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.007'; |
2205 | 2205 | } |
@@ -2211,14 +2211,14 @@ discard block |
||
2211 | 2211 | */ |
2212 | 2212 | function calendar_upgrade1_9_007() |
2213 | 2213 | { |
2214 | - foreach(array('egw_cal_repeats','egw_cal_dates','egw_cal_user','egw_cal_extra') as $table) |
|
2214 | + foreach (array('egw_cal_repeats', 'egw_cal_dates', 'egw_cal_user', 'egw_cal_extra') as $table) |
|
2215 | 2215 | { |
2216 | 2216 | $GLOBALS['egw_setup']->db->query("DELETE FROM $table WHERE cal_id IN (SELECT cal_id FROM egw_cal WHERE range_start=0 OR range_start IS NULL)", __LINE__, __FILE__); |
2217 | 2217 | } |
2218 | 2218 | $GLOBALS['egw_setup']->db->query("DELETE FROM egw_cal WHERE range_start=0 OR range_start IS NULL", __LINE__, __FILE__); |
2219 | 2219 | |
2220 | 2220 | // now we can remove temporary default of 0 from range_start and set it NOT NULL |
2221 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','range_start',array( |
|
2221 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'range_start', array( |
|
2222 | 2222 | 'type' => 'int', |
2223 | 2223 | 'precision' => '8', |
2224 | 2224 | 'nullable' => False, |
@@ -2283,7 +2283,7 @@ discard block |
||
2283 | 2283 | |
2284 | 2284 | function calendar_upgrade1_9_010() |
2285 | 2285 | { |
2286 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','caldav_name',array( |
|
2286 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'caldav_name', array( |
|
2287 | 2287 | 'type' => 'varchar', |
2288 | 2288 | 'precision' => '200', |
2289 | 2289 | 'comment' => 'name part of CalDAV URL, if specified by client' |
@@ -2313,7 +2313,7 @@ discard block |
||
2313 | 2313 | SET cal_reference=0,cal_recurrence=0,cal_etag=cal_etag+1,cal_modifier=0,cal_modified=".time()." |
2314 | 2314 | WHERE cal_reference != 0 AND cal_id IN (SELECT cal_id FROM egw_cal_repeats)", __LINE__, __FILE__); |
2315 | 2315 | |
2316 | - foreach($GLOBALS['egw_setup']->db->query( |
|
2316 | + foreach ($GLOBALS['egw_setup']->db->query( |
|
2317 | 2317 | "SELECT DISTINCT master.cal_id,egw_cal_user.cal_user_type,egw_cal_user.cal_user_id,'E' AS cal_status |
2318 | 2318 | FROM egw_cal_user |
2319 | 2319 | JOIN egw_cal ON egw_cal_user.cal_id=egw_cal.cal_id |
@@ -2340,7 +2340,7 @@ discard block |
||
2340 | 2340 | */ |
2341 | 2341 | function calendar_upgrade14_1_001() |
2342 | 2342 | { |
2343 | - foreach($GLOBALS['egw_setup']->db->query( |
|
2343 | + foreach ($GLOBALS['egw_setup']->db->query( |
|
2344 | 2344 | "SELECT egw_cal.cal_id AS cal_id,cal_start,cal_end,range_start,range_end,egw_cal_repeats.*,tz_tzid AS tzid |
2345 | 2345 | FROM egw_cal |
2346 | 2346 | JOIN egw_cal_repeats ON egw_cal_repeats.cal_id=egw_cal.cal_id |
@@ -2362,7 +2362,7 @@ discard block |
||
2362 | 2362 | $enddate->modify(($event['end'] - $event['start']).' second'); |
2363 | 2363 | if (($range_end = $enddate->format('server')) != $event['range_end']) |
2364 | 2364 | { |
2365 | - $GLOBALS['egw_setup']->db->update('egw_cal',array( |
|
2365 | + $GLOBALS['egw_setup']->db->update('egw_cal', array( |
|
2366 | 2366 | 'range_end' => $range_end, |
2367 | 2367 | 'cal_etag=cal_etag+1', |
2368 | 2368 | 'cal_modified' => time(), |
@@ -2372,7 +2372,7 @@ discard block |
||
2372 | 2372 | //error_log(__FUNCTION__."() #$event[id], start=".date('Y-m-d H:i:s', $event['start']).', end='.date('Y-m-d H:i:s', $event['end']).', range_end='.date('Y-m-d H:i:s', $event['recur_enddate']).' --> '.date('Y-m-d H:i:s', $range_end)); |
2373 | 2373 | } |
2374 | 2374 | } |
2375 | - return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.002'; // skip 14.2.001 update, as query is fixed now |
|
2375 | + return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.002'; // skip 14.2.001 update, as query is fixed now |
|
2376 | 2376 | } |
2377 | 2377 | |
2378 | 2378 | /** |
@@ -2396,7 +2396,7 @@ discard block |
||
2396 | 2396 | // if maximum is bigger then 3 |
2397 | 2397 | if ($values[1] > 3) |
2398 | 2398 | { |
2399 | - switch($GLOBALS['egw_setup']->db->Type) |
|
2399 | + switch ($GLOBALS['egw_setup']->db->Type) |
|
2400 | 2400 | { |
2401 | 2401 | case 'mysql': |
2402 | 2402 | $sql = "UPDATE egw_cal |
@@ -2446,7 +2446,7 @@ discard block |
||
2446 | 2446 | |
2447 | 2447 | function calendar_upgrade14_2_003() |
2448 | 2448 | { |
2449 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_uid',array( |
|
2449 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_uid', array( |
|
2450 | 2450 | 'type' => 'ascii', |
2451 | 2451 | 'precision' => '128', |
2452 | 2452 | 'nullable' => False, |
@@ -2458,13 +2458,13 @@ discard block |
||
2458 | 2458 | { |
2459 | 2459 | $GLOBALS['egw_setup']->db->query("UPDATE egw_cal SET cal_category='' WHERE cal_category NOT REGEXP '^[0-9,]*$'", __LINE__, __FILE__); |
2460 | 2460 | } |
2461 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_category',array( |
|
2461 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_category', array( |
|
2462 | 2462 | 'type' => 'ascii', |
2463 | 2463 | 'meta' => 'category', |
2464 | 2464 | 'precision' => '64', |
2465 | 2465 | 'comment' => 'category id(s)' |
2466 | 2466 | )); |
2467 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','caldav_name',array( |
|
2467 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'caldav_name', array( |
|
2468 | 2468 | 'type' => 'ascii', |
2469 | 2469 | 'precision' => '128', |
2470 | 2470 | 'comment' => 'name part of CalDAV URL, if specified by client' |
@@ -2521,22 +2521,22 @@ discard block |
||
2521 | 2521 | 'type' => 'auto', |
2522 | 2522 | 'nullable' => False |
2523 | 2523 | ));*/ |
2524 | - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user',array( |
|
2524 | + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user', array( |
|
2525 | 2525 | 'fd' => array( |
2526 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
2527 | - 'cal_recur_date' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'default' => '0'), |
|
2528 | - 'cal_user_type' => array('type' => 'ascii','precision' => '1','nullable' => False,'default' => 'u','comment' => 'u=user, g=group, c=contact, r=resource, e=email'), |
|
2529 | - 'cal_user_id' => array('type' => 'varchar','meta' => array("cal_user_type='u'" => 'account'),'precision' => '128','nullable' => False,'comment' => 'id or email-address for type=e'), |
|
2530 | - 'cal_status' => array('type' => 'ascii','precision' => '1','default' => 'A','comment' => 'U=unknown, A=accepted, R=rejected, T=tentative'), |
|
2531 | - 'cal_quantity' => array('type' => 'int','precision' => '4','default' => '1','comment' => 'only for certain types (eg. resources)'), |
|
2532 | - 'cal_role' => array('type' => 'ascii','precision' => '64','default' => 'REQ-PARTICIPANT','comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id'), |
|
2533 | - 'cal_user_modified' => array('type' => 'timestamp','default' => 'current_timestamp','comment' => 'automatic timestamp of last update'), |
|
2534 | - 'cal_user_auto' => array('type' => 'auto','nullable' => False) |
|
2526 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
2527 | + 'cal_recur_date' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
2528 | + 'cal_user_type' => array('type' => 'ascii', 'precision' => '1', 'nullable' => False, 'default' => 'u', 'comment' => 'u=user, g=group, c=contact, r=resource, e=email'), |
|
2529 | + 'cal_user_id' => array('type' => 'varchar', 'meta' => array("cal_user_type='u'" => 'account'), 'precision' => '128', 'nullable' => False, 'comment' => 'id or email-address for type=e'), |
|
2530 | + 'cal_status' => array('type' => 'ascii', 'precision' => '1', 'default' => 'A', 'comment' => 'U=unknown, A=accepted, R=rejected, T=tentative'), |
|
2531 | + 'cal_quantity' => array('type' => 'int', 'precision' => '4', 'default' => '1', 'comment' => 'only for certain types (eg. resources)'), |
|
2532 | + 'cal_role' => array('type' => 'ascii', 'precision' => '64', 'default' => 'REQ-PARTICIPANT', 'comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id'), |
|
2533 | + 'cal_user_modified' => array('type' => 'timestamp', 'default' => 'current_timestamp', 'comment' => 'automatic timestamp of last update'), |
|
2534 | + 'cal_user_auto' => array('type' => 'auto', 'nullable' => False) |
|
2535 | 2535 | ), |
2536 | 2536 | 'pk' => array('cal_user_auto'), |
2537 | 2537 | 'fk' => array(), |
2538 | - 'ix' => array('cal_user_modified',array('cal_user_type','cal_user_id')), |
|
2539 | - 'uc' => array(array('cal_id','cal_recur_date','cal_user_type','cal_user_id')) |
|
2538 | + 'ix' => array('cal_user_modified', array('cal_user_type', 'cal_user_id')), |
|
2539 | + 'uc' => array(array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id')) |
|
2540 | 2540 | )); |
2541 | 2541 | |
2542 | 2542 | return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.005'; |
@@ -2545,12 +2545,12 @@ discard block |
||
2545 | 2545 | |
2546 | 2546 | function calendar_upgrade14_2_005() |
2547 | 2547 | { |
2548 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones','tz_tzid',array( |
|
2548 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones', 'tz_tzid', array( |
|
2549 | 2549 | 'type' => 'ascii', |
2550 | 2550 | 'precision' => '128', |
2551 | 2551 | 'nullable' => False |
2552 | 2552 | )); |
2553 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones','tz_component',array( |
|
2553 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones', 'tz_component', array( |
|
2554 | 2554 | 'type' => 'ascii', |
2555 | 2555 | 'precision' => '8192', |
2556 | 2556 | 'comment' => 'iCal VTIMEZONE component' |
@@ -2566,7 +2566,7 @@ discard block |
||
2566 | 2566 | */ |
2567 | 2567 | function calendar_upgrade14_3() |
2568 | 2568 | { |
2569 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_user_attendee',array( |
|
2569 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_user_attendee', array( |
|
2570 | 2570 | 'type' => 'varchar', |
2571 | 2571 | 'precision' => '255', |
2572 | 2572 | 'comment' => 'email or json object with attr. cn, url, ...' |
@@ -2577,12 +2577,12 @@ discard block |
||
2577 | 2577 | |
2578 | 2578 | // delete all but one row, which would give a doublicate key, after above normalising of email addresses |
2579 | 2579 | // by ordering by status we prever accepted over tentative over unknow over deleted |
2580 | - foreach($GLOBALS['egw_setup']->db->select('egw_cal_user', "cal_id,cal_recur_date,$email AS email", array( |
|
2580 | + foreach ($GLOBALS['egw_setup']->db->select('egw_cal_user', "cal_id,cal_recur_date,$email AS email", array( |
|
2581 | 2581 | 'cal_user_type' => 'e', |
2582 | 2582 | ), __LINE__, __FILE__, false, "GROUP BY cal_id,cal_recur_date,$email HAVING COUNT(*)>1", 'calendar') as $row) |
2583 | 2583 | { |
2584 | 2584 | $n = 0; |
2585 | - foreach($GLOBALS['egw_setup']->db->select('egw_cal_user', "*,$email AS email", array( |
|
2585 | + foreach ($GLOBALS['egw_setup']->db->select('egw_cal_user', "*,$email AS email", array( |
|
2586 | 2586 | 'cal_id' => $row['cal_id'], |
2587 | 2587 | 'cal_recur_date' => $row['cal_recur_date'], |
2588 | 2588 | 'cal_user_type' => 'e', |
@@ -2590,7 +2590,7 @@ discard block |
||
2590 | 2590 | ), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user) // order A, T, U, X |
2591 | 2591 | { |
2592 | 2592 | if (strpos($user['email'], '@') !== false && !$n++) continue; |
2593 | - $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')))); |
|
2593 | + $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')))); |
|
2594 | 2594 | } |
2595 | 2595 | } |
2596 | 2596 | |
@@ -2599,7 +2599,7 @@ discard block |
||
2599 | 2599 | "UPDATE egw_cal_user SET cal_user_attendee=cal_user_id,cal_user_id=MD5($email) WHERE cal_user_type='e'", |
2600 | 2600 | __LINE__, __FILE__); |
2601 | 2601 | |
2602 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
2602 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
2603 | 2603 | 'type' => 'ascii', |
2604 | 2604 | 'meta' => array( |
2605 | 2605 | "cal_user_type='u'" => 'account' |
@@ -2619,7 +2619,7 @@ discard block |
||
2619 | 2619 | */ |
2620 | 2620 | function calendar_upgrade14_3_001() |
2621 | 2621 | { |
2622 | - foreach($GLOBALS['egw_setup']->db->query("SELECT egw_cal_user.cal_id AS cal_id,egw_cal_user.cal_user_id AS cal_user_id,egw_cal_user.cal_user_attendee AS cal_user_attendee |
|
2622 | + foreach ($GLOBALS['egw_setup']->db->query("SELECT egw_cal_user.cal_id AS cal_id,egw_cal_user.cal_user_id AS cal_user_id,egw_cal_user.cal_user_attendee AS cal_user_attendee |
|
2623 | 2623 | FROM egw_cal_user |
2624 | 2624 | JOIN egw_cal_user euser ON euser.cal_id=egw_cal_user.cal_id AND euser.cal_user_type='e' AND euser.cal_user_id=egw_cal_user.cal_user_id AND euser.cal_user_attendee IS NULL |
2625 | 2625 | WHERE egw_cal_user.cal_user_type='e' AND egw_cal_user.cal_user_attendee IS NOT NULL |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | 'Arab Standard Time' => 'Asia/Riyadh', |
25 | 25 | 'Arabian Standard Time' => 'Asia/Dubai', |
26 | 26 | 'Arabic Standard Time' => 'Asia/Baghdad', |
27 | - 'Argentina Standard Time' => 'America/Argentina/Buenos_Aires', // was 'America/Buenos_Aires', |
|
27 | + 'Argentina Standard Time' => 'America/Argentina/Buenos_Aires', // was 'America/Buenos_Aires', |
|
28 | 28 | 'Atlantic Standard Time' => 'America/Halifax', |
29 | 29 | 'Azerbaijan Standard Time' => 'Asia/Baku', |
30 | 30 | 'Azores Standard Time' => 'Atlantic/Azores', |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'Greenland Standard Time' => 'America/Godthab', |
60 | 60 | 'Greenwich Standard Time' => 'Atlantic/Reykjavik', |
61 | 61 | 'Hawaiian Standard Time' => 'Pacific/Honolulu', |
62 | - 'India Standard Time' => 'Asia/Kolkata', // Asia/Calcutta is an alias to Asia/Kolkata |
|
62 | + 'India Standard Time' => 'Asia/Kolkata', // Asia/Calcutta is an alias to Asia/Kolkata |
|
63 | 63 | 'Iran Standard Time' => 'Asia/Tehran', |
64 | 64 | 'Israel Standard Time' => 'Asia/Jerusalem', |
65 | 65 | 'Jordan Standard Time' => 'Asia/Amman', |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | 'Eniwetok, Kwajalein, Dateline Time' => 'Pacific/Kwajalein', |
199 | 199 | |
200 | 200 | // various aliases collected over time |
201 | - 'America/Creston' => 'America/Dawson_Creek', // not in sqlight DB of Thunderbird version 1.2011n, Dawson Creek is also UTC-7 without DS |
|
201 | + 'America/Creston' => 'America/Dawson_Creek', // not in sqlight DB of Thunderbird version 1.2011n, Dawson Creek is also UTC-7 without DS |
|
202 | 202 | 'Armenian Standard Time' => 'Asia/Yerevan', |
203 | 203 | 'Asia/Katmandu' => 'Asia/Kathmandu', |
204 | 204 | 'Asia/Calcutta' => 'Asia/Kolkata', |
@@ -10,17 +10,17 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // enable auto-loading of holidays from localhost by default |
13 | -foreach(array( |
|
13 | +foreach (array( |
|
14 | 14 | 'auto_load_holidays' => 'True', |
15 | 15 | 'holidays_url_path' => 'localhost', |
16 | 16 | ) as $name => $value) |
17 | 17 | { |
18 | - $oProc->insert($GLOBALS['egw_setup']->config_table,array( |
|
18 | + $oProc->insert($GLOBALS['egw_setup']->config_table, array( |
|
19 | 19 | 'config_value' => $value, |
20 | - ),array( |
|
20 | + ), array( |
|
21 | 21 | 'config_app' => 'phpgwapi', |
22 | 22 | 'config_name' => $name, |
23 | - ),__FILE__,__LINE__); |
|
23 | + ), __FILE__, __LINE__); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | // import timezone data |
@@ -1490,13 +1490,13 @@ discard block |
||
1490 | 1490 | } |
1491 | 1491 | |
1492 | 1492 | /** |
1493 | - * Converts a participant into a (readable) user- or resource-name |
|
1494 | - * |
|
1495 | - * @param string|int $id id of user or resource |
|
1496 | - * @param string|boolean $use_type =false type-letter or false |
|
1497 | - * @param boolean $append_email =false append email (Name <email>) |
|
1498 | - * @return string with name |
|
1499 | - */ |
|
1493 | + * Converts a participant into a (readable) user- or resource-name |
|
1494 | + * |
|
1495 | + * @param string|int $id id of user or resource |
|
1496 | + * @param string|boolean $use_type =false type-letter or false |
|
1497 | + * @param boolean $append_email =false append email (Name <email>) |
|
1498 | + * @return string with name |
|
1499 | + */ |
|
1500 | 1500 | function participant_name($id,$use_type=false, $append_email=false) |
1501 | 1501 | { |
1502 | 1502 | static $id2lid = array(); |
@@ -1525,13 +1525,13 @@ discard block |
||
1525 | 1525 | } |
1526 | 1526 | |
1527 | 1527 | /** |
1528 | - * Converts participants array of an event into array of (readable) participant-names with status |
|
1529 | - * |
|
1530 | - * @param array $event event-data |
|
1531 | - * @param boolean $long_status =false should the long/verbose status or an icon be use |
|
1532 | - * @param boolean $show_group_invitation =false show group-invitations (status == 'G') or not (default) |
|
1533 | - * @return array with id / names with status pairs |
|
1534 | - */ |
|
1528 | + * Converts participants array of an event into array of (readable) participant-names with status |
|
1529 | + * |
|
1530 | + * @param array $event event-data |
|
1531 | + * @param boolean $long_status =false should the long/verbose status or an icon be use |
|
1532 | + * @param boolean $show_group_invitation =false show group-invitations (status == 'G') or not (default) |
|
1533 | + * @return array with id / names with status pairs |
|
1534 | + */ |
|
1535 | 1535 | function participants($event,$long_status=false,$show_group_invitation=false) |
1536 | 1536 | { |
1537 | 1537 | //error_log(__METHOD__.__LINE__.array2string($event['participants'])); |
@@ -1601,12 +1601,12 @@ discard block |
||
1601 | 1601 | } |
1602 | 1602 | |
1603 | 1603 | /** |
1604 | - * Converts category string of an event into array of (readable) category-names |
|
1605 | - * |
|
1606 | - * @param string $category cat-id (multiple id's commaseparated) |
|
1607 | - * @param int $color color of the category, if multiple cats, the color of the last one with color is returned |
|
1608 | - * @return array with id / names |
|
1609 | - */ |
|
1604 | + * Converts category string of an event into array of (readable) category-names |
|
1605 | + * |
|
1606 | + * @param string $category cat-id (multiple id's commaseparated) |
|
1607 | + * @param int $color color of the category, if multiple cats, the color of the last one with color is returned |
|
1608 | + * @return array with id / names |
|
1609 | + */ |
|
1610 | 1610 | function categories($category,&$color) |
1611 | 1611 | { |
1612 | 1612 | static $id2cat = array(); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | /** |
123 | 123 | * @var array recur_types translates MCAL recur-types to verbose labels |
124 | 124 | */ |
125 | - var $recur_types = Array( |
|
125 | + var $recur_types = array( |
|
126 | 126 | MCAL_RECUR_NONE => 'No recurrence', |
127 | 127 | MCAL_RECUR_DAILY => 'Daily', |
128 | 128 | MCAL_RECUR_WEEKLY => 'Weekly', |
@@ -1897,7 +1897,7 @@ discard block |
||
1897 | 1897 | * @param string $pattern pattern to search |
1898 | 1898 | * @return array with cal_id - title pairs of the matching entries |
1899 | 1899 | */ |
1900 | - function link_query($pattern, Array &$options = array()) |
|
1900 | + function link_query($pattern, array &$options = array()) |
|
1901 | 1901 | { |
1902 | 1902 | $result = array(); |
1903 | 1903 | $query = array( |
@@ -13,23 +13,23 @@ discard block |
||
13 | 13 | |
14 | 14 | if (!defined('ACL_TYPE_IDENTIFER')) // used to mark ACL-values for the debug_message methode |
15 | 15 | { |
16 | - define('ACL_TYPE_IDENTIFER','***ACL***'); |
|
16 | + define('ACL_TYPE_IDENTIFER', '***ACL***'); |
|
17 | 17 | } |
18 | 18 | |
19 | -define('HOUR_s',60*60); |
|
20 | -define('DAY_s',24*HOUR_s); |
|
21 | -define('WEEK_s',7*DAY_s); |
|
19 | +define('HOUR_s', 60 * 60); |
|
20 | +define('DAY_s', 24 * HOUR_s); |
|
21 | +define('WEEK_s', 7 * DAY_s); |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Gives read access to the calendar, but all events the user is not participating are private! |
25 | 25 | * Used by addressbook. |
26 | 26 | */ |
27 | -define('EGW_ACL_READ_FOR_PARTICIPANTS',EGW_ACL_CUSTOM_1); |
|
28 | -define('EGW_ACL_FREEBUSY',EGW_ACL_CUSTOM_2); |
|
27 | +define('EGW_ACL_READ_FOR_PARTICIPANTS', EGW_ACL_CUSTOM_1); |
|
28 | +define('EGW_ACL_FREEBUSY', EGW_ACL_CUSTOM_2); |
|
29 | 29 | /** |
30 | 30 | * Allows to invite an other user (if configured to be used!) |
31 | 31 | */ |
32 | -define('EGW_ACL_INVITE',EGW_ACL_CUSTOM_3); |
|
32 | +define('EGW_ACL_INVITE', EGW_ACL_CUSTOM_3); |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Required (!) include, as we use the MCAL_* constants, BEFORE instanciating (and therefore autoloading) the class |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * 4 = function-calls to exported conversation-functions like date2ts, date2array, ... |
65 | 65 | * 5 = function-calls to private functions |
66 | 66 | */ |
67 | - var $debug=false; |
|
67 | + var $debug = false; |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * @var int $now timestamp in server-time |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | /** |
95 | 95 | * @var int $user nummerical id of the current user-id |
96 | 96 | */ |
97 | - var $user=0; |
|
97 | + var $user = 0; |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * @var array $grants grants of the current user, array with user-id / ored-ACL-rights pairs |
101 | 101 | */ |
102 | - var $grants=array(); |
|
102 | + var $grants = array(); |
|
103 | 103 | |
104 | 104 | /** |
105 | 105 | * @var array $verbose_status translated 1-char status values to a verbose name, run through lang() by the constructor |
@@ -225,25 +225,25 @@ discard block |
||
225 | 225 | */ |
226 | 226 | function __construct() |
227 | 227 | { |
228 | - if ($this->debug > 0) $this->debug_message('calendar_bo::bocal() started',True); |
|
228 | + if ($this->debug > 0) $this->debug_message('calendar_bo::bocal() started', True); |
|
229 | 229 | |
230 | 230 | $this->so = new calendar_so(); |
231 | 231 | $this->datetime = $GLOBALS['egw']->datetime; |
232 | 232 | |
233 | - $this->common_prefs =& $GLOBALS['egw_info']['user']['preferences']['common']; |
|
234 | - $this->cal_prefs =& $GLOBALS['egw_info']['user']['preferences']['calendar']; |
|
233 | + $this->common_prefs = & $GLOBALS['egw_info']['user']['preferences']['common']; |
|
234 | + $this->cal_prefs = & $GLOBALS['egw_info']['user']['preferences']['calendar']; |
|
235 | 235 | |
236 | 236 | $this->now = time(); |
237 | - $this->now_su = egw_time::server2user($this->now,'ts'); |
|
237 | + $this->now_su = egw_time::server2user($this->now, 'ts'); |
|
238 | 238 | |
239 | 239 | $this->user = $GLOBALS['egw_info']['user']['account_id']; |
240 | 240 | |
241 | 241 | $this->grants = $GLOBALS['egw']->acl->get_grants('calendar'); |
242 | 242 | |
243 | - if (!is_array($this->resources = $GLOBALS['egw']->session->appsession('resources','calendar'))) |
|
243 | + if (!is_array($this->resources = $GLOBALS['egw']->session->appsession('resources', 'calendar'))) |
|
244 | 244 | { |
245 | 245 | $this->resources = array(); |
246 | - foreach($GLOBALS['egw']->hooks->process('calendar_resources') as $app => $data) |
|
246 | + foreach ($GLOBALS['egw']->hooks->process('calendar_resources') as $app => $data) |
|
247 | 247 | { |
248 | 248 | if ($data && $data['type']) |
249 | 249 | { |
@@ -259,19 +259,19 @@ discard block |
||
259 | 259 | 'type' => '', |
260 | 260 | 'app' => 'home-accounts', |
261 | 261 | ); |
262 | - $GLOBALS['egw']->session->appsession('resources','calendar',$this->resources); |
|
262 | + $GLOBALS['egw']->session->appsession('resources', 'calendar', $this->resources); |
|
263 | 263 | } |
264 | 264 | //echo "registered resources="; _debug_array($this->resources); |
265 | 265 | |
266 | - $this->config = config::read('calendar'); // only used for horizont, regular calendar config is under phpgwapi |
|
267 | - $this->calview_no_consolidate = ($GLOBALS['egw_info']['server']['calview_no_consolidate']?$GLOBALS['egw_info']['server']['calview_no_consolidate']:5); |
|
266 | + $this->config = config::read('calendar'); // only used for horizont, regular calendar config is under phpgwapi |
|
267 | + $this->calview_no_consolidate = ($GLOBALS['egw_info']['server']['calview_no_consolidate'] ? $GLOBALS['egw_info']['server']['calview_no_consolidate'] : 5); |
|
268 | 268 | $this->require_acl_invite = $GLOBALS['egw_info']['server']['require_acl_invite']; |
269 | 269 | |
270 | - $this->categories = new categories($this->user,'calendar'); |
|
270 | + $this->categories = new categories($this->user, 'calendar'); |
|
271 | 271 | |
272 | 272 | $this->customfields = config::get_customfields('calendar'); |
273 | 273 | |
274 | - foreach($this->alarms as $secs => &$label) |
|
274 | + foreach ($this->alarms as $secs => &$label) |
|
275 | 275 | { |
276 | 276 | $label = self::secs2label($secs); |
277 | 277 | } |
@@ -287,15 +287,15 @@ discard block |
||
287 | 287 | { |
288 | 288 | if ($secs <= 3600) |
289 | 289 | { |
290 | - $label = lang('%1 minutes', $secs/60); |
|
290 | + $label = lang('%1 minutes', $secs / 60); |
|
291 | 291 | } |
292 | - elseif($secs <= 86400) |
|
292 | + elseif ($secs <= 86400) |
|
293 | 293 | { |
294 | - $label = lang('%1 hours', $secs/3600); |
|
294 | + $label = lang('%1 hours', $secs / 3600); |
|
295 | 295 | } |
296 | 296 | else |
297 | 297 | { |
298 | - $label = lang('%1 days', $secs/86400); |
|
298 | + $label = lang('%1 days', $secs / 86400); |
|
299 | 299 | } |
300 | 300 | return $label; |
301 | 301 | } |
@@ -311,12 +311,12 @@ discard block |
||
311 | 311 | if (!$ids) return null; |
312 | 312 | |
313 | 313 | $data = array(); |
314 | - foreach((array)$ids as $id) |
|
314 | + foreach ((array)$ids as $id) |
|
315 | 315 | { |
316 | 316 | $email = $id; |
317 | 317 | $name = ''; |
318 | 318 | $matches = null; |
319 | - if (preg_match('/^(.*) *<([a-z0-9_.@-]{8,})>$/iU',$email,$matches)) |
|
319 | + if (preg_match('/^(.*) *<([a-z0-9_.@-]{8,})>$/iU', $email, $matches)) |
|
320 | 320 | { |
321 | 321 | $name = $matches[1]; |
322 | 322 | $email = $matches[2]; |
@@ -341,12 +341,12 @@ discard block |
||
341 | 341 | function enum_groups(&$event) |
342 | 342 | { |
343 | 343 | $added = 0; |
344 | - foreach(array_keys($event['participants']) as $uid) |
|
344 | + foreach (array_keys($event['participants']) as $uid) |
|
345 | 345 | { |
346 | 346 | if (is_numeric($uid) && $GLOBALS['egw']->accounts->get_type($uid) == 'g' && |
347 | 347 | ($members = $GLOBALS['egw']->accounts->member($uid))) |
348 | 348 | { |
349 | - foreach($members as $member) |
|
349 | + foreach ($members as $member) |
|
350 | 350 | { |
351 | 351 | $member = $member['account_id']; |
352 | 352 | if (!isset($event['participants'][$member])) |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * @param boolean $use_freebusy =true should freebusy rights are taken into account, default true, can be set to false eg. for a search |
370 | 370 | * @return array of user-ids |
371 | 371 | */ |
372 | - private function resolve_users($_users, $no_enum_groups=true, $ignore_acl=false, $use_freebusy=true) |
|
372 | + private function resolve_users($_users, $no_enum_groups = true, $ignore_acl = false, $use_freebusy = true) |
|
373 | 373 | { |
374 | 374 | if (!is_array($_users)) |
375 | 375 | { |
@@ -377,19 +377,19 @@ discard block |
||
377 | 377 | } |
378 | 378 | // only query calendars of users, we have READ-grants from |
379 | 379 | $users = array(); |
380 | - foreach($_users as $user) |
|
380 | + foreach ($_users as $user) |
|
381 | 381 | { |
382 | 382 | $user = trim($user); |
383 | - if ($ignore_acl || $this->check_perms(EGW_ACL_READ|EGW_ACL_READ_FOR_PARTICIPANTS|($use_freebusy?EGW_ACL_FREEBUSY:0),0,$user)) |
|
383 | + if ($ignore_acl || $this->check_perms(EGW_ACL_READ|EGW_ACL_READ_FOR_PARTICIPANTS|($use_freebusy ? EGW_ACL_FREEBUSY : 0), 0, $user)) |
|
384 | 384 | { |
385 | - if ($user && !in_array($user,$users)) // already added? |
|
385 | + if ($user && !in_array($user, $users)) // already added? |
|
386 | 386 | { |
387 | 387 | $users[] = $user; |
388 | 388 | } |
389 | 389 | } |
390 | 390 | elseif ($GLOBALS['egw']->accounts->get_type($user) != 'g') |
391 | 391 | { |
392 | - continue; // for non-groups (eg. users), we stop here if we have no read-rights |
|
392 | + continue; // for non-groups (eg. users), we stop here if we have no read-rights |
|
393 | 393 | } |
394 | 394 | // the further code is only for real users |
395 | 395 | if (!is_numeric($user)) continue; |
@@ -402,11 +402,11 @@ discard block |
||
402 | 402 | $members = $GLOBALS['egw']->accounts->member($user); |
403 | 403 | if (is_array($members)) |
404 | 404 | { |
405 | - foreach($members as $member) |
|
405 | + foreach ($members as $member) |
|
406 | 406 | { |
407 | 407 | // use only members which gave the user a read-grant |
408 | - if (!in_array($member['account_id'],$users) && |
|
409 | - ($ignore_acl || $this->check_perms(EGW_ACL_READ|($use_freebusy?EGW_ACL_FREEBUSY:0),0,$member['account_id']))) |
|
408 | + if (!in_array($member['account_id'], $users) && |
|
409 | + ($ignore_acl || $this->check_perms(EGW_ACL_READ|($use_freebusy ? EGW_ACL_FREEBUSY : 0), 0, $member['account_id']))) |
|
410 | 410 | { |
411 | 411 | $users[] = $member['account_id']; |
412 | 412 | } |
@@ -418,9 +418,9 @@ discard block |
||
418 | 418 | $memberships = $GLOBALS['egw']->accounts->membership($user); |
419 | 419 | if (is_array($memberships)) |
420 | 420 | { |
421 | - foreach($memberships as $group) |
|
421 | + foreach ($memberships as $group) |
|
422 | 422 | { |
423 | - if (!in_array($group['account_id'],$users)) |
|
423 | + if (!in_array($group['account_id'], $users)) |
|
424 | 424 | { |
425 | 425 | $users[] = $group['account_id']; |
426 | 426 | } |
@@ -461,18 +461,18 @@ discard block |
||
461 | 461 | * @return iterator|array|boolean array of events or array with YYYYMMDD strings / array of events pairs (depending on $daywise param) |
462 | 462 | * or false if there are no read-grants from _any_ of the requested users or iterator/recordset if cols are given |
463 | 463 | */ |
464 | - function &search($params,$sql_filter=null) |
|
464 | + function &search($params, $sql_filter = null) |
|
465 | 465 | { |
466 | 466 | $params_in = $params; |
467 | 467 | |
468 | - $params['sql_filter'] = $sql_filter; // dont allow to set it via UI or xmlrpc |
|
468 | + $params['sql_filter'] = $sql_filter; // dont allow to set it via UI or xmlrpc |
|
469 | 469 | |
470 | 470 | // check if any resource wants to hook into |
471 | - foreach($this->resources as $data) |
|
471 | + foreach ($this->resources as $data) |
|
472 | 472 | { |
473 | 473 | if (isset($data['search_filter'])) |
474 | 474 | { |
475 | - $params = ExecMethod($data['search_filter'],$params); |
|
475 | + $params = ExecMethod($data['search_filter'], $params); |
|
476 | 476 | } |
477 | 477 | } |
478 | 478 | |
@@ -490,9 +490,9 @@ discard block |
||
490 | 490 | if (!empty($params['query'])) |
491 | 491 | { |
492 | 492 | $params['private_grants'] = array(); |
493 | - foreach($this->grants as $user => $rights) |
|
493 | + foreach ($this->grants as $user => $rights) |
|
494 | 494 | { |
495 | - if ($rights & EGW_ACL_PRIVATE) $params['private_grants'][] = $user; |
|
495 | + if ($rights&EGW_ACL_PRIVATE) $params['private_grants'][] = $user; |
|
496 | 496 | } |
497 | 497 | } |
498 | 498 | |
@@ -518,49 +518,49 @@ discard block |
||
518 | 518 | $params['enum_recuring'] = $enum_recuring = $daywise || !isset($params['enum_recuring']) || !!$params['enum_recuring']; |
519 | 519 | $cat_id = isset($params['cat_id']) ? $params['cat_id'] : 0; |
520 | 520 | $filter = isset($params['filter']) ? $params['filter'] : 'all'; |
521 | - $offset = isset($params['offset']) && $params['offset'] !== false ? (int) $params['offset'] : false; |
|
521 | + $offset = isset($params['offset']) && $params['offset'] !== false ? (int)$params['offset'] : false; |
|
522 | 522 | // socal::search() returns rejected group-invitations, as only the user not also the group is rejected |
523 | 523 | // as we cant remove them efficiantly in SQL, we kick them out here, but only if just one user is displayed |
524 | 524 | $users_in = (array)$params_in['users']; |
525 | - $remove_rejected_by_user = !in_array($filter,array('all','rejected','everything')) && |
|
525 | + $remove_rejected_by_user = !in_array($filter, array('all', 'rejected', 'everything')) && |
|
526 | 526 | count($users_in) == 1 && $users_in[0] > 0 ? $users_in[0] : null; |
527 | 527 | //error_log(__METHOD__.'('.array2string($params_in).", $sql_filter) params[users]=".array2string($params['users']).' --> remove_rejected_by_user='.array2string($remove_rejected_by_user)); |
528 | 528 | |
529 | 529 | if ($this->debug && ($this->debug > 1 || $this->debug == 'search')) |
530 | 530 | { |
531 | 531 | $this->debug_message('calendar_bo::search(%1) start=%2, end=%3, daywise=%4, cat_id=%5, filter=%6, query=%7, offset=%8, num_rows=%9, order=%10, sql_filter=%11)', |
532 | - True,$params,$start,$end,$daywise,$cat_id,$filter,$params['query'],$offset,(int)$params['num_rows'],$params['order'],$params['sql_filter']); |
|
532 | + True, $params, $start, $end, $daywise, $cat_id, $filter, $params['query'], $offset, (int)$params['num_rows'], $params['order'], $params['sql_filter']); |
|
533 | 533 | } |
534 | 534 | // date2ts(,true) converts to server time, db2data converts again to user-time |
535 | - $events =& $this->so->search(isset($start) ? $this->date2ts($start,true) : null,isset($end) ? $this->date2ts($end,true) : null, |
|
536 | - $users,$cat_id,$filter,$offset,(int)$params['num_rows'],$params,$remove_rejected_by_user); |
|
535 | + $events = & $this->so->search(isset($start) ? $this->date2ts($start, true) : null, isset($end) ? $this->date2ts($end, true) : null, |
|
536 | + $users, $cat_id, $filter, $offset, (int)$params['num_rows'], $params, $remove_rejected_by_user); |
|
537 | 537 | |
538 | 538 | if (isset($params['cols'])) |
539 | 539 | { |
540 | 540 | return $events; |
541 | 541 | } |
542 | 542 | $this->total = $this->so->total; |
543 | - $this->db2data($events,isset($params['date_format']) ? $params['date_format'] : 'ts'); |
|
543 | + $this->db2data($events, isset($params['date_format']) ? $params['date_format'] : 'ts'); |
|
544 | 544 | |
545 | 545 | //echo "<p align=right>remove_rejected_by_user=$remove_rejected_by_user, filter=$filter, params[users]=".print_r($param['users'])."</p>\n"; |
546 | - foreach($events as $id => $event) |
|
546 | + foreach ($events as $id => $event) |
|
547 | 547 | { |
548 | 548 | if ($params['enum_groups'] && $this->enum_groups($event)) |
549 | 549 | { |
550 | 550 | $events[$id] = $event; |
551 | 551 | } |
552 | 552 | $matches = null; |
553 | - if (!(int)$event['id'] && preg_match('/^([a-z_]+)([0-9]+)$/',$event['id'],$matches)) |
|
553 | + if (!(int)$event['id'] && preg_match('/^([a-z_]+)([0-9]+)$/', $event['id'], $matches)) |
|
554 | 554 | { |
555 | - $is_private = self::integration_get_private($matches[1],$matches[2],$event); |
|
555 | + $is_private = self::integration_get_private($matches[1], $matches[2], $event); |
|
556 | 556 | } |
557 | 557 | else |
558 | 558 | { |
559 | - $is_private = !$this->check_perms(EGW_ACL_READ,$event); |
|
559 | + $is_private = !$this->check_perms(EGW_ACL_READ, $event); |
|
560 | 560 | } |
561 | 561 | if ($is_private || (!$event['public'] && $filter == 'hideprivate')) |
562 | 562 | { |
563 | - $this->clear_private_infos($events[$id],$users); |
|
563 | + $this->clear_private_infos($events[$id], $users); |
|
564 | 564 | } |
565 | 565 | } |
566 | 566 | |
@@ -568,18 +568,18 @@ discard block |
||
568 | 568 | { |
569 | 569 | if ($this->debug && ($this->debug > 2 || $this->debug == 'search')) |
570 | 570 | { |
571 | - $this->debug_message('socalendar::search daywise sorting from %1 to %2 of %3',False,$start,$end,$events); |
|
571 | + $this->debug_message('socalendar::search daywise sorting from %1 to %2 of %3', False, $start, $end, $events); |
|
572 | 572 | } |
573 | 573 | // create empty entries for each day in the reported time |
574 | - for($ts = $start; $ts <= $end; $ts += DAY_s) // good enough for array creation, but see while loop below. |
|
574 | + for ($ts = $start; $ts <= $end; $ts += DAY_s) // good enough for array creation, but see while loop below. |
|
575 | 575 | { |
576 | 576 | $daysEvents[$this->date2string($ts)] = array(); |
577 | 577 | } |
578 | - foreach($events as $k => $event) |
|
578 | + foreach ($events as $k => $event) |
|
579 | 579 | { |
580 | - $e_start = max($this->date2ts($event['start']),$start); |
|
580 | + $e_start = max($this->date2ts($event['start']), $start); |
|
581 | 581 | // $event['end']['raw']-1 to allow events to end on a full hour/day without the need to enter it as minute=59 |
582 | - $e_end = min($this->date2ts($event['end'])-1,$end); |
|
582 | + $e_end = min($this->date2ts($event['end']) - 1, $end); |
|
583 | 583 | |
584 | 584 | // add event to each day in the reported time |
585 | 585 | $ts = $e_start; |
@@ -588,23 +588,23 @@ discard block |
||
588 | 588 | $ymd = null; |
589 | 589 | while ($ts <= $e_end) |
590 | 590 | { |
591 | - $daysEvents[$ymd = $this->date2string($ts)][] =& $events[$k]; |
|
592 | - $ts = strtotime("+1 day",$ts); |
|
591 | + $daysEvents[$ymd = $this->date2string($ts)][] = & $events[$k]; |
|
592 | + $ts = strtotime("+1 day", $ts); |
|
593 | 593 | } |
594 | 594 | if ($ymd != ($last = $this->date2string($e_end))) |
595 | 595 | { |
596 | - $daysEvents[$last][] =& $events[$k]; |
|
596 | + $daysEvents[$last][] = & $events[$k]; |
|
597 | 597 | } |
598 | 598 | } |
599 | - $events =& $daysEvents; |
|
599 | + $events = & $daysEvents; |
|
600 | 600 | if ($this->debug && ($this->debug > 2 || $this->debug == 'search')) |
601 | 601 | { |
602 | - $this->debug_message('socalendar::search daywise events=%1',False,$events); |
|
602 | + $this->debug_message('socalendar::search daywise events=%1', False, $events); |
|
603 | 603 | } |
604 | 604 | } |
605 | 605 | if ($this->debug && ($this->debug > 0 || $this->debug == 'search')) |
606 | 606 | { |
607 | - $this->debug_message('calendar_bo::search(%1)=%2',True,$params,$events); |
|
607 | + $this->debug_message('calendar_bo::search(%1)=%2', True, $params, $events); |
|
608 | 608 | } |
609 | 609 | //error_log(__METHOD__."() returning ".count($events)." entries, total=$this->total ".function_backtrace()); |
610 | 610 | return $events; |
@@ -617,9 +617,9 @@ discard block |
||
617 | 617 | * @param string $part |
618 | 618 | * @return array |
619 | 619 | */ |
620 | - static function integration_get_data($app,$part=null) |
|
620 | + static function integration_get_data($app, $part = null) |
|
621 | 621 | { |
622 | - static $integration_data=null; |
|
622 | + static $integration_data = null; |
|
623 | 623 | |
624 | 624 | if (!isset($integration_data)) |
625 | 625 | { |
@@ -641,14 +641,14 @@ discard block |
||
641 | 641 | * @param int|string $id |
642 | 642 | * @return string |
643 | 643 | */ |
644 | - static function integration_get_private($app,$id,$event) |
|
644 | + static function integration_get_private($app, $id, $event) |
|
645 | 645 | { |
646 | - $app_data = self::integration_get_data($app,'is_private'); |
|
646 | + $app_data = self::integration_get_data($app, 'is_private'); |
|
647 | 647 | |
648 | 648 | // no method, fall back to link title |
649 | 649 | if (is_null($app_data)) |
650 | 650 | { |
651 | - $is_private = !egw_link::title($app,$id); |
|
651 | + $is_private = !egw_link::title($app, $id); |
|
652 | 652 | } |
653 | 653 | // boolean value to make all events of $app public (false) or private (true) |
654 | 654 | elseif (is_bool($app_data)) |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | } |
658 | 658 | else |
659 | 659 | { |
660 | - $is_private = (bool)ExecMethod2($app_data,$id,$event); |
|
660 | + $is_private = (bool)ExecMethod2($app_data, $id, $event); |
|
661 | 661 | } |
662 | 662 | //echo '<p>'.__METHOD__."($app,$id,) app_data=".array2string($app_data).' returning '.array2string($is_private)."</p>\n"; |
663 | 663 | return $is_private; |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | * @param array &$event |
672 | 672 | * @param array $allowed_participants ids of the allowed participants, eg. the ones the search is over or eg. the owner of the calendar |
673 | 673 | */ |
674 | - function clear_private_infos(&$event,$allowed_participants = array()) |
|
674 | + function clear_private_infos(&$event, $allowed_participants = array()) |
|
675 | 675 | { |
676 | 676 | if ($event == false) return; |
677 | 677 | if (!is_array($event['participants'])) error_log(__METHOD__.'('.array2string($event).', '.array2string($allowed_participants).') NO PARTICIPANTS '.function_backtrace()); |
@@ -687,19 +687,19 @@ discard block |
||
687 | 687 | 'owner' => $event['owner'], |
688 | 688 | 'uid' => $event['uid'], |
689 | 689 | 'etag' => $event['etag'], |
690 | - 'participants' => array_intersect_key($event['participants'],array_flip($allowed_participants)), |
|
690 | + 'participants' => array_intersect_key($event['participants'], array_flip($allowed_participants)), |
|
691 | 691 | 'public'=> 0, |
692 | - 'category' => $event['category'], // category is visible anyway, eg. by using planner by cat |
|
692 | + 'category' => $event['category'], // category is visible anyway, eg. by using planner by cat |
|
693 | 693 | 'non_blocking' => $event['non_blocking'], |
694 | 694 | 'caldav_name' => $event['caldav_name'], |
695 | 695 | // we need full recurrence information, as they are relevant free/busy information |
696 | - )+($event['recur_type'] ? array( |
|
696 | + ) + ($event['recur_type'] ? array( |
|
697 | 697 | 'recur_type' => $event['recur_type'], |
698 | 698 | 'recur_interval' => $event['recur_interval'], |
699 | 699 | 'recur_data' => $event['recur_data'], |
700 | 700 | 'recur_enddate' => $event['recur_enddate'], |
701 | 701 | 'recur_exception'=> $event['recur_exception'], |
702 | - ):array( |
|
702 | + ) : array( |
|
703 | 703 | 'reference' => $event['reference'], |
704 | 704 | 'recurrence' => $event['recurrence'], |
705 | 705 | )); |
@@ -713,15 +713,15 @@ discard block |
||
713 | 713 | */ |
714 | 714 | function check_move_horizont($_new_horizont) |
715 | 715 | { |
716 | - if ((int) $this->debug >= 2 || $this->debug == 'check_move_horizont') |
|
716 | + if ((int)$this->debug >= 2 || $this->debug == 'check_move_horizont') |
|
717 | 717 | { |
718 | - $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2',true,$_new_horizont,(int)$this->config['horizont']); |
|
718 | + $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2', true, $_new_horizont, (int)$this->config['horizont']); |
|
719 | 719 | } |
720 | - $new_horizont = $this->date2ts($_new_horizont,true); // now we are in server-time, where this function operates |
|
720 | + $new_horizont = $this->date2ts($_new_horizont, true); // now we are in server-time, where this function operates |
|
721 | 721 | |
722 | 722 | if ($new_horizont <= $this->config['horizont']) // no move necessary |
723 | 723 | { |
724 | - if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2 is bigger ==> nothing to do',true,$new_horizont,(int)$this->config['horizont']); |
|
724 | + if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2 is bigger ==> nothing to do', true, $new_horizont, (int)$this->config['horizont']); |
|
725 | 725 | return; |
726 | 726 | } |
727 | 727 | if (!empty($GLOBALS['egw_info']['server']['calendar_horizont'])) |
@@ -729,15 +729,15 @@ discard block |
||
729 | 729 | $maxdays = abs($GLOBALS['egw_info']['server']['calendar_horizont']); |
730 | 730 | } |
731 | 731 | if (empty($maxdays)) $maxdays = 1000; // old default |
732 | - if ($new_horizont > time()+$maxdays*DAY_s) // some user tries to "look" more then the maximum number of days in the future |
|
732 | + if ($new_horizont > time() + $maxdays * DAY_s) // some user tries to "look" more then the maximum number of days in the future |
|
733 | 733 | { |
734 | - if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2 new horizont more then %3 days from now --> ignoring it',true,$new_horizont,(int)$this->config['horizont'],$maxdays); |
|
735 | - $this->warnings['horizont'] = lang('Requested date %1 outside allowed range of %2 days: recurring events obmitted!', egw_time::to($new_horizont,true), $maxdays); |
|
734 | + if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2 new horizont more then %3 days from now --> ignoring it', true, $new_horizont, (int)$this->config['horizont'], $maxdays); |
|
735 | + $this->warnings['horizont'] = lang('Requested date %1 outside allowed range of %2 days: recurring events obmitted!', egw_time::to($new_horizont, true), $maxdays); |
|
736 | 736 | return; |
737 | 737 | } |
738 | - if ($new_horizont < time()+31*DAY_s) |
|
738 | + if ($new_horizont < time() + 31 * DAY_s) |
|
739 | 739 | { |
740 | - $new_horizont = time()+31*DAY_s; |
|
740 | + $new_horizont = time() + 31 * DAY_s; |
|
741 | 741 | } |
742 | 742 | $old_horizont = $this->config['horizont']; |
743 | 743 | $this->config['horizont'] = $new_horizont; |
@@ -745,21 +745,21 @@ discard block |
||
745 | 745 | // create further recurrences for all recurring and not yet (at the old horizont) ended events |
746 | 746 | if (($recuring = $this->so->unfinished_recuring($old_horizont))) |
747 | 747 | { |
748 | - @set_time_limit(0); // disable time-limit, in case it takes longer to calculate the recurrences |
|
749 | - foreach($this->read(array_keys($recuring)) as $cal_id => $event) |
|
748 | + @set_time_limit(0); // disable time-limit, in case it takes longer to calculate the recurrences |
|
749 | + foreach ($this->read(array_keys($recuring)) as $cal_id => $event) |
|
750 | 750 | { |
751 | 751 | if ($this->debug == 'check_move_horizont') |
752 | 752 | { |
753 | - $this->debug_message('calendar_bo::check_move_horizont(%1): calling set_recurrences(%2,%3)',true,$new_horizont,$event,$old_horizont); |
|
753 | + $this->debug_message('calendar_bo::check_move_horizont(%1): calling set_recurrences(%2,%3)', true, $new_horizont, $event, $old_horizont); |
|
754 | 754 | } |
755 | 755 | // insert everything behind max(cal_start), which can be less then $old_horizont because of bugs in the past |
756 | - $this->set_recurrences($event,egw_time::server2user($recuring[$cal_id]+1)); // set_recurences operates in user-time! |
|
756 | + $this->set_recurrences($event, egw_time::server2user($recuring[$cal_id] + 1)); // set_recurences operates in user-time! |
|
757 | 757 | } |
758 | 758 | } |
759 | 759 | // update the horizont |
760 | - config::save_value('horizont',$this->config['horizont'],'calendar'); |
|
760 | + config::save_value('horizont', $this->config['horizont'], 'calendar'); |
|
761 | 761 | |
762 | - if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) new horizont=%2, exiting',true,$new_horizont,(int)$this->config['horizont']); |
|
762 | + if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) new horizont=%2, exiting', true, $new_horizont, (int)$this->config['horizont']); |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | /** |
@@ -770,11 +770,11 @@ discard block |
||
770 | 770 | * @param array $event |
771 | 771 | * @param mixed $start =0 minimum start-time for new recurrences or !$start = since the start of the event |
772 | 772 | */ |
773 | - function set_recurrences($event,$start=0) |
|
773 | + function set_recurrences($event, $start = 0) |
|
774 | 774 | { |
775 | - if ($this->debug && ((int) $this->debug >= 2 || $this->debug == 'set_recurrences' || $this->debug == 'check_move_horizont')) |
|
775 | + if ($this->debug && ((int)$this->debug >= 2 || $this->debug == 'set_recurrences' || $this->debug == 'check_move_horizont')) |
|
776 | 776 | { |
777 | - $this->debug_message('calendar_bo::set_recurrences(%1,%2)',true,$event,$start); |
|
777 | + $this->debug_message('calendar_bo::set_recurrences(%1,%2)', true, $event, $start); |
|
778 | 778 | } |
779 | 779 | // check if the caller gave us enough information and if not read it from the DB |
780 | 780 | if (!isset($event['participants']) || !isset($event['start']) || !isset($event['end'])) |
@@ -793,27 +793,27 @@ discard block |
||
793 | 793 | if (!$start) $start = $event['start']; |
794 | 794 | |
795 | 795 | $events = array(); |
796 | - $this->insert_all_recurrences($event,$start,$this->date2usertime($this->config['horizont']),$events); |
|
796 | + $this->insert_all_recurrences($event, $start, $this->date2usertime($this->config['horizont']), $events); |
|
797 | 797 | |
798 | 798 | $exceptions = array(); |
799 | - foreach((array)$event['recur_exception'] as $exception) |
|
799 | + foreach ((array)$event['recur_exception'] as $exception) |
|
800 | 800 | { |
801 | - $exceptions[] = egw_time::to($exception, true); // true = date |
|
801 | + $exceptions[] = egw_time::to($exception, true); // true = date |
|
802 | 802 | } |
803 | 803 | //error_log(__METHOD__."(".array2string($event).", $start) exceptions=".array2string($exceptions)); |
804 | - foreach($events as $event) |
|
804 | + foreach ($events as $event) |
|
805 | 805 | { |
806 | 806 | $is_exception = in_array(egw_time::to($event['start'], true), $exceptions); |
807 | - $start = $this->date2ts($event['start'],true); |
|
807 | + $start = $this->date2ts($event['start'], true); |
|
808 | 808 | if ($event['whole_day']) |
809 | 809 | { |
810 | 810 | $time = $this->so->startOfDay(new egw_time($event['end'], egw_time::$user_timezone)); |
811 | 811 | $time->setTime(23, 59, 59); |
812 | - $end = $this->date2ts($time,true); |
|
812 | + $end = $this->date2ts($time, true); |
|
813 | 813 | } |
814 | 814 | else |
815 | 815 | { |
816 | - $end = $this->date2ts($event['end'],true); |
|
816 | + $end = $this->date2ts($event['end'], true); |
|
817 | 817 | } |
818 | 818 | //error_log(__METHOD__."() start=".egw_time::to($start).", is_exception=".array2string($is_exception)); |
819 | 819 | $this->so->recurrence($event['id'], $start, $end, $event['participants'], $is_exception); |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | * @param array &$events array of event-arrays (reference) |
830 | 830 | * @param $date_format ='ts' date-formats: 'ts'=timestamp, 'server'=timestamp in server-time, 'array'=array or string with date-format |
831 | 831 | */ |
832 | - function db2data(&$events,$date_format='ts') |
|
832 | + function db2data(&$events, $date_format = 'ts') |
|
833 | 833 | { |
834 | 834 | if (!is_array($events)) echo "<p>calendar_bo::db2data(\$events,$date_format) \$events is no array<br />\n".function_backtrace()."</p>\n"; |
835 | 835 | foreach ($events as &$event) |
@@ -842,65 +842,65 @@ discard block |
||
842 | 842 | // database returns timestamps as string, convert them to integer |
843 | 843 | // to avoid misinterpretation by egw_time as Ymd string |
844 | 844 | // (this will fail on 32bit systems for times > 2038!) |
845 | - $event['start'] = (int)$event['start']; // this is for isWholeDay(), which also calls egw_time |
|
845 | + $event['start'] = (int)$event['start']; // this is for isWholeDay(), which also calls egw_time |
|
846 | 846 | $event['end'] = (int)$event['end']; |
847 | 847 | $event['whole_day'] = self::isWholeDay($event); |
848 | 848 | if ($event['whole_day'] && $date_format != 'server') |
849 | 849 | { |
850 | 850 | // Adjust dates to user TZ |
851 | - $stime =& $this->so->startOfDay(new egw_time((int)$event['start'], egw_time::$server_timezone), $event['tzid']); |
|
851 | + $stime = & $this->so->startOfDay(new egw_time((int)$event['start'], egw_time::$server_timezone), $event['tzid']); |
|
852 | 852 | $event['start'] = egw_time::to($stime, $date_format); |
853 | - $time =& $this->so->startOfDay(new egw_time((int)$event['end'], egw_time::$server_timezone), $event['tzid']); |
|
853 | + $time = & $this->so->startOfDay(new egw_time((int)$event['end'], egw_time::$server_timezone), $event['tzid']); |
|
854 | 854 | $time->setTime(23, 59, 59); |
855 | 855 | $event['end'] = egw_time::to($time, $date_format); |
856 | 856 | if (!empty($event['recurrence'])) |
857 | 857 | { |
858 | - $time =& $this->so->startOfDay(new egw_time((int)$event['recurrence'], egw_time::$server_timezone), $event['tzid']); |
|
858 | + $time = & $this->so->startOfDay(new egw_time((int)$event['recurrence'], egw_time::$server_timezone), $event['tzid']); |
|
859 | 859 | $event['recurrence'] = egw_time::to($time, $date_format); |
860 | 860 | } |
861 | 861 | if (!empty($event['recur_enddate'])) |
862 | 862 | { |
863 | - $time =& $this->so->startOfDay(new egw_time((int)$event['recur_enddate'], egw_time::$server_timezone), $event['tzid']); |
|
863 | + $time = & $this->so->startOfDay(new egw_time((int)$event['recur_enddate'], egw_time::$server_timezone), $event['tzid']); |
|
864 | 864 | $time->setTime(23, 59, 59); |
865 | 865 | $event['recur_enddate'] = egw_time::to($time, $date_format); |
866 | 866 | } |
867 | - $timestamps = array('modified','created'); |
|
867 | + $timestamps = array('modified', 'created'); |
|
868 | 868 | } |
869 | 869 | else |
870 | 870 | { |
871 | - $timestamps = array('start','end','modified','created','recur_enddate','recurrence'); |
|
871 | + $timestamps = array('start', 'end', 'modified', 'created', 'recur_enddate', 'recurrence'); |
|
872 | 872 | } |
873 | 873 | // we convert here from the server-time timestamps to user-time and (optional) to a different date-format! |
874 | 874 | foreach ($timestamps as $ts) |
875 | 875 | { |
876 | 876 | if (!empty($event[$ts])) |
877 | 877 | { |
878 | - $event[$ts] = $this->date2usertime((int)$event[$ts],$date_format); |
|
878 | + $event[$ts] = $this->date2usertime((int)$event[$ts], $date_format); |
|
879 | 879 | } |
880 | 880 | } |
881 | 881 | // same with the recur exceptions |
882 | 882 | if (isset($event['recur_exception']) && is_array($event['recur_exception'])) |
883 | 883 | { |
884 | - foreach($event['recur_exception'] as &$date) |
|
884 | + foreach ($event['recur_exception'] as &$date) |
|
885 | 885 | { |
886 | 886 | if ($event['whole_day'] && $date_format != 'server') |
887 | 887 | { |
888 | 888 | // Adjust dates to user TZ |
889 | - $time =& $this->so->startOfDay(new egw_time((int)$date, egw_time::$server_timezone), $event['tzid']); |
|
889 | + $time = & $this->so->startOfDay(new egw_time((int)$date, egw_time::$server_timezone), $event['tzid']); |
|
890 | 890 | $date = egw_time::to($time, $date_format); |
891 | 891 | } |
892 | 892 | else |
893 | 893 | { |
894 | - $date = $this->date2usertime((int)$date,$date_format); |
|
894 | + $date = $this->date2usertime((int)$date, $date_format); |
|
895 | 895 | } |
896 | 896 | } |
897 | 897 | } |
898 | 898 | // same with the alarms |
899 | 899 | if (isset($event['alarm']) && is_array($event['alarm'])) |
900 | 900 | { |
901 | - foreach($event['alarm'] as &$alarm) |
|
901 | + foreach ($event['alarm'] as &$alarm) |
|
902 | 902 | { |
903 | - $alarm['time'] = $this->date2usertime((int)$alarm['time'],$date_format); |
|
903 | + $alarm['time'] = $this->date2usertime((int)$alarm['time'], $date_format); |
|
904 | 904 | } |
905 | 905 | } |
906 | 906 | } |
@@ -913,11 +913,11 @@ discard block |
||
913 | 913 | * @param string $date_format ='ts' date-formats: 'ts'=timestamp, 'server'=timestamp in server-time, 'array'=array or string with date-format |
914 | 914 | * @return mixed depending of $date_format |
915 | 915 | */ |
916 | - function date2usertime($ts,$date_format='ts') |
|
916 | + function date2usertime($ts, $date_format = 'ts') |
|
917 | 917 | { |
918 | 918 | if (empty($ts) || $date_format == 'server') return $ts; |
919 | 919 | |
920 | - return egw_time::server2user($ts,$date_format); |
|
920 | + return egw_time::server2user($ts, $date_format); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | /** |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | * but call clear_private_infos() with the given users |
932 | 932 | * @return boolean|array event or array of id => event pairs, false if the acl-check went wrong, null if $ids not found |
933 | 933 | */ |
934 | - function read($ids,$date=null,$ignore_acl=False,$date_format='ts',$clear_private_infos_users=null) |
|
934 | + function read($ids, $date = null, $ignore_acl = False, $date_format = 'ts', $clear_private_infos_users = null) |
|
935 | 935 | { |
936 | 936 | if (!$ids) return false; |
937 | 937 | |
@@ -940,21 +940,21 @@ discard block |
||
940 | 940 | $return = null; |
941 | 941 | |
942 | 942 | $check = $clear_private_infos_users ? EGW_ACL_FREEBUSY : EGW_ACL_READ; |
943 | - if ($ignore_acl || is_array($ids) || ($return = $this->check_perms($check,$ids,0,$date_format,$date))) |
|
943 | + if ($ignore_acl || is_array($ids) || ($return = $this->check_perms($check, $ids, 0, $date_format, $date))) |
|
944 | 944 | { |
945 | 945 | if (is_array($ids) || !isset(self::$cached_event['id']) || self::$cached_event['id'] != $ids || |
946 | 946 | self::$cached_event_date_format != $date_format || |
947 | 947 | self::$cached_event['recur_type'] != MCAL_RECUR_NONE && self::$cached_event_date != $date) |
948 | 948 | { |
949 | - $events = $this->so->read($ids,$date ? $this->date2ts($date,true) : 0); |
|
949 | + $events = $this->so->read($ids, $date ? $this->date2ts($date, true) : 0); |
|
950 | 950 | |
951 | 951 | if ($events) |
952 | 952 | { |
953 | - $this->db2data($events,$date_format); |
|
953 | + $this->db2data($events, $date_format); |
|
954 | 954 | |
955 | 955 | if (is_array($ids)) |
956 | 956 | { |
957 | - $return =& $events; |
|
957 | + $return = & $events; |
|
958 | 958 | } |
959 | 959 | else |
960 | 960 | { |
@@ -970,13 +970,13 @@ discard block |
||
970 | 970 | $return = self::$cached_event; |
971 | 971 | } |
972 | 972 | } |
973 | - if ($clear_private_infos_users && !is_array($ids) && !$this->check_perms(EGW_ACL_READ,$return)) |
|
973 | + if ($clear_private_infos_users && !is_array($ids) && !$this->check_perms(EGW_ACL_READ, $return)) |
|
974 | 974 | { |
975 | 975 | $this->clear_private_infos($return, (array)$clear_private_infos_users); |
976 | 976 | } |
977 | 977 | if ($this->debug && ($this->debug > 1 || $this->debug == 'read')) |
978 | 978 | { |
979 | - $this->debug_message('calendar_bo::read(%1,%2,%3,%4,%5)=%6',True,$ids,$date,$ignore_acl,$date_format,$clear_private_infos_users,$return); |
|
979 | + $this->debug_message('calendar_bo::read(%1,%2,%3,%4,%5)=%6', True, $ids, $date, $ignore_acl, $date_format, $clear_private_infos_users, $return); |
|
980 | 980 | } |
981 | 981 | return $return; |
982 | 982 | } |
@@ -994,17 +994,17 @@ discard block |
||
994 | 994 | * @param array $events where the repetions get inserted |
995 | 995 | * @param array $recur_exceptions with date (in Ymd) as key (and True as values), seems not to be used anymore |
996 | 996 | */ |
997 | - function insert_all_recurrences($event,$_start,$end,&$events) |
|
997 | + function insert_all_recurrences($event, $_start, $end, &$events) |
|
998 | 998 | { |
999 | - if ((int) $this->debug >= 3 || $this->debug == 'set_recurrences' || $this->debug == 'check_move_horizont' || $this->debug == 'insert_all_recurrences') |
|
999 | + if ((int)$this->debug >= 3 || $this->debug == 'set_recurrences' || $this->debug == 'check_move_horizont' || $this->debug == 'insert_all_recurrences') |
|
1000 | 1000 | { |
1001 | - $this->debug_message(__METHOD__.'(%1,%2,%3,&$events)',true,$event,$_start,$end); |
|
1001 | + $this->debug_message(__METHOD__.'(%1,%2,%3,&$events)', true, $event, $_start, $end); |
|
1002 | 1002 | } |
1003 | 1003 | $end_in = $end; |
1004 | 1004 | |
1005 | 1005 | $start = $this->date2ts($_start); |
1006 | 1006 | $event_start_ts = $this->date2ts($event['start']); |
1007 | - $event_length = $this->date2ts($event['end']) - $event_start_ts; // we use a constant event-length, NOT a constant end-time! |
|
1007 | + $event_length = $this->date2ts($event['end']) - $event_start_ts; // we use a constant event-length, NOT a constant end-time! |
|
1008 | 1008 | |
1009 | 1009 | // if $end is before recur_enddate, use it instead |
1010 | 1010 | if (!$event['recur_enddate'] || $this->date2ts($event['recur_enddate']) > $this->date2ts($end)) |
@@ -1016,27 +1016,27 @@ discard block |
||
1016 | 1016 | // unset exceptions, as we need to add them as recurrence too, but marked as exception |
1017 | 1017 | unset($event['recur_exception']); |
1018 | 1018 | // loop over all recurrences and insert them, if they are after $start |
1019 | - $rrule = calendar_rrule::event2rrule($event, true); // true = we operate in usertime, like the rest of calendar_bo |
|
1020 | - foreach($rrule as $time) |
|
1019 | + $rrule = calendar_rrule::event2rrule($event, true); // true = we operate in usertime, like the rest of calendar_bo |
|
1020 | + foreach ($rrule as $time) |
|
1021 | 1021 | { |
1022 | - $time->setUser(); // $time is in timezone of event, convert it to usertime used here |
|
1023 | - if (($ts = $this->date2ts($time)) < $start-$event_length) |
|
1022 | + $time->setUser(); // $time is in timezone of event, convert it to usertime used here |
|
1023 | + if (($ts = $this->date2ts($time)) < $start - $event_length) |
|
1024 | 1024 | { |
1025 | 1025 | //echo "<p>".$time." --> ignored as $ts < $start-$event_length</p>\n"; |
1026 | - continue; // to early or original event (returned by interator too) |
|
1026 | + continue; // to early or original event (returned by interator too) |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | $ts_end = $ts + $event_length; |
1030 | 1030 | // adjust ts_end for whole day events in case it does not fit due to |
1031 | 1031 | // spans over summer/wintertime adjusted days |
1032 | - if($event['whole_day'] && ($arr_end = $this->date2array($ts_end)) && |
|
1032 | + if ($event['whole_day'] && ($arr_end = $this->date2array($ts_end)) && |
|
1033 | 1033 | !($arr_end['hour'] == 23 && $arr_end['minute'] == 59 && $arr_end['second'] == 59)) |
1034 | 1034 | { |
1035 | 1035 | $arr_end['hour'] = 23; |
1036 | 1036 | $arr_end['minute'] = 59; |
1037 | 1037 | $arr_end['second'] = 59; |
1038 | 1038 | $ts_end_guess = $this->date2ts($arr_end); |
1039 | - if($ts_end_guess - $ts_end > DAY_s/2) |
|
1039 | + if ($ts_end_guess - $ts_end > DAY_s / 2) |
|
1040 | 1040 | { |
1041 | 1041 | $ts_end = $ts_end_guess - DAY_s; // $ts_end_guess was one day too far in the future |
1042 | 1042 | } |
@@ -1050,11 +1050,11 @@ discard block |
||
1050 | 1050 | $event['end'] = $ts_end; |
1051 | 1051 | $events[] = $event; |
1052 | 1052 | } |
1053 | - if ($this->debug && ((int) $this->debug > 2 || $this->debug == 'set_recurrences' || $this->debug == 'check_move_horizont' || $this->debug == 'insert_all_recurrences')) |
|
1053 | + if ($this->debug && ((int)$this->debug > 2 || $this->debug == 'set_recurrences' || $this->debug == 'check_move_horizont' || $this->debug == 'insert_all_recurrences')) |
|
1054 | 1054 | { |
1055 | 1055 | $event['start'] = $event_start_ts; |
1056 | 1056 | $event['end'] = $event_start_ts + $event_length; |
1057 | - $this->debug_message(__METHOD__.'(%1,start=%2,end=%3,events) events=%5',True,$event,$_start,$end_in,$events); |
|
1057 | + $this->debug_message(__METHOD__.'(%1,start=%2,end=%3,events) events=%5', True, $event, $_start, $end_in, $events); |
|
1058 | 1058 | } |
1059 | 1059 | } |
1060 | 1060 | |
@@ -1065,18 +1065,18 @@ discard block |
||
1065 | 1065 | * @param array $event event to insert, it has start- and end-date of the first recurrence, not of $date_ymd |
1066 | 1066 | * @param int|string $date_ymd of the date of the event |
1067 | 1067 | */ |
1068 | - function add_adjusted_event(&$events,$event,$date_ymd) |
|
1068 | + function add_adjusted_event(&$events, $event, $date_ymd) |
|
1069 | 1069 | { |
1070 | 1070 | $event_in = $event; |
1071 | 1071 | // calculate the new start- and end-time |
1072 | 1072 | $length_s = $this->date2ts($event['end']) - $this->date2ts($event['start']); |
1073 | 1073 | $event_start_arr = $this->date2array($event['start']); |
1074 | 1074 | |
1075 | - $date_arr = $this->date2array((string) $date_ymd); |
|
1075 | + $date_arr = $this->date2array((string)$date_ymd); |
|
1076 | 1076 | $date_arr['hour'] = $event_start_arr['hour']; |
1077 | 1077 | $date_arr['minute'] = $event_start_arr['minute']; |
1078 | 1078 | $date_arr['second'] = $event_start_arr['second']; |
1079 | - unset($date_arr['raw']); // else date2ts would use it |
|
1079 | + unset($date_arr['raw']); // else date2ts would use it |
|
1080 | 1080 | $event['start'] = $this->date2ts($date_arr); |
1081 | 1081 | $event['end'] = $event['start'] + $length_s; |
1082 | 1082 | |
@@ -1084,7 +1084,7 @@ discard block |
||
1084 | 1084 | |
1085 | 1085 | if ($this->debug && ($this->debug > 2 || $this->debug == 'add_adjust_event')) |
1086 | 1086 | { |
1087 | - $this->debug_message('calendar_bo::add_adjust_event(,%1,%2) as %3',True,$event_in,$date_ymd,$event); |
|
1087 | + $this->debug_message('calendar_bo::add_adjust_event(,%1,%2) as %3', True, $event_in, $date_ymd, $event); |
|
1088 | 1088 | } |
1089 | 1089 | } |
1090 | 1090 | |
@@ -1108,22 +1108,22 @@ discard block |
||
1108 | 1108 | { |
1109 | 1109 | $info = array( |
1110 | 1110 | 'res_id' => $uid, |
1111 | - 'email' => $GLOBALS['egw']->accounts->id2name($uid,'account_email'), |
|
1112 | - 'name' => trim($GLOBALS['egw']->accounts->id2name($uid,'account_firstname'). ' ' . |
|
1113 | - $GLOBALS['egw']->accounts->id2name($uid,'account_lastname')), |
|
1111 | + 'email' => $GLOBALS['egw']->accounts->id2name($uid, 'account_email'), |
|
1112 | + 'name' => trim($GLOBALS['egw']->accounts->id2name($uid, 'account_firstname').' '. |
|
1113 | + $GLOBALS['egw']->accounts->id2name($uid, 'account_lastname')), |
|
1114 | 1114 | 'type' => $GLOBALS['egw']->accounts->get_type($uid), |
1115 | 1115 | 'app' => 'accounts', |
1116 | 1116 | ); |
1117 | 1117 | } |
1118 | 1118 | else |
1119 | 1119 | { |
1120 | - list($info) = $this->resources[$uid[0]]['info'] ? ExecMethod($this->resources[$uid[0]]['info'],substr($uid,1)) : false; |
|
1120 | + list($info) = $this->resources[$uid[0]]['info'] ? ExecMethod($this->resources[$uid[0]]['info'], substr($uid, 1)) : false; |
|
1121 | 1121 | if ($info) |
1122 | 1122 | { |
1123 | 1123 | $info['type'] = $uid[0]; |
1124 | 1124 | if (!$info['email'] && $info['responsible']) |
1125 | 1125 | { |
1126 | - $info['email'] = $GLOBALS['egw']->accounts->id2name($info['responsible'],'account_email'); |
|
1126 | + $info['email'] = $GLOBALS['egw']->accounts->id2name($info['responsible'], 'account_email'); |
|
1127 | 1127 | } |
1128 | 1128 | $info['app'] = $this->resources[$uid[0]]['app']; |
1129 | 1129 | } |
@@ -1132,7 +1132,7 @@ discard block |
||
1132 | 1132 | } |
1133 | 1133 | if ($this->debug && ($this->debug > 2 || $this->debug == 'resource_info')) |
1134 | 1134 | { |
1135 | - $this->debug_message('calendar_bo::resource_info(%1) = %2',True,$uid,$res_info_cache[$uid]); |
|
1135 | + $this->debug_message('calendar_bo::resource_info(%1) = %2', True, $uid, $res_info_cache[$uid]); |
|
1136 | 1136 | } |
1137 | 1137 | return $res_info_cache[$uid]; |
1138 | 1138 | } |
@@ -1153,7 +1153,7 @@ discard block |
||
1153 | 1153 | * @param int $user =null for which user to check, default current user |
1154 | 1154 | * @return boolean true permission granted, false for permission denied or null if event not found |
1155 | 1155 | */ |
1156 | - function check_perms($needed,$event=0,$other=0,$date_format='ts',$date_to_read=null,$user=null) |
|
1156 | + function check_perms($needed, $event = 0, $other = 0, $date_format = 'ts', $date_to_read = null, $user = null) |
|
1157 | 1157 | { |
1158 | 1158 | if (!$user) $user = $this->user; |
1159 | 1159 | if ($user == $this->user) |
@@ -1162,13 +1162,13 @@ discard block |
||
1162 | 1162 | } |
1163 | 1163 | else |
1164 | 1164 | { |
1165 | - $grants = $GLOBALS['egw']->acl->get_grants('calendar',true,$user); |
|
1165 | + $grants = $GLOBALS['egw']->acl->get_grants('calendar', true, $user); |
|
1166 | 1166 | } |
1167 | 1167 | |
1168 | 1168 | if ($other && !is_numeric($other)) |
1169 | 1169 | { |
1170 | 1170 | $resource = $this->resource_info($other); |
1171 | - return $needed & $resource['rights']; |
|
1171 | + return $needed&$resource['rights']; |
|
1172 | 1172 | } |
1173 | 1173 | if (is_int($event) && $event == 0) |
1174 | 1174 | { |
@@ -1178,15 +1178,15 @@ discard block |
||
1178 | 1178 | { |
1179 | 1179 | if (!is_array($event)) |
1180 | 1180 | { |
1181 | - $event = $this->read($event,$date_to_read,true,$date_format); // = no ACL check !!! |
|
1181 | + $event = $this->read($event, $date_to_read, true, $date_format); // = no ACL check !!! |
|
1182 | 1182 | } |
1183 | 1183 | if (!is_array($event)) |
1184 | 1184 | { |
1185 | 1185 | if ($this->xmlrpc) |
1186 | 1186 | { |
1187 | - $GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['not_exist'],$GLOBALS['xmlrpcstr']['not_exist']); |
|
1187 | + $GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['not_exist'], $GLOBALS['xmlrpcstr']['not_exist']); |
|
1188 | 1188 | } |
1189 | - return null; // event not found |
|
1189 | + return null; // event not found |
|
1190 | 1190 | } |
1191 | 1191 | $owner = $event['owner']; |
1192 | 1192 | $private = !$event['public']; |
@@ -1194,7 +1194,7 @@ discard block |
||
1194 | 1194 | $grant = $grants[$owner]; |
1195 | 1195 | |
1196 | 1196 | // now any ACL rights (but invite rights!) implicate FREEBUSY rights (at least READ has to include FREEBUSY) |
1197 | - if ($grant & ~EGW_ACL_INVITE) $grant |= EGW_ACL_FREEBUSY; |
|
1197 | + if ($grant&~EGW_ACL_INVITE) $grant |= EGW_ACL_FREEBUSY; |
|
1198 | 1198 | |
1199 | 1199 | if (is_array($event) && ($needed == EGW_ACL_READ || $needed == EGW_ACL_FREEBUSY)) |
1200 | 1200 | { |
@@ -1203,15 +1203,15 @@ discard block |
||
1203 | 1203 | // |
1204 | 1204 | if ($event['participants'] && is_array($event['participants'])) |
1205 | 1205 | { |
1206 | - foreach(array_keys($event['participants']) as $uid) |
|
1206 | + foreach (array_keys($event['participants']) as $uid) |
|
1207 | 1207 | { |
1208 | - if ($uid == $user || $uid < 0 && in_array($user, (array)$GLOBALS['egw']->accounts->members($uid,true))) |
|
1208 | + if ($uid == $user || $uid < 0 && in_array($user, (array)$GLOBALS['egw']->accounts->members($uid, true))) |
|
1209 | 1209 | { |
1210 | 1210 | // if we are a participant, we have an implicite FREEBUSY, READ and PRIVAT grant |
1211 | - $grant |= EGW_ACL_FREEBUSY | EGW_ACL_READ | EGW_ACL_PRIVATE; |
|
1211 | + $grant |= EGW_ACL_FREEBUSY|EGW_ACL_READ|EGW_ACL_PRIVATE; |
|
1212 | 1212 | break; |
1213 | 1213 | } |
1214 | - elseif ($grants[$uid] & EGW_ACL_READ) |
|
1214 | + elseif ($grants[$uid]&EGW_ACL_READ) |
|
1215 | 1215 | { |
1216 | 1216 | // if we have a READ grant from a participant, we dont give an implicit privat grant too |
1217 | 1217 | $grant |= EGW_ACL_READ; |
@@ -1230,12 +1230,12 @@ discard block |
||
1230 | 1230 | } |
1231 | 1231 | if ($GLOBALS['egw']->accounts->get_type($owner) == 'g' && $needed == EGW_ACL_ADD) |
1232 | 1232 | { |
1233 | - $access = False; // a group can't be the owner of an event |
|
1233 | + $access = False; // a group can't be the owner of an event |
|
1234 | 1234 | } |
1235 | 1235 | else |
1236 | 1236 | { |
1237 | - $access = $user == $owner || $grant & $needed |
|
1238 | - && ($needed == EGW_ACL_FREEBUSY || !$private || $grant & EGW_ACL_PRIVATE); |
|
1237 | + $access = $user == $owner || $grant&$needed |
|
1238 | + && ($needed == EGW_ACL_FREEBUSY || !$private || $grant&EGW_ACL_PRIVATE); |
|
1239 | 1239 | } |
1240 | 1240 | // do NOT allow users to purge deleted events, if we dont have 'userpurge' enabled |
1241 | 1241 | if ($access && $needed == EGW_ACL_DELETE && $event['deleted'] && |
@@ -1246,7 +1246,7 @@ discard block |
||
1246 | 1246 | } |
1247 | 1247 | if ($this->debug && ($this->debug > 2 || $this->debug == 'check_perms')) |
1248 | 1248 | { |
1249 | - $this->debug_message('calendar_bo::check_perms(%1,%2,other=%3,%4,%5,user=%6)=%7',True,ACL_TYPE_IDENTIFER.$needed,$event,$other,$date_format,$date_to_read,$user,$access); |
|
1249 | + $this->debug_message('calendar_bo::check_perms(%1,%2,other=%3,%4,%5,user=%6)=%7', True, ACL_TYPE_IDENTIFER.$needed, $event, $other, $date_format, $date_to_read, $user, $access); |
|
1250 | 1250 | } |
1251 | 1251 | //error_log(__METHOD__."($needed,".array2string($event).",$other,...,$user) returning ".array2string($access)); |
1252 | 1252 | return $access; |
@@ -1261,9 +1261,9 @@ discard block |
||
1261 | 1261 | * array with keys 'second', 'minute', 'hour', 'day' or 'mday' (depricated !), 'month' and 'year' |
1262 | 1262 | * @param boolean $user2server =False conversion between user- and server-time; default False == Off |
1263 | 1263 | */ |
1264 | - static function date2ts($date,$user2server=False) |
|
1264 | + static function date2ts($date, $user2server = False) |
|
1265 | 1265 | { |
1266 | - return $user2server ? egw_time::user2server($date,'ts') : egw_time::to($date,'ts'); |
|
1266 | + return $user2server ? egw_time::user2server($date, 'ts') : egw_time::to($date, 'ts'); |
|
1267 | 1267 | } |
1268 | 1268 | |
1269 | 1269 | /** |
@@ -1273,9 +1273,9 @@ discard block |
||
1273 | 1273 | * @param boolean $server2user conversation between user- and server-time default False == Off |
1274 | 1274 | * @return array with keys 'second', 'minute', 'hour', 'day', 'month', 'year', 'raw' (timestamp) and 'full' (Ymd-string) |
1275 | 1275 | */ |
1276 | - static function date2array($date,$server2user=False) |
|
1276 | + static function date2array($date, $server2user = False) |
|
1277 | 1277 | { |
1278 | - return $server2user ? egw_time::server2user($date,'array') : egw_time::to($date,'array'); |
|
1278 | + return $server2user ? egw_time::server2user($date, 'array') : egw_time::to($date, 'array'); |
|
1279 | 1279 | } |
1280 | 1280 | |
1281 | 1281 | /** |
@@ -1286,9 +1286,9 @@ discard block |
||
1286 | 1286 | * @param string $format ='Ymd' format of the date to return, eg. 'Y-m-d\TH:i:sO' (2005-11-01T15:30:00+0100) |
1287 | 1287 | * @return string date formatted according to $format |
1288 | 1288 | */ |
1289 | - static function date2string($date,$server2user=False,$format='Ymd') |
|
1289 | + static function date2string($date, $server2user = False, $format = 'Ymd') |
|
1290 | 1290 | { |
1291 | - return $server2user ? egw_time::server2user($date,$format) : egw_time::to($date,$format); |
|
1291 | + return $server2user ? egw_time::server2user($date, $format) : egw_time::to($date, $format); |
|
1292 | 1292 | } |
1293 | 1293 | |
1294 | 1294 | /** |
@@ -1298,9 +1298,9 @@ discard block |
||
1298 | 1298 | * @param string|boolean $format ='' default common_prefs[dateformat], common_prefs[timeformat], false=time only, true=date only |
1299 | 1299 | * @return string the formated date (incl. time) |
1300 | 1300 | */ |
1301 | - static function format_date($date,$format='') |
|
1301 | + static function format_date($date, $format = '') |
|
1302 | 1302 | { |
1303 | - return egw_time::to($date,$format); |
|
1303 | + return egw_time::to($date, $format); |
|
1304 | 1304 | } |
1305 | 1305 | |
1306 | 1306 | /** |
@@ -1322,7 +1322,7 @@ discard block |
||
1322 | 1322 | * @param mixed $param a variable number of parameters, to be inserted in $msg |
1323 | 1323 | * arrays get serialized with print_r() ! |
1324 | 1324 | */ |
1325 | - static function debug_message($msg,$backtrace=True) |
|
1325 | + static function debug_message($msg, $backtrace = True) |
|
1326 | 1326 | { |
1327 | 1327 | static $acl2string = array( |
1328 | 1328 | 0 => 'ACL-UNKNOWN', |
@@ -1333,22 +1333,22 @@ discard block |
||
1333 | 1333 | EGW_ACL_PRIVATE => 'ACL_PRIVATE', |
1334 | 1334 | EGW_ACL_FREEBUSY => 'ACL_FREEBUSY', |
1335 | 1335 | ); |
1336 | - for($i = 2; $i < func_num_args(); ++$i) |
|
1336 | + for ($i = 2; $i < func_num_args(); ++$i) |
|
1337 | 1337 | { |
1338 | 1338 | $param = func_get_arg($i); |
1339 | 1339 | |
1340 | 1340 | if (is_null($param)) |
1341 | 1341 | { |
1342 | - $param='NULL'; |
|
1342 | + $param = 'NULL'; |
|
1343 | 1343 | } |
1344 | 1344 | else |
1345 | 1345 | { |
1346 | - switch(gettype($param)) |
|
1346 | + switch (gettype($param)) |
|
1347 | 1347 | { |
1348 | 1348 | case 'string': |
1349 | - if (substr($param,0,strlen(ACL_TYPE_IDENTIFER))== ACL_TYPE_IDENTIFER) |
|
1349 | + if (substr($param, 0, strlen(ACL_TYPE_IDENTIFER)) == ACL_TYPE_IDENTIFER) |
|
1350 | 1350 | { |
1351 | - $param = (int) substr($param,strlen(ACL_TYPE_IDENTIFER)); |
|
1351 | + $param = (int)substr($param, strlen(ACL_TYPE_IDENTIFER)); |
|
1352 | 1352 | $param = (isset($acl2string[$param]) ? $acl2string[$param] : $acl2string[0])." ($param)"; |
1353 | 1353 | } |
1354 | 1354 | else |
@@ -1370,11 +1370,11 @@ discard block |
||
1370 | 1370 | $param = $param ? 'True' : 'False'; |
1371 | 1371 | break; |
1372 | 1372 | case 'integer': |
1373 | - if ($param >= mktime(0,0,0,1,1,2000)) $param = adodb_date('Y-m-d H:i:s',$param)." ($param)"; |
|
1373 | + if ($param >= mktime(0, 0, 0, 1, 1, 2000)) $param = adodb_date('Y-m-d H:i:s', $param)." ($param)"; |
|
1374 | 1374 | break; |
1375 | 1375 | } |
1376 | 1376 | } |
1377 | - $msg = str_replace('%'.($i-1),$param,$msg); |
|
1377 | + $msg = str_replace('%'.($i - 1), $param, $msg); |
|
1378 | 1378 | } |
1379 | 1379 | error_log($msg); |
1380 | 1380 | if ($backtrace) error_log(function_backtrace(1)); |
@@ -1389,7 +1389,7 @@ discard block |
||
1389 | 1389 | * @param boolean $display_day =false should a day-name prefix the date, eg. monday June 20, 2006 |
1390 | 1390 | * @return string with formated date |
1391 | 1391 | */ |
1392 | - function long_date($_first,$last=0,$display_time=false,$display_day=false) |
|
1392 | + function long_date($_first, $last = 0, $display_time = false, $display_day = false) |
|
1393 | 1393 | { |
1394 | 1394 | $first = $this->date2array($_first); |
1395 | 1395 | if ($last) |
@@ -1404,27 +1404,27 @@ discard block |
||
1404 | 1404 | |
1405 | 1405 | if ($display_day) |
1406 | 1406 | { |
1407 | - $range = lang(adodb_date('l',$first['raw'])).($this->common_prefs['dateformat'][0] != 'd' ? ' ' : ', '); |
|
1407 | + $range = lang(adodb_date('l', $first['raw'])).($this->common_prefs['dateformat'][0] != 'd' ? ' ' : ', '); |
|
1408 | 1408 | } |
1409 | 1409 | for ($i = 0; $i < 5; $i += 2) |
1410 | 1410 | { |
1411 | - switch($datefmt[$i]) |
|
1411 | + switch ($datefmt[$i]) |
|
1412 | 1412 | { |
1413 | 1413 | case 'd': |
1414 | - $range .= $first['day'] . ($datefmt[1] == '.' ? '.' : ''); |
|
1414 | + $range .= $first['day'].($datefmt[1] == '.' ? '.' : ''); |
|
1415 | 1415 | if ($first['month'] != $last['month'] || $first['year'] != $last['year']) |
1416 | 1416 | { |
1417 | 1417 | if (!$month_before_day) |
1418 | 1418 | { |
1419 | - $range .= ' '.lang(strftime('%B',$first['raw'])); |
|
1419 | + $range .= ' '.lang(strftime('%B', $first['raw'])); |
|
1420 | 1420 | } |
1421 | 1421 | if ($first['year'] != $last['year'] && $datefmt[0] != 'Y') |
1422 | 1422 | { |
1423 | - $range .= ($datefmt[0] != 'd' ? ', ' : ' ') . $first['year']; |
|
1423 | + $range .= ($datefmt[0] != 'd' ? ', ' : ' ').$first['year']; |
|
1424 | 1424 | } |
1425 | 1425 | if ($display_time) |
1426 | 1426 | { |
1427 | - $range .= ' '.adodb_date($timefmt,$first['raw']); |
|
1427 | + $range .= ' '.adodb_date($timefmt, $first['raw']); |
|
1428 | 1428 | } |
1429 | 1429 | if (!$last) |
1430 | 1430 | { |
@@ -1434,43 +1434,43 @@ discard block |
||
1434 | 1434 | |
1435 | 1435 | if ($first['year'] != $last['year'] && $datefmt[0] == 'Y') |
1436 | 1436 | { |
1437 | - $range .= $last['year'] . ', '; |
|
1437 | + $range .= $last['year'].', '; |
|
1438 | 1438 | } |
1439 | 1439 | |
1440 | 1440 | if ($month_before_day) |
1441 | 1441 | { |
1442 | - $range .= lang(strftime('%B',$last['raw'])); |
|
1442 | + $range .= lang(strftime('%B', $last['raw'])); |
|
1443 | 1443 | } |
1444 | 1444 | } |
1445 | 1445 | else |
1446 | 1446 | { |
1447 | 1447 | if ($display_time) |
1448 | 1448 | { |
1449 | - $range .= ' '.adodb_date($timefmt,$first['raw']); |
|
1449 | + $range .= ' '.adodb_date($timefmt, $first['raw']); |
|
1450 | 1450 | } |
1451 | 1451 | $range .= ' - '; |
1452 | 1452 | } |
1453 | - $range .= ' ' . $last['day'] . ($datefmt[1] == '.' ? '.' : ''); |
|
1453 | + $range .= ' '.$last['day'].($datefmt[1] == '.' ? '.' : ''); |
|
1454 | 1454 | break; |
1455 | 1455 | case 'm': |
1456 | 1456 | case 'M': |
1457 | - $range .= ' '.lang(strftime('%B',$month_before_day ? $first['raw'] : $last['raw'])) . ' '; |
|
1457 | + $range .= ' '.lang(strftime('%B', $month_before_day ? $first['raw'] : $last['raw'])).' '; |
|
1458 | 1458 | break; |
1459 | 1459 | case 'Y': |
1460 | 1460 | if ($datefmt[0] != 'm') |
1461 | 1461 | { |
1462 | - $range .= ' ' . ($datefmt[0] == 'Y' ? $first['year'].($datefmt[2] == 'd' ? ', ' : ' ') : $last['year'].' '); |
|
1462 | + $range .= ' '.($datefmt[0] == 'Y' ? $first['year'].($datefmt[2] == 'd' ? ', ' : ' ') : $last['year'].' '); |
|
1463 | 1463 | } |
1464 | 1464 | break; |
1465 | 1465 | } |
1466 | 1466 | } |
1467 | 1467 | if ($display_time && $last) |
1468 | 1468 | { |
1469 | - $range .= ' '.adodb_date($timefmt,$last['raw']); |
|
1469 | + $range .= ' '.adodb_date($timefmt, $last['raw']); |
|
1470 | 1470 | } |
1471 | 1471 | if ($datefmt[4] == 'Y' && $datefmt[0] == 'm') |
1472 | 1472 | { |
1473 | - $range .= ', ' . $last['year']; |
|
1473 | + $range .= ', '.$last['year']; |
|
1474 | 1474 | } |
1475 | 1475 | return $range; |
1476 | 1476 | } |
@@ -1482,25 +1482,25 @@ discard block |
||
1482 | 1482 | * @param int $end_m end time in minutes since 0h |
1483 | 1483 | * @param boolean $both =false display the end-time too, duration is always displayed |
1484 | 1484 | */ |
1485 | - function timespan($start_m,$end_m,$both=false) |
|
1485 | + function timespan($start_m, $end_m, $both = false) |
|
1486 | 1486 | { |
1487 | 1487 | $duration = $end_m - $start_m; |
1488 | - if ($end_m == 24*60-1) ++$duration; |
|
1489 | - $duration = floor($duration/60).lang('h').($duration%60 ? $duration%60 : ''); |
|
1488 | + if ($end_m == 24 * 60 - 1) ++$duration; |
|
1489 | + $duration = floor($duration / 60).lang('h').($duration % 60 ? $duration % 60 : ''); |
|
1490 | 1490 | |
1491 | - $timespan = $t = common::formattime(sprintf('%02d',$start_m/60),sprintf('%02d',$start_m%60)); |
|
1491 | + $timespan = $t = common::formattime(sprintf('%02d', $start_m / 60), sprintf('%02d', $start_m % 60)); |
|
1492 | 1492 | |
1493 | 1493 | if ($both) // end-time too |
1494 | 1494 | { |
1495 | - $timespan .= ' - '.common::formattime(sprintf('%02d',$end_m/60),sprintf('%02d',$end_m%60)); |
|
1495 | + $timespan .= ' - '.common::formattime(sprintf('%02d', $end_m / 60), sprintf('%02d', $end_m % 60)); |
|
1496 | 1496 | // dont double am/pm if they are the same in both times |
1497 | - if ($this->common_prefs['timeformat'] == 12 && substr($timespan,-2) == substr($t,-2)) |
|
1497 | + if ($this->common_prefs['timeformat'] == 12 && substr($timespan, -2) == substr($t, -2)) |
|
1498 | 1498 | { |
1499 | - $timespan = str_replace($t,substr($t,0,-3),$timespan); |
|
1499 | + $timespan = str_replace($t, substr($t, 0, -3), $timespan); |
|
1500 | 1500 | } |
1501 | 1501 | $timespan .= ':'; |
1502 | 1502 | } |
1503 | - return $timespan . ' ' . $duration; |
|
1503 | + return $timespan.' '.$duration; |
|
1504 | 1504 | } |
1505 | 1505 | |
1506 | 1506 | /** |
@@ -1511,13 +1511,13 @@ discard block |
||
1511 | 1511 | * @param boolean $append_email =false append email (Name <email>) |
1512 | 1512 | * @return string with name |
1513 | 1513 | */ |
1514 | - function participant_name($id,$use_type=false, $append_email=false) |
|
1514 | + function participant_name($id, $use_type = false, $append_email = false) |
|
1515 | 1515 | { |
1516 | 1516 | static $id2lid = array(); |
1517 | 1517 | static $id2email = array(); |
1518 | 1518 | |
1519 | 1519 | if ($use_type && $use_type != 'u') $id = $use_type.$id; |
1520 | - if($id === 0 || $id === '0') $id = $this->user; |
|
1520 | + if ($id === 0 || $id === '0') $id = $this->user; |
|
1521 | 1521 | |
1522 | 1522 | if (!isset($id2lid[$id])) |
1523 | 1523 | { |
@@ -1533,7 +1533,7 @@ discard block |
||
1533 | 1533 | else |
1534 | 1534 | { |
1535 | 1535 | $id2lid[$id] = common::grab_owner_name($id); |
1536 | - $id2email[$id] = $GLOBALS['egw']->accounts->id2name($id,'account_email'); |
|
1536 | + $id2email[$id] = $GLOBALS['egw']->accounts->id2name($id, 'account_email'); |
|
1537 | 1537 | } |
1538 | 1538 | } |
1539 | 1539 | return $id2lid[$id].(($append_email || $id[0] == 'e') && $id2email[$id] ? ' <'.$id2email[$id].'>' : ''); |
@@ -1547,37 +1547,37 @@ discard block |
||
1547 | 1547 | * @param boolean $show_group_invitation =false show group-invitations (status == 'G') or not (default) |
1548 | 1548 | * @return array with id / names with status pairs |
1549 | 1549 | */ |
1550 | - function participants($event,$long_status=false,$show_group_invitation=false) |
|
1550 | + function participants($event, $long_status = false, $show_group_invitation = false) |
|
1551 | 1551 | { |
1552 | 1552 | //error_log(__METHOD__.__LINE__.array2string($event['participants'])); |
1553 | 1553 | $names = array(); |
1554 | - foreach((array)$event['participants'] as $id => $status) |
|
1554 | + foreach ((array)$event['participants'] as $id => $status) |
|
1555 | 1555 | { |
1556 | 1556 | if (!is_string($status)) continue; |
1557 | 1557 | $quantity = $role = null; |
1558 | - calendar_so::split_status($status,$quantity,$role); |
|
1558 | + calendar_so::split_status($status, $quantity, $role); |
|
1559 | 1559 | |
1560 | - if ($status == 'G' && !$show_group_invitation) continue; // dont show group-invitation |
|
1560 | + if ($status == 'G' && !$show_group_invitation) continue; // dont show group-invitation |
|
1561 | 1561 | |
1562 | 1562 | $lang_status = lang($this->verbose_status[$status]); |
1563 | 1563 | if (!$long_status) |
1564 | 1564 | { |
1565 | - switch($status[0]) |
|
1565 | + switch ($status[0]) |
|
1566 | 1566 | { |
1567 | 1567 | case 'A': // accepted |
1568 | - $status = html::image('calendar','accepted',$lang_status); |
|
1568 | + $status = html::image('calendar', 'accepted', $lang_status); |
|
1569 | 1569 | break; |
1570 | 1570 | case 'R': // rejected |
1571 | - $status = html::image('calendar','rejected',$lang_status); |
|
1571 | + $status = html::image('calendar', 'rejected', $lang_status); |
|
1572 | 1572 | break; |
1573 | 1573 | case 'T': // tentative |
1574 | - $status = html::image('calendar','tentative',$lang_status); |
|
1574 | + $status = html::image('calendar', 'tentative', $lang_status); |
|
1575 | 1575 | break; |
1576 | 1576 | case 'U': // no response = unknown |
1577 | - $status = html::image('calendar','needs-action',$lang_status); |
|
1577 | + $status = html::image('calendar', 'needs-action', $lang_status); |
|
1578 | 1578 | break; |
1579 | 1579 | case 'D': // delegated |
1580 | - $status = html::image('calendar','forward',$lang_status); |
|
1580 | + $status = html::image('calendar', 'forward', $lang_status); |
|
1581 | 1581 | break; |
1582 | 1582 | case 'G': // group invitation |
1583 | 1583 | // Todo: Image, seems not to be used |
@@ -1599,13 +1599,13 @@ discard block |
||
1599 | 1599 | $role = lang($this->roles[$role]); |
1600 | 1600 | } |
1601 | 1601 | // allow to use cats as roles (beside regular iCal ones) |
1602 | - elseif (substr($role,0,6) == 'X-CAT-' && ($cat_id = (int)substr($role,6)) > 0) |
|
1602 | + elseif (substr($role, 0, 6) == 'X-CAT-' && ($cat_id = (int)substr($role, 6)) > 0) |
|
1603 | 1603 | { |
1604 | 1604 | $role = $GLOBALS['egw']->categories->id2name($cat_id); |
1605 | 1605 | } |
1606 | 1606 | else |
1607 | 1607 | { |
1608 | - $role = lang(str_replace('X-','',$role)); |
|
1608 | + $role = lang(str_replace('X-', '', $role)); |
|
1609 | 1609 | } |
1610 | 1610 | $names[$id] .= ' '.$role; |
1611 | 1611 | } |
@@ -1622,13 +1622,13 @@ discard block |
||
1622 | 1622 | * @param int $color color of the category, if multiple cats, the color of the last one with color is returned |
1623 | 1623 | * @return array with id / names |
1624 | 1624 | */ |
1625 | - function categories($category,&$color) |
|
1625 | + function categories($category, &$color) |
|
1626 | 1626 | { |
1627 | 1627 | static $id2cat = array(); |
1628 | 1628 | $cats = array(); |
1629 | 1629 | $color = 0; |
1630 | 1630 | |
1631 | - foreach(explode(',',$category) as $cat_id) |
|
1631 | + foreach (explode(',', $category) as $cat_id) |
|
1632 | 1632 | { |
1633 | 1633 | if (!$cat_id) continue; |
1634 | 1634 | |
@@ -1643,7 +1643,7 @@ discard block |
||
1643 | 1643 | { |
1644 | 1644 | $color = $cat['data']['color']; |
1645 | 1645 | } |
1646 | - elseif(preg_match('/(#[0-9A-Fa-f]{6})/', $cat['description'], $parts)) |
|
1646 | + elseif (preg_match('/(#[0-9A-Fa-f]{6})/', $cat['description'], $parts)) |
|
1647 | 1647 | { |
1648 | 1648 | $color = $parts[1]; |
1649 | 1649 | } |
@@ -1655,12 +1655,12 @@ discard block |
||
1655 | 1655 | /** |
1656 | 1656 | * This is called only by list_cals(). It was moved here to remove fatal error in php5 beta4 |
1657 | 1657 | */ |
1658 | - private static function _list_cals_add($id,&$users,&$groups) |
|
1658 | + private static function _list_cals_add($id, &$users, &$groups) |
|
1659 | 1659 | { |
1660 | 1660 | $name = common::grab_owner_name($id); |
1661 | 1661 | if (!($egw_name = $GLOBALS['egw']->accounts->id2name($id))) |
1662 | 1662 | { |
1663 | - return; // do not return no longer existing accounts which eg. still mentioned in acl |
|
1663 | + return; // do not return no longer existing accounts which eg. still mentioned in acl |
|
1664 | 1664 | } |
1665 | 1665 | if (($type = $GLOBALS['egw']->accounts->get_type($id)) == 'g') |
1666 | 1666 | { |
@@ -1672,7 +1672,7 @@ discard block |
||
1672 | 1672 | } |
1673 | 1673 | $arr[$id] = array( |
1674 | 1674 | 'grantor' => $id, |
1675 | - 'value' => ($type == 'g' ? 'g_' : '') . $id, |
|
1675 | + 'value' => ($type == 'g' ? 'g_' : '').$id, |
|
1676 | 1676 | 'name' => $name, |
1677 | 1677 | 'sname' => $egw_name |
1678 | 1678 | ); |
@@ -1694,26 +1694,26 @@ discard block |
||
1694 | 1694 | * @param int $user account_id of user to generate list for |
1695 | 1695 | * @param array $grants =null calendar grants from user, or null to query them from acl class |
1696 | 1696 | */ |
1697 | - public static function list_calendars($user, array $grants=null) |
|
1697 | + public static function list_calendars($user, array $grants = null) |
|
1698 | 1698 | { |
1699 | 1699 | if (is_null($grants)) $grants = $GLOBALS['egw']->acl->get_grants('calendar', true, $user); |
1700 | 1700 | |
1701 | 1701 | $users = $groups = array(); |
1702 | - foreach(array_keys($grants) as $id) |
|
1702 | + foreach (array_keys($grants) as $id) |
|
1703 | 1703 | { |
1704 | - self::_list_cals_add($id,$users,$groups); |
|
1704 | + self::_list_cals_add($id, $users, $groups); |
|
1705 | 1705 | } |
1706 | 1706 | if (($memberships = $GLOBALS['egw']->accounts->membership($user))) |
1707 | 1707 | { |
1708 | - foreach($memberships as $group_info) |
|
1708 | + foreach ($memberships as $group_info) |
|
1709 | 1709 | { |
1710 | - self::_list_cals_add($group_info['account_id'],$users,$groups); |
|
1710 | + self::_list_cals_add($group_info['account_id'], $users, $groups); |
|
1711 | 1711 | |
1712 | - if (($account_perms = $GLOBALS['egw']->acl->get_ids_for_location($group_info['account_id'],EGW_ACL_READ,'calendar'))) |
|
1712 | + if (($account_perms = $GLOBALS['egw']->acl->get_ids_for_location($group_info['account_id'], EGW_ACL_READ, 'calendar'))) |
|
1713 | 1713 | { |
1714 | - foreach($account_perms as $id) |
|
1714 | + foreach ($account_perms as $id) |
|
1715 | 1715 | { |
1716 | - self::_list_cals_add($id,$users,$groups); |
|
1716 | + self::_list_cals_add($id, $users, $groups); |
|
1717 | 1717 | } |
1718 | 1718 | } |
1719 | 1719 | } |
@@ -1721,7 +1721,7 @@ discard block |
||
1721 | 1721 | usort($users, array(__CLASS__, 'name_cmp')); |
1722 | 1722 | usort($groups, array(__CLASS__, 'name_cmp')); |
1723 | 1723 | |
1724 | - return array_merge($users, $groups); // users first and then groups, both alphabeticaly |
|
1724 | + return array_merge($users, $groups); // users first and then groups, both alphabeticaly |
|
1725 | 1725 | } |
1726 | 1726 | |
1727 | 1727 | /** |
@@ -1764,13 +1764,13 @@ discard block |
||
1764 | 1764 | * dow: day of week, 0=sunday, .., 6= saturday |
1765 | 1765 | * observande_rule: boolean |
1766 | 1766 | */ |
1767 | - function read_holidays($year=0) |
|
1767 | + function read_holidays($year = 0) |
|
1768 | 1768 | { |
1769 | - if (!$year) $year = (int) date('Y',$this->now_su); |
|
1769 | + if (!$year) $year = (int)date('Y', $this->now_su); |
|
1770 | 1770 | |
1771 | 1771 | if (!$this->cached_holidays) // try reading the holidays from the session |
1772 | 1772 | { |
1773 | - $this->cached_holidays = $GLOBALS['egw']->session->appsession('holidays','calendar'); |
|
1773 | + $this->cached_holidays = $GLOBALS['egw']->session->appsession('holidays', 'calendar'); |
|
1774 | 1774 | } |
1775 | 1775 | if (!isset($this->cached_holidays[$year])) |
1776 | 1776 | { |
@@ -1789,46 +1789,46 @@ discard block |
||
1789 | 1789 | 'n_family' => "!''", |
1790 | 1790 | 'bday' => "!''", |
1791 | 1791 | ); |
1792 | - $bdays =& $contacts->search('',array('id','n_family','n_given','n_prefix','n_middle','bday'), |
|
1793 | - 'contact_bday ASC',$extra_cols='',$wildcard='',$empty=False,$op='AND',$start=false,$filter); |
|
1792 | + $bdays = & $contacts->search('', array('id', 'n_family', 'n_given', 'n_prefix', 'n_middle', 'bday'), |
|
1793 | + 'contact_bday ASC', $extra_cols = '', $wildcard = '', $empty = False, $op = 'AND', $start = false, $filter); |
|
1794 | 1794 | // search accounts too, if not stored in contacts repository |
1795 | 1795 | $extra_accounts_search = $contacts->account_repository == 'ldap' && !is_null($contacts->so_accounts) && |
1796 | 1796 | !$GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts']; |
1797 | - if ($extra_accounts_search && ($bdays2 =& $contacts->search('',array('id','n_family','n_given','n_prefix','n_middle','bday'), |
|
1798 | - 'contact_bday ASC',$extra_cols='',$wildcard='',$empty=False,$op='AND',$start=false,$filter+array('owner' => 0)))) |
|
1797 | + if ($extra_accounts_search && ($bdays2 = & $contacts->search('', array('id', 'n_family', 'n_given', 'n_prefix', 'n_middle', 'bday'), |
|
1798 | + 'contact_bday ASC', $extra_cols = '', $wildcard = '', $empty = False, $op = 'AND', $start = false, $filter + array('owner' => 0)))) |
|
1799 | 1799 | { |
1800 | - $bdays = !$bdays ? $bdays2 : array_merge($bdays,$bdays2); |
|
1800 | + $bdays = !$bdays ? $bdays2 : array_merge($bdays, $bdays2); |
|
1801 | 1801 | } |
1802 | 1802 | if ($bdays) |
1803 | 1803 | { |
1804 | 1804 | // sort by month and day only |
1805 | - usort($bdays,create_function('$a,$b','return (int) $a[\'bday\'] == (int) $b[\'bday\'] ? strcmp($a[\'bday\'],$b[\'bday\']) : (int) $a[\'bday\'] - (int) $b[\'bday\'];')); |
|
1806 | - foreach($bdays as $pers) |
|
1805 | + usort($bdays, create_function('$a,$b', 'return (int) $a[\'bday\'] == (int) $b[\'bday\'] ? strcmp($a[\'bday\'],$b[\'bday\']) : (int) $a[\'bday\'] - (int) $b[\'bday\'];')); |
|
1806 | + foreach ($bdays as $pers) |
|
1807 | 1807 | { |
1808 | - if (empty($pers['bday']) || $pers['bday']=='0000-00-00 0' || $pers['bday']=='0000-00-00' || $pers['bday']=='0.0.00') |
|
1808 | + if (empty($pers['bday']) || $pers['bday'] == '0000-00-00 0' || $pers['bday'] == '0000-00-00' || $pers['bday'] == '0.0.00') |
|
1809 | 1809 | { |
1810 | 1810 | //error_log(__METHOD__.__LINE__.' Skipping entry for invalid birthday:'.array2string($pers)); |
1811 | 1811 | continue; |
1812 | 1812 | } |
1813 | - list($y,$m,$d) = explode('-',$pers['bday']); |
|
1814 | - if ($y > $year) continue; // not yet born |
|
1815 | - $this->cached_holidays[$year][sprintf('%04d%02d%02d',$year,$m,$d)][] = array( |
|
1813 | + list($y, $m, $d) = explode('-', $pers['bday']); |
|
1814 | + if ($y > $year) continue; // not yet born |
|
1815 | + $this->cached_holidays[$year][sprintf('%04d%02d%02d', $year, $m, $d)][] = array( |
|
1816 | 1816 | 'day' => $d, |
1817 | 1817 | 'month' => $m, |
1818 | 1818 | 'occurence' => 0, |
1819 | 1819 | 'name' => lang('Birthday').' '.($pers['n_given'] ? $pers['n_given'] : $pers['n_prefix']).' '.$pers['n_middle'].' '. |
1820 | 1820 | $pers['n_family'].($y && !$GLOBALS['egw_info']['server']['hide_birthdays'] ? ' ('.$y.')' : ''), |
1821 | - 'birthyear' => $y, // this can be used to identify birthdays from holidays |
|
1821 | + 'birthyear' => $y, // this can be used to identify birthdays from holidays |
|
1822 | 1822 | ); |
1823 | 1823 | } |
1824 | 1824 | } |
1825 | 1825 | } |
1826 | 1826 | // store holidays and birthdays in the session |
1827 | - $this->cached_holidays = $GLOBALS['egw']->session->appsession('holidays','calendar',$this->cached_holidays); |
|
1827 | + $this->cached_holidays = $GLOBALS['egw']->session->appsession('holidays', 'calendar', $this->cached_holidays); |
|
1828 | 1828 | } |
1829 | - if ((int) $this->debug >= 2 || $this->debug == 'read_holidays') |
|
1829 | + if ((int)$this->debug >= 2 || $this->debug == 'read_holidays') |
|
1830 | 1830 | { |
1831 | - $this->debug_message('calendar_bo::read_holidays(%1)=%2',true,$year,$this->cached_holidays[$year]); |
|
1831 | + $this->debug_message('calendar_bo::read_holidays(%1)=%2', true, $year, $this->cached_holidays[$year]); |
|
1832 | 1832 | } |
1833 | 1833 | return $this->cached_holidays[$year]; |
1834 | 1834 | } |
@@ -1839,10 +1839,10 @@ discard block |
||
1839 | 1839 | * @param type $event |
1840 | 1840 | * @return array array of selected calendar fields |
1841 | 1841 | */ |
1842 | - function get_link_options ($event = array()) |
|
1842 | + function get_link_options($event = array()) |
|
1843 | 1843 | { |
1844 | - unset($event); // not used, but required by function signature |
|
1845 | - $options = array ( |
|
1844 | + unset($event); // not used, but required by function signature |
|
1845 | + $options = array( |
|
1846 | 1846 | 'end' => lang('End date'), |
1847 | 1847 | 'id' => lang('ID'), |
1848 | 1848 | 'owner' => lang('Event owner'), |
@@ -1869,7 +1869,7 @@ discard block |
||
1869 | 1869 | list($id, $recur) = explode('-', $event, 2); |
1870 | 1870 | $event = $this->read($id, $recur); |
1871 | 1871 | } |
1872 | - else if (!is_array($event) && (int) $event > 0) |
|
1872 | + else if (!is_array($event) && (int)$event > 0) |
|
1873 | 1873 | { |
1874 | 1874 | $event = $this->read($event); |
1875 | 1875 | } |
@@ -1877,7 +1877,7 @@ discard block |
||
1877 | 1877 | { |
1878 | 1878 | return $event; |
1879 | 1879 | } |
1880 | - $type = explode(',',$this->cal_prefs['link_title']); |
|
1880 | + $type = explode(',', $this->cal_prefs['link_title']); |
|
1881 | 1881 | if (is_array($type)) |
1882 | 1882 | { |
1883 | 1883 | foreach ($type as &$val) |
@@ -1903,10 +1903,10 @@ discard block |
||
1903 | 1903 | $extra_fields [] = $event[$val]; |
1904 | 1904 | } |
1905 | 1905 | } |
1906 | - $str_fields = implode(', ',$extra_fields); |
|
1907 | - if (is_array($extra_fields)) return $this->format_date($event['start']) . ': ' . $event['title'] . ($str_fields? ', ' . $str_fields:''); |
|
1906 | + $str_fields = implode(', ', $extra_fields); |
|
1907 | + if (is_array($extra_fields)) return $this->format_date($event['start']).': '.$event['title'].($str_fields ? ', '.$str_fields : ''); |
|
1908 | 1908 | } |
1909 | - return $this->format_date($event['start']) . ': ' . $event['title']; |
|
1909 | + return $this->format_date($event['start']).': '.$event['title']; |
|
1910 | 1910 | } |
1911 | 1911 | |
1912 | 1912 | /** |
@@ -1925,10 +1925,10 @@ discard block |
||
1925 | 1925 | 'offset' => $options['start'], |
1926 | 1926 | 'order' => 'cal_start DESC', |
1927 | 1927 | ); |
1928 | - if($options['num_rows']) { |
|
1928 | + if ($options['num_rows']) { |
|
1929 | 1929 | $query['num_rows'] = $options['num_rows']; |
1930 | 1930 | } |
1931 | - foreach((array) $this->search($query) as $event) |
|
1931 | + foreach ((array)$this->search($query) as $event) |
|
1932 | 1932 | { |
1933 | 1933 | $result[$event['id']] = $this->link_title($event); |
1934 | 1934 | } |
@@ -1945,11 +1945,11 @@ discard block |
||
1945 | 1945 | * @param int $user =null for which user to check, default current user |
1946 | 1946 | * @return boolean true if access is granted or false otherwise |
1947 | 1947 | */ |
1948 | - function file_access($id,$check,$rel_path,$user=null) |
|
1948 | + function file_access($id, $check, $rel_path, $user = null) |
|
1949 | 1949 | { |
1950 | - unset($rel_path); // not used, but required by function signature |
|
1950 | + unset($rel_path); // not used, but required by function signature |
|
1951 | 1951 | |
1952 | - return $this->check_perms($check,$id,0,'ts',null,$user); |
|
1952 | + return $this->check_perms($check, $id, 0, 'ts', null, $user); |
|
1953 | 1953 | } |
1954 | 1954 | |
1955 | 1955 | /** |
@@ -1959,47 +1959,47 @@ discard block |
||
1959 | 1959 | */ |
1960 | 1960 | function check_set_default_prefs() |
1961 | 1961 | { |
1962 | - if ($this->cal_prefs['interval'] && ($set = $GLOBALS['egw']->session->appsession('default_prefs_set','calendar'))) |
|
1962 | + if ($this->cal_prefs['interval'] && ($set = $GLOBALS['egw']->session->appsession('default_prefs_set', 'calendar'))) |
|
1963 | 1963 | { |
1964 | 1964 | return; |
1965 | 1965 | } |
1966 | - $GLOBALS['egw']->session->appsession('default_prefs_set','calendar','set'); |
|
1966 | + $GLOBALS['egw']->session->appsession('default_prefs_set', 'calendar', 'set'); |
|
1967 | 1967 | |
1968 | - $default_prefs =& $GLOBALS['egw']->preferences->default['calendar']; |
|
1969 | - $forced_prefs =& $GLOBALS['egw']->preferences->forced['calendar']; |
|
1968 | + $default_prefs = & $GLOBALS['egw']->preferences->default['calendar']; |
|
1969 | + $forced_prefs = & $GLOBALS['egw']->preferences->forced['calendar']; |
|
1970 | 1970 | |
1971 | 1971 | if (!($planner_start_with_group = $GLOBALS['egw']->accounts->name2id('Default'))) |
1972 | 1972 | { |
1973 | 1973 | $planner_start_with_group = '0'; |
1974 | 1974 | } |
1975 | - $subject = lang('Calendar Event') . ' - $$action$$: $$startdate$$ $$title$$'."\n"; |
|
1975 | + $subject = lang('Calendar Event').' - $$action$$: $$startdate$$ $$title$$'."\n"; |
|
1976 | 1976 | $values = array( |
1977 | - 'notifyAdded' => $subject . lang ('You have a meeting scheduled for %1','$$startdate$$'), |
|
1978 | - 'notifyCanceled' => $subject . lang ('Your meeting scheduled for %1 has been canceled','$$startdate$$'), |
|
1979 | - 'notifyModified' => $subject . lang ('Your meeting that had been scheduled for %1 has been rescheduled to %2','$$olddate$$','$$startdate$$'), |
|
1980 | - 'notifyDisinvited'=> $subject . lang ('You have been disinvited from the meeting at %1','$$startdate$$'), |
|
1981 | - 'notifyResponse' => $subject . lang ('On %1 %2 %3 your meeting request for %4','$$date$$','$$fullname$$','$$action$$','$$startdate$$'), |
|
1982 | - 'notifyAlarm' => lang('Alarm for %1 at %2 in %3','$$title$$','$$startdate$$','$$location$$')."\n".lang ('Here is your requested alarm.'), |
|
1977 | + 'notifyAdded' => $subject.lang('You have a meeting scheduled for %1', '$$startdate$$'), |
|
1978 | + 'notifyCanceled' => $subject.lang('Your meeting scheduled for %1 has been canceled', '$$startdate$$'), |
|
1979 | + 'notifyModified' => $subject.lang('Your meeting that had been scheduled for %1 has been rescheduled to %2', '$$olddate$$', '$$startdate$$'), |
|
1980 | + 'notifyDisinvited'=> $subject.lang('You have been disinvited from the meeting at %1', '$$startdate$$'), |
|
1981 | + 'notifyResponse' => $subject.lang('On %1 %2 %3 your meeting request for %4', '$$date$$', '$$fullname$$', '$$action$$', '$$startdate$$'), |
|
1982 | + 'notifyAlarm' => lang('Alarm for %1 at %2 in %3', '$$title$$', '$$startdate$$', '$$location$$')."\n".lang('Here is your requested alarm.'), |
|
1983 | 1983 | 'planner_start_with_group' => $planner_start_with_group, |
1984 | 1984 | 'interval' => 30, |
1985 | 1985 | ); |
1986 | - foreach($values as $var => $default) |
|
1986 | + foreach ($values as $var => $default) |
|
1987 | 1987 | { |
1988 | - $type = substr($var,0,6) == 'notify' ? 'forced' : 'default'; |
|
1988 | + $type = substr($var, 0, 6) == 'notify' ? 'forced' : 'default'; |
|
1989 | 1989 | |
1990 | 1990 | // only set, if neither default nor forced pref exists |
1991 | 1991 | if ((!isset($default_prefs[$var]) || (string)$default_prefs[$var] === '') && (!isset($forced_prefs[$var]) || (string)$forced_prefs[$var] === '')) |
1992 | 1992 | { |
1993 | - $GLOBALS['egw']->preferences->add('calendar',$var,$default,'default'); // always store default, even if we have a forced too |
|
1994 | - if ($type == 'forced') $GLOBALS['egw']->preferences->add('calendar',$var,$default,'forced'); |
|
1993 | + $GLOBALS['egw']->preferences->add('calendar', $var, $default, 'default'); // always store default, even if we have a forced too |
|
1994 | + if ($type == 'forced') $GLOBALS['egw']->preferences->add('calendar', $var, $default, 'forced'); |
|
1995 | 1995 | $this->cal_prefs[$var] = $default; |
1996 | 1996 | $need_save = True; |
1997 | 1997 | } |
1998 | 1998 | } |
1999 | 1999 | if ($need_save) |
2000 | 2000 | { |
2001 | - $GLOBALS['egw']->preferences->save_repository(False,'default'); |
|
2002 | - $GLOBALS['egw']->preferences->save_repository(False,'forced'); |
|
2001 | + $GLOBALS['egw']->preferences->save_repository(False, 'default'); |
|
2002 | + $GLOBALS['egw']->preferences->save_repository(False, 'forced'); |
|
2003 | 2003 | } |
2004 | 2004 | } |
2005 | 2005 | |
@@ -2009,7 +2009,7 @@ discard block |
||
2009 | 2009 | * @param int|string $user account_id or account_lid |
2010 | 2010 | * @param string $pw =null password |
2011 | 2011 | */ |
2012 | - static function freebusy_url($user='',$pw=null) |
|
2012 | + static function freebusy_url($user = '', $pw = null) |
|
2013 | 2013 | { |
2014 | 2014 | if (is_numeric($user)) $user = $GLOBALS['egw']->accounts->id2name($user); |
2015 | 2015 | |
@@ -2022,8 +2022,8 @@ discard block |
||
2022 | 2022 | elseif ($GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy'] == 2) |
2023 | 2023 | { |
2024 | 2024 | $credentials = $GLOBALS['egw_info']['user']['account_lid'] |
2025 | - . ':' . $GLOBALS['egw_info']['user']['passwd']; |
|
2026 | - $credentials = '&cred=' . base64_encode($credentials); |
|
2025 | + . ':'.$GLOBALS['egw_info']['user']['passwd']; |
|
2026 | + $credentials = '&cred='.base64_encode($credentials); |
|
2027 | 2027 | } |
2028 | 2028 | return (!$GLOBALS['egw_info']['server']['webserver_url'] || $GLOBALS['egw_info']['server']['webserver_url'][0] == '/' ? |
2029 | 2029 | ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['HTTP_HOST'] : ''). |
@@ -2055,11 +2055,11 @@ discard block |
||
2055 | 2055 | * @param string &$schedule_tag=null on return schedule-tag (egw_cal.cal_id:egw_cal.cal_etag, no participant modifications!) |
2056 | 2056 | * @return string|boolean string with etag or false |
2057 | 2057 | */ |
2058 | - function get_etag($entry, &$schedule_tag=null) |
|
2058 | + function get_etag($entry, &$schedule_tag = null) |
|
2059 | 2059 | { |
2060 | 2060 | if (!is_array($entry)) |
2061 | 2061 | { |
2062 | - list($id,$recur_date) = explode(':',$entry); |
|
2062 | + list($id, $recur_date) = explode(':', $entry); |
|
2063 | 2063 | $entry = $this->read($id, $recur_date, true, 'server'); |
2064 | 2064 | } |
2065 | 2065 | $etag = $schedule_tag = $entry['id'].':'.$entry['etag']; |
@@ -2077,15 +2077,15 @@ discard block |
||
2077 | 2077 | * @param boolean $master_only =false only check recurance master (egw_cal_user.recur_date=0) |
2078 | 2078 | * @return integer |
2079 | 2079 | */ |
2080 | - public function get_ctag($user, $filter='owner', $master_only=false) |
|
2080 | + public function get_ctag($user, $filter = 'owner', $master_only = false) |
|
2081 | 2081 | { |
2082 | 2082 | if ($this->debug > 1) $startime = microtime(true); |
2083 | 2083 | |
2084 | 2084 | // resolve users to add memberships for users and members for groups |
2085 | 2085 | $users = $this->resolve_users($user); |
2086 | - $ctag = $users ? $this->so->get_ctag($users, $filter == 'owner', $master_only) : 0; // no rights, return 0 as ctag (otherwise we get SQL error!) |
|
2086 | + $ctag = $users ? $this->so->get_ctag($users, $filter == 'owner', $master_only) : 0; // no rights, return 0 as ctag (otherwise we get SQL error!) |
|
2087 | 2087 | |
2088 | - if ($this->debug > 1) error_log(__METHOD__. "($user, '$filter') = $ctag = ".date('Y-m-d H:i:s',$ctag)." took ".(microtime(true)-$startime)." secs"); |
|
2088 | + if ($this->debug > 1) error_log(__METHOD__."($user, '$filter') = $ctag = ".date('Y-m-d H:i:s', $ctag)." took ".(microtime(true) - $startime)." secs"); |
|
2089 | 2089 | return $ctag; |
2090 | 2090 | } |
2091 | 2091 | |
@@ -2105,7 +2105,7 @@ discard block |
||
2105 | 2105 | |
2106 | 2106 | $content = array( |
2107 | 2107 | 'info_cat' => $GLOBALS['egw']->categories->check_list(EGW_ACL_READ, $calendar['category']), |
2108 | - 'info_priority' => $calendar['priority'] , |
|
2108 | + 'info_priority' => $calendar['priority'], |
|
2109 | 2109 | 'info_public' => $calendar['public'] != 'private', |
2110 | 2110 | 'info_subject' => $calendar['title'], |
2111 | 2111 | 'info_des' => $calendar['description'], |
@@ -2120,7 +2120,7 @@ discard block |
||
2120 | 2120 | $content['link_app'][] = $calendar['info_link']['app']; |
2121 | 2121 | $content['link_id'][] = $calendar['info_link']['id']; |
2122 | 2122 | // Copy claendar's links |
2123 | - foreach(egw_link::get_links('calendar',$calendar['id'],'','link_lastmod DESC',true) as $link) |
|
2123 | + foreach (egw_link::get_links('calendar', $calendar['id'], '', 'link_lastmod DESC', true) as $link) |
|
2124 | 2124 | { |
2125 | 2125 | if ($link['app'] != egw_link::VFS_APPNAME) |
2126 | 2126 | { |
@@ -2133,7 +2133,7 @@ discard block |
||
2133 | 2133 | } |
2134 | 2134 | } |
2135 | 2135 | // Copy same custom fields |
2136 | - foreach(array_keys(config::get_customfields('infolog')) as $name) |
|
2136 | + foreach (array_keys(config::get_customfields('infolog')) as $name) |
|
2137 | 2137 | { |
2138 | 2138 | if ($this->customfields[$name]) $content['#'.$name] = $calendar['#'.$name]; |
2139 | 2139 | } |
@@ -2151,20 +2151,20 @@ discard block |
||
2151 | 2151 | function timesheet_set($data) |
2152 | 2152 | { |
2153 | 2153 | $set = array(); |
2154 | - list($id,$recurrence) = explode(':',$data['id']); |
|
2155 | - if ((int)$id && ($event = $this->read($id,$recurrence))) |
|
2154 | + list($id, $recurrence) = explode(':', $data['id']); |
|
2155 | + if ((int)$id && ($event = $this->read($id, $recurrence))) |
|
2156 | 2156 | { |
2157 | 2157 | $set['ts_start'] = $event['start']; |
2158 | 2158 | $set['ts_title'] = $this->link_title($event); |
2159 | - $set['start_time'] = egw_time::to($event['start'],'H:i'); |
|
2159 | + $set['start_time'] = egw_time::to($event['start'], 'H:i'); |
|
2160 | 2160 | $set['ts_description'] = $event['description']; |
2161 | - if ($this->isWholeDay($event)) $event['end']++; // whole day events are 1sec short |
|
2161 | + if ($this->isWholeDay($event)) $event['end']++; // whole day events are 1sec short |
|
2162 | 2162 | $set['ts_duration'] = ($event['end'] - $event['start']) / 60; |
2163 | 2163 | $set['ts_quantity'] = ($event['end'] - $event['start']) / 3600; |
2164 | - $set['end_time'] = null; // unset end-time |
|
2164 | + $set['end_time'] = null; // unset end-time |
|
2165 | 2165 | $set['cat_id'] = (int)$event['category']; |
2166 | 2166 | |
2167 | - foreach(egw_link::get_links('calendar',$id,'','link_lastmod DESC',true) as $link) |
|
2167 | + foreach (egw_link::get_links('calendar', $id, '', 'link_lastmod DESC', true) as $link) |
|
2168 | 2168 | { |
2169 | 2169 | if ($link['app'] != 'timesheet' && $link['app'] != egw_link::VFS_APPNAME) |
2170 | 2170 | { |
@@ -11,10 +11,13 @@ discard block |
||
11 | 11 | * @version $Id$ |
12 | 12 | */ |
13 | 13 | |
14 | -if (!defined('ACL_TYPE_IDENTIFER')) // used to mark ACL-values for the debug_message methode |
|
14 | +if (!defined('ACL_TYPE_IDENTIFER')) |
|
15 | +{ |
|
16 | + // used to mark ACL-values for the debug_message methode |
|
15 | 17 | { |
16 | 18 | define('ACL_TYPE_IDENTIFER','***ACL***'); |
17 | 19 | } |
20 | +} |
|
18 | 21 | |
19 | 22 | define('HOUR_s',60*60); |
20 | 23 | define('DAY_s',24*HOUR_s); |
@@ -225,7 +228,10 @@ discard block |
||
225 | 228 | */ |
226 | 229 | function __construct() |
227 | 230 | { |
228 | - if ($this->debug > 0) $this->debug_message('calendar_bo::bocal() started',True); |
|
231 | + if ($this->debug > 0) |
|
232 | + { |
|
233 | + $this->debug_message('calendar_bo::bocal() started',True); |
|
234 | + } |
|
229 | 235 | |
230 | 236 | $this->so = new calendar_so(); |
231 | 237 | $this->datetime = $GLOBALS['egw']->datetime; |
@@ -308,7 +314,10 @@ discard block |
||
308 | 314 | */ |
309 | 315 | static function email_info($ids) |
310 | 316 | { |
311 | - if (!$ids) return null; |
|
317 | + if (!$ids) |
|
318 | + { |
|
319 | + return null; |
|
320 | + } |
|
312 | 321 | |
313 | 322 | $data = array(); |
314 | 323 | foreach((array)$ids as $id) |
@@ -382,22 +391,31 @@ discard block |
||
382 | 391 | $user = trim($user); |
383 | 392 | if ($ignore_acl || $this->check_perms(EGW_ACL_READ|EGW_ACL_READ_FOR_PARTICIPANTS|($use_freebusy?EGW_ACL_FREEBUSY:0),0,$user)) |
384 | 393 | { |
385 | - if ($user && !in_array($user,$users)) // already added? |
|
394 | + if ($user && !in_array($user,$users)) |
|
395 | + { |
|
396 | + // already added? |
|
386 | 397 | { |
387 | 398 | $users[] = $user; |
388 | 399 | } |
400 | + } |
|
389 | 401 | } |
390 | 402 | elseif ($GLOBALS['egw']->accounts->get_type($user) != 'g') |
391 | 403 | { |
392 | 404 | continue; // for non-groups (eg. users), we stop here if we have no read-rights |
393 | 405 | } |
394 | 406 | // the further code is only for real users |
395 | - if (!is_numeric($user)) continue; |
|
407 | + if (!is_numeric($user)) |
|
408 | + { |
|
409 | + continue; |
|
410 | + } |
|
396 | 411 | |
397 | 412 | // for groups we have to include the members |
398 | 413 | if ($GLOBALS['egw']->accounts->get_type($user) == 'g') |
399 | 414 | { |
400 | - if ($no_enum_groups) continue; |
|
415 | + if ($no_enum_groups) |
|
416 | + { |
|
417 | + continue; |
|
418 | + } |
|
401 | 419 | |
402 | 420 | $members = $GLOBALS['egw']->accounts->member($user); |
403 | 421 | if (is_array($members)) |
@@ -477,11 +495,14 @@ discard block |
||
477 | 495 | } |
478 | 496 | |
479 | 497 | if (!isset($params['users']) || !$params['users'] || |
480 | - count($params['users']) == 1 && isset($params['users'][0]) && !$params['users'][0]) // null or '' casted to an array |
|
498 | + count($params['users']) == 1 && isset($params['users'][0]) && !$params['users'][0]) |
|
499 | + { |
|
500 | + // null or '' casted to an array |
|
481 | 501 | { |
482 | 502 | // for a search use all account you have read grants from |
483 | 503 | $params['users'] = $params['query'] ? array_keys($this->grants) : $this->user; |
484 | 504 | } |
505 | + } |
|
485 | 506 | // resolve users to add memberships for users and members for groups |
486 | 507 | // for search, do NOT use freebusy rights, as it would allow to probe the content of event entries |
487 | 508 | $users = $this->resolve_users($params['users'], $params['filter'] == 'no-enum-groups', $params['ignore_acl'], empty($params['query'])); |
@@ -492,7 +513,10 @@ discard block |
||
492 | 513 | $params['private_grants'] = array(); |
493 | 514 | foreach($this->grants as $user => $rights) |
494 | 515 | { |
495 | - if ($rights & EGW_ACL_PRIVATE) $params['private_grants'][] = $user; |
|
516 | + if ($rights & EGW_ACL_PRIVATE) |
|
517 | + { |
|
518 | + $params['private_grants'][] = $user; |
|
519 | + } |
|
496 | 520 | } |
497 | 521 | } |
498 | 522 | |
@@ -507,7 +531,10 @@ discard block |
||
507 | 531 | { |
508 | 532 | return false; |
509 | 533 | } |
510 | - if (isset($params['start'])) $start = $this->date2ts($params['start']); |
|
534 | + if (isset($params['start'])) |
|
535 | + { |
|
536 | + $start = $this->date2ts($params['start']); |
|
537 | + } |
|
511 | 538 | |
512 | 539 | if (isset($params['end'])) |
513 | 540 | { |
@@ -571,10 +598,13 @@ discard block |
||
571 | 598 | $this->debug_message('socalendar::search daywise sorting from %1 to %2 of %3',False,$start,$end,$events); |
572 | 599 | } |
573 | 600 | // create empty entries for each day in the reported time |
574 | - for($ts = $start; $ts <= $end; $ts += DAY_s) // good enough for array creation, but see while loop below. |
|
601 | + for($ts = $start; $ts <= $end; $ts += DAY_s) |
|
602 | + { |
|
603 | + // good enough for array creation, but see while loop below. |
|
575 | 604 | { |
576 | 605 | $daysEvents[$this->date2string($ts)] = array(); |
577 | 606 | } |
607 | + } |
|
578 | 608 | foreach($events as $k => $event) |
579 | 609 | { |
580 | 610 | $e_start = max($this->date2ts($event['start']),$start); |
@@ -626,7 +656,10 @@ discard block |
||
626 | 656 | $integration_data = calendar_so::get_integration_data(); |
627 | 657 | } |
628 | 658 | |
629 | - if (!isset($integration_data[$app])) return null; |
|
659 | + if (!isset($integration_data[$app])) |
|
660 | + { |
|
661 | + return null; |
|
662 | + } |
|
630 | 663 | |
631 | 664 | return $part ? $integration_data[$app][$part] : $integration_data[$app]; |
632 | 665 | } |
@@ -673,8 +706,14 @@ discard block |
||
673 | 706 | */ |
674 | 707 | function clear_private_infos(&$event,$allowed_participants = array()) |
675 | 708 | { |
676 | - if ($event == false) return; |
|
677 | - if (!is_array($event['participants'])) error_log(__METHOD__.'('.array2string($event).', '.array2string($allowed_participants).') NO PARTICIPANTS '.function_backtrace()); |
|
709 | + if ($event == false) |
|
710 | + { |
|
711 | + return; |
|
712 | + } |
|
713 | + if (!is_array($event['participants'])) |
|
714 | + { |
|
715 | + error_log(__METHOD__.'('.array2string($event).', '.array2string($allowed_participants).') NO PARTICIPANTS '.function_backtrace()); |
|
716 | + } |
|
678 | 717 | |
679 | 718 | $event = array( |
680 | 719 | 'id' => $event['id'], |
@@ -719,19 +758,29 @@ discard block |
||
719 | 758 | } |
720 | 759 | $new_horizont = $this->date2ts($_new_horizont,true); // now we are in server-time, where this function operates |
721 | 760 | |
722 | - if ($new_horizont <= $this->config['horizont']) // no move necessary |
|
761 | + if ($new_horizont <= $this->config['horizont']) |
|
762 | + { |
|
763 | + // no move necessary |
|
723 | 764 | { |
724 | 765 | if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2 is bigger ==> nothing to do',true,$new_horizont,(int)$this->config['horizont']); |
766 | + } |
|
725 | 767 | return; |
726 | 768 | } |
727 | 769 | if (!empty($GLOBALS['egw_info']['server']['calendar_horizont'])) |
728 | 770 | { |
729 | 771 | $maxdays = abs($GLOBALS['egw_info']['server']['calendar_horizont']); |
730 | 772 | } |
731 | - if (empty($maxdays)) $maxdays = 1000; // old default |
|
732 | - if ($new_horizont > time()+$maxdays*DAY_s) // some user tries to "look" more then the maximum number of days in the future |
|
773 | + if (empty($maxdays)) |
|
774 | + { |
|
775 | + $maxdays = 1000; |
|
776 | + } |
|
777 | + // old default |
|
778 | + if ($new_horizont > time()+$maxdays*DAY_s) |
|
779 | + { |
|
780 | + // some user tries to "look" more then the maximum number of days in the future |
|
733 | 781 | { |
734 | 782 | if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2 new horizont more then %3 days from now --> ignoring it',true,$new_horizont,(int)$this->config['horizont'],$maxdays); |
783 | + } |
|
735 | 784 | $this->warnings['horizont'] = lang('Requested date %1 outside allowed range of %2 days: recurring events obmitted!', egw_time::to($new_horizont,true), $maxdays); |
736 | 785 | return; |
737 | 786 | } |
@@ -759,7 +808,10 @@ discard block |
||
759 | 808 | // update the horizont |
760 | 809 | config::save_value('horizont',$this->config['horizont'],'calendar'); |
761 | 810 | |
762 | - if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) new horizont=%2, exiting',true,$new_horizont,(int)$this->config['horizont']); |
|
811 | + if ($this->debug == 'check_move_horizont') |
|
812 | + { |
|
813 | + $this->debug_message('calendar_bo::check_move_horizont(%1) new horizont=%2, exiting',true,$new_horizont,(int)$this->config['horizont']); |
|
814 | + } |
|
763 | 815 | } |
764 | 816 | |
765 | 817 | /** |
@@ -790,7 +842,10 @@ discard block |
||
790 | 842 | $event['end'] = $event_read['end']; |
791 | 843 | } |
792 | 844 | } |
793 | - if (!$start) $start = $event['start']; |
|
845 | + if (!$start) |
|
846 | + { |
|
847 | + $start = $event['start']; |
|
848 | + } |
|
794 | 849 | |
795 | 850 | $events = array(); |
796 | 851 | $this->insert_all_recurrences($event,$start,$this->date2usertime($this->config['horizont']),$events); |
@@ -831,7 +886,10 @@ discard block |
||
831 | 886 | */ |
832 | 887 | function db2data(&$events,$date_format='ts') |
833 | 888 | { |
834 | - if (!is_array($events)) echo "<p>calendar_bo::db2data(\$events,$date_format) \$events is no array<br />\n".function_backtrace()."</p>\n"; |
|
889 | + if (!is_array($events)) |
|
890 | + { |
|
891 | + echo "<p>calendar_bo::db2data(\$events,$date_format) \$events is no array<br />\n".function_backtrace()."</p>\n"; |
|
892 | + } |
|
835 | 893 | foreach ($events as &$event) |
836 | 894 | { |
837 | 895 | // convert timezone id of event to tzid (iCal id like 'Europe/Berlin') |
@@ -915,7 +973,10 @@ discard block |
||
915 | 973 | */ |
916 | 974 | function date2usertime($ts,$date_format='ts') |
917 | 975 | { |
918 | - if (empty($ts) || $date_format == 'server') return $ts; |
|
976 | + if (empty($ts) || $date_format == 'server') |
|
977 | + { |
|
978 | + return $ts; |
|
979 | + } |
|
919 | 980 | |
920 | 981 | return egw_time::server2user($ts,$date_format); |
921 | 982 | } |
@@ -933,9 +994,15 @@ discard block |
||
933 | 994 | */ |
934 | 995 | function read($ids,$date=null,$ignore_acl=False,$date_format='ts',$clear_private_infos_users=null) |
935 | 996 | { |
936 | - if (!$ids) return false; |
|
997 | + if (!$ids) |
|
998 | + { |
|
999 | + return false; |
|
1000 | + } |
|
937 | 1001 | |
938 | - if ($date) $date = $this->date2ts($date); |
|
1002 | + if ($date) |
|
1003 | + { |
|
1004 | + $date = $this->date2ts($date); |
|
1005 | + } |
|
939 | 1006 | |
940 | 1007 | $return = null; |
941 | 1008 | |
@@ -1100,7 +1167,10 @@ discard block |
||
1100 | 1167 | { |
1101 | 1168 | static $res_info_cache = array(); |
1102 | 1169 | |
1103 | - if (!is_scalar($uid)) throw new egw_exception_wrong_parameter(__METHOD__.'('.array2string($uid).') parameter must be scalar'); |
|
1170 | + if (!is_scalar($uid)) |
|
1171 | + { |
|
1172 | + throw new egw_exception_wrong_parameter(__METHOD__.'('.array2string($uid).') parameter must be scalar'); |
|
1173 | + } |
|
1104 | 1174 | |
1105 | 1175 | if (!isset($res_info_cache[$uid])) |
1106 | 1176 | { |
@@ -1155,7 +1225,10 @@ discard block |
||
1155 | 1225 | */ |
1156 | 1226 | function check_perms($needed,$event=0,$other=0,$date_format='ts',$date_to_read=null,$user=null) |
1157 | 1227 | { |
1158 | - if (!$user) $user = $this->user; |
|
1228 | + if (!$user) |
|
1229 | + { |
|
1230 | + $user = $this->user; |
|
1231 | + } |
|
1159 | 1232 | if ($user == $this->user) |
1160 | 1233 | { |
1161 | 1234 | $grants = $this->grants; |
@@ -1194,7 +1267,10 @@ discard block |
||
1194 | 1267 | $grant = $grants[$owner]; |
1195 | 1268 | |
1196 | 1269 | // now any ACL rights (but invite rights!) implicate FREEBUSY rights (at least READ has to include FREEBUSY) |
1197 | - if ($grant & ~EGW_ACL_INVITE) $grant |= EGW_ACL_FREEBUSY; |
|
1270 | + if ($grant & ~EGW_ACL_INVITE) |
|
1271 | + { |
|
1272 | + $grant |= EGW_ACL_FREEBUSY; |
|
1273 | + } |
|
1198 | 1274 | |
1199 | 1275 | if (is_array($event) && ($needed == EGW_ACL_READ || $needed == EGW_ACL_FREEBUSY)) |
1200 | 1276 | { |
@@ -1220,7 +1296,10 @@ discard block |
||
1220 | 1296 | elseif (!is_numeric($uid)) |
1221 | 1297 | { |
1222 | 1298 | // if the owner only grants EGW_ACL_FREEBUSY we are not interested in the recources explicit rights |
1223 | - if ($grant == EGW_ACL_FREEBUSY) continue; |
|
1299 | + if ($grant == EGW_ACL_FREEBUSY) |
|
1300 | + { |
|
1301 | + continue; |
|
1302 | + } |
|
1224 | 1303 | // if we have a resource as participant |
1225 | 1304 | $resource = $this->resource_info($uid); |
1226 | 1305 | $grant |= $resource['rights']; |
@@ -1370,14 +1449,20 @@ discard block |
||
1370 | 1449 | $param = $param ? 'True' : 'False'; |
1371 | 1450 | break; |
1372 | 1451 | case 'integer': |
1373 | - if ($param >= mktime(0,0,0,1,1,2000)) $param = adodb_date('Y-m-d H:i:s',$param)." ($param)"; |
|
1452 | + if ($param >= mktime(0,0,0,1,1,2000)) |
|
1453 | + { |
|
1454 | + $param = adodb_date('Y-m-d H:i:s',$param)." ($param)"; |
|
1455 | + } |
|
1374 | 1456 | break; |
1375 | 1457 | } |
1376 | 1458 | } |
1377 | 1459 | $msg = str_replace('%'.($i-1),$param,$msg); |
1378 | 1460 | } |
1379 | 1461 | error_log($msg); |
1380 | - if ($backtrace) error_log(function_backtrace(1)); |
|
1462 | + if ($backtrace) |
|
1463 | + { |
|
1464 | + error_log(function_backtrace(1)); |
|
1465 | + } |
|
1381 | 1466 | } |
1382 | 1467 | |
1383 | 1468 | /** |
@@ -1485,14 +1570,20 @@ discard block |
||
1485 | 1570 | function timespan($start_m,$end_m,$both=false) |
1486 | 1571 | { |
1487 | 1572 | $duration = $end_m - $start_m; |
1488 | - if ($end_m == 24*60-1) ++$duration; |
|
1573 | + if ($end_m == 24*60-1) |
|
1574 | + { |
|
1575 | + ++$duration; |
|
1576 | + } |
|
1489 | 1577 | $duration = floor($duration/60).lang('h').($duration%60 ? $duration%60 : ''); |
1490 | 1578 | |
1491 | 1579 | $timespan = $t = common::formattime(sprintf('%02d',$start_m/60),sprintf('%02d',$start_m%60)); |
1492 | 1580 | |
1493 | - if ($both) // end-time too |
|
1581 | + if ($both) |
|
1582 | + { |
|
1583 | + // end-time too |
|
1494 | 1584 | { |
1495 | 1585 | $timespan .= ' - '.common::formattime(sprintf('%02d',$end_m/60),sprintf('%02d',$end_m%60)); |
1586 | + } |
|
1496 | 1587 | // dont double am/pm if they are the same in both times |
1497 | 1588 | if ($this->common_prefs['timeformat'] == 12 && substr($timespan,-2) == substr($t,-2)) |
1498 | 1589 | { |
@@ -1516,8 +1607,14 @@ discard block |
||
1516 | 1607 | static $id2lid = array(); |
1517 | 1608 | static $id2email = array(); |
1518 | 1609 | |
1519 | - if ($use_type && $use_type != 'u') $id = $use_type.$id; |
|
1520 | - if($id === 0 || $id === '0') $id = $this->user; |
|
1610 | + if ($use_type && $use_type != 'u') |
|
1611 | + { |
|
1612 | + $id = $use_type.$id; |
|
1613 | + } |
|
1614 | + if($id === 0 || $id === '0') |
|
1615 | + { |
|
1616 | + $id = $this->user; |
|
1617 | + } |
|
1521 | 1618 | |
1522 | 1619 | if (!isset($id2lid[$id])) |
1523 | 1620 | { |
@@ -1527,7 +1624,10 @@ discard block |
||
1527 | 1624 | if (($info = $this->resource_info($id))) |
1528 | 1625 | { |
1529 | 1626 | $id2lid[$id] = $info['name'] ? $info['name'] : $info['email']; |
1530 | - if ($info['name']) $id2email[$id] = $info['email']; |
|
1627 | + if ($info['name']) |
|
1628 | + { |
|
1629 | + $id2email[$id] = $info['email']; |
|
1630 | + } |
|
1531 | 1631 | } |
1532 | 1632 | } |
1533 | 1633 | else |
@@ -1553,11 +1653,18 @@ discard block |
||
1553 | 1653 | $names = array(); |
1554 | 1654 | foreach((array)$event['participants'] as $id => $status) |
1555 | 1655 | { |
1556 | - if (!is_string($status)) continue; |
|
1656 | + if (!is_string($status)) |
|
1657 | + { |
|
1658 | + continue; |
|
1659 | + } |
|
1557 | 1660 | $quantity = $role = null; |
1558 | 1661 | calendar_so::split_status($status,$quantity,$role); |
1559 | 1662 | |
1560 | - if ($status == 'G' && !$show_group_invitation) continue; // dont show group-invitation |
|
1663 | + if ($status == 'G' && !$show_group_invitation) |
|
1664 | + { |
|
1665 | + continue; |
|
1666 | + } |
|
1667 | + // dont show group-invitation |
|
1561 | 1668 | |
1562 | 1669 | $lang_status = lang($this->verbose_status[$status]); |
1563 | 1670 | if (!$long_status) |
@@ -1630,7 +1737,10 @@ discard block |
||
1630 | 1737 | |
1631 | 1738 | foreach(explode(',',$category) as $cat_id) |
1632 | 1739 | { |
1633 | - if (!$cat_id) continue; |
|
1740 | + if (!$cat_id) |
|
1741 | + { |
|
1742 | + continue; |
|
1743 | + } |
|
1634 | 1744 | |
1635 | 1745 | if (!isset($id2cat[$cat_id])) |
1636 | 1746 | { |
@@ -1696,7 +1806,10 @@ discard block |
||
1696 | 1806 | */ |
1697 | 1807 | public static function list_calendars($user, array $grants=null) |
1698 | 1808 | { |
1699 | - if (is_null($grants)) $grants = $GLOBALS['egw']->acl->get_grants('calendar', true, $user); |
|
1809 | + if (is_null($grants)) |
|
1810 | + { |
|
1811 | + $grants = $GLOBALS['egw']->acl->get_grants('calendar', true, $user); |
|
1812 | + } |
|
1700 | 1813 | |
1701 | 1814 | $users = $groups = array(); |
1702 | 1815 | foreach(array_keys($grants) as $id) |
@@ -1744,7 +1857,10 @@ discard block |
||
1744 | 1857 | */ |
1745 | 1858 | function recure2string($event) |
1746 | 1859 | { |
1747 | - if (!is_array($event)) return false; |
|
1860 | + if (!is_array($event)) |
|
1861 | + { |
|
1862 | + return false; |
|
1863 | + } |
|
1748 | 1864 | return (string)calendar_rrule::event2rrule($event); |
1749 | 1865 | } |
1750 | 1866 | |
@@ -1766,12 +1882,18 @@ discard block |
||
1766 | 1882 | */ |
1767 | 1883 | function read_holidays($year=0) |
1768 | 1884 | { |
1769 | - if (!$year) $year = (int) date('Y',$this->now_su); |
|
1885 | + if (!$year) |
|
1886 | + { |
|
1887 | + $year = (int) date('Y',$this->now_su); |
|
1888 | + } |
|
1770 | 1889 | |
1771 | - if (!$this->cached_holidays) // try reading the holidays from the session |
|
1890 | + if (!$this->cached_holidays) |
|
1891 | + { |
|
1892 | + // try reading the holidays from the session |
|
1772 | 1893 | { |
1773 | 1894 | $this->cached_holidays = $GLOBALS['egw']->session->appsession('holidays','calendar'); |
1774 | 1895 | } |
1896 | + } |
|
1775 | 1897 | if (!isset($this->cached_holidays[$year])) |
1776 | 1898 | { |
1777 | 1899 | if (!is_object($this->holidays)) |
@@ -1811,7 +1933,11 @@ discard block |
||
1811 | 1933 | continue; |
1812 | 1934 | } |
1813 | 1935 | list($y,$m,$d) = explode('-',$pers['bday']); |
1814 | - if ($y > $year) continue; // not yet born |
|
1936 | + if ($y > $year) |
|
1937 | + { |
|
1938 | + continue; |
|
1939 | + } |
|
1940 | + // not yet born |
|
1815 | 1941 | $this->cached_holidays[$year][sprintf('%04d%02d%02d',$year,$m,$d)][] = array( |
1816 | 1942 | 'day' => $d, |
1817 | 1943 | 'month' => $m, |
@@ -1904,7 +2030,10 @@ discard block |
||
1904 | 2030 | } |
1905 | 2031 | } |
1906 | 2032 | $str_fields = implode(', ',$extra_fields); |
1907 | - if (is_array($extra_fields)) return $this->format_date($event['start']) . ': ' . $event['title'] . ($str_fields? ', ' . $str_fields:''); |
|
2033 | + if (is_array($extra_fields)) |
|
2034 | + { |
|
2035 | + return $this->format_date($event['start']) . ': ' . $event['title'] . ($str_fields? ', ' . $str_fields:''); |
|
2036 | + } |
|
1908 | 2037 | } |
1909 | 2038 | return $this->format_date($event['start']) . ': ' . $event['title']; |
1910 | 2039 | } |
@@ -1925,7 +2054,8 @@ discard block |
||
1925 | 2054 | 'offset' => $options['start'], |
1926 | 2055 | 'order' => 'cal_start DESC', |
1927 | 2056 | ); |
1928 | - if($options['num_rows']) { |
|
2057 | + if($options['num_rows']) |
|
2058 | + { |
|
1929 | 2059 | $query['num_rows'] = $options['num_rows']; |
1930 | 2060 | } |
1931 | 2061 | foreach((array) $this->search($query) as $event) |
@@ -1991,7 +2121,10 @@ discard block |
||
1991 | 2121 | if ((!isset($default_prefs[$var]) || (string)$default_prefs[$var] === '') && (!isset($forced_prefs[$var]) || (string)$forced_prefs[$var] === '')) |
1992 | 2122 | { |
1993 | 2123 | $GLOBALS['egw']->preferences->add('calendar',$var,$default,'default'); // always store default, even if we have a forced too |
1994 | - if ($type == 'forced') $GLOBALS['egw']->preferences->add('calendar',$var,$default,'forced'); |
|
2124 | + if ($type == 'forced') |
|
2125 | + { |
|
2126 | + $GLOBALS['egw']->preferences->add('calendar',$var,$default,'forced'); |
|
2127 | + } |
|
1995 | 2128 | $this->cal_prefs[$var] = $default; |
1996 | 2129 | $need_save = True; |
1997 | 2130 | } |
@@ -2011,7 +2144,10 @@ discard block |
||
2011 | 2144 | */ |
2012 | 2145 | static function freebusy_url($user='',$pw=null) |
2013 | 2146 | { |
2014 | - if (is_numeric($user)) $user = $GLOBALS['egw']->accounts->id2name($user); |
|
2147 | + if (is_numeric($user)) |
|
2148 | + { |
|
2149 | + $user = $GLOBALS['egw']->accounts->id2name($user); |
|
2150 | + } |
|
2015 | 2151 | |
2016 | 2152 | $credentials = ''; |
2017 | 2153 | |
@@ -2079,13 +2215,19 @@ discard block |
||
2079 | 2215 | */ |
2080 | 2216 | public function get_ctag($user, $filter='owner', $master_only=false) |
2081 | 2217 | { |
2082 | - if ($this->debug > 1) $startime = microtime(true); |
|
2218 | + if ($this->debug > 1) |
|
2219 | + { |
|
2220 | + $startime = microtime(true); |
|
2221 | + } |
|
2083 | 2222 | |
2084 | 2223 | // resolve users to add memberships for users and members for groups |
2085 | 2224 | $users = $this->resolve_users($user); |
2086 | 2225 | $ctag = $users ? $this->so->get_ctag($users, $filter == 'owner', $master_only) : 0; // no rights, return 0 as ctag (otherwise we get SQL error!) |
2087 | 2226 | |
2088 | - if ($this->debug > 1) error_log(__METHOD__. "($user, '$filter') = $ctag = ".date('Y-m-d H:i:s',$ctag)." took ".(microtime(true)-$startime)." secs"); |
|
2227 | + if ($this->debug > 1) |
|
2228 | + { |
|
2229 | + error_log(__METHOD__. "($user, '$filter') = $ctag = ".date('Y-m-d H:i:s',$ctag)." took ".(microtime(true)-$startime)." secs"); |
|
2230 | + } |
|
2089 | 2231 | return $ctag; |
2090 | 2232 | } |
2091 | 2233 | |
@@ -2127,15 +2269,21 @@ discard block |
||
2127 | 2269 | $content['link_app'][] = $link['app']; |
2128 | 2270 | $content['link_id'][] = $link['id']; |
2129 | 2271 | } |
2130 | - if ($link['app'] == 'addressbook') // prefering contact as primary contact over calendar entry set above |
|
2272 | + if ($link['app'] == 'addressbook') |
|
2273 | + { |
|
2274 | + // prefering contact as primary contact over calendar entry set above |
|
2131 | 2275 | { |
2132 | 2276 | $content['info_contact'] = 'addressbook:'.$link['id']; |
2133 | 2277 | } |
2278 | + } |
|
2134 | 2279 | } |
2135 | 2280 | // Copy same custom fields |
2136 | 2281 | foreach(array_keys(config::get_customfields('infolog')) as $name) |
2137 | 2282 | { |
2138 | - if ($this->customfields[$name]) $content['#'.$name] = $calendar['#'.$name]; |
|
2283 | + if ($this->customfields[$name]) |
|
2284 | + { |
|
2285 | + $content['#'.$name] = $calendar['#'.$name]; |
|
2286 | + } |
|
2139 | 2287 | } |
2140 | 2288 | //error_log(__METHOD__.'('.array2string($data).') calendar='.array2string($calendar).' returning '.array2string($content)); |
2141 | 2289 | return $content; |
@@ -2158,7 +2306,11 @@ discard block |
||
2158 | 2306 | $set['ts_title'] = $this->link_title($event); |
2159 | 2307 | $set['start_time'] = egw_time::to($event['start'],'H:i'); |
2160 | 2308 | $set['ts_description'] = $event['description']; |
2161 | - if ($this->isWholeDay($event)) $event['end']++; // whole day events are 1sec short |
|
2309 | + if ($this->isWholeDay($event)) |
|
2310 | + { |
|
2311 | + $event['end']++; |
|
2312 | + } |
|
2313 | + // whole day events are 1sec short |
|
2162 | 2314 | $set['ts_duration'] = ($event['end'] - $event['start']) / 60; |
2163 | 2315 | $set['ts_quantity'] = ($event['end'] - $event['start']) / 3600; |
2164 | 2316 | $set['end_time'] = null; // unset end-time |
@@ -638,8 +638,8 @@ discard block |
||
638 | 638 | * or an ExecMethod callback with parameters $id,$event |
639 | 639 | * |
640 | 640 | * @param string $app |
641 | - * @param int|string $id |
|
642 | - * @return string |
|
641 | + * @param string $id |
|
642 | + * @return boolean |
|
643 | 643 | */ |
644 | 644 | static function integration_get_private($app,$id,$event) |
645 | 645 | { |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | * This methods operates in usertime, while $this->config['horizont'] is in servertime! |
769 | 769 | * |
770 | 770 | * @param array $event |
771 | - * @param mixed $start =0 minimum start-time for new recurrences or !$start = since the start of the event |
|
771 | + * @param integer $start =0 minimum start-time for new recurrences or !$start = since the start of the event |
|
772 | 772 | */ |
773 | 773 | function set_recurrences($event,$start=0) |
774 | 774 | { |
@@ -989,10 +989,9 @@ discard block |
||
989 | 989 | * Recurrences get calculated by rrule iterator implemented in calendar_rrule class. |
990 | 990 | * |
991 | 991 | * @param array $event repeating event whos repetions should be inserted |
992 | - * @param mixed $start start-date |
|
992 | + * @param mixed $_start start-date |
|
993 | 993 | * @param mixed $end end-date |
994 | 994 | * @param array $events where the repetions get inserted |
995 | - * @param array $recur_exceptions with date (in Ymd) as key (and True as values), seems not to be used anymore |
|
996 | 995 | */ |
997 | 996 | function insert_all_recurrences($event,$_start,$end,&$events) |
998 | 997 | { |
@@ -1146,7 +1145,7 @@ discard block |
||
1146 | 1145 | * even if you have no general read-grant from that user. |
1147 | 1146 | * |
1148 | 1147 | * @param int $needed necessary ACL right: EGW_ACL_{READ|EDIT|DELETE} |
1149 | - * @param mixed $event event as array or the event-id or 0 for a general check |
|
1148 | + * @param integer $event event as array or the event-id or 0 for a general check |
|
1150 | 1149 | * @param int $other uid to check (if event==0) or 0 to check against $this->user |
1151 | 1150 | * @param string $date_format ='ts' date-format used for reading: 'ts'=timestamp, 'array'=array, 'string'=iso8601 string for xmlrpc |
1152 | 1151 | * @param mixed $date_to_read =null date used for reading, internal param for the caching |
@@ -1319,8 +1318,6 @@ discard block |
||
1319 | 1318 | * @param string $msg message with parameters/variables like lang(), eg. '%1' |
1320 | 1319 | * @param boolean $backtrace =True include a function-backtrace, default True=On |
1321 | 1320 | * should only be set to False=Off, if your code ensures a call with backtrace=On was made before !!! |
1322 | - * @param mixed $param a variable number of parameters, to be inserted in $msg |
|
1323 | - * arrays get serialized with print_r() ! |
|
1324 | 1321 | */ |
1325 | 1322 | static function debug_message($msg,$backtrace=True) |
1326 | 1323 | { |
@@ -1384,7 +1381,7 @@ discard block |
||
1384 | 1381 | * Formats one or two dates (range) as long date (full monthname), optionaly with a time |
1385 | 1382 | * |
1386 | 1383 | * @param mixed $_first first date |
1387 | - * @param mixed $last =0 last date if != 0 (default) |
|
1384 | + * @param integer $last =0 last date if != 0 (default) |
|
1388 | 1385 | * @param boolean $display_time =false should a time be displayed too |
1389 | 1386 | * @param boolean $display_day =false should a day-name prefix the date, eg. monday June 20, 2006 |
1390 | 1387 | * @return string with formated date |
@@ -1859,7 +1856,6 @@ discard block |
||
1859 | 1856 | * |
1860 | 1857 | * Is called as hook to participate in the linking |
1861 | 1858 | * |
1862 | - * @param int|array $entry int cal_id or array with event |
|
1863 | 1859 | * @param string|boolean string with title, null if not found or false if not read perms |
1864 | 1860 | */ |
1865 | 1861 | function link_title($event) |
@@ -2093,7 +2089,6 @@ discard block |
||
2093 | 2089 | * Hook for infolog to set some extra data and links |
2094 | 2090 | * |
2095 | 2091 | * @param array $data event-array preset by infolog plus |
2096 | - * @param int $data[id] cal_id |
|
2097 | 2092 | * @return array with key => value pairs to set in new event and link_app/link_id arrays |
2098 | 2093 | */ |
2099 | 2094 | function infolog_set($data) |
@@ -2145,7 +2140,6 @@ discard block |
||
2145 | 2140 | * Hook for timesheet to set some extra data and links |
2146 | 2141 | * |
2147 | 2142 | * @param array $data |
2148 | - * @param int $data[id] cal_id:recurrence |
|
2149 | 2143 | * @return array with key => value pairs to set in new timesheet and link_app/link_id arrays |
2150 | 2144 | */ |
2151 | 2145 | function timesheet_set($data) |
@@ -326,20 +326,20 @@ discard block |
||
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
329 | - * Table plugin for event |
|
330 | - * Lists events for a certain day of the week. Only works for one week at a time, so for multiple weeks, |
|
331 | - * use multiple date ranges. |
|
332 | - * |
|
333 | - * Use: |
|
334 | - * $$table/Monday$$ $$starttime$$ $$title$$ $$endtable$$ |
|
335 | - * The day of the week may be language specific (date('l')). |
|
336 | - * |
|
337 | - * @param string $plugin (Monday-Sunday) |
|
338 | - * @param int/array date or date range |
|
339 | - * @param int $n Row number |
|
340 | - * @param string $repeat Text being repeated for each entry |
|
341 | - * @return array |
|
342 | - */ |
|
329 | + * Table plugin for event |
|
330 | + * Lists events for a certain day of the week. Only works for one week at a time, so for multiple weeks, |
|
331 | + * use multiple date ranges. |
|
332 | + * |
|
333 | + * Use: |
|
334 | + * $$table/Monday$$ $$starttime$$ $$title$$ $$endtable$$ |
|
335 | + * The day of the week may be language specific (date('l')). |
|
336 | + * |
|
337 | + * @param string $plugin (Monday-Sunday) |
|
338 | + * @param int/array date or date range |
|
339 | + * @param int $n Row number |
|
340 | + * @param string $repeat Text being repeated for each entry |
|
341 | + * @return array |
|
342 | + */ |
|
343 | 343 | public function day_plugin($plugin,$date,$n,$repeat) |
344 | 344 | { |
345 | 345 | static $days = null; |
@@ -414,16 +414,16 @@ discard block |
||
414 | 414 | } |
415 | 415 | |
416 | 416 | /** |
417 | - * Table plugin for a certain date |
|
418 | - * |
|
419 | - * Can be either a particular date (2011-02-15) or a day of the month (15) |
|
420 | - * |
|
421 | - * @param string $plugin |
|
422 | - * @param int $id ID for this record |
|
423 | - * @param int $n Repeated row number |
|
424 | - * @param string $repeat Text being repeated for each entry |
|
425 | - * @return array |
|
426 | - */ |
|
417 | + * Table plugin for a certain date |
|
418 | + * |
|
419 | + * Can be either a particular date (2011-02-15) or a day of the month (15) |
|
420 | + * |
|
421 | + * @param string $plugin |
|
422 | + * @param int $id ID for this record |
|
423 | + * @param int $n Repeated row number |
|
424 | + * @param string $repeat Text being repeated for each entry |
|
425 | + * @return array |
|
426 | + */ |
|
427 | 427 | public function day($plugin,$id,$n,$repeat) |
428 | 428 | { |
429 | 429 | static $days = null; |
@@ -515,15 +515,15 @@ discard block |
||
515 | 515 | } |
516 | 516 | |
517 | 517 | /** |
518 | - * Table plugin for participants |
|
519 | - * |
|
520 | - * Copied from eventmgr resources |
|
521 | - * |
|
522 | - * @param string $plugin |
|
523 | - * @param int $id |
|
524 | - * @param int $n |
|
525 | - * @return array |
|
526 | - */ |
|
518 | + * Table plugin for participants |
|
519 | + * |
|
520 | + * Copied from eventmgr resources |
|
521 | + * |
|
522 | + * @param string $plugin |
|
523 | + * @param int $id |
|
524 | + * @param int $n |
|
525 | + * @return array |
|
526 | + */ |
|
527 | 527 | public function participant($plugin,$id,$n) |
528 | 528 | { |
529 | 529 | unset($plugin); // not used, but required by function signature |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | { |
583 | 583 | foreach($resource as $name => $value) |
584 | 584 | { |
585 | - $replacements['$$'.$name.'$$'] = $value; |
|
585 | + $replacements['$$'.$name.'$$'] = $value; |
|
586 | 586 | } |
587 | 587 | } |
588 | 588 | break; |
@@ -82,17 +82,17 @@ discard block |
||
82 | 82 | |
83 | 83 | // Register table plugins |
84 | 84 | $this->table_plugins['participant'] = 'participant'; |
85 | - for($i = 0; $i < 7; $i++) |
|
85 | + for ($i = 0; $i < 7; $i++) |
|
86 | 86 | { |
87 | 87 | $this->table_plugins[date('l', strtotime("+$i days"))] = 'day_plugin'; |
88 | 88 | } |
89 | - for($i = 1; $i <= 31; $i++) { |
|
89 | + for ($i = 1; $i <= 31; $i++) { |
|
90 | 90 | $this->table_plugins['day_'.$i] = 'day'; // Numerically by day number (1-31) |
91 | 91 | } |
92 | - foreach(self::$relative as $day) { |
|
92 | + foreach (self::$relative as $day) { |
|
93 | 93 | $this->table_plugins[$day] = 'day'; // Current day |
94 | 94 | } |
95 | - $this->query = $GLOBALS['egw']->session->appsession('session_data','calendar'); |
|
95 | + $this->query = $GLOBALS['egw']->session->appsession('session_data', 'calendar'); |
|
96 | 96 | $this->query['users'] = explode(',', $this->query['owner']); |
97 | 97 | $this->query['num_rows'] = -1; |
98 | 98 | } |
@@ -113,10 +113,10 @@ discard block |
||
113 | 113 | * @param string $charset=null charset to override default set by mimetype or export charset |
114 | 114 | * @return string|boolean merged document or false on error |
115 | 115 | */ |
116 | - function merge_string($content,$ids,$err,$mimetype,$fix) |
|
116 | + function merge_string($content, $ids, $err, $mimetype, $fix) |
|
117 | 117 | { |
118 | 118 | // Handle merging a list of events into a document with range instead of pagerepeat |
119 | - if(strpos($content, '$$pagerepeat') === false && strpos($content, '{{pagerepeat') === false && count($ids) > 1) |
|
119 | + if (strpos($content, '$$pagerepeat') === false && strpos($content, '{{pagerepeat') === false && count($ids) > 1) |
|
120 | 120 | { |
121 | 121 | // Merging more than one something will fail without pagerepeat |
122 | 122 | if (is_array($ids) && $ids[0]['id']) |
@@ -125,16 +125,16 @@ discard block |
||
125 | 125 | $events = $ids; |
126 | 126 | $ids = array('start' => PHP_INT_MAX, 'end' => 0); |
127 | 127 | $this->ids = array(); |
128 | - foreach($events as $event) { |
|
129 | - if($event['start'] && egw_time::to($event['start'],'ts') < $ids['start']) $ids['start'] = egw_time::to($event['start'],'ts'); |
|
130 | - if($event['end'] && egw_time::to($event['end'],'ts') > $ids['end']) $ids['end'] = egw_time::to($event['end'],'ts'); |
|
128 | + foreach ($events as $event) { |
|
129 | + if ($event['start'] && egw_time::to($event['start'], 'ts') < $ids['start']) $ids['start'] = egw_time::to($event['start'], 'ts'); |
|
130 | + if ($event['end'] && egw_time::to($event['end'], 'ts') > $ids['end']) $ids['end'] = egw_time::to($event['end'], 'ts'); |
|
131 | 131 | // Keep ids for future use |
132 | 132 | $this->ids[] = $event['id']; |
133 | 133 | } |
134 | 134 | $ids = array($ids); |
135 | 135 | } |
136 | 136 | } |
137 | - return parent::merge_string($content, $ids, $err, $mimetype,$fix); |
|
137 | + return parent::merge_string($content, $ids, $err, $mimetype, $fix); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -144,20 +144,20 @@ discard block |
||
144 | 144 | * @param string &$content=null content to create some replacements only if they are used |
145 | 145 | * @return array|boolean |
146 | 146 | */ |
147 | - protected function get_replacements($id,&$content=null) |
|
147 | + protected function get_replacements($id, &$content = null) |
|
148 | 148 | { |
149 | 149 | $prefix = ''; |
150 | 150 | // List events ? |
151 | - if(is_array($id) && !$id['id'] && !$id[0]['id']) |
|
151 | + if (is_array($id) && !$id['id'] && !$id[0]['id']) |
|
152 | 152 | { |
153 | 153 | $events = $this->bo->search($this->query + $id + array( |
154 | 154 | 'offset' => 0, |
155 | 155 | 'order' => 'cal_start', |
156 | 156 | 'cfs' => strpos($content, '#') !== false ? array_keys(config::get_customfields('calendar')) : null |
157 | 157 | )); |
158 | - if(strpos($content,'$$calendar/') !== false || strpos($content, '$$table/day') !== false) |
|
158 | + if (strpos($content, '$$calendar/') !== false || strpos($content, '$$table/day') !== false) |
|
159 | 159 | { |
160 | - array_unshift($events,false); unset($events[0]); // renumber the array to start with key 1, instead of 0 |
|
160 | + array_unshift($events, false); unset($events[0]); // renumber the array to start with key 1, instead of 0 |
|
161 | 161 | $prefix = 'calendar/%d'; |
162 | 162 | } |
163 | 163 | } |
@@ -167,11 +167,11 @@ discard block |
||
167 | 167 | $events = $id; |
168 | 168 | $id = array('start' => PHP_INT_MAX, 'end' => 0); |
169 | 169 | $this->ids = array(); |
170 | - foreach($events as $event) { |
|
171 | - if($event['start'] && $event['start'] < $id['start']) $id['start'] = $event['start']; |
|
172 | - if($event['end'] && $event['end'] > $id['end']) $id['end'] = $event['end']; |
|
170 | + foreach ($events as $event) { |
|
171 | + if ($event['start'] && $event['start'] < $id['start']) $id['start'] = $event['start']; |
|
172 | + if ($event['end'] && $event['end'] > $id['end']) $id['end'] = $event['end']; |
|
173 | 173 | // Keep ids for future use |
174 | - $this->ids[] = $event['id']; |
|
174 | + $this->ids[] = $event['id']; |
|
175 | 175 | } |
176 | 176 | $id = array($id); |
177 | 177 | } |
@@ -183,20 +183,20 @@ discard block |
||
183 | 183 | // as this function allows to pass query- parameters, we need to check the result of the query against export_limit restrictions |
184 | 184 | if (bo_merge::hasExportLimit($this->export_limit) && !bo_merge::is_export_limit_excepted() && count($events) > (int)$this->export_limit) |
185 | 185 | { |
186 | - $err = lang('No rights to export more than %1 entries!',(int)$this->export_limit); |
|
186 | + $err = lang('No rights to export more than %1 entries!', (int)$this->export_limit); |
|
187 | 187 | throw new egw_exception_wrong_userinput($err); |
188 | 188 | } |
189 | 189 | $replacements = array(); |
190 | 190 | $n = 0; |
191 | - foreach($events as $event) |
|
191 | + foreach ($events as $event) |
|
192 | 192 | { |
193 | - $values = $this->calendar_replacements($event,sprintf($prefix,++$n), $content); |
|
194 | - if(is_array($id) && $id['start']) |
|
193 | + $values = $this->calendar_replacements($event, sprintf($prefix, ++$n), $content); |
|
194 | + if (is_array($id) && $id['start']) |
|
195 | 195 | { |
196 | - foreach(self::$range_tags as $key => $format) |
|
196 | + foreach (self::$range_tags as $key => $format) |
|
197 | 197 | { |
198 | 198 | $value = date($format, $key == 'end' ? $id['end'] : $id['start']); |
199 | - if($key == 'month') $value = lang($value); |
|
199 | + if ($key == 'month') $value = lang($value); |
|
200 | 200 | $values["$\$range/$key$$"] = $value; |
201 | 201 | } |
202 | 202 | } |
@@ -212,10 +212,10 @@ discard block |
||
212 | 212 | * @param boolean $last_event_too=false also include information about the last event |
213 | 213 | * @return array |
214 | 214 | */ |
215 | - public function calendar_replacements($id,$prefix = '', &$content = '') |
|
215 | + public function calendar_replacements($id, $prefix = '', &$content = '') |
|
216 | 216 | { |
217 | 217 | $replacements = array(); |
218 | - if(!is_array($id) || !$id['start']) { |
|
218 | + if (!is_array($id) || !$id['start']) { |
|
219 | 219 | $event = $this->bo->read(is_array($id) ? $id['id'] : $id, is_array($id) ? $id['recur_date'] : null); |
220 | 220 | } else { |
221 | 221 | $event = $id; |
@@ -228,68 +228,68 @@ discard block |
||
228 | 228 | importexport_export_csv::convert($record, $types, 'calendar'); |
229 | 229 | |
230 | 230 | $array = $record->get_record_array(); |
231 | - foreach($array as $key => $value) |
|
231 | + foreach ($array as $key => $value) |
|
232 | 232 | { |
233 | - $replacements['$$'.($prefix?$prefix.'/':'').$key.'$$'] = $value; |
|
233 | + $replacements['$$'.($prefix ? $prefix.'/' : '').$key.'$$'] = $value; |
|
234 | 234 | } |
235 | 235 | |
236 | - $replacements['$$' . ($prefix ? $prefix . '/' : '') . 'calendar_id'. '$$'] = $event['id']; |
|
237 | - foreach($this->bo->event2array($event) as $name => $data) |
|
236 | + $replacements['$$'.($prefix ? $prefix.'/' : '').'calendar_id'.'$$'] = $event['id']; |
|
237 | + foreach ($this->bo->event2array($event) as $name => $data) |
|
238 | 238 | { |
239 | - if (substr($name,-4) == 'date') $name = substr($name,0,-4); |
|
240 | - $replacements['$$' . ($prefix ? $prefix . '/' : '') . 'calendar_'.$name . '$$'] = is_array($data['data']) ? implode(', ',$data['data']) : $data['data']; |
|
239 | + if (substr($name, -4) == 'date') $name = substr($name, 0, -4); |
|
240 | + $replacements['$$'.($prefix ? $prefix.'/' : '').'calendar_'.$name.'$$'] = is_array($data['data']) ? implode(', ', $data['data']) : $data['data']; |
|
241 | 241 | } |
242 | 242 | // Add seperate lists of participants by type |
243 | - if(strpos($content, 'calendar_participants/')!== false) |
|
243 | + if (strpos($content, 'calendar_participants/') !== false) |
|
244 | 244 | { |
245 | 245 | $types = array(); |
246 | - foreach($this->bo->resources as $resource) |
|
246 | + foreach ($this->bo->resources as $resource) |
|
247 | 247 | { |
248 | 248 | $types[$resource['app']] = array(); |
249 | 249 | } |
250 | - foreach($event['participants'] as $uid => $status) |
|
250 | + foreach ($event['participants'] as $uid => $status) |
|
251 | 251 | { |
252 | 252 | $type = $this->bo->resources[$uid[0]]['app']; |
253 | - if($type == 'home-accounts') |
|
253 | + if ($type == 'home-accounts') |
|
254 | 254 | { |
255 | 255 | $type = ($GLOBALS['egw']->accounts->get_type($uid) == 'g' ? 'group' : 'account'); |
256 | 256 | } |
257 | 257 | $types[$type][] = $this->bo->participant_name($uid); |
258 | 258 | } |
259 | - foreach($types as $t_id => $type) |
|
259 | + foreach ($types as $t_id => $type) |
|
260 | 260 | { |
261 | - $replacements['$$'.($prefix ? $prefix . '/' : '') . "calendar_participants/{$t_id}$$"] = implode(', ',$type); |
|
261 | + $replacements['$$'.($prefix ? $prefix.'/' : '')."calendar_participants/{$t_id}$$"] = implode(', ', $type); |
|
262 | 262 | } |
263 | 263 | } |
264 | - if(!$replacements['$$'.($prefix ? $prefix . '/' : '') . 'calendar_recur_type$$']) |
|
264 | + if (!$replacements['$$'.($prefix ? $prefix.'/' : '').'calendar_recur_type$$']) |
|
265 | 265 | { |
266 | 266 | // Need to set it to '' if not set or previous record may be used |
267 | - $replacements['$$'.($prefix ? $prefix . '/' : '') . 'calendar_recur_type$$'] = ''; |
|
267 | + $replacements['$$'.($prefix ? $prefix.'/' : '').'calendar_recur_type$$'] = ''; |
|
268 | 268 | } |
269 | - foreach(array('start','end') as $what) |
|
269 | + foreach (array('start', 'end') as $what) |
|
270 | 270 | { |
271 | - foreach(array( |
|
271 | + foreach (array( |
|
272 | 272 | 'date' => $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'], |
273 | 273 | 'day' => 'l', |
274 | - 'time' => (date('Ymd',$event['start']) != date('Ymd',$event['end']) ? $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'].' ' : '') . ($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i'), |
|
274 | + 'time' => (date('Ymd', $event['start']) != date('Ymd', $event['end']) ? $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'].' ' : '').($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i'), |
|
275 | 275 | ) as $name => $format) |
276 | 276 | { |
277 | - $value = egw_time::to($event[$what],$format); |
|
277 | + $value = egw_time::to($event[$what], $format); |
|
278 | 278 | if ($format == 'l') $value = lang($value); |
279 | - $replacements['$$' .($prefix ? $prefix.'/':'').'calendar_'.$what.$name.'$$'] = $value; |
|
279 | + $replacements['$$'.($prefix ? $prefix.'/' : '').'calendar_'.$what.$name.'$$'] = $value; |
|
280 | 280 | } |
281 | 281 | } |
282 | - $duration = ($event['end'] - $event['start'])/60; |
|
283 | - $replacements['$$'.($prefix?$prefix.'/':'').'calendar_duration$$'] = floor($duration/60).lang('h').($duration%60 ? $duration%60 : ''); |
|
282 | + $duration = ($event['end'] - $event['start']) / 60; |
|
283 | + $replacements['$$'.($prefix ? $prefix.'/' : '').'calendar_duration$$'] = floor($duration / 60).lang('h').($duration % 60 ? $duration % 60 : ''); |
|
284 | 284 | |
285 | 285 | // Add in contact stuff for owner |
286 | - if (strpos($content,'$$calendar_owner/') !== null && ($user = $GLOBALS['egw']->accounts->id2name($event['owner'],'person_id'))) |
|
286 | + if (strpos($content, '$$calendar_owner/') !== null && ($user = $GLOBALS['egw']->accounts->id2name($event['owner'], 'person_id'))) |
|
287 | 287 | { |
288 | - $replacements += $this->contact_replacements($user,($prefix ? $prefix.'/':'').'calendar_owner'); |
|
289 | - $replacements['$$'.($prefix?$prefix.'/':'').'calendar_owner/primary_group$$'] = $GLOBALS['egw']->accounts->id2name($GLOBALS['egw']->accounts->id2name($event['owner'],'account_primary_group')); |
|
288 | + $replacements += $this->contact_replacements($user, ($prefix ? $prefix.'/' : '').'calendar_owner'); |
|
289 | + $replacements['$$'.($prefix ? $prefix.'/' : '').'calendar_owner/primary_group$$'] = $GLOBALS['egw']->accounts->id2name($GLOBALS['egw']->accounts->id2name($event['owner'], 'account_primary_group')); |
|
290 | 290 | } |
291 | 291 | |
292 | - if($content && strpos($content, '$$#') !== FALSE) |
|
292 | + if ($content && strpos($content, '$$#') !== FALSE) |
|
293 | 293 | { |
294 | 294 | $this->cf_link_to_expand($event, $content, $replacements); |
295 | 295 | } |
@@ -315,77 +315,77 @@ discard block |
||
315 | 315 | * @param string $repeat Text being repeated for each entry |
316 | 316 | * @return array |
317 | 317 | */ |
318 | - public function day_plugin($plugin,$date,$n,$repeat) |
|
318 | + public function day_plugin($plugin, $date, $n, $repeat) |
|
319 | 319 | { |
320 | 320 | static $days = null; |
321 | - if(is_array($date) && !$date['start']) { |
|
321 | + if (is_array($date) && !$date['start']) { |
|
322 | 322 | // List of IDs |
323 | - if($date[0]['start']) { |
|
323 | + if ($date[0]['start']) { |
|
324 | 324 | $id = array('start' => PHP_INT_MAX, 'end' => 0); |
325 | - foreach($date as $event) { |
|
326 | - if($event['start'] && $event['start'] < $id['start']) $id['start'] = $event['start']; |
|
327 | - if($event['end'] && $event['end'] > $id['end']) $id['end'] = $event['end']; |
|
325 | + foreach ($date as $event) { |
|
326 | + if ($event['start'] && $event['start'] < $id['start']) $id['start'] = $event['start']; |
|
327 | + if ($event['end'] && $event['end'] > $id['end']) $id['end'] = $event['end']; |
|
328 | 328 | } |
329 | 329 | $date = $id; |
330 | 330 | } else { |
331 | 331 | $event = $this->bo->read(is_array($date) ? $date['id'] : $date, is_array($date) ? $date['recur_date'] : null); |
332 | - if(date('l',$event['start']) != $plugin) return array(); |
|
332 | + if (date('l', $event['start']) != $plugin) return array(); |
|
333 | 333 | $date = $event['start']; |
334 | 334 | } |
335 | 335 | } |
336 | 336 | |
337 | 337 | $_date = $date['start'] ? $date['start'] : $date; |
338 | - if($days[date('Ymd',$_date)][$plugin]) return $days[date('Ymd',$_date)][$plugin][$n]; |
|
338 | + if ($days[date('Ymd', $_date)][$plugin]) return $days[date('Ymd', $_date)][$plugin][$n]; |
|
339 | 339 | |
340 | 340 | $events = $this->bo->search($this->query + array( |
341 | - 'start' => $date['end'] ? $date['start'] : mktime(0,0,0,date('m',$_date),date('d',$_date),date('Y',$_date)), |
|
342 | - 'end' => $date['end'] ? $date['end'] : mktime(23,59,59,date('m',$_date),date('d',$_date),date('Y',$_date)), |
|
341 | + 'start' => $date['end'] ? $date['start'] : mktime(0, 0, 0, date('m', $_date), date('d', $_date), date('Y', $_date)), |
|
342 | + 'end' => $date['end'] ? $date['end'] : mktime(23, 59, 59, date('m', $_date), date('d', $_date), date('Y', $_date)), |
|
343 | 343 | 'offset' => 0, |
344 | 344 | 'num_rows' => 20, |
345 | 345 | 'order' => 'cal_start', |
346 | 346 | 'daywise' => true, |
347 | - 'cfs' => array(), // read all custom-fields |
|
347 | + 'cfs' => array(), // read all custom-fields |
|
348 | 348 | )); |
349 | 349 | |
350 | 350 | if (true) $days = array(); |
351 | 351 | $replacements = array(); |
352 | 352 | $time_format = $GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i'; |
353 | - foreach($events as $day => $list) |
|
353 | + foreach ($events as $day => $list) |
|
354 | 354 | { |
355 | - foreach($list as $event) |
|
355 | + foreach ($list as $event) |
|
356 | 356 | { |
357 | - if($this->ids && !in_array($event['id'], $this->ids)) continue; |
|
357 | + if ($this->ids && !in_array($event['id'], $this->ids)) continue; |
|
358 | 358 | $start = egw_time::to($event['start'], 'array'); |
359 | 359 | $end = egw_time::to($event['end'], 'array'); |
360 | 360 | $replacements = $this->calendar_replacements($event); |
361 | - if($start['year'] == $end['year'] && $start['month'] == $end['month'] && $start['day'] == $end['day']) { |
|
362 | - $dow = date('l',$event['start']); |
|
361 | + if ($start['year'] == $end['year'] && $start['month'] == $end['month'] && $start['day'] == $end['day']) { |
|
362 | + $dow = date('l', $event['start']); |
|
363 | 363 | } else { |
364 | 364 | $dow = date('l', strtotime($day)); |
365 | 365 | // Fancy date+time formatting for multi-day events |
366 | - $replacements['$$calendar_starttime$$'] = date($time_format, $day == date('Ymd', $event['start']) ? $event['start'] : mktime(0,0,0,0,0,1)); |
|
367 | - $replacements['$$calendar_endtime$$'] = date($time_format, $day == date('Ymd', $event['end']) ? $event['end'] : mktime(23,59,59,0,0,0)); |
|
366 | + $replacements['$$calendar_starttime$$'] = date($time_format, $day == date('Ymd', $event['start']) ? $event['start'] : mktime(0, 0, 0, 0, 0, 1)); |
|
367 | + $replacements['$$calendar_endtime$$'] = date($time_format, $day == date('Ymd', $event['end']) ? $event['end'] : mktime(23, 59, 59, 0, 0, 0)); |
|
368 | 368 | } |
369 | 369 | |
370 | - $days[date('Ymd',$_date)][$dow][] = $replacements; |
|
370 | + $days[date('Ymd', $_date)][$dow][] = $replacements; |
|
371 | 371 | } |
372 | - if(strpos($repeat, 'day/date') !== false || strpos($repeat, 'day/name') !== false) { |
|
372 | + if (strpos($repeat, 'day/date') !== false || strpos($repeat, 'day/name') !== false) { |
|
373 | 373 | $date_marker = array( |
374 | 374 | '$$day/date$$' => date($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'], strtotime($day)), |
375 | 375 | '$$day/name$$' => lang(date('l', strtotime($day))) |
376 | 376 | ); |
377 | - if(!is_array($days[date('Ymd',$_date)][date('l',strtotime($day))])) { |
|
377 | + if (!is_array($days[date('Ymd', $_date)][date('l', strtotime($day))])) { |
|
378 | 378 | $blank = $this->calendar_replacements(array()); |
379 | - foreach($blank as &$value) |
|
379 | + foreach ($blank as &$value) |
|
380 | 380 | { |
381 | 381 | $value = ''; |
382 | 382 | } |
383 | - $days[date('Ymd',$_date)][date('l',strtotime($day))][] = $blank; |
|
383 | + $days[date('Ymd', $_date)][date('l', strtotime($day))][] = $blank; |
|
384 | 384 | } |
385 | - $days[date('Ymd',$_date)][date('l',strtotime($day))][0] += $date_marker; |
|
385 | + $days[date('Ymd', $_date)][date('l', strtotime($day))][0] += $date_marker; |
|
386 | 386 | } |
387 | 387 | } |
388 | - return $days[date('Ymd',$_date)][$plugin][0]; |
|
388 | + return $days[date('Ymd', $_date)][$plugin][0]; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | /** |
@@ -399,27 +399,27 @@ discard block |
||
399 | 399 | * @param string $repeat Text being repeated for each entry |
400 | 400 | * @return array |
401 | 401 | */ |
402 | - public function day($plugin,$id,$n,$repeat) |
|
402 | + public function day($plugin, $id, $n, $repeat) |
|
403 | 403 | { |
404 | 404 | static $days = null; |
405 | 405 | |
406 | 406 | // Figure out which day |
407 | - list($type, $which) = explode('_',$plugin); |
|
408 | - if($type == 'day' && $which) |
|
407 | + list($type, $which) = explode('_', $plugin); |
|
408 | + if ($type == 'day' && $which) |
|
409 | 409 | { |
410 | - if($id[0]['start']) |
|
410 | + if ($id[0]['start']) |
|
411 | 411 | { |
412 | 412 | $dates = array('start' => PHP_INT_MAX, 'end' => 0); |
413 | - foreach($id as $event) { |
|
414 | - if($event['start'] && $event['start'] < $dates['start']) $dates['start'] = $event['start']; |
|
415 | - if($event['end'] && $event['end'] > $dates['end']) $dates['end'] = $event['end']; |
|
413 | + foreach ($id as $event) { |
|
414 | + if ($event['start'] && $event['start'] < $dates['start']) $dates['start'] = $event['start']; |
|
415 | + if ($event['end'] && $event['end'] > $dates['end']) $dates['end'] = $event['end']; |
|
416 | 416 | } |
417 | 417 | $id = $dates; |
418 | 418 | } |
419 | 419 | $arr = $this->bo->date2array($id['start']); |
420 | 420 | $arr['day'] = $which; |
421 | 421 | $date = $this->bo->date2ts($arr); |
422 | - if(is_array($id) && $id['start'] && ($date < $id['start'] || $date > $id['end'])) return array(); |
|
422 | + if (is_array($id) && $id['start'] && ($date < $id['start'] || $date > $id['end'])) return array(); |
|
423 | 423 | } |
424 | 424 | elseif ($plugin == 'selected') |
425 | 425 | { |
@@ -429,64 +429,64 @@ discard block |
||
429 | 429 | { |
430 | 430 | $date = strtotime($plugin); |
431 | 431 | } |
432 | - if($type == 'day' && is_array($id) && !$id['start']) { |
|
432 | + if ($type == 'day' && is_array($id) && !$id['start']) { |
|
433 | 433 | $event = $this->bo->read(is_array($id) ? $id['id'] : $id, is_array($id) ? $id['recur_date'] : null); |
434 | - if($which && date('d',$event['start']) != $which) return array(); |
|
435 | - if(date('Ymd',$date) != date('Ymd', $event['start'])) return array(); |
|
434 | + if ($which && date('d', $event['start']) != $which) return array(); |
|
435 | + if (date('Ymd', $date) != date('Ymd', $event['start'])) return array(); |
|
436 | 436 | return $n == 0 ? $this->calendar_replacements($event) : array(); |
437 | 437 | } |
438 | 438 | |
439 | 439 | // Use start for cache, in case of multiple months |
440 | 440 | $_date = $id['start'] ? $id['start'] : $date; |
441 | - if($days[date('Ymd',$_date)][$plugin]) return $days[date('Ymd',$_date)][$plugin][$n]; |
|
441 | + if ($days[date('Ymd', $_date)][$plugin]) return $days[date('Ymd', $_date)][$plugin][$n]; |
|
442 | 442 | |
443 | 443 | $events = $this->bo->search($this->query + array( |
444 | 444 | 'start' => $date, |
445 | - 'end' => mktime(23,59,59,date('m',$date),date('d',$date),date('Y',$date)), |
|
445 | + 'end' => mktime(23, 59, 59, date('m', $date), date('d', $date), date('Y', $date)), |
|
446 | 446 | 'offset' => 0, |
447 | 447 | 'num_rows' => 20, |
448 | 448 | 'order' => 'cal_start', |
449 | 449 | 'daywise' => true, |
450 | - 'cfs' => array(), // read all custom-fields |
|
450 | + 'cfs' => array(), // read all custom-fields |
|
451 | 451 | )); |
452 | 452 | |
453 | 453 | $replacements = array(); |
454 | 454 | if (true) $days = array(); |
455 | 455 | $time_format = $GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i'; |
456 | - foreach($events as $day => $list) |
|
456 | + foreach ($events as $day => $list) |
|
457 | 457 | { |
458 | - foreach($list as $event) |
|
458 | + foreach ($list as $event) |
|
459 | 459 | { |
460 | - if($this->ids && !in_array($event['id'], $this->ids)) continue; |
|
460 | + if ($this->ids && !in_array($event['id'], $this->ids)) continue; |
|
461 | 461 | $start = egw_time::to($event['start'], 'array'); |
462 | 462 | $end = egw_time::to($event['end'], 'array'); |
463 | 463 | $replacements = $this->calendar_replacements($event); |
464 | - if($start['year'] == $end['year'] && $start['month'] == $end['month'] && $start['day'] == $end['day']) { |
|
464 | + if ($start['year'] == $end['year'] && $start['month'] == $end['month'] && $start['day'] == $end['day']) { |
|
465 | 465 | //$dow = date('l',$event['start']); |
466 | 466 | } else { |
467 | 467 | // Fancy date+time formatting for multi-day events |
468 | - $replacements['$$calendar_starttime$$'] = date($time_format, $day == date('Ymd', $event['start']) ? $event['start'] : mktime(0,0,0,0,0,1)); |
|
469 | - $replacements['$$calendar_endtime$$'] = date($time_format, $day == date('Ymd', $event['end']) ? $event['end'] : mktime(23,59,59,0,0,0)); |
|
468 | + $replacements['$$calendar_starttime$$'] = date($time_format, $day == date('Ymd', $event['start']) ? $event['start'] : mktime(0, 0, 0, 0, 0, 1)); |
|
469 | + $replacements['$$calendar_endtime$$'] = date($time_format, $day == date('Ymd', $event['end']) ? $event['end'] : mktime(23, 59, 59, 0, 0, 0)); |
|
470 | 470 | } |
471 | - $days[date('Ymd',$_date)][$plugin][] = $replacements; |
|
471 | + $days[date('Ymd', $_date)][$plugin][] = $replacements; |
|
472 | 472 | } |
473 | - if(strpos($repeat, 'day/date') !== false || strpos($repeat, 'day/name') !== false) { |
|
473 | + if (strpos($repeat, 'day/date') !== false || strpos($repeat, 'day/name') !== false) { |
|
474 | 474 | $date_marker = array( |
475 | 475 | '$$day/date$$' => date($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'], strtotime($day)), |
476 | 476 | '$$day/name$$' => lang(date('l', strtotime($day))) |
477 | 477 | ); |
478 | - if(!is_array($days[date('Ymd',$_date)][$plugin])) { |
|
478 | + if (!is_array($days[date('Ymd', $_date)][$plugin])) { |
|
479 | 479 | $blank = $this->calendar_replacements(array()); |
480 | - foreach($blank as &$value) |
|
480 | + foreach ($blank as &$value) |
|
481 | 481 | { |
482 | 482 | $value = ''; |
483 | 483 | } |
484 | - $days[date('Ymd',$_date)][$plugin][] = $blank; |
|
484 | + $days[date('Ymd', $_date)][$plugin][] = $blank; |
|
485 | 485 | } |
486 | - $days[date('Ymd',$_date)][$plugin][0] += $date_marker; |
|
486 | + $days[date('Ymd', $_date)][$plugin][0] += $date_marker; |
|
487 | 487 | } |
488 | 488 | } |
489 | - return $days[date('Ymd',$_date)][$plugin][0]; |
|
489 | + return $days[date('Ymd', $_date)][$plugin][0]; |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | /** |
@@ -499,30 +499,30 @@ discard block |
||
499 | 499 | * @param int $n |
500 | 500 | * @return array |
501 | 501 | */ |
502 | - public function participant($plugin,$id,$n) |
|
502 | + public function participant($plugin, $id, $n) |
|
503 | 503 | { |
504 | - unset($plugin); // not used, but required by function signature |
|
504 | + unset($plugin); // not used, but required by function signature |
|
505 | 505 | |
506 | - if(!is_array($id) || !$id['start']) { |
|
506 | + if (!is_array($id) || !$id['start']) { |
|
507 | 507 | $event = $this->bo->read(is_array($id) ? $id['id'] : $id, is_array($id) ? $id['recur_date'] : null); |
508 | 508 | } else { |
509 | 509 | $event = $id; |
510 | 510 | } |
511 | 511 | |
512 | - if(!is_array($event['participants']) || $n >= count($event['participants'])) return array(); |
|
512 | + if (!is_array($event['participants']) || $n >= count($event['participants'])) return array(); |
|
513 | 513 | |
514 | 514 | $participant = null; |
515 | 515 | $status = null; |
516 | 516 | $i = -1; |
517 | - foreach($event['participants'] as $participant => $status) { |
|
518 | - if(++$i == $n) break; |
|
517 | + foreach ($event['participants'] as $participant => $status) { |
|
518 | + if (++$i == $n) break; |
|
519 | 519 | } |
520 | 520 | |
521 | - if(!$participant) return array(); |
|
521 | + if (!$participant) return array(); |
|
522 | 522 | |
523 | 523 | // Add some common information |
524 | 524 | $quantity = $role = null; |
525 | - calendar_so::split_status($status,$quantity,$role); |
|
525 | + calendar_so::split_status($status, $quantity, $role); |
|
526 | 526 | if ($role != 'REQ-PARTICIPANT') |
527 | 527 | { |
528 | 528 | if (isset($this->bo->roles[$role])) |
@@ -530,13 +530,13 @@ discard block |
||
530 | 530 | $role = lang($this->bo->roles[$role]); |
531 | 531 | } |
532 | 532 | // allow to use cats as roles (beside regular iCal ones) |
533 | - elseif (substr($role,0,6) == 'X-CAT-' && ($cat_id = (int)substr($role,6)) > 0) |
|
533 | + elseif (substr($role, 0, 6) == 'X-CAT-' && ($cat_id = (int)substr($role, 6)) > 0) |
|
534 | 534 | { |
535 | 535 | $role = $GLOBALS['egw']->categories->id2name($cat_id); |
536 | 536 | } |
537 | 537 | else |
538 | 538 | { |
539 | - $role = lang(str_replace('X-','',$role)); |
|
539 | + $role = lang(str_replace('X-', '', $role)); |
|
540 | 540 | } |
541 | 541 | } |
542 | 542 | $info = array( |
@@ -549,26 +549,26 @@ discard block |
||
549 | 549 | switch ($participant[0]) |
550 | 550 | { |
551 | 551 | case 'c': |
552 | - $replacements = $this->contact_replacements(substr($participant,1),''); |
|
552 | + $replacements = $this->contact_replacements(substr($participant, 1), ''); |
|
553 | 553 | break; |
554 | 554 | case 'r': |
555 | 555 | if (is_null(self::$resources)) self::$resources = CreateObject('resources.resources_bo'); |
556 | - if (($resource = self::$resources->read(substr($participant,1)))) |
|
556 | + if (($resource = self::$resources->read(substr($participant, 1)))) |
|
557 | 557 | { |
558 | - foreach($resource as $name => $value) |
|
558 | + foreach ($resource as $name => $value) |
|
559 | 559 | { |
560 | 560 | $replacements['$$'.$name.'$$'] = $value; |
561 | 561 | } |
562 | 562 | } |
563 | 563 | break; |
564 | 564 | default: |
565 | - if (is_numeric($participant) && ($contact = $GLOBALS['egw']->accounts->id2name($participant,'person_id'))) |
|
565 | + if (is_numeric($participant) && ($contact = $GLOBALS['egw']->accounts->id2name($participant, 'person_id'))) |
|
566 | 566 | { |
567 | - $replacements = $this->contact_replacements($contact,''); |
|
567 | + $replacements = $this->contact_replacements($contact, ''); |
|
568 | 568 | } |
569 | 569 | break; |
570 | 570 | } |
571 | - foreach($info as $name => $value) |
|
571 | + foreach ($info as $name => $value) |
|
572 | 572 | { |
573 | 573 | $replacements['$$'.$name.'$$'] = $value; |
574 | 574 | } |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | echo '<tr><td colspan="4"><h3>'.lang('Calendar fields:')."</h3></td></tr>"; |
591 | 591 | |
592 | 592 | $n = 0; |
593 | - foreach(array( |
|
593 | + foreach (array( |
|
594 | 594 | 'calendar_id' => lang('Calendar ID'), |
595 | 595 | 'calendar_title' => lang('Title'), |
596 | 596 | 'calendar_description' => lang('Description'), |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | 'calendar_owner' => lang('Owner'), |
614 | 614 | ) as $name => $label) |
615 | 615 | { |
616 | - if (in_array($name,array('start','end')) && $n&1) // main values, which should be in the first column |
|
616 | + if (in_array($name, array('start', 'end')) && $n&1) // main values, which should be in the first column |
|
617 | 617 | { |
618 | 618 | echo "</tr>\n"; |
619 | 619 | $n++; |
@@ -626,13 +626,13 @@ discard block |
||
626 | 626 | |
627 | 627 | echo '<tr><td colspan="4"><h3>'.lang('Range fields').":</h3></td></tr>"; |
628 | 628 | echo '<tr><td colspan="4">'.lang('If you select a range (month, week, etc) instead of a list of entries, these extra fields are available').'</td></tr>'; |
629 | - foreach(array_keys(self::$range_tags) as $name) |
|
629 | + foreach (array_keys(self::$range_tags) as $name) |
|
630 | 630 | { |
631 | 631 | echo '<tr><td>{{range/'.$name.'}}</td><td>'.lang($name)."</td></tr>\n"; |
632 | 632 | } |
633 | 633 | echo '<tr><td colspan="4"><h3>'.lang('Custom fields').":</h3></td></tr>"; |
634 | 634 | $custom = config::get_customfields('calendar'); |
635 | - foreach($custom as $name => $field) |
|
635 | + foreach ($custom as $name => $field) |
|
636 | 636 | { |
637 | 637 | echo '<tr><td>{{#'.$name.'}}</td><td colspan="3">'.$field['label']."</td></tr>\n"; |
638 | 638 | } |
@@ -641,9 +641,9 @@ discard block |
||
641 | 641 | echo '<tr><td colspan="4"><h3>'.lang('Participants').":</h3></td></tr>"; |
642 | 642 | echo '<tr><td>{{calendar_participants/account}}</td><td colspan="3">'.lang('Accounts')."</td></tr>\n"; |
643 | 643 | echo '<tr><td>{{calendar_participants/group}}</td><td colspan="3">'.lang('Groups')."</td></tr>\n"; |
644 | - foreach($this->bo->resources as $resource) |
|
644 | + foreach ($this->bo->resources as $resource) |
|
645 | 645 | { |
646 | - if($resource['type']) |
|
646 | + if ($resource['type']) |
|
647 | 647 | { |
648 | 648 | echo '<tr><td>{{calendar_participants/'.$resource['app'].'}}</td><td colspan="3">'.lang($resource['app'])."</td></tr>\n"; |
649 | 649 | } |
@@ -660,19 +660,19 @@ discard block |
||
660 | 660 | echo '<tr style="vertical-align:top"><td colspan="2"><table >'; |
661 | 661 | echo '<tr><td><h3>'.lang('Day of week tables').":</h3></td></tr>"; |
662 | 662 | $days = array(); |
663 | - for($i = 0; $i < 7; $i++) |
|
663 | + for ($i = 0; $i < 7; $i++) |
|
664 | 664 | { |
665 | - $days[date('N',strtotime("+$i days"))] = date('l',strtotime("+$i days")); |
|
665 | + $days[date('N', strtotime("+$i days"))] = date('l', strtotime("+$i days")); |
|
666 | 666 | } |
667 | 667 | ksort($days); |
668 | - foreach($days as $day) |
|
668 | + foreach ($days as $day) |
|
669 | 669 | { |
670 | - echo '<tr><td>{{table/'.$day. '}} ... {{endtable}}</td></tr>'; |
|
670 | + echo '<tr><td>{{table/'.$day.'}} ... {{endtable}}</td></tr>'; |
|
671 | 671 | } |
672 | 672 | echo '</table></td><td colspan="2"><table >'; |
673 | 673 | echo '<tr><td><h3>'.lang('Daily tables').":</h3></td></tr>"; |
674 | - foreach(self::$relative as $value) { |
|
675 | - echo '<tr><td>{{table/'.$value. '}} ... {{endtable}}</td></tr>'; |
|
674 | + foreach (self::$relative as $value) { |
|
675 | + echo '<tr><td>{{table/'.$value.'}} ... {{endtable}}</td></tr>'; |
|
676 | 676 | } |
677 | 677 | echo '<tr><td>{{table/day_n}} ... {{endtable}}</td><td>1 <= n <= 31</td></tr>'; |
678 | 678 | echo '</table></td></tr>'; |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | echo '<tr><td>{{day/name}}</td><td colspan="3">'.lang('Name of the week (ex: Monday), available for the first entry inside each day of week or daily table inside the selected range.').'</td></tr>'; |
681 | 681 | |
682 | 682 | echo '<tr><td colspan="4"><h3>'.lang('General fields:')."</h3></td></tr>"; |
683 | - foreach(array( |
|
683 | + foreach (array( |
|
684 | 684 | 'link' => lang('HTML link to the current record'), |
685 | 685 | 'links' => lang('Titles of any entries linked to the current record, excluding attached files'), |
686 | 686 | 'attachments' => lang('List of files linked to the current record'), |
@@ -86,10 +86,12 @@ discard block |
||
86 | 86 | { |
87 | 87 | $this->table_plugins[date('l', strtotime("+$i days"))] = 'day_plugin'; |
88 | 88 | } |
89 | - for($i = 1; $i <= 31; $i++) { |
|
89 | + for($i = 1; $i <= 31; $i++) |
|
90 | + { |
|
90 | 91 | $this->table_plugins['day_'.$i] = 'day'; // Numerically by day number (1-31) |
91 | 92 | } |
92 | - foreach(self::$relative as $day) { |
|
93 | + foreach(self::$relative as $day) |
|
94 | + { |
|
93 | 95 | $this->table_plugins[$day] = 'day'; // Current day |
94 | 96 | } |
95 | 97 | $this->query = $GLOBALS['egw']->session->appsession('session_data','calendar'); |
@@ -125,9 +127,16 @@ discard block |
||
125 | 127 | $events = $ids; |
126 | 128 | $ids = array('start' => PHP_INT_MAX, 'end' => 0); |
127 | 129 | $this->ids = array(); |
128 | - foreach($events as $event) { |
|
129 | - if($event['start'] && egw_time::to($event['start'],'ts') < $ids['start']) $ids['start'] = egw_time::to($event['start'],'ts'); |
|
130 | - if($event['end'] && egw_time::to($event['end'],'ts') > $ids['end']) $ids['end'] = egw_time::to($event['end'],'ts'); |
|
130 | + foreach($events as $event) |
|
131 | + { |
|
132 | + if($event['start'] && egw_time::to($event['start'],'ts') < $ids['start']) |
|
133 | + { |
|
134 | + $ids['start'] = egw_time::to($event['start'],'ts'); |
|
135 | + } |
|
136 | + if($event['end'] && egw_time::to($event['end'],'ts') > $ids['end']) |
|
137 | + { |
|
138 | + $ids['end'] = egw_time::to($event['end'],'ts'); |
|
139 | + } |
|
131 | 140 | // Keep ids for future use |
132 | 141 | $this->ids[] = $event['id']; |
133 | 142 | } |
@@ -167,9 +176,16 @@ discard block |
||
167 | 176 | $events = $id; |
168 | 177 | $id = array('start' => PHP_INT_MAX, 'end' => 0); |
169 | 178 | $this->ids = array(); |
170 | - foreach($events as $event) { |
|
171 | - if($event['start'] && $event['start'] < $id['start']) $id['start'] = $event['start']; |
|
172 | - if($event['end'] && $event['end'] > $id['end']) $id['end'] = $event['end']; |
|
179 | + foreach($events as $event) |
|
180 | + { |
|
181 | + if($event['start'] && $event['start'] < $id['start']) |
|
182 | + { |
|
183 | + $id['start'] = $event['start']; |
|
184 | + } |
|
185 | + if($event['end'] && $event['end'] > $id['end']) |
|
186 | + { |
|
187 | + $id['end'] = $event['end']; |
|
188 | + } |
|
173 | 189 | // Keep ids for future use |
174 | 190 | $this->ids[] = $event['id']; |
175 | 191 | } |
@@ -196,7 +212,10 @@ discard block |
||
196 | 212 | foreach(self::$range_tags as $key => $format) |
197 | 213 | { |
198 | 214 | $value = date($format, $key == 'end' ? $id['end'] : $id['start']); |
199 | - if($key == 'month') $value = lang($value); |
|
215 | + if($key == 'month') |
|
216 | + { |
|
217 | + $value = lang($value); |
|
218 | + } |
|
200 | 219 | $values["$\$range/$key$$"] = $value; |
201 | 220 | } |
202 | 221 | } |
@@ -215,9 +234,12 @@ discard block |
||
215 | 234 | public function calendar_replacements($id,$prefix = '', &$content = '') |
216 | 235 | { |
217 | 236 | $replacements = array(); |
218 | - if(!is_array($id) || !$id['start']) { |
|
237 | + if(!is_array($id) || !$id['start']) |
|
238 | + { |
|
219 | 239 | $event = $this->bo->read(is_array($id) ? $id['id'] : $id, is_array($id) ? $id['recur_date'] : null); |
220 | - } else { |
|
240 | + } |
|
241 | + else |
|
242 | + { |
|
221 | 243 | $event = $id; |
222 | 244 | } |
223 | 245 | |
@@ -236,7 +258,10 @@ discard block |
||
236 | 258 | $replacements['$$' . ($prefix ? $prefix . '/' : '') . 'calendar_id'. '$$'] = $event['id']; |
237 | 259 | foreach($this->bo->event2array($event) as $name => $data) |
238 | 260 | { |
239 | - if (substr($name,-4) == 'date') $name = substr($name,0,-4); |
|
261 | + if (substr($name,-4) == 'date') |
|
262 | + { |
|
263 | + $name = substr($name,0,-4); |
|
264 | + } |
|
240 | 265 | $replacements['$$' . ($prefix ? $prefix . '/' : '') . 'calendar_'.$name . '$$'] = is_array($data['data']) ? implode(', ',$data['data']) : $data['data']; |
241 | 266 | } |
242 | 267 | // Add seperate lists of participants by type |
@@ -275,7 +300,10 @@ discard block |
||
275 | 300 | ) as $name => $format) |
276 | 301 | { |
277 | 302 | $value = egw_time::to($event[$what],$format); |
278 | - if ($format == 'l') $value = lang($value); |
|
303 | + if ($format == 'l') |
|
304 | + { |
|
305 | + $value = lang($value); |
|
306 | + } |
|
279 | 307 | $replacements['$$' .($prefix ? $prefix.'/':'').'calendar_'.$what.$name.'$$'] = $value; |
280 | 308 | } |
281 | 309 | } |
@@ -318,24 +346,41 @@ discard block |
||
318 | 346 | public function day_plugin($plugin,$date,$n,$repeat) |
319 | 347 | { |
320 | 348 | static $days = null; |
321 | - if(is_array($date) && !$date['start']) { |
|
349 | + if(is_array($date) && !$date['start']) |
|
350 | + { |
|
322 | 351 | // List of IDs |
323 | - if($date[0]['start']) { |
|
352 | + if($date[0]['start']) |
|
353 | + { |
|
324 | 354 | $id = array('start' => PHP_INT_MAX, 'end' => 0); |
325 | - foreach($date as $event) { |
|
326 | - if($event['start'] && $event['start'] < $id['start']) $id['start'] = $event['start']; |
|
327 | - if($event['end'] && $event['end'] > $id['end']) $id['end'] = $event['end']; |
|
355 | + foreach($date as $event) |
|
356 | + { |
|
357 | + if($event['start'] && $event['start'] < $id['start']) |
|
358 | + { |
|
359 | + $id['start'] = $event['start']; |
|
360 | + } |
|
361 | + if($event['end'] && $event['end'] > $id['end']) |
|
362 | + { |
|
363 | + $id['end'] = $event['end']; |
|
364 | + } |
|
328 | 365 | } |
329 | 366 | $date = $id; |
330 | - } else { |
|
367 | + } |
|
368 | + else |
|
369 | + { |
|
331 | 370 | $event = $this->bo->read(is_array($date) ? $date['id'] : $date, is_array($date) ? $date['recur_date'] : null); |
332 | - if(date('l',$event['start']) != $plugin) return array(); |
|
371 | + if(date('l',$event['start']) != $plugin) |
|
372 | + { |
|
373 | + return array(); |
|
374 | + } |
|
333 | 375 | $date = $event['start']; |
334 | 376 | } |
335 | 377 | } |
336 | 378 | |
337 | 379 | $_date = $date['start'] ? $date['start'] : $date; |
338 | - if($days[date('Ymd',$_date)][$plugin]) return $days[date('Ymd',$_date)][$plugin][$n]; |
|
380 | + if($days[date('Ymd',$_date)][$plugin]) |
|
381 | + { |
|
382 | + return $days[date('Ymd',$_date)][$plugin][$n]; |
|
383 | + } |
|
339 | 384 | |
340 | 385 | $events = $this->bo->search($this->query + array( |
341 | 386 | 'start' => $date['end'] ? $date['start'] : mktime(0,0,0,date('m',$_date),date('d',$_date),date('Y',$_date)), |
@@ -347,20 +392,29 @@ discard block |
||
347 | 392 | 'cfs' => array(), // read all custom-fields |
348 | 393 | )); |
349 | 394 | |
350 | - if (true) $days = array(); |
|
395 | + if (true) |
|
396 | + { |
|
397 | + $days = array(); |
|
398 | + } |
|
351 | 399 | $replacements = array(); |
352 | 400 | $time_format = $GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i'; |
353 | 401 | foreach($events as $day => $list) |
354 | 402 | { |
355 | 403 | foreach($list as $event) |
356 | 404 | { |
357 | - if($this->ids && !in_array($event['id'], $this->ids)) continue; |
|
405 | + if($this->ids && !in_array($event['id'], $this->ids)) |
|
406 | + { |
|
407 | + continue; |
|
408 | + } |
|
358 | 409 | $start = egw_time::to($event['start'], 'array'); |
359 | 410 | $end = egw_time::to($event['end'], 'array'); |
360 | 411 | $replacements = $this->calendar_replacements($event); |
361 | - if($start['year'] == $end['year'] && $start['month'] == $end['month'] && $start['day'] == $end['day']) { |
|
412 | + if($start['year'] == $end['year'] && $start['month'] == $end['month'] && $start['day'] == $end['day']) |
|
413 | + { |
|
362 | 414 | $dow = date('l',$event['start']); |
363 | - } else { |
|
415 | + } |
|
416 | + else |
|
417 | + { |
|
364 | 418 | $dow = date('l', strtotime($day)); |
365 | 419 | // Fancy date+time formatting for multi-day events |
366 | 420 | $replacements['$$calendar_starttime$$'] = date($time_format, $day == date('Ymd', $event['start']) ? $event['start'] : mktime(0,0,0,0,0,1)); |
@@ -369,12 +423,14 @@ discard block |
||
369 | 423 | |
370 | 424 | $days[date('Ymd',$_date)][$dow][] = $replacements; |
371 | 425 | } |
372 | - if(strpos($repeat, 'day/date') !== false || strpos($repeat, 'day/name') !== false) { |
|
426 | + if(strpos($repeat, 'day/date') !== false || strpos($repeat, 'day/name') !== false) |
|
427 | + { |
|
373 | 428 | $date_marker = array( |
374 | 429 | '$$day/date$$' => date($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'], strtotime($day)), |
375 | 430 | '$$day/name$$' => lang(date('l', strtotime($day))) |
376 | 431 | ); |
377 | - if(!is_array($days[date('Ymd',$_date)][date('l',strtotime($day))])) { |
|
432 | + if(!is_array($days[date('Ymd',$_date)][date('l',strtotime($day))])) |
|
433 | + { |
|
378 | 434 | $blank = $this->calendar_replacements(array()); |
379 | 435 | foreach($blank as &$value) |
380 | 436 | { |
@@ -410,16 +466,26 @@ discard block |
||
410 | 466 | if($id[0]['start']) |
411 | 467 | { |
412 | 468 | $dates = array('start' => PHP_INT_MAX, 'end' => 0); |
413 | - foreach($id as $event) { |
|
414 | - if($event['start'] && $event['start'] < $dates['start']) $dates['start'] = $event['start']; |
|
415 | - if($event['end'] && $event['end'] > $dates['end']) $dates['end'] = $event['end']; |
|
469 | + foreach($id as $event) |
|
470 | + { |
|
471 | + if($event['start'] && $event['start'] < $dates['start']) |
|
472 | + { |
|
473 | + $dates['start'] = $event['start']; |
|
474 | + } |
|
475 | + if($event['end'] && $event['end'] > $dates['end']) |
|
476 | + { |
|
477 | + $dates['end'] = $event['end']; |
|
478 | + } |
|
416 | 479 | } |
417 | 480 | $id = $dates; |
418 | 481 | } |
419 | 482 | $arr = $this->bo->date2array($id['start']); |
420 | 483 | $arr['day'] = $which; |
421 | 484 | $date = $this->bo->date2ts($arr); |
422 | - if(is_array($id) && $id['start'] && ($date < $id['start'] || $date > $id['end'])) return array(); |
|
485 | + if(is_array($id) && $id['start'] && ($date < $id['start'] || $date > $id['end'])) |
|
486 | + { |
|
487 | + return array(); |
|
488 | + } |
|
423 | 489 | } |
424 | 490 | elseif ($plugin == 'selected') |
425 | 491 | { |
@@ -429,16 +495,26 @@ discard block |
||
429 | 495 | { |
430 | 496 | $date = strtotime($plugin); |
431 | 497 | } |
432 | - if($type == 'day' && is_array($id) && !$id['start']) { |
|
498 | + if($type == 'day' && is_array($id) && !$id['start']) |
|
499 | + { |
|
433 | 500 | $event = $this->bo->read(is_array($id) ? $id['id'] : $id, is_array($id) ? $id['recur_date'] : null); |
434 | - if($which && date('d',$event['start']) != $which) return array(); |
|
435 | - if(date('Ymd',$date) != date('Ymd', $event['start'])) return array(); |
|
501 | + if($which && date('d',$event['start']) != $which) |
|
502 | + { |
|
503 | + return array(); |
|
504 | + } |
|
505 | + if(date('Ymd',$date) != date('Ymd', $event['start'])) |
|
506 | + { |
|
507 | + return array(); |
|
508 | + } |
|
436 | 509 | return $n == 0 ? $this->calendar_replacements($event) : array(); |
437 | 510 | } |
438 | 511 | |
439 | 512 | // Use start for cache, in case of multiple months |
440 | 513 | $_date = $id['start'] ? $id['start'] : $date; |
441 | - if($days[date('Ymd',$_date)][$plugin]) return $days[date('Ymd',$_date)][$plugin][$n]; |
|
514 | + if($days[date('Ymd',$_date)][$plugin]) |
|
515 | + { |
|
516 | + return $days[date('Ymd',$_date)][$plugin][$n]; |
|
517 | + } |
|
442 | 518 | |
443 | 519 | $events = $this->bo->search($this->query + array( |
444 | 520 | 'start' => $date, |
@@ -451,31 +527,42 @@ discard block |
||
451 | 527 | )); |
452 | 528 | |
453 | 529 | $replacements = array(); |
454 | - if (true) $days = array(); |
|
530 | + if (true) |
|
531 | + { |
|
532 | + $days = array(); |
|
533 | + } |
|
455 | 534 | $time_format = $GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == 12 ? 'h:i a' : 'H:i'; |
456 | 535 | foreach($events as $day => $list) |
457 | 536 | { |
458 | 537 | foreach($list as $event) |
459 | 538 | { |
460 | - if($this->ids && !in_array($event['id'], $this->ids)) continue; |
|
539 | + if($this->ids && !in_array($event['id'], $this->ids)) |
|
540 | + { |
|
541 | + continue; |
|
542 | + } |
|
461 | 543 | $start = egw_time::to($event['start'], 'array'); |
462 | 544 | $end = egw_time::to($event['end'], 'array'); |
463 | 545 | $replacements = $this->calendar_replacements($event); |
464 | - if($start['year'] == $end['year'] && $start['month'] == $end['month'] && $start['day'] == $end['day']) { |
|
546 | + if($start['year'] == $end['year'] && $start['month'] == $end['month'] && $start['day'] == $end['day']) |
|
547 | + { |
|
465 | 548 | //$dow = date('l',$event['start']); |
466 | - } else { |
|
549 | + } |
|
550 | + else |
|
551 | + { |
|
467 | 552 | // Fancy date+time formatting for multi-day events |
468 | 553 | $replacements['$$calendar_starttime$$'] = date($time_format, $day == date('Ymd', $event['start']) ? $event['start'] : mktime(0,0,0,0,0,1)); |
469 | 554 | $replacements['$$calendar_endtime$$'] = date($time_format, $day == date('Ymd', $event['end']) ? $event['end'] : mktime(23,59,59,0,0,0)); |
470 | 555 | } |
471 | 556 | $days[date('Ymd',$_date)][$plugin][] = $replacements; |
472 | 557 | } |
473 | - if(strpos($repeat, 'day/date') !== false || strpos($repeat, 'day/name') !== false) { |
|
558 | + if(strpos($repeat, 'day/date') !== false || strpos($repeat, 'day/name') !== false) |
|
559 | + { |
|
474 | 560 | $date_marker = array( |
475 | 561 | '$$day/date$$' => date($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'], strtotime($day)), |
476 | 562 | '$$day/name$$' => lang(date('l', strtotime($day))) |
477 | 563 | ); |
478 | - if(!is_array($days[date('Ymd',$_date)][$plugin])) { |
|
564 | + if(!is_array($days[date('Ymd',$_date)][$plugin])) |
|
565 | + { |
|
479 | 566 | $blank = $this->calendar_replacements(array()); |
480 | 567 | foreach($blank as &$value) |
481 | 568 | { |
@@ -503,22 +590,35 @@ discard block |
||
503 | 590 | { |
504 | 591 | unset($plugin); // not used, but required by function signature |
505 | 592 | |
506 | - if(!is_array($id) || !$id['start']) { |
|
593 | + if(!is_array($id) || !$id['start']) |
|
594 | + { |
|
507 | 595 | $event = $this->bo->read(is_array($id) ? $id['id'] : $id, is_array($id) ? $id['recur_date'] : null); |
508 | - } else { |
|
596 | + } |
|
597 | + else |
|
598 | + { |
|
509 | 599 | $event = $id; |
510 | 600 | } |
511 | 601 | |
512 | - if(!is_array($event['participants']) || $n >= count($event['participants'])) return array(); |
|
602 | + if(!is_array($event['participants']) || $n >= count($event['participants'])) |
|
603 | + { |
|
604 | + return array(); |
|
605 | + } |
|
513 | 606 | |
514 | 607 | $participant = null; |
515 | 608 | $status = null; |
516 | 609 | $i = -1; |
517 | - foreach($event['participants'] as $participant => $status) { |
|
518 | - if(++$i == $n) break; |
|
610 | + foreach($event['participants'] as $participant => $status) |
|
611 | + { |
|
612 | + if(++$i == $n) |
|
613 | + { |
|
614 | + break; |
|
615 | + } |
|
519 | 616 | } |
520 | 617 | |
521 | - if(!$participant) return array(); |
|
618 | + if(!$participant) |
|
619 | + { |
|
620 | + return array(); |
|
621 | + } |
|
522 | 622 | |
523 | 623 | // Add some common information |
524 | 624 | $quantity = $role = null; |
@@ -552,7 +652,10 @@ discard block |
||
552 | 652 | $replacements = $this->contact_replacements(substr($participant,1),''); |
553 | 653 | break; |
554 | 654 | case 'r': |
555 | - if (is_null(self::$resources)) self::$resources = CreateObject('resources.resources_bo'); |
|
655 | + if (is_null(self::$resources)) |
|
656 | + { |
|
657 | + self::$resources = CreateObject('resources.resources_bo'); |
|
658 | + } |
|
556 | 659 | if (($resource = self::$resources->read(substr($participant,1)))) |
557 | 660 | { |
558 | 661 | foreach($resource as $name => $value) |
@@ -613,14 +716,23 @@ discard block |
||
613 | 716 | 'calendar_owner' => lang('Owner'), |
614 | 717 | ) as $name => $label) |
615 | 718 | { |
616 | - if (in_array($name,array('start','end')) && $n&1) // main values, which should be in the first column |
|
719 | + if (in_array($name,array('start','end')) && $n&1) |
|
720 | + { |
|
721 | + // main values, which should be in the first column |
|
617 | 722 | { |
618 | 723 | echo "</tr>\n"; |
724 | + } |
|
619 | 725 | $n++; |
620 | 726 | } |
621 | - if (!($n&1)) echo '<tr>'; |
|
727 | + if (!($n&1)) |
|
728 | + { |
|
729 | + echo '<tr>'; |
|
730 | + } |
|
622 | 731 | echo '<td>{{'.$name.'}}</td><td>'.$label.'</td>'; |
623 | - if ($n&1) echo "</tr>\n"; |
|
732 | + if ($n&1) |
|
733 | + { |
|
734 | + echo "</tr>\n"; |
|
735 | + } |
|
624 | 736 | $n++; |
625 | 737 | } |
626 | 738 | |
@@ -671,7 +783,8 @@ discard block |
||
671 | 783 | } |
672 | 784 | echo '</table></td><td colspan="2"><table >'; |
673 | 785 | echo '<tr><td><h3>'.lang('Daily tables').":</h3></td></tr>"; |
674 | - foreach(self::$relative as $value) { |
|
786 | + foreach(self::$relative as $value) |
|
787 | + { |
|
675 | 788 | echo '<tr><td>{{table/'.$value. '}} ... {{endtable}}</td></tr>'; |
676 | 789 | } |
677 | 790 | echo '<tr><td>{{table/day_n}} ... {{endtable}}</td><td>1 <= n <= 31</td></tr>'; |
@@ -323,17 +323,17 @@ |
||
323 | 323 | $days = $states['days']; |
324 | 324 | $ui = new calendar_uiviews($states); |
325 | 325 | if (!$days) |
326 | - { |
|
327 | - $days = isset($_GET['days']) ? $_GET['days'] : $ui->cal_prefs['days_in_weekview']; |
|
328 | - if ($days != 5) $days = 7; |
|
329 | - } |
|
326 | + { |
|
327 | + $days = isset($_GET['days']) ? $_GET['days'] : $ui->cal_prefs['days_in_weekview']; |
|
328 | + if ($days != 5) $days = 7; |
|
329 | + } |
|
330 | 330 | if ($states['view'] == 'week' && $days == 4) // next 4 days view |
331 | - { |
|
332 | - $query['start'] = $this->bo->date2ts($states['date']); |
|
333 | - $query['end'] = strtotime("+$days days",$query['start']) - 1; |
|
334 | - } |
|
335 | - else |
|
336 | - { |
|
331 | + { |
|
332 | + $query['start'] = $this->bo->date2ts($states['date']); |
|
333 | + $query['end'] = strtotime("+$days days",$query['start']) - 1; |
|
334 | + } |
|
335 | + else |
|
336 | + { |
|
337 | 337 | $query['start'] = $ui->datetime->get_weekday_start($states['year'],$states['month'],$states['day']); |
338 | 338 | if ($days == 5) // no weekend-days |
339 | 339 | { |
@@ -29,7 +29,7 @@ |
||
29 | 29 | /** |
30 | 30 | * Exports records as defined in $_definition |
31 | 31 | * |
32 | - * @param egw_record $_definition |
|
32 | + * @param importexport_definition $_definition |
|
33 | 33 | */ |
34 | 34 | public function export( $_stream, importexport_definition $_definition) { |
35 | 35 | $options = $_definition->plugin_options; |
@@ -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 |
@@ -14,9 +14,11 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * export CSV plugin of calendar |
16 | 16 | */ |
17 | -class calendar_export_csv implements importexport_iface_export_plugin { |
|
17 | +class calendar_export_csv implements importexport_iface_export_plugin |
|
18 | +{ |
|
18 | 19 | |
19 | - public function __construct() { |
|
20 | + public function __construct() |
|
21 | + { |
|
20 | 22 | translation::add_app('calendar'); |
21 | 23 | $this->bo = new calendar_bo(); |
22 | 24 | $this->get_selects(); |
@@ -27,15 +29,23 @@ discard block |
||
27 | 29 | * |
28 | 30 | * @param egw_record $_definition |
29 | 31 | */ |
30 | - public function export( $_stream, importexport_definition $_definition) { |
|
32 | + public function export( $_stream, importexport_definition $_definition) |
|
33 | + { |
|
31 | 34 | $options = $_definition->plugin_options; |
32 | 35 | |
33 | 36 | $limit_exception = bo_merge::is_export_limit_excepted(); |
34 | - if (!$limit_exception) $export_limit = bo_merge::getExportLimit('calendar'); |
|
37 | + if (!$limit_exception) |
|
38 | + { |
|
39 | + $export_limit = bo_merge::getExportLimit('calendar'); |
|
40 | + } |
|
35 | 41 | // Custom fields need to be specifically requested |
36 | 42 | $cfs = array(); |
37 | - foreach($options['mapping'] + (array)$_definition->filter as $key => $label) { |
|
38 | - if($key[0] == '#') $cfs[] = substr($key,1); |
|
43 | + foreach($options['mapping'] + (array)$_definition->filter as $key => $label) |
|
44 | + { |
|
45 | + if($key[0] == '#') |
|
46 | + { |
|
47 | + $cfs[] = substr($key,1); |
|
48 | + } |
|
39 | 49 | } |
40 | 50 | |
41 | 51 | $query = array( |
@@ -55,7 +65,8 @@ discard block |
||
55 | 65 | 'users' => $options['criteria']['owner'], |
56 | 66 | 'cfs' => $cfs // Otherwise we shouldn't get any custom fields |
57 | 67 | ); |
58 | - if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
68 | + if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) |
|
69 | + { |
|
59 | 70 | $query['offset'] = 0; |
60 | 71 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
61 | 72 | } |
@@ -63,28 +74,34 @@ discard block |
||
63 | 74 | break; |
64 | 75 | case 'search_results': |
65 | 76 | $states = $GLOBALS['egw']->session->appsession('session_data','calendar'); |
66 | - if($states['view'] == 'listview') { |
|
77 | + if($states['view'] == 'listview') |
|
78 | + { |
|
67 | 79 | $query = $GLOBALS['egw']->session->appsession('calendar_list','calendar'); |
68 | 80 | $query['num_rows'] = -1; // all |
69 | 81 | $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
70 | 82 | $query['start'] = 0; |
71 | 83 | $query['cfs'] = $cfs; |
72 | 84 | |
73 | - if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
85 | + if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) |
|
86 | + { |
|
74 | 87 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
75 | 88 | } |
76 | 89 | $ui = new calendar_uilist(); |
77 | 90 | $ui->get_rows($query, $events, $unused); |
78 | - } else { |
|
91 | + } |
|
92 | + else |
|
93 | + { |
|
79 | 94 | $query = $GLOBALS['egw']->session->appsession('session_data','calendar'); |
80 | 95 | $query['users'] = explode(',', $query['owner']); |
81 | 96 | $query['num_rows'] = -1; |
82 | - if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
97 | + if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) |
|
98 | + { |
|
83 | 99 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
84 | 100 | } |
85 | 101 | |
86 | 102 | $events = array(); |
87 | - switch($states['view']) { |
|
103 | + switch($states['view']) |
|
104 | + { |
|
88 | 105 | case 'month': |
89 | 106 | $query += $this->get_query_month($states); |
90 | 107 | break; |
@@ -136,8 +153,14 @@ discard block |
||
136 | 153 | } |
137 | 154 | |
138 | 155 | // Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10) |
139 | - if($value['from']) $query['sql_filter'][] = "cal_$field >= " . (int)$value['from']; |
|
140 | - if($value['to']) $query['sql_filter'][] = "cal_$field <= " . (int)$value['to']; |
|
156 | + if($value['from']) |
|
157 | + { |
|
158 | + $query['sql_filter'][] = "cal_$field >= " . (int)$value['from']; |
|
159 | + } |
|
160 | + if($value['to']) |
|
161 | + { |
|
162 | + $query['sql_filter'][] = "cal_$field <= " . (int)$value['to']; |
|
163 | + } |
|
141 | 164 | |
142 | 165 | } |
143 | 166 | if($query['sql_filter'] && is_array($query['sql_filter'])) |
@@ -155,36 +178,52 @@ discard block |
||
155 | 178 | } |
156 | 179 | |
157 | 180 | $export_object = new importexport_export_csv($_stream, (array)$options); |
158 | - if (!$limit_exception) $export_object->export_limit = $export_limit; |
|
181 | + if (!$limit_exception) |
|
182 | + { |
|
183 | + $export_object->export_limit = $export_limit; |
|
184 | + } |
|
159 | 185 | $export_object->set_mapping($options['mapping']); |
160 | 186 | $convert_fields = calendar_egw_record::$types; |
161 | 187 | |
162 | 188 | $recurrence = $this->bo->recur_types; |
163 | 189 | |
164 | 190 | $record = new calendar_egw_record(); |
165 | - foreach ($events as $event) { |
|
191 | + foreach ($events as $event) |
|
192 | + { |
|
166 | 193 | // the condition below (2 lines) may only work on enum_recuring=false and using the iterator to test an recurring event on the given timerange |
167 | 194 | // Get rid of yearly recurring events that don't belong |
168 | 195 | //if($options['selection']['select'] == 'criteria' && ($event['start'] > $query['end'] || $event['end'] < $query['start'])) continue; |
169 | 196 | // Add in participants |
170 | - if($options['mapping']['participants']) { |
|
197 | + if($options['mapping']['participants']) |
|
198 | + { |
|
171 | 199 | $event['participants'] = implode(", ",$this->bo->participants($event,true)); |
172 | 200 | } |
173 | 201 | if (is_array($event)) |
174 | 202 | { |
175 | 203 | $record->set_record($event); |
176 | - if($options['mapping']['recurrence']) { |
|
204 | + if($options['mapping']['recurrence']) |
|
205 | + { |
|
177 | 206 | $record->recurrence = $recurrence[$record->recur_type]; |
178 | - if($record->recur_type != MCAL_RECUR_NONE) $record->recurrence .= ' / '. $record->recur_interval; |
|
207 | + if($record->recur_type != MCAL_RECUR_NONE) |
|
208 | + { |
|
209 | + $record->recurrence .= ' / '. $record->recur_interval; |
|
210 | + } |
|
179 | 211 | } |
180 | 212 | |
181 | 213 | // Standard stuff |
182 | - if($options['convert']) { |
|
214 | + if($options['convert']) |
|
215 | + { |
|
183 | 216 | importexport_export_csv::convert($record, $convert_fields, 'calendar', $this->selects); |
184 | - } else { |
|
217 | + } |
|
218 | + else |
|
219 | + { |
|
185 | 220 | // Implode arrays, so they don't say 'Array' |
186 | - foreach($record->get_record_array() as $key => $value) { |
|
187 | - if(is_array($value)) $record->$key = implode(',', $value); |
|
221 | + foreach($record->get_record_array() as $key => $value) |
|
222 | + { |
|
223 | + if(is_array($value)) |
|
224 | + { |
|
225 | + $record->$key = implode(',', $value); |
|
226 | + } |
|
188 | 227 | } |
189 | 228 | } |
190 | 229 | $export_object->export_record($record); |
@@ -199,7 +238,8 @@ discard block |
||
199 | 238 | * |
200 | 239 | * @return string name |
201 | 240 | */ |
202 | - public static function get_name() { |
|
241 | + public static function get_name() |
|
242 | + { |
|
203 | 243 | return lang('Calendar CSV export'); |
204 | 244 | } |
205 | 245 | |
@@ -208,7 +248,8 @@ discard block |
||
208 | 248 | * |
209 | 249 | * @return string descriprion |
210 | 250 | */ |
211 | - public static function get_description() { |
|
251 | + public static function get_description() |
|
252 | + { |
|
212 | 253 | return lang("Exports events from your Calendar into a CSV File."); |
213 | 254 | } |
214 | 255 | |
@@ -217,11 +258,13 @@ discard block |
||
217 | 258 | * |
218 | 259 | * @return string suffix |
219 | 260 | */ |
220 | - public static function get_filesuffix() { |
|
261 | + public static function get_filesuffix() |
|
262 | + { |
|
221 | 263 | return 'csv'; |
222 | 264 | } |
223 | 265 | |
224 | - public static function get_mimetype() { |
|
266 | + public static function get_mimetype() |
|
267 | + { |
|
225 | 268 | return 'text/csv'; |
226 | 269 | } |
227 | 270 | |
@@ -229,16 +272,19 @@ discard block |
||
229 | 272 | * return html for options. |
230 | 273 | * |
231 | 274 | */ |
232 | - public function get_options_etpl($definition = null) { |
|
275 | + public function get_options_etpl($definition = null) |
|
276 | + { |
|
233 | 277 | } |
234 | 278 | |
235 | 279 | /** |
236 | 280 | * returns selectors of this plugin |
237 | 281 | * |
238 | 282 | */ |
239 | - public function get_selectors_etpl($definition = null) { |
|
283 | + public function get_selectors_etpl($definition = null) |
|
284 | + { |
|
240 | 285 | $states = $GLOBALS['egw']->session->appsession('session_data','calendar'); |
241 | - switch($states['view']) { |
|
286 | + switch($states['view']) |
|
287 | + { |
|
242 | 288 | case 'month': |
243 | 289 | $query = $this->get_query_month($states); |
244 | 290 | break; |
@@ -264,7 +310,10 @@ discard block |
||
264 | 310 | $end = $ui->last; |
265 | 311 | |
266 | 312 | // Special handling |
267 | - if($list['filter'] == 'all') $start = $end = null; |
|
313 | + if($list['filter'] == 'all') |
|
314 | + { |
|
315 | + $start = $end = null; |
|
316 | + } |
|
268 | 317 | if($list['filter'] == 'before') |
269 | 318 | { |
270 | 319 | $end = $start; |
@@ -312,24 +361,33 @@ discard block |
||
312 | 361 | $days = $states['days']; |
313 | 362 | $ui = new calendar_uiviews($states); |
314 | 363 | if (!$days) |
315 | - { |
|
364 | + { |
|
316 | 365 | $days = isset($_GET['days']) ? $_GET['days'] : $ui->cal_prefs['days_in_weekview']; |
317 | - if ($days != 5) $days = 7; |
|
366 | + if ($days != 5) |
|
367 | + { |
|
368 | + $days = 7; |
|
369 | + } |
|
318 | 370 | } |
319 | - if ($states['view'] == 'week' && $days == 4) // next 4 days view |
|
371 | + if ($states['view'] == 'week' && $days == 4) |
|
372 | + { |
|
373 | + // next 4 days view |
|
320 | 374 | { |
321 | 375 | $query['start'] = $this->bo->date2ts($states['date']); |
376 | + } |
|
322 | 377 | $query['end'] = strtotime("+$days days",$query['start']) - 1; |
323 | 378 | } |
324 | 379 | else |
325 | 380 | { |
326 | 381 | $query['start'] = $ui->datetime->get_weekday_start($states['year'],$states['month'],$states['day']); |
327 | - if ($days == 5) // no weekend-days |
|
382 | + if ($days == 5) |
|
383 | + { |
|
384 | + // no weekend-days |
|
328 | 385 | { |
329 | 386 | switch($ui->cal_prefs['weekdaystarts']) |
330 | 387 | { |
331 | 388 | case 'Saturday': |
332 | 389 | $query['start'] = strtotime("+2 days",$query['start']); |
390 | + } |
|
333 | 391 | break; |
334 | 392 | case 'Sunday': |
335 | 393 | $query['start'] = strtotime("+1 day",$query['start']); |
@@ -405,7 +463,10 @@ discard block |
||
405 | 463 | } |
406 | 464 | |
407 | 465 | // Pass on select options |
408 | - if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
466 | + if($this->selects[$field_name]) |
|
467 | + { |
|
468 | + $settings['values'] = $this->selects[$field_name]; |
|
469 | + } |
|
409 | 470 | } |
410 | 471 | |
411 | 472 | } |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @param egw_record $_definition |
29 | 29 | */ |
30 | - public function export( $_stream, importexport_definition $_definition) { |
|
30 | + public function export($_stream, importexport_definition $_definition) { |
|
31 | 31 | $options = $_definition->plugin_options; |
32 | 32 | |
33 | 33 | $limit_exception = bo_merge::is_export_limit_excepted(); |
34 | 34 | if (!$limit_exception) $export_limit = bo_merge::getExportLimit('calendar'); |
35 | 35 | // Custom fields need to be specifically requested |
36 | 36 | $cfs = array(); |
37 | - foreach($options['mapping'] + (array)$_definition->filter as $key => $label) { |
|
38 | - if($key[0] == '#') $cfs[] = substr($key,1); |
|
37 | + foreach ($options['mapping'] + (array)$_definition->filter as $key => $label) { |
|
38 | + if ($key[0] == '#') $cfs[] = substr($key, 1); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $query = array( |
@@ -43,48 +43,48 @@ discard block |
||
43 | 43 | 'num_rows' => -1, |
44 | 44 | 'csv_export' => true |
45 | 45 | ); |
46 | - switch($options['selection']) |
|
46 | + switch ($options['selection']) |
|
47 | 47 | { |
48 | 48 | case 'criteria': |
49 | 49 | $query = array( |
50 | 50 | 'start' => $options['criteria']['start'], |
51 | - 'end' => strtotime('+1 day',$options['criteria']['end'])-1, |
|
51 | + 'end' => strtotime('+1 day', $options['criteria']['end']) - 1, |
|
52 | 52 | 'categories' => $options['categories'] ? $options['categories'] : $options['criteria']['categories'], |
53 | 53 | //'enum_recuring' => false, // we want the recurring events enumerated for csv export |
54 | 54 | 'daywise' => false, |
55 | 55 | 'users' => $options['criteria']['owner'], |
56 | 56 | 'cfs' => $cfs // Otherwise we shouldn't get any custom fields |
57 | 57 | ); |
58 | - if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
58 | + if (bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
59 | 59 | $query['offset'] = 0; |
60 | 60 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
61 | 61 | } |
62 | - $events =& $this->bo->search($query); |
|
62 | + $events = & $this->bo->search($query); |
|
63 | 63 | break; |
64 | 64 | case 'search_results': |
65 | - $states = $GLOBALS['egw']->session->appsession('session_data','calendar'); |
|
66 | - if($states['view'] == 'listview') { |
|
67 | - $query = $GLOBALS['egw']->session->appsession('calendar_list','calendar'); |
|
68 | - $query['num_rows'] = -1; // all |
|
69 | - $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
65 | + $states = $GLOBALS['egw']->session->appsession('session_data', 'calendar'); |
|
66 | + if ($states['view'] == 'listview') { |
|
67 | + $query = $GLOBALS['egw']->session->appsession('calendar_list', 'calendar'); |
|
68 | + $query['num_rows'] = -1; // all |
|
69 | + $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
70 | 70 | $query['start'] = 0; |
71 | 71 | $query['cfs'] = $cfs; |
72 | 72 | |
73 | - if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
73 | + if (bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
74 | 74 | $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
75 | 75 | } |
76 | 76 | $ui = new calendar_uilist(); |
77 | 77 | $ui->get_rows($query, $events, $unused); |
78 | 78 | } else { |
79 | - $query = $GLOBALS['egw']->session->appsession('session_data','calendar'); |
|
79 | + $query = $GLOBALS['egw']->session->appsession('session_data', 'calendar'); |
|
80 | 80 | $query['users'] = explode(',', $query['owner']); |
81 | 81 | $query['num_rows'] = -1; |
82 | - if(bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
83 | - $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
|
82 | + if (bo_merge::hasExportLimit($export_limit) && !$limit_exception) { |
|
83 | + $query['num_rows'] = (int)$export_limit; // ! int of 'no' is 0 |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | $events = array(); |
87 | - switch($states['view']) { |
|
87 | + switch ($states['view']) { |
|
88 | 88 | case 'month': |
89 | 89 | $query += $this->get_query_month($states); |
90 | 90 | break; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | default: |
99 | 99 | // Let UI set the date ranges |
100 | 100 | $ui = new calendar_uiviews($query); |
101 | - if(method_exists($ui, $states['view'])) |
|
101 | + if (method_exists($ui, $states['view'])) |
|
102 | 102 | { |
103 | 103 | ob_start(); |
104 | 104 | $ui->$states['view'](); |
@@ -122,35 +122,35 @@ discard block |
||
122 | 122 | $filter = $_definition->filter; |
123 | 123 | |
124 | 124 | // Handle ranges |
125 | - foreach($filter as $field => $value) |
|
125 | + foreach ($filter as $field => $value) |
|
126 | 126 | { |
127 | - if($field == 'filter' && $value) |
|
127 | + if ($field == 'filter' && $value) |
|
128 | 128 | { |
129 | 129 | $query['filter'] = $value; |
130 | 130 | continue; |
131 | 131 | } |
132 | - if(!is_array($value) || (!$value['from'] && !$value['to'])) |
|
132 | + if (!is_array($value) || (!$value['from'] && !$value['to'])) |
|
133 | 133 | { |
134 | 134 | $query['query']["cal_$field"] = $value; |
135 | 135 | continue; |
136 | 136 | } |
137 | 137 | |
138 | 138 | // Ranges are inclusive, so should be provided that way (from 2 to 10 includes 2 and 10) |
139 | - if($value['from']) $query['sql_filter'][] = "cal_$field >= " . (int)$value['from']; |
|
140 | - if($value['to']) $query['sql_filter'][] = "cal_$field <= " . (int)$value['to']; |
|
139 | + if ($value['from']) $query['sql_filter'][] = "cal_$field >= ".(int)$value['from']; |
|
140 | + if ($value['to']) $query['sql_filter'][] = "cal_$field <= ".(int)$value['to']; |
|
141 | 141 | |
142 | 142 | } |
143 | - if($query['sql_filter'] && is_array($query['sql_filter'])) |
|
143 | + if ($query['sql_filter'] && is_array($query['sql_filter'])) |
|
144 | 144 | { |
145 | 145 | // Set as an extra parameter |
146 | - $sql_filter = implode(' AND ',$query['sql_filter']); |
|
146 | + $sql_filter = implode(' AND ', $query['sql_filter']); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | case 'all': |
150 | 150 | $events = $this->bo->search($query + array( |
151 | 151 | 'offset' => 0, |
152 | 152 | 'order' => 'cal_start', |
153 | - ),$sql_filter); |
|
153 | + ), $sql_filter); |
|
154 | 154 | break; |
155 | 155 | } |
156 | 156 | |
@@ -167,24 +167,24 @@ discard block |
||
167 | 167 | // Get rid of yearly recurring events that don't belong |
168 | 168 | //if($options['selection']['select'] == 'criteria' && ($event['start'] > $query['end'] || $event['end'] < $query['start'])) continue; |
169 | 169 | // Add in participants |
170 | - if($options['mapping']['participants']) { |
|
171 | - $event['participants'] = implode(", ",$this->bo->participants($event,true)); |
|
170 | + if ($options['mapping']['participants']) { |
|
171 | + $event['participants'] = implode(", ", $this->bo->participants($event, true)); |
|
172 | 172 | } |
173 | 173 | if (is_array($event)) |
174 | 174 | { |
175 | 175 | $record->set_record($event); |
176 | - if($options['mapping']['recurrence']) { |
|
176 | + if ($options['mapping']['recurrence']) { |
|
177 | 177 | $record->recurrence = $recurrence[$record->recur_type]; |
178 | - if($record->recur_type != MCAL_RECUR_NONE) $record->recurrence .= ' / '. $record->recur_interval; |
|
178 | + if ($record->recur_type != MCAL_RECUR_NONE) $record->recurrence .= ' / '.$record->recur_interval; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | // Standard stuff |
182 | - if($options['convert']) { |
|
182 | + if ($options['convert']) { |
|
183 | 183 | importexport_export_csv::convert($record, $convert_fields, 'calendar', $this->selects); |
184 | 184 | } else { |
185 | 185 | // Implode arrays, so they don't say 'Array' |
186 | - foreach($record->get_record_array() as $key => $value) { |
|
187 | - if(is_array($value)) $record->$key = implode(',', $value); |
|
186 | + foreach ($record->get_record_array() as $key => $value) { |
|
187 | + if (is_array($value)) $record->$key = implode(',', $value); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | $export_object->export_record($record); |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | * |
238 | 238 | */ |
239 | 239 | public function get_selectors_etpl($definition = null) { |
240 | - $states = $GLOBALS['egw']->session->appsession('session_data','calendar'); |
|
241 | - switch($states['view']) { |
|
240 | + $states = $GLOBALS['egw']->session->appsession('session_data', 'calendar'); |
|
241 | + switch ($states['view']) { |
|
242 | 242 | case 'month': |
243 | 243 | $query = $this->get_query_month($states); |
244 | 244 | break; |
@@ -250,32 +250,32 @@ discard block |
||
250 | 250 | $query = $this->get_query_day($states); |
251 | 251 | break; |
252 | 252 | } |
253 | - $start= new egw_time($query['start']); |
|
253 | + $start = new egw_time($query['start']); |
|
254 | 254 | $end = new egw_time($query['end']); |
255 | 255 | if ($states['view'] == 'listview') |
256 | 256 | { |
257 | - $list = $GLOBALS['egw']->session->appsession('calendar_list','calendar'); |
|
257 | + $list = $GLOBALS['egw']->session->appsession('calendar_list', 'calendar'); |
|
258 | 258 | |
259 | 259 | // Use UI to get dates |
260 | 260 | $ui = new calendar_uilist(); |
261 | - $list['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
262 | - $ui->get_rows($list,$rows,$readonlys); |
|
261 | + $list['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session |
|
262 | + $ui->get_rows($list, $rows, $readonlys); |
|
263 | 263 | $start = $ui->first ? $ui->first : new egw_time($ui->date); |
264 | 264 | $end = $ui->last; |
265 | 265 | |
266 | 266 | // Special handling |
267 | - if($list['filter'] == 'all') $start = $end = null; |
|
268 | - if($list['filter'] == 'before') |
|
267 | + if ($list['filter'] == 'all') $start = $end = null; |
|
268 | + if ($list['filter'] == 'before') |
|
269 | 269 | { |
270 | 270 | $end = $start; |
271 | 271 | $start = null; |
272 | 272 | } |
273 | 273 | $ui = null; |
274 | 274 | } |
275 | - elseif(!$end) |
|
275 | + elseif (!$end) |
|
276 | 276 | { |
277 | - $end = '+1 ' . $states['view']; |
|
278 | - $end = strtotime($end, $start->format('ts'))-1; |
|
277 | + $end = '+1 '.$states['view']; |
|
278 | + $end = strtotime($end, $start->format('ts')) - 1; |
|
279 | 279 | } |
280 | 280 | $prefs = unserialize($GLOBALS['egw_info']['user']['preferences']['importexport'][$definition->definition_id]); |
281 | 281 | $data = array( |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | 'criteria' => array( |
287 | 287 | 'start' => is_object($start) ? $start->format('ts') : $start, |
288 | 288 | 'end' => is_object($end) ? $end->format('ts') : $end, |
289 | - 'owner' => is_array($states['owner']) ? $states['owner'] : explode(',',$states['owner']) |
|
289 | + 'owner' => is_array($states['owner']) ? $states['owner'] : explode(',', $states['owner']) |
|
290 | 290 | ) |
291 | 291 | ), |
292 | 292 | 'sel_options' => array( |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | ) |
295 | 295 | ); |
296 | 296 | // Pass current owner labels |
297 | - foreach($data['content']['criteria']['owner'] as $owner) |
|
297 | + foreach ($data['content']['criteria']['owner'] as $owner) |
|
298 | 298 | { |
299 | 299 | $data['sel_options']['owner'][] = array( |
300 | 300 | 'id' => $owner, |
@@ -312,8 +312,8 @@ discard block |
||
312 | 312 | public static function get_query_month($states) |
313 | 313 | { |
314 | 314 | $timespan = array( |
315 | - 'start' => mktime(0,0,0,$states['month'],1,$states['year']), |
|
316 | - 'end' => mktime(0,0,0,$states['month']+1,1,$states['year'])-1 |
|
315 | + 'start' => mktime(0, 0, 0, $states['month'], 1, $states['year']), |
|
316 | + 'end' => mktime(0, 0, 0, $states['month'] + 1, 1, $states['year']) - 1 |
|
317 | 317 | ); |
318 | 318 | return $timespan; |
319 | 319 | } |
@@ -331,24 +331,24 @@ discard block |
||
331 | 331 | if ($states['view'] == 'week' && $days == 4) // next 4 days view |
332 | 332 | { |
333 | 333 | $query['start'] = $this->bo->date2ts($states['date']); |
334 | - $query['end'] = strtotime("+$days days",$query['start']) - 1; |
|
334 | + $query['end'] = strtotime("+$days days", $query['start']) - 1; |
|
335 | 335 | } |
336 | 336 | else |
337 | 337 | { |
338 | - $query['start'] = $ui->datetime->get_weekday_start($states['year'],$states['month'],$states['day']); |
|
338 | + $query['start'] = $ui->datetime->get_weekday_start($states['year'], $states['month'], $states['day']); |
|
339 | 339 | if ($days == 5) // no weekend-days |
340 | 340 | { |
341 | - switch($ui->cal_prefs['weekdaystarts']) |
|
341 | + switch ($ui->cal_prefs['weekdaystarts']) |
|
342 | 342 | { |
343 | 343 | case 'Saturday': |
344 | - $query['start'] = strtotime("+2 days",$query['start']); |
|
344 | + $query['start'] = strtotime("+2 days", $query['start']); |
|
345 | 345 | break; |
346 | 346 | case 'Sunday': |
347 | - $query['start'] = strtotime("+1 day",$query['start']); |
|
347 | + $query['start'] = strtotime("+1 day", $query['start']); |
|
348 | 348 | break; |
349 | 349 | } |
350 | 350 | } |
351 | - $query['end'] = strtotime($states['view'] == 'week' ? "+$days days" : "+{$ui->cal_prefs['multiple_weeks']} weeks",$query['start']) - 1; |
|
351 | + $query['end'] = strtotime($states['view'] == 'week' ? "+$days days" : "+{$ui->cal_prefs['multiple_weeks']} weeks", $query['start']) - 1; |
|
352 | 352 | } |
353 | 353 | return $query; |
354 | 354 | } |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $query = array(); |
359 | 359 | $bo = new calendar_bo(); |
360 | 360 | $query['start'] = $bo->date2ts((string)$states['date']); |
361 | - $query['end'] = $query['start']+DAY_s-1; |
|
361 | + $query['end'] = $query['start'] + DAY_s - 1; |
|
362 | 362 | return $query; |
363 | 363 | } |
364 | 364 | |
@@ -407,17 +407,17 @@ discard block |
||
407 | 407 | ); |
408 | 408 | $filters = array_reverse($filters, true); |
409 | 409 | |
410 | - foreach($filters as $field_name => &$settings) |
|
410 | + foreach ($filters as $field_name => &$settings) |
|
411 | 411 | { |
412 | 412 | // Can't filter on a custom field |
413 | - if(strpos($field_name, '#') === 0) |
|
413 | + if (strpos($field_name, '#') === 0) |
|
414 | 414 | { |
415 | 415 | unset($filters[$field_name]); |
416 | 416 | continue; |
417 | 417 | } |
418 | 418 | |
419 | 419 | // Pass on select options |
420 | - if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
420 | + if ($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | } |