@@ -36,11 +36,11 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | //print_r($config); exit; |
| 38 | 38 | |
| 39 | -$uglify =& $config['uglify']; |
|
| 39 | +$uglify = & $config['uglify']; |
|
| 40 | 40 | |
| 41 | -foreach(Bundle::all() as $name => $files) |
|
| 41 | +foreach (Bundle::all() as $name => $files) |
|
| 42 | 42 | { |
| 43 | - if ($name == '.ts') continue; // ignore timestamp |
|
| 43 | + if ($name == '.ts') continue; // ignore timestamp |
|
| 44 | 44 | |
| 45 | 45 | // remove leading / from file-names |
| 46 | 46 | array_walk($files, function(&$path) |
@@ -79,16 +79,16 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // add css for all templates and themes |
| 82 | -$cssmin =& $config['cssmin']; |
|
| 83 | -$GLOBALS['egw_info']['flags']['currentapp'] = '*grunt*'; // to no find any app.css files |
|
| 84 | -$GLOBALS['egw_info']['server']['debug_minify'] = 'True'; // otherwise we would only get minified file |
|
| 85 | -foreach(array('pixelegg','jdots')/*array_keys(Framework::list_templates())*/ as $template) |
|
| 82 | +$cssmin = & $config['cssmin']; |
|
| 83 | +$GLOBALS['egw_info']['flags']['currentapp'] = '*grunt*'; // to no find any app.css files |
|
| 84 | +$GLOBALS['egw_info']['server']['debug_minify'] = 'True'; // otherwise we would only get minified file |
|
| 85 | +foreach (array('pixelegg', 'jdots')/*array_keys(Framework::list_templates())*/ as $template) |
|
| 86 | 86 | { |
| 87 | 87 | $GLOBALS['egw_info']['server']['template_set'] = $template; |
| 88 | 88 | $tpl = Framework::factory(); |
| 89 | 89 | $themes = $tpl->list_themes(); |
| 90 | - if ($template == 'pixelegg') $themes[] = 'fw_mobile'; // this is for mobile devices |
|
| 91 | - foreach($themes as $theme) |
|
| 90 | + if ($template == 'pixelegg') $themes[] = 'fw_mobile'; // this is for mobile devices |
|
| 91 | + foreach ($themes as $theme) |
|
| 92 | 92 | { |
| 93 | 93 | // skip not working cssmin of pixelegg/traditional: Broken @import declaration of "../../etemplate/templates/default/etemplate2.css" |
| 94 | 94 | if ($template == 'pixelegg' && $theme == 'traditional') continue; |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $new_json = str_replace("\n", "\n\t", |
| 115 | 115 | preg_replace_callback('/^( *)/m', function($matches) |
| 116 | 116 | { |
| 117 | - return str_repeat("\t", strlen($matches[1])/4); |
|
| 117 | + return str_repeat("\t", strlen($matches[1]) / 4); |
|
| 118 | 118 | }, json_encode($config, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES))); |
| 119 | 119 | |
| 120 | 120 | $new_content = preg_replace('/^(\s*)"([a-z0-9]+)":/mi', '$1$2:', $new_json); |
@@ -13,7 +13,10 @@ discard block |
||
| 13 | 13 | use EGroupware\Api\Framework; |
| 14 | 14 | use EGroupware\Api\Framework\Bundle; |
| 15 | 15 | |
| 16 | -if (php_sapi_name() !== 'cli') die("This is a commandline ONLY tool!\n"); |
|
| 16 | +if (php_sapi_name() !== 'cli') |
|
| 17 | +{ |
|
| 18 | + die("This is a commandline ONLY tool!\n"); |
|
| 19 | +} |
|
| 17 | 20 | |
| 18 | 21 | $GLOBALS['egw_info'] = array( |
| 19 | 22 | 'flags' => array( |
@@ -40,12 +43,19 @@ discard block |
||
| 40 | 43 | |
| 41 | 44 | foreach(Bundle::all() as $name => $files) |
| 42 | 45 | { |
| 43 | - if ($name == '.ts') continue; // ignore timestamp |
|
| 46 | + if ($name == '.ts') |
|
| 47 | + { |
|
| 48 | + continue; |
|
| 49 | + } |
|
| 50 | + // ignore timestamp |
|
| 44 | 51 | |
| 45 | 52 | // remove leading / from file-names |
| 46 | 53 | array_walk($files, function(&$path) |
| 47 | 54 | { |
| 48 | - if ($path[0] == '/') $path = substr($path, 1); |
|
| 55 | + if ($path[0] == '/') |
|
| 56 | + { |
|
| 57 | + $path = substr($path, 1); |
|
| 58 | + } |
|
| 49 | 59 | }); |
| 50 | 60 | |
| 51 | 61 | // api/js/jsapi/egw.js loaded via own tag, and we must not load it twice! |
@@ -87,11 +97,18 @@ discard block |
||
| 87 | 97 | $GLOBALS['egw_info']['server']['template_set'] = $template; |
| 88 | 98 | $tpl = Framework::factory(); |
| 89 | 99 | $themes = $tpl->list_themes(); |
| 90 | - if ($template == 'pixelegg') $themes[] = 'fw_mobile'; // this is for mobile devices |
|
| 100 | + if ($template == 'pixelegg') |
|
| 101 | + { |
|
| 102 | + $themes[] = 'fw_mobile'; |
|
| 103 | + } |
|
| 104 | + // this is for mobile devices |
|
| 91 | 105 | foreach($themes as $theme) |
| 92 | 106 | { |
| 93 | 107 | // skip not working cssmin of pixelegg/traditional: Broken @import declaration of "../../etemplate/templates/default/etemplate2.css" |
| 94 | - if ($template == 'pixelegg' && $theme == 'traditional') continue; |
|
| 108 | + if ($template == 'pixelegg' && $theme == 'traditional') |
|
| 109 | + { |
|
| 110 | + continue; |
|
| 111 | + } |
|
| 95 | 112 | $GLOBALS['egw_info']['user']['preferences']['common']['theme'] = $theme; |
| 96 | 113 | // empty include list by not-existing file plus last true |
| 97 | 114 | Framework\CssIncludes::add('*grunt*', null, true, true); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | 'category' => array( |
| 56 | 56 | 'type' => 'select', |
| 57 | 57 | 'label' => lang('Choose a category'), |
| 58 | - 'options' => array(), // specification of options is postponed into the get_user_interface function |
|
| 58 | + 'options' => array(), // specification of options is postponed into the get_user_interface function |
|
| 59 | 59 | 'multiple' => true, |
| 60 | 60 | ), |
| 61 | 61 | 'numWeeks' => array( |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | function get_user_interface() |
| 108 | 108 | { |
| 109 | 109 | // copied from bookmarks module. |
| 110 | - $cat = createobject('phpgwapi.categories','','calendar'); |
|
| 111 | - $cats = $cat->return_array('all',0,False,'','cat_name','',True); |
|
| 110 | + $cat = createobject('phpgwapi.categories', '', 'calendar'); |
|
| 111 | + $cats = $cat->return_array('all', 0, False, '', 'cat_name', '', True); |
|
| 112 | 112 | $cat_ids = array(); |
| 113 | 113 | while (list(,$category) = @each($cats)) |
| 114 | 114 | { |
@@ -119,12 +119,12 @@ discard block |
||
| 119 | 119 | $this->arguments['category']['multiple'] = 5; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if (! isset($GLOBALS['egw']->accounts)) |
|
| 122 | + if (!isset($GLOBALS['egw']->accounts)) |
|
| 123 | 123 | { |
| 124 | 124 | $GLOBALS['egw']->accounts = new Api\Accounts(); |
| 125 | 125 | } |
| 126 | - $this->accounts =& $GLOBALS['egw']->accounts; |
|
| 127 | - $search_params=array( |
|
| 126 | + $this->accounts = & $GLOBALS['egw']->accounts; |
|
| 127 | + $search_params = array( |
|
| 128 | 128 | 'type' => 'both', |
| 129 | 129 | 'app' => 'calendar', |
| 130 | 130 | ); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | // sort users and groups separately. |
| 135 | 135 | if (isset($GLOBALS['sitemgr_info']['anonymous_user'])) |
| 136 | 136 | { |
| 137 | - $anon_user = $this->accounts->name2id($GLOBALS['sitemgr_info']['anonymous_user'],'account_lid','u'); |
|
| 137 | + $anon_user = $this->accounts->name2id($GLOBALS['sitemgr_info']['anonymous_user'], 'account_lid', 'u'); |
|
| 138 | 138 | } |
| 139 | 139 | else |
| 140 | 140 | { |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * Get possible sitemgr paths from the HTTP_REFERRER in order to unreveal the |
| 144 | 144 | * anonymous user for the correct site. |
| 145 | 145 | */ |
| 146 | - $sitemgr_path = preg_replace('/^[^\/]+:\/\/[^\/]+\/([^\?]*)(\?.*)*$/',"/\${1}",$_SERVER['HTTP_REFERER']); |
|
| 146 | + $sitemgr_path = preg_replace('/^[^\/]+:\/\/[^\/]+\/([^\?]*)(\?.*)*$/', "/\${1}", $_SERVER['HTTP_REFERER']); |
|
| 147 | 147 | // Remove the trailing file- / pathname if any |
| 148 | 148 | $sitemgr_path = preg_replace('/[^\/]*$/', '', $sitemgr_path); |
| 149 | 149 | // Add leading slash if it has been lost. |
@@ -155,14 +155,14 @@ discard block |
||
| 155 | 155 | // Code adapted from sitemgr-site/index.php |
| 156 | 156 | $site_urls = array(); |
| 157 | 157 | $site_urls[] = $sitemgr_path; |
| 158 | - $site_urls[] = ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['SERVER_ADDR'] . $sitemgr_path; |
|
| 159 | - $site_urls[] = $site_url = ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . $sitemgr_path; |
|
| 158 | + $site_urls[] = ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['SERVER_ADDR'].$sitemgr_path; |
|
| 159 | + $site_urls[] = $site_url = ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['SERVER_NAME'].$sitemgr_path; |
|
| 160 | 160 | |
| 161 | - $anon_user = $this->accounts->name2id($GLOBALS['egw']->db->select('egw_sitemgr_sites','anonymous_user,anonymous_passwd,site_id', |
|
| 162 | - array('site_url' => $site_urls),__LINE__,__FILE__,false,'','sitemgr')->fetchColumn(),'account_lid','u'); |
|
| 161 | + $anon_user = $this->accounts->name2id($GLOBALS['egw']->db->select('egw_sitemgr_sites', 'anonymous_user,anonymous_passwd,site_id', |
|
| 162 | + array('site_url' => $site_urls), __LINE__, __FILE__, false, '', 'sitemgr')->fetchColumn(), 'account_lid', 'u'); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - $anon_groups = $this->accounts->memberships($anon_user,true); |
|
| 165 | + $anon_groups = $this->accounts->memberships($anon_user, true); |
|
| 166 | 166 | foreach ($accounts as $entry) |
| 167 | 167 | { |
| 168 | 168 | $is_group = false; |
@@ -170,9 +170,9 @@ discard block |
||
| 170 | 170 | $acl = new Acl($entry['account_id']); |
| 171 | 171 | $acl->read_repository(); |
| 172 | 172 | // get the rights for each account to check whether the anon user has read permissions. |
| 173 | - $rights = $acl->get_rights($anon_user,'calendar'); |
|
| 173 | + $rights = $acl->get_rights($anon_user, 'calendar'); |
|
| 174 | 174 | // also add the anon user if it's his own calendar. |
| 175 | - if (($rights & Acl::READ) || ($entry['account_id'] == $anon_user)) |
|
| 175 | + if (($rights&Acl::READ) || ($entry['account_id'] == $anon_user)) |
|
| 176 | 176 | { |
| 177 | 177 | $has_read_permissions = true; |
| 178 | 178 | } |
@@ -182,8 +182,8 @@ discard block |
||
| 182 | 182 | // or ass permissions if this is the anon group's calendar. |
| 183 | 183 | foreach ($anon_groups as $parent_group) |
| 184 | 184 | { |
| 185 | - $rights = $acl->get_rights($parent_group,'calendar'); |
|
| 186 | - if (($rights & Acl::READ) || ($entry['account_id'] == $parent_group)) |
|
| 185 | + $rights = $acl->get_rights($parent_group, 'calendar'); |
|
| 186 | + if (($rights&Acl::READ) || ($entry['account_id'] == $parent_group)) |
|
| 187 | 187 | { |
| 188 | 188 | $has_read_permissions = true; |
| 189 | 189 | break; |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | else |
| 201 | 201 | { |
| 202 | - $users[$entry['account_id']] = Api\Accounts::format_username($entry['account_lid'],$entry['account_firstname'],$entry['account_lastname']); |
|
| 202 | + $users[$entry['account_id']] = Api\Accounts::format_username($entry['account_lid'], $entry['account_firstname'], $entry['account_lastname']); |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | return parent::get_user_interface(); |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - function get_content(&$arguments,$properties) |
|
| 222 | + function get_content(&$arguments, $properties) |
|
| 223 | 223 | { |
| 224 | 224 | $html = ""; |
| 225 | 225 | Api\Translation::add_app('calendar'); |
@@ -227,33 +227,32 @@ discard block |
||
| 227 | 227 | $this->ui->allowEdit = false; |
| 228 | 228 | $this->ui->use_time_grid = isset($arguments['grid']) ? $arguments['grid'] : false; |
| 229 | 229 | |
| 230 | - $weeks = $arguments['numWeeks'] ? (int) $arguments['numWeeks'] : 2; |
|
| 230 | + $weeks = $arguments['numWeeks'] ? (int)$arguments['numWeeks'] : 2; |
|
| 231 | 231 | |
| 232 | - if (($arguments['acceptDateParam']) && (get_var('date',array('POST','GET')))) |
|
| 232 | + if (($arguments['acceptDateParam']) && (get_var('date', array('POST', 'GET')))) |
|
| 233 | 233 | { |
| 234 | - $start = (int) (strtotime(get_var('date',array('POST','GET'))) + |
|
| 234 | + $start = (int)(strtotime(get_var('date', array('POST', 'GET'))) + |
|
| 235 | 235 | (60 * 60 * 24 * 7 * $dateOffset)); |
| 236 | 236 | } |
| 237 | 237 | else |
| 238 | 238 | { |
| 239 | - $start = (int) ($this->bo->now_su + |
|
| 239 | + $start = (int)($this->bo->now_su + |
|
| 240 | 240 | (60 * 60 * 24 * 7 * $dateOffset)); |
| 241 | 241 | } |
| 242 | 242 | $start = new Api\DateTime($start); |
| 243 | 243 | $start->setWeekstart(); |
| 244 | 244 | $first = $start->format('ts'); |
| 245 | - $last = strtotime("+$weeks weeks",$first) - 1; |
|
| 245 | + $last = strtotime("+$weeks weeks", $first) - 1; |
|
| 246 | 246 | |
| 247 | 247 | if ($arguments['showTitle']) |
| 248 | 248 | { |
| 249 | 249 | $html .= '<div id="divAppboxHeader">'.$GLOBALS['egw_info']['apps']['calendar']['title'].' - '.lang('Weekview').": "; |
| 250 | - $html .= lang('After %1',$this->bo->long_date($first)); |
|
| 250 | + $html .= lang('After %1', $this->bo->long_date($first)); |
|
| 251 | 251 | $html .= "</div>"; |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | // set the search parameters |
| 255 | - $search_params = Array |
|
| 256 | - ( |
|
| 255 | + $search_params = Array( |
|
| 257 | 256 | 'offset' => false, |
| 258 | 257 | 'order' => 'cal_start ASC', |
| 259 | 258 | 'start' => $first, |
@@ -288,19 +287,19 @@ discard block |
||
| 288 | 287 | $html .= '<!-- END Calendar info -->'."\n"; |
| 289 | 288 | unset($css_file); |
| 290 | 289 | // we add DAY_s/2 to $this->first (using 12h), to deal with daylight saving changes |
| 291 | - for ($week_start = $first; $week_start < $last; $week_start = strtotime("+1 week",$week_start)) |
|
| 290 | + for ($week_start = $first; $week_start < $last; $week_start = strtotime("+1 week", $week_start)) |
|
| 292 | 291 | { |
| 293 | 292 | $week = array(); |
| 294 | 293 | for ($i = 0; $i < 7; ++$i) |
| 295 | 294 | { |
| 296 | - $day_ymd = $this->bo->date2string($i ? strtotime("+$i days",$week_start) : $week_start); |
|
| 295 | + $day_ymd = $this->bo->date2string($i ? strtotime("+$i days", $week_start) : $week_start); |
|
| 297 | 296 | $week[$day_ymd] = array_shift($rows); |
| 298 | 297 | } |
| 299 | 298 | $week_view = array( |
| 300 | 299 | 'menuaction' => false, |
| 301 | 300 | 'date' => $this->bo->date2string($week_start), |
| 302 | 301 | ); |
| 303 | - $title = lang('Wk').' '.adodb_date('W',$week_start); |
|
| 302 | + $title = lang('Wk').' '.adodb_date('W', $week_start); |
|
| 304 | 303 | if (!isset($GLOBALS['egw']->template)) |
| 305 | 304 | { |
| 306 | 305 | $GLOBALS['egw']->template = new Framework\Template; |
@@ -115,7 +115,8 @@ |
||
| 115 | 115 | $cat_ids[$category['id']] = $GLOBALS['egw']->strip_html($category['name']); |
| 116 | 116 | } |
| 117 | 117 | $this->arguments['category']['options'] = $cat_ids; |
| 118 | - if (count($cat_ids) > 5) { |
|
| 118 | + if (count($cat_ids) > 5) |
|
| 119 | + { |
|
| 119 | 120 | $this->arguments['category']['multiple'] = 5; |
| 120 | 121 | } |
| 121 | 122 | |
@@ -252,7 +252,7 @@ |
||
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | // set the search parameters |
| 255 | - $search_params = Array |
|
| 255 | + $search_params = array |
|
| 256 | 256 | ( |
| 257 | 257 | 'offset' => false, |
| 258 | 258 | 'order' => 'cal_start ASC', |
@@ -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('16.1') |
|
| 53 | + 'versions' => array('16.1') |
|
| 54 | 54 | ); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | 'Arab Standard Time' => 'Asia/Riyadh', |
| 25 | 25 | 'Arabian Standard Time' => 'Asia/Dubai', |
| 26 | 26 | 'Arabic Standard Time' => 'Asia/Baghdad', |
| 27 | - 'Argentina Standard Time' => 'America/Argentina/Buenos_Aires', // was 'America/Buenos_Aires', |
|
| 27 | + 'Argentina Standard Time' => 'America/Argentina/Buenos_Aires', // was 'America/Buenos_Aires', |
|
| 28 | 28 | 'Atlantic Standard Time' => 'America/Halifax', |
| 29 | 29 | 'Azerbaijan Standard Time' => 'Asia/Baku', |
| 30 | 30 | 'Azores Standard Time' => 'Atlantic/Azores', |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | 'Greenland Standard Time' => 'America/Godthab', |
| 60 | 60 | 'Greenwich Standard Time' => 'Atlantic/Reykjavik', |
| 61 | 61 | 'Hawaiian Standard Time' => 'Pacific/Honolulu', |
| 62 | - 'India Standard Time' => 'Asia/Kolkata', // Asia/Calcutta is an alias to Asia/Kolkata |
|
| 62 | + 'India Standard Time' => 'Asia/Kolkata', // Asia/Calcutta is an alias to Asia/Kolkata |
|
| 63 | 63 | 'Iran Standard Time' => 'Asia/Tehran', |
| 64 | 64 | 'Israel Standard Time' => 'Asia/Jerusalem', |
| 65 | 65 | 'Jordan Standard Time' => 'Asia/Amman', |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | 'Eniwetok, Kwajalein, Dateline Time' => 'Pacific/Kwajalein', |
| 199 | 199 | |
| 200 | 200 | // various aliases collected over time |
| 201 | - 'America/Creston' => 'America/Dawson_Creek', // not in sqlight DB of Thunderbird version 1.2011n, Dawson Creek is also UTC-7 without DS |
|
| 201 | + 'America/Creston' => 'America/Dawson_Creek', // not in sqlight DB of Thunderbird version 1.2011n, Dawson Creek is also UTC-7 without DS |
|
| 202 | 202 | 'Armenian Standard Time' => 'Asia/Yerevan', |
| 203 | 203 | 'Asia/Katmandu' => 'Asia/Kathmandu', |
| 204 | 204 | 'Asia/Calcutta' => 'Asia/Kolkata', |
@@ -10,17 +10,17 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // enable auto-loading of holidays from localhost by default |
| 13 | -foreach(array( |
|
| 13 | +foreach (array( |
|
| 14 | 14 | 'auto_load_holidays' => 'True', |
| 15 | 15 | 'holidays_url_path' => 'localhost', |
| 16 | 16 | ) as $name => $value) |
| 17 | 17 | { |
| 18 | - $oProc->insert($GLOBALS['egw_setup']->config_table,array( |
|
| 18 | + $oProc->insert($GLOBALS['egw_setup']->config_table, array( |
|
| 19 | 19 | 'config_value' => $value, |
| 20 | - ),array( |
|
| 20 | + ), array( |
|
| 21 | 21 | 'config_app' => 'phpgwapi', |
| 22 | 22 | 'config_name' => $name, |
| 23 | - ),__FILE__,__LINE__); |
|
| 23 | + ), __FILE__, __LINE__); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | // import timezone data |
@@ -41,23 +41,23 @@ discard block |
||
| 41 | 41 | $GLOBALS['egw_info']['flags']['currentapp'] = 'calendar'; |
| 42 | 42 | } |
| 43 | 43 | // fix for SOGo connector, which does not decode the = in our f/b url |
| 44 | -if (strpos($_SERVER['QUERY_STRING'],'=3D') !== false && substr($_GET['user'],0,2) == '3D') |
|
| 44 | +if (strpos($_SERVER['QUERY_STRING'], '=3D') !== false && substr($_GET['user'], 0, 2) == '3D') |
|
| 45 | 45 | { |
| 46 | - $_GET['user'] = substr($_GET['user'],2); |
|
| 47 | - if (isset($_GET['password'])) $_GET['password'] = substr($_GET['password'],2); |
|
| 48 | - if (isset($_GET['cred'])) $_GET['cred'] = substr($_GET['cred'],2); |
|
| 46 | + $_GET['user'] = substr($_GET['user'], 2); |
|
| 47 | + if (isset($_GET['password'])) $_GET['password'] = substr($_GET['password'], 2); |
|
| 48 | + if (isset($_GET['cred'])) $_GET['cred'] = substr($_GET['cred'], 2); |
|
| 49 | 49 | } |
| 50 | 50 | if (!is_numeric($user = $_GET['user'])) |
| 51 | 51 | { |
| 52 | 52 | // check if user contains the current domain --> remove it |
| 53 | - list(,$domain) = explode('@',$user); |
|
| 53 | + list(,$domain) = explode('@', $user); |
|
| 54 | 54 | if ($domain === $GLOBALS['egw_info']['user']['domain']) |
| 55 | - list($user) = explode('@',$user); |
|
| 56 | - $user = $GLOBALS['egw']->accounts->name2id($user,'account_lid','u'); |
|
| 55 | + list($user) = explode('@', $user); |
|
| 56 | + $user = $GLOBALS['egw']->accounts->name2id($user, 'account_lid', 'u'); |
|
| 57 | 57 | } |
| 58 | 58 | if ($user === false || !($username = $GLOBALS['egw']->accounts->id2name($user))) |
| 59 | 59 | { |
| 60 | - fail_exit(lang("freebusy: Unknow user '%1', wrong password or not availible to not loged in users !!!"." $username($user)",$_GET['user'])); |
|
| 60 | + fail_exit(lang("freebusy: Unknow user '%1', wrong password or not availible to not loged in users !!!"." $username($user)", $_GET['user'])); |
|
| 61 | 61 | } |
| 62 | 62 | if (!$loged_in) |
| 63 | 63 | { |
@@ -78,11 +78,11 @@ discard block |
||
| 78 | 78 | if (strpos($authuser, '@') === false) |
| 79 | 79 | { |
| 80 | 80 | $domain = $GLOBALS['egw_info']['server']['default_domain']; |
| 81 | - $authuser .= '@' . $domain; |
|
| 81 | + $authuser .= '@'.$domain; |
|
| 82 | 82 | } |
| 83 | 83 | else |
| 84 | 84 | { |
| 85 | - list(, $domain) = explode('@',$authuser, 2); |
|
| 85 | + list(, $domain) = explode('@', $authuser, 2); |
|
| 86 | 86 | } |
| 87 | 87 | if (array_key_exists($domain, $GLOBALS['egw_domain'])) |
| 88 | 88 | { |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | $GLOBALS['egw_info']['user']['domain'] = $domain; |
| 93 | 93 | $GLOBALS['egw_info']['flags']['currentapp'] = 'login'; |
| 94 | 94 | $GLOBALS['egw_info']['flags']['noapi'] = false; |
| 95 | - require_once(EGW_API_INC . '/functions.inc.php'); |
|
| 96 | - $loged_in = $GLOBALS['egw']->session->create($authuser, $password, 'text'); |
|
| 95 | + require_once(EGW_API_INC.'/functions.inc.php'); |
|
| 96 | + $loged_in = $GLOBALS['egw']->session->create($authuser, $password, 'text'); |
|
| 97 | 97 | session_unset(); |
| 98 | 98 | session_destroy(); |
| 99 | 99 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | else |
| 111 | 111 | { |
| 112 | - Api\Header\Content::type('freebusy.ifb','text/calendar'); |
|
| 112 | + Api\Header\Content::type('freebusy.ifb', 'text/calendar'); |
|
| 113 | 113 | } |
| 114 | 114 | $ical = new calendar_ical(); |
| 115 | 115 | echo $ical->freebusy($user, $_GET['end']); |
@@ -44,15 +44,23 @@ |
||
| 44 | 44 | if (strpos($_SERVER['QUERY_STRING'],'=3D') !== false && substr($_GET['user'],0,2) == '3D') |
| 45 | 45 | { |
| 46 | 46 | $_GET['user'] = substr($_GET['user'],2); |
| 47 | - if (isset($_GET['password'])) $_GET['password'] = substr($_GET['password'],2); |
|
| 48 | - if (isset($_GET['cred'])) $_GET['cred'] = substr($_GET['cred'],2); |
|
| 49 | -} |
|
| 47 | + if (isset($_GET['password'])) |
|
| 48 | + { |
|
| 49 | + $_GET['password'] = substr($_GET['password'],2); |
|
| 50 | + } |
|
| 51 | + if (isset($_GET['cred'])) |
|
| 52 | + { |
|
| 53 | + $_GET['cred'] = substr($_GET['cred'],2); |
|
| 54 | + } |
|
| 55 | + } |
|
| 50 | 56 | if (!is_numeric($user = $_GET['user'])) |
| 51 | 57 | { |
| 52 | 58 | // check if user contains the current domain --> remove it |
| 53 | 59 | list(,$domain) = explode('@',$user); |
| 54 | 60 | if ($domain === $GLOBALS['egw_info']['user']['domain']) |
| 55 | - list($user) = explode('@',$user); |
|
| 61 | + { |
|
| 62 | + list($user) = explode('@',$user); |
|
| 63 | + } |
|
| 56 | 64 | $user = $GLOBALS['egw']->accounts->name2id($user,'account_lid','u'); |
| 57 | 65 | } |
| 58 | 66 | if ($user === false || !($username = $GLOBALS['egw']->accounts->id2name($user))) |
@@ -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 | } |
@@ -177,7 +177,7 @@ |
||
| 177 | 177 | * @param int $cutoffdate =null |
| 178 | 178 | * @param array $not_uids =null uids NOT to return for meeting requests |
| 179 | 179 | * @return array |
| 180 | - */ |
|
| 180 | + */ |
|
| 181 | 181 | function GetMessageList($id, $cutoffdate=NULL, array $not_uids=null) |
| 182 | 182 | { |
| 183 | 183 | if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
@@ -20,8 +20,12 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) |
| 22 | 22 | { |
| 23 | - interface activesync_plugin_write {} |
|
| 24 | - interface activesync_plugin_meeting_requests {} |
|
| 23 | + interface activesync_plugin_write |
|
| 24 | + { |
|
| 25 | +} |
|
| 26 | + interface activesync_plugin_meeting_requests |
|
| 27 | + { |
|
| 28 | +} |
|
| 25 | 29 | } |
| 26 | 30 | |
| 27 | 31 | /** |
@@ -81,7 +85,10 @@ discard block |
||
| 81 | 85 | */ |
| 82 | 86 | public function GetFolderList() |
| 83 | 87 | { |
| 84 | - if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
|
| 88 | + if (!isset($this->calendar)) |
|
| 89 | + { |
|
| 90 | + $this->calendar = new calendar_boupdate(); |
|
| 91 | + } |
|
| 85 | 92 | |
| 86 | 93 | $cals_pref = $GLOBALS['egw_info']['user']['preferences']['activesync']['calendar-cals']; |
| 87 | 94 | $cals = $cals_pref ? explode(',',$cals_pref) : array('P'); // implicit default of 'P' |
@@ -180,13 +187,20 @@ discard block |
||
| 180 | 187 | */ |
| 181 | 188 | function GetMessageList($id, $cutoffdate=NULL, array $not_uids=null) |
| 182 | 189 | { |
| 183 | - if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
|
| 190 | + if (!isset($this->calendar)) |
|
| 191 | + { |
|
| 192 | + $this->calendar = new calendar_boupdate(); |
|
| 193 | + } |
|
| 184 | 194 | |
| 185 | 195 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$id',$cutoffdate)"); |
| 186 | 196 | $type = $user = null; |
| 187 | 197 | $this->backend->splitID($id,$type,$user); |
| 188 | 198 | |
| 189 | - if (!$cutoffdate) $cutoffdate = $this->bo->now - 100*24*3600; // default three month back -30 breaks all sync recurrences |
|
| 199 | + if (!$cutoffdate) |
|
| 200 | + { |
|
| 201 | + $cutoffdate = $this->bo->now - 100*24*3600; |
|
| 202 | + } |
|
| 203 | + // default three month back -30 breaks all sync recurrences |
|
| 190 | 204 | |
| 191 | 205 | $filter = array( |
| 192 | 206 | 'users' => $user, |
@@ -212,7 +226,10 @@ discard block |
||
| 212 | 226 | { |
| 213 | 227 | foreach ($events as $event) |
| 214 | 228 | { |
| 215 | - if ($not_uids && in_array($event['uid'], $not_uids)) continue; |
|
| 229 | + if ($not_uids && in_array($event['uid'], $not_uids)) |
|
| 230 | + { |
|
| 231 | + continue; |
|
| 232 | + } |
|
| 216 | 233 | $messagelist[] = $this->StatMessage($id, $event); |
| 217 | 234 | |
| 218 | 235 | // add virtual exceptions for recuring events too |
@@ -227,7 +244,10 @@ discard block |
||
| 227 | 244 | } |
| 228 | 245 | }*/ |
| 229 | 246 | } |
| 230 | - if (count($events) < $num_rows) break; |
|
| 247 | + if (count($events) < $num_rows) |
|
| 248 | + { |
|
| 249 | + break; |
|
| 250 | + } |
|
| 231 | 251 | } |
| 232 | 252 | //error_log(__METHOD__."($id, $cutoffdate, ".array2string($not_uids).") type=$type, user=$user returning ".count($messagelist)." messages ".function_backtrace()); |
| 233 | 253 | return $messagelist; |
@@ -289,7 +309,10 @@ discard block |
||
| 289 | 309 | { |
| 290 | 310 | unset($truncsize, $optionbodypreference, $mimesupport); // not used, but required by function signature |
| 291 | 311 | |
| 292 | - if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
|
| 312 | + if (!isset($this->calendar)) |
|
| 313 | + { |
|
| 314 | + $this->calendar = new calendar_boupdate(); |
|
| 315 | + } |
|
| 293 | 316 | |
| 294 | 317 | if (!($event = $this->calendar->read(abs($id), 0, false, 'server'))) |
| 295 | 318 | { |
@@ -367,7 +390,10 @@ discard block |
||
| 367 | 390 | 'created' => 'dtstamp', |
| 368 | 391 | ) as $key => $attr) |
| 369 | 392 | { |
| 370 | - if (!empty($event[$key])) $message->$attr = $event[$key]; |
|
| 393 | + if (!empty($event[$key])) |
|
| 394 | + { |
|
| 395 | + $message->$attr = $event[$key]; |
|
| 396 | + } |
|
| 371 | 397 | } |
| 372 | 398 | if (($message->alldayevent = (int)calendar_bo::isWholeDay($event))) |
| 373 | 399 | { |
@@ -379,7 +405,10 @@ discard block |
||
| 379 | 405 | 'location' => 'location', |
| 380 | 406 | ) as $key => $attr) |
| 381 | 407 | { |
| 382 | - if (!empty($event[$key])) $message->$attr = $event[$key]; |
|
| 408 | + if (!empty($event[$key])) |
|
| 409 | + { |
|
| 410 | + $message->$attr = $event[$key]; |
|
| 411 | + } |
|
| 383 | 412 | } |
| 384 | 413 | $message->organizer = $event['organizer']; |
| 385 | 414 | |
@@ -414,7 +443,10 @@ discard block |
||
| 414 | 443 | */ |
| 415 | 444 | function MeetingResponse($folderid, $requestid, $response) |
| 416 | 445 | { |
| 417 | - if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
|
| 446 | + if (!isset($this->calendar)) |
|
| 447 | + { |
|
| 448 | + $this->calendar = new calendar_boupdate(); |
|
| 449 | + } |
|
| 418 | 450 | |
| 419 | 451 | static $as2status = array( // different from self::$status2as! |
| 420 | 452 | 1 => 'A', |
@@ -424,9 +456,12 @@ discard block |
||
| 424 | 456 | $status_in = isset($as2status[$response]) ? $as2status[$response] : 'U'; |
| 425 | 457 | $uid = $GLOBALS['egw_info']['user']['account_id']; |
| 426 | 458 | |
| 427 | - if (!is_numeric($requestid)) // iCal from fmail |
|
| 459 | + if (!is_numeric($requestid)) |
|
| 460 | + { |
|
| 461 | + // iCal from fmail |
|
| 428 | 462 | { |
| 429 | 463 | $ical = new calendar_ical(); |
| 464 | + } |
|
| 430 | 465 | if (!($events = $ical->icaltoegw($requestid, '', 'utf-8')) || count($events) != 1) |
| 431 | 466 | { |
| 432 | 467 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."($folderid, '$requestid') error parsing iCal!"); |
@@ -536,7 +571,10 @@ discard block |
||
| 536 | 571 | { |
| 537 | 572 | unset($contentParameters); // unused, but required by function signature |
| 538 | 573 | |
| 539 | - if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
|
| 574 | + if (!isset($this->calendar)) |
|
| 575 | + { |
|
| 576 | + $this->calendar = new calendar_boupdate(); |
|
| 577 | + } |
|
| 540 | 578 | |
| 541 | 579 | $old_event = array(); |
| 542 | 580 | $type = $account = null; |
@@ -551,10 +589,13 @@ discard block |
||
| 551 | 589 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid',$id,...) Folder wrong or event does not existing"); |
| 552 | 590 | return false; |
| 553 | 591 | } |
| 554 | - if ($recur_date) // virtual exception |
|
| 592 | + if ($recur_date) |
|
| 593 | + { |
|
| 594 | + // virtual exception |
|
| 555 | 595 | { |
| 556 | 596 | // @todo check if virtual exception needs to be saved as real exception, or only stati need to be changed |
| 557 | 597 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid',$id:$recur_date,".array2string($message).") handling of virtual exception not yet implemented!"); |
| 598 | + } |
|
| 558 | 599 | //error_log(__METHOD__."('$folderid',$id:$recur_date,".array2string($message).") handling of virtual exception not yet implemented!"); |
| 559 | 600 | } |
| 560 | 601 | if (!$this->calendar->check_perms($id ? Acl::EDIT : Acl::ADD, $old_event ? $old_event : 0,$account)) |
@@ -564,7 +605,11 @@ discard block |
||
| 564 | 605 | //error_log(__METHOD__."('$folderid',$id,".array2string($message).") no rights to add/edit event!"); |
| 565 | 606 | return false; |
| 566 | 607 | } |
| 567 | - if (!$id) $old_event['owner'] = $account; // we do NOT allow to change the owner of existing events |
|
| 608 | + if (!$id) |
|
| 609 | + { |
|
| 610 | + $old_event['owner'] = $account; |
|
| 611 | + } |
|
| 612 | + // we do NOT allow to change the owner of existing events |
|
| 568 | 613 | |
| 569 | 614 | $event = $this->message2event($message, $account, $old_event); |
| 570 | 615 | |
@@ -593,7 +638,10 @@ discard block |
||
| 593 | 638 | unset($ex_event['etag']); |
| 594 | 639 | foreach(array_keys($ex_event) as $name) |
| 595 | 640 | { |
| 596 | - if (substr($name,0,6) == 'recur_') unset($ex_event[$name]); |
|
| 641 | + if (substr($name,0,6) == 'recur_') |
|
| 642 | + { |
|
| 643 | + unset($ex_event[$name]); |
|
| 644 | + } |
|
| 597 | 645 | } |
| 598 | 646 | $ex_event['recur_type'] = calendar_rrule::NONE; |
| 599 | 647 | |
@@ -646,7 +694,10 @@ discard block |
||
| 646 | 694 | 'end' => 'endtime', |
| 647 | 695 | ) as $key => $attr) |
| 648 | 696 | { |
| 649 | - if (isset($message->$attr)) $event[$key] = Api\DateTime::server2user($message->$attr); |
|
| 697 | + if (isset($message->$attr)) |
|
| 698 | + { |
|
| 699 | + $event[$key] = Api\DateTime::server2user($message->$attr); |
|
| 700 | + } |
|
| 650 | 701 | } |
| 651 | 702 | // copying strings |
| 652 | 703 | foreach(array( |
@@ -655,7 +706,10 @@ discard block |
||
| 655 | 706 | 'location' => 'location', |
| 656 | 707 | ) as $key => $attr) |
| 657 | 708 | { |
| 658 | - if (isset($message->$attr)) $event[$key] = $message->$attr; |
|
| 709 | + if (isset($message->$attr)) |
|
| 710 | + { |
|
| 711 | + $event[$key] = $message->$attr; |
|
| 712 | + } |
|
| 659 | 713 | } |
| 660 | 714 | |
| 661 | 715 | // only change description, if one given, as iOS5 skips description in ChangeMessage after MeetingResponse |
@@ -674,14 +728,22 @@ discard block |
||
| 674 | 728 | |
| 675 | 729 | if (($event['whole_day'] = $message->alldayevent)) |
| 676 | 730 | { |
| 677 | - if ($event['end'] == $event['start']) $event['end'] += 24*3600; // some clients send equal start&end for 1day |
|
| 731 | + if ($event['end'] == $event['start']) |
|
| 732 | + { |
|
| 733 | + $event['end'] += 24*3600; |
|
| 734 | + } |
|
| 735 | + // some clients send equal start&end for 1day |
|
| 678 | 736 | $event['end']--; // otherwise our whole-day event code in save makes it one more day! |
| 679 | 737 | } |
| 680 | 738 | |
| 681 | 739 | $participants = array(); |
| 682 | 740 | foreach((array)$message->attendees as $attendee) |
| 683 | 741 | { |
| 684 | - if ($attendee->type == 3) continue; // we can not identify resources and re-add them anyway later |
|
| 742 | + if ($attendee->type == 3) |
|
| 743 | + { |
|
| 744 | + continue; |
|
| 745 | + } |
|
| 746 | + // we can not identify resources and re-add them anyway later |
|
| 685 | 747 | |
| 686 | 748 | $matches = null; |
| 687 | 749 | if (preg_match('/^noreply-(.*)[email protected]$/',$attendee->email,$matches)) |
@@ -696,7 +758,10 @@ discard block |
||
| 696 | 758 | //'n_fn' => $attendee->name, // not sure if we want matches without email |
| 697 | 759 | ); |
| 698 | 760 | // search addressbook for participant |
| 699 | - if (!isset($this->addressbook)) $this->addressbook = new Api\Contacts(); |
|
| 761 | + if (!isset($this->addressbook)) |
|
| 762 | + { |
|
| 763 | + $this->addressbook = new Api\Contacts(); |
|
| 764 | + } |
|
| 700 | 765 | if ((list($data) = $this->addressbook->search($search, |
| 701 | 766 | array('id','egw_addressbook.account_id as account_id','n_fn'), |
| 702 | 767 | 'egw_addressbook.account_id IS NOT NULL DESC, n_fn IS NOT NULL DESC', |
@@ -704,10 +769,13 @@ discard block |
||
| 704 | 769 | { |
| 705 | 770 | $uid = $data['account_id'] ? (int)$data['account_id'] : 'c'.$data['id']; |
| 706 | 771 | } |
| 707 | - elseif($attendee->name === $attendee->email || empty($attendee->name)) // dont store empty or email as name |
|
| 772 | + elseif($attendee->name === $attendee->email || empty($attendee->name)) |
|
| 773 | + { |
|
| 774 | + // dont store empty or email as name |
|
| 708 | 775 | { |
| 709 | 776 | $uid = 'e'.$attendee->email; |
| 710 | 777 | } |
| 778 | + } |
|
| 711 | 779 | else // store just the email |
| 712 | 780 | { |
| 713 | 781 | $uid = 'e'.$attendee->name.' <'.$attendee->email.'>'; |
@@ -736,7 +804,11 @@ discard block |
||
| 736 | 804 | $role = 'REQ-PARTICIPANT'; |
| 737 | 805 | //ZLog::Write(LOGLEVEL_DEBUG, "default status for $uid is status=$status, quantity=$quantitiy, role=$role"); |
| 738 | 806 | } |
| 739 | - if ($role == 'CHAIR') $chair_set = true; // by role from existing participant |
|
| 807 | + if ($role == 'CHAIR') |
|
| 808 | + { |
|
| 809 | + $chair_set = true; |
|
| 810 | + } |
|
| 811 | + // by role from existing participant |
|
| 740 | 812 | |
| 741 | 813 | if (isset($attendee->attendeestatus) && ($s = array_search($attendee->attendeestatus,self::$status2as))) |
| 742 | 814 | { |
@@ -750,10 +822,13 @@ discard block |
||
| 750 | 822 | elseif (isset($attendee->attendeetype) && |
| 751 | 823 | !($role == 'CHAIR' && !is_numeric($uid)) && // do not override our external ORGANIZER |
| 752 | 824 | ($r = array_search($attendee->attendeetype,self::$role2as)) && |
| 753 | - (int)self::$role2as[$role] != $attendee->attendeetype) // if old role gives same type, use old role, as we have a lot more roles then AS |
|
| 825 | + (int)self::$role2as[$role] != $attendee->attendeetype) |
|
| 826 | + { |
|
| 827 | + // if old role gives same type, use old role, as we have a lot more roles then AS |
|
| 754 | 828 | { |
| 755 | 829 | $role = $r; |
| 756 | 830 | } |
| 831 | + } |
|
| 757 | 832 | //ZLog::Write(LOGLEVEL_DEBUG, "-> status for $uid is status=$status ($s), quantity=$quantitiy, role=$role ($r)"); |
| 758 | 833 | $participants[$uid] = calendar_so::combine_status($status,$quantitiy,$role); |
| 759 | 834 | } |
@@ -768,12 +843,19 @@ discard block |
||
| 768 | 843 | // $account is also preserved, as AS does not add him as participant! |
| 769 | 844 | foreach((array)$event['participant_types'] as $type => $parts) |
| 770 | 845 | { |
| 771 | - if (in_array($type,array('c','e'))) continue; // they are correctly representable in AS |
|
| 846 | + if (in_array($type,array('c','e'))) |
|
| 847 | + { |
|
| 848 | + continue; |
|
| 849 | + } |
|
| 850 | + // they are correctly representable in AS |
|
| 772 | 851 | |
| 773 | 852 | foreach($parts as $id => $status) |
| 774 | 853 | { |
| 775 | 854 | // accounts are represented correctly, but the event owner which is no participant in AS |
| 776 | - if ($type == 'u' && $id != $account) continue; |
|
| 855 | + if ($type == 'u' && $id != $account) |
|
| 856 | + { |
|
| 857 | + continue; |
|
| 858 | + } |
|
| 777 | 859 | |
| 778 | 860 | $uid = calendar_so::combine_user($type, $id); |
| 779 | 861 | if (!isset($participants[$uid])) |
@@ -798,10 +880,13 @@ discard block |
||
| 798 | 880 | // check if event is recurring and import recur information (incl. timezone) |
| 799 | 881 | if ($message->recurrence) |
| 800 | 882 | { |
| 801 | - if ($message->timezone && !$event['id']) // dont care for timezone, if no new and recurring event |
|
| 883 | + if ($message->timezone && !$event['id']) |
|
| 884 | + { |
|
| 885 | + // dont care for timezone, if no new and recurring event |
|
| 802 | 886 | { |
| 803 | 887 | $event['tzid'] = self::as2tz(self::_getTZFromSyncBlob(base64_decode($message->timezone))); |
| 804 | 888 | } |
| 889 | + } |
|
| 805 | 890 | $event['recur_type'] = $message->recurrence->type == 6 ? calendar_rrule::YEARLY : |
| 806 | 891 | array_search($message->recurrence->type, self::$recur_type2as); |
| 807 | 892 | $event['recur_interval'] = $message->recurrence->interval; |
@@ -838,10 +923,13 @@ discard block |
||
| 838 | 923 | { |
| 839 | 924 | // calculate enddate from occurences count, as we only support enddate |
| 840 | 925 | $count = $message->recurrence->occurrences; |
| 841 | - foreach(calendar_rrule::event2rrule($event, true) as $rtime) // true = timestamps are user time here, because of save! |
|
| 926 | + foreach(calendar_rrule::event2rrule($event, true) as $rtime) |
|
| 927 | + { |
|
| 928 | + // true = timestamps are user time here, because of save! |
|
| 842 | 929 | { |
| 843 | 930 | if (--$count <= 0) break; |
| 844 | 931 | } |
| 932 | + } |
|
| 845 | 933 | $event['recur_enddate'] = $rtime->format('ts'); |
| 846 | 934 | } |
| 847 | 935 | } |
@@ -856,7 +944,9 @@ discard block |
||
| 856 | 944 | break; |
| 857 | 945 | } |
| 858 | 946 | } |
| 859 | - if ($alarm !== true) // new alarm |
|
| 947 | + if ($alarm !== true) |
|
| 948 | + { |
|
| 949 | + // new alarm |
|
| 860 | 950 | { |
| 861 | 951 | // delete all earlier alarms of that user |
| 862 | 952 | // user get's per AS only the earliest alarm, as AS only supports one alarm |
@@ -866,6 +956,7 @@ discard block |
||
| 866 | 956 | if ($alarm['owner'] == $account && $alarm['offset'] > 60*$message->reminder) |
| 867 | 957 | { |
| 868 | 958 | unset($event['alarm'][$key]); |
| 959 | + } |
|
| 869 | 960 | } |
| 870 | 961 | } |
| 871 | 962 | $event['alarm'][] = $alarm = array( |
@@ -946,7 +1037,10 @@ discard block |
||
| 946 | 1037 | { |
| 947 | 1038 | unset($contentParameters); // not used, but required by function signature |
| 948 | 1039 | |
| 949 | - if (!isset($this->caledar)) $this->calendar = new calendar_boupdate(); |
|
| 1040 | + if (!isset($this->caledar)) |
|
| 1041 | + { |
|
| 1042 | + $this->calendar = new calendar_boupdate(); |
|
| 1043 | + } |
|
| 950 | 1044 | |
| 951 | 1045 | $ret = $this->calendar->delete($id); |
| 952 | 1046 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid', $id) delete($id) returned ".array2string($ret)); |
@@ -1008,7 +1102,10 @@ discard block |
||
| 1008 | 1102 | */ |
| 1009 | 1103 | public function GetMessage($folderid, $id, $contentparameters, $class='SyncAppointment') |
| 1010 | 1104 | { |
| 1011 | - if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
|
| 1105 | + if (!isset($this->calendar)) |
|
| 1106 | + { |
|
| 1107 | + $this->calendar = new calendar_boupdate(); |
|
| 1108 | + } |
|
| 1012 | 1109 | //error_log(__METHOD__.__LINE__.array2string($contentparameters).function_backtrace()); |
| 1013 | 1110 | $truncsize = Utils::GetTruncSize($contentparameters->GetTruncation()); |
| 1014 | 1111 | $mimesupport = $contentparameters->GetMimeSupport(); |
@@ -1046,7 +1143,10 @@ discard block |
||
| 1046 | 1143 | catch(Exception $e) { |
| 1047 | 1144 | unset($e); |
| 1048 | 1145 | // z-push (2.3 at least) requires a timezone for recurring events |
| 1049 | - if ($event['recur_type']) $message->timezone = self::UTC_BLOB; |
|
| 1146 | + if ($event['recur_type']) |
|
| 1147 | + { |
|
| 1148 | + $message->timezone = self::UTC_BLOB; |
|
| 1149 | + } |
|
| 1050 | 1150 | } |
| 1051 | 1151 | |
| 1052 | 1152 | // copying timestamps (they are already read in servertime, so non tz conversation) |
@@ -1057,7 +1157,10 @@ discard block |
||
| 1057 | 1157 | 'modified' => 'dtstamp', |
| 1058 | 1158 | ) as $key => $attr) |
| 1059 | 1159 | { |
| 1060 | - if (!empty($event[$key])) $message->$attr = $event[$key]; |
|
| 1160 | + if (!empty($event[$key])) |
|
| 1161 | + { |
|
| 1162 | + $message->$attr = $event[$key]; |
|
| 1163 | + } |
|
| 1061 | 1164 | } |
| 1062 | 1165 | if (($message->alldayevent = (int)calendar_bo::isWholeDay($event))) |
| 1063 | 1166 | { |
@@ -1070,7 +1173,10 @@ discard block |
||
| 1070 | 1173 | 'location' => 'location', |
| 1071 | 1174 | ) as $key => $attr) |
| 1072 | 1175 | { |
| 1073 | - if (!empty($event[$key])) $message->$attr = $event[$key]; |
|
| 1176 | + if (!empty($event[$key])) |
|
| 1177 | + { |
|
| 1178 | + $message->$attr = $event[$key]; |
|
| 1179 | + } |
|
| 1074 | 1180 | } |
| 1075 | 1181 | |
| 1076 | 1182 | // appoint description |
@@ -1103,7 +1209,10 @@ discard block |
||
| 1103 | 1209 | foreach($event['participants'] as $uid => $status) |
| 1104 | 1210 | { |
| 1105 | 1211 | // AS does NOT want calendar owner as participant |
| 1106 | - if ($uid == $account) continue; |
|
| 1212 | + if ($uid == $account) |
|
| 1213 | + { |
|
| 1214 | + continue; |
|
| 1215 | + } |
|
| 1107 | 1216 | $quantity = $role = null; |
| 1108 | 1217 | calendar_so::split_status($status, $quantity, $role); |
| 1109 | 1218 | |
@@ -1120,7 +1229,10 @@ discard block |
||
| 1120 | 1229 | list($info) = $i = $this->calendar->resources[$uid[0]]['info'] ? |
| 1121 | 1230 | ExecMethod($this->calendar->resources[$uid[0]]['info'],substr($uid,1)) : array(false); |
| 1122 | 1231 | |
| 1123 | - if (!$info) continue; |
|
| 1232 | + if (!$info) |
|
| 1233 | + { |
|
| 1234 | + continue; |
|
| 1235 | + } |
|
| 1124 | 1236 | |
| 1125 | 1237 | if (!$info['email'] && $info['responsible']) |
| 1126 | 1238 | { |
@@ -1136,10 +1248,17 @@ discard block |
||
| 1136 | 1248 | $message->organizeremail = $attendee->email; |
| 1137 | 1249 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."($folderid, $id, ...) external organizer detected (role=$role, uid=$uid), set as AS organizer: $message->organizername <$message->organizeremail>"); |
| 1138 | 1250 | } |
| 1139 | - if ($uid[0] == 'r') $attendee->type = 3; // 3 = resource |
|
| 1251 | + if ($uid[0] == 'r') |
|
| 1252 | + { |
|
| 1253 | + $attendee->type = 3; |
|
| 1254 | + } |
|
| 1255 | + // 3 = resource |
|
| 1140 | 1256 | } |
| 1141 | 1257 | // email must NOT be empty, but MAY be an arbitrary text |
| 1142 | - if (empty($attendee->email)) $attendee->email = 'noreply-'.$uid.'[email protected]'; |
|
| 1258 | + if (empty($attendee->email)) |
|
| 1259 | + { |
|
| 1260 | + $attendee->email = 'noreply-'.$uid.'[email protected]'; |
|
| 1261 | + } |
|
| 1143 | 1262 | |
| 1144 | 1263 | $message->attendees[] = $attendee; |
| 1145 | 1264 | } |
@@ -1174,9 +1293,12 @@ discard block |
||
| 1174 | 1293 | $recurrence->monthofyear = (int)$rrule->time->format('m'); // 1..12 |
| 1175 | 1294 | break; |
| 1176 | 1295 | } |
| 1177 | - if ($rrule->enddate) // enddate is only a date, but AS needs a time incl. correct starttime! |
|
| 1296 | + if ($rrule->enddate) |
|
| 1297 | + { |
|
| 1298 | + // enddate is only a date, but AS needs a time incl. correct starttime! |
|
| 1178 | 1299 | { |
| 1179 | 1300 | $enddate = clone $rrule->time; |
| 1301 | + } |
|
| 1180 | 1302 | $enddate->setDate($rrule->enddate->format('Y'), $rrule->enddate->format('m'), |
| 1181 | 1303 | $rrule->enddate->format('d')); |
| 1182 | 1304 | $recurrence->until = $enddate->format('server'); |
@@ -1198,12 +1320,19 @@ discard block |
||
| 1198 | 1320 | { |
| 1199 | 1321 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.__LINE__." Exceptions found but no UID given for Event:".$event['id'].' Exceptions:'.array2string($event['recur_exception'])); |
| 1200 | 1322 | } |
| 1201 | - if (count($ex_events)>=1) ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.__LINE__." found ".count($ex_events)." exeptions for event with UID/ID:".$event['uid'].'/'.$event['id']); |
|
| 1323 | + if (count($ex_events)>=1) |
|
| 1324 | + { |
|
| 1325 | + ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.__LINE__." found ".count($ex_events)." exeptions for event with UID/ID:".$event['uid'].'/'.$event['id']); |
|
| 1326 | + } |
|
| 1202 | 1327 | |
| 1203 | 1328 | $message->exceptions = array(); |
| 1204 | 1329 | foreach($ex_events as $ex_event) |
| 1205 | 1330 | { |
| 1206 | - if ($ex_event['id'] == $event['id']) continue; // ignore series master |
|
| 1331 | + if ($ex_event['id'] == $event['id']) |
|
| 1332 | + { |
|
| 1333 | + continue; |
|
| 1334 | + } |
|
| 1335 | + // ignore series master |
|
| 1207 | 1336 | $exception = $this->GetMessage($folderid, $ex_event, $contentparameters, 'SyncAppointmentException'); |
| 1208 | 1337 | $exception->exceptionstarttime = $exception_time = $ex_event['recurrence']; |
| 1209 | 1338 | foreach(array('attendees','recurrence','uid','timezone','organizername','organizeremail') as $not_supported) |
@@ -1223,7 +1352,10 @@ discard block |
||
| 1223 | 1352 | { |
| 1224 | 1353 | if (!empty($exception_time)) |
| 1225 | 1354 | { |
| 1226 | - if (empty($event['uid'])) ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.__LINE__." BEWARE no UID given for this event:".$event['id'].' but exception is set for '.$exception_time); |
|
| 1355 | + if (empty($event['uid'])) |
|
| 1356 | + { |
|
| 1357 | + ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.__LINE__." BEWARE no UID given for this event:".$event['id'].' but exception is set for '.$exception_time); |
|
| 1358 | + } |
|
| 1227 | 1359 | $exception = new SyncAppointmentException(); // exceptions seems to be full SyncAppointments, with only starttime required |
| 1228 | 1360 | $exception->deleted = 1; |
| 1229 | 1361 | $exception->exceptionstarttime = $exception_time; |
@@ -1279,12 +1411,18 @@ discard block |
||
| 1279 | 1411 | { |
| 1280 | 1412 | unset($folderid); // not used ($id is unique), but required by function signature |
| 1281 | 1413 | |
| 1282 | - if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
|
| 1414 | + if (!isset($this->calendar)) |
|
| 1415 | + { |
|
| 1416 | + $this->calendar = new calendar_boupdate(); |
|
| 1417 | + } |
|
| 1283 | 1418 | |
| 1284 | 1419 | $nul = null; |
| 1285 | - if (!($etag = $this->calendar->get_etag($id, $nul, true, true))) // last true: $only_master=true |
|
| 1420 | + if (!($etag = $this->calendar->get_etag($id, $nul, true, true))) |
|
| 1421 | + { |
|
| 1422 | + // last true: $only_master=true |
|
| 1286 | 1423 | { |
| 1287 | 1424 | $stat = false; |
| 1425 | + } |
|
| 1288 | 1426 | // error_log why access is denied (should never happen for everything returned by calendar_bo::search) |
| 1289 | 1427 | $backup = $this->calendar->debug; |
| 1290 | 1428 | //$this->calendar->debug = 2; |
@@ -1318,13 +1456,22 @@ discard block |
||
| 1318 | 1456 | $type = $owner = null; |
| 1319 | 1457 | $this->backend->splitID($folderid, $type, $owner); |
| 1320 | 1458 | |
| 1321 | - if ($type != 'calendar') return false; |
|
| 1459 | + if ($type != 'calendar') |
|
| 1460 | + { |
|
| 1461 | + return false; |
|
| 1462 | + } |
|
| 1322 | 1463 | |
| 1323 | - if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
|
| 1464 | + if (!isset($this->calendar)) |
|
| 1465 | + { |
|
| 1466 | + $this->calendar = new calendar_boupdate(); |
|
| 1467 | + } |
|
| 1324 | 1468 | //$ctag = $this->calendar->get_ctag($owner,'owner',true); // true only consider recurrence master |
| 1325 | 1469 | $syncstate = $this->calendar->get_ctag($owner,false,true); // we only want to fetch the owners events, where he is a participant too |
| 1326 | 1470 | // workaround for syncstate = 0 when calendar is empty causes synctate to not return 0 but array resulting in foldersync loop |
| 1327 | - if ($syncstate == 0) $syncstate = 1; |
|
| 1471 | + if ($syncstate == 0) |
|
| 1472 | + { |
|
| 1473 | + $syncstate = 1; |
|
| 1474 | + } |
|
| 1328 | 1475 | |
| 1329 | 1476 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid', ...) type='$type', owner=$owner --> syncstate='$syncstate'"); |
| 1330 | 1477 | } |
@@ -1400,10 +1547,16 @@ discard block |
||
| 1400 | 1547 | 'dstendhour' => 0, 'dstendminute' => 0, 'dstendsecond' => 0, 'dstendmillis' => 0, |
| 1401 | 1548 | ); |
| 1402 | 1549 | |
| 1403 | - if ($tz === 'UTC') return $data; |
|
| 1550 | + if ($tz === 'UTC') |
|
| 1551 | + { |
|
| 1552 | + return $data; |
|
| 1553 | + } |
|
| 1404 | 1554 | |
| 1405 | 1555 | $name = $component = is_a($tz,'DateTimeZone') ? $tz->getName() : $tz; |
| 1406 | - if (strpos($component, 'VTIMEZONE') === false) $component = calendar_timezones::tz2id($name,'component'); |
|
| 1556 | + if (strpos($component, 'VTIMEZONE') === false) |
|
| 1557 | + { |
|
| 1558 | + $component = calendar_timezones::tz2id($name,'component'); |
|
| 1559 | + } |
|
| 1407 | 1560 | // parse ical timezone defintion |
| 1408 | 1561 | $ical = self::ical2array($component); |
| 1409 | 1562 | $standard = $ical['VTIMEZONE']['STANDARD']; |
@@ -1446,11 +1599,17 @@ discard block |
||
| 1446 | 1599 | $data[$prefix.'week'] = 5; |
| 1447 | 1600 | } |
| 1448 | 1601 | // if both start and end use 1SU use week=5 and decrement month |
| 1449 | - if ($prefix == 'dststart') $start_byday = $matches[1]; |
|
| 1602 | + if ($prefix == 'dststart') |
|
| 1603 | + { |
|
| 1604 | + $start_byday = $matches[1]; |
|
| 1605 | + } |
|
| 1450 | 1606 | if ($prefix == 'dstend' && $matches[1] == '1SU' && $start_byday == '1SU') |
| 1451 | 1607 | { |
| 1452 | 1608 | $data[$prefix.'week'] = 5; |
| 1453 | - if ($prefix == 'dstend') $data[$prefix.'month'] -= 1; |
|
| 1609 | + if ($prefix == 'dstend') |
|
| 1610 | + { |
|
| 1611 | + $data[$prefix.'month'] -= 1; |
|
| 1612 | + } |
|
| 1454 | 1613 | } |
| 1455 | 1614 | static $day2int = array('SU'=>0,'MO'=>1,'TU'=>2,'WE'=>3,'TH'=>4,'FR'=>5,'SA'=>6); |
| 1456 | 1615 | $data[$prefix.'day'] = (int)$day2int[substr($matches[1],-2)]; |
@@ -1526,7 +1685,10 @@ discard block |
||
| 1526 | 1685 | static public function ical2array(&$ical,$section=null) |
| 1527 | 1686 | { |
| 1528 | 1687 | $arr = array(); |
| 1529 | - if (!is_array($ical)) $ical = preg_split("/[\r\n]+/m", $ical); |
|
| 1688 | + if (!is_array($ical)) |
|
| 1689 | + { |
|
| 1690 | + $ical = preg_split("/[\r\n]+/m", $ical); |
|
| 1691 | + } |
|
| 1530 | 1692 | while (($line = array_shift($ical))) |
| 1531 | 1693 | { |
| 1532 | 1694 | list($name,$value) = explode(':',$line,2); |
@@ -1536,7 +1698,10 @@ discard block |
||
| 1536 | 1698 | } |
| 1537 | 1699 | elseif($name == 'END') |
| 1538 | 1700 | { |
| 1539 | - if ($section && $section==$value) return $arr; |
|
| 1701 | + if ($section && $section==$value) |
|
| 1702 | + { |
|
| 1703 | + return $arr; |
|
| 1704 | + } |
|
| 1540 | 1705 | break; |
| 1541 | 1706 | } |
| 1542 | 1707 | else |
@@ -1567,13 +1732,19 @@ discard block |
||
| 1567 | 1732 | |
| 1568 | 1733 | for($n = 0; !isset($cache[$key]); ++$n) |
| 1569 | 1734 | { |
| 1570 | - if (!$n) // check users timezone first |
|
| 1735 | + if (!$n) |
|
| 1736 | + { |
|
| 1737 | + // check users timezone first |
|
| 1571 | 1738 | { |
| 1572 | 1739 | $tz = Api\DateTime::$user_timezone->getName(); |
| 1573 | 1740 | } |
| 1574 | - elseif (!($tz = calendar_timezones::id2tz($n))) // no further timezones to check |
|
| 1741 | + } |
|
| 1742 | + elseif (!($tz = calendar_timezones::id2tz($n))) |
|
| 1743 | + { |
|
| 1744 | + // no further timezones to check |
|
| 1575 | 1745 | { |
| 1576 | 1746 | $cache[$key] = 'UTC'; |
| 1747 | + } |
|
| 1577 | 1748 | error_log(__METHOD__.'('.array2string($data).') NO matching timezone found --> using UTC now!'); |
| 1578 | 1749 | break; |
| 1579 | 1750 | } |
@@ -1637,7 +1808,11 @@ discard block |
||
| 1637 | 1808 | $account_id = $entry['grantor']; |
| 1638 | 1809 | $cals[$account_id] = $entry['name']; |
| 1639 | 1810 | } |
| 1640 | - if ($hook_data['account_id'] > 0) unset($cals[$hook_data['account_id']]); // skip current user |
|
| 1811 | + if ($hook_data['account_id'] > 0) |
|
| 1812 | + { |
|
| 1813 | + unset($cals[$hook_data['account_id']]); |
|
| 1814 | + } |
|
| 1815 | + // skip current user |
|
| 1641 | 1816 | } |
| 1642 | 1817 | $cals['G'] = lang('Primary group'); |
| 1643 | 1818 | $cals['A'] = lang('All'); |
@@ -1665,13 +1840,16 @@ discard block |
||
| 1665 | 1840 | * |
| 1666 | 1841 | * You need to comment implements activesync_plugin_write |
| 1667 | 1842 | */ |
| 1668 | -if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) // some tests |
|
| 1843 | +if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) |
|
| 1844 | +{ |
|
| 1845 | + // some tests |
|
| 1669 | 1846 | { |
| 1670 | 1847 | $GLOBALS['egw_info'] = array( |
| 1671 | 1848 | 'flags' => array( |
| 1672 | 1849 | 'currentapp' => 'login' |
| 1673 | 1850 | ) |
| 1674 | 1851 | ); |
| 1852 | +} |
|
| 1675 | 1853 | require_once('../../header.inc.php'); |
| 1676 | 1854 | ini_set('display_errors',1); |
| 1677 | 1855 | error_reporting(E_ALL & ~E_NOTICE); |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @param int $truncsize |
| 283 | 283 | * @param int $bodypreference |
| 284 | 284 | * @param $optionbodypreference |
| 285 | - * @param bool $mimesupport |
|
| 285 | + * @param integer $mimesupport |
|
| 286 | 286 | * @return SyncMail |
| 287 | 287 | */ |
| 288 | 288 | function GetMeetingRequest($id, $truncsize, $bodypreference=false, $optionbodypreference=false, $mimesupport = 0) |
@@ -900,7 +900,7 @@ discard block |
||
| 900 | 900 | * @param string $id of the folder to delete |
| 901 | 901 | * |
| 902 | 902 | * @return |
| 903 | - * @TODO check what is to be returned |
|
| 903 | + boolean @TODO check what is to be returned |
|
| 904 | 904 | */ |
| 905 | 905 | public function DeleteFolder($parentid, $id) |
| 906 | 906 | { |
@@ -1596,6 +1596,7 @@ discard block |
||
| 1596 | 1596 | * Unpack timezone info from Sync |
| 1597 | 1597 | * |
| 1598 | 1598 | * copied from backend/ics.php |
| 1599 | + * @param string $data |
|
| 1599 | 1600 | */ |
| 1600 | 1601 | static public function _getTZFromSyncBlob($data) |
| 1601 | 1602 | { |
@@ -84,19 +84,19 @@ discard block |
||
| 84 | 84 | if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
| 85 | 85 | |
| 86 | 86 | $cals_pref = $GLOBALS['egw_info']['user']['preferences']['activesync']['calendar-cals']; |
| 87 | - $cals = $cals_pref ? explode(',',$cals_pref) : array('P'); // implicit default of 'P' |
|
| 87 | + $cals = $cals_pref ? explode(',', $cals_pref) : array('P'); // implicit default of 'P' |
|
| 88 | 88 | $folderlist = array(); |
| 89 | 89 | |
| 90 | 90 | foreach ($this->calendar->list_cals() as $entry) |
| 91 | 91 | { |
| 92 | 92 | $account_id = $entry['grantor']; |
| 93 | - if (in_array('A',$cals) || in_array($account_id,$cals) || |
|
| 94 | - $account_id == $GLOBALS['egw_info']['user']['account_id'] || // always incl. own calendar! |
|
| 95 | - $account_id == $GLOBALS['egw_info']['user']['account_primary_group'] && in_array('G',$cals)) |
|
| 93 | + if (in_array('A', $cals) || in_array($account_id, $cals) || |
|
| 94 | + $account_id == $GLOBALS['egw_info']['user']['account_id'] || // always incl. own calendar! |
|
| 95 | + $account_id == $GLOBALS['egw_info']['user']['account_primary_group'] && in_array('G', $cals)) |
|
| 96 | 96 | { |
| 97 | 97 | $folderlist[] = $f = array( |
| 98 | - 'id' => $this->backend->createID('calendar',$account_id), |
|
| 99 | - 'mod' => $GLOBALS['egw']->accounts->id2name($account_id,'account_fullname'), |
|
| 98 | + 'id' => $this->backend->createID('calendar', $account_id), |
|
| 99 | + 'mod' => $GLOBALS['egw']->accounts->id2name($account_id, 'account_fullname'), |
|
| 100 | 100 | 'parent'=> '0', |
| 101 | 101 | ); |
| 102 | 102 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $folderObj = new SyncFolder(); |
| 121 | 121 | $folderObj->serverid = $id; |
| 122 | 122 | $folderObj->parentid = '0'; |
| 123 | - $folderObj->displayname = $GLOBALS['egw']->accounts->id2name($owner,'account_fullname'); |
|
| 123 | + $folderObj->displayname = $GLOBALS['egw']->accounts->id2name($owner, 'account_fullname'); |
|
| 124 | 124 | if ($owner == $GLOBALS['egw_info']['user']['account_id']) |
| 125 | 125 | { |
| 126 | 126 | $folderObj->type = SYNC_FOLDER_TYPE_APPOINTMENT; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | $stat = array( |
| 156 | 156 | 'id' => $id, |
| 157 | - 'mod' => $GLOBALS['egw']->accounts->id2name($owner,'account_fullname'), |
|
| 157 | + 'mod' => $GLOBALS['egw']->accounts->id2name($owner, 'account_fullname'), |
|
| 158 | 158 | 'parent' => '0', |
| 159 | 159 | ); |
| 160 | 160 | //error_log(__METHOD__."('$id') folderObj=".array2string($stat)); |
@@ -178,19 +178,19 @@ discard block |
||
| 178 | 178 | * @param array $not_uids =null uids NOT to return for meeting requests |
| 179 | 179 | * @return array |
| 180 | 180 | */ |
| 181 | - function GetMessageList($id, $cutoffdate=NULL, array $not_uids=null) |
|
| 181 | + function GetMessageList($id, $cutoffdate = NULL, array $not_uids = null) |
|
| 182 | 182 | { |
| 183 | 183 | if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
| 184 | 184 | |
| 185 | 185 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$id',$cutoffdate)"); |
| 186 | 186 | $type = $user = null; |
| 187 | - $this->backend->splitID($id,$type,$user); |
|
| 187 | + $this->backend->splitID($id, $type, $user); |
|
| 188 | 188 | |
| 189 | - if (!$cutoffdate) $cutoffdate = $this->bo->now - 100*24*3600; // default three month back -30 breaks all sync recurrences |
|
| 189 | + if (!$cutoffdate) $cutoffdate = $this->bo->now - 100 * 24 * 3600; // default three month back -30 breaks all sync recurrences |
|
| 190 | 190 | |
| 191 | 191 | $filter = array( |
| 192 | 192 | 'users' => $user, |
| 193 | - 'start' => $cutoffdate, // default one month back -30 breaks all sync recurrences |
|
| 193 | + 'start' => $cutoffdate, // default one month back -30 breaks all sync recurrences |
|
| 194 | 194 | 'enum_recuring' => false, |
| 195 | 195 | 'daywise' => false, |
| 196 | 196 | 'date_format' => 'server', |
@@ -199,13 +199,13 @@ discard block |
||
| 199 | 199 | 'filter' => $user == $GLOBALS['egw_info']['user']['account_id'] ? (is_array($not_uids) ? 'unknown' : 'default') : 'default', |
| 200 | 200 | // @todo return only etag relevant information (seems not to work ...) |
| 201 | 201 | //'cols' => array('egw_cal.cal_id', 'cal_start', 'recur_type', 'cal_modified', 'cal_uid', 'cal_etag'), |
| 202 | - 'query' => array('cal_recurrence' => 0), // do NOT return recurrence exceptions |
|
| 202 | + 'query' => array('cal_recurrence' => 0), // do NOT return recurrence exceptions |
|
| 203 | 203 | ); |
| 204 | 204 | |
| 205 | 205 | $messagelist = array(); |
| 206 | 206 | // reading events in chunks of 100, to keep memory down for huge calendars |
| 207 | 207 | $num_rows = 100; |
| 208 | - for($start=0; ($events = $this->calendar->search($filter+array( |
|
| 208 | + for ($start = 0; ($events = $this->calendar->search($filter + array( |
|
| 209 | 209 | 'offset' => $start, |
| 210 | 210 | 'num_rows' => $num_rows, |
| 211 | 211 | ))); $start += $num_rows) |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | * @param int $cutoffdate =null |
| 241 | 241 | * @return array |
| 242 | 242 | */ |
| 243 | - function GetMeetingRequests(array $not_uids, $cutoffdate=NULL) |
|
| 243 | + function GetMeetingRequests(array $not_uids, $cutoffdate = NULL) |
|
| 244 | 244 | { |
| 245 | 245 | unset($not_uids, $cutoffdate); |
| 246 | 246 | return array(); |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | function StatMeetingRequest($id) |
| 268 | 268 | { |
| 269 | - $folderid = $this->backend->createID('calendar', $GLOBALS['egw_info']['user']['account_id']); // users personal calendar |
|
| 269 | + $folderid = $this->backend->createID('calendar', $GLOBALS['egw_info']['user']['account_id']); // users personal calendar |
|
| 270 | 270 | |
| 271 | 271 | $ret = $this->StatMessage($folderid, abs($id)); |
| 272 | 272 | $ret['id'] = $id; |
@@ -285,9 +285,9 @@ discard block |
||
| 285 | 285 | * @param bool $mimesupport |
| 286 | 286 | * @return SyncMail |
| 287 | 287 | */ |
| 288 | - function GetMeetingRequest($id, $truncsize, $bodypreference=false, $optionbodypreference=false, $mimesupport = 0) |
|
| 288 | + function GetMeetingRequest($id, $truncsize, $bodypreference = false, $optionbodypreference = false, $mimesupport = 0) |
|
| 289 | 289 | { |
| 290 | - unset($truncsize, $optionbodypreference, $mimesupport); // not used, but required by function signature |
|
| 290 | + unset($truncsize, $optionbodypreference, $mimesupport); // not used, but required by function signature |
|
| 291 | 291 | |
| 292 | 292 | if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
| 293 | 293 | |
@@ -300,13 +300,13 @@ discard block |
||
| 300 | 300 | $message = new SyncMail(); |
| 301 | 301 | $message->read = false; |
| 302 | 302 | $message->subject = $event['title']; |
| 303 | - $message->importance = 1; // 0=Low, 1=Normal, 2=High |
|
| 303 | + $message->importance = 1; // 0=Low, 1=Normal, 2=High |
|
| 304 | 304 | $message->datereceived = $event['created']; |
| 305 | 305 | $message->to = $message->displayto = $GLOBALS['egw_info']['user']['account_email']; |
| 306 | - $message->from = $GLOBALS['egw']->accounts->id2name($event['owner'],'account_fullname'). |
|
| 307 | - ' <'.$GLOBALS['egw']->accounts->id2name($event['owner'],'account_email').'>'; |
|
| 306 | + $message->from = $GLOBALS['egw']->accounts->id2name($event['owner'], 'account_fullname'). |
|
| 307 | + ' <'.$GLOBALS['egw']->accounts->id2name($event['owner'], 'account_email').'>'; |
|
| 308 | 308 | $message->internetcpid = 65001; |
| 309 | - $message->contentclass="urn:content-classes:message"; |
|
| 309 | + $message->contentclass = "urn:content-classes:message"; |
|
| 310 | 310 | |
| 311 | 311 | $message->meetingrequest = self::meetingRequest($event); |
| 312 | 312 | $message->messageclass = "IPM.Schedule.Meeting.Request"; |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | else |
| 322 | 322 | { |
| 323 | 323 | $message->airsyncbasebody = new SyncAirSyncBaseBody(); |
| 324 | - $message->airsyncbasenativebodytype=1; |
|
| 324 | + $message->airsyncbasenativebodytype = 1; |
|
| 325 | 325 | $this->backend->note2messagenote($event['description'], $bodypreference, $message->airsyncbasebody); |
| 326 | 326 | } |
| 327 | 327 | } |
@@ -356,12 +356,12 @@ discard block |
||
| 356 | 356 | $as_tz = self::tz2as($event['tzid']); |
| 357 | 357 | $message->timezone = base64_encode(self::_getSyncBlobFromTZ($as_tz)); |
| 358 | 358 | } |
| 359 | - catch(Exception $e) { |
|
| 359 | + catch (Exception $e) { |
|
| 360 | 360 | unset($e); |
| 361 | 361 | // ignore exception, simply set no timezone, as it is optional |
| 362 | 362 | } |
| 363 | 363 | // copying timestamps (they are already read in servertime, so non tz conversation) |
| 364 | - foreach(array( |
|
| 364 | + foreach (array( |
|
| 365 | 365 | 'start' => 'starttime', |
| 366 | 366 | 'end' => 'endtime', |
| 367 | 367 | 'created' => 'dtstamp', |
@@ -371,10 +371,10 @@ discard block |
||
| 371 | 371 | } |
| 372 | 372 | if (($message->alldayevent = (int)calendar_bo::isWholeDay($event))) |
| 373 | 373 | { |
| 374 | - ++$message->endtime; // EGw all-day-events are 1 sec shorter! |
|
| 374 | + ++$message->endtime; // EGw all-day-events are 1 sec shorter! |
|
| 375 | 375 | } |
| 376 | 376 | // copying strings |
| 377 | - foreach(array( |
|
| 377 | + foreach (array( |
|
| 378 | 378 | 'title' => 'subject', |
| 379 | 379 | 'location' => 'location', |
| 380 | 380 | ) as $key => $attr) |
@@ -383,16 +383,16 @@ discard block |
||
| 383 | 383 | } |
| 384 | 384 | $message->organizer = $event['organizer']; |
| 385 | 385 | |
| 386 | - $message->sensitivity = $event['public'] ? 0 : 2; // 0=normal, 1=personal, 2=private, 3=confidential |
|
| 386 | + $message->sensitivity = $event['public'] ? 0 : 2; // 0=normal, 1=personal, 2=private, 3=confidential |
|
| 387 | 387 | |
| 388 | 388 | // busystatus=(0=free|1=tentative|2=busy|3=out-of-office), EGw has non_blocking=0|1 |
| 389 | 389 | $message->busystatus = $event['non_blocking'] ? 0 : 2; |
| 390 | 390 | |
| 391 | 391 | // ToDo: recurring events: InstanceType, RecurrenceId, Recurrences; ... |
| 392 | - $message->instancetype = 0; // 0=Single, 1=Master recurring, 2=Single recuring, 3=Exception |
|
| 392 | + $message->instancetype = 0; // 0=Single, 1=Master recurring, 2=Single recuring, 3=Exception |
|
| 393 | 393 | |
| 394 | - $message->responserequested = 1; //0=No, 1=Yes |
|
| 395 | - $message->disallownewtimeproposal = 1; //1=forbidden, 0=allowed |
|
| 394 | + $message->responserequested = 1; //0=No, 1=Yes |
|
| 395 | + $message->disallownewtimeproposal = 1; //1=forbidden, 0=allowed |
|
| 396 | 396 | //$message->messagemeetingtype; // email2 |
| 397 | 397 | |
| 398 | 398 | // ToDo: alarme: Reminder |
@@ -438,14 +438,14 @@ discard block |
||
| 438 | 438 | // check if event already exist (invitation of or already imported by other user) |
| 439 | 439 | if (!($event = $this->calendar->read($parsed_event['uid'], 0, false, 'server'))) |
| 440 | 440 | { |
| 441 | - $event = $parsed_event; // create new event from external invitation |
|
| 441 | + $event = $parsed_event; // create new event from external invitation |
|
| 442 | 442 | } |
| 443 | - elseif(!isset($event['participants'][$uid])) |
|
| 443 | + elseif (!isset($event['participants'][$uid])) |
|
| 444 | 444 | { |
| 445 | 445 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.'('.array2string($requestid).", $folderid, $response) current user ($uid) is NO participant of event ".array2string($event)); |
| 446 | 446 | // maybe we should silently add him, as he might not have the rights to add him himself with calendar->update ... |
| 447 | 447 | } |
| 448 | - elseif($event['deleted']) |
|
| 448 | + elseif ($event['deleted']) |
|
| 449 | 449 | { |
| 450 | 450 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.'('.array2string($requestid).", $folderid, $response) event ($uid) deleted on server --> return false"); |
| 451 | 451 | return false; |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | else |
| 469 | 469 | { |
| 470 | 470 | $event['participants'][$uid] = $status; |
| 471 | - $ret = $this->calendar->update($event, true); // true = ignore conflicts, as there seems no conflict handling in AS |
|
| 471 | + $ret = $this->calendar->update($event, true); // true = ignore conflicts, as there seems no conflict handling in AS |
|
| 472 | 472 | } |
| 473 | 473 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.'('.array2string($requestid).", '$folderid', $response) returning ".array2string($ret)); |
| 474 | 474 | return $ret; |
@@ -480,10 +480,10 @@ discard block |
||
| 480 | 480 | * @var array |
| 481 | 481 | */ |
| 482 | 482 | static $status2as = array( |
| 483 | - 'U' => 0, // unknown |
|
| 484 | - 'T' => 2, // tentative |
|
| 485 | - 'A' => 3, // accepted |
|
| 486 | - 'R' => 4, // decline |
|
| 483 | + 'U' => 0, // unknown |
|
| 484 | + 'T' => 2, // tentative |
|
| 485 | + 'A' => 3, // accepted |
|
| 486 | + 'R' => 4, // decline |
|
| 487 | 487 | // 5 = not responded |
| 488 | 488 | ); |
| 489 | 489 | /** |
@@ -492,9 +492,9 @@ discard block |
||
| 492 | 492 | * @var array |
| 493 | 493 | */ |
| 494 | 494 | static $role2as = array( |
| 495 | - 'REQ-PARTICIPANT' => 1, // required |
|
| 496 | - 'CHAIR' => 1, // required |
|
| 497 | - 'OPT-PARTICIPANT' => 2, // optional |
|
| 495 | + 'REQ-PARTICIPANT' => 1, // required |
|
| 496 | + 'CHAIR' => 1, // required |
|
| 497 | + 'OPT-PARTICIPANT' => 2, // optional |
|
| 498 | 498 | 'NON-PARTICIPANT' => 2, |
| 499 | 499 | // 3 = ressource |
| 500 | 500 | ); |
@@ -506,8 +506,8 @@ discard block |
||
| 506 | 506 | static $recur_type2as = array( |
| 507 | 507 | calendar_rrule::DAILY => 0, |
| 508 | 508 | calendar_rrule::WEEKLY => 1, |
| 509 | - calendar_rrule::MONTHLY_MDAY => 2, // monthly |
|
| 510 | - calendar_rrule::MONTHLY_WDAY => 3, // monthly on nth day |
|
| 509 | + calendar_rrule::MONTHLY_MDAY => 2, // monthly |
|
| 510 | + calendar_rrule::MONTHLY_WDAY => 3, // monthly on nth day |
|
| 511 | 511 | calendar_rrule::YEARLY => 5, |
| 512 | 512 | // 6 = yearly on nth day (same as 5 on non-leapyears or before March on leapyears) |
| 513 | 513 | ); |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | */ |
| 535 | 535 | public function ChangeMessage($folderid, $_id, $message, $contentParameters) |
| 536 | 536 | { |
| 537 | - unset($contentParameters); // unused, but required by function signature |
|
| 537 | + unset($contentParameters); // unused, but required by function signature |
|
| 538 | 538 | |
| 539 | 539 | if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
| 540 | 540 | |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | |
| 545 | 545 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid', $_id, ".array2string($message).") type='$type', account=$account"); |
| 546 | 546 | |
| 547 | - list($id,$recur_date) = explode(':', $_id); |
|
| 547 | + list($id, $recur_date) = explode(':', $_id); |
|
| 548 | 548 | |
| 549 | 549 | if ($type != 'calendar' || $id && !($old_event = $this->calendar->read($id, $recur_date, false, 'server'))) |
| 550 | 550 | { |
@@ -557,21 +557,21 @@ discard block |
||
| 557 | 557 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid',$id:$recur_date,".array2string($message).") handling of virtual exception not yet implemented!"); |
| 558 | 558 | //error_log(__METHOD__."('$folderid',$id:$recur_date,".array2string($message).") handling of virtual exception not yet implemented!"); |
| 559 | 559 | } |
| 560 | - if (!$this->calendar->check_perms($id ? Acl::EDIT : Acl::ADD, $old_event ? $old_event : 0,$account)) |
|
| 560 | + if (!$this->calendar->check_perms($id ? Acl::EDIT : Acl::ADD, $old_event ? $old_event : 0, $account)) |
|
| 561 | 561 | { |
| 562 | 562 | // @todo: write in users calendar and make account only a participant |
| 563 | 563 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid',$id,...) no rights to add/edit event!"); |
| 564 | 564 | //error_log(__METHOD__."('$folderid',$id,".array2string($message).") no rights to add/edit event!"); |
| 565 | 565 | return false; |
| 566 | 566 | } |
| 567 | - if (!$id) $old_event['owner'] = $account; // we do NOT allow to change the owner of existing events |
|
| 567 | + if (!$id) $old_event['owner'] = $account; // we do NOT allow to change the owner of existing events |
|
| 568 | 568 | |
| 569 | 569 | $event = $this->message2event($message, $account, $old_event); |
| 570 | 570 | |
| 571 | 571 | // store event, ignore conflicts and skip notifications, as AS clients do their own notifications |
| 572 | 572 | $skip_notification = false; |
| 573 | 573 | if (isset($GLOBALS['egw_info']['user']['preferences']['activesync']['mail-allowSendingInvitations']) && |
| 574 | - $GLOBALS['egw_info']['user']['preferences']['activesync']['mail-allowSendingInvitations']=='send') |
|
| 574 | + $GLOBALS['egw_info']['user']['preferences']['activesync']['mail-allowSendingInvitations'] == 'send') |
|
| 575 | 575 | { |
| 576 | 576 | $skip_notification = true; // to avoid double notification from client AND Server |
| 577 | 577 | } |
@@ -584,16 +584,16 @@ discard block |
||
| 584 | 584 | // store non-delete exceptions |
| 585 | 585 | if ($message->exceptions) |
| 586 | 586 | { |
| 587 | - foreach($message->exceptions as $exception) |
|
| 587 | + foreach ($message->exceptions as $exception) |
|
| 588 | 588 | { |
| 589 | 589 | if (!$exception->deleted) |
| 590 | 590 | { |
| 591 | 591 | $ex_event = $event; |
| 592 | 592 | unset($ex_event['id']); |
| 593 | 593 | unset($ex_event['etag']); |
| 594 | - foreach(array_keys($ex_event) as $name) |
|
| 594 | + foreach (array_keys($ex_event) as $name) |
|
| 595 | 595 | { |
| 596 | - if (substr($name,0,6) == 'recur_') unset($ex_event[$name]); |
|
| 596 | + if (substr($name, 0, 6) == 'recur_') unset($ex_event[$name]); |
|
| 597 | 597 | } |
| 598 | 598 | $ex_event['recur_type'] = calendar_rrule::NONE; |
| 599 | 599 | |
@@ -601,10 +601,10 @@ discard block |
||
| 601 | 601 | 'user' => $account, |
| 602 | 602 | 'enum_recuring' => false, |
| 603 | 603 | 'daywise' => false, |
| 604 | - 'filter' => 'owner', // return all possible entries |
|
| 604 | + 'filter' => 'owner', // return all possible entries |
|
| 605 | 605 | 'query' => array( |
| 606 | 606 | 'cal_uid' => $event['uid'], |
| 607 | - 'cal_recurrence' => $exception->exceptionstarttime, // in servertime |
|
| 607 | + 'cal_recurrence' => $exception->exceptionstarttime, // in servertime |
|
| 608 | 608 | ), |
| 609 | 609 | )))) |
| 610 | 610 | { |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | $participants = $event['participants']; |
| 617 | 617 | } |
| 618 | 618 | $save_event = $this->message2event($exception, $account, $ex_event); |
| 619 | - $save_event['participants'] = $participants; // not contained in $exception |
|
| 619 | + $save_event['participants'] = $participants; // not contained in $exception |
|
| 620 | 620 | $save_event['reference'] = $event['id']; |
| 621 | 621 | $save_event['recurrence'] = Api\DateTime::server2user($exception->exceptionstarttime); |
| 622 | 622 | $ex_ok = $this->calendar->save($save_event); |
@@ -638,10 +638,10 @@ discard block |
||
| 638 | 638 | * @param array $event =array() |
| 639 | 639 | * @return array |
| 640 | 640 | */ |
| 641 | - private function message2event(SyncAppointment $message, $account, $event=array()) |
|
| 641 | + private function message2event(SyncAppointment $message, $account, $event = array()) |
|
| 642 | 642 | { |
| 643 | 643 | // timestamps (created & modified are updated automatically) |
| 644 | - foreach(array( |
|
| 644 | + foreach (array( |
|
| 645 | 645 | 'start' => 'starttime', |
| 646 | 646 | 'end' => 'endtime', |
| 647 | 647 | ) as $key => $attr) |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | if (isset($message->$attr)) $event[$key] = Api\DateTime::server2user($message->$attr); |
| 650 | 650 | } |
| 651 | 651 | // copying strings |
| 652 | - foreach(array( |
|
| 652 | + foreach (array( |
|
| 653 | 653 | 'title' => 'subject', |
| 654 | 654 | 'uid' => 'uid', |
| 655 | 655 | 'location' => 'location', |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | { |
| 665 | 665 | $event['description'] = $description; |
| 666 | 666 | } |
| 667 | - $event['public'] = (int)($message->sensitivity < 1); // 0=normal, 1=personal, 2=private, 3=confidential |
|
| 667 | + $event['public'] = (int)($message->sensitivity < 1); // 0=normal, 1=personal, 2=private, 3=confidential |
|
| 668 | 668 | |
| 669 | 669 | // busystatus=(0=free|1=tentative|2=busy|3=out-of-office), EGw has non_blocking=0|1 |
| 670 | 670 | if (isset($message->busystatus)) |
@@ -674,21 +674,21 @@ discard block |
||
| 674 | 674 | |
| 675 | 675 | if (($event['whole_day'] = $message->alldayevent)) |
| 676 | 676 | { |
| 677 | - if ($event['end'] == $event['start']) $event['end'] += 24*3600; // some clients send equal start&end for 1day |
|
| 678 | - $event['end']--; // otherwise our whole-day event code in save makes it one more day! |
|
| 677 | + if ($event['end'] == $event['start']) $event['end'] += 24 * 3600; // some clients send equal start&end for 1day |
|
| 678 | + $event['end']--; // otherwise our whole-day event code in save makes it one more day! |
|
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | $participants = array(); |
| 682 | - foreach((array)$message->attendees as $attendee) |
|
| 682 | + foreach ((array)$message->attendees as $attendee) |
|
| 683 | 683 | { |
| 684 | - if ($attendee->type == 3) continue; // we can not identify resources and re-add them anyway later |
|
| 684 | + if ($attendee->type == 3) continue; // we can not identify resources and re-add them anyway later |
|
| 685 | 685 | |
| 686 | 686 | $matches = null; |
| 687 | - if (preg_match('/^noreply-(.*)[email protected]$/',$attendee->email,$matches)) |
|
| 687 | + if (preg_match('/^noreply-(.*)[email protected]$/', $attendee->email, $matches)) |
|
| 688 | 688 | { |
| 689 | 689 | $uid = $matches[1]; |
| 690 | 690 | } |
| 691 | - elseif (!($uid = $GLOBALS['egw']->accounts->name2id($attendee->email,'account_email'))) |
|
| 691 | + elseif (!($uid = $GLOBALS['egw']->accounts->name2id($attendee->email, 'account_email'))) |
|
| 692 | 692 | { |
| 693 | 693 | $search = array( |
| 694 | 694 | 'email' => $attendee->email, |
@@ -698,13 +698,13 @@ discard block |
||
| 698 | 698 | // search addressbook for participant |
| 699 | 699 | if (!isset($this->addressbook)) $this->addressbook = new Api\Contacts(); |
| 700 | 700 | if ((list($data) = $this->addressbook->search($search, |
| 701 | - array('id','egw_addressbook.account_id as account_id','n_fn'), |
|
| 701 | + array('id', 'egw_addressbook.account_id as account_id', 'n_fn'), |
|
| 702 | 702 | 'egw_addressbook.account_id IS NOT NULL DESC, n_fn IS NOT NULL DESC', |
| 703 | - '','',false,'OR'))) |
|
| 703 | + '', '', false, 'OR'))) |
|
| 704 | 704 | { |
| 705 | 705 | $uid = $data['account_id'] ? (int)$data['account_id'] : 'c'.$data['id']; |
| 706 | 706 | } |
| 707 | - elseif($attendee->name === $attendee->email || empty($attendee->name)) // dont store empty or email as name |
|
| 707 | + elseif ($attendee->name === $attendee->email || empty($attendee->name)) // dont store empty or email as name |
|
| 708 | 708 | { |
| 709 | 709 | $uid = 'e'.$attendee->email; |
| 710 | 710 | } |
@@ -722,8 +722,8 @@ discard block |
||
| 722 | 722 | //ZLog::Write(LOGLEVEL_DEBUG, "old status for $uid is status=$status, quantity=$quantitiy, role=$role"); |
| 723 | 723 | } |
| 724 | 724 | // check if just email is an existing attendee (iOS returns email as name too!), keep it to keep status/role if not set |
| 725 | - elseif ($event['id'] && (isset($event['participants'][$u='e'.$attendee->email]) || |
|
| 726 | - (isset($event['participants'][$u='e'.$attendee->name.' <'.$attendee->email.'>'])))) |
|
| 725 | + elseif ($event['id'] && (isset($event['participants'][$u = 'e'.$attendee->email]) || |
|
| 726 | + (isset($event['participants'][$u = 'e'.$attendee->name.' <'.$attendee->email.'>'])))) |
|
| 727 | 727 | { |
| 728 | 728 | $status = $event['participants'][$u]; |
| 729 | 729 | calendar_so::split_status($status, $quantity, $role); |
@@ -736,9 +736,9 @@ discard block |
||
| 736 | 736 | $role = 'REQ-PARTICIPANT'; |
| 737 | 737 | //ZLog::Write(LOGLEVEL_DEBUG, "default status for $uid is status=$status, quantity=$quantitiy, role=$role"); |
| 738 | 738 | } |
| 739 | - if ($role == 'CHAIR') $chair_set = true; // by role from existing participant |
|
| 739 | + if ($role == 'CHAIR') $chair_set = true; // by role from existing participant |
|
| 740 | 740 | |
| 741 | - if (isset($attendee->attendeestatus) && ($s = array_search($attendee->attendeestatus,self::$status2as))) |
|
| 741 | + if (isset($attendee->attendeestatus) && ($s = array_search($attendee->attendeestatus, self::$status2as))) |
|
| 742 | 742 | { |
| 743 | 743 | $status = $s; |
| 744 | 744 | } |
@@ -748,29 +748,29 @@ discard block |
||
| 748 | 748 | $chair_set = true; |
| 749 | 749 | } |
| 750 | 750 | elseif (isset($attendee->attendeetype) && |
| 751 | - !($role == 'CHAIR' && !is_numeric($uid)) && // do not override our external ORGANIZER |
|
| 752 | - ($r = array_search($attendee->attendeetype,self::$role2as)) && |
|
| 751 | + !($role == 'CHAIR' && !is_numeric($uid)) && // do not override our external ORGANIZER |
|
| 752 | + ($r = array_search($attendee->attendeetype, self::$role2as)) && |
|
| 753 | 753 | (int)self::$role2as[$role] != $attendee->attendeetype) // if old role gives same type, use old role, as we have a lot more roles then AS |
| 754 | 754 | { |
| 755 | 755 | $role = $r; |
| 756 | 756 | } |
| 757 | 757 | //ZLog::Write(LOGLEVEL_DEBUG, "-> status for $uid is status=$status ($s), quantity=$quantitiy, role=$role ($r)"); |
| 758 | - $participants[$uid] = calendar_so::combine_status($status,$quantitiy,$role); |
|
| 758 | + $participants[$uid] = calendar_so::combine_status($status, $quantitiy, $role); |
|
| 759 | 759 | } |
| 760 | 760 | // if organizer is not already participant, add him as chair |
| 761 | - if (($uid = $GLOBALS['egw']->accounts->name2id($message->organizeremail,'account_email')) && !isset($participants[$uid])) |
|
| 761 | + if (($uid = $GLOBALS['egw']->accounts->name2id($message->organizeremail, 'account_email')) && !isset($participants[$uid])) |
|
| 762 | 762 | { |
| 763 | 763 | $participants[$uid] = calendar_so::combine_status($uid == $GLOBALS['egw_info']['user']['account_id'] ? |
| 764 | - 'A' : 'U',1,'CHAIR'); |
|
| 764 | + 'A' : 'U', 1, 'CHAIR'); |
|
| 765 | 765 | $chair_set = true; |
| 766 | 766 | } |
| 767 | 767 | // preserve all resource types not account, contact or email (eg. resources) for existing events |
| 768 | 768 | // $account is also preserved, as AS does not add him as participant! |
| 769 | - foreach((array)$event['participant_types'] as $type => $parts) |
|
| 769 | + foreach ((array)$event['participant_types'] as $type => $parts) |
|
| 770 | 770 | { |
| 771 | - if (in_array($type,array('c','e'))) continue; // they are correctly representable in AS |
|
| 771 | + if (in_array($type, array('c', 'e'))) continue; // they are correctly representable in AS |
|
| 772 | 772 | |
| 773 | - foreach($parts as $id => $status) |
|
| 773 | + foreach ($parts as $id => $status) |
|
| 774 | 774 | { |
| 775 | 775 | // accounts are represented correctly, but the event owner which is no participant in AS |
| 776 | 776 | if ($type == 'u' && $id != $account) continue; |
@@ -786,13 +786,13 @@ discard block |
||
| 786 | 786 | if (!$event['id'] || !$participants || !isset($participants[$account])) |
| 787 | 787 | { |
| 788 | 788 | $participants[$account] = calendar_so::combine_status($account == $GLOBALS['egw_info']['user']['account_id'] ? |
| 789 | - 'A' : 'U',1,!$chair_set ? 'CHAIR' : 'REQ-PARTICIPANT'); |
|
| 789 | + 'A' : 'U', 1, !$chair_set ? 'CHAIR' : 'REQ-PARTICIPANT'); |
|
| 790 | 790 | } |
| 791 | 791 | $event['participants'] = $participants; |
| 792 | 792 | |
| 793 | 793 | if (isset($message->categories)) |
| 794 | 794 | { |
| 795 | - $event['category'] = implode(',', array_filter($this->calendar->find_or_add_categories($message->categories, $event),'strlen')); |
|
| 795 | + $event['category'] = implode(',', array_filter($this->calendar->find_or_add_categories($message->categories, $event), 'strlen')); |
|
| 796 | 796 | } |
| 797 | 797 | |
| 798 | 798 | // check if event is recurring and import recur information (incl. timezone) |
@@ -802,8 +802,7 @@ discard block |
||
| 802 | 802 | { |
| 803 | 803 | $event['tzid'] = self::as2tz(self::_getTZFromSyncBlob(base64_decode($message->timezone))); |
| 804 | 804 | } |
| 805 | - $event['recur_type'] = $message->recurrence->type == 6 ? calendar_rrule::YEARLY : |
|
| 806 | - array_search($message->recurrence->type, self::$recur_type2as); |
|
| 805 | + $event['recur_type'] = $message->recurrence->type == 6 ? calendar_rrule::YEARLY : array_search($message->recurrence->type, self::$recur_type2as); |
|
| 807 | 806 | $event['recur_interval'] = $message->recurrence->interval; |
| 808 | 807 | |
| 809 | 808 | switch ($event['recur_type']) |
@@ -812,7 +811,7 @@ discard block |
||
| 812 | 811 | // $message->recurrence->weekofmonth is not explicitly stored in egw, just taken from start date |
| 813 | 812 | // fall throught |
| 814 | 813 | case calendar_rrule::WEEKLY: |
| 815 | - $event['recur_data'] = $message->recurrence->dayofweek; // 1=Su, 2=Mo, 4=Tu, .., 64=Sa |
|
| 814 | + $event['recur_data'] = $message->recurrence->dayofweek; // 1=Su, 2=Mo, 4=Tu, .., 64=Sa |
|
| 816 | 815 | break; |
| 817 | 816 | case calendar_rrule::MONTHLY_MDAY: |
| 818 | 817 | // $message->recurrence->dayofmonth is not explicitly stored in egw, just taken from start date |
@@ -828,7 +827,7 @@ discard block |
||
| 828 | 827 | $event['recur_exceptions'] = array(); |
| 829 | 828 | if ($message->exceptions) |
| 830 | 829 | { |
| 831 | - foreach($message->exceptions as $exception) |
|
| 830 | + foreach ($message->exceptions as $exception) |
|
| 832 | 831 | { |
| 833 | 832 | $event['recur_exception'][] = Api\DateTime::server2user($exception->exceptionstarttime); |
| 834 | 833 | } |
@@ -838,7 +837,7 @@ discard block |
||
| 838 | 837 | { |
| 839 | 838 | // calculate enddate from occurences count, as we only support enddate |
| 840 | 839 | $count = $message->recurrence->occurrences; |
| 841 | - foreach(calendar_rrule::event2rrule($event, true) as $rtime) // true = timestamps are user time here, because of save! |
|
| 840 | + foreach (calendar_rrule::event2rrule($event, true) as $rtime) // true = timestamps are user time here, because of save! |
|
| 842 | 841 | { |
| 843 | 842 | if (--$count <= 0) break; |
| 844 | 843 | } |
@@ -848,11 +847,11 @@ discard block |
||
| 848 | 847 | // only import alarms in own calendar |
| 849 | 848 | if ($message->reminder && $account == $GLOBALS['egw_info']['user']['account_id']) |
| 850 | 849 | { |
| 851 | - foreach((array)$event['alarm'] as $alarm) |
|
| 850 | + foreach ((array)$event['alarm'] as $alarm) |
|
| 852 | 851 | { |
| 853 | - if (($alarm['all'] || $alarm['owner'] == $account) && $alarm['offset'] == 60*$message->reminder) |
|
| 852 | + if (($alarm['all'] || $alarm['owner'] == $account) && $alarm['offset'] == 60 * $message->reminder) |
|
| 854 | 853 | { |
| 855 | - $alarm = true; // alarm already exists --> do nothing |
|
| 854 | + $alarm = true; // alarm already exists --> do nothing |
|
| 856 | 855 | break; |
| 857 | 856 | } |
| 858 | 857 | } |
@@ -861,16 +860,16 @@ discard block |
||
| 861 | 860 | // delete all earlier alarms of that user |
| 862 | 861 | // user get's per AS only the earliest alarm, as AS only supports one alarm |
| 863 | 862 | // --> if a later alarm is returned, user probably modifed an existing alarm |
| 864 | - foreach((array)$event['alarm'] as $key => $alarm) |
|
| 863 | + foreach ((array)$event['alarm'] as $key => $alarm) |
|
| 865 | 864 | { |
| 866 | - if ($alarm['owner'] == $account && $alarm['offset'] > 60*$message->reminder) |
|
| 865 | + if ($alarm['owner'] == $account && $alarm['offset'] > 60 * $message->reminder) |
|
| 867 | 866 | { |
| 868 | 867 | unset($event['alarm'][$key]); |
| 869 | 868 | } |
| 870 | 869 | } |
| 871 | 870 | $event['alarm'][] = $alarm = array( |
| 872 | 871 | 'owner' => $account, |
| 873 | - 'offset' => 60*$message->reminder, |
|
| 872 | + 'offset' => 60 * $message->reminder, |
|
| 874 | 873 | ); |
| 875 | 874 | } |
| 876 | 875 | } |
@@ -944,7 +943,7 @@ discard block |
||
| 944 | 943 | */ |
| 945 | 944 | public function DeleteMessage($folderid, $id, $contentParameters) |
| 946 | 945 | { |
| 947 | - unset($contentParameters); // not used, but required by function signature |
|
| 946 | + unset($contentParameters); // not used, but required by function signature |
|
| 948 | 947 | |
| 949 | 948 | if (!isset($this->caledar)) $this->calendar = new calendar_boupdate(); |
| 950 | 949 | |
@@ -972,7 +971,7 @@ discard block |
||
| 972 | 971 | */ |
| 973 | 972 | function SetReadFlag($folderid, $id, $flags, $contentParameters) |
| 974 | 973 | { |
| 975 | - unset($contentParameters); // not used, but required by function signature |
|
| 974 | + unset($contentParameters); // not used, but required by function signature |
|
| 976 | 975 | |
| 977 | 976 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid', $id, ".array2string($flags)." NOT supported!"); |
| 978 | 977 | return false; |
@@ -1006,7 +1005,7 @@ discard block |
||
| 1006 | 1005 | * @param string $class ='SyncAppointment' or 'SyncAppointmentException' |
| 1007 | 1006 | * @return SyncAppointment|boolean false on error |
| 1008 | 1007 | */ |
| 1009 | - public function GetMessage($folderid, $id, $contentparameters, $class='SyncAppointment') |
|
| 1008 | + public function GetMessage($folderid, $id, $contentparameters, $class = 'SyncAppointment') |
|
| 1010 | 1009 | { |
| 1011 | 1010 | if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
| 1012 | 1011 | //error_log(__METHOD__.__LINE__.array2string($contentparameters).function_backtrace()); |
@@ -1024,17 +1023,17 @@ discard block |
||
| 1024 | 1023 | } |
| 1025 | 1024 | else |
| 1026 | 1025 | { |
| 1027 | - list($id,$recur_date) = explode(':',$id); |
|
| 1028 | - if ($type != 'calendar' || !($event = $this->calendar->read($id,$recur_date,false,'server',$account))) |
|
| 1026 | + list($id, $recur_date) = explode(':', $id); |
|
| 1027 | + if ($type != 'calendar' || !($event = $this->calendar->read($id, $recur_date, false, 'server', $account))) |
|
| 1029 | 1028 | { |
| 1030 | 1029 | error_log(__METHOD__."('$folderid', $id, ...) read($id,null,false,'server',$account) returned false"); |
| 1031 | 1030 | return false; |
| 1032 | 1031 | } |
| 1033 | 1032 | } |
| 1034 | - ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."($folderid,$id,...) start=$event[start]=".date('Y-m-d H:i:s',$event['start']).", recurrence=$event[recurrence]=".date('Y-m-d H:i:s',$event['recurrence'])); |
|
| 1035 | - foreach((array)$event['recur_exception'] as $ex) |
|
| 1033 | + ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."($folderid,$id,...) start=$event[start]=".date('Y-m-d H:i:s', $event['start']).", recurrence=$event[recurrence]=".date('Y-m-d H:i:s', $event['recurrence'])); |
|
| 1034 | + foreach ((array)$event['recur_exception'] as $ex) |
|
| 1036 | 1035 | { |
| 1037 | - ZLog::Write(LOGLEVEL_DEBUG, "exception=$ex=".date('Y-m-d H:i:s',$ex)); |
|
| 1036 | + ZLog::Write(LOGLEVEL_DEBUG, "exception=$ex=".date('Y-m-d H:i:s', $ex)); |
|
| 1038 | 1037 | } |
| 1039 | 1038 | $message = new $class(); |
| 1040 | 1039 | |
@@ -1043,14 +1042,14 @@ discard block |
||
| 1043 | 1042 | $as_tz = self::tz2as($event['tzid']); |
| 1044 | 1043 | $message->timezone = base64_encode(self::_getSyncBlobFromTZ($as_tz)); |
| 1045 | 1044 | } |
| 1046 | - catch(Exception $e) { |
|
| 1045 | + catch (Exception $e) { |
|
| 1047 | 1046 | unset($e); |
| 1048 | 1047 | // z-push (2.3 at least) requires a timezone for recurring events |
| 1049 | 1048 | if ($event['recur_type']) $message->timezone = self::UTC_BLOB; |
| 1050 | 1049 | } |
| 1051 | 1050 | |
| 1052 | 1051 | // copying timestamps (they are already read in servertime, so non tz conversation) |
| 1053 | - foreach(array( |
|
| 1052 | + foreach (array( |
|
| 1054 | 1053 | 'start' => 'starttime', |
| 1055 | 1054 | 'end' => 'endtime', |
| 1056 | 1055 | 'created' => 'dtstamp', |
@@ -1061,10 +1060,10 @@ discard block |
||
| 1061 | 1060 | } |
| 1062 | 1061 | if (($message->alldayevent = (int)calendar_bo::isWholeDay($event))) |
| 1063 | 1062 | { |
| 1064 | - ++$message->endtime; // EGw all-day-events are 1 sec shorter! |
|
| 1063 | + ++$message->endtime; // EGw all-day-events are 1 sec shorter! |
|
| 1065 | 1064 | } |
| 1066 | 1065 | // copying strings |
| 1067 | - foreach(array( |
|
| 1066 | + foreach (array( |
|
| 1068 | 1067 | 'title' => 'subject', |
| 1069 | 1068 | 'uid' => 'uid', |
| 1070 | 1069 | 'location' => 'location', |
@@ -1086,21 +1085,21 @@ discard block |
||
| 1086 | 1085 | { |
| 1087 | 1086 | ZLog::Write(LOGLEVEL_DEBUG, "airsyncbasebody!"); |
| 1088 | 1087 | $message->asbody = new SyncBaseBody(); |
| 1089 | - $message->nativebodytype=1; |
|
| 1088 | + $message->nativebodytype = 1; |
|
| 1090 | 1089 | $this->backend->note2messagenote($event['description'], $bodypreference, $message->asbody); |
| 1091 | 1090 | } |
| 1092 | 1091 | } |
| 1093 | - $message->organizername = $GLOBALS['egw']->accounts->id2name($event['owner'],'account_fullname'); |
|
| 1092 | + $message->organizername = $GLOBALS['egw']->accounts->id2name($event['owner'], 'account_fullname'); |
|
| 1094 | 1093 | // at least iOS calendar crashes, if organizer has no email address (true = generate an email, if user has none) |
| 1095 | 1094 | $message->organizeremail = $GLOBALS['egw']->accounts->id2name($event['owner'], 'account_email', true); |
| 1096 | 1095 | |
| 1097 | - $message->sensitivity = $event['public'] ? 0 : 2; // 0=normal, 1=personal, 2=private, 3=confidential |
|
| 1096 | + $message->sensitivity = $event['public'] ? 0 : 2; // 0=normal, 1=personal, 2=private, 3=confidential |
|
| 1098 | 1097 | |
| 1099 | 1098 | // busystatus=(0=free|1=tentative|2=busy|3=out-of-office), EGw has non_blocking=0|1 |
| 1100 | 1099 | $message->busystatus = $event['non_blocking'] ? 0 : 2; |
| 1101 | 1100 | |
| 1102 | 1101 | $message->attendees = array(); |
| 1103 | - foreach($event['participants'] as $uid => $status) |
|
| 1102 | + foreach ($event['participants'] as $uid => $status) |
|
| 1104 | 1103 | { |
| 1105 | 1104 | // AS does NOT want calendar owner as participant |
| 1106 | 1105 | if ($uid == $account) continue; |
@@ -1112,13 +1111,13 @@ discard block |
||
| 1112 | 1111 | $attendee->attendeetype = (int)self::$role2as[$role]; |
| 1113 | 1112 | if (is_numeric($uid)) |
| 1114 | 1113 | { |
| 1115 | - $attendee->name = $GLOBALS['egw']->accounts->id2name($uid,'account_fullname'); |
|
| 1114 | + $attendee->name = $GLOBALS['egw']->accounts->id2name($uid, 'account_fullname'); |
|
| 1116 | 1115 | $attendee->email = $GLOBALS['egw']->accounts->id2name($uid, 'account_email', true); |
| 1117 | 1116 | } |
| 1118 | 1117 | else |
| 1119 | 1118 | { |
| 1120 | 1119 | list($info) = $i = $this->calendar->resources[$uid[0]]['info'] ? |
| 1121 | - ExecMethod($this->calendar->resources[$uid[0]]['info'],substr($uid,1)) : array(false); |
|
| 1120 | + ExecMethod($this->calendar->resources[$uid[0]]['info'], substr($uid, 1)) : array(false); |
|
| 1122 | 1121 | |
| 1123 | 1122 | if (!$info) continue; |
| 1124 | 1123 | |
@@ -1136,7 +1135,7 @@ discard block |
||
| 1136 | 1135 | $message->organizeremail = $attendee->email; |
| 1137 | 1136 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."($folderid, $id, ...) external organizer detected (role=$role, uid=$uid), set as AS organizer: $message->organizername <$message->organizeremail>"); |
| 1138 | 1137 | } |
| 1139 | - if ($uid[0] == 'r') $attendee->type = 3; // 3 = resource |
|
| 1138 | + if ($uid[0] == 'r') $attendee->type = 3; // 3 = resource |
|
| 1140 | 1139 | } |
| 1141 | 1140 | // email must NOT be empty, but MAY be an arbitrary text |
| 1142 | 1141 | if (empty($attendee->email)) $attendee->email = 'noreply-'.$uid.'[email protected]'; |
@@ -1144,7 +1143,7 @@ discard block |
||
| 1144 | 1143 | $message->attendees[] = $attendee; |
| 1145 | 1144 | } |
| 1146 | 1145 | $message->categories = array(); |
| 1147 | - foreach($event['category'] ? explode(',',$event['category']) : array() as $cat_id) |
|
| 1146 | + foreach ($event['category'] ? explode(',', $event['category']) : array() as $cat_id) |
|
| 1148 | 1147 | { |
| 1149 | 1148 | $message->categories[] = Api\Categories::id2name($cat_id); |
| 1150 | 1149 | } |
@@ -1153,25 +1152,25 @@ discard block |
||
| 1153 | 1152 | if ($event['recur_type'] != calendar_rrule::NONE && !$recur_date) |
| 1154 | 1153 | { |
| 1155 | 1154 | $message->recurrence = $recurrence = new SyncRecurrence(); |
| 1156 | - $rrule = calendar_rrule::event2rrule($event,false); // false = timestamps in $event are servertime |
|
| 1155 | + $rrule = calendar_rrule::event2rrule($event, false); // false = timestamps in $event are servertime |
|
| 1157 | 1156 | $recurrence->type = (int)self::$recur_type2as[$rrule->type]; |
| 1158 | 1157 | $recurrence->interval = $rrule->interval; |
| 1159 | 1158 | switch ($rrule->type) |
| 1160 | 1159 | { |
| 1161 | 1160 | case calendar_rrule::MONTHLY_WDAY: |
| 1162 | 1161 | $recurrence->weekofmonth = $rrule->monthly_byday_num >= 1 ? |
| 1163 | - $rrule->monthly_byday_num : 5; // 1..5=last week of month, not -1 |
|
| 1162 | + $rrule->monthly_byday_num : 5; // 1..5=last week of month, not -1 |
|
| 1164 | 1163 | // fall throught |
| 1165 | 1164 | case calendar_rrule::WEEKLY: |
| 1166 | - $recurrence->dayofweek = $rrule->weekdays; // 1=Su, 2=Mo, 4=Tu, .., 64=Sa |
|
| 1165 | + $recurrence->dayofweek = $rrule->weekdays; // 1=Su, 2=Mo, 4=Tu, .., 64=Sa |
|
| 1167 | 1166 | break; |
| 1168 | 1167 | case calendar_rrule::MONTHLY_MDAY: |
| 1169 | - $recurrence->dayofmonth = $rrule->monthly_bymonthday >= 1 ? // 1..31 |
|
| 1170 | - $rrule->monthly_bymonthday : 31; // not -1 for last day of month! |
|
| 1168 | + $recurrence->dayofmonth = $rrule->monthly_bymonthday >= 1 ? // 1..31 |
|
| 1169 | + $rrule->monthly_bymonthday : 31; // not -1 for last day of month! |
|
| 1171 | 1170 | break; |
| 1172 | 1171 | case calendar_rrule::YEARLY: |
| 1173 | - $recurrence->dayofmonth = (int)$rrule->time->format('d'); // 1..31 |
|
| 1174 | - $recurrence->monthofyear = (int)$rrule->time->format('m'); // 1..12 |
|
| 1172 | + $recurrence->dayofmonth = (int)$rrule->time->format('d'); // 1..31 |
|
| 1173 | + $recurrence->monthofyear = (int)$rrule->time->format('m'); // 1..12 |
|
| 1175 | 1174 | break; |
| 1176 | 1175 | } |
| 1177 | 1176 | if ($rrule->enddate) // enddate is only a date, but AS needs a time incl. correct starttime! |
@@ -1187,9 +1186,9 @@ discard block |
||
| 1187 | 1186 | // search real / non-virtual exceptions |
| 1188 | 1187 | if (!empty($event['uid'])) |
| 1189 | 1188 | { |
| 1190 | - $ex_events =& $this->calendar->search(array( |
|
| 1189 | + $ex_events = & $this->calendar->search(array( |
|
| 1191 | 1190 | 'query' => array('cal_uid' => $event['uid']), |
| 1192 | - 'filter' => 'owner', // return all possible entries |
|
| 1191 | + 'filter' => 'owner', // return all possible entries |
|
| 1193 | 1192 | 'daywise' => false, |
| 1194 | 1193 | 'date_format' => 'server', |
| 1195 | 1194 | )); |
@@ -1198,36 +1197,36 @@ discard block |
||
| 1198 | 1197 | { |
| 1199 | 1198 | ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.__LINE__." Exceptions found but no UID given for Event:".$event['id'].' Exceptions:'.array2string($event['recur_exception'])); |
| 1200 | 1199 | } |
| 1201 | - if (count($ex_events)>=1) ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.__LINE__." found ".count($ex_events)." exeptions for event with UID/ID:".$event['uid'].'/'.$event['id']); |
|
| 1200 | + if (count($ex_events) >= 1) ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.__LINE__." found ".count($ex_events)." exeptions for event with UID/ID:".$event['uid'].'/'.$event['id']); |
|
| 1202 | 1201 | |
| 1203 | 1202 | $message->exceptions = array(); |
| 1204 | - foreach($ex_events as $ex_event) |
|
| 1203 | + foreach ($ex_events as $ex_event) |
|
| 1205 | 1204 | { |
| 1206 | - if ($ex_event['id'] == $event['id']) continue; // ignore series master |
|
| 1205 | + if ($ex_event['id'] == $event['id']) continue; // ignore series master |
|
| 1207 | 1206 | $exception = $this->GetMessage($folderid, $ex_event, $contentparameters, 'SyncAppointmentException'); |
| 1208 | 1207 | $exception->exceptionstarttime = $exception_time = $ex_event['recurrence']; |
| 1209 | - foreach(array('attendees','recurrence','uid','timezone','organizername','organizeremail') as $not_supported) |
|
| 1208 | + foreach (array('attendees', 'recurrence', 'uid', 'timezone', 'organizername', 'organizeremail') as $not_supported) |
|
| 1210 | 1209 | { |
| 1211 | - $exception->$not_supported = null; // not allowed in exceptions :-( |
|
| 1210 | + $exception->$not_supported = null; // not allowed in exceptions :-( |
|
| 1212 | 1211 | } |
| 1213 | 1212 | $exception->deleted = 0; |
| 1214 | - if (($key = array_search($exception_time,$event['recur_exception'])) !== false) |
|
| 1213 | + if (($key = array_search($exception_time, $event['recur_exception'])) !== false) |
|
| 1215 | 1214 | { |
| 1216 | 1215 | unset($event['recur_exception'][$key]); |
| 1217 | 1216 | } |
| 1218 | - ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."() added exception ".date('Y-m-d H:i:s',$exception_time).' '.array2string($exception)); |
|
| 1217 | + ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."() added exception ".date('Y-m-d H:i:s', $exception_time).' '.array2string($exception)); |
|
| 1219 | 1218 | $message->exceptions[] = $exception; |
| 1220 | 1219 | } |
| 1221 | 1220 | // add rest of exceptions as deleted |
| 1222 | - foreach($event['recur_exception'] as $exception_time) |
|
| 1221 | + foreach ($event['recur_exception'] as $exception_time) |
|
| 1223 | 1222 | { |
| 1224 | 1223 | if (!empty($exception_time)) |
| 1225 | 1224 | { |
| 1226 | 1225 | if (empty($event['uid'])) ZLog::Write(LOGLEVEL_DEBUG, __METHOD__.__LINE__." BEWARE no UID given for this event:".$event['id'].' but exception is set for '.$exception_time); |
| 1227 | - $exception = new SyncAppointmentException(); // exceptions seems to be full SyncAppointments, with only starttime required |
|
| 1226 | + $exception = new SyncAppointmentException(); // exceptions seems to be full SyncAppointments, with only starttime required |
|
| 1228 | 1227 | $exception->deleted = 1; |
| 1229 | 1228 | $exception->exceptionstarttime = $exception_time; |
| 1230 | - ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."() added deleted exception ".date('Y-m-d H:i:s',$exception_time).' '.array2string($exception)); |
|
| 1229 | + ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."() added deleted exception ".date('Y-m-d H:i:s', $exception_time).' '.array2string($exception)); |
|
| 1231 | 1230 | $message->exceptions[] = $exception; |
| 1232 | 1231 | } |
| 1233 | 1232 | } |
@@ -1249,12 +1248,12 @@ discard block |
||
| 1249 | 1248 | // only return alarms if in own calendar |
| 1250 | 1249 | if ($account == $GLOBALS['egw_info']['user']['account_id'] && $event['alarm']) |
| 1251 | 1250 | { |
| 1252 | - foreach($event['alarm'] as $alarm) |
|
| 1251 | + foreach ($event['alarm'] as $alarm) |
|
| 1253 | 1252 | { |
| 1254 | 1253 | if ($alarm['all'] || $alarm['owner'] == $account) |
| 1255 | 1254 | { |
| 1256 | - $message->reminder = $alarm['offset']/60; // is in minutes, not seconds as in EGw |
|
| 1257 | - break; // AS supports only one alarm! (we use the next/earliest one) |
|
| 1255 | + $message->reminder = $alarm['offset'] / 60; // is in minutes, not seconds as in EGw |
|
| 1256 | + break; // AS supports only one alarm! (we use the next/earliest one) |
|
| 1258 | 1257 | } |
| 1259 | 1258 | } |
| 1260 | 1259 | } |
@@ -1277,7 +1276,7 @@ discard block |
||
| 1277 | 1276 | */ |
| 1278 | 1277 | public function StatMessage($folderid, $id) |
| 1279 | 1278 | { |
| 1280 | - unset($folderid); // not used ($id is unique), but required by function signature |
|
| 1279 | + unset($folderid); // not used ($id is unique), but required by function signature |
|
| 1281 | 1280 | |
| 1282 | 1281 | if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
| 1283 | 1282 | |
@@ -1288,7 +1287,7 @@ discard block |
||
| 1288 | 1287 | // error_log why access is denied (should never happen for everything returned by calendar_bo::search) |
| 1289 | 1288 | $backup = $this->calendar->debug; |
| 1290 | 1289 | //$this->calendar->debug = 2; |
| 1291 | - list($id) = explode(':',$id); |
|
| 1290 | + list($id) = explode(':', $id); |
|
| 1292 | 1291 | $this->calendar->check_perms(calendar_bo::ACL_FREEBUSY, $id, 0, 'server'); |
| 1293 | 1292 | $this->calendar->debug = $backup; |
| 1294 | 1293 | } |
@@ -1322,7 +1321,7 @@ discard block |
||
| 1322 | 1321 | |
| 1323 | 1322 | if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); |
| 1324 | 1323 | //$ctag = $this->calendar->get_ctag($owner,'owner',true); // true only consider recurrence master |
| 1325 | - $syncstate = $this->calendar->get_ctag($owner,false,true); // we only want to fetch the owners events, where he is a participant too |
|
| 1324 | + $syncstate = $this->calendar->get_ctag($owner, false, true); // we only want to fetch the owners events, where he is a participant too |
|
| 1326 | 1325 | // workaround for syncstate = 0 when calendar is empty causes synctate to not return 0 but array resulting in foldersync loop |
| 1327 | 1326 | if ($syncstate == 0) $syncstate = 1; |
| 1328 | 1327 | |
@@ -1402,8 +1401,8 @@ discard block |
||
| 1402 | 1401 | |
| 1403 | 1402 | if ($tz === 'UTC') return $data; |
| 1404 | 1403 | |
| 1405 | - $name = $component = is_a($tz,'DateTimeZone') ? $tz->getName() : $tz; |
|
| 1406 | - if (strpos($component, 'VTIMEZONE') === false) $component = calendar_timezones::tz2id($name,'component'); |
|
| 1404 | + $name = $component = is_a($tz, 'DateTimeZone') ? $tz->getName() : $tz; |
|
| 1405 | + if (strpos($component, 'VTIMEZONE') === false) $component = calendar_timezones::tz2id($name, 'component'); |
|
| 1407 | 1406 | // parse ical timezone defintion |
| 1408 | 1407 | $ical = self::ical2array($component); |
| 1409 | 1408 | $standard = $ical['VTIMEZONE']['STANDARD']; |
@@ -1412,11 +1411,11 @@ discard block |
||
| 1412 | 1411 | if (!isset($standard)) |
| 1413 | 1412 | { |
| 1414 | 1413 | $matches = null; |
| 1415 | - if (preg_match('/^etc\/gmt([+-])([0-9]+)$/i',$name,$matches)) |
|
| 1414 | + if (preg_match('/^etc\/gmt([+-])([0-9]+)$/i', $name, $matches)) |
|
| 1416 | 1415 | { |
| 1417 | 1416 | $standard = array( |
| 1418 | - 'TZOFFSETTO' => sprintf('%s%02d00',$matches[1],$matches[2]), |
|
| 1419 | - 'TZOFFSETFROM' => sprintf('%s%02d00',$matches[1],$matches[2]), |
|
| 1417 | + 'TZOFFSETTO' => sprintf('%s%02d00', $matches[1], $matches[2]), |
|
| 1418 | + 'TZOFFSETFROM' => sprintf('%s%02d00', $matches[1], $matches[2]), |
|
| 1420 | 1419 | ); |
| 1421 | 1420 | unset($daylight); |
| 1422 | 1421 | } |
@@ -1427,15 +1426,15 @@ discard block |
||
| 1427 | 1426 | } |
| 1428 | 1427 | // get bias and dstbias from standard component, which is present in all tz's |
| 1429 | 1428 | // (dstbias is relative to bias and almost always 60 or 0) |
| 1430 | - $data['bias'] = -(60 * substr($standard['TZOFFSETTO'],0,-2) + substr($standard['TZOFFSETTO'],-2)); |
|
| 1431 | - $data['dstbias'] = -(60 * substr($standard['TZOFFSETFROM'],0,-2) + substr($standard['TZOFFSETFROM'],-2) + $data['bias']); |
|
| 1429 | + $data['bias'] = -(60 * substr($standard['TZOFFSETTO'], 0, -2) + substr($standard['TZOFFSETTO'], -2)); |
|
| 1430 | + $data['dstbias'] = -(60 * substr($standard['TZOFFSETFROM'], 0, -2) + substr($standard['TZOFFSETFROM'], -2) + $data['bias']); |
|
| 1432 | 1431 | |
| 1433 | 1432 | // check if we have an additional DAYLIGHT component and both have a RRULE component --> tz uses daylight saving |
| 1434 | 1433 | if (isset($standard['RRULE']) && isset($daylight) && isset($daylight['RRULE'])) |
| 1435 | 1434 | { |
| 1436 | - foreach(array('dststart' => $daylight,'dstend' => $standard) as $prefix => $comp) |
|
| 1435 | + foreach (array('dststart' => $daylight, 'dstend' => $standard) as $prefix => $comp) |
|
| 1437 | 1436 | { |
| 1438 | - if (preg_match('/FREQ=YEARLY;BYDAY=(.*);BYMONTH=(\d+)/',$comp['RRULE'],$matches)) |
|
| 1437 | + if (preg_match('/FREQ=YEARLY;BYDAY=(.*);BYMONTH=(\d+)/', $comp['RRULE'], $matches)) |
|
| 1439 | 1438 | { |
| 1440 | 1439 | $data[$prefix.'month'] = (int)$matches[2]; |
| 1441 | 1440 | $data[$prefix.'week'] = (int)$matches[1]; |
@@ -1452,20 +1451,20 @@ discard block |
||
| 1452 | 1451 | $data[$prefix.'week'] = 5; |
| 1453 | 1452 | if ($prefix == 'dstend') $data[$prefix.'month'] -= 1; |
| 1454 | 1453 | } |
| 1455 | - static $day2int = array('SU'=>0,'MO'=>1,'TU'=>2,'WE'=>3,'TH'=>4,'FR'=>5,'SA'=>6); |
|
| 1456 | - $data[$prefix.'day'] = (int)$day2int[substr($matches[1],-2)]; |
|
| 1454 | + static $day2int = array('SU'=>0, 'MO'=>1, 'TU'=>2, 'WE'=>3, 'TH'=>4, 'FR'=>5, 'SA'=>6); |
|
| 1455 | + $data[$prefix.'day'] = (int)$day2int[substr($matches[1], -2)]; |
|
| 1457 | 1456 | } |
| 1458 | - if (preg_match('/^\d{8}T(\d{6})$/',$comp['DTSTART'],$matches)) |
|
| 1457 | + if (preg_match('/^\d{8}T(\d{6})$/', $comp['DTSTART'], $matches)) |
|
| 1459 | 1458 | { |
| 1460 | - $data[$prefix.'hour'] = (int)substr($matches[1],0,2)+($prefix=='dststart'?-1:1)*$data['dstbias']/60; |
|
| 1461 | - $data[$prefix.'minute'] = (int)substr($matches[1],2,2)+($prefix=='dststart'?-1:1)*$data['dstbias']%60; |
|
| 1462 | - $data[$prefix.'second'] = (int)substr($matches[1],4,2); |
|
| 1459 | + $data[$prefix.'hour'] = (int)substr($matches[1], 0, 2) + ($prefix == 'dststart' ?-1 : 1) * $data['dstbias'] / 60; |
|
| 1460 | + $data[$prefix.'minute'] = (int)substr($matches[1], 2, 2) + ($prefix == 'dststart' ?-1 : 1) * $data['dstbias'] % 60; |
|
| 1461 | + $data[$prefix.'second'] = (int)substr($matches[1], 4, 2); |
|
| 1463 | 1462 | } |
| 1464 | 1463 | } |
| 1465 | 1464 | // for southern hermisphere, were DST is in January, we have to swap start- and end-hour/-minute |
| 1466 | 1465 | if ($data['dststartmonth'] > $data['dstendmonth']) |
| 1467 | 1466 | { |
| 1468 | - $start = $data['dststarthour']; $data['dststarthour'] = $data['dstendhour']; $data['dstendhour'] = $start; |
|
| 1467 | + $start = $data['dststarthour']; $data['dststarthour'] = $data['dstendhour']; $data['dstendhour'] = $start; |
|
| 1469 | 1468 | $end = $data['dststartminute']; $data['dststartminute'] = $data['dstendminute']; $data['dstendminute'] = $end; |
| 1470 | 1469 | } |
| 1471 | 1470 | } |
@@ -1523,20 +1522,20 @@ discard block |
||
| 1523 | 1522 | * @param string|array $ical lines of ical file |
| 1524 | 1523 | * @return array with parsed ical components |
| 1525 | 1524 | */ |
| 1526 | - static public function ical2array(&$ical,$section=null) |
|
| 1525 | + static public function ical2array(&$ical, $section = null) |
|
| 1527 | 1526 | { |
| 1528 | 1527 | $arr = array(); |
| 1529 | 1528 | if (!is_array($ical)) $ical = preg_split("/[\r\n]+/m", $ical); |
| 1530 | 1529 | while (($line = array_shift($ical))) |
| 1531 | 1530 | { |
| 1532 | - list($name,$value) = explode(':',$line,2); |
|
| 1531 | + list($name, $value) = explode(':', $line, 2); |
|
| 1533 | 1532 | if ($name == 'BEGIN') |
| 1534 | 1533 | { |
| 1535 | - $arr[$value] = self::ical2array($ical,$value); |
|
| 1534 | + $arr[$value] = self::ical2array($ical, $value); |
|
| 1536 | 1535 | } |
| 1537 | - elseif($name == 'END') |
|
| 1536 | + elseif ($name == 'END') |
|
| 1538 | 1537 | { |
| 1539 | - if ($section && $section==$value) return $arr; |
|
| 1538 | + if ($section && $section == $value) return $arr; |
|
| 1540 | 1539 | break; |
| 1541 | 1540 | } |
| 1542 | 1541 | else |
@@ -1559,13 +1558,13 @@ discard block |
||
| 1559 | 1558 | */ |
| 1560 | 1559 | public static function as2tz(array $data) |
| 1561 | 1560 | { |
| 1562 | - static $cache=null; // some caching withing the request |
|
| 1561 | + static $cache = null; // some caching withing the request |
|
| 1563 | 1562 | |
| 1564 | - unset($data['name']); // not used, but can stall the match |
|
| 1563 | + unset($data['name']); // not used, but can stall the match |
|
| 1565 | 1564 | |
| 1566 | 1565 | $key = serialize($data); |
| 1567 | 1566 | |
| 1568 | - for($n = 0; !isset($cache[$key]); ++$n) |
|
| 1567 | + for ($n = 0; !isset($cache[$key]); ++$n) |
|
| 1569 | 1568 | { |
| 1570 | 1569 | if (!$n) // check users timezone first |
| 1571 | 1570 | { |
@@ -1584,7 +1583,7 @@ discard block |
||
| 1584 | 1583 | break; |
| 1585 | 1584 | } |
| 1586 | 1585 | } |
| 1587 | - catch(Exception $e) { |
|
| 1586 | + catch (Exception $e) { |
|
| 1588 | 1587 | unset($e); |
| 1589 | 1588 | // simpy ignore that, as it only means $tz can NOT be converted, because it has no VTIMEZONE component |
| 1590 | 1589 | } |
@@ -1599,8 +1598,8 @@ discard block |
||
| 1599 | 1598 | */ |
| 1600 | 1599 | static public function _getTZFromSyncBlob($data) |
| 1601 | 1600 | { |
| 1602 | - $tz = unpack( "lbias/a64name/vdstendyear/vdstendmonth/vdstendday/vdstendweek/vdstendhour/vdstendminute/vdstendsecond/vdstendmillis/" . |
|
| 1603 | - "lstdbias/a64name/vdststartyear/vdststartmonth/vdststartday/vdststartweek/vdststarthour/vdststartminute/vdststartsecond/vdststartmillis/" . |
|
| 1601 | + $tz = unpack("lbias/a64name/vdstendyear/vdstendmonth/vdstendday/vdstendweek/vdstendhour/vdstendminute/vdstendsecond/vdstendmillis/". |
|
| 1602 | + "lstdbias/a64name/vdststartyear/vdststartmonth/vdststartday/vdststartweek/vdststarthour/vdststartminute/vdststartsecond/vdststartmillis/". |
|
| 1604 | 1603 | "ldstbias", $data); |
| 1605 | 1604 | |
| 1606 | 1605 | return $tz; |
@@ -1613,7 +1612,7 @@ discard block |
||
| 1613 | 1612 | */ |
| 1614 | 1613 | static public function _getSyncBlobFromTZ($tz) |
| 1615 | 1614 | { |
| 1616 | - $packed = pack("la64vvvvvvvv" . "la64vvvvvvvv" . "l", |
|
| 1615 | + $packed = pack("la64vvvvvvvv"."la64vvvvvvvv"."l", |
|
| 1617 | 1616 | $tz["bias"], "", 0, $tz["dstendmonth"], $tz["dstendday"], $tz["dstendweek"], $tz["dstendhour"], $tz["dstendminute"], $tz["dstendsecond"], $tz["dstendmillis"], |
| 1618 | 1617 | $tz["stdbias"], "", 0, $tz["dststartmonth"], $tz["dststartday"], $tz["dststartweek"], $tz["dststarthour"], $tz["dststartminute"], $tz["dststartsecond"], $tz["dststartmillis"], |
| 1619 | 1618 | $tz["dstbias"]); |
@@ -1637,7 +1636,7 @@ discard block |
||
| 1637 | 1636 | $account_id = $entry['grantor']; |
| 1638 | 1637 | $cals[$account_id] = $entry['name']; |
| 1639 | 1638 | } |
| 1640 | - if ($hook_data['account_id'] > 0) unset($cals[$hook_data['account_id']]); // skip current user |
|
| 1639 | + if ($hook_data['account_id'] > 0) unset($cals[$hook_data['account_id']]); // skip current user |
|
| 1641 | 1640 | } |
| 1642 | 1641 | $cals['G'] = lang('Primary group'); |
| 1643 | 1642 | $cals['A'] = lang('All'); |
@@ -1673,7 +1672,7 @@ discard block |
||
| 1673 | 1672 | ) |
| 1674 | 1673 | ); |
| 1675 | 1674 | require_once('../../header.inc.php'); |
| 1676 | - ini_set('display_errors',1); |
|
| 1675 | + ini_set('display_errors', 1); |
|
| 1677 | 1676 | error_reporting(E_ALL & ~E_NOTICE); |
| 1678 | 1677 | |
| 1679 | 1678 | echo "<html><head><title>Conversation of ActiveSync Timezone Blobs to TZID's</title></head>\n<body>\n"; |
@@ -1688,7 +1687,7 @@ discard block |
||
| 1688 | 1687 | </script>\n"; |
| 1689 | 1688 | |
| 1690 | 1689 | // TZID => AS timezone blobs reported by various devices |
| 1691 | - foreach(array( |
|
| 1690 | + foreach (array( |
|
| 1692 | 1691 | 'Europe/Berlin' => 'xP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAFAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAMAAAAAAAAAxP///w==', |
| 1693 | 1692 | 'Europe/Helsinki' => 'iP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAFAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAQAAAAAAAAAxP///w==', |
| 1694 | 1693 | 'Asia/Tokyo' => '5P3//wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAxP///w==', |
@@ -1702,7 +1701,7 @@ discard block |
||
| 1702 | 1701 | ) as $tz => $sync_blob) |
| 1703 | 1702 | { |
| 1704 | 1703 | // get as timezone data for a given timezone |
| 1705 | - $ical = calendar_timezones::tz2id($tz,'component'); |
|
| 1704 | + $ical = calendar_timezones::tz2id($tz, 'component'); |
|
| 1706 | 1705 | //echo "<pre>".print_r($ical,true)."</pre>\n"; |
| 1707 | 1706 | $ical_tz = $ical; |
| 1708 | 1707 | $ical_arr = calendar_zpush::ical2array($ical_tz); |
@@ -1719,22 +1718,22 @@ discard block |
||
| 1719 | 1718 | //echo array2string($matched); |
| 1720 | 1719 | |
| 1721 | 1720 | echo "<tr><td><b onclick='toggle_display(this.nextSibling);' style='cursor:pointer;'>$tz</b><pre style='margin:0; font-size: 90%; display:none;'>$ical</pre></td><td>$as_tz_org[bias]<br/>$as_tz[bias]</td><td>$as_tz_org[dstbias]<br/>$as_tz[dstbias]</td>\n"; |
| 1722 | - foreach(array('dststart','dstend') as $prefix) |
|
| 1721 | + foreach (array('dststart', 'dstend') as $prefix) |
|
| 1723 | 1722 | { |
| 1724 | 1723 | echo "<td>\n"; |
| 1725 | - foreach(array($as_tz_org,$as_tz) as $n => $arr) |
|
| 1724 | + foreach (array($as_tz_org, $as_tz) as $n => $arr) |
|
| 1726 | 1725 | { |
| 1727 | 1726 | $parts = array(); |
| 1728 | - foreach(array('year','month','day','week','hour','minute','second') as $postfix) |
|
| 1727 | + foreach (array('year', 'month', 'day', 'week', 'hour', 'minute', 'second') as $postfix) |
|
| 1729 | 1728 | { |
| 1730 | 1729 | $failed = $n && $as_tz_org[$prefix.$postfix] !== $as_tz[$prefix.$postfix]; |
| 1731 | - $parts[] = ($failed?'<font color="red">':'').$arr[$prefix.$postfix].($failed?'</font>':''); |
|
| 1730 | + $parts[] = ($failed ? '<font color="red">' : '').$arr[$prefix.$postfix].($failed ? '</font>' : ''); |
|
| 1732 | 1731 | } |
| 1733 | - echo implode(' ', $parts).(!$n?'<br/>':''); |
|
| 1732 | + echo implode(' ', $parts).(!$n ? '<br/>' : ''); |
|
| 1734 | 1733 | } |
| 1735 | 1734 | echo "</td>\n"; |
| 1736 | 1735 | } |
| 1737 | - echo "<td> <br/>".($matched=='UTC'?'<font color="red">':'').$matched.($matched=='UTC'?'</font>':'')."</td></tr>\n"; |
|
| 1736 | + echo "<td> <br/>".($matched == 'UTC' ? '<font color="red">' : '').$matched.($matched == 'UTC' ? '</font>' : '')."</td></tr>\n"; |
|
| 1738 | 1737 | } |
| 1739 | 1738 | echo "</tbody></table>\n"; |
| 1740 | 1739 | echo "</body></html>\n"; |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public static $types = array( |
| 26 | 26 | 'select-cat' => array('category'), |
| 27 | - 'select-account'=> array('owner','creator', 'modifier'), |
|
| 28 | - 'date-time' => array('modified', 'created','start','end','recur_date'), |
|
| 27 | + 'select-account'=> array('owner', 'creator', 'modifier'), |
|
| 28 | + 'date-time' => array('modified', 'created', 'start', 'end', 'recur_date'), |
|
| 29 | 29 | 'date' => array('recur_enddate'), |
| 30 | 30 | 'select-bool' => array('public', 'non_blocking'), |
| 31 | 31 | 'select' => array('priority'), |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @param string $_identifier |
| 39 | 39 | */ |
| 40 | - public function __construct( $_identifier='' ){ |
|
| 40 | + public function __construct($_identifier = '') { |
|
| 41 | 41 | $this->identifier = $_identifier; |
| 42 | - if(!is_object($this->bo)) { |
|
| 42 | + if (!is_object($this->bo)) { |
|
| 43 | 43 | $this->bo = new calendar_bo(); |
| 44 | 44 | } |
| 45 | - if($this->identifier) { |
|
| 45 | + if ($this->identifier) { |
|
| 46 | 46 | $this->record = $this->bo->read($this->identifier); |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @todo add some checks |
| 97 | 97 | * @return void |
| 98 | 98 | */ |
| 99 | - public function set_record(array $_record){ |
|
| 99 | + public function set_record(array $_record) { |
|
| 100 | 100 | $this->record = $_record; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * |
| 125 | 125 | * @return string identifier |
| 126 | 126 | */ |
| 127 | - public function save ( $_dst_identifier ) { |
|
| 127 | + public function save($_dst_identifier) { |
|
| 128 | 128 | // Not yet implemeted |
| 129 | 129 | $this->identifier = $_dst_identifier; |
| 130 | 130 | } |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | * @param string $_dst_identifier |
| 136 | 136 | * @return string dst_identifier |
| 137 | 137 | */ |
| 138 | - public function copy ( $_dst_identifier ) { |
|
| 139 | - unset($_dst_identifier); // not used |
|
| 138 | + public function copy($_dst_identifier) { |
|
| 139 | + unset($_dst_identifier); // not used |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -146,15 +146,15 @@ discard block |
||
| 146 | 146 | * @param string $_dst_identifier |
| 147 | 147 | * @return string dst_identifier |
| 148 | 148 | */ |
| 149 | - public function move ( $_dst_identifier ) { |
|
| 150 | - unset($_dst_identifier); // not used |
|
| 149 | + public function move($_dst_identifier) { |
|
| 150 | + unset($_dst_identifier); // not used |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | 154 | * delets current record from backend |
| 155 | 155 | * |
| 156 | 156 | */ |
| 157 | - public function delete () { |
|
| 157 | + public function delete() { |
|
| 158 | 158 | |
| 159 | 159 | } |
| 160 | 160 | |
@@ -37,12 +37,15 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @param string $_identifier |
| 39 | 39 | */ |
| 40 | - public function __construct( $_identifier='' ){ |
|
| 40 | + public function __construct( $_identifier='' ) |
|
| 41 | + { |
|
| 41 | 42 | $this->identifier = $_identifier; |
| 42 | - if(!is_object($this->bo)) { |
|
| 43 | + if(!is_object($this->bo)) |
|
| 44 | + { |
|
| 43 | 45 | $this->bo = new calendar_bo(); |
| 44 | 46 | } |
| 45 | - if($this->identifier) { |
|
| 47 | + if($this->identifier) |
|
| 48 | + { |
|
| 46 | 49 | $this->record = $this->bo->read($this->identifier); |
| 47 | 50 | } |
| 48 | 51 | } |
@@ -52,7 +55,8 @@ discard block |
||
| 52 | 55 | * |
| 53 | 56 | * @param string $_attribute_name |
| 54 | 57 | */ |
| 55 | - public function __get($_attribute_name) { |
|
| 58 | + public function __get($_attribute_name) |
|
| 59 | + { |
|
| 56 | 60 | return $this->record[$_attribute_name]; |
| 57 | 61 | } |
| 58 | 62 | |
@@ -62,11 +66,13 @@ discard block |
||
| 62 | 66 | * @param string $_attribute_name |
| 63 | 67 | * @param data $data |
| 64 | 68 | */ |
| 65 | - public function __set($_attribute_name, $data) { |
|
| 69 | + public function __set($_attribute_name, $data) |
|
| 70 | + { |
|
| 66 | 71 | $this->record[$_attribute_name] = $data; |
| 67 | 72 | } |
| 68 | 73 | |
| 69 | - public function __unset($_attribute_name) { |
|
| 74 | + public function __unset($_attribute_name) |
|
| 75 | + { |
|
| 70 | 76 | unset($this->record[$_attribute_name]); |
| 71 | 77 | } |
| 72 | 78 | |
@@ -78,7 +84,8 @@ discard block |
||
| 78 | 84 | * |
| 79 | 85 | * @return array complete record as associative array |
| 80 | 86 | */ |
| 81 | - public function get_record_array() { |
|
| 87 | + public function get_record_array() |
|
| 88 | + { |
|
| 82 | 89 | return $this->record; |
| 83 | 90 | } |
| 84 | 91 | |
@@ -87,8 +94,10 @@ discard block |
||
| 87 | 94 | * |
| 88 | 95 | *@return string tiltle |
| 89 | 96 | */ |
| 90 | - public function get_title() { |
|
| 91 | - if (empty($this->record)) { |
|
| 97 | + public function get_title() |
|
| 98 | + { |
|
| 99 | + if (empty($this->record)) |
|
| 100 | + { |
|
| 92 | 101 | $this->get_record(); |
| 93 | 102 | } |
| 94 | 103 | return $this->record['title']; |
@@ -100,7 +109,8 @@ discard block |
||
| 100 | 109 | * @todo add some checks |
| 101 | 110 | * @return void |
| 102 | 111 | */ |
| 103 | - public function set_record(array $_record){ |
|
| 112 | + public function set_record(array $_record) |
|
| 113 | + { |
|
| 104 | 114 | $this->record = $_record; |
| 105 | 115 | } |
| 106 | 116 | |
@@ -109,7 +119,8 @@ discard block |
||
| 109 | 119 | * |
| 110 | 120 | * @return string identifier of current record |
| 111 | 121 | */ |
| 112 | - public function get_identifier() { |
|
| 122 | + public function get_identifier() |
|
| 123 | + { |
|
| 113 | 124 | return $this->identifier; |
| 114 | 125 | } |
| 115 | 126 | |
@@ -119,7 +130,8 @@ discard block |
||
| 119 | 130 | * |
| 120 | 131 | * @return string Full URL of an icon, or appname/icon_name |
| 121 | 132 | */ |
| 122 | - public function get_icon() { |
|
| 133 | + public function get_icon() |
|
| 134 | + { |
|
| 123 | 135 | return 'calendar/navbar'; |
| 124 | 136 | } |
| 125 | 137 | |
@@ -128,7 +140,8 @@ discard block |
||
| 128 | 140 | * |
| 129 | 141 | * @return string identifier |
| 130 | 142 | */ |
| 131 | - public function save ( $_dst_identifier ) { |
|
| 143 | + public function save ( $_dst_identifier ) |
|
| 144 | + { |
|
| 132 | 145 | // Not yet implemeted |
| 133 | 146 | $this->identifier = $_dst_identifier; |
| 134 | 147 | } |
@@ -139,7 +152,8 @@ discard block |
||
| 139 | 152 | * @param string $_dst_identifier |
| 140 | 153 | * @return string dst_identifier |
| 141 | 154 | */ |
| 142 | - public function copy ( $_dst_identifier ) { |
|
| 155 | + public function copy ( $_dst_identifier ) |
|
| 156 | + { |
|
| 143 | 157 | unset($_dst_identifier); // not used |
| 144 | 158 | } |
| 145 | 159 | |
@@ -150,7 +164,8 @@ discard block |
||
| 150 | 164 | * @param string $_dst_identifier |
| 151 | 165 | * @return string dst_identifier |
| 152 | 166 | */ |
| 153 | - public function move ( $_dst_identifier ) { |
|
| 167 | + public function move ( $_dst_identifier ) |
|
| 168 | + { |
|
| 154 | 169 | unset($_dst_identifier); // not used |
| 155 | 170 | } |
| 156 | 171 | |
@@ -158,7 +173,8 @@ discard block |
||
| 158 | 173 | * delets current record from backend |
| 159 | 174 | * |
| 160 | 175 | */ |
| 161 | - public function delete () { |
|
| 176 | + public function delete () |
|
| 177 | + { |
|
| 162 | 178 | |
| 163 | 179 | } |
| 164 | 180 | |
@@ -166,7 +182,8 @@ discard block |
||
| 166 | 182 | * destructor |
| 167 | 183 | * |
| 168 | 184 | */ |
| 169 | - public function __destruct() { |
|
| 185 | + public function __destruct() |
|
| 186 | + { |
|
| 170 | 187 | } |
| 171 | 188 | |
| 172 | 189 | } |
| 173 | 190 | \ No newline at end of file |