@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | "<a href=\"$webserverURL/redirect.php?go=".htmlentities(urlencode('http://www.egroupware.org')).'">' |
23 | 23 | */ |
24 | 24 | |
25 | - if(!function_exists('html_entity_decode')) |
|
25 | + if (!function_exists('html_entity_decode')) |
|
26 | 26 | { |
27 | 27 | function html_entity_decode($given_html, $quote_style = ENT_QUOTES) |
28 | 28 | { |
29 | - $trans_table = array_flip(get_html_translation_table( HTML_SPECIALCHARS, $quote_style)); |
|
29 | + $trans_table = array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style)); |
|
30 | 30 | $trans_table['''] = "'"; |
31 | 31 | return(strtr($given_html, $trans_table)); |
32 | 32 | } |
@@ -45,17 +45,17 @@ discard block |
||
45 | 45 | |
46 | 46 | /* Only allow redirects from inside this eGroupware installation. */ |
47 | 47 | $valid_referer = array(); |
48 | - $path = preg_replace('/\/[^\/]*$/','',$_SERVER['PHP_SELF']) . '/'; |
|
48 | + $path = preg_replace('/\/[^\/]*$/', '', $_SERVER['PHP_SELF']).'/'; |
|
49 | 49 | array_push($valid_referer, $path); |
50 | - array_push($valid_referer, ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['SERVER_ADDR'] . $path); |
|
51 | - array_push($valid_referer, ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . $path); |
|
50 | + array_push($valid_referer, ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['SERVER_ADDR'].$path); |
|
51 | + array_push($valid_referer, ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['SERVER_NAME'].$path); |
|
52 | 52 | |
53 | 53 | $referrer = trim($_SERVER['HTTP_REFERER']); |
54 | 54 | if ((!isset($_SERVER['HTTP_REFERER'])) || (empty($referrer))) |
55 | 55 | { |
56 | 56 | echo "Only usable from within eGroupware.\n"; |
57 | 57 | } |
58 | - else if($_GET['go']) |
|
58 | + else if ($_GET['go']) |
|
59 | 59 | { |
60 | 60 | $allow = false; |
61 | 61 | foreach ($valid_referer as $urlRoot) |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | } |
70 | 70 | if ($allow) |
71 | 71 | { |
72 | - $url= html_entity_decode(urldecode($_GET['go'])); |
|
72 | + $url = html_entity_decode(urldecode($_GET['go'])); |
|
73 | 73 | unset($_GET['go']); |
74 | 74 | /* Only add "&" if there is something to append. */ |
75 | 75 | if (!empty($_GET)) |
76 | 76 | { |
77 | - $url=$url."&".http_build_query($_GET); |
|
77 | + $url = $url."&".http_build_query($_GET); |
|
78 | 78 | } |
79 | 79 | |
80 | - Header('Location: ' . html_entity_decode(urldecode($url))); |
|
80 | + Header('Location: '.html_entity_decode(urldecode($url))); |
|
81 | 81 | exit; |
82 | 82 | } |
83 | 83 | else |
@@ -20,7 +20,7 @@ |
||
20 | 20 | 'name' => 'Ralf Becker', |
21 | 21 | 'email' => '[email protected]' |
22 | 22 | ); |
23 | -$setup_info['filemanager']['license'] = 'GPL'; |
|
23 | +$setup_info['filemanager']['license'] = 'GPL'; |
|
24 | 24 | |
25 | 25 | /* The hooks this app includes, needed for hooks registration */ |
26 | 26 | $setup_info['filemanager']['hooks']['settings'] = 'filemanager_hooks::settings'; |
@@ -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 |
@@ -200,7 +205,10 @@ discard block |
||
200 | 205 | } |
201 | 206 | |
202 | 207 | // Prepend site, if missing |
203 | - if ($link[0] == '/') $link = Api\Framework::getUrl($link); |
|
208 | + if ($link[0] == '/') |
|
209 | + { |
|
210 | + $link = Api\Framework::getUrl($link); |
|
211 | + } |
|
204 | 212 | |
205 | 213 | $file['link'] = Api\Html::a_href(Api\Html::htmlspecialchars($file['name']), $link); |
206 | 214 | $file['webdav_url'] = Api\Session::link(Vfs::download_url($file['url'])); |
@@ -209,7 +217,10 @@ discard block |
||
209 | 217 | // Add markers |
210 | 218 | foreach($file as $key => &$value) |
211 | 219 | { |
212 | - if(!$value) $value = ''; |
|
220 | + if(!$value) |
|
221 | + { |
|
222 | + $value = ''; |
|
223 | + } |
|
213 | 224 | $info['$$'.($prefix ? $prefix.'/':'').$key.'$$'] = $value; |
214 | 225 | } |
215 | 226 | if($app_placeholders) |
@@ -251,9 +262,15 @@ discard block |
||
251 | 262 | ); |
252 | 263 | foreach($fields as $name => $label) |
253 | 264 | { |
254 | - if (!($n&1)) echo '<tr>'; |
|
265 | + if (!($n&1)) |
|
266 | + { |
|
267 | + echo '<tr>'; |
|
268 | + } |
|
255 | 269 | echo '<td>{{'.$name.'}}</td><td>'.lang($label).'</td>'; |
256 | - if ($n&1) echo "</tr>\n"; |
|
270 | + if ($n&1) |
|
271 | + { |
|
272 | + echo "</tr>\n"; |
|
273 | + } |
|
257 | 274 | $n++; |
258 | 275 | } |
259 | 276 |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | { |
61 | 61 | parent::__construct(); |
62 | 62 | |
63 | - if($_dir) |
|
63 | + if ($_dir) |
|
64 | 64 | { |
65 | 65 | $this->dir = $_dir; |
66 | 66 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @param string &$content=null content to create some replacements only if they are use |
77 | 77 | * @return array|boolean |
78 | 78 | */ |
79 | - protected function get_replacements($id,&$content=null) |
|
79 | + protected function get_replacements($id, &$content = null) |
|
80 | 80 | { |
81 | 81 | if (!($replacements = $this->filemanager_replacements($id, '', $content))) |
82 | 82 | { |
@@ -92,27 +92,27 @@ discard block |
||
92 | 92 | * @param string $prefix='' prefix like eg. 'erole' |
93 | 93 | * @return array|boolean |
94 | 94 | */ |
95 | - public function filemanager_replacements($id,$prefix='', &$content = null) |
|
95 | + public function filemanager_replacements($id, $prefix = '', &$content = null) |
|
96 | 96 | { |
97 | 97 | $info = array(); |
98 | - $file = Vfs::lstat($id,true); |
|
98 | + $file = Vfs::lstat($id, true); |
|
99 | 99 | |
100 | 100 | $file['mtime'] = Api\DateTime::to($file['mtime']); |
101 | 101 | $file['ctime'] = Api\DateTime::to($file['ctime']); |
102 | 102 | |
103 | 103 | $file['name'] = Vfs::basename($id); |
104 | 104 | $file['dir'] = ($dir = Vfs::dirname($id)) ? Vfs::decodePath($dir) : ''; |
105 | - $dirlist = explode('/',$file['dir']); |
|
105 | + $dirlist = explode('/', $file['dir']); |
|
106 | 106 | $file['folder'] = array_pop($dirlist); |
107 | - $file['folder_file'] = $file['folder'] . '/'.$file['name']; |
|
107 | + $file['folder_file'] = $file['folder'].'/'.$file['name']; |
|
108 | 108 | $file['path'] = $id; |
109 | 109 | $file['rel_path'] = str_replace($this->dir.'/', '', $id); |
110 | 110 | $file['hsize'] = Vfs::hsize($file['size']); |
111 | 111 | $file['mime'] = Vfs::mime_content_type($id); |
112 | - $file['gid'] *= -1; // our widgets use negative gid's |
|
112 | + $file['gid'] *= -1; // our widgets use negative gid's |
|
113 | 113 | if (($props = Vfs::propfind($id))) |
114 | 114 | { |
115 | - foreach($props as $prop) |
|
115 | + foreach ($props as $prop) |
|
116 | 116 | { |
117 | 117 | $file[$prop['name']] = $prop['val']; |
118 | 118 | } |
@@ -122,22 +122,22 @@ discard block |
||
122 | 122 | $file['symlink'] = Vfs::readlink($id); |
123 | 123 | } |
124 | 124 | // Custom fields |
125 | - if($content && strpos($content, '#') !== 0) |
|
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 | |
130 | - foreach(Api\Storage\Customfields::get('filemanager') as $name => $field) |
|
130 | + foreach (Api\Storage\Customfields::get('filemanager') as $name => $field) |
|
131 | 131 | { |
132 | 132 | // Set any missing custom fields, or the marker will stay |
133 | - if(!$file['#'.$name]) |
|
133 | + if (!$file['#'.$name]) |
|
134 | 134 | { |
135 | 135 | $file['#'.$name] = ''; |
136 | 136 | continue; |
137 | 137 | } |
138 | 138 | |
139 | 139 | // Format date cfs per user Api\Preferences |
140 | - if($field['type'] == 'date' || $field['type'] == 'date-time') |
|
140 | + if ($field['type'] == 'date' || $field['type'] == 'date-time') |
|
141 | 141 | { |
142 | 142 | $this->date_fields[] = '#'.$name; |
143 | 143 | $file['#'.$name] = Api\DateTime::to($file['#'.$name], $field['type'] == 'date' ? true : ''); |
@@ -146,51 +146,51 @@ discard block |
||
146 | 146 | } |
147 | 147 | |
148 | 148 | // If in apps folder, try for app-specific placeholders |
149 | - if($dirlist[1] == 'apps' && count($dirlist) > 1) |
|
149 | + if ($dirlist[1] == 'apps' && count($dirlist) > 1) |
|
150 | 150 | { |
151 | 151 | // Try this first - a normal path /apps/appname/id/file |
152 | - list($app, $app_id) = explode('/', substr($file['path'], strpos($file['path'], 'apps/')+5)); |
|
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 | // Try resolving just app + ID - /apps/App Name/Record Title/file |
156 | - $resolved = Vfs::resolve_url_symlinks(implode('/',array_slice(explode('/',$file['dir']),0,4))); |
|
157 | - list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/')+5)); |
|
156 | + $resolved = Vfs::resolve_url_symlinks(implode('/', array_slice(explode('/', $file['dir']), 0, 4))); |
|
157 | + list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/') + 5)); |
|
158 | 158 | |
159 | - if(!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
159 | + if (!$app || !(int)$app_id || !array_key_exists($app, $GLOBALS['egw_info']['user']['apps'])) { |
|
160 | 160 | // Get rid of any virtual folders (eg: All$) and symlinks |
161 | 161 | $resolved = Vfs::resolve_url_symlinks($file['path']); |
162 | - list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/')+5)); |
|
162 | + list($app, $app_id) = explode('/', substr($resolved, strpos($resolved, 'apps/') + 5)); |
|
163 | 163 | } |
164 | 164 | } |
165 | - if($app && $app_id) |
|
165 | + if ($app && $app_id) |
|
166 | 166 | { |
167 | - if($app && $GLOBALS['egw_info']['user']['apps'][$app]) |
|
167 | + if ($app && $GLOBALS['egw_info']['user']['apps'][$app]) |
|
168 | 168 | { |
169 | 169 | $app_merge = null; |
170 | 170 | try |
171 | 171 | { |
172 | - $classname = $app .'_merge'; |
|
173 | - if(class_exists($classname)) |
|
172 | + $classname = $app.'_merge'; |
|
173 | + if (class_exists($classname)) |
|
174 | 174 | { |
175 | 175 | $app_merge = new $classname(); |
176 | - if($app_merge && method_exists($app_merge, 'get_replacements')) |
|
176 | + if ($app_merge && method_exists($app_merge, 'get_replacements')) |
|
177 | 177 | { |
178 | 178 | $app_placeholders = $app_merge->get_replacements($app_id, $content); |
179 | 179 | } |
180 | 180 | } |
181 | 181 | } |
182 | 182 | // Silently discard & continue |
183 | - catch(Exception $e) { |
|
184 | - unset($e); // not used |
|
183 | + catch (Exception $e) { |
|
184 | + unset($e); // not used |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | } |
188 | 188 | } |
189 | 189 | $link = Link::mime_open($file['url'], $file['mime']); |
190 | - if(is_array($link)) |
|
190 | + if (is_array($link)) |
|
191 | 191 | { |
192 | 192 | // Directories have their internal protocol in path here |
193 | - if($link['path'] && strpos($link['path'], '://') !== false) $link['path'] = $file['path']; |
|
193 | + if ($link['path'] && strpos($link['path'], '://') !== false) $link['path'] = $file['path']; |
|
194 | 194 | $link = Api\Session::link('/index.php', $link); |
195 | 195 | } |
196 | 196 | else |
@@ -207,12 +207,12 @@ discard block |
||
207 | 207 | $file['url'] = $link; |
208 | 208 | |
209 | 209 | // Add markers |
210 | - foreach($file as $key => &$value) |
|
210 | + foreach ($file as $key => &$value) |
|
211 | 211 | { |
212 | - if(!$value) $value = ''; |
|
213 | - $info['$$'.($prefix ? $prefix.'/':'').$key.'$$'] = $value; |
|
212 | + if (!$value) $value = ''; |
|
213 | + $info['$$'.($prefix ? $prefix.'/' : '').$key.'$$'] = $value; |
|
214 | 214 | } |
215 | - if($app_placeholders) |
|
215 | + if ($app_placeholders) |
|
216 | 216 | { |
217 | 217 | $info = array_merge($app_placeholders, $info); |
218 | 218 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | // and put it in the session cache for us |
235 | 235 | $path = $id; |
236 | 236 | $session = \EGroupware\Api\Cache::getSession(Api\Sharing::class, $path); |
237 | - if($session && $session['share_path'] == $path) |
|
237 | + if ($session && $session['share_path'] == $path) |
|
238 | 238 | { |
239 | 239 | return $session; |
240 | 240 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | 'hsize' => 'Size', |
278 | 278 | 'size' => 'Size (in bytes)', |
279 | 279 | ); |
280 | - foreach($fields as $name => $label) |
|
280 | + foreach ($fields as $name => $label) |
|
281 | 281 | { |
282 | 282 | if (!($n&1)) echo '<tr>'; |
283 | 283 | echo '<td>{{'.$name.'}}</td><td>'.lang($label).'</td>'; |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | } |
287 | 287 | |
288 | 288 | echo '<tr><td colspan="4"><h3>'.lang('Custom fields').":</h3></td></tr>"; |
289 | - foreach(Api\Storage\Customfields::get('filemanager') as $name => $field) |
|
289 | + foreach (Api\Storage\Customfields::get('filemanager') as $name => $field) |
|
290 | 290 | { |
291 | 291 | echo '<tr><td>{{#'.$name.'}}</td><td colspan="3">'.$field['label']."</td></tr>\n"; |
292 | 292 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | 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>'; |
296 | 296 | |
297 | 297 | echo '<tr><td colspan="4"><h3>'.lang('General fields:')."</h3></td></tr>"; |
298 | - foreach(array( |
|
298 | + foreach (array( |
|
299 | 299 | 'date' => lang('Date'), |
300 | 300 | 'user/n_fn' => lang('Name of current user, all other contact fields are valid too'), |
301 | 301 | 'user/account_lid' => lang('Username'), |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $readonlys = null; |
90 | 90 | $total = Sharing::so()->get_rows($query, $rows, $readonlys); |
91 | 91 | |
92 | - foreach($rows as &$row) |
|
92 | + foreach ($rows as &$row) |
|
93 | 93 | { |
94 | 94 | if (substr($row['share_path'], 0, strlen(self::$tmp_dir)) === self::$tmp_dir) |
95 | 95 | { |
@@ -130,21 +130,21 @@ discard block |
||
130 | 130 | * @param array $content=null |
131 | 131 | * @param string $msg='' |
132 | 132 | */ |
133 | - public function index(array $content=null) |
|
133 | + public function index(array $content = null) |
|
134 | 134 | { |
135 | 135 | if (!is_array($content)) |
136 | 136 | { |
137 | 137 | $content = array( |
138 | 138 | 'nm' => array( |
139 | - 'get_rows' => 'filemanager.filemanager_shares.get_rows', // I method/callback to request the data for the rows eg. 'notes.bo.get_rows' |
|
140 | - 'no_filter' => True, // current dir only |
|
141 | - 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
142 | - 'no_cat' => True, // I disable the cat-selectbox |
|
143 | - 'lettersearch' => false, // I show a lettersearch |
|
144 | - 'searchletter' => false, // I0 active letter of the lettersearch or false for [all] |
|
145 | - 'start' => 0, // IO position in list |
|
146 | - 'order' => 'share_created', // IO name of the column to sort after (optional for the sortheaders) |
|
147 | - 'sort' => 'DESC', // IO direction of the sort: 'ASC' or 'DESC' |
|
139 | + 'get_rows' => 'filemanager.filemanager_shares.get_rows', // I method/callback to request the data for the rows eg. 'notes.bo.get_rows' |
|
140 | + 'no_filter' => True, // current dir only |
|
141 | + 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
142 | + 'no_cat' => True, // I disable the cat-selectbox |
|
143 | + 'lettersearch' => false, // I show a lettersearch |
|
144 | + 'searchletter' => false, // I0 active letter of the lettersearch or false for [all] |
|
145 | + 'start' => 0, // IO position in list |
|
146 | + 'order' => 'share_created', // IO name of the column to sort after (optional for the sortheaders) |
|
147 | + 'sort' => 'DESC', // IO direction of the sort: 'ASC' or 'DESC' |
|
148 | 148 | //'default_cols' => '!', // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns |
149 | 149 | 'csv_fields' => false, // I false=disable csv export, true or unset=enable it with auto-detected fieldnames, |
150 | 150 | //or array with name=>label or name=>array('label'=>label,'type'=>type) pairs (type is a eT widget-type) |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | } |
157 | 157 | elseif ($content['nm']['action']) |
158 | 158 | { |
159 | - switch($content['nm']['action']) |
|
159 | + switch ($content['nm']['action']) |
|
160 | 160 | { |
161 | 161 | case 'delete': |
162 | 162 | $where = array('share_owner' => $GLOBALS['egw_info']['user']['account_id']); |
@@ -101,7 +101,10 @@ |
||
101 | 101 | $row['type'] = $row['share_writable'] ? Sharing::WRITABLE : Sharing::READONLY; |
102 | 102 | } |
103 | 103 | $row['share_passwd'] = (boolean)$row['share_passwd']; |
104 | - if ($row['share_with']) $row['share_with'] = preg_replace('/,([^ ])/', ', $1', $row['share_with']); |
|
104 | + if ($row['share_with']) |
|
105 | + { |
|
106 | + $row['share_with'] = preg_replace('/,([^ ])/', ', $1', $row['share_with']); |
|
107 | + } |
|
105 | 108 | } |
106 | 109 | return $total; |
107 | 110 | } |
@@ -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'] = |
@@ -50,5 +50,5 @@ |
||
50 | 50 | /* Dependencies for this app to work */ |
51 | 51 | $setup_info['calendar']['depends'][] = array( |
52 | 52 | 'appname' => 'api', |
53 | - 'versions' => Array('17.1') |
|
53 | + 'versions' => array('17.1') |
|
54 | 54 | ); |
@@ -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'; |
@@ -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 | { |
@@ -1428,13 +1428,18 @@ discard block |
||
1428 | 1428 | function calendar_upgrade1_0_1_008() |
1429 | 1429 | { |
1430 | 1430 | $config_data = Api\Config::read('calendar'); |
1431 | - if (isset($config_data['fields'])) // old custom fields |
|
1431 | + if (isset($config_data['fields'])) |
|
1432 | + { |
|
1433 | + // old custom fields |
|
1432 | 1434 | { |
1433 | 1435 | $customfields = array(); |
1436 | + } |
|
1434 | 1437 | $order = 0; |
1435 | 1438 | foreach($config_data['fields'] as $name => $data) |
1436 | 1439 | { |
1437 | - if ($name{0} == '#' && !$data['disabled']) // real not-disabled custom field |
|
1440 | + if ($name{0} == '#' && !$data['disabled']) |
|
1441 | + { |
|
1442 | + // real not-disabled custom field |
|
1438 | 1443 | { |
1439 | 1444 | $customfields[substr($name,1)] = array( |
1440 | 1445 | 'type' => 'text', |
@@ -1443,6 +1448,7 @@ discard block |
||
1443 | 1448 | 'order' => ($order += 10), |
1444 | 1449 | ); |
1445 | 1450 | } |
1451 | + } |
|
1446 | 1452 | } |
1447 | 1453 | if (count($customfields)) |
1448 | 1454 | { |
@@ -2583,9 +2589,12 @@ discard block |
||
2583 | 2589 | 'cal_recur_date' => $row['cal_recur_date'], |
2584 | 2590 | 'cal_user_type' => 'e', |
2585 | 2591 | $email.'='.$GLOBALS['egw_setup']->db->quote($row['email']), |
2586 | - ), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user) // order A, T, U, X |
|
2592 | + ), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user) |
|
2593 | + { |
|
2594 | + // order A, T, U, X |
|
2587 | 2595 | { |
2588 | 2596 | if (strpos($user['email'], '@') !== false && !$n++) continue; |
2597 | + } |
|
2589 | 2598 | $GLOBALS['egw_setup']->db->delete('egw_cal_user', |
2590 | 2599 | array_intersect_key($user, array_flip(array('cal_id','cal_recur_date','cal_user_type','cal_user_id','cal_status'))), |
2591 | 2600 | __LINE__, __FILE__, 'calendar'); |
@@ -2735,8 +2744,12 @@ discard block |
||
2735 | 2744 | function calendar_upgrade16_1_002() |
2736 | 2745 | { |
2737 | 2746 | // Explicitly add months as showing list of events, no times |
2738 | - $change = function($attr, $old_value, $owner) { |
|
2739 | - if($owner == Api\Preferences::FORCED_ID) return; |
|
2747 | + $change = function($attr, $old_value, $owner) |
|
2748 | + { |
|
2749 | + if($owner == Api\Preferences::FORCED_ID) |
|
2750 | + { |
|
2751 | + return; |
|
2752 | + } |
|
2740 | 2753 | if(is_array($old_value) && !in_array('month', $old_value)) |
2741 | 2754 | { |
2742 | 2755 | $old_value[] = 'month'; |
@@ -2758,8 +2771,13 @@ discard block |
||
2758 | 2771 | function calendar_upgrade17_1() |
2759 | 2772 | { |
2760 | 2773 | // Update birthdays as events preference from boolean |
2761 | - $change = function($attr, $old_value, $owner) { |
|
2762 | - if (!isset($old_value)) return null; // do not set anything, if nothing was set before |
|
2774 | + $change = function($attr, $old_value, $owner) |
|
2775 | + { |
|
2776 | + if (!isset($old_value)) |
|
2777 | + { |
|
2778 | + return null; |
|
2779 | + } |
|
2780 | + // do not set anything, if nothing was set before |
|
2763 | 2781 | return $old_value ? 'birthday' : 'none'; |
2764 | 2782 | }; |
2765 | 2783 | Api\Preferences::change_preference('calendar', 'birthdays_as_events', $change); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | $owner[count($owner)] = $GLOBALS['egw_setup']->oProc->f($field); |
21 | 21 | } |
22 | - if($GLOBALS['egw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'],'0.9.10pre4')) |
|
22 | + if ($GLOBALS['egw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'], '0.9.10pre4')) |
|
23 | 23 | { |
24 | 24 | $acctstbl = 'accounts'; |
25 | 25 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | $acctstbl = 'phpgw_accounts'; |
29 | 29 | } |
30 | - for($i=0;$i<count($owner);$i++) |
|
30 | + for ($i = 0; $i < count($owner); $i++) |
|
31 | 31 | { |
32 | 32 | $GLOBALS['egw_setup']->oProc->query("SELECT account_id FROM $acctstbl WHERE account_lid='".$owner[$i]."'"); |
33 | 33 | $GLOBALS['egw_setup']->oProc->next_record(); |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | |
41 | 41 | function calendar_upgrade0_9_3pre1() |
42 | 42 | { |
43 | - calendar_v0_9_2to0_9_3update_owner('webcal_entry','cal_create_by'); |
|
44 | - calendar_v0_9_2to0_9_3update_owner('webcal_entry_user','cal_login'); |
|
43 | + calendar_v0_9_2to0_9_3update_owner('webcal_entry', 'cal_create_by'); |
|
44 | + calendar_v0_9_2to0_9_3update_owner('webcal_entry_user', 'cal_login'); |
|
45 | 45 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre2'; |
46 | 46 | return $GLOBALS['setup_info']['calendar']['currentver']; |
47 | 47 | } |
@@ -208,12 +208,12 @@ discard block |
||
208 | 208 | ) |
209 | 209 | ); |
210 | 210 | |
211 | - $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry',__LINE__,__FILE__); |
|
211 | + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry', __LINE__, __FILE__); |
|
212 | 212 | $GLOBALS['egw_setup']->oProc->next_record(); |
213 | - if($GLOBALS['egw_setup']->oProc->f(0)) |
|
213 | + if ($GLOBALS['egw_setup']->oProc->f(0)) |
|
214 | 214 | { |
215 | - $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__); |
|
216 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
215 | + $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__); |
|
216 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
217 | 217 | { |
218 | 218 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
219 | 219 | $cal_owner = $GLOBALS['egw_setup']->oProc->f('cal_owner'); |
@@ -223,13 +223,13 @@ discard block |
||
223 | 223 | $cal_access = $GLOBALS['egw_setup']->oProc->f('cal_access'); |
224 | 224 | $cal_name = $GLOBALS['egw_setup']->oProc->f('cal_name'); |
225 | 225 | $cal_description = $GLOBALS['egw_setup']->oProc->f('cal_description'); |
226 | - $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))); |
|
227 | - $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))); |
|
228 | - $db2->query('SELECT groups FROM webcal_entry_groups WHERE cal_id='.$cal_id,__LINE__,__FILE__); |
|
226 | + $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))); |
|
227 | + $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))); |
|
228 | + $db2->query('SELECT groups FROM webcal_entry_groups WHERE cal_id='.$cal_id, __LINE__, __FILE__); |
|
229 | 229 | $db2->next_record(); |
230 | 230 | $cal_group = $db2->f('groups'); |
231 | 231 | $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) ' |
232 | - .'VALUES('.$cal_id.",'".$cal_owner."','".$cal_group."',".$datetime.",".$moddatetime.",".$cal_duration.",".$cal_priority.",'".$cal_type."','".$cal_access."','".$cal_name."','".$cal_description."')",__LINE__,__FILE__); |
|
232 | + .'VALUES('.$cal_id.",'".$cal_owner."','".$cal_group."',".$datetime.",".$moddatetime.",".$cal_duration.",".$cal_priority.",'".$cal_type."','".$cal_access."','".$cal_name."','".$cal_description."')", __LINE__, __FILE__); |
|
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
@@ -250,17 +250,17 @@ discard block |
||
250 | 250 | ) |
251 | 251 | ); |
252 | 252 | |
253 | - $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_user',__LINE__,__FILE__); |
|
253 | + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_user', __LINE__, __FILE__); |
|
254 | 254 | $GLOBALS['egw_setup']->oProc->next_record(); |
255 | - if($GLOBALS['egw_setup']->oProc->f(0)) |
|
255 | + if ($GLOBALS['egw_setup']->oProc->f(0)) |
|
256 | 256 | { |
257 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_login,cal_status FROM webcal_entry_user ORDER BY cal_id',__LINE__,__FILE__); |
|
258 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
257 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_login,cal_status FROM webcal_entry_user ORDER BY cal_id', __LINE__, __FILE__); |
|
258 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
259 | 259 | { |
260 | 260 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
261 | 261 | $cal_login = $GLOBALS['egw_setup']->oProc->f('cal_login'); |
262 | 262 | $cal_status = $GLOBALS['egw_setup']->oProc->f('cal_status'); |
263 | - $db2->query('INSERT INTO calendar_entry_user(cal_id,cal_login,cal_status) VALUES('.$cal_id.','.$cal_login.",'".$cal_status."')",__LINE__,__FILE__); |
|
263 | + $db2->query('INSERT INTO calendar_entry_user(cal_id,cal_login,cal_status) VALUES('.$cal_id.','.$cal_login.",'".$cal_status."')", __LINE__, __FILE__); |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
@@ -283,18 +283,18 @@ discard block |
||
283 | 283 | ) |
284 | 284 | ); |
285 | 285 | |
286 | - $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_repeats',__LINE__,__FILE__); |
|
286 | + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_repeats', __LINE__, __FILE__); |
|
287 | 287 | $GLOBALS['egw_setup']->oProc->next_record(); |
288 | - if($GLOBALS['egw_setup']->oProc->f(0)) |
|
288 | + if ($GLOBALS['egw_setup']->oProc->f(0)) |
|
289 | 289 | { |
290 | - $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__); |
|
291 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
290 | + $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__); |
|
291 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
292 | 292 | { |
293 | 293 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
294 | 294 | $cal_type = $GLOBALS['egw_setup']->oProc->f('cal_type'); |
295 | - if(isset($GLOBALS['egw_setup']->oProc->Record['cal_end'])) |
|
295 | + if (isset($GLOBALS['egw_setup']->oProc->Record['cal_end'])) |
|
296 | 296 | { |
297 | - $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 | + $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))); |
|
298 | 298 | $useend = 1; |
299 | 299 | } |
300 | 300 | else |
@@ -304,12 +304,12 @@ discard block |
||
304 | 304 | } |
305 | 305 | $cal_frequency = $GLOBALS['egw_setup']->oProc->f('cal_frequency'); |
306 | 306 | $cal_days = $GLOBALS['egw_setup']->oProc->f('cal_days'); |
307 | - $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 | + $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__); |
|
308 | 308 | } |
309 | 309 | } |
310 | 310 | |
311 | 311 | $GLOBALS['egw_setup']->oProc->DropTable('webcal_entry_repeats'); |
312 | - $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 | + $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 | 313 | |
314 | 314 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.7pre2'; |
315 | 315 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -321,19 +321,19 @@ discard block |
||
321 | 321 | $db2 = $GLOBALS['egw_setup']->db; |
322 | 322 | |
323 | 323 | $GLOBALS['egw_setup']->oProc->RenameColumn('calendar_entry', 'cal_duration', 'cal_edatetime'); |
324 | - $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__); |
|
325 | - if($GLOBALS['egw_setup']->oProc->num_rows()) |
|
324 | + $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__); |
|
325 | + if ($GLOBALS['egw_setup']->oProc->num_rows()) |
|
326 | 326 | { |
327 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
327 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
328 | 328 | { |
329 | - $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 | + $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__); |
|
330 | 330 | $db2->next_record(); |
331 | 331 | $tz = $db2->f('preference_value'); |
332 | 332 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
333 | 333 | $datetime = $GLOBALS['egw_setup']->oProc->f('cal_datetime') - ((60 * 60) * $tz); |
334 | 334 | $mdatetime = $GLOBALS['egw_setup']->oProc->f('cal_mdatetime') - ((60 * 60) * $tz); |
335 | 335 | $edatetime = $datetime + (60 * $GLOBALS['egw_setup']->oProc->f('cal_edatetime')); |
336 | - $db2->query('UPDATE calendar_entry SET cal_datetime='.$datetime.', cal_edatetime='.$edatetime.', cal_mdatetime='.$mdatetime.' WHERE cal_id='.$cal_id,__LINE__,__FILE__); |
|
336 | + $db2->query('UPDATE calendar_entry SET cal_datetime='.$datetime.', cal_edatetime='.$edatetime.', cal_mdatetime='.$mdatetime.' WHERE cal_id='.$cal_id, __LINE__, __FILE__); |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 | |
@@ -581,22 +581,22 @@ discard block |
||
581 | 581 | { |
582 | 582 | $db2 = $GLOBALS['egw_setup']->db; |
583 | 583 | |
584 | - if(extension_loaded('mcal') == False) |
|
584 | + if (extension_loaded('mcal') == False) |
|
585 | 585 | { |
586 | - define(RECUR_NONE,0); |
|
587 | - define(RECUR_DAILY,1); |
|
588 | - define(RECUR_WEEKLY,2); |
|
589 | - define(RECUR_MONTHLY_MDAY,3); |
|
590 | - define(RECUR_MONTHLY_WDAY,4); |
|
591 | - define(RECUR_YEARLY,5); |
|
592 | - |
|
593 | - define(M_SUNDAY,1); |
|
594 | - define(M_MONDAY,2); |
|
595 | - define(M_TUESDAY,4); |
|
596 | - define(M_WEDNESDAY,8); |
|
597 | - define(M_THURSDAY,16); |
|
598 | - define(M_FRIDAY,32); |
|
599 | - define(M_SATURDAY,64); |
|
586 | + define(RECUR_NONE, 0); |
|
587 | + define(RECUR_DAILY, 1); |
|
588 | + define(RECUR_WEEKLY, 2); |
|
589 | + define(RECUR_MONTHLY_MDAY, 3); |
|
590 | + define(RECUR_MONTHLY_WDAY, 4); |
|
591 | + define(RECUR_YEARLY, 5); |
|
592 | + |
|
593 | + define(M_SUNDAY, 1); |
|
594 | + define(M_MONDAY, 2); |
|
595 | + define(M_TUESDAY, 4); |
|
596 | + define(M_WEDNESDAY, 8); |
|
597 | + define(M_THURSDAY, 16); |
|
598 | + define(M_FRIDAY, 32); |
|
599 | + define(M_SATURDAY, 64); |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | // calendar_entry => phpgw_cal |
@@ -623,13 +623,13 @@ discard block |
||
623 | 623 | ) |
624 | 624 | ); |
625 | 625 | |
626 | - $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry',__LINE__,__FILE__); |
|
627 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
626 | + $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry', __LINE__, __FILE__); |
|
627 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
628 | 628 | { |
629 | 629 | $id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
630 | 630 | $owner = $GLOBALS['egw_setup']->oProc->f('cal_owner'); |
631 | 631 | $access = $GLOBALS['egw_setup']->oProc->f('cal_access'); |
632 | - switch($access) |
|
632 | + switch ($access) |
|
633 | 633 | { |
634 | 634 | case 'private': |
635 | 635 | $is_public = 0; |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | $description = $GLOBALS['egw_setup']->oProc->f('cal_description'); |
652 | 652 | |
653 | 653 | $db2->query("INSERT INTO phpgw_cal(cal_id,owner,groups,datetime,mdatetime,edatetime,priority,cal_type,is_public,title,description) " |
654 | - . "VALUES($id,$owner,'$groups',$datetime,$mdatetime,$edatetime,$priority,'$type',$is_public,'$title','$description')",__LINE__,__FILE__); |
|
654 | + . "VALUES($id,$owner,'$groups',$datetime,$mdatetime,$edatetime,$priority,'$type',$is_public,'$title','$description')", __LINE__, __FILE__); |
|
655 | 655 | } |
656 | 656 | $GLOBALS['egw_setup']->oProc->DropTable('calendar_entry'); |
657 | 657 | |
@@ -659,12 +659,12 @@ discard block |
||
659 | 659 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_repeats', |
660 | 660 | Array( |
661 | 661 | 'fd' => array( |
662 | - 'cal_id' => array('type' => 'int', 'precision' => 8,'nullable' => False), |
|
663 | - 'recur_type' => array('type' => 'int', 'precision' => 8,'nullable' => False), |
|
664 | - 'recur_use_end' => array('type' => 'int', 'precision' => 8,'nullable' => True), |
|
665 | - 'recur_enddate' => array('type' => 'int', 'precision' => 8,'nullable' => True), |
|
666 | - 'recur_interval' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1'), |
|
667 | - 'recur_data' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1') |
|
662 | + 'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
|
663 | + 'recur_type' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
|
664 | + 'recur_use_end' => array('type' => 'int', 'precision' => 8, 'nullable' => True), |
|
665 | + 'recur_enddate' => array('type' => 'int', 'precision' => 8, 'nullable' => True), |
|
666 | + 'recur_interval' => array('type' => 'int', 'precision' => 8, 'nullable' => True, 'default' => '1'), |
|
667 | + 'recur_data' => array('type' => 'int', 'precision' => 8, 'nullable' => True, 'default' => '1') |
|
668 | 668 | ), |
669 | 669 | 'pk' => array(), |
670 | 670 | 'fk' => array(), |
@@ -672,12 +672,12 @@ discard block |
||
672 | 672 | 'uc' => array() |
673 | 673 | ) |
674 | 674 | ); |
675 | - $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry_repeats',__LINE__,__FILE__); |
|
676 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
675 | + $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry_repeats', __LINE__, __FILE__); |
|
676 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
677 | 677 | { |
678 | 678 | $id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
679 | 679 | $recur_type = $GLOBALS['egw_setup']->oProc->f('cal_type'); |
680 | - switch($recur_type) |
|
680 | + switch ($recur_type) |
|
681 | 681 | { |
682 | 682 | case 'daily': |
683 | 683 | $recur_type_num = RECUR_DAILY; |
@@ -700,20 +700,20 @@ discard block |
||
700 | 700 | $recur_interval = $GLOBALS['egw_setup']->oProc->f('cal_frequency'); |
701 | 701 | $days = strtoupper($GLOBALS['egw_setup']->oProc->f('cal_days')); |
702 | 702 | $recur_data = 0; |
703 | - $recur_data += (substr($days,0,1)=='Y'?M_SUNDAY:0); |
|
704 | - $recur_data += (substr($days,1,1)=='Y'?M_MONDAY:0); |
|
705 | - $recur_data += (substr($days,2,1)=='Y'?M_TUESDAY:0); |
|
706 | - $recur_data += (substr($days,3,1)=='Y'?M_WEDNESDAY:0); |
|
707 | - $recur_data += (substr($days,4,1)=='Y'?M_THURSDAY:0); |
|
708 | - $recur_data += (substr($days,5,1)=='Y'?M_FRIDAY:0); |
|
709 | - $recur_data += (substr($days,6,1)=='Y'?M_SATURDAY:0); |
|
703 | + $recur_data += (substr($days, 0, 1) == 'Y' ?M_SUNDAY:0); |
|
704 | + $recur_data += (substr($days, 1, 1) == 'Y' ?M_MONDAY:0); |
|
705 | + $recur_data += (substr($days, 2, 1) == 'Y' ?M_TUESDAY:0); |
|
706 | + $recur_data += (substr($days, 3, 1) == 'Y' ?M_WEDNESDAY:0); |
|
707 | + $recur_data += (substr($days, 4, 1) == 'Y' ?M_THURSDAY:0); |
|
708 | + $recur_data += (substr($days, 5, 1) == 'Y' ?M_FRIDAY:0); |
|
709 | + $recur_data += (substr($days, 6, 1) == 'Y' ?M_SATURDAY:0); |
|
710 | 710 | $db2->query("INSERT INTO phpgw_cal_repeats(cal_id,recur_type,recur_use_end,recur_enddate,recur_interval,recur_data) " |
711 | - . "VALUES($id,$recur_type_num,$recur_use_end,$recur_end,$recur_interval,$recur_data)",__LINE__,__FILE__); |
|
711 | + . "VALUES($id,$recur_type_num,$recur_use_end,$recur_end,$recur_interval,$recur_data)", __LINE__, __FILE__); |
|
712 | 712 | } |
713 | 713 | $GLOBALS['egw_setup']->oProc->DropTable('calendar_entry_repeats'); |
714 | 714 | |
715 | 715 | // calendar_entry_user => phpgw_cal_user |
716 | - $GLOBALS['egw_setup']->oProc->RenameTable('calendar_entry_user','phpgw_cal_user'); |
|
716 | + $GLOBALS['egw_setup']->oProc->RenameTable('calendar_entry_user', 'phpgw_cal_user'); |
|
717 | 717 | |
718 | 718 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.002'; |
719 | 719 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -732,11 +732,11 @@ discard block |
||
732 | 732 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', |
733 | 733 | Array( |
734 | 734 | 'fd' => array( |
735 | - 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), |
|
736 | - 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), |
|
737 | - 'date_time' => array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0') |
|
735 | + 'locale' => array('type' => 'char', 'precision' => 2, 'nullable' => False), |
|
736 | + 'name' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False), |
|
737 | + 'date_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0') |
|
738 | 738 | ), |
739 | - 'pk' => array('locale','name'), |
|
739 | + 'pk' => array('locale', 'name'), |
|
740 | 740 | 'fk' => array(), |
741 | 741 | 'ix' => array(), |
742 | 742 | 'uc' => array() |
@@ -768,10 +768,10 @@ discard block |
||
768 | 768 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', |
769 | 769 | Array( |
770 | 770 | 'fd' => array( |
771 | - 'hol_id' => array('type' => 'auto','nullable' => False), |
|
772 | - 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), |
|
773 | - 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), |
|
774 | - 'date_time' => array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0') |
|
771 | + 'hol_id' => array('type' => 'auto', 'nullable' => False), |
|
772 | + 'locale' => array('type' => 'char', 'precision' => 2, 'nullable' => False), |
|
773 | + 'name' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False), |
|
774 | + 'date_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0') |
|
775 | 775 | ), |
776 | 776 | 'pk' => array('hol_id'), |
777 | 777 | 'fk' => array(), |
@@ -788,10 +788,10 @@ discard block |
||
788 | 788 | function calendar_upgrade0_9_11_007() |
789 | 789 | { |
790 | 790 | $GLOBALS['egw_setup']->oProc->query('DELETE FROM phpgw_cal_holidays'); |
791 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','mday',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
792 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','month_num',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
793 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','occurence',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
794 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','dow',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
791 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'mday', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
792 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'month_num', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
793 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'occurence', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
794 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'dow', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
795 | 795 | |
796 | 796 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.008'; |
797 | 797 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | function calendar_upgrade0_9_11_009() |
809 | 809 | { |
810 | 810 | $GLOBALS['egw_setup']->oProc->query('DELETE FROM phpgw_cal_holidays'); |
811 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','observance_rule',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
811 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'observance_rule', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
812 | 812 | |
813 | 813 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.010'; |
814 | 814 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | |
844 | 844 | function calendar_upgrade0_9_13_002() |
845 | 845 | { |
846 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','reference',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
846 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'reference', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
847 | 847 | |
848 | 848 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.003'; |
849 | 849 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_alarm', |
856 | 856 | Array( |
857 | 857 | 'fd' => array( |
858 | - 'alarm_id' => array('type' => 'auto','nullable' => False), |
|
858 | + 'alarm_id' => array('type' => 'auto', 'nullable' => False), |
|
859 | 859 | 'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
860 | 860 | 'cal_owner' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
861 | 861 | 'cal_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
@@ -868,8 +868,8 @@ discard block |
||
868 | 868 | ) |
869 | 869 | ); |
870 | 870 | |
871 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','uid',array('type' => 'varchar', 'precision' => 255,'nullable' => False)); |
|
872 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','location',array('type' => 'varchar', 'precision' => 255,'nullable' => True)); |
|
871 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'uid', array('type' => 'varchar', 'precision' => 255, 'nullable' => False)); |
|
872 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'location', array('type' => 'varchar', 'precision' => 255, 'nullable' => True)); |
|
873 | 873 | |
874 | 874 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.004'; |
875 | 875 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | |
879 | 879 | function calendar_upgrade0_9_13_004() |
880 | 880 | { |
881 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_alarm','alarm_enabled',array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => '1')); |
|
881 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_alarm', 'alarm_enabled', array('type' => 'int', 'precision' => 4, 'nullable' => False, 'default' => '1')); |
|
882 | 882 | |
883 | 883 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.005'; |
884 | 884 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -888,18 +888,18 @@ discard block |
||
888 | 888 | function calendar_upgrade0_9_13_005() |
889 | 889 | { |
890 | 890 | $calendar_data = Array(); |
891 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal',__LINE__,__FILE__); |
|
892 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
891 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal', __LINE__, __FILE__); |
|
892 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
893 | 893 | { |
894 | 894 | $calendar_data[$GLOBALS['egw_setup']->oProc->f('cal_id')] = $GLOBALS['egw_setup']->oProc->f('category'); |
895 | 895 | } |
896 | 896 | |
897 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal','category',array('type' => 'varchar', 'precision' => 30,'nullable' => True)); |
|
897 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal', 'category', array('type' => 'varchar', 'precision' => 30, 'nullable' => True)); |
|
898 | 898 | |
899 | 899 | @reset($calendar_data); |
900 | - while($calendar_data && list($cal_id,$category) = each($calendar_data)) |
|
900 | + while ($calendar_data && list($cal_id, $category) = each($calendar_data)) |
|
901 | 901 | { |
902 | - $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_cal SET category='".$category."' WHERE cal_id=".$cal_id,__LINE__,__FILE__); |
|
902 | + $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_cal SET category='".$category."' WHERE cal_id=".$cal_id, __LINE__, __FILE__); |
|
903 | 903 | } |
904 | 904 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.006'; |
905 | 905 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | |
909 | 909 | function calendar_upgrade0_9_13_006() |
910 | 910 | { |
911 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_repeats','recur_exception',array('type' => 'varchar', 'precision' => 255, 'nullable' => True, 'default' => '')); |
|
911 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_repeats', 'recur_exception', array('type' => 'varchar', 'precision' => 255, 'nullable' => True, 'default' => '')); |
|
912 | 912 | |
913 | 913 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.007'; |
914 | 914 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -918,20 +918,20 @@ discard block |
||
918 | 918 | |
919 | 919 | function calendar_upgrade0_9_13_007() |
920 | 920 | { |
921 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_user','cal_type',array( |
|
921 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_user', 'cal_type', array( |
|
922 | 922 | 'type' => 'varchar', |
923 | 923 | 'precision' => '1', |
924 | 924 | 'nullable' => False, |
925 | 925 | 'default' => 'u' |
926 | 926 | )); |
927 | 927 | |
928 | - $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_extra',array( |
|
928 | + $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_extra', array( |
|
929 | 929 | 'fd' => array( |
930 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
931 | - 'cal_extra_name' => array('type' => 'varchar','precision' => '40','nullable' => False), |
|
932 | - 'cal_extra_value' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '') |
|
930 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
931 | + 'cal_extra_name' => array('type' => 'varchar', 'precision' => '40', 'nullable' => False), |
|
932 | + 'cal_extra_value' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '') |
|
933 | 933 | ), |
934 | - 'pk' => array('cal_id','cal_extra_name'), |
|
934 | + 'pk' => array('cal_id', 'cal_extra_name'), |
|
935 | 935 | 'fk' => array(), |
936 | 936 | 'ix' => array(), |
937 | 937 | 'uc' => array() |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | function calendar_upgrade0_9_16_001() |
949 | 949 | { |
950 | 950 | // this is to set the default as schema_proc was not setting an empty default |
951 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal_user','cal_type',array( |
|
951 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal_user', 'cal_type', array( |
|
952 | 952 | 'type' => 'varchar', |
953 | 953 | 'precision' => '1', |
954 | 954 | 'nullable' => False, |
@@ -965,15 +965,15 @@ discard block |
||
965 | 965 | |
966 | 966 | function calendar_upgrade0_9_16_002() |
967 | 967 | { |
968 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats',array( |
|
968 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats', array( |
|
969 | 969 | 'fd' => array( |
970 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), |
|
971 | - 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), |
|
972 | - 'recur_use_end' => array('type' => 'int','precision' => '8','default' => '0'), |
|
973 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
974 | - 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), |
|
975 | - 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), |
|
976 | - 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') |
|
970 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
971 | + 'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
972 | + 'recur_use_end' => array('type' => 'int', 'precision' => '8', 'default' => '0'), |
|
973 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
974 | + 'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
975 | + 'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
976 | + 'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '') |
|
977 | 977 | ), |
978 | 978 | 'pk' => array(), |
979 | 979 | 'fk' => array(), |
@@ -989,14 +989,14 @@ discard block |
||
989 | 989 | |
990 | 990 | function calendar_upgrade0_9_16_003() |
991 | 991 | { |
992 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_user',array( |
|
992 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_user', array( |
|
993 | 993 | 'fd' => array( |
994 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
995 | - 'cal_login' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
996 | - 'cal_status' => array('type' => 'char','precision' => '1','default' => 'A'), |
|
997 | - 'cal_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u') |
|
994 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
995 | + 'cal_login' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
996 | + 'cal_status' => array('type' => 'char', 'precision' => '1', 'default' => 'A'), |
|
997 | + 'cal_type' => array('type' => 'varchar', 'precision' => '1', 'nullable' => False, 'default' => 'u') |
|
998 | 998 | ), |
999 | - 'pk' => array('cal_id','cal_login','cal_type'), |
|
999 | + 'pk' => array('cal_id', 'cal_login', 'cal_type'), |
|
1000 | 1000 | 'fk' => array(), |
1001 | 1001 | 'ix' => array(), |
1002 | 1002 | 'uc' => array() |
@@ -1010,16 +1010,16 @@ discard block |
||
1010 | 1010 | |
1011 | 1011 | function calendar_upgrade0_9_16_004() |
1012 | 1012 | { |
1013 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_holidays',array( |
|
1013 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_holidays', array( |
|
1014 | 1014 | 'fd' => array( |
1015 | - 'hol_id' => array('type' => 'auto','nullable' => False), |
|
1016 | - 'locale' => array('type' => 'char','precision' => '2','nullable' => False), |
|
1017 | - 'name' => array('type' => 'varchar','precision' => '50','nullable' => False), |
|
1018 | - 'mday' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1019 | - 'month_num' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1020 | - 'occurence' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1021 | - 'dow' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1022 | - 'observance_rule' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
1015 | + 'hol_id' => array('type' => 'auto', 'nullable' => False), |
|
1016 | + 'locale' => array('type' => 'char', 'precision' => '2', 'nullable' => False), |
|
1017 | + 'name' => array('type' => 'varchar', 'precision' => '50', 'nullable' => False), |
|
1018 | + 'mday' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1019 | + 'month_num' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1020 | + 'occurence' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1021 | + 'dow' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1022 | + 'observance_rule' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
1023 | 1023 | ), |
1024 | 1024 | 'pk' => array('hol_id'), |
1025 | 1025 | 'fk' => array(), |
@@ -1037,13 +1037,13 @@ discard block |
||
1037 | 1037 | { |
1038 | 1038 | // creates uid's for all entries which do not have unique ones, they are '[email protected]' |
1039 | 1039 | // very old entries even have an empty uid, see 0.9.16.006 update |
1040 | - $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 | + $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__); |
|
1041 | 1041 | while ($GLOBALS['egw_setup']->oProc->next_record()) |
1042 | 1042 | { |
1043 | 1043 | $config[$GLOBALS['egw_setup']->oProc->f(0)] = $GLOBALS['egw_setup']->oProc->f(1); |
1044 | 1044 | } |
1045 | 1045 | $GLOBALS['egw_setup']->oProc->query('UPDATE phpgw_cal SET uid='. |
1046 | - $GLOBALS['egw_setup']->db->concat($GLOBALS['egw_setup']->db->quote('cal-'),'cal_id', |
|
1046 | + $GLOBALS['egw_setup']->db->concat($GLOBALS['egw_setup']->db->quote('cal-'), 'cal_id', |
|
1047 | 1047 | $GLOBALS['egw_setup']->db->quote('-'.$config['install_id'].'@'. |
1048 | 1048 | ($config['mail_suffix'] ? $config['mail_suffix'] : 'local'))). |
1049 | 1049 | " WHERE uid LIKE '-@%' OR uid=''"); |
@@ -1066,7 +1066,7 @@ discard block |
||
1066 | 1066 | function calendar_upgrade0_9_16_007() |
1067 | 1067 | { |
1068 | 1068 | // update the sequenzes for refreshed tables (postgres only) |
1069 | - $GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_cal_holidays','hol_id'); |
|
1069 | + $GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_cal_holidays', 'hol_id'); |
|
1070 | 1070 | |
1071 | 1071 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0'; |
1072 | 1072 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1076,19 +1076,19 @@ discard block |
||
1076 | 1076 | |
1077 | 1077 | function calendar_upgrade1_0_0() |
1078 | 1078 | { |
1079 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','uid','cal_uid'); |
|
1080 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','owner','cal_owner'); |
|
1081 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','category','cal_category'); |
|
1082 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','groups','cal_groups'); |
|
1083 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','datetime','cal_starttime'); |
|
1084 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','mdatetime','cal_modified'); |
|
1085 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','edatetime','cal_endtime'); |
|
1086 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','priority','cal_priority'); |
|
1087 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','is_public','cal_public'); |
|
1088 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','title','cal_title'); |
|
1089 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','description','cal_description'); |
|
1090 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','location','cal_location'); |
|
1091 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','reference','cal_reference'); |
|
1079 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'uid', 'cal_uid'); |
|
1080 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'owner', 'cal_owner'); |
|
1081 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'category', 'cal_category'); |
|
1082 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'groups', 'cal_groups'); |
|
1083 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'datetime', 'cal_starttime'); |
|
1084 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'mdatetime', 'cal_modified'); |
|
1085 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'edatetime', 'cal_endtime'); |
|
1086 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'priority', 'cal_priority'); |
|
1087 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'is_public', 'cal_public'); |
|
1088 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'title', 'cal_title'); |
|
1089 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'description', 'cal_description'); |
|
1090 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'location', 'cal_location'); |
|
1091 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'reference', 'cal_reference'); |
|
1092 | 1092 | |
1093 | 1093 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.001'; |
1094 | 1094 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1098,13 +1098,13 @@ discard block |
||
1098 | 1098 | |
1099 | 1099 | function calendar_upgrade1_0_0_001() |
1100 | 1100 | { |
1101 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','locale','hol_locale'); |
|
1102 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','name','hol_name'); |
|
1103 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','mday','hol_mday'); |
|
1104 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','month_num','hol_month_num'); |
|
1105 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','occurence','hol_occurence'); |
|
1106 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','dow','hol_dow'); |
|
1107 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','observance_rule','hol_observance_rule'); |
|
1101 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'locale', 'hol_locale'); |
|
1102 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'name', 'hol_name'); |
|
1103 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'mday', 'hol_mday'); |
|
1104 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'month_num', 'hol_month_num'); |
|
1105 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'occurence', 'hol_occurence'); |
|
1106 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'dow', 'hol_dow'); |
|
1107 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'observance_rule', 'hol_observance_rule'); |
|
1108 | 1108 | |
1109 | 1109 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.002'; |
1110 | 1110 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1114,8 +1114,8 @@ discard block |
||
1114 | 1114 | |
1115 | 1115 | function calendar_upgrade1_0_0_002() |
1116 | 1116 | { |
1117 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user','cal_login','cal_user_id'); |
|
1118 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user','cal_type','cal_user_type'); |
|
1117 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user', 'cal_login', 'cal_user_id'); |
|
1118 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user', 'cal_type', 'cal_user_type'); |
|
1119 | 1119 | |
1120 | 1120 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.003'; |
1121 | 1121 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1125,7 +1125,7 @@ discard block |
||
1125 | 1125 | |
1126 | 1126 | function calendar_upgrade1_0_0_003() |
1127 | 1127 | { |
1128 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal','cal_title',array( |
|
1128 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal', 'cal_title', array( |
|
1129 | 1129 | 'type' => 'varchar', |
1130 | 1130 | 'precision' => '255', |
1131 | 1131 | 'nullable' => False, |
@@ -1140,15 +1140,15 @@ discard block |
||
1140 | 1140 | |
1141 | 1141 | function calendar_upgrade1_0_0_004() |
1142 | 1142 | { |
1143 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats',array( |
|
1143 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats', array( |
|
1144 | 1144 | 'fd' => array( |
1145 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1146 | - 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1147 | - 'recur_use_end' => array('type' => 'int','precision' => '8','default' => '0'), |
|
1148 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
1149 | - 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), |
|
1150 | - 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), |
|
1151 | - 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') |
|
1145 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1146 | + 'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1147 | + 'recur_use_end' => array('type' => 'int', 'precision' => '8', 'default' => '0'), |
|
1148 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
1149 | + 'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
1150 | + 'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
1151 | + 'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '') |
|
1152 | 1152 | ), |
1153 | 1153 | 'pk' => array('cal_id'), |
1154 | 1154 | 'fk' => array(), |
@@ -1165,19 +1165,19 @@ discard block |
||
1165 | 1165 | function calendar_upgrade1_0_0_005() |
1166 | 1166 | { |
1167 | 1167 | // change prefix of all calendar tables to egw_ |
1168 | - foreach(array('cal_user','cal_repeats','cal_extra','cal_holidays','cal') as $name) |
|
1168 | + foreach (array('cal_user', 'cal_repeats', 'cal_extra', 'cal_holidays', 'cal') as $name) |
|
1169 | 1169 | { |
1170 | - $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_'.$name,'egw_'.$name); |
|
1170 | + $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_'.$name, 'egw_'.$name); |
|
1171 | 1171 | } |
1172 | 1172 | |
1173 | 1173 | // create new dates table, with content from the egw_cal table |
1174 | - $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_dates',array( |
|
1174 | + $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_dates', array( |
|
1175 | 1175 | 'fd' => array( |
1176 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
1177 | - 'cal_start' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1178 | - 'cal_end' => array('type' => 'int','precision' => '8','nullable' => False) |
|
1176 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
1177 | + 'cal_start' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1178 | + 'cal_end' => array('type' => 'int', 'precision' => '8', 'nullable' => False) |
|
1179 | 1179 | ), |
1180 | - 'pk' => array('cal_id','cal_start'), |
|
1180 | + 'pk' => array('cal_id', 'cal_start'), |
|
1181 | 1181 | 'fk' => array(), |
1182 | 1182 | 'ix' => array(), |
1183 | 1183 | 'uc' => array() |
@@ -1185,49 +1185,49 @@ discard block |
||
1185 | 1185 | $GLOBALS['egw_setup']->oProc->query("INSERT INTO egw_cal_dates SELECT cal_id,cal_starttime,cal_endtime FROM egw_cal"); |
1186 | 1186 | |
1187 | 1187 | // drop the fields transfered to the dates table |
1188 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1188 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1189 | 1189 | 'fd' => array( |
1190 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1191 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1192 | - 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1193 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1194 | - 'cal_groups' => array('type' => 'varchar','precision' => '255'), |
|
1195 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1196 | - 'cal_endtime' => array('type' => 'int','precision' => '8'), |
|
1197 | - 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), |
|
1198 | - 'cal_type' => array('type' => 'varchar','precision' => '10'), |
|
1199 | - 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), |
|
1200 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1190 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1191 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1192 | + 'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1193 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1194 | + 'cal_groups' => array('type' => 'varchar', 'precision' => '255'), |
|
1195 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1196 | + 'cal_endtime' => array('type' => 'int', 'precision' => '8'), |
|
1197 | + 'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'), |
|
1198 | + 'cal_type' => array('type' => 'varchar', 'precision' => '10'), |
|
1199 | + 'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'), |
|
1200 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1201 | 1201 | 'cal_description' => array('type' => 'text'), |
1202 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1203 | - 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
1202 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1203 | + 'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
1204 | 1204 | ), |
1205 | 1205 | 'pk' => array('cal_id'), |
1206 | 1206 | 'fk' => array(), |
1207 | 1207 | 'ix' => array(), |
1208 | 1208 | 'uc' => array() |
1209 | - ),'cal_starttime'); |
|
1210 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1209 | + ), 'cal_starttime'); |
|
1210 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1211 | 1211 | 'fd' => array( |
1212 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1213 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1214 | - 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1215 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1216 | - 'cal_groups' => array('type' => 'varchar','precision' => '255'), |
|
1217 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1218 | - 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), |
|
1219 | - 'cal_type' => array('type' => 'varchar','precision' => '10'), |
|
1220 | - 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), |
|
1221 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1212 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1213 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1214 | + 'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1215 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1216 | + 'cal_groups' => array('type' => 'varchar', 'precision' => '255'), |
|
1217 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1218 | + 'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'), |
|
1219 | + 'cal_type' => array('type' => 'varchar', 'precision' => '10'), |
|
1220 | + 'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'), |
|
1221 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1222 | 1222 | 'cal_description' => array('type' => 'text'), |
1223 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1224 | - 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
1223 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1224 | + 'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
1225 | 1225 | ), |
1226 | 1226 | 'pk' => array('cal_id'), |
1227 | 1227 | 'fk' => array(), |
1228 | 1228 | 'ix' => array(), |
1229 | 1229 | 'uc' => array() |
1230 | - ),'cal_endtime'); |
|
1230 | + ), 'cal_endtime'); |
|
1231 | 1231 | |
1232 | 1232 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.1.001'; |
1233 | 1233 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1243,15 +1243,15 @@ discard block |
||
1243 | 1243 | 'precision' => '8', |
1244 | 1244 | 'default' => '0' |
1245 | 1245 | ));*/ |
1246 | - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user',array( |
|
1246 | + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user', array( |
|
1247 | 1247 | 'fd' => array( |
1248 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1249 | - 'cal_recur_date' => array('type' => 'int','precision' => '8','default' => '0'), |
|
1250 | - 'cal_user_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u'), |
|
1251 | - 'cal_user_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1252 | - 'cal_status' => array('type' => 'char','precision' => '1','default' => 'A') |
|
1248 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1249 | + 'cal_recur_date' => array('type' => 'int', 'precision' => '8', 'default' => '0'), |
|
1250 | + 'cal_user_type' => array('type' => 'varchar', 'precision' => '1', 'nullable' => False, 'default' => 'u'), |
|
1251 | + 'cal_user_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1252 | + 'cal_status' => array('type' => 'char', 'precision' => '1', 'default' => 'A') |
|
1253 | 1253 | ), |
1254 | - 'pk' => array('cal_id','cal_recur_date','cal_user_type','cal_user_id'), |
|
1254 | + 'pk' => array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id'), |
|
1255 | 1255 | 'fk' => array(), |
1256 | 1256 | 'ix' => array(), |
1257 | 1257 | 'uc' => array() |
@@ -1265,50 +1265,50 @@ discard block |
||
1265 | 1265 | |
1266 | 1266 | function calendar_upgrade1_0_1_002() |
1267 | 1267 | { |
1268 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1268 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1269 | 1269 | 'fd' => array( |
1270 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1271 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1272 | - 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1273 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1274 | - 'cal_groups' => array('type' => 'varchar','precision' => '255'), |
|
1275 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1276 | - 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), |
|
1277 | - 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), |
|
1278 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1270 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1271 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1272 | + 'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1273 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1274 | + 'cal_groups' => array('type' => 'varchar', 'precision' => '255'), |
|
1275 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1276 | + 'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'), |
|
1277 | + 'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'), |
|
1278 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1279 | 1279 | 'cal_description' => array('type' => 'text'), |
1280 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1281 | - 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
1280 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1281 | + 'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
1282 | 1282 | ), |
1283 | 1283 | 'pk' => array('cal_id'), |
1284 | 1284 | 'fk' => array(), |
1285 | 1285 | 'ix' => array(), |
1286 | 1286 | 'uc' => array() |
1287 | - ),'cal_type'); |
|
1288 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_owner',array( |
|
1287 | + ), 'cal_type'); |
|
1288 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_owner', array( |
|
1289 | 1289 | 'type' => 'int', |
1290 | 1290 | 'precision' => '4', |
1291 | 1291 | 'nullable' => False |
1292 | 1292 | )); |
1293 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_priority',array( |
|
1293 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_priority', array( |
|
1294 | 1294 | 'type' => 'int', |
1295 | 1295 | 'precision' => '2', |
1296 | 1296 | 'nullable' => False, |
1297 | 1297 | 'default' => '2' |
1298 | 1298 | )); |
1299 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_public',array( |
|
1299 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_public', array( |
|
1300 | 1300 | 'type' => 'int', |
1301 | 1301 | 'precision' => '2', |
1302 | 1302 | 'nullable' => False, |
1303 | 1303 | 'default' => '1' |
1304 | 1304 | )); |
1305 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_reference',array( |
|
1305 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_reference', array( |
|
1306 | 1306 | 'type' => 'int', |
1307 | 1307 | 'precision' => '4', |
1308 | 1308 | 'nullable' => False, |
1309 | 1309 | 'default' => '0' |
1310 | 1310 | )); |
1311 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_modifier',array( |
|
1311 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_modifier', array( |
|
1312 | 1312 | 'type' => 'int', |
1313 | 1313 | 'precision' => '4' |
1314 | 1314 | )); |
@@ -1321,36 +1321,36 @@ discard block |
||
1321 | 1321 | |
1322 | 1322 | function calendar_upgrade1_0_1_003() |
1323 | 1323 | { |
1324 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats',array( |
|
1324 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array( |
|
1325 | 1325 | 'fd' => array( |
1326 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1327 | - 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1328 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
1329 | - 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), |
|
1330 | - 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), |
|
1331 | - 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') |
|
1326 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1327 | + 'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1328 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
1329 | + 'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
1330 | + 'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
1331 | + 'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '') |
|
1332 | 1332 | ), |
1333 | 1333 | 'pk' => array('cal_id'), |
1334 | 1334 | 'fk' => array(), |
1335 | 1335 | 'ix' => array(), |
1336 | 1336 | 'uc' => array() |
1337 | - ),'recur_use_end'); |
|
1338 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','cal_id',array( |
|
1337 | + ), 'recur_use_end'); |
|
1338 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'cal_id', array( |
|
1339 | 1339 | 'type' => 'int', |
1340 | 1340 | 'precision' => '4', |
1341 | 1341 | 'nullable' => False |
1342 | 1342 | )); |
1343 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_type',array( |
|
1343 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_type', array( |
|
1344 | 1344 | 'type' => 'int', |
1345 | 1345 | 'precision' => '2', |
1346 | 1346 | 'nullable' => False |
1347 | 1347 | )); |
1348 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_interval',array( |
|
1348 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_interval', array( |
|
1349 | 1349 | 'type' => 'int', |
1350 | 1350 | 'precision' => '2', |
1351 | 1351 | 'default' => '1' |
1352 | 1352 | )); |
1353 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_data',array( |
|
1353 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_data', array( |
|
1354 | 1354 | 'type' => 'int', |
1355 | 1355 | 'precision' => '2', |
1356 | 1356 | 'default' => '1' |
@@ -1364,13 +1364,13 @@ discard block |
||
1364 | 1364 | |
1365 | 1365 | function calendar_upgrade1_0_1_004() |
1366 | 1366 | { |
1367 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_id',array( |
|
1367 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_id', array( |
|
1368 | 1368 | 'type' => 'int', |
1369 | 1369 | 'precision' => '4', |
1370 | 1370 | 'nullable' => False, |
1371 | 1371 | 'default' => '0' |
1372 | 1372 | )); |
1373 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
1373 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
1374 | 1374 | 'type' => 'int', |
1375 | 1375 | 'precision' => '4', |
1376 | 1376 | 'nullable' => False, |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | |
1386 | 1386 | function calendar_upgrade1_0_1_005() |
1387 | 1387 | { |
1388 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_quantity',array( |
|
1388 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_quantity', array( |
|
1389 | 1389 | 'type' => 'int', |
1390 | 1390 | 'precision' => '4', |
1391 | 1391 | 'default' => '1' |
@@ -1399,7 +1399,7 @@ discard block |
||
1399 | 1399 | |
1400 | 1400 | function calendar_upgrade1_0_1_006() |
1401 | 1401 | { |
1402 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_non_blocking',array( |
|
1402 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_non_blocking', array( |
|
1403 | 1403 | 'type' => 'int', |
1404 | 1404 | 'precision' => '2', |
1405 | 1405 | 'default' => '0' |
@@ -1413,9 +1413,9 @@ discard block |
||
1413 | 1413 | |
1414 | 1414 | function calendar_upgrade1_0_1_007() |
1415 | 1415 | { |
1416 | - $GLOBALS['egw_setup']->db->update('egw_cal_repeats',array('recur_exception' => null),array('recur_exception' => ''),__LINE__,__FILE__,'calendar'); |
|
1416 | + $GLOBALS['egw_setup']->db->update('egw_cal_repeats', array('recur_exception' => null), array('recur_exception' => ''), __LINE__, __FILE__, 'calendar'); |
|
1417 | 1417 | |
1418 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_exception',array( |
|
1418 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_exception', array( |
|
1419 | 1419 | 'type' => 'text' |
1420 | 1420 | )); |
1421 | 1421 | |
@@ -1432,11 +1432,11 @@ discard block |
||
1432 | 1432 | { |
1433 | 1433 | $customfields = array(); |
1434 | 1434 | $order = 0; |
1435 | - foreach($config_data['fields'] as $name => $data) |
|
1435 | + foreach ($config_data['fields'] as $name => $data) |
|
1436 | 1436 | { |
1437 | 1437 | if ($name{0} == '#' && !$data['disabled']) // real not-disabled custom field |
1438 | 1438 | { |
1439 | - $customfields[substr($name,1)] = array( |
|
1439 | + $customfields[substr($name, 1)] = array( |
|
1440 | 1440 | 'type' => 'text', |
1441 | 1441 | 'len' => $data['length'].($data['shown'] ? ','.$data['shown'] : ''), |
1442 | 1442 | 'label' => $data['name'], |
@@ -1459,38 +1459,38 @@ discard block |
||
1459 | 1459 | function calendar_upgrade1_0_1_009() |
1460 | 1460 | { |
1461 | 1461 | $db2 = clone($GLOBALS['egw_setup']->db); |
1462 | - $GLOBALS['egw_setup']->db->select('egw_cal','DISTINCT egw_cal.cal_id,cal_groups,cal_recur_date',"cal_groups != ''",__LINE__,__FILE__, |
|
1463 | - False,'','calendar',0,',egw_cal_user WHERE egw_cal.cal_id=egw_cal_user.cal_id'); |
|
1464 | - while(($row = $GLOBALS['egw_setup']->db->row(true))) |
|
1462 | + $GLOBALS['egw_setup']->db->select('egw_cal', 'DISTINCT egw_cal.cal_id,cal_groups,cal_recur_date', "cal_groups != ''", __LINE__, __FILE__, |
|
1463 | + False, '', 'calendar', 0, ',egw_cal_user WHERE egw_cal.cal_id=egw_cal_user.cal_id'); |
|
1464 | + while (($row = $GLOBALS['egw_setup']->db->row(true))) |
|
1465 | 1465 | { |
1466 | 1466 | $row['cal_user_type'] = 'u'; |
1467 | - foreach(explode(',',$row['cal_groups']) as $group) |
|
1467 | + foreach (explode(',', $row['cal_groups']) as $group) |
|
1468 | 1468 | { |
1469 | 1469 | $row['cal_user_id'] = $group; |
1470 | - $db2->insert('egw_cal_user',array('cal_status' => 'U'),$row,__LINE__,__FILE__,'calendar'); |
|
1470 | + $db2->insert('egw_cal_user', array('cal_status' => 'U'), $row, __LINE__, __FILE__, 'calendar'); |
|
1471 | 1471 | } |
1472 | 1472 | } |
1473 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1473 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1474 | 1474 | 'fd' => array( |
1475 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1476 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1477 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
1478 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1479 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1480 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
1481 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), |
|
1482 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1475 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1476 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1477 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
1478 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1479 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1480 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
1481 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'), |
|
1482 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1483 | 1483 | 'cal_description' => array('type' => 'text'), |
1484 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1485 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
1486 | - 'cal_modifier' => array('type' => 'int','precision' => '4'), |
|
1487 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0') |
|
1484 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1485 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
1486 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4'), |
|
1487 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0') |
|
1488 | 1488 | ), |
1489 | 1489 | 'pk' => array('cal_id'), |
1490 | 1490 | 'fk' => array(), |
1491 | 1491 | 'ix' => array(), |
1492 | 1492 | 'uc' => array() |
1493 | - ),'cal_groups'); |
|
1493 | + ), 'cal_groups'); |
|
1494 | 1494 | |
1495 | 1495 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.2'; |
1496 | 1496 | } |
@@ -1500,7 +1500,7 @@ discard block |
||
1500 | 1500 | function calendar_upgrade1_2() |
1501 | 1501 | { |
1502 | 1502 | // get old alarms (saved before 1.2) working again |
1503 | - $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 | + $GLOBALS['egw_setup']->db->query("UPDATE egw_async SET async_method ='calendar.bocalupdate.send_alarm' WHERE async_method ='calendar.bocalendar.send_alarm'", __LINE__, __FILE__); |
|
1504 | 1504 | |
1505 | 1505 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.2.001'; |
1506 | 1506 | } |
@@ -1508,7 +1508,7 @@ discard block |
||
1508 | 1508 | |
1509 | 1509 | function calendar_upgrade1_2_001() |
1510 | 1510 | { |
1511 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_special',array( |
|
1511 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_special', array( |
|
1512 | 1512 | 'type' => 'int', |
1513 | 1513 | 'precision' => '2', |
1514 | 1514 | 'default' => '0' |
@@ -1526,7 +1526,7 @@ discard block |
||
1526 | 1526 | |
1527 | 1527 | function calendar_upgrade1_4() |
1528 | 1528 | { |
1529 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_etag',array( |
|
1529 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_etag', array( |
|
1530 | 1530 | 'type' => 'int', |
1531 | 1531 | 'precision' => '4', |
1532 | 1532 | 'default' => '0' |
@@ -1538,59 +1538,59 @@ discard block |
||
1538 | 1538 | |
1539 | 1539 | function calendar_upgrade1_5() |
1540 | 1540 | { |
1541 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1541 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1542 | 1542 | 'fd' => array( |
1543 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1544 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1545 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
1546 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1547 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1548 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
1549 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), |
|
1550 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1543 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1544 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1545 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
1546 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1547 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1548 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
1549 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'), |
|
1550 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1551 | 1551 | 'cal_description' => array('type' => 'text'), |
1552 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1553 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
1554 | - 'cal_modifier' => array('type' => 'int','precision' => '4'), |
|
1555 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0'), |
|
1556 | - 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), |
|
1557 | - 'cal_etag' => array('type' => 'int','precision' => '4'), |
|
1558 | - 'cal_edit_time' => array('type' => 'int','precision' => '8') |
|
1552 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1553 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
1554 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4'), |
|
1555 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
1556 | + 'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
1557 | + 'cal_etag' => array('type' => 'int', 'precision' => '4'), |
|
1558 | + 'cal_edit_time' => array('type' => 'int', 'precision' => '8') |
|
1559 | 1559 | ), |
1560 | 1560 | 'pk' => array('cal_id'), |
1561 | 1561 | 'fk' => array(), |
1562 | 1562 | 'ix' => array(), |
1563 | 1563 | 'uc' => array() |
1564 | - ),'cal_edit_user'); |
|
1565 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1564 | + ), 'cal_edit_user'); |
|
1565 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1566 | 1566 | 'fd' => array( |
1567 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1568 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1569 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
1570 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1571 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1572 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
1573 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), |
|
1574 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1567 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1568 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1569 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
1570 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1571 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1572 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
1573 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'), |
|
1574 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1575 | 1575 | 'cal_description' => array('type' => 'text'), |
1576 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1577 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
1578 | - 'cal_modifier' => array('type' => 'int','precision' => '4'), |
|
1579 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0'), |
|
1580 | - 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), |
|
1581 | - 'cal_etag' => array('type' => 'int','precision' => '4') |
|
1576 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1577 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
1578 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4'), |
|
1579 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
1580 | + 'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
1581 | + 'cal_etag' => array('type' => 'int', 'precision' => '4') |
|
1582 | 1582 | ), |
1583 | 1583 | 'pk' => array('cal_id'), |
1584 | 1584 | 'fk' => array(), |
1585 | 1585 | 'ix' => array(), |
1586 | 1586 | 'uc' => array() |
1587 | - ),'cal_edit_time'); |
|
1588 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_etag',array( |
|
1587 | + ), 'cal_edit_time'); |
|
1588 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_etag', array( |
|
1589 | 1589 | 'type' => 'int', |
1590 | 1590 | 'precision' => '4', |
1591 | 1591 | 'default' => '0' |
1592 | 1592 | )); |
1593 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_etag=0 WHERE cal_etag IS NULL',__LINE__,__FILE__); |
|
1593 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_etag=0 WHERE cal_etag IS NULL', __LINE__, __FILE__); |
|
1594 | 1594 | |
1595 | 1595 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.5.001'; |
1596 | 1596 | } |
@@ -1598,12 +1598,12 @@ discard block |
||
1598 | 1598 | |
1599 | 1599 | function calendar_upgrade1_5_001() |
1600 | 1600 | { |
1601 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_id',array( |
|
1601 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_id', array( |
|
1602 | 1602 | 'type' => 'int', |
1603 | 1603 | 'precision' => '4', |
1604 | 1604 | 'nullable' => False |
1605 | 1605 | )); |
1606 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
1606 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
1607 | 1607 | 'type' => 'varchar', |
1608 | 1608 | 'precision' => '128', |
1609 | 1609 | 'nullable' => False |
@@ -1617,12 +1617,12 @@ discard block |
||
1617 | 1617 | { |
1618 | 1618 | // update the alarm methods |
1619 | 1619 | $async = new Api\Asyncservice(); |
1620 | - foreach((array)$async->read('cal:%') as $job) |
|
1620 | + foreach ((array)$async->read('cal:%') as $job) |
|
1621 | 1621 | { |
1622 | 1622 | if ($job['method'] == 'calendar.bocalupdate.send_alarm') |
1623 | 1623 | { |
1624 | 1624 | $job['method'] = 'calendar.calendar_boupdate.send_alarm'; |
1625 | - $async->write($job,true); |
|
1625 | + $async->write($job, true); |
|
1626 | 1626 | } |
1627 | 1627 | } |
1628 | 1628 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.6'; |
@@ -1639,48 +1639,48 @@ discard block |
||
1639 | 1639 | { |
1640 | 1640 | // Set UID of series exception to UID of series master |
1641 | 1641 | // update cal_etag, cal_modified and cal_modifier to distribute changes on GroupDAV devices |
1642 | - foreach($GLOBALS['egw_setup']->db->query(' |
|
1642 | + foreach ($GLOBALS['egw_setup']->db->query(' |
|
1643 | 1643 | SELECT cal_ex.cal_id,cal_ex.cal_uid AS cal_uid_ex,cal_master.cal_uid AS cal_uid_master |
1644 | 1644 | FROM egw_cal cal_ex |
1645 | 1645 | JOIN egw_cal cal_master ON cal_ex.cal_reference=cal_master.cal_id |
1646 | - WHERE cal_ex.cal_reference != 0',__LINE__,__FILE__) as $row) |
|
1646 | + WHERE cal_ex.cal_reference != 0',__LINE__, __FILE__) as $row) |
|
1647 | 1647 | { |
1648 | 1648 | if (strlen($row['cal_uid_master']) > 0 && $row['cal_uid_ex'] != $row['cal_uid_master']) |
1649 | 1649 | { |
1650 | 1650 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_uid=\''.$row['cal_uid_master']. |
1651 | 1651 | '\',cal_etag=cal_etag+1,cal_modified='.time(). |
1652 | - ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
1652 | + ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
1653 | 1653 | } |
1654 | 1654 | } |
1655 | 1655 | |
1656 | 1656 | // Search series exception for nearest exception in series master and add that RECURRENCE-ID |
1657 | 1657 | // as cal_reference (for 1.6.003 and move it to new field cal_recurrence in 1.7.001) |
1658 | 1658 | $diff = null; |
1659 | - foreach($GLOBALS['egw_setup']->db->query('SELECT egw_cal.cal_id,cal_start,recur_exception FROM egw_cal |
|
1659 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT egw_cal.cal_id,cal_start,recur_exception FROM egw_cal |
|
1660 | 1660 | JOIN egw_cal_dates ON egw_cal.cal_id=egw_cal_dates.cal_id |
1661 | 1661 | JOIN egw_cal_repeats ON cal_reference=egw_cal_repeats.cal_id |
1662 | - WHERE cal_reference != 0',__LINE__,__FILE__) as $row) |
|
1662 | + WHERE cal_reference != 0',__LINE__, __FILE__) as $row) |
|
1663 | 1663 | { |
1664 | 1664 | $recurrence = null; |
1665 | - foreach(explode(',',$row['recur_exception']) as $ts) |
|
1665 | + foreach (explode(',', $row['recur_exception']) as $ts) |
|
1666 | 1666 | { |
1667 | - if (is_null($recurrence) || abs($ts-$row['cal_start']) < $diff) |
|
1667 | + if (is_null($recurrence) || abs($ts - $row['cal_start']) < $diff) |
|
1668 | 1668 | { |
1669 | 1669 | $recurrence = $ts; |
1670 | - $diff = abs($ts-$row['cal_start']); |
|
1670 | + $diff = abs($ts - $row['cal_start']); |
|
1671 | 1671 | } |
1672 | 1672 | } |
1673 | 1673 | if ($recurrence) |
1674 | 1674 | { |
1675 | 1675 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_reference='.(int)$recurrence. |
1676 | - ' WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
1676 | + ' WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
1677 | 1677 | } |
1678 | 1678 | else |
1679 | 1679 | { |
1680 | 1680 | // if we cannot determine the RECURRENCE-ID use cal_start |
1681 | 1681 | // because RECURRENCE-ID must be present |
1682 | 1682 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_reference='.(int)$row['cal_start']. |
1683 | - ' WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
1683 | + ' WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
1684 | 1684 | } |
1685 | 1685 | } |
1686 | 1686 | |
@@ -1695,33 +1695,33 @@ discard block |
||
1695 | 1695 | */ |
1696 | 1696 | function calendar_upgrade1_6_003() |
1697 | 1697 | { |
1698 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_creator',array( |
|
1698 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_creator', array( |
|
1699 | 1699 | 'type' => 'int', |
1700 | 1700 | 'precision' => '4', |
1701 | 1701 | 'comment' => 'creating user' |
1702 | 1702 | )); |
1703 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_creator=cal_owner',__LINE__,__FILE__); |
|
1704 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_creator',array( |
|
1703 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_creator=cal_owner', __LINE__, __FILE__); |
|
1704 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_creator', array( |
|
1705 | 1705 | 'type' => 'int', |
1706 | 1706 | 'precision' => '4', |
1707 | 1707 | 'nullable' => False, |
1708 | 1708 | 'comment' => 'creating user' |
1709 | 1709 | )); |
1710 | 1710 | |
1711 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_created',array( |
|
1711 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_created', array( |
|
1712 | 1712 | 'type' => 'int', |
1713 | 1713 | 'precision' => '8', |
1714 | 1714 | 'comment' => 'creation time of event' |
1715 | 1715 | )); |
1716 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_created=cal_modified',__LINE__,__FILE__); |
|
1717 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_created',array( |
|
1716 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_created=cal_modified', __LINE__, __FILE__); |
|
1717 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_created', array( |
|
1718 | 1718 | 'type' => 'int', |
1719 | 1719 | 'precision' => '8', |
1720 | 1720 | 'nullable' => False, |
1721 | 1721 | 'comment' => 'creation time of event' |
1722 | 1722 | )); |
1723 | 1723 | |
1724 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_recurrence',array( |
|
1724 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_recurrence', array( |
|
1725 | 1725 | 'type' => 'int', |
1726 | 1726 | 'precision' => '8', |
1727 | 1727 | 'nullable' => False, |
@@ -1732,14 +1732,14 @@ discard block |
||
1732 | 1732 | // move RECURRENCE-ID from temporarily (1.6.003) |
1733 | 1733 | // used field cal_reference to new field cal_recurrence |
1734 | 1734 | // and restore cal_reference field of series exceptions with id of the series master |
1735 | - foreach($GLOBALS['egw_setup']->db->query(' |
|
1735 | + foreach ($GLOBALS['egw_setup']->db->query(' |
|
1736 | 1736 | SELECT cal_ex.cal_id AS cal_id_ex,cal_master.cal_id AS cal_id_master, |
1737 | 1737 | cal_ex.cal_reference AS cal_reference_ex,cal_ex.cal_uid AS cal_uid_ex, |
1738 | 1738 | cal_master.cal_uid AS cal_uid_master |
1739 | 1739 | FROM egw_cal cal_ex |
1740 | 1740 | JOIN egw_cal cal_master |
1741 | 1741 | ON cal_ex.cal_uid=cal_master.cal_uid AND cal_master.cal_reference = 0 AND cal_ex.cal_owner = cal_master.cal_owner |
1742 | - WHERE cal_ex.cal_reference !=0 AND cal_master.cal_id IS NOT NULL',__LINE__,__FILE__) as $row) |
|
1742 | + WHERE cal_ex.cal_reference !=0 AND cal_master.cal_id IS NOT NULL',__LINE__, __FILE__) as $row) |
|
1743 | 1743 | { |
1744 | 1744 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_recurrence='.(int)$row['cal_reference_ex']. |
1745 | 1745 | ', cal_reference='.(int)$row['cal_id_master']. |
@@ -1756,7 +1756,7 @@ discard block |
||
1756 | 1756 | */ |
1757 | 1757 | function calendar_upgrade1_7_001() |
1758 | 1758 | { |
1759 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_role',array( |
|
1759 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_role', array( |
|
1760 | 1760 | 'type' => 'varchar', |
1761 | 1761 | 'precision' => '64', |
1762 | 1762 | 'default' => 'REQ-PARTICIPANT' |
@@ -1772,14 +1772,14 @@ discard block |
||
1772 | 1772 | */ |
1773 | 1773 | function calendar_upgrade1_7_002() |
1774 | 1774 | { |
1775 | - $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_timezones',array( |
|
1775 | + $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_timezones', array( |
|
1776 | 1776 | 'fd' => array( |
1777 | - 'tz_id' => array('type' => 'auto','nullable' => False), |
|
1778 | - 'tz_tzid' => array('type' => 'varchar','precision' => '128','nullable' => False), |
|
1779 | - 'tz_alias' => array('type' => 'int','precision' => '4','comment' => 'tz_id for data'), |
|
1780 | - 'tz_latitude' => array('type' => 'int','precision' => '4'), |
|
1781 | - 'tz_longitude' => array('type' => 'int','precision' => '4'), |
|
1782 | - 'tz_component' => array('type' => 'text','comment' => 'iCal VTIMEZONE component') |
|
1777 | + 'tz_id' => array('type' => 'auto', 'nullable' => False), |
|
1778 | + 'tz_tzid' => array('type' => 'varchar', 'precision' => '128', 'nullable' => False), |
|
1779 | + 'tz_alias' => array('type' => 'int', 'precision' => '4', 'comment' => 'tz_id for data'), |
|
1780 | + 'tz_latitude' => array('type' => 'int', 'precision' => '4'), |
|
1781 | + 'tz_longitude' => array('type' => 'int', 'precision' => '4'), |
|
1782 | + 'tz_component' => array('type' => 'text', 'comment' => 'iCal VTIMEZONE component') |
|
1783 | 1783 | ), |
1784 | 1784 | 'pk' => array('tz_id'), |
1785 | 1785 | 'fk' => array(), |
@@ -1799,38 +1799,38 @@ discard block |
||
1799 | 1799 | */ |
1800 | 1800 | function calendar_upgrade1_7_003() |
1801 | 1801 | { |
1802 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_type',array( |
|
1802 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_type', array( |
|
1803 | 1803 | 'type' => 'varchar', |
1804 | 1804 | 'precision' => '1', |
1805 | 1805 | 'nullable' => False, |
1806 | 1806 | 'default' => 'u', |
1807 | 1807 | 'comment' => 'u=user, g=group, c=contact, r=resource, e=email' |
1808 | 1808 | )); |
1809 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
1809 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
1810 | 1810 | 'type' => 'varchar', |
1811 | 1811 | 'precision' => '128', |
1812 | 1812 | 'nullable' => False, |
1813 | 1813 | 'comment' => 'id or email-address for type=e' |
1814 | 1814 | )); |
1815 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_status',array( |
|
1815 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_status', array( |
|
1816 | 1816 | 'type' => 'char', |
1817 | 1817 | 'precision' => '1', |
1818 | 1818 | 'default' => 'A', |
1819 | 1819 | 'comment' => 'U=unknown, A=accepted, R=rejected, T=tentative' |
1820 | 1820 | )); |
1821 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_quantity',array( |
|
1821 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_quantity', array( |
|
1822 | 1822 | 'type' => 'int', |
1823 | 1823 | 'precision' => '4', |
1824 | 1824 | 'default' => '1', |
1825 | 1825 | 'comment' => 'only for certain types (eg. resources)' |
1826 | 1826 | )); |
1827 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_role',array( |
|
1827 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_role', array( |
|
1828 | 1828 | 'type' => 'varchar', |
1829 | 1829 | 'precision' => '64', |
1830 | 1830 | 'default' => 'REQ-PARTICIPANT', |
1831 | 1831 | 'comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id' |
1832 | 1832 | )); |
1833 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_user_modified',array( |
|
1833 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_user_modified', array( |
|
1834 | 1834 | 'type' => 'timestamp', |
1835 | 1835 | 'default' => 'current_timestamp', |
1836 | 1836 | 'comment' => 'automatic timestamp of last update' |
@@ -1846,19 +1846,19 @@ discard block |
||
1846 | 1846 | */ |
1847 | 1847 | function calendar_upgrade1_7_004() |
1848 | 1848 | { |
1849 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates','cal_start',array( |
|
1849 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates', 'cal_start', array( |
|
1850 | 1850 | 'type' => 'int', |
1851 | 1851 | 'precision' => '8', |
1852 | 1852 | 'nullable' => False, |
1853 | 1853 | 'comment' => 'starttime in server time' |
1854 | 1854 | )); |
1855 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates','cal_end',array( |
|
1855 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates', 'cal_end', array( |
|
1856 | 1856 | 'type' => 'int', |
1857 | 1857 | 'precision' => '8', |
1858 | 1858 | 'nullable' => False, |
1859 | 1859 | 'comment' => 'endtime in server time' |
1860 | 1860 | )); |
1861 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','tz_id',array( |
|
1861 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'tz_id', array( |
|
1862 | 1862 | 'type' => 'int', |
1863 | 1863 | 'precision' => '4', |
1864 | 1864 | 'comment' => 'key into egw_cal_timezones' |
@@ -1867,7 +1867,7 @@ discard block |
||
1867 | 1867 | // set id of server timezone for existing events, as that's the timezone their recurrences are using |
1868 | 1868 | if (($tzid = date_default_timezone_get()) && ($tz_id = calendar_timezones::tz2id($tzid))) |
1869 | 1869 | { |
1870 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET tz_id='.(int)$tz_id,__LINE__,__FILE__); |
|
1870 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET tz_id='.(int)$tz_id, __LINE__, __FILE__); |
|
1871 | 1871 | } |
1872 | 1872 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.005'; |
1873 | 1873 | } |
@@ -1894,22 +1894,22 @@ discard block |
||
1894 | 1894 | */ |
1895 | 1895 | function calendar_upgrade1_7_006() |
1896 | 1896 | { |
1897 | - foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
1898 | - WHERE (cal_end-cal_start)%86400=86340',__LINE__,__FILE__) as $row) |
|
1897 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
1898 | + WHERE (cal_end-cal_start)%86400=86340',__LINE__, __FILE__) as $row) |
|
1899 | 1899 | { |
1900 | 1900 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end+59 |
1901 | - WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__); |
|
1901 | + WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'], __LINE__, __FILE__); |
|
1902 | 1902 | } |
1903 | 1903 | |
1904 | - foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
1905 | - WHERE cal_end-cal_start>0 AND (cal_end-cal_start)%86400=0',__LINE__,__FILE__) as $row) |
|
1904 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
1905 | + WHERE cal_end-cal_start>0 AND (cal_end-cal_start)%86400=0',__LINE__, __FILE__) as $row) |
|
1906 | 1906 | { |
1907 | 1907 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end-1 |
1908 | - WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__); |
|
1908 | + WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'], __LINE__, __FILE__); |
|
1909 | 1909 | } |
1910 | 1910 | |
1911 | 1911 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1 |
1912 | - WHERE recur_interval=0',__LINE__,__FILE__); |
|
1912 | + WHERE recur_interval=0',__LINE__, __FILE__); |
|
1913 | 1913 | |
1914 | 1914 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.007'; |
1915 | 1915 | } |
@@ -1925,17 +1925,17 @@ discard block |
||
1925 | 1925 | { |
1926 | 1926 | // Set UID of series exception to UID of series master |
1927 | 1927 | // update cal_etag,cal_modified and cal_modifier to distribute changes on GroupDAV devices |
1928 | - foreach($GLOBALS['egw_setup']->db->query(' |
|
1928 | + foreach ($GLOBALS['egw_setup']->db->query(' |
|
1929 | 1929 | SELECT cal_ex.cal_id,cal_ex.cal_uid AS cal_uid_ex,cal_master.cal_uid AS cal_uid_master |
1930 | 1930 | FROM egw_cal cal_ex |
1931 | 1931 | JOIN egw_cal cal_master ON cal_ex.cal_reference=cal_master.cal_id |
1932 | - WHERE cal_ex.cal_reference != 0',__LINE__,__FILE__) as $row) |
|
1932 | + WHERE cal_ex.cal_reference != 0',__LINE__, __FILE__) as $row) |
|
1933 | 1933 | { |
1934 | 1934 | if (strlen($row['cal_uid_master']) > 0 && $row['cal_uid_ex'] != $row['cal_uid_master']) |
1935 | 1935 | { |
1936 | 1936 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_uid=\''.$row['cal_uid_master']. |
1937 | 1937 | '\',cal_etag=cal_etag+1,cal_modified='.time(). |
1938 | - ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
1938 | + ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
1939 | 1939 | } |
1940 | 1940 | } |
1941 | 1941 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.008'; |
@@ -1948,7 +1948,7 @@ discard block |
||
1948 | 1948 | */ |
1949 | 1949 | function calendar_upgrade1_7_008() |
1950 | 1950 | { |
1951 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user',array('cal_user_type','cal_user_id')); |
|
1951 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user', array('cal_user_type', 'cal_user_id')); |
|
1952 | 1952 | |
1953 | 1953 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.009'; |
1954 | 1954 | } |
@@ -1960,22 +1960,22 @@ discard block |
||
1960 | 1960 | */ |
1961 | 1961 | function calendar_upgrade1_7_009() |
1962 | 1962 | { |
1963 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_uid'); |
|
1964 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_owner'); |
|
1963 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_uid'); |
|
1964 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_owner'); |
|
1965 | 1965 | |
1966 | 1966 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.010'; |
1967 | 1967 | } |
1968 | 1968 | |
1969 | 1969 | function calendar_upgrade1_7_010() |
1970 | 1970 | { |
1971 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_deleted',array( |
|
1971 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_deleted', array( |
|
1972 | 1972 | 'type' => 'bool', |
1973 | 1973 | 'nullable' => False, |
1974 | 1974 | 'default' => '0', |
1975 | 1975 | 'comment' => '1 if the event has been deleted, but you want to keep it around' |
1976 | 1976 | )); |
1977 | 1977 | |
1978 | - return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.001'; // was 1.7.011 |
|
1978 | + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.001'; // was 1.7.011 |
|
1979 | 1979 | } |
1980 | 1980 | |
1981 | 1981 | function calendar_upgrade1_7_011() |
@@ -2005,36 +2005,36 @@ discard block |
||
2005 | 2005 | 'precision' => '8', |
2006 | 2006 | 'comment' => 'ts when event was deleted' |
2007 | 2007 | ));*/ |
2008 | - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal',array( |
|
2008 | + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal', array( |
|
2009 | 2009 | 'fd' => array( |
2010 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
2011 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False,'comment' => 'unique id of event(-series)'), |
|
2012 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'event owner / calendar'), |
|
2013 | - 'cal_category' => array('type' => 'varchar','precision' => '30','comment' => 'category id'), |
|
2014 | - 'cal_modified' => array('type' => 'int','precision' => '8','comment' => 'ts of last modification'), |
|
2015 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
2016 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1','comment' => '1=public, 0=private event'), |
|
2017 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
2010 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
2011 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'comment' => 'unique id of event(-series)'), |
|
2012 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'event owner / calendar'), |
|
2013 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30', 'comment' => 'category id'), |
|
2014 | + 'cal_modified' => array('type' => 'int', 'precision' => '8', 'comment' => 'ts of last modification'), |
|
2015 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
2016 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1', 'comment' => '1=public, 0=private event'), |
|
2017 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
2018 | 2018 | 'cal_description' => array('type' => 'text'), |
2019 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
2020 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'cal_id of series for exception'), |
|
2021 | - 'cal_modifier' => array('type' => 'int','precision' => '4','comment' => 'user who last modified event'), |
|
2022 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0','comment' => '1 for non-blocking events'), |
|
2023 | - 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), |
|
2024 | - 'cal_etag' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'etag for optimistic locking'), |
|
2025 | - 'cal_creator' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'creating user'), |
|
2026 | - 'cal_created' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'creation time of event'), |
|
2027 | - 'cal_recurrence' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0','comment' => 'cal_start of original recurrence for exception'), |
|
2028 | - 'tz_id' => array('type' => 'int','precision' => '4','comment' => 'key into egw_cal_timezones'), |
|
2029 | - 'cal_deleted' => array('type' => 'int','precision' => '8','comment' => 'ts when event was deleted') |
|
2019 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
2020 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'cal_id of series for exception'), |
|
2021 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4', 'comment' => 'user who last modified event'), |
|
2022 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0', 'comment' => '1 for non-blocking events'), |
|
2023 | + 'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
2024 | + 'cal_etag' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'comment' => 'etag for optimistic locking'), |
|
2025 | + 'cal_creator' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'creating user'), |
|
2026 | + 'cal_created' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'comment' => 'creation time of event'), |
|
2027 | + 'cal_recurrence' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0', 'comment' => 'cal_start of original recurrence for exception'), |
|
2028 | + 'tz_id' => array('type' => 'int', 'precision' => '4', 'comment' => 'key into egw_cal_timezones'), |
|
2029 | + 'cal_deleted' => array('type' => 'int', 'precision' => '8', 'comment' => 'ts when event was deleted') |
|
2030 | 2030 | ), |
2031 | 2031 | 'pk' => array('cal_id'), |
2032 | 2032 | 'fk' => array(), |
2033 | - 'ix' => array('cal_uid','cal_owner','cal_deleted'), |
|
2033 | + 'ix' => array('cal_uid', 'cal_owner', 'cal_deleted'), |
|
2034 | 2034 | 'uc' => array() |
2035 | - ),array( |
|
2035 | + ), array( |
|
2036 | 2036 | // for deleted rows use cal_modified as deleted date, NULL for not deleted ones |
2037 | - 'cal_deleted' => 'CASE cal_deleted WHEN '.$GLOBALS['egw_setup']->db->quote(true,'bool').' THEN cal_modified ELSE NULL END', |
|
2037 | + 'cal_deleted' => 'CASE cal_deleted WHEN '.$GLOBALS['egw_setup']->db->quote(true, 'bool').' THEN cal_modified ELSE NULL END', |
|
2038 | 2038 | )); |
2039 | 2039 | |
2040 | 2040 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.002'; |
@@ -2046,16 +2046,16 @@ discard block |
||
2046 | 2046 | */ |
2047 | 2047 | function calendar_upgrade1_9_002() |
2048 | 2048 | { |
2049 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','caldav_name',array( |
|
2049 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'caldav_name', array( |
|
2050 | 2050 | 'type' => 'varchar', |
2051 | 2051 | 'precision' => '64', |
2052 | 2052 | 'comment' => 'name part of CalDAV URL, if specified by client' |
2053 | 2053 | )); |
2054 | - $GLOBALS['egw_setup']->db->query($sql='UPDATE egw_cal SET caldav_name='. |
|
2054 | + $GLOBALS['egw_setup']->db->query($sql = 'UPDATE egw_cal SET caldav_name='. |
|
2055 | 2055 | $GLOBALS['egw_setup']->db->concat( |
2056 | - $GLOBALS['egw_setup']->db->to_varchar('cal_id'),"'.ics'"),__LINE__,__FILE__); |
|
2056 | + $GLOBALS['egw_setup']->db->to_varchar('cal_id'), "'.ics'"), __LINE__, __FILE__); |
|
2057 | 2057 | |
2058 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','caldav_name'); |
|
2058 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'caldav_name'); |
|
2059 | 2059 | |
2060 | 2060 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.003'; |
2061 | 2061 | } |
@@ -2066,8 +2066,8 @@ discard block |
||
2066 | 2066 | */ |
2067 | 2067 | function calendar_upgrade1_9_003() |
2068 | 2068 | { |
2069 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_modified'); |
|
2070 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user','cal_user_modified'); |
|
2069 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_modified'); |
|
2070 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user', 'cal_user_modified'); |
|
2071 | 2071 | |
2072 | 2072 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.004'; |
2073 | 2073 | } |
@@ -2079,7 +2079,7 @@ discard block |
||
2079 | 2079 | */ |
2080 | 2080 | function calendar_upgrade1_9_004() |
2081 | 2081 | { |
2082 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_dates','recur_exception',array( |
|
2082 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_dates', 'recur_exception', array( |
|
2083 | 2083 | 'type' => 'bool', |
2084 | 2084 | 'default' => '', |
2085 | 2085 | 'null' => false, |
@@ -2087,16 +2087,16 @@ discard block |
||
2087 | 2087 | )); |
2088 | 2088 | |
2089 | 2089 | // migrate existing exceptions to egw_cal_dates |
2090 | - foreach($GLOBALS['egw_setup']->db->select('egw_cal_repeats', |
|
2090 | + foreach ($GLOBALS['egw_setup']->db->select('egw_cal_repeats', |
|
2091 | 2091 | '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', |
2092 | 2092 | 'egw_cal_repeats.recur_exception IS NOT NULL', __LINE__, __FILE__, false, |
2093 | 2093 | 'GROUP BY egw_cal_repeats.cal_id,egw_cal_repeats.recur_exception', 'calendar', '', |
2094 | 2094 | 'JOIN egw_cal_dates ON egw_cal_repeats.cal_id=egw_cal_dates.cal_id') as $row) |
2095 | 2095 | { |
2096 | - foreach($row['recur_exception'] ? array_unique(explode(',', $row['recur_exception'])) : array() as $recur_exception) |
|
2096 | + foreach ($row['recur_exception'] ? array_unique(explode(',', $row['recur_exception'])) : array() as $recur_exception) |
|
2097 | 2097 | { |
2098 | 2098 | $GLOBALS['egw_setup']->db->insert('egw_cal_dates', array( |
2099 | - 'cal_end' => $recur_exception+$row['cal_end']-$row['cal_start'], |
|
2099 | + 'cal_end' => $recur_exception + $row['cal_end'] - $row['cal_start'], |
|
2100 | 2100 | 'recur_exception' => true, |
2101 | 2101 | ), array( |
2102 | 2102 | 'cal_id' => $row['cal_id'], |
@@ -2108,11 +2108,11 @@ discard block |
||
2108 | 2108 | |
2109 | 2109 | $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array( |
2110 | 2110 | 'fd' => array( |
2111 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
2112 | - 'recur_type' => array('type' => 'int','precision' => '2','nullable' => False), |
|
2113 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
2114 | - 'recur_interval' => array('type' => 'int','precision' => '2','default' => '1'), |
|
2115 | - 'recur_data' => array('type' => 'int','precision' => '2','default' => '1'), |
|
2111 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
2112 | + 'recur_type' => array('type' => 'int', 'precision' => '2', 'nullable' => False), |
|
2113 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
2114 | + 'recur_interval' => array('type' => 'int', 'precision' => '2', 'default' => '1'), |
|
2115 | + 'recur_data' => array('type' => 'int', 'precision' => '2', 'default' => '1'), |
|
2116 | 2116 | ), |
2117 | 2117 | 'pk' => array('cal_id'), |
2118 | 2118 | 'fk' => array(), |
@@ -2133,19 +2133,19 @@ discard block |
||
2133 | 2133 | // returns NULL, if there are no rows! |
2134 | 2134 | if ((int)$max_description_length <= 16384 && $GLOBALS['egw_setup']->oProc->max_varchar_length >= 16384) |
2135 | 2135 | { |
2136 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_description',array( |
|
2136 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_description', array( |
|
2137 | 2137 | 'type' => 'varchar', |
2138 | 2138 | 'precision' => '16384' |
2139 | 2139 | )); |
2140 | 2140 | } |
2141 | 2141 | // allow more categories |
2142 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_category',array( |
|
2142 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_category', array( |
|
2143 | 2143 | 'type' => 'varchar', |
2144 | 2144 | 'precision' => '64', |
2145 | 2145 | 'comment' => 'category id(s)' |
2146 | 2146 | )); |
2147 | 2147 | // remove silly default of 1 |
2148 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_title',array( |
|
2148 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_title', array( |
|
2149 | 2149 | 'type' => 'varchar', |
2150 | 2150 | 'precision' => '255', |
2151 | 2151 | 'nullable' => False |
@@ -2160,14 +2160,14 @@ discard block |
||
2160 | 2160 | { |
2161 | 2161 | // PostgreSQL needs temporary a nullable column, to not stall on broken events without dates! |
2162 | 2162 | // We add that constrain in 1.9.007, after deleting all rows with range_start=0 OR range_start IS NULL |
2163 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','range_start',array( |
|
2163 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'range_start', array( |
|
2164 | 2164 | 'type' => 'int', |
2165 | 2165 | 'precision' => '8', |
2166 | 2166 | 'comment' => 'startdate (of range)' |
2167 | 2167 | )); |
2168 | 2168 | $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__); |
2169 | 2169 | |
2170 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','range_end',array( |
|
2170 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'range_end', array( |
|
2171 | 2171 | 'type' => 'int', |
2172 | 2172 | 'precision' => '8', |
2173 | 2173 | 'comment' => 'enddate (of range, UNTIL of RRULE)' |
@@ -2183,18 +2183,18 @@ discard block |
||
2183 | 2183 | { |
2184 | 2184 | $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__); |
2185 | 2185 | } |
2186 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats',array( |
|
2186 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array( |
|
2187 | 2187 | 'fd' => array( |
2188 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
2189 | - 'recur_type' => array('type' => 'int','precision' => '2','nullable' => False), |
|
2190 | - 'recur_interval' => array('type' => 'int','precision' => '2','default' => '1'), |
|
2191 | - 'recur_data' => array('type' => 'int','precision' => '2','default' => '1') |
|
2188 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
2189 | + 'recur_type' => array('type' => 'int', 'precision' => '2', 'nullable' => False), |
|
2190 | + 'recur_interval' => array('type' => 'int', 'precision' => '2', 'default' => '1'), |
|
2191 | + 'recur_data' => array('type' => 'int', 'precision' => '2', 'default' => '1') |
|
2192 | 2192 | ), |
2193 | 2193 | 'pk' => array('cal_id'), |
2194 | 2194 | 'fk' => array(), |
2195 | 2195 | 'ix' => array(), |
2196 | 2196 | 'uc' => array() |
2197 | - ),'recur_enddate'); |
|
2197 | + ), 'recur_enddate'); |
|
2198 | 2198 | |
2199 | 2199 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.007'; |
2200 | 2200 | } |
@@ -2206,14 +2206,14 @@ discard block |
||
2206 | 2206 | */ |
2207 | 2207 | function calendar_upgrade1_9_007() |
2208 | 2208 | { |
2209 | - foreach(array('egw_cal_repeats','egw_cal_dates','egw_cal_user','egw_cal_extra') as $table) |
|
2209 | + foreach (array('egw_cal_repeats', 'egw_cal_dates', 'egw_cal_user', 'egw_cal_extra') as $table) |
|
2210 | 2210 | { |
2211 | 2211 | $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__); |
2212 | 2212 | } |
2213 | 2213 | $GLOBALS['egw_setup']->db->query("DELETE FROM egw_cal WHERE range_start=0 OR range_start IS NULL", __LINE__, __FILE__); |
2214 | 2214 | |
2215 | 2215 | // now we can remove temporary default of 0 from range_start and set it NOT NULL |
2216 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','range_start',array( |
|
2216 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'range_start', array( |
|
2217 | 2217 | 'type' => 'int', |
2218 | 2218 | 'precision' => '8', |
2219 | 2219 | 'nullable' => False, |
@@ -2278,7 +2278,7 @@ discard block |
||
2278 | 2278 | |
2279 | 2279 | function calendar_upgrade1_9_010() |
2280 | 2280 | { |
2281 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','caldav_name',array( |
|
2281 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'caldav_name', array( |
|
2282 | 2282 | 'type' => 'varchar', |
2283 | 2283 | 'precision' => '200', |
2284 | 2284 | 'comment' => 'name part of CalDAV URL, if specified by client' |
@@ -2308,7 +2308,7 @@ discard block |
||
2308 | 2308 | SET cal_reference=0,cal_recurrence=0,cal_etag=cal_etag+1,cal_modifier=0,cal_modified=".time()." |
2309 | 2309 | WHERE cal_reference != 0 AND cal_id IN (SELECT cal_id FROM egw_cal_repeats)", __LINE__, __FILE__); |
2310 | 2310 | |
2311 | - foreach($GLOBALS['egw_setup']->db->query( |
|
2311 | + foreach ($GLOBALS['egw_setup']->db->query( |
|
2312 | 2312 | "SELECT DISTINCT master.cal_id,egw_cal_user.cal_user_type,egw_cal_user.cal_user_id,'E' AS cal_status |
2313 | 2313 | FROM egw_cal_user |
2314 | 2314 | JOIN egw_cal ON egw_cal_user.cal_id=egw_cal.cal_id |
@@ -2335,7 +2335,7 @@ discard block |
||
2335 | 2335 | */ |
2336 | 2336 | function calendar_upgrade14_1_001() |
2337 | 2337 | { |
2338 | - foreach($GLOBALS['egw_setup']->db->query( |
|
2338 | + foreach ($GLOBALS['egw_setup']->db->query( |
|
2339 | 2339 | "SELECT egw_cal.cal_id AS cal_id,cal_start,cal_end,range_start,range_end,egw_cal_repeats.*,tz_tzid AS tzid |
2340 | 2340 | FROM egw_cal |
2341 | 2341 | JOIN egw_cal_repeats ON egw_cal_repeats.cal_id=egw_cal.cal_id |
@@ -2363,7 +2363,7 @@ discard block |
||
2363 | 2363 | $enddate->modify(($event['end'] - $event['start']).' second'); |
2364 | 2364 | if (($range_end = $enddate->format('server')) != $event['range_end']) |
2365 | 2365 | { |
2366 | - $GLOBALS['egw_setup']->db->update('egw_cal',array( |
|
2366 | + $GLOBALS['egw_setup']->db->update('egw_cal', array( |
|
2367 | 2367 | 'range_end' => $range_end, |
2368 | 2368 | 'cal_etag=cal_etag+1', |
2369 | 2369 | 'cal_modified' => time(), |
@@ -2373,7 +2373,7 @@ discard block |
||
2373 | 2373 | //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)); |
2374 | 2374 | } |
2375 | 2375 | } |
2376 | - return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.002'; // skip 14.2.001 update, as query is fixed now |
|
2376 | + return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.002'; // skip 14.2.001 update, as query is fixed now |
|
2377 | 2377 | } |
2378 | 2378 | |
2379 | 2379 | /** |
@@ -2397,7 +2397,7 @@ discard block |
||
2397 | 2397 | // if maximum is bigger then 3 |
2398 | 2398 | if ($values[1] > 3) |
2399 | 2399 | { |
2400 | - switch($GLOBALS['egw_setup']->db->Type) |
|
2400 | + switch ($GLOBALS['egw_setup']->db->Type) |
|
2401 | 2401 | { |
2402 | 2402 | case 'mysql': |
2403 | 2403 | $sql = "UPDATE egw_cal |
@@ -2442,7 +2442,7 @@ discard block |
||
2442 | 2442 | |
2443 | 2443 | function calendar_upgrade14_2_003() |
2444 | 2444 | { |
2445 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_uid',array( |
|
2445 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_uid', array( |
|
2446 | 2446 | 'type' => 'ascii', |
2447 | 2447 | 'precision' => '128', |
2448 | 2448 | 'nullable' => False, |
@@ -2454,13 +2454,13 @@ discard block |
||
2454 | 2454 | { |
2455 | 2455 | $GLOBALS['egw_setup']->db->query("UPDATE egw_cal SET cal_category='' WHERE cal_category NOT REGEXP '^[0-9,]*$'", __LINE__, __FILE__); |
2456 | 2456 | } |
2457 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_category',array( |
|
2457 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_category', array( |
|
2458 | 2458 | 'type' => 'ascii', |
2459 | 2459 | 'meta' => 'category', |
2460 | 2460 | 'precision' => '64', |
2461 | 2461 | 'comment' => 'category id(s)' |
2462 | 2462 | )); |
2463 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','caldav_name',array( |
|
2463 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'caldav_name', array( |
|
2464 | 2464 | 'type' => 'ascii', |
2465 | 2465 | 'precision' => '128', |
2466 | 2466 | 'comment' => 'name part of CalDAV URL, if specified by client' |
@@ -2517,22 +2517,22 @@ discard block |
||
2517 | 2517 | 'type' => 'auto', |
2518 | 2518 | 'nullable' => False |
2519 | 2519 | ));*/ |
2520 | - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user',array( |
|
2520 | + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user', array( |
|
2521 | 2521 | 'fd' => array( |
2522 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
2523 | - 'cal_recur_date' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'default' => '0'), |
|
2524 | - 'cal_user_type' => array('type' => 'ascii','precision' => '1','nullable' => False,'default' => 'u','comment' => 'u=user, g=group, c=contact, r=resource, e=email'), |
|
2525 | - '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'), |
|
2526 | - 'cal_status' => array('type' => 'ascii','precision' => '1','default' => 'A','comment' => 'U=unknown, A=accepted, R=rejected, T=tentative'), |
|
2527 | - 'cal_quantity' => array('type' => 'int','precision' => '4','default' => '1','comment' => 'only for certain types (eg. resources)'), |
|
2528 | - 'cal_role' => array('type' => 'ascii','precision' => '64','default' => 'REQ-PARTICIPANT','comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id'), |
|
2529 | - 'cal_user_modified' => array('type' => 'timestamp','default' => 'current_timestamp','comment' => 'automatic timestamp of last update'), |
|
2530 | - 'cal_user_auto' => array('type' => 'auto','nullable' => False) |
|
2522 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
2523 | + 'cal_recur_date' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
2524 | + 'cal_user_type' => array('type' => 'ascii', 'precision' => '1', 'nullable' => False, 'default' => 'u', 'comment' => 'u=user, g=group, c=contact, r=resource, e=email'), |
|
2525 | + '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'), |
|
2526 | + 'cal_status' => array('type' => 'ascii', 'precision' => '1', 'default' => 'A', 'comment' => 'U=unknown, A=accepted, R=rejected, T=tentative'), |
|
2527 | + 'cal_quantity' => array('type' => 'int', 'precision' => '4', 'default' => '1', 'comment' => 'only for certain types (eg. resources)'), |
|
2528 | + 'cal_role' => array('type' => 'ascii', 'precision' => '64', 'default' => 'REQ-PARTICIPANT', 'comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id'), |
|
2529 | + 'cal_user_modified' => array('type' => 'timestamp', 'default' => 'current_timestamp', 'comment' => 'automatic timestamp of last update'), |
|
2530 | + 'cal_user_auto' => array('type' => 'auto', 'nullable' => False) |
|
2531 | 2531 | ), |
2532 | 2532 | 'pk' => array('cal_user_auto'), |
2533 | 2533 | 'fk' => array(), |
2534 | - 'ix' => array('cal_user_modified',array('cal_user_type','cal_user_id')), |
|
2535 | - 'uc' => array(array('cal_id','cal_recur_date','cal_user_type','cal_user_id')) |
|
2534 | + 'ix' => array('cal_user_modified', array('cal_user_type', 'cal_user_id')), |
|
2535 | + 'uc' => array(array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id')) |
|
2536 | 2536 | )); |
2537 | 2537 | |
2538 | 2538 | return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.005'; |
@@ -2541,12 +2541,12 @@ discard block |
||
2541 | 2541 | |
2542 | 2542 | function calendar_upgrade14_2_005() |
2543 | 2543 | { |
2544 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones','tz_tzid',array( |
|
2544 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones', 'tz_tzid', array( |
|
2545 | 2545 | 'type' => 'ascii', |
2546 | 2546 | 'precision' => '128', |
2547 | 2547 | 'nullable' => False |
2548 | 2548 | )); |
2549 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones','tz_component',array( |
|
2549 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones', 'tz_component', array( |
|
2550 | 2550 | 'type' => 'ascii', |
2551 | 2551 | 'precision' => '8192', |
2552 | 2552 | 'comment' => 'iCal VTIMEZONE component' |
@@ -2562,7 +2562,7 @@ discard block |
||
2562 | 2562 | */ |
2563 | 2563 | function calendar_upgrade14_3() |
2564 | 2564 | { |
2565 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_user_attendee',array( |
|
2565 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_user_attendee', array( |
|
2566 | 2566 | 'type' => 'varchar', |
2567 | 2567 | 'precision' => '255', |
2568 | 2568 | 'comment' => 'email or json object with attr. cn, url, ...' |
@@ -2573,12 +2573,12 @@ discard block |
||
2573 | 2573 | |
2574 | 2574 | // delete all but one row, which would give a doublicate key, after above normalising of email addresses |
2575 | 2575 | // by ordering by status we prever accepted over tentative over unknow over deleted |
2576 | - foreach($GLOBALS['egw_setup']->db->select('egw_cal_user', "cal_id,cal_recur_date,$email AS email", array( |
|
2576 | + foreach ($GLOBALS['egw_setup']->db->select('egw_cal_user', "cal_id,cal_recur_date,$email AS email", array( |
|
2577 | 2577 | 'cal_user_type' => 'e', |
2578 | 2578 | ), __LINE__, __FILE__, false, "GROUP BY cal_id,cal_recur_date,$email HAVING COUNT(*)>1", 'calendar') as $row) |
2579 | 2579 | { |
2580 | 2580 | $n = 0; |
2581 | - foreach($GLOBALS['egw_setup']->db->select('egw_cal_user', "*,$email AS email", array( |
|
2581 | + foreach ($GLOBALS['egw_setup']->db->select('egw_cal_user', "*,$email AS email", array( |
|
2582 | 2582 | 'cal_id' => $row['cal_id'], |
2583 | 2583 | 'cal_recur_date' => $row['cal_recur_date'], |
2584 | 2584 | 'cal_user_type' => 'e', |
@@ -2587,7 +2587,7 @@ discard block |
||
2587 | 2587 | { |
2588 | 2588 | if (strpos($user['email'], '@') !== false && !$n++) continue; |
2589 | 2589 | $GLOBALS['egw_setup']->db->delete('egw_cal_user', |
2590 | - array_intersect_key($user, array_flip(array('cal_id','cal_recur_date','cal_user_type','cal_user_id','cal_status'))), |
|
2590 | + array_intersect_key($user, array_flip(array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id', 'cal_status'))), |
|
2591 | 2591 | __LINE__, __FILE__, 'calendar'); |
2592 | 2592 | } |
2593 | 2593 | } |
@@ -2597,7 +2597,7 @@ discard block |
||
2597 | 2597 | "UPDATE egw_cal_user SET cal_user_attendee=cal_user_id,cal_user_id=MD5($email) WHERE cal_user_type='e'", |
2598 | 2598 | __LINE__, __FILE__); |
2599 | 2599 | |
2600 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
2600 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
2601 | 2601 | 'type' => 'ascii', |
2602 | 2602 | 'meta' => array( |
2603 | 2603 | "cal_user_type='u'" => 'account' |
@@ -2619,7 +2619,7 @@ discard block |
||
2619 | 2619 | { |
2620 | 2620 | $GLOBALS['calendar_upgrade14_3_001-run'] = true; |
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 |
@@ -2670,8 +2670,8 @@ discard block |
||
2670 | 2670 | { |
2671 | 2671 | Api\Preferences::change_preference('calendar', '/^favorite_/', function($attr, $old_value, $owner) |
2672 | 2672 | { |
2673 | - unset($attr, $owner); // not used, but required by function signature |
|
2674 | - if($old_value['state'] && is_array($old_value['state'])) |
|
2673 | + unset($attr, $owner); // not used, but required by function signature |
|
2674 | + if ($old_value['state'] && is_array($old_value['state'])) |
|
2675 | 2675 | { |
2676 | 2676 | unset($old_value['state']['date']); |
2677 | 2677 | unset($old_value['state']['startdate']); |
@@ -2691,15 +2691,15 @@ discard block |
||
2691 | 2691 | { |
2692 | 2692 | Api\Preferences::change_preference('calendar', 'use_time_grid', function($attr, $old_value, $owner) |
2693 | 2693 | { |
2694 | - unset($attr, $owner); // not used, but required by function signature |
|
2695 | - switch($old_value) |
|
2694 | + unset($attr, $owner); // not used, but required by function signature |
|
2695 | + switch ($old_value) |
|
2696 | 2696 | { |
2697 | 2697 | case 'all': |
2698 | 2698 | return 0; |
2699 | 2699 | case 'day_week': |
2700 | - return ['day','day4','week']; |
|
2700 | + return ['day', 'day4', 'week']; |
|
2701 | 2701 | case 'day4': |
2702 | - return ['day','day4']; |
|
2702 | + return ['day', 'day4']; |
|
2703 | 2703 | } |
2704 | 2704 | return null; |
2705 | 2705 | }); |
@@ -2724,7 +2724,7 @@ discard block |
||
2724 | 2724 | function calendar_upgrade16_1_001() |
2725 | 2725 | { |
2726 | 2726 | $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_extra', 'cal_extra_value', |
2727 | - array('type' => 'varchar','meta' => 'cfvalue','precision' => '16384','nullable' => False,'default' => '')); |
|
2727 | + array('type' => 'varchar', 'meta' => 'cfvalue', 'precision' => '16384', 'nullable' => False, 'default' => '')); |
|
2728 | 2728 | |
2729 | 2729 | Api\Preferences::change_preference('calendar', 'defaultresource_sel', 'resources', 'addressbook', 'forced'); |
2730 | 2730 | Api\Preferences::change_preference('calendar', 'defaultresource_sel', 'resources', 'addressbook', 'default'); |
@@ -2736,8 +2736,8 @@ discard block |
||
2736 | 2736 | { |
2737 | 2737 | // Explicitly add months as showing list of events, no times |
2738 | 2738 | $change = function($attr, $old_value, $owner) { |
2739 | - if($owner == Api\Preferences::FORCED_ID) return; |
|
2740 | - if(is_array($old_value) && !in_array('month', $old_value)) |
|
2739 | + if ($owner == Api\Preferences::FORCED_ID) return; |
|
2740 | + if (is_array($old_value) && !in_array('month', $old_value)) |
|
2741 | 2741 | { |
2742 | 2742 | $old_value[] = 'month'; |
2743 | 2743 | } |
@@ -2759,7 +2759,7 @@ discard block |
||
2759 | 2759 | { |
2760 | 2760 | // Update birthdays as events preference from boolean |
2761 | 2761 | $change = function($attr, $old_value, $owner) { |
2762 | - if (!isset($old_value)) return null; // do not set anything, if nothing was set before |
|
2762 | + if (!isset($old_value)) return null; // do not set anything, if nothing was set before |
|
2763 | 2763 | return $old_value ? 'birthday' : 'none'; |
2764 | 2764 | }; |
2765 | 2765 | Api\Preferences::change_preference('calendar', 'birthdays_as_events', $change); |
@@ -2775,13 +2775,13 @@ discard block |
||
2775 | 2775 | |
2776 | 2776 | function calendar_upgrade17_1_002() |
2777 | 2777 | { |
2778 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_uid',array( |
|
2778 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_uid', array( |
|
2779 | 2779 | 'type' => 'ascii', |
2780 | 2780 | 'precision' => '255', |
2781 | 2781 | 'nullable' => False, |
2782 | 2782 | 'comment' => 'unique id of event(-series)' |
2783 | 2783 | )); |
2784 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','caldav_name',array( |
|
2784 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'caldav_name', array( |
|
2785 | 2785 | 'type' => 'ascii', |
2786 | 2786 | 'precision' => '260', |
2787 | 2787 | 'comment' => 'name part of CalDAV URL, if specified by client' |
@@ -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', |
@@ -24,7 +24,7 @@ |
||
24 | 24 | unset($this->export_fields['participants-r']); |
25 | 25 | |
26 | 26 | $custom = Api\Storage\Customfields::get('calendar', true); |
27 | - foreach($custom as $name => $data) { |
|
27 | + foreach ($custom as $name => $data) { |
|
28 | 28 | $this->export_fields['#'.$name] = $data['label']; |
29 | 29 | } |
30 | 30 | } |
@@ -13,7 +13,8 @@ discard block |
||
13 | 13 | |
14 | 14 | class calendar_wizard_export_csv extends importexport_wizard_basic_export_csv |
15 | 15 | { |
16 | - public function __construct() { |
|
16 | + public function __construct() |
|
17 | + { |
|
17 | 18 | parent::__construct(); |
18 | 19 | // Field mapping |
19 | 20 | $bo = new calendar_tracking(); |
@@ -24,7 +25,8 @@ discard block |
||
24 | 25 | unset($this->export_fields['participants-r']); |
25 | 26 | |
26 | 27 | $custom = Api\Storage\Customfields::get('calendar', true); |
27 | - foreach($custom as $name => $data) { |
|
28 | + foreach($custom as $name => $data) |
|
29 | + { |
|
28 | 30 | $this->export_fields['#'.$name] = $data['label']; |
29 | 31 | } |
30 | 32 | } |
@@ -32,8 +32,8 @@ |
||
32 | 32 | protected static $conditions = array('exists'); |
33 | 33 | |
34 | 34 | /** |
35 | - * For figuring out if an entry has changed |
|
36 | - */ |
|
35 | + * For figuring out if an entry has changed |
|
36 | + */ |
|
37 | 37 | protected $tracking; |
38 | 38 | |
39 | 39 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $this->role_map = array_flip($this->bo->roles); |
58 | 58 | |
59 | 59 | $this->lookups = array( |
60 | - 'priority' => Array( |
|
60 | + 'priority' => array( |
|
61 | 61 | 0 => lang('None'), |
62 | 62 | 1 => lang('Low'), |
63 | 63 | 2 => lang('Normal'), |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return boolean |
239 | 239 | */ |
240 | - protected function exists(importexport_iface_egw_record &$record, Array &$condition, &$records = array()) |
|
240 | + protected function exists(importexport_iface_egw_record &$record, array &$condition, &$records = array()) |
|
241 | 241 | { |
242 | 242 | if($record->__get($condition['string']) && $condition['string'] == 'id') { |
243 | 243 | $event = $this->bo->read($record->__get($condition['string'])); |
@@ -17,12 +17,12 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * class import_csv for calendar |
19 | 19 | */ |
20 | -class calendar_import_csv extends importexport_basic_import_csv { |
|
20 | +class calendar_import_csv extends importexport_basic_import_csv { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * actions wich could be done to data entries |
24 | 24 | */ |
25 | - protected static $actions = array( 'none', 'update', 'insert' ); |
|
25 | + protected static $actions = array('none', 'update', 'insert'); |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * conditions for actions |
@@ -44,16 +44,16 @@ discard block |
||
44 | 44 | /** |
45 | 45 | * Set up import |
46 | 46 | */ |
47 | - protected function init(importexport_definition &$definition, importexport_import_csv &$import_csv=NULL) |
|
47 | + protected function init(importexport_definition &$definition, importexport_import_csv &$import_csv = NULL) |
|
48 | 48 | { |
49 | 49 | // fetch the addressbook bo |
50 | - $this->bo= new calendar_boupdate(); |
|
50 | + $this->bo = new calendar_boupdate(); |
|
51 | 51 | |
52 | 52 | // Get the tracker for changes |
53 | 53 | $this->tracking = new calendar_tracking(); |
54 | 54 | |
55 | 55 | // Used for participants |
56 | - $this->status_map = array_flip(array_map('lang',$this->bo->verbose_status)); |
|
56 | + $this->status_map = array_flip(array_map('lang', $this->bo->verbose_status)); |
|
57 | 57 | $this->role_map = array_flip($this->bo->roles); |
58 | 58 | |
59 | 59 | $this->lookups = array( |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | public function import_record(\calendar_egw_record &$record, &$import_csv) |
80 | 80 | { |
81 | 81 | // set eventOwner |
82 | - $options =& $this->definition->plugin_options; |
|
82 | + $options = & $this->definition->plugin_options; |
|
83 | 83 | $options['owner'] = $options['owner'] ? $options['owner'] : $this->user; |
84 | 84 | |
85 | 85 | // Set owner, unless it's supposed to come from CSV file |
86 | - if($options['owner_from_csv']) { |
|
87 | - if(!is_numeric($record['owner'])) { |
|
86 | + if ($options['owner_from_csv']) { |
|
87 | + if (!is_numeric($record['owner'])) { |
|
88 | 88 | $this->errors[$import_csv->get_current_position()] = lang( |
89 | 89 | 'Invalid owner ID: %1. Might be a bad field translation. Used %2 instead.', |
90 | 90 | $record->owner, |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | // Handle errors in length or start/end date |
102 | - if($record->start > $record->end) |
|
102 | + if ($record->start > $record->end) |
|
103 | 103 | { |
104 | 104 | $record->end = $record->start + $GLOBALS['egw_info']['user']['preferences']['calendar']['defaultlength'] * 60; |
105 | 105 | $this->warnings[$import_csv->get_current_position()] = lang('error: starttime has to be before the endtime !!!'); |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | if ($record->participants && !is_array($record->participants)) { |
110 | 110 | $warning = ''; |
111 | 111 | $record->participants = $this->parse_participants($record, $warning); |
112 | - if($warning) |
|
112 | + if ($warning) |
|
113 | 113 | { |
114 | 114 | $this->warnings[$import_csv->get_current_position()] = $warning; |
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | - if($record->recurrence) |
|
118 | + if ($record->recurrence) |
|
119 | 119 | { |
120 | 120 | $start = new Api\DateTime($record->start); |
121 | 121 | try |
@@ -130,37 +130,37 @@ discard block |
||
130 | 130 | catch (Exception $e) |
131 | 131 | { |
132 | 132 | // Try old way from export using just recur_type / interval |
133 | - list($record->recur_type, $record->recur_interval) = explode('/',$record->recurrence,2); |
|
133 | + list($record->recur_type, $record->recur_interval) = explode('/', $record->recurrence, 2); |
|
134 | 134 | $record->recur_interval = trim($record->recur_interval); |
135 | - $record->recur_type = array_search(strtolower(trim($record->recur_type)), array_map('strtolower',$this->lookups['recurrence'])); |
|
135 | + $record->recur_type = array_search(strtolower(trim($record->recur_type)), array_map('strtolower', $this->lookups['recurrence'])); |
|
136 | 136 | } |
137 | 137 | unset($record->recurrence); |
138 | 138 | } |
139 | 139 | $record->tzid = calendar_timezones::id2tz($record->tz_id); |
140 | 140 | |
141 | - if ( $options['conditions'] ) { |
|
142 | - foreach ( $options['conditions'] as $condition ) { |
|
141 | + if ($options['conditions']) { |
|
142 | + foreach ($options['conditions'] as $condition) { |
|
143 | 143 | $records = array(); |
144 | - switch ( $condition['type'] ) { |
|
144 | + switch ($condition['type']) { |
|
145 | 145 | // exists |
146 | 146 | case 'exists' : |
147 | 147 | // Check for that record |
148 | 148 | $result = $this->exists($record, $condition, $records); |
149 | 149 | |
150 | - if ( is_array( $records ) && count( $records ) >= 1) { |
|
150 | + if (is_array($records) && count($records) >= 1) { |
|
151 | 151 | // apply action to all records matching this exists condition |
152 | 152 | $action = $condition['true']; |
153 | - foreach ( (array)$records as $event ) { |
|
153 | + foreach ((array)$records as $event) { |
|
154 | 154 | $record->id = $event['id']; |
155 | - if ( $this->definition->plugin_options['update_cats'] == 'add' ) { |
|
156 | - if ( !is_array( $record->category ) ) $record->category = explode( ',', $record->category ); |
|
157 | - $record->category = implode( ',', array_unique( array_merge( $record->category, $event['category'] ) ) ); |
|
155 | + if ($this->definition->plugin_options['update_cats'] == 'add') { |
|
156 | + if (!is_array($record->category)) $record->category = explode(',', $record->category); |
|
157 | + $record->category = implode(',', array_unique(array_merge($record->category, $event['category']))); |
|
158 | 158 | } |
159 | - $success = $this->action( $action['action'], $record, $import_csv->get_current_position() ); |
|
159 | + $success = $this->action($action['action'], $record, $import_csv->get_current_position()); |
|
160 | 160 | } |
161 | 161 | } else { |
162 | 162 | $action = $condition['false']; |
163 | - $success = ($this->action( $action['action'], $record, $import_csv->get_current_position() )); |
|
163 | + $success = ($this->action($action['action'], $record, $import_csv->get_current_position())); |
|
164 | 164 | } |
165 | 165 | break; |
166 | 166 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | } |
174 | 174 | } else { |
175 | 175 | // unconditional insert |
176 | - $success = $this->action( 'insert', $record, $import_csv->get_current_position() ); |
|
176 | + $success = $this->action('insert', $record, $import_csv->get_current_position()); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | return $success; |
@@ -192,12 +192,12 @@ discard block |
||
192 | 192 | // Name (quantity)? (status) Role[, Name (quantity)? (status) Role]+ |
193 | 193 | $statuses = implode('|', array_keys($this->status_map)); |
194 | 194 | //echo ('/((?<name>.+?)(?: \((?<quantity>[\d]+)\))? \((?<status>'.$statuses.')\)(?: (?<role>[^ ,]+))?)(?:, )?/'); |
195 | - preg_match_all('/((?<name>.+?)(?: \((?<quantity>[\d]+)\))? \((?<status>'.$statuses.')\)(?: (?<role>[^ ,]+))?)(?:, )?/i',$record->participants,$participants); |
|
195 | + preg_match_all('/((?<name>.+?)(?: \((?<quantity>[\d]+)\))? \((?<status>'.$statuses.')\)(?: (?<role>[^ ,]+))?)(?:, )?/i', $record->participants, $participants); |
|
196 | 196 | $p_participants = array(); |
197 | 197 | $missing = array(); |
198 | 198 | |
199 | 199 | list($lines, $p, $names, $quantity, $status, $role) = $participants; |
200 | - foreach($names as $key => $name) { |
|
200 | + foreach ($names as $key => $name) { |
|
201 | 201 | //echo (__METHOD__ ." Name: $name Quantity: {$quantity[$key]} Status: {$status[$key]} Role: {$role[$key]}"); |
202 | 202 | |
203 | 203 | // Search for direct account name, then user in accounts first |
@@ -205,26 +205,26 @@ discard block |
||
205 | 205 | $id = importexport_helper_functions::account_name2id($name); |
206 | 206 | |
207 | 207 | // If not found, or not an exact match to a user (account_name2id is pretty generous) |
208 | - if(!$id || $names[$key] !== $this->bo->participant_name($id)) { |
|
209 | - $contacts = ExecMethod2('addressbook.addressbook_bo.search', $search,array('contact_id','account_id'),'org_name,n_family,n_given,cat_id,contact_email','','%',false,'OR',array(0,1)); |
|
210 | - if($contacts) $id = $contacts[0]['account_id'] ? $contacts[0]['account_id'] : 'c'.$contacts[0]['contact_id']; |
|
208 | + if (!$id || $names[$key] !== $this->bo->participant_name($id)) { |
|
209 | + $contacts = ExecMethod2('addressbook.addressbook_bo.search', $search, array('contact_id', 'account_id'), 'org_name,n_family,n_given,cat_id,contact_email', '', '%', false, 'OR', array(0, 1)); |
|
210 | + if ($contacts) $id = $contacts[0]['account_id'] ? $contacts[0]['account_id'] : 'c'.$contacts[0]['contact_id']; |
|
211 | 211 | } |
212 | - if(!$id) |
|
212 | + if (!$id) |
|
213 | 213 | { |
214 | 214 | // Use calendar's registered resources to find participant |
215 | - foreach($this->bo->resources as $resource) |
|
215 | + foreach ($this->bo->resources as $resource) |
|
216 | 216 | { |
217 | 217 | // Can't search for email |
218 | - if($resource['app'] == 'email') continue; |
|
218 | + if ($resource['app'] == 'email') continue; |
|
219 | 219 | // Special resource search, since it does special stuff in link_query |
220 | - if($resource['app'] == 'resources') |
|
220 | + if ($resource['app'] == 'resources') |
|
221 | 221 | { |
222 | - if(!$this->resource_so) |
|
222 | + if (!$this->resource_so) |
|
223 | 223 | { |
224 | 224 | $this->resource_so = new resources_so(); |
225 | 225 | } |
226 | - $result = $this->resource_so->search($search,'res_id'); |
|
227 | - if($result && count($result) >= 1) { |
|
226 | + $result = $this->resource_so->search($search, 'res_id'); |
|
227 | + if ($result && count($result) >= 1) { |
|
228 | 228 | $id = $resource['type'].$result[0]['res_id']; |
229 | 229 | break; |
230 | 230 | } |
@@ -235,15 +235,15 @@ discard block |
||
235 | 235 | $link_options = array(); |
236 | 236 | $result = Link::query($resource['app'], $search, $link_options); |
237 | 237 | |
238 | - if($result) |
|
238 | + if ($result) |
|
239 | 239 | { |
240 | - $id = $resource['type'] . key($result); |
|
240 | + $id = $resource['type'].key($result); |
|
241 | 241 | break; |
242 | 242 | } |
243 | 243 | } |
244 | 244 | } |
245 | 245 | } |
246 | - if($id) { |
|
246 | + if ($id) { |
|
247 | 247 | $p_participants[$id] = calendar_so::combine_status( |
248 | 248 | $this->status_map[lang($status[$key])] ? $this->status_map[lang($status[$key])] : $status[$key][0], |
249 | 249 | $quantity[$key] ? $quantity[$key] : 1, |
@@ -254,10 +254,10 @@ discard block |
||
254 | 254 | { |
255 | 255 | $missing[] = $name; |
256 | 256 | } |
257 | - if(count($missing) > 0) |
|
257 | + if (count($missing) > 0) |
|
258 | 258 | { |
259 | - $warnings = $record->title . ' ' . lang('participants') . ': ' . |
|
260 | - lang('Contact not found!') . '<br />'.implode(", ",$missing); |
|
259 | + $warnings = $record->title.' '.lang('participants').': '. |
|
260 | + lang('Contact not found!').'<br />'.implode(", ", $missing); |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | return $p_participants; |
@@ -274,12 +274,12 @@ discard block |
||
274 | 274 | */ |
275 | 275 | protected function exists(importexport_iface_egw_record &$record, Array &$condition, &$records = array()) |
276 | 276 | { |
277 | - if($record->__get($condition['string']) && $condition['string'] == 'id') { |
|
277 | + if ($record->__get($condition['string']) && $condition['string'] == 'id') { |
|
278 | 278 | $event = $this->bo->read($record->__get($condition['string'])); |
279 | 279 | $records = array($event); |
280 | 280 | } |
281 | 281 | |
282 | - if ( is_array( $records ) && count( $records ) >= 1) { |
|
282 | + if (is_array($records) && count($records) >= 1) { |
|
283 | 283 | return true; |
284 | 284 | } |
285 | 285 | return false; |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * @param array $_data record data for the action |
293 | 293 | * @return bool success or not |
294 | 294 | */ |
295 | - protected function action ( $_action, importexport_iface_egw_record &$record, $record_num = 0 ) |
|
295 | + protected function action($_action, importexport_iface_egw_record &$record, $record_num = 0) |
|
296 | 296 | { |
297 | 297 | $_data = $record->get_record_array(); |
298 | 298 | switch ($_action) { |
@@ -303,41 +303,41 @@ discard block |
||
303 | 303 | $old = $this->bo->read($_data['id']); |
304 | 304 | |
305 | 305 | // Don't change a user account into a record |
306 | - if(!$this->definition->plugin_options['change_owner']) { |
|
306 | + if (!$this->definition->plugin_options['change_owner']) { |
|
307 | 307 | // Don't change owner of an existing record |
308 | 308 | unset($_data['owner']); |
309 | 309 | } |
310 | 310 | |
311 | 311 | // Merge to deal with fields not in import record |
312 | - if($old) |
|
312 | + if ($old) |
|
313 | 313 | { |
314 | 314 | $_data = array_merge($old, $_data); |
315 | 315 | $changed = $this->tracking->changed_fields($_data, $old); |
316 | - if(count($changed) == 0) { |
|
316 | + if (count($changed) == 0) { |
|
317 | 317 | return true; |
318 | 318 | } |
319 | 319 | } |
320 | 320 | // Fall through |
321 | 321 | case 'insert' : |
322 | - if($_action == 'insert') { |
|
322 | + if ($_action == 'insert') { |
|
323 | 323 | // Backend doesn't like inserting with ID specified, can overwrite existing |
324 | 324 | unset($_data['id']); |
325 | 325 | } |
326 | 326 | // Make sure participants are set |
327 | - if(!$_data['participants']) { |
|
327 | + if (!$_data['participants']) { |
|
328 | 328 | $user = $_data['owner'] ? $_data['owner'] : $this->user; |
329 | 329 | $_data['participants'] = array( |
330 | 330 | $user => 'U' |
331 | 331 | ); |
332 | 332 | } |
333 | - if ( $this->dry_run ) { |
|
333 | + if ($this->dry_run) { |
|
334 | 334 | //print_r($_data); |
335 | 335 | // User is interested in conflict checks, do so for dry run |
336 | 336 | // Otherwise, conflicts are just ignored and imported anyway |
337 | - if($this->definition->plugin_options['skip_conflicts'] && !$_data['non_blocking']) |
|
337 | + if ($this->definition->plugin_options['skip_conflicts'] && !$_data['non_blocking']) |
|
338 | 338 | { |
339 | 339 | $conflicts = $this->bo->conflicts($_data); |
340 | - if($conflicts) |
|
340 | + if ($conflicts) |
|
341 | 341 | { |
342 | 342 | $this->conflict_warning($record_num, $conflicts); |
343 | 343 | $this->results['skipped']++; |
@@ -348,15 +348,15 @@ discard block |
||
348 | 348 | return true; |
349 | 349 | } else { |
350 | 350 | $messages = null; |
351 | - $result = $this->bo->update( $_data, |
|
351 | + $result = $this->bo->update($_data, |
|
352 | 352 | !$this->definition->plugin_options['skip_conflicts'], |
353 | 353 | true, $this->is_admin, true, $messages, |
354 | 354 | $this->definition->plugin_options['no_notification'] |
355 | 355 | ); |
356 | - if(!$result) |
|
356 | + if (!$result) |
|
357 | 357 | { |
358 | - $this->errors[$record_num] = lang('Unable to save') . "\n" . |
|
359 | - implode("\n",$messages); |
|
358 | + $this->errors[$record_num] = lang('Unable to save')."\n". |
|
359 | + implode("\n", $messages); |
|
360 | 360 | } |
361 | 361 | else if (is_array($result)) |
362 | 362 | { |
@@ -386,10 +386,10 @@ discard block |
||
386 | 386 | */ |
387 | 387 | protected function conflict_warning($record_num, &$conflicts) |
388 | 388 | { |
389 | - $this->warnings[$record_num] = lang('Conflicts') . ':'; |
|
390 | - foreach($conflicts as $conflict) |
|
389 | + $this->warnings[$record_num] = lang('Conflicts').':'; |
|
390 | + foreach ($conflicts as $conflict) |
|
391 | 391 | { |
392 | - $this->warnings[$record_num] .= "<br />\n" . Api\DateTime::to($conflict['start']) . "\t" . $conflict['title']; |
|
392 | + $this->warnings[$record_num] .= "<br />\n".Api\DateTime::to($conflict['start'])."\t".$conflict['title']; |
|
393 | 393 | } |
394 | 394 | } |
395 | 395 | |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | */ |
428 | 428 | protected function row_preview(importexport_iface_egw_record &$row_entry) |
429 | 429 | { |
430 | - $row_entry->participants = implode('<br />', $this->bo->participants(array('participants' => $row_entry->participants),true)); |
|
430 | + $row_entry->participants = implode('<br />', $this->bo->participants(array('participants' => $row_entry->participants), true)); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | } |
434 | 434 | \ No newline at end of file |
@@ -17,7 +17,8 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * class import_csv for calendar |
19 | 19 | */ |
20 | -class calendar_import_csv extends importexport_basic_import_csv { |
|
20 | +class calendar_import_csv extends importexport_basic_import_csv |
|
21 | +{ |
|
21 | 22 | |
22 | 23 | /** |
23 | 24 | * actions wich could be done to data entries |
@@ -83,8 +84,10 @@ discard block |
||
83 | 84 | $options['owner'] = $options['owner'] ? $options['owner'] : $this->user; |
84 | 85 | |
85 | 86 | // Set owner, unless it's supposed to come from CSV file |
86 | - if($options['owner_from_csv']) { |
|
87 | - if(!is_numeric($record['owner'])) { |
|
87 | + if($options['owner_from_csv']) |
|
88 | + { |
|
89 | + if(!is_numeric($record['owner'])) |
|
90 | + { |
|
88 | 91 | $this->errors[$import_csv->get_current_position()] = lang( |
89 | 92 | 'Invalid owner ID: %1. Might be a bad field translation. Used %2 instead.', |
90 | 93 | $record->owner, |
@@ -106,7 +109,8 @@ discard block |
||
106 | 109 | } |
107 | 110 | |
108 | 111 | // Parse particpants |
109 | - if ($record->participants && !is_array($record->participants)) { |
|
112 | + if ($record->participants && !is_array($record->participants)) |
|
113 | + { |
|
110 | 114 | $warning = ''; |
111 | 115 | $record->participants = $this->parse_participants($record, $warning); |
112 | 116 | if($warning) |
@@ -138,27 +142,38 @@ discard block |
||
138 | 142 | } |
139 | 143 | $record->tzid = calendar_timezones::id2tz($record->tz_id); |
140 | 144 | |
141 | - if ( $options['conditions'] ) { |
|
142 | - foreach ( $options['conditions'] as $condition ) { |
|
145 | + if ( $options['conditions'] ) |
|
146 | + { |
|
147 | + foreach ( $options['conditions'] as $condition ) |
|
148 | + { |
|
143 | 149 | $records = array(); |
144 | - switch ( $condition['type'] ) { |
|
150 | + switch ( $condition['type'] ) |
|
151 | + { |
|
145 | 152 | // exists |
146 | 153 | case 'exists' : |
147 | 154 | // Check for that record |
148 | 155 | $result = $this->exists($record, $condition, $records); |
149 | 156 | |
150 | - if ( is_array( $records ) && count( $records ) >= 1) { |
|
157 | + if ( is_array( $records ) && count( $records ) >= 1) |
|
158 | + { |
|
151 | 159 | // apply action to all records matching this exists condition |
152 | 160 | $action = $condition['true']; |
153 | - foreach ( (array)$records as $event ) { |
|
161 | + foreach ( (array)$records as $event ) |
|
162 | + { |
|
154 | 163 | $record->id = $event['id']; |
155 | - if ( $this->definition->plugin_options['update_cats'] == 'add' ) { |
|
156 | - if ( !is_array( $record->category ) ) $record->category = explode( ',', $record->category ); |
|
164 | + if ( $this->definition->plugin_options['update_cats'] == 'add' ) |
|
165 | + { |
|
166 | + if ( !is_array( $record->category ) ) |
|
167 | + { |
|
168 | + $record->category = explode( ',', $record->category ); |
|
169 | + } |
|
157 | 170 | $record->category = implode( ',', array_unique( array_merge( $record->category, $event['category'] ) ) ); |
158 | 171 | } |
159 | 172 | $success = $this->action( $action['action'], $record, $import_csv->get_current_position() ); |
160 | 173 | } |
161 | - } else { |
|
174 | + } |
|
175 | + else |
|
176 | + { |
|
162 | 177 | $action = $condition['false']; |
163 | 178 | $success = ($this->action( $action['action'], $record, $import_csv->get_current_position() )); |
164 | 179 | } |
@@ -169,9 +184,14 @@ discard block |
||
169 | 184 | die('condition / action not supported!!!'); |
170 | 185 | break; |
171 | 186 | } |
172 | - if ($action['last']) break; |
|
187 | + if ($action['last']) |
|
188 | + { |
|
189 | + break; |
|
190 | + } |
|
173 | 191 | } |
174 | - } else { |
|
192 | + } |
|
193 | + else |
|
194 | + { |
|
175 | 195 | // unconditional insert |
176 | 196 | $success = $this->action( 'insert', $record, $import_csv->get_current_position() ); |
177 | 197 | } |
@@ -197,7 +217,8 @@ discard block |
||
197 | 217 | $missing = array(); |
198 | 218 | |
199 | 219 | list($lines, $p, $names, $quantity, $status, $role) = $participants; |
200 | - foreach($names as $key => $name) { |
|
220 | + foreach($names as $key => $name) |
|
221 | + { |
|
201 | 222 | //echo (__METHOD__ ." Name: $name Quantity: {$quantity[$key]} Status: {$status[$key]} Role: {$role[$key]}"); |
202 | 223 | |
203 | 224 | // Search for direct account name, then user in accounts first |
@@ -205,9 +226,13 @@ discard block |
||
205 | 226 | $id = importexport_helper_functions::account_name2id($name); |
206 | 227 | |
207 | 228 | // If not found, or not an exact match to a user (account_name2id is pretty generous) |
208 | - if(!$id || $names[$key] !== $this->bo->participant_name($id)) { |
|
229 | + if(!$id || $names[$key] !== $this->bo->participant_name($id)) |
|
230 | + { |
|
209 | 231 | $contacts = ExecMethod2('addressbook.addressbook_bo.search', $search,array('contact_id','account_id'),'org_name,n_family,n_given,cat_id,contact_email','','%',false,'OR',array(0,1)); |
210 | - if($contacts) $id = $contacts[0]['account_id'] ? $contacts[0]['account_id'] : 'c'.$contacts[0]['contact_id']; |
|
232 | + if($contacts) |
|
233 | + { |
|
234 | + $id = $contacts[0]['account_id'] ? $contacts[0]['account_id'] : 'c'.$contacts[0]['contact_id']; |
|
235 | + } |
|
211 | 236 | } |
212 | 237 | if(!$id) |
213 | 238 | { |
@@ -215,7 +240,10 @@ discard block |
||
215 | 240 | foreach($this->bo->resources as $resource) |
216 | 241 | { |
217 | 242 | // Can't search for email |
218 | - if($resource['app'] == 'email') continue; |
|
243 | + if($resource['app'] == 'email') |
|
244 | + { |
|
245 | + continue; |
|
246 | + } |
|
219 | 247 | // Special resource search, since it does special stuff in link_query |
220 | 248 | if($resource['app'] == 'resources') |
221 | 249 | { |
@@ -224,7 +252,8 @@ discard block |
||
224 | 252 | $this->resource_so = new resources_so(); |
225 | 253 | } |
226 | 254 | $result = $this->resource_so->search($search,'res_id'); |
227 | - if($result && count($result) >= 1) { |
|
255 | + if($result && count($result) >= 1) |
|
256 | + { |
|
228 | 257 | $id = $resource['type'].$result[0]['res_id']; |
229 | 258 | break; |
230 | 259 | } |
@@ -243,7 +272,8 @@ discard block |
||
243 | 272 | } |
244 | 273 | } |
245 | 274 | } |
246 | - if($id) { |
|
275 | + if($id) |
|
276 | + { |
|
247 | 277 | $p_participants[$id] = calendar_so::combine_status( |
248 | 278 | $this->status_map[lang($status[$key])] ? $this->status_map[lang($status[$key])] : $status[$key][0], |
249 | 279 | $quantity[$key] ? $quantity[$key] : 1, |
@@ -274,12 +304,14 @@ discard block |
||
274 | 304 | */ |
275 | 305 | protected function exists(importexport_iface_egw_record &$record, Array &$condition, &$records = array()) |
276 | 306 | { |
277 | - if($record->__get($condition['string']) && $condition['string'] == 'id') { |
|
307 | + if($record->__get($condition['string']) && $condition['string'] == 'id') |
|
308 | + { |
|
278 | 309 | $event = $this->bo->read($record->__get($condition['string'])); |
279 | 310 | $records = array($event); |
280 | 311 | } |
281 | 312 | |
282 | - if ( is_array( $records ) && count( $records ) >= 1) { |
|
313 | + if ( is_array( $records ) && count( $records ) >= 1) |
|
314 | + { |
|
283 | 315 | return true; |
284 | 316 | } |
285 | 317 | return false; |
@@ -295,7 +327,8 @@ discard block |
||
295 | 327 | protected function action ( $_action, importexport_iface_egw_record &$record, $record_num = 0 ) |
296 | 328 | { |
297 | 329 | $_data = $record->get_record_array(); |
298 | - switch ($_action) { |
|
330 | + switch ($_action) |
|
331 | + { |
|
299 | 332 | case 'none' : |
300 | 333 | return true; |
301 | 334 | case 'update' : |
@@ -303,7 +336,8 @@ discard block |
||
303 | 336 | $old = $this->bo->read($_data['id']); |
304 | 337 | |
305 | 338 | // Don't change a user account into a record |
306 | - if(!$this->definition->plugin_options['change_owner']) { |
|
339 | + if(!$this->definition->plugin_options['change_owner']) |
|
340 | + { |
|
307 | 341 | // Don't change owner of an existing record |
308 | 342 | unset($_data['owner']); |
309 | 343 | } |
@@ -313,24 +347,28 @@ discard block |
||
313 | 347 | { |
314 | 348 | $_data = array_merge($old, $_data); |
315 | 349 | $changed = $this->tracking->changed_fields($_data, $old); |
316 | - if(count($changed) == 0) { |
|
350 | + if(count($changed) == 0) |
|
351 | + { |
|
317 | 352 | return true; |
318 | 353 | } |
319 | 354 | } |
320 | 355 | // Fall through |
321 | 356 | case 'insert' : |
322 | - if($_action == 'insert') { |
|
357 | + if($_action == 'insert') |
|
358 | + { |
|
323 | 359 | // Backend doesn't like inserting with ID specified, can overwrite existing |
324 | 360 | unset($_data['id']); |
325 | 361 | } |
326 | 362 | // Make sure participants are set |
327 | - if(!$_data['participants']) { |
|
363 | + if(!$_data['participants']) |
|
364 | + { |
|
328 | 365 | $user = $_data['owner'] ? $_data['owner'] : $this->user; |
329 | 366 | $_data['participants'] = array( |
330 | 367 | $user => 'U' |
331 | 368 | ); |
332 | 369 | } |
333 | - if ( $this->dry_run ) { |
|
370 | + if ( $this->dry_run ) |
|
371 | + { |
|
334 | 372 | //print_r($_data); |
335 | 373 | // User is interested in conflict checks, do so for dry run |
336 | 374 | // Otherwise, conflicts are just ignored and imported anyway |
@@ -346,7 +384,9 @@ discard block |
||
346 | 384 | } |
347 | 385 | $this->results[$_action]++; |
348 | 386 | return true; |
349 | - } else { |
|
387 | + } |
|
388 | + else |
|
389 | + { |
|
350 | 390 | $messages = null; |
351 | 391 | $result = $this->bo->update( $_data, |
352 | 392 | !$this->definition->plugin_options['skip_conflicts'], |
@@ -398,7 +438,8 @@ discard block |
||
398 | 438 | * |
399 | 439 | * @return string name |
400 | 440 | */ |
401 | - public static function get_name() { |
|
441 | + public static function get_name() |
|
442 | + { |
|
402 | 443 | return lang('Calendar CSV import'); |
403 | 444 | } |
404 | 445 | |
@@ -407,7 +448,8 @@ discard block |
||
407 | 448 | * |
408 | 449 | * @return string descriprion |
409 | 450 | */ |
410 | - public static function get_description() { |
|
451 | + public static function get_description() |
|
452 | + { |
|
411 | 453 | return lang("Imports events into your Calendar from a CSV File. CSV means 'Comma Separated Values'. However in the options Tab you can also choose other seperators."); |
412 | 454 | } |
413 | 455 | |
@@ -416,7 +458,8 @@ discard block |
||
416 | 458 | * |
417 | 459 | * @return string suffix (comma seperated) |
418 | 460 | */ |
419 | - public static function get_filesuffix() { |
|
461 | + public static function get_filesuffix() |
|
462 | + { |
|
420 | 463 | return 'csv'; |
421 | 464 | } |
422 | 465 |