@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | $owner[count($owner)] = $GLOBALS['egw_setup']->oProc->f($field); |
| 22 | 22 | } |
| 23 | - if($GLOBALS['egw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'],'0.9.10pre4')) |
|
| 23 | + if ($GLOBALS['egw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'], '0.9.10pre4')) |
|
| 24 | 24 | { |
| 25 | 25 | $acctstbl = 'accounts'; |
| 26 | 26 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $acctstbl = 'phpgw_accounts'; |
| 30 | 30 | } |
| 31 | - for($i=0;$i<count($owner);$i++) |
|
| 31 | + for ($i = 0; $i < count($owner); $i++) |
|
| 32 | 32 | { |
| 33 | 33 | $GLOBALS['egw_setup']->oProc->query("SELECT account_id FROM $acctstbl WHERE account_lid='".$owner[$i]."'"); |
| 34 | 34 | $GLOBALS['egw_setup']->oProc->next_record(); |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | function calendar_upgrade0_9_3pre1() |
| 43 | 43 | { |
| 44 | - calendar_v0_9_2to0_9_3update_owner('webcal_entry','cal_create_by'); |
|
| 45 | - calendar_v0_9_2to0_9_3update_owner('webcal_entry_user','cal_login'); |
|
| 44 | + calendar_v0_9_2to0_9_3update_owner('webcal_entry', 'cal_create_by'); |
|
| 45 | + calendar_v0_9_2to0_9_3update_owner('webcal_entry_user', 'cal_login'); |
|
| 46 | 46 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre2'; |
| 47 | 47 | return $GLOBALS['setup_info']['calendar']['currentver']; |
| 48 | 48 | } |
@@ -209,12 +209,12 @@ discard block |
||
| 209 | 209 | ) |
| 210 | 210 | ); |
| 211 | 211 | |
| 212 | - $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry',__LINE__,__FILE__); |
|
| 212 | + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry', __LINE__, __FILE__); |
|
| 213 | 213 | $GLOBALS['egw_setup']->oProc->next_record(); |
| 214 | - if($GLOBALS['egw_setup']->oProc->f(0)) |
|
| 214 | + if ($GLOBALS['egw_setup']->oProc->f(0)) |
|
| 215 | 215 | { |
| 216 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_owner,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description,cal_id,cal_date,cal_time,cal_mod_date,cal_mod_time FROM webcal_entry ORDER BY cal_id',__LINE__,__FILE__); |
|
| 217 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 216 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_owner,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description,cal_id,cal_date,cal_time,cal_mod_date,cal_mod_time FROM webcal_entry ORDER BY cal_id', __LINE__, __FILE__); |
|
| 217 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 218 | 218 | { |
| 219 | 219 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
| 220 | 220 | $cal_owner = $GLOBALS['egw_setup']->oProc->f('cal_owner'); |
@@ -224,13 +224,13 @@ discard block |
||
| 224 | 224 | $cal_access = $GLOBALS['egw_setup']->oProc->f('cal_access'); |
| 225 | 225 | $cal_name = $GLOBALS['egw_setup']->oProc->f('cal_name'); |
| 226 | 226 | $cal_description = $GLOBALS['egw_setup']->oProc->f('cal_description'); |
| 227 | - $datetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')),4))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')),2,2))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')),0,2))),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'),4,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'),6,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'),0,4))); |
|
| 228 | - $moddatetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')),4))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')),2,2))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')),0,2))),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'),4,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'),6,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'),0,4))); |
|
| 229 | - $db2->query('SELECT groups FROM webcal_entry_groups WHERE cal_id='.$cal_id,__LINE__,__FILE__); |
|
| 227 | + $datetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')), 4))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')), 2, 2))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')), 0, 2))), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'), 4, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'), 6, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'), 0, 4))); |
|
| 228 | + $moddatetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')), 4))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')), 2, 2))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')), 0, 2))), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'), 4, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'), 6, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'), 0, 4))); |
|
| 229 | + $db2->query('SELECT groups FROM webcal_entry_groups WHERE cal_id='.$cal_id, __LINE__, __FILE__); |
|
| 230 | 230 | $db2->next_record(); |
| 231 | 231 | $cal_group = $db2->f('groups'); |
| 232 | 232 | $db2->query('INSERT INTO calendar_entry(cal_id,cal_owner,cal_group,cal_datetime,cal_mdatetime,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description) ' |
| 233 | - .'VALUES('.$cal_id.",'".$cal_owner."','".$cal_group."',".$datetime.",".$moddatetime.",".$cal_duration.",".$cal_priority.",'".$cal_type."','".$cal_access."','".$cal_name."','".$cal_description."')",__LINE__,__FILE__); |
|
| 233 | + .'VALUES('.$cal_id.",'".$cal_owner."','".$cal_group."',".$datetime.",".$moddatetime.",".$cal_duration.",".$cal_priority.",'".$cal_type."','".$cal_access."','".$cal_name."','".$cal_description."')", __LINE__, __FILE__); |
|
| 234 | 234 | } |
| 235 | 235 | } |
| 236 | 236 | |
@@ -251,17 +251,17 @@ discard block |
||
| 251 | 251 | ) |
| 252 | 252 | ); |
| 253 | 253 | |
| 254 | - $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_user',__LINE__,__FILE__); |
|
| 254 | + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_user', __LINE__, __FILE__); |
|
| 255 | 255 | $GLOBALS['egw_setup']->oProc->next_record(); |
| 256 | - if($GLOBALS['egw_setup']->oProc->f(0)) |
|
| 256 | + if ($GLOBALS['egw_setup']->oProc->f(0)) |
|
| 257 | 257 | { |
| 258 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_login,cal_status FROM webcal_entry_user ORDER BY cal_id',__LINE__,__FILE__); |
|
| 259 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 258 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_login,cal_status FROM webcal_entry_user ORDER BY cal_id', __LINE__, __FILE__); |
|
| 259 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 260 | 260 | { |
| 261 | 261 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
| 262 | 262 | $cal_login = $GLOBALS['egw_setup']->oProc->f('cal_login'); |
| 263 | 263 | $cal_status = $GLOBALS['egw_setup']->oProc->f('cal_status'); |
| 264 | - $db2->query('INSERT INTO calendar_entry_user(cal_id,cal_login,cal_status) VALUES('.$cal_id.','.$cal_login.",'".$cal_status."')",__LINE__,__FILE__); |
|
| 264 | + $db2->query('INSERT INTO calendar_entry_user(cal_id,cal_login,cal_status) VALUES('.$cal_id.','.$cal_login.",'".$cal_status."')", __LINE__, __FILE__); |
|
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | |
@@ -284,18 +284,18 @@ discard block |
||
| 284 | 284 | ) |
| 285 | 285 | ); |
| 286 | 286 | |
| 287 | - $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_repeats',__LINE__,__FILE__); |
|
| 287 | + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_repeats', __LINE__, __FILE__); |
|
| 288 | 288 | $GLOBALS['egw_setup']->oProc->next_record(); |
| 289 | - if($GLOBALS['egw_setup']->oProc->f(0)) |
|
| 289 | + if ($GLOBALS['egw_setup']->oProc->f(0)) |
|
| 290 | 290 | { |
| 291 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_type,cal_end,cal_frequency,cal_days FROM webcal_entry_repeats ORDER BY cal_id',__LINE__,__FILE__); |
|
| 292 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 291 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_type,cal_end,cal_frequency,cal_days FROM webcal_entry_repeats ORDER BY cal_id', __LINE__, __FILE__); |
|
| 292 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 293 | 293 | { |
| 294 | 294 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
| 295 | 295 | $cal_type = $GLOBALS['egw_setup']->oProc->f('cal_type'); |
| 296 | - if(isset($GLOBALS['egw_setup']->oProc->Record['cal_end'])) |
|
| 296 | + if (isset($GLOBALS['egw_setup']->oProc->Record['cal_end'])) |
|
| 297 | 297 | { |
| 298 | - $enddate = mktime(0,0,0,intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'),4,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'),6,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'),0,4))); |
|
| 298 | + $enddate = mktime(0, 0, 0, intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'), 4, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'), 6, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'), 0, 4))); |
|
| 299 | 299 | $useend = 1; |
| 300 | 300 | } |
| 301 | 301 | else |
@@ -305,12 +305,12 @@ discard block |
||
| 305 | 305 | } |
| 306 | 306 | $cal_frequency = $GLOBALS['egw_setup']->oProc->f('cal_frequency'); |
| 307 | 307 | $cal_days = $GLOBALS['egw_setup']->oProc->f('cal_days'); |
| 308 | - $db2->query('INSERT INTO calendar_entry_repeats(cal_id,cal_type,cal_use_end,cal_end,cal_frequency,cal_days) VALUES('.$cal_id.",'".$cal_type."',".$useend.",".$enddate.",".$cal_frequency.",'".$cal_days."')",__LINE__,__FILE__); |
|
| 308 | + $db2->query('INSERT INTO calendar_entry_repeats(cal_id,cal_type,cal_use_end,cal_end,cal_frequency,cal_days) VALUES('.$cal_id.",'".$cal_type."',".$useend.",".$enddate.",".$cal_frequency.",'".$cal_days."')", __LINE__, __FILE__); |
|
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | $GLOBALS['egw_setup']->oProc->DropTable('webcal_entry_repeats'); |
| 313 | - $GLOBALS['egw_setup']->oProc->query("UPDATE {$GLOBALS['egw_setup']->applications_table} SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'",__LINE__,__FILE__); |
|
| 313 | + $GLOBALS['egw_setup']->oProc->query("UPDATE {$GLOBALS['egw_setup']->applications_table} SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'", __LINE__, __FILE__); |
|
| 314 | 314 | |
| 315 | 315 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.7pre2'; |
| 316 | 316 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -322,19 +322,19 @@ discard block |
||
| 322 | 322 | $db2 = $GLOBALS['egw_setup']->db; |
| 323 | 323 | |
| 324 | 324 | $GLOBALS['egw_setup']->oProc->RenameColumn('calendar_entry', 'cal_duration', 'cal_edatetime'); |
| 325 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_datetime,cal_owner,cal_edatetime,cal_mdatetime FROM calendar_entry ORDER BY cal_id',__LINE__,__FILE__); |
|
| 326 | - if($GLOBALS['egw_setup']->oProc->num_rows()) |
|
| 325 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_datetime,cal_owner,cal_edatetime,cal_mdatetime FROM calendar_entry ORDER BY cal_id', __LINE__, __FILE__); |
|
| 326 | + if ($GLOBALS['egw_setup']->oProc->num_rows()) |
|
| 327 | 327 | { |
| 328 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 328 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 329 | 329 | { |
| 330 | - $db2->query("SELECT preference_value FROM preferences WHERE preference_name='tz_offset' AND preference_appname='common' AND preference_owner=".$GLOBALS['egw_setup']->db->f('cal_owner'),__LINE__,__FILE__); |
|
| 330 | + $db2->query("SELECT preference_value FROM preferences WHERE preference_name='tz_offset' AND preference_appname='common' AND preference_owner=".$GLOBALS['egw_setup']->db->f('cal_owner'), __LINE__, __FILE__); |
|
| 331 | 331 | $db2->next_record(); |
| 332 | 332 | $tz = $db2->f('preference_value'); |
| 333 | 333 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
| 334 | 334 | $datetime = $GLOBALS['egw_setup']->oProc->f('cal_datetime') - ((60 * 60) * $tz); |
| 335 | 335 | $mdatetime = $GLOBALS['egw_setup']->oProc->f('cal_mdatetime') - ((60 * 60) * $tz); |
| 336 | 336 | $edatetime = $datetime + (60 * $GLOBALS['egw_setup']->oProc->f('cal_edatetime')); |
| 337 | - $db2->query('UPDATE calendar_entry SET cal_datetime='.$datetime.', cal_edatetime='.$edatetime.', cal_mdatetime='.$mdatetime.' WHERE cal_id='.$cal_id,__LINE__,__FILE__); |
|
| 337 | + $db2->query('UPDATE calendar_entry SET cal_datetime='.$datetime.', cal_edatetime='.$edatetime.', cal_mdatetime='.$mdatetime.' WHERE cal_id='.$cal_id, __LINE__, __FILE__); |
|
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 | |
@@ -582,22 +582,22 @@ discard block |
||
| 582 | 582 | { |
| 583 | 583 | $db2 = $GLOBALS['egw_setup']->db; |
| 584 | 584 | |
| 585 | - if(extension_loaded('mcal') == False) |
|
| 585 | + if (extension_loaded('mcal') == False) |
|
| 586 | 586 | { |
| 587 | - define(RECUR_NONE,0); |
|
| 588 | - define(RECUR_DAILY,1); |
|
| 589 | - define(RECUR_WEEKLY,2); |
|
| 590 | - define(RECUR_MONTHLY_MDAY,3); |
|
| 591 | - define(RECUR_MONTHLY_WDAY,4); |
|
| 592 | - define(RECUR_YEARLY,5); |
|
| 593 | - |
|
| 594 | - define(M_SUNDAY,1); |
|
| 595 | - define(M_MONDAY,2); |
|
| 596 | - define(M_TUESDAY,4); |
|
| 597 | - define(M_WEDNESDAY,8); |
|
| 598 | - define(M_THURSDAY,16); |
|
| 599 | - define(M_FRIDAY,32); |
|
| 600 | - define(M_SATURDAY,64); |
|
| 587 | + define(RECUR_NONE, 0); |
|
| 588 | + define(RECUR_DAILY, 1); |
|
| 589 | + define(RECUR_WEEKLY, 2); |
|
| 590 | + define(RECUR_MONTHLY_MDAY, 3); |
|
| 591 | + define(RECUR_MONTHLY_WDAY, 4); |
|
| 592 | + define(RECUR_YEARLY, 5); |
|
| 593 | + |
|
| 594 | + define(M_SUNDAY, 1); |
|
| 595 | + define(M_MONDAY, 2); |
|
| 596 | + define(M_TUESDAY, 4); |
|
| 597 | + define(M_WEDNESDAY, 8); |
|
| 598 | + define(M_THURSDAY, 16); |
|
| 599 | + define(M_FRIDAY, 32); |
|
| 600 | + define(M_SATURDAY, 64); |
|
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | // calendar_entry => phpgw_cal |
@@ -624,13 +624,13 @@ discard block |
||
| 624 | 624 | ) |
| 625 | 625 | ); |
| 626 | 626 | |
| 627 | - $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry',__LINE__,__FILE__); |
|
| 628 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 627 | + $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry', __LINE__, __FILE__); |
|
| 628 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 629 | 629 | { |
| 630 | 630 | $id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
| 631 | 631 | $owner = $GLOBALS['egw_setup']->oProc->f('cal_owner'); |
| 632 | 632 | $access = $GLOBALS['egw_setup']->oProc->f('cal_access'); |
| 633 | - switch($access) |
|
| 633 | + switch ($access) |
|
| 634 | 634 | { |
| 635 | 635 | case 'private': |
| 636 | 636 | $is_public = 0; |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | $description = $GLOBALS['egw_setup']->oProc->f('cal_description'); |
| 653 | 653 | |
| 654 | 654 | $db2->query("INSERT INTO phpgw_cal(cal_id,owner,groups,datetime,mdatetime,edatetime,priority,cal_type,is_public,title,description) " |
| 655 | - . "VALUES($id,$owner,'$groups',$datetime,$mdatetime,$edatetime,$priority,'$type',$is_public,'$title','$description')",__LINE__,__FILE__); |
|
| 655 | + . "VALUES($id,$owner,'$groups',$datetime,$mdatetime,$edatetime,$priority,'$type',$is_public,'$title','$description')", __LINE__, __FILE__); |
|
| 656 | 656 | } |
| 657 | 657 | $GLOBALS['egw_setup']->oProc->DropTable('calendar_entry'); |
| 658 | 658 | |
@@ -660,12 +660,12 @@ discard block |
||
| 660 | 660 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_repeats', |
| 661 | 661 | Array( |
| 662 | 662 | 'fd' => array( |
| 663 | - 'cal_id' => array('type' => 'int', 'precision' => 8,'nullable' => False), |
|
| 664 | - 'recur_type' => array('type' => 'int', 'precision' => 8,'nullable' => False), |
|
| 665 | - 'recur_use_end' => array('type' => 'int', 'precision' => 8,'nullable' => True), |
|
| 666 | - 'recur_enddate' => array('type' => 'int', 'precision' => 8,'nullable' => True), |
|
| 667 | - 'recur_interval' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1'), |
|
| 668 | - 'recur_data' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1') |
|
| 663 | + 'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
|
| 664 | + 'recur_type' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
|
| 665 | + 'recur_use_end' => array('type' => 'int', 'precision' => 8, 'nullable' => True), |
|
| 666 | + 'recur_enddate' => array('type' => 'int', 'precision' => 8, 'nullable' => True), |
|
| 667 | + 'recur_interval' => array('type' => 'int', 'precision' => 8, 'nullable' => True, 'default' => '1'), |
|
| 668 | + 'recur_data' => array('type' => 'int', 'precision' => 8, 'nullable' => True, 'default' => '1') |
|
| 669 | 669 | ), |
| 670 | 670 | 'pk' => array(), |
| 671 | 671 | 'fk' => array(), |
@@ -673,12 +673,12 @@ discard block |
||
| 673 | 673 | 'uc' => array() |
| 674 | 674 | ) |
| 675 | 675 | ); |
| 676 | - $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry_repeats',__LINE__,__FILE__); |
|
| 677 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 676 | + $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry_repeats', __LINE__, __FILE__); |
|
| 677 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 678 | 678 | { |
| 679 | 679 | $id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
| 680 | 680 | $recur_type = $GLOBALS['egw_setup']->oProc->f('cal_type'); |
| 681 | - switch($recur_type) |
|
| 681 | + switch ($recur_type) |
|
| 682 | 682 | { |
| 683 | 683 | case 'daily': |
| 684 | 684 | $recur_type_num = RECUR_DAILY; |
@@ -701,20 +701,20 @@ discard block |
||
| 701 | 701 | $recur_interval = $GLOBALS['egw_setup']->oProc->f('cal_frequency'); |
| 702 | 702 | $days = strtoupper($GLOBALS['egw_setup']->oProc->f('cal_days')); |
| 703 | 703 | $recur_data = 0; |
| 704 | - $recur_data += (substr($days,0,1)=='Y'?M_SUNDAY:0); |
|
| 705 | - $recur_data += (substr($days,1,1)=='Y'?M_MONDAY:0); |
|
| 706 | - $recur_data += (substr($days,2,1)=='Y'?M_TUESDAY:0); |
|
| 707 | - $recur_data += (substr($days,3,1)=='Y'?M_WEDNESDAY:0); |
|
| 708 | - $recur_data += (substr($days,4,1)=='Y'?M_THURSDAY:0); |
|
| 709 | - $recur_data += (substr($days,5,1)=='Y'?M_FRIDAY:0); |
|
| 710 | - $recur_data += (substr($days,6,1)=='Y'?M_SATURDAY:0); |
|
| 704 | + $recur_data += (substr($days, 0, 1) == 'Y' ?M_SUNDAY:0); |
|
| 705 | + $recur_data += (substr($days, 1, 1) == 'Y' ?M_MONDAY:0); |
|
| 706 | + $recur_data += (substr($days, 2, 1) == 'Y' ?M_TUESDAY:0); |
|
| 707 | + $recur_data += (substr($days, 3, 1) == 'Y' ?M_WEDNESDAY:0); |
|
| 708 | + $recur_data += (substr($days, 4, 1) == 'Y' ?M_THURSDAY:0); |
|
| 709 | + $recur_data += (substr($days, 5, 1) == 'Y' ?M_FRIDAY:0); |
|
| 710 | + $recur_data += (substr($days, 6, 1) == 'Y' ?M_SATURDAY:0); |
|
| 711 | 711 | $db2->query("INSERT INTO phpgw_cal_repeats(cal_id,recur_type,recur_use_end,recur_enddate,recur_interval,recur_data) " |
| 712 | - . "VALUES($id,$recur_type_num,$recur_use_end,$recur_end,$recur_interval,$recur_data)",__LINE__,__FILE__); |
|
| 712 | + . "VALUES($id,$recur_type_num,$recur_use_end,$recur_end,$recur_interval,$recur_data)", __LINE__, __FILE__); |
|
| 713 | 713 | } |
| 714 | 714 | $GLOBALS['egw_setup']->oProc->DropTable('calendar_entry_repeats'); |
| 715 | 715 | |
| 716 | 716 | // calendar_entry_user => phpgw_cal_user |
| 717 | - $GLOBALS['egw_setup']->oProc->RenameTable('calendar_entry_user','phpgw_cal_user'); |
|
| 717 | + $GLOBALS['egw_setup']->oProc->RenameTable('calendar_entry_user', 'phpgw_cal_user'); |
|
| 718 | 718 | |
| 719 | 719 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.002'; |
| 720 | 720 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -733,11 +733,11 @@ discard block |
||
| 733 | 733 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', |
| 734 | 734 | Array( |
| 735 | 735 | 'fd' => array( |
| 736 | - 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), |
|
| 737 | - 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), |
|
| 738 | - 'date_time' => array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0') |
|
| 736 | + 'locale' => array('type' => 'char', 'precision' => 2, 'nullable' => False), |
|
| 737 | + 'name' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False), |
|
| 738 | + 'date_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0') |
|
| 739 | 739 | ), |
| 740 | - 'pk' => array('locale','name'), |
|
| 740 | + 'pk' => array('locale', 'name'), |
|
| 741 | 741 | 'fk' => array(), |
| 742 | 742 | 'ix' => array(), |
| 743 | 743 | 'uc' => array() |
@@ -769,10 +769,10 @@ discard block |
||
| 769 | 769 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', |
| 770 | 770 | Array( |
| 771 | 771 | 'fd' => array( |
| 772 | - 'hol_id' => array('type' => 'auto','nullable' => False), |
|
| 773 | - 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), |
|
| 774 | - 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), |
|
| 775 | - 'date_time' => array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0') |
|
| 772 | + 'hol_id' => array('type' => 'auto', 'nullable' => False), |
|
| 773 | + 'locale' => array('type' => 'char', 'precision' => 2, 'nullable' => False), |
|
| 774 | + 'name' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False), |
|
| 775 | + 'date_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0') |
|
| 776 | 776 | ), |
| 777 | 777 | 'pk' => array('hol_id'), |
| 778 | 778 | 'fk' => array(), |
@@ -789,10 +789,10 @@ discard block |
||
| 789 | 789 | function calendar_upgrade0_9_11_007() |
| 790 | 790 | { |
| 791 | 791 | $GLOBALS['egw_setup']->oProc->query('DELETE FROM phpgw_cal_holidays'); |
| 792 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','mday',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
| 793 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','month_num',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
| 794 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','occurence',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
| 795 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','dow',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
| 792 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'mday', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
| 793 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'month_num', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
| 794 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'occurence', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
| 795 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'dow', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
| 796 | 796 | |
| 797 | 797 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.008'; |
| 798 | 798 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | function calendar_upgrade0_9_11_009() |
| 810 | 810 | { |
| 811 | 811 | $GLOBALS['egw_setup']->oProc->query('DELETE FROM phpgw_cal_holidays'); |
| 812 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','observance_rule',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
| 812 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'observance_rule', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
| 813 | 813 | |
| 814 | 814 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.010'; |
| 815 | 815 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -844,7 +844,7 @@ discard block |
||
| 844 | 844 | |
| 845 | 845 | function calendar_upgrade0_9_13_002() |
| 846 | 846 | { |
| 847 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','reference',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
| 847 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'reference', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
| 848 | 848 | |
| 849 | 849 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.003'; |
| 850 | 850 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -856,7 +856,7 @@ discard block |
||
| 856 | 856 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_alarm', |
| 857 | 857 | Array( |
| 858 | 858 | 'fd' => array( |
| 859 | - 'alarm_id' => array('type' => 'auto','nullable' => False), |
|
| 859 | + 'alarm_id' => array('type' => 'auto', 'nullable' => False), |
|
| 860 | 860 | 'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
| 861 | 861 | 'cal_owner' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
| 862 | 862 | 'cal_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
@@ -869,8 +869,8 @@ discard block |
||
| 869 | 869 | ) |
| 870 | 870 | ); |
| 871 | 871 | |
| 872 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','uid',array('type' => 'varchar', 'precision' => 255,'nullable' => False)); |
|
| 873 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','location',array('type' => 'varchar', 'precision' => 255,'nullable' => True)); |
|
| 872 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'uid', array('type' => 'varchar', 'precision' => 255, 'nullable' => False)); |
|
| 873 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'location', array('type' => 'varchar', 'precision' => 255, 'nullable' => True)); |
|
| 874 | 874 | |
| 875 | 875 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.004'; |
| 876 | 876 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -879,7 +879,7 @@ discard block |
||
| 879 | 879 | |
| 880 | 880 | function calendar_upgrade0_9_13_004() |
| 881 | 881 | { |
| 882 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_alarm','alarm_enabled',array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => '1')); |
|
| 882 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_alarm', 'alarm_enabled', array('type' => 'int', 'precision' => 4, 'nullable' => False, 'default' => '1')); |
|
| 883 | 883 | |
| 884 | 884 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.005'; |
| 885 | 885 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -889,18 +889,18 @@ discard block |
||
| 889 | 889 | function calendar_upgrade0_9_13_005() |
| 890 | 890 | { |
| 891 | 891 | $calendar_data = Array(); |
| 892 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal',__LINE__,__FILE__); |
|
| 893 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 892 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal', __LINE__, __FILE__); |
|
| 893 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 894 | 894 | { |
| 895 | 895 | $calendar_data[$GLOBALS['egw_setup']->oProc->f('cal_id')] = $GLOBALS['egw_setup']->oProc->f('category'); |
| 896 | 896 | } |
| 897 | 897 | |
| 898 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal','category',array('type' => 'varchar', 'precision' => 30,'nullable' => True)); |
|
| 898 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal', 'category', array('type' => 'varchar', 'precision' => 30, 'nullable' => True)); |
|
| 899 | 899 | |
| 900 | 900 | @reset($calendar_data); |
| 901 | - while($calendar_data && list($cal_id,$category) = each($calendar_data)) |
|
| 901 | + while ($calendar_data && list($cal_id, $category) = each($calendar_data)) |
|
| 902 | 902 | { |
| 903 | - $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_cal SET category='".$category."' WHERE cal_id=".$cal_id,__LINE__,__FILE__); |
|
| 903 | + $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_cal SET category='".$category."' WHERE cal_id=".$cal_id, __LINE__, __FILE__); |
|
| 904 | 904 | } |
| 905 | 905 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.006'; |
| 906 | 906 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -909,7 +909,7 @@ discard block |
||
| 909 | 909 | |
| 910 | 910 | function calendar_upgrade0_9_13_006() |
| 911 | 911 | { |
| 912 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_repeats','recur_exception',array('type' => 'varchar', 'precision' => 255, 'nullable' => True, 'default' => '')); |
|
| 912 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_repeats', 'recur_exception', array('type' => 'varchar', 'precision' => 255, 'nullable' => True, 'default' => '')); |
|
| 913 | 913 | |
| 914 | 914 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.007'; |
| 915 | 915 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -919,20 +919,20 @@ discard block |
||
| 919 | 919 | |
| 920 | 920 | function calendar_upgrade0_9_13_007() |
| 921 | 921 | { |
| 922 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_user','cal_type',array( |
|
| 922 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_user', 'cal_type', array( |
|
| 923 | 923 | 'type' => 'varchar', |
| 924 | 924 | 'precision' => '1', |
| 925 | 925 | 'nullable' => False, |
| 926 | 926 | 'default' => 'u' |
| 927 | 927 | )); |
| 928 | 928 | |
| 929 | - $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_extra',array( |
|
| 929 | + $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_extra', array( |
|
| 930 | 930 | 'fd' => array( |
| 931 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
| 932 | - 'cal_extra_name' => array('type' => 'varchar','precision' => '40','nullable' => False), |
|
| 933 | - 'cal_extra_value' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '') |
|
| 931 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
| 932 | + 'cal_extra_name' => array('type' => 'varchar', 'precision' => '40', 'nullable' => False), |
|
| 933 | + 'cal_extra_value' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '') |
|
| 934 | 934 | ), |
| 935 | - 'pk' => array('cal_id','cal_extra_name'), |
|
| 935 | + 'pk' => array('cal_id', 'cal_extra_name'), |
|
| 936 | 936 | 'fk' => array(), |
| 937 | 937 | 'ix' => array(), |
| 938 | 938 | 'uc' => array() |
@@ -949,7 +949,7 @@ discard block |
||
| 949 | 949 | function calendar_upgrade0_9_16_001() |
| 950 | 950 | { |
| 951 | 951 | // this is to set the default as schema_proc was not setting an empty default |
| 952 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal_user','cal_type',array( |
|
| 952 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal_user', 'cal_type', array( |
|
| 953 | 953 | 'type' => 'varchar', |
| 954 | 954 | 'precision' => '1', |
| 955 | 955 | 'nullable' => False, |
@@ -966,15 +966,15 @@ discard block |
||
| 966 | 966 | |
| 967 | 967 | function calendar_upgrade0_9_16_002() |
| 968 | 968 | { |
| 969 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats',array( |
|
| 969 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats', array( |
|
| 970 | 970 | 'fd' => array( |
| 971 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 972 | - 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 973 | - 'recur_use_end' => array('type' => 'int','precision' => '8','default' => '0'), |
|
| 974 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
| 975 | - 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), |
|
| 976 | - 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), |
|
| 977 | - 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') |
|
| 971 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 972 | + 'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 973 | + 'recur_use_end' => array('type' => 'int', 'precision' => '8', 'default' => '0'), |
|
| 974 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
| 975 | + 'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
| 976 | + 'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
| 977 | + 'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '') |
|
| 978 | 978 | ), |
| 979 | 979 | 'pk' => array(), |
| 980 | 980 | 'fk' => array(), |
@@ -990,14 +990,14 @@ discard block |
||
| 990 | 990 | |
| 991 | 991 | function calendar_upgrade0_9_16_003() |
| 992 | 992 | { |
| 993 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_user',array( |
|
| 993 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_user', array( |
|
| 994 | 994 | 'fd' => array( |
| 995 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
| 996 | - 'cal_login' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
| 997 | - 'cal_status' => array('type' => 'char','precision' => '1','default' => 'A'), |
|
| 998 | - 'cal_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u') |
|
| 995 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
| 996 | + 'cal_login' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
| 997 | + 'cal_status' => array('type' => 'char', 'precision' => '1', 'default' => 'A'), |
|
| 998 | + 'cal_type' => array('type' => 'varchar', 'precision' => '1', 'nullable' => False, 'default' => 'u') |
|
| 999 | 999 | ), |
| 1000 | - 'pk' => array('cal_id','cal_login','cal_type'), |
|
| 1000 | + 'pk' => array('cal_id', 'cal_login', 'cal_type'), |
|
| 1001 | 1001 | 'fk' => array(), |
| 1002 | 1002 | 'ix' => array(), |
| 1003 | 1003 | 'uc' => array() |
@@ -1011,16 +1011,16 @@ discard block |
||
| 1011 | 1011 | |
| 1012 | 1012 | function calendar_upgrade0_9_16_004() |
| 1013 | 1013 | { |
| 1014 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_holidays',array( |
|
| 1014 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_holidays', array( |
|
| 1015 | 1015 | 'fd' => array( |
| 1016 | - 'hol_id' => array('type' => 'auto','nullable' => False), |
|
| 1017 | - 'locale' => array('type' => 'char','precision' => '2','nullable' => False), |
|
| 1018 | - 'name' => array('type' => 'varchar','precision' => '50','nullable' => False), |
|
| 1019 | - 'mday' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
| 1020 | - 'month_num' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
| 1021 | - 'occurence' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
| 1022 | - 'dow' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
| 1023 | - 'observance_rule' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
| 1016 | + 'hol_id' => array('type' => 'auto', 'nullable' => False), |
|
| 1017 | + 'locale' => array('type' => 'char', 'precision' => '2', 'nullable' => False), |
|
| 1018 | + 'name' => array('type' => 'varchar', 'precision' => '50', 'nullable' => False), |
|
| 1019 | + 'mday' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
| 1020 | + 'month_num' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
| 1021 | + 'occurence' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
| 1022 | + 'dow' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
| 1023 | + 'observance_rule' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
| 1024 | 1024 | ), |
| 1025 | 1025 | 'pk' => array('hol_id'), |
| 1026 | 1026 | 'fk' => array(), |
@@ -1038,13 +1038,13 @@ discard block |
||
| 1038 | 1038 | { |
| 1039 | 1039 | // creates uid's for all entries which do not have unique ones, they are '[email protected]' |
| 1040 | 1040 | // very old entries even have an empty uid, see 0.9.16.006 update |
| 1041 | - $GLOBALS['egw_setup']->oProc->query("SELECT config_name,config_value FROM {$GLOBALS['egw_setup']->config_table} WHERE config_name IN ('install_id','mail_suffix') AND config_app='phpgwapi'",__LINE__,__FILE__); |
|
| 1041 | + $GLOBALS['egw_setup']->oProc->query("SELECT config_name,config_value FROM {$GLOBALS['egw_setup']->config_table} WHERE config_name IN ('install_id','mail_suffix') AND config_app='phpgwapi'", __LINE__, __FILE__); |
|
| 1042 | 1042 | while ($GLOBALS['egw_setup']->oProc->next_record()) |
| 1043 | 1043 | { |
| 1044 | 1044 | $config[$GLOBALS['egw_setup']->oProc->f(0)] = $GLOBALS['egw_setup']->oProc->f(1); |
| 1045 | 1045 | } |
| 1046 | 1046 | $GLOBALS['egw_setup']->oProc->query('UPDATE phpgw_cal SET uid='. |
| 1047 | - $GLOBALS['egw_setup']->db->concat($GLOBALS['egw_setup']->db->quote('cal-'),'cal_id', |
|
| 1047 | + $GLOBALS['egw_setup']->db->concat($GLOBALS['egw_setup']->db->quote('cal-'), 'cal_id', |
|
| 1048 | 1048 | $GLOBALS['egw_setup']->db->quote('-'.$config['install_id'].'@'. |
| 1049 | 1049 | ($config['mail_suffix'] ? $config['mail_suffix'] : 'local'))). |
| 1050 | 1050 | " WHERE uid LIKE '-@%' OR uid=''"); |
@@ -1067,7 +1067,7 @@ discard block |
||
| 1067 | 1067 | function calendar_upgrade0_9_16_007() |
| 1068 | 1068 | { |
| 1069 | 1069 | // update the sequenzes for refreshed tables (postgres only) |
| 1070 | - $GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_cal_holidays','hol_id'); |
|
| 1070 | + $GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_cal_holidays', 'hol_id'); |
|
| 1071 | 1071 | |
| 1072 | 1072 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0'; |
| 1073 | 1073 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1077,19 +1077,19 @@ discard block |
||
| 1077 | 1077 | |
| 1078 | 1078 | function calendar_upgrade1_0_0() |
| 1079 | 1079 | { |
| 1080 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','uid','cal_uid'); |
|
| 1081 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','owner','cal_owner'); |
|
| 1082 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','category','cal_category'); |
|
| 1083 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','groups','cal_groups'); |
|
| 1084 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','datetime','cal_starttime'); |
|
| 1085 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','mdatetime','cal_modified'); |
|
| 1086 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','edatetime','cal_endtime'); |
|
| 1087 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','priority','cal_priority'); |
|
| 1088 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','is_public','cal_public'); |
|
| 1089 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','title','cal_title'); |
|
| 1090 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','description','cal_description'); |
|
| 1091 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','location','cal_location'); |
|
| 1092 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','reference','cal_reference'); |
|
| 1080 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'uid', 'cal_uid'); |
|
| 1081 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'owner', 'cal_owner'); |
|
| 1082 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'category', 'cal_category'); |
|
| 1083 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'groups', 'cal_groups'); |
|
| 1084 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'datetime', 'cal_starttime'); |
|
| 1085 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'mdatetime', 'cal_modified'); |
|
| 1086 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'edatetime', 'cal_endtime'); |
|
| 1087 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'priority', 'cal_priority'); |
|
| 1088 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'is_public', 'cal_public'); |
|
| 1089 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'title', 'cal_title'); |
|
| 1090 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'description', 'cal_description'); |
|
| 1091 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'location', 'cal_location'); |
|
| 1092 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'reference', 'cal_reference'); |
|
| 1093 | 1093 | |
| 1094 | 1094 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.001'; |
| 1095 | 1095 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1099,13 +1099,13 @@ discard block |
||
| 1099 | 1099 | |
| 1100 | 1100 | function calendar_upgrade1_0_0_001() |
| 1101 | 1101 | { |
| 1102 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','locale','hol_locale'); |
|
| 1103 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','name','hol_name'); |
|
| 1104 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','mday','hol_mday'); |
|
| 1105 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','month_num','hol_month_num'); |
|
| 1106 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','occurence','hol_occurence'); |
|
| 1107 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','dow','hol_dow'); |
|
| 1108 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','observance_rule','hol_observance_rule'); |
|
| 1102 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'locale', 'hol_locale'); |
|
| 1103 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'name', 'hol_name'); |
|
| 1104 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'mday', 'hol_mday'); |
|
| 1105 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'month_num', 'hol_month_num'); |
|
| 1106 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'occurence', 'hol_occurence'); |
|
| 1107 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'dow', 'hol_dow'); |
|
| 1108 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'observance_rule', 'hol_observance_rule'); |
|
| 1109 | 1109 | |
| 1110 | 1110 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.002'; |
| 1111 | 1111 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1115,8 +1115,8 @@ discard block |
||
| 1115 | 1115 | |
| 1116 | 1116 | function calendar_upgrade1_0_0_002() |
| 1117 | 1117 | { |
| 1118 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user','cal_login','cal_user_id'); |
|
| 1119 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user','cal_type','cal_user_type'); |
|
| 1118 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user', 'cal_login', 'cal_user_id'); |
|
| 1119 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user', 'cal_type', 'cal_user_type'); |
|
| 1120 | 1120 | |
| 1121 | 1121 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.003'; |
| 1122 | 1122 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1126,7 +1126,7 @@ discard block |
||
| 1126 | 1126 | |
| 1127 | 1127 | function calendar_upgrade1_0_0_003() |
| 1128 | 1128 | { |
| 1129 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal','cal_title',array( |
|
| 1129 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal', 'cal_title', array( |
|
| 1130 | 1130 | 'type' => 'varchar', |
| 1131 | 1131 | 'precision' => '255', |
| 1132 | 1132 | 'nullable' => False, |
@@ -1141,15 +1141,15 @@ discard block |
||
| 1141 | 1141 | |
| 1142 | 1142 | function calendar_upgrade1_0_0_004() |
| 1143 | 1143 | { |
| 1144 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats',array( |
|
| 1144 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats', array( |
|
| 1145 | 1145 | 'fd' => array( |
| 1146 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 1147 | - 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 1148 | - 'recur_use_end' => array('type' => 'int','precision' => '8','default' => '0'), |
|
| 1149 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
| 1150 | - 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), |
|
| 1151 | - 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), |
|
| 1152 | - 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') |
|
| 1146 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 1147 | + 'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 1148 | + 'recur_use_end' => array('type' => 'int', 'precision' => '8', 'default' => '0'), |
|
| 1149 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
| 1150 | + 'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
| 1151 | + 'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
| 1152 | + 'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '') |
|
| 1153 | 1153 | ), |
| 1154 | 1154 | 'pk' => array('cal_id'), |
| 1155 | 1155 | 'fk' => array(), |
@@ -1166,19 +1166,19 @@ discard block |
||
| 1166 | 1166 | function calendar_upgrade1_0_0_005() |
| 1167 | 1167 | { |
| 1168 | 1168 | // change prefix of all calendar tables to egw_ |
| 1169 | - foreach(array('cal_user','cal_repeats','cal_extra','cal_holidays','cal') as $name) |
|
| 1169 | + foreach (array('cal_user', 'cal_repeats', 'cal_extra', 'cal_holidays', 'cal') as $name) |
|
| 1170 | 1170 | { |
| 1171 | - $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_'.$name,'egw_'.$name); |
|
| 1171 | + $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_'.$name, 'egw_'.$name); |
|
| 1172 | 1172 | } |
| 1173 | 1173 | |
| 1174 | 1174 | // create new dates table, with content from the egw_cal table |
| 1175 | - $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_dates',array( |
|
| 1175 | + $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_dates', array( |
|
| 1176 | 1176 | 'fd' => array( |
| 1177 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
| 1178 | - 'cal_start' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 1179 | - 'cal_end' => array('type' => 'int','precision' => '8','nullable' => False) |
|
| 1177 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
| 1178 | + 'cal_start' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 1179 | + 'cal_end' => array('type' => 'int', 'precision' => '8', 'nullable' => False) |
|
| 1180 | 1180 | ), |
| 1181 | - 'pk' => array('cal_id','cal_start'), |
|
| 1181 | + 'pk' => array('cal_id', 'cal_start'), |
|
| 1182 | 1182 | 'fk' => array(), |
| 1183 | 1183 | 'ix' => array(), |
| 1184 | 1184 | 'uc' => array() |
@@ -1186,49 +1186,49 @@ discard block |
||
| 1186 | 1186 | $GLOBALS['egw_setup']->oProc->query("INSERT INTO egw_cal_dates SELECT cal_id,cal_starttime,cal_endtime FROM egw_cal"); |
| 1187 | 1187 | |
| 1188 | 1188 | // drop the fields transfered to the dates table |
| 1189 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
| 1189 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
| 1190 | 1190 | 'fd' => array( |
| 1191 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
| 1192 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
| 1193 | - 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 1194 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
| 1195 | - 'cal_groups' => array('type' => 'varchar','precision' => '255'), |
|
| 1196 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
| 1197 | - 'cal_endtime' => array('type' => 'int','precision' => '8'), |
|
| 1198 | - 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), |
|
| 1199 | - 'cal_type' => array('type' => 'varchar','precision' => '10'), |
|
| 1200 | - 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), |
|
| 1201 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
| 1191 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
| 1192 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
| 1193 | + 'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 1194 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
| 1195 | + 'cal_groups' => array('type' => 'varchar', 'precision' => '255'), |
|
| 1196 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
| 1197 | + 'cal_endtime' => array('type' => 'int', 'precision' => '8'), |
|
| 1198 | + 'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'), |
|
| 1199 | + 'cal_type' => array('type' => 'varchar', 'precision' => '10'), |
|
| 1200 | + 'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'), |
|
| 1201 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
| 1202 | 1202 | 'cal_description' => array('type' => 'text'), |
| 1203 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
| 1204 | - 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
| 1203 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
| 1204 | + 'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
| 1205 | 1205 | ), |
| 1206 | 1206 | 'pk' => array('cal_id'), |
| 1207 | 1207 | 'fk' => array(), |
| 1208 | 1208 | 'ix' => array(), |
| 1209 | 1209 | 'uc' => array() |
| 1210 | - ),'cal_starttime'); |
|
| 1211 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
| 1210 | + ), 'cal_starttime'); |
|
| 1211 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
| 1212 | 1212 | 'fd' => array( |
| 1213 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
| 1214 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
| 1215 | - 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 1216 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
| 1217 | - 'cal_groups' => array('type' => 'varchar','precision' => '255'), |
|
| 1218 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
| 1219 | - 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), |
|
| 1220 | - 'cal_type' => array('type' => 'varchar','precision' => '10'), |
|
| 1221 | - 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), |
|
| 1222 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
| 1213 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
| 1214 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
| 1215 | + 'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 1216 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
| 1217 | + 'cal_groups' => array('type' => 'varchar', 'precision' => '255'), |
|
| 1218 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
| 1219 | + 'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'), |
|
| 1220 | + 'cal_type' => array('type' => 'varchar', 'precision' => '10'), |
|
| 1221 | + 'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'), |
|
| 1222 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
| 1223 | 1223 | 'cal_description' => array('type' => 'text'), |
| 1224 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
| 1225 | - 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
| 1224 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
| 1225 | + 'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
| 1226 | 1226 | ), |
| 1227 | 1227 | 'pk' => array('cal_id'), |
| 1228 | 1228 | 'fk' => array(), |
| 1229 | 1229 | 'ix' => array(), |
| 1230 | 1230 | 'uc' => array() |
| 1231 | - ),'cal_endtime'); |
|
| 1231 | + ), 'cal_endtime'); |
|
| 1232 | 1232 | |
| 1233 | 1233 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.1.001'; |
| 1234 | 1234 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1244,15 +1244,15 @@ discard block |
||
| 1244 | 1244 | 'precision' => '8', |
| 1245 | 1245 | 'default' => '0' |
| 1246 | 1246 | ));*/ |
| 1247 | - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user',array( |
|
| 1247 | + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user', array( |
|
| 1248 | 1248 | 'fd' => array( |
| 1249 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
| 1250 | - 'cal_recur_date' => array('type' => 'int','precision' => '8','default' => '0'), |
|
| 1251 | - 'cal_user_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u'), |
|
| 1252 | - 'cal_user_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
| 1253 | - 'cal_status' => array('type' => 'char','precision' => '1','default' => 'A') |
|
| 1249 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
| 1250 | + 'cal_recur_date' => array('type' => 'int', 'precision' => '8', 'default' => '0'), |
|
| 1251 | + 'cal_user_type' => array('type' => 'varchar', 'precision' => '1', 'nullable' => False, 'default' => 'u'), |
|
| 1252 | + 'cal_user_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
| 1253 | + 'cal_status' => array('type' => 'char', 'precision' => '1', 'default' => 'A') |
|
| 1254 | 1254 | ), |
| 1255 | - 'pk' => array('cal_id','cal_recur_date','cal_user_type','cal_user_id'), |
|
| 1255 | + 'pk' => array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id'), |
|
| 1256 | 1256 | 'fk' => array(), |
| 1257 | 1257 | 'ix' => array(), |
| 1258 | 1258 | 'uc' => array() |
@@ -1266,50 +1266,50 @@ discard block |
||
| 1266 | 1266 | |
| 1267 | 1267 | function calendar_upgrade1_0_1_002() |
| 1268 | 1268 | { |
| 1269 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
| 1269 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
| 1270 | 1270 | 'fd' => array( |
| 1271 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
| 1272 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
| 1273 | - 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 1274 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
| 1275 | - 'cal_groups' => array('type' => 'varchar','precision' => '255'), |
|
| 1276 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
| 1277 | - 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), |
|
| 1278 | - 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), |
|
| 1279 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
| 1271 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
| 1272 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
| 1273 | + 'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 1274 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
| 1275 | + 'cal_groups' => array('type' => 'varchar', 'precision' => '255'), |
|
| 1276 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
| 1277 | + 'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'), |
|
| 1278 | + 'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'), |
|
| 1279 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
| 1280 | 1280 | 'cal_description' => array('type' => 'text'), |
| 1281 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
| 1282 | - 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
| 1281 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
| 1282 | + 'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
| 1283 | 1283 | ), |
| 1284 | 1284 | 'pk' => array('cal_id'), |
| 1285 | 1285 | 'fk' => array(), |
| 1286 | 1286 | 'ix' => array(), |
| 1287 | 1287 | 'uc' => array() |
| 1288 | - ),'cal_type'); |
|
| 1289 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_owner',array( |
|
| 1288 | + ), 'cal_type'); |
|
| 1289 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_owner', array( |
|
| 1290 | 1290 | 'type' => 'int', |
| 1291 | 1291 | 'precision' => '4', |
| 1292 | 1292 | 'nullable' => False |
| 1293 | 1293 | )); |
| 1294 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_priority',array( |
|
| 1294 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_priority', array( |
|
| 1295 | 1295 | 'type' => 'int', |
| 1296 | 1296 | 'precision' => '2', |
| 1297 | 1297 | 'nullable' => False, |
| 1298 | 1298 | 'default' => '2' |
| 1299 | 1299 | )); |
| 1300 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_public',array( |
|
| 1300 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_public', array( |
|
| 1301 | 1301 | 'type' => 'int', |
| 1302 | 1302 | 'precision' => '2', |
| 1303 | 1303 | 'nullable' => False, |
| 1304 | 1304 | 'default' => '1' |
| 1305 | 1305 | )); |
| 1306 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_reference',array( |
|
| 1306 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_reference', array( |
|
| 1307 | 1307 | 'type' => 'int', |
| 1308 | 1308 | 'precision' => '4', |
| 1309 | 1309 | 'nullable' => False, |
| 1310 | 1310 | 'default' => '0' |
| 1311 | 1311 | )); |
| 1312 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_modifier',array( |
|
| 1312 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_modifier', array( |
|
| 1313 | 1313 | 'type' => 'int', |
| 1314 | 1314 | 'precision' => '4' |
| 1315 | 1315 | )); |
@@ -1322,36 +1322,36 @@ discard block |
||
| 1322 | 1322 | |
| 1323 | 1323 | function calendar_upgrade1_0_1_003() |
| 1324 | 1324 | { |
| 1325 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats',array( |
|
| 1325 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array( |
|
| 1326 | 1326 | 'fd' => array( |
| 1327 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 1328 | - 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 1329 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
| 1330 | - 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), |
|
| 1331 | - 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), |
|
| 1332 | - 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') |
|
| 1327 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 1328 | + 'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 1329 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
| 1330 | + 'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
| 1331 | + 'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
| 1332 | + 'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '') |
|
| 1333 | 1333 | ), |
| 1334 | 1334 | 'pk' => array('cal_id'), |
| 1335 | 1335 | 'fk' => array(), |
| 1336 | 1336 | 'ix' => array(), |
| 1337 | 1337 | 'uc' => array() |
| 1338 | - ),'recur_use_end'); |
|
| 1339 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','cal_id',array( |
|
| 1338 | + ), 'recur_use_end'); |
|
| 1339 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'cal_id', array( |
|
| 1340 | 1340 | 'type' => 'int', |
| 1341 | 1341 | 'precision' => '4', |
| 1342 | 1342 | 'nullable' => False |
| 1343 | 1343 | )); |
| 1344 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_type',array( |
|
| 1344 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_type', array( |
|
| 1345 | 1345 | 'type' => 'int', |
| 1346 | 1346 | 'precision' => '2', |
| 1347 | 1347 | 'nullable' => False |
| 1348 | 1348 | )); |
| 1349 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_interval',array( |
|
| 1349 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_interval', array( |
|
| 1350 | 1350 | 'type' => 'int', |
| 1351 | 1351 | 'precision' => '2', |
| 1352 | 1352 | 'default' => '1' |
| 1353 | 1353 | )); |
| 1354 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_data',array( |
|
| 1354 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_data', array( |
|
| 1355 | 1355 | 'type' => 'int', |
| 1356 | 1356 | 'precision' => '2', |
| 1357 | 1357 | 'default' => '1' |
@@ -1365,13 +1365,13 @@ discard block |
||
| 1365 | 1365 | |
| 1366 | 1366 | function calendar_upgrade1_0_1_004() |
| 1367 | 1367 | { |
| 1368 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_id',array( |
|
| 1368 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_id', array( |
|
| 1369 | 1369 | 'type' => 'int', |
| 1370 | 1370 | 'precision' => '4', |
| 1371 | 1371 | 'nullable' => False, |
| 1372 | 1372 | 'default' => '0' |
| 1373 | 1373 | )); |
| 1374 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
| 1374 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
| 1375 | 1375 | 'type' => 'int', |
| 1376 | 1376 | 'precision' => '4', |
| 1377 | 1377 | 'nullable' => False, |
@@ -1386,7 +1386,7 @@ discard block |
||
| 1386 | 1386 | |
| 1387 | 1387 | function calendar_upgrade1_0_1_005() |
| 1388 | 1388 | { |
| 1389 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_quantity',array( |
|
| 1389 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_quantity', array( |
|
| 1390 | 1390 | 'type' => 'int', |
| 1391 | 1391 | 'precision' => '4', |
| 1392 | 1392 | 'default' => '1' |
@@ -1400,7 +1400,7 @@ discard block |
||
| 1400 | 1400 | |
| 1401 | 1401 | function calendar_upgrade1_0_1_006() |
| 1402 | 1402 | { |
| 1403 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_non_blocking',array( |
|
| 1403 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_non_blocking', array( |
|
| 1404 | 1404 | 'type' => 'int', |
| 1405 | 1405 | 'precision' => '2', |
| 1406 | 1406 | 'default' => '0' |
@@ -1414,9 +1414,9 @@ discard block |
||
| 1414 | 1414 | |
| 1415 | 1415 | function calendar_upgrade1_0_1_007() |
| 1416 | 1416 | { |
| 1417 | - $GLOBALS['egw_setup']->db->update('egw_cal_repeats',array('recur_exception' => null),array('recur_exception' => ''),__LINE__,__FILE__,'calendar'); |
|
| 1417 | + $GLOBALS['egw_setup']->db->update('egw_cal_repeats', array('recur_exception' => null), array('recur_exception' => ''), __LINE__, __FILE__, 'calendar'); |
|
| 1418 | 1418 | |
| 1419 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_exception',array( |
|
| 1419 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_exception', array( |
|
| 1420 | 1420 | 'type' => 'text' |
| 1421 | 1421 | )); |
| 1422 | 1422 | |
@@ -1433,11 +1433,11 @@ discard block |
||
| 1433 | 1433 | { |
| 1434 | 1434 | $customfields = array(); |
| 1435 | 1435 | $order = 0; |
| 1436 | - foreach($config_data['fields'] as $name => $data) |
|
| 1436 | + foreach ($config_data['fields'] as $name => $data) |
|
| 1437 | 1437 | { |
| 1438 | 1438 | if ($name{0} == '#' && !$data['disabled']) // real not-disabled custom field |
| 1439 | 1439 | { |
| 1440 | - $customfields[substr($name,1)] = array( |
|
| 1440 | + $customfields[substr($name, 1)] = array( |
|
| 1441 | 1441 | 'type' => 'text', |
| 1442 | 1442 | 'len' => $data['length'].($data['shown'] ? ','.$data['shown'] : ''), |
| 1443 | 1443 | 'label' => $data['name'], |
@@ -1460,38 +1460,38 @@ discard block |
||
| 1460 | 1460 | function calendar_upgrade1_0_1_009() |
| 1461 | 1461 | { |
| 1462 | 1462 | $db2 = clone($GLOBALS['egw_setup']->db); |
| 1463 | - $GLOBALS['egw_setup']->db->select('egw_cal','DISTINCT egw_cal.cal_id,cal_groups,cal_recur_date',"cal_groups != ''",__LINE__,__FILE__, |
|
| 1464 | - False,'','calendar',0,',egw_cal_user WHERE egw_cal.cal_id=egw_cal_user.cal_id'); |
|
| 1465 | - while(($row = $GLOBALS['egw_setup']->db->row(true))) |
|
| 1463 | + $GLOBALS['egw_setup']->db->select('egw_cal', 'DISTINCT egw_cal.cal_id,cal_groups,cal_recur_date', "cal_groups != ''", __LINE__, __FILE__, |
|
| 1464 | + False, '', 'calendar', 0, ',egw_cal_user WHERE egw_cal.cal_id=egw_cal_user.cal_id'); |
|
| 1465 | + while (($row = $GLOBALS['egw_setup']->db->row(true))) |
|
| 1466 | 1466 | { |
| 1467 | 1467 | $row['cal_user_type'] = 'u'; |
| 1468 | - foreach(explode(',',$row['cal_groups']) as $group) |
|
| 1468 | + foreach (explode(',', $row['cal_groups']) as $group) |
|
| 1469 | 1469 | { |
| 1470 | 1470 | $row['cal_user_id'] = $group; |
| 1471 | - $db2->insert('egw_cal_user',array('cal_status' => 'U'),$row,__LINE__,__FILE__,'calendar'); |
|
| 1471 | + $db2->insert('egw_cal_user', array('cal_status' => 'U'), $row, __LINE__, __FILE__, 'calendar'); |
|
| 1472 | 1472 | } |
| 1473 | 1473 | } |
| 1474 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
| 1474 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
| 1475 | 1475 | 'fd' => array( |
| 1476 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
| 1477 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
| 1478 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
| 1479 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
| 1480 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
| 1481 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
| 1482 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), |
|
| 1483 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
| 1476 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
| 1477 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
| 1478 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
| 1479 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
| 1480 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
| 1481 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
| 1482 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'), |
|
| 1483 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
| 1484 | 1484 | 'cal_description' => array('type' => 'text'), |
| 1485 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
| 1486 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
| 1487 | - 'cal_modifier' => array('type' => 'int','precision' => '4'), |
|
| 1488 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0') |
|
| 1485 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
| 1486 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
| 1487 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4'), |
|
| 1488 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0') |
|
| 1489 | 1489 | ), |
| 1490 | 1490 | 'pk' => array('cal_id'), |
| 1491 | 1491 | 'fk' => array(), |
| 1492 | 1492 | 'ix' => array(), |
| 1493 | 1493 | 'uc' => array() |
| 1494 | - ),'cal_groups'); |
|
| 1494 | + ), 'cal_groups'); |
|
| 1495 | 1495 | |
| 1496 | 1496 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.2'; |
| 1497 | 1497 | } |
@@ -1501,7 +1501,7 @@ discard block |
||
| 1501 | 1501 | function calendar_upgrade1_2() |
| 1502 | 1502 | { |
| 1503 | 1503 | // get old alarms (saved before 1.2) working again |
| 1504 | - $GLOBALS['egw_setup']->db->query("UPDATE egw_async SET async_method ='calendar.bocalupdate.send_alarm' WHERE async_method ='calendar.bocalendar.send_alarm'",__LINE__,__FILE__); |
|
| 1504 | + $GLOBALS['egw_setup']->db->query("UPDATE egw_async SET async_method ='calendar.bocalupdate.send_alarm' WHERE async_method ='calendar.bocalendar.send_alarm'", __LINE__, __FILE__); |
|
| 1505 | 1505 | |
| 1506 | 1506 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.2.001'; |
| 1507 | 1507 | } |
@@ -1509,7 +1509,7 @@ discard block |
||
| 1509 | 1509 | |
| 1510 | 1510 | function calendar_upgrade1_2_001() |
| 1511 | 1511 | { |
| 1512 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_special',array( |
|
| 1512 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_special', array( |
|
| 1513 | 1513 | 'type' => 'int', |
| 1514 | 1514 | 'precision' => '2', |
| 1515 | 1515 | 'default' => '0' |
@@ -1527,7 +1527,7 @@ discard block |
||
| 1527 | 1527 | |
| 1528 | 1528 | function calendar_upgrade1_4() |
| 1529 | 1529 | { |
| 1530 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_etag',array( |
|
| 1530 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_etag', array( |
|
| 1531 | 1531 | 'type' => 'int', |
| 1532 | 1532 | 'precision' => '4', |
| 1533 | 1533 | 'default' => '0' |
@@ -1539,59 +1539,59 @@ discard block |
||
| 1539 | 1539 | |
| 1540 | 1540 | function calendar_upgrade1_5() |
| 1541 | 1541 | { |
| 1542 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
| 1542 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
| 1543 | 1543 | 'fd' => array( |
| 1544 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
| 1545 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
| 1546 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
| 1547 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
| 1548 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
| 1549 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
| 1550 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), |
|
| 1551 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
| 1544 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
| 1545 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
| 1546 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
| 1547 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
| 1548 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
| 1549 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
| 1550 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'), |
|
| 1551 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
| 1552 | 1552 | 'cal_description' => array('type' => 'text'), |
| 1553 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
| 1554 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
| 1555 | - 'cal_modifier' => array('type' => 'int','precision' => '4'), |
|
| 1556 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0'), |
|
| 1557 | - 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), |
|
| 1558 | - 'cal_etag' => array('type' => 'int','precision' => '4'), |
|
| 1559 | - 'cal_edit_time' => array('type' => 'int','precision' => '8') |
|
| 1553 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
| 1554 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
| 1555 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4'), |
|
| 1556 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
| 1557 | + 'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
| 1558 | + 'cal_etag' => array('type' => 'int', 'precision' => '4'), |
|
| 1559 | + 'cal_edit_time' => array('type' => 'int', 'precision' => '8') |
|
| 1560 | 1560 | ), |
| 1561 | 1561 | 'pk' => array('cal_id'), |
| 1562 | 1562 | 'fk' => array(), |
| 1563 | 1563 | 'ix' => array(), |
| 1564 | 1564 | 'uc' => array() |
| 1565 | - ),'cal_edit_user'); |
|
| 1566 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
| 1565 | + ), 'cal_edit_user'); |
|
| 1566 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
| 1567 | 1567 | 'fd' => array( |
| 1568 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
| 1569 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
| 1570 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
| 1571 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
| 1572 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
| 1573 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
| 1574 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), |
|
| 1575 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
| 1568 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
| 1569 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
| 1570 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
| 1571 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
| 1572 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
| 1573 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
| 1574 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'), |
|
| 1575 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
| 1576 | 1576 | 'cal_description' => array('type' => 'text'), |
| 1577 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
| 1578 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
| 1579 | - 'cal_modifier' => array('type' => 'int','precision' => '4'), |
|
| 1580 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0'), |
|
| 1581 | - 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), |
|
| 1582 | - 'cal_etag' => array('type' => 'int','precision' => '4') |
|
| 1577 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
| 1578 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
| 1579 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4'), |
|
| 1580 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
| 1581 | + 'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
| 1582 | + 'cal_etag' => array('type' => 'int', 'precision' => '4') |
|
| 1583 | 1583 | ), |
| 1584 | 1584 | 'pk' => array('cal_id'), |
| 1585 | 1585 | 'fk' => array(), |
| 1586 | 1586 | 'ix' => array(), |
| 1587 | 1587 | 'uc' => array() |
| 1588 | - ),'cal_edit_time'); |
|
| 1589 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_etag',array( |
|
| 1588 | + ), 'cal_edit_time'); |
|
| 1589 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_etag', array( |
|
| 1590 | 1590 | 'type' => 'int', |
| 1591 | 1591 | 'precision' => '4', |
| 1592 | 1592 | 'default' => '0' |
| 1593 | 1593 | )); |
| 1594 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_etag=0 WHERE cal_etag IS NULL',__LINE__,__FILE__); |
|
| 1594 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_etag=0 WHERE cal_etag IS NULL', __LINE__, __FILE__); |
|
| 1595 | 1595 | |
| 1596 | 1596 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.5.001'; |
| 1597 | 1597 | } |
@@ -1599,12 +1599,12 @@ discard block |
||
| 1599 | 1599 | |
| 1600 | 1600 | function calendar_upgrade1_5_001() |
| 1601 | 1601 | { |
| 1602 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_id',array( |
|
| 1602 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_id', array( |
|
| 1603 | 1603 | 'type' => 'int', |
| 1604 | 1604 | 'precision' => '4', |
| 1605 | 1605 | 'nullable' => False |
| 1606 | 1606 | )); |
| 1607 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
| 1607 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
| 1608 | 1608 | 'type' => 'varchar', |
| 1609 | 1609 | 'precision' => '128', |
| 1610 | 1610 | 'nullable' => False |
@@ -1618,12 +1618,12 @@ discard block |
||
| 1618 | 1618 | { |
| 1619 | 1619 | // update the alarm methods |
| 1620 | 1620 | $async = new Api\Asyncservice(); |
| 1621 | - foreach((array)$async->read('cal:%') as $job) |
|
| 1621 | + foreach ((array)$async->read('cal:%') as $job) |
|
| 1622 | 1622 | { |
| 1623 | 1623 | if ($job['method'] == 'calendar.bocalupdate.send_alarm') |
| 1624 | 1624 | { |
| 1625 | 1625 | $job['method'] = 'calendar.calendar_boupdate.send_alarm'; |
| 1626 | - $async->write($job,true); |
|
| 1626 | + $async->write($job, true); |
|
| 1627 | 1627 | } |
| 1628 | 1628 | } |
| 1629 | 1629 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.6'; |
@@ -1640,48 +1640,48 @@ discard block |
||
| 1640 | 1640 | { |
| 1641 | 1641 | // Set UID of series exception to UID of series master |
| 1642 | 1642 | // update cal_etag, cal_modified and cal_modifier to distribute changes on GroupDAV devices |
| 1643 | - foreach($GLOBALS['egw_setup']->db->query(' |
|
| 1643 | + foreach ($GLOBALS['egw_setup']->db->query(' |
|
| 1644 | 1644 | SELECT cal_ex.cal_id,cal_ex.cal_uid AS cal_uid_ex,cal_master.cal_uid AS cal_uid_master |
| 1645 | 1645 | FROM egw_cal cal_ex |
| 1646 | 1646 | JOIN egw_cal cal_master ON cal_ex.cal_reference=cal_master.cal_id |
| 1647 | - WHERE cal_ex.cal_reference != 0',__LINE__,__FILE__) as $row) |
|
| 1647 | + WHERE cal_ex.cal_reference != 0',__LINE__, __FILE__) as $row) |
|
| 1648 | 1648 | { |
| 1649 | 1649 | if (strlen($row['cal_uid_master']) > 0 && $row['cal_uid_ex'] != $row['cal_uid_master']) |
| 1650 | 1650 | { |
| 1651 | 1651 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_uid=\''.$row['cal_uid_master']. |
| 1652 | 1652 | '\',cal_etag=cal_etag+1,cal_modified='.time(). |
| 1653 | - ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
| 1653 | + ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
| 1654 | 1654 | } |
| 1655 | 1655 | } |
| 1656 | 1656 | |
| 1657 | 1657 | // Search series exception for nearest exception in series master and add that RECURRENCE-ID |
| 1658 | 1658 | // as cal_reference (for 1.6.003 and move it to new field cal_recurrence in 1.7.001) |
| 1659 | 1659 | $diff = null; |
| 1660 | - foreach($GLOBALS['egw_setup']->db->query('SELECT egw_cal.cal_id,cal_start,recur_exception FROM egw_cal |
|
| 1660 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT egw_cal.cal_id,cal_start,recur_exception FROM egw_cal |
|
| 1661 | 1661 | JOIN egw_cal_dates ON egw_cal.cal_id=egw_cal_dates.cal_id |
| 1662 | 1662 | JOIN egw_cal_repeats ON cal_reference=egw_cal_repeats.cal_id |
| 1663 | - WHERE cal_reference != 0',__LINE__,__FILE__) as $row) |
|
| 1663 | + WHERE cal_reference != 0',__LINE__, __FILE__) as $row) |
|
| 1664 | 1664 | { |
| 1665 | 1665 | $recurrence = null; |
| 1666 | - foreach(explode(',',$row['recur_exception']) as $ts) |
|
| 1666 | + foreach (explode(',', $row['recur_exception']) as $ts) |
|
| 1667 | 1667 | { |
| 1668 | - if (is_null($recurrence) || abs($ts-$row['cal_start']) < $diff) |
|
| 1668 | + if (is_null($recurrence) || abs($ts - $row['cal_start']) < $diff) |
|
| 1669 | 1669 | { |
| 1670 | 1670 | $recurrence = $ts; |
| 1671 | - $diff = abs($ts-$row['cal_start']); |
|
| 1671 | + $diff = abs($ts - $row['cal_start']); |
|
| 1672 | 1672 | } |
| 1673 | 1673 | } |
| 1674 | 1674 | if ($recurrence) |
| 1675 | 1675 | { |
| 1676 | 1676 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_reference='.(int)$recurrence. |
| 1677 | - ' WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
| 1677 | + ' WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
| 1678 | 1678 | } |
| 1679 | 1679 | else |
| 1680 | 1680 | { |
| 1681 | 1681 | // if we cannot determine the RECURRENCE-ID use cal_start |
| 1682 | 1682 | // because RECURRENCE-ID must be present |
| 1683 | 1683 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_reference='.(int)$row['cal_start']. |
| 1684 | - ' WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
| 1684 | + ' WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
| 1685 | 1685 | } |
| 1686 | 1686 | } |
| 1687 | 1687 | |
@@ -1696,33 +1696,33 @@ discard block |
||
| 1696 | 1696 | */ |
| 1697 | 1697 | function calendar_upgrade1_6_003() |
| 1698 | 1698 | { |
| 1699 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_creator',array( |
|
| 1699 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_creator', array( |
|
| 1700 | 1700 | 'type' => 'int', |
| 1701 | 1701 | 'precision' => '4', |
| 1702 | 1702 | 'comment' => 'creating user' |
| 1703 | 1703 | )); |
| 1704 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_creator=cal_owner',__LINE__,__FILE__); |
|
| 1705 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_creator',array( |
|
| 1704 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_creator=cal_owner', __LINE__, __FILE__); |
|
| 1705 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_creator', array( |
|
| 1706 | 1706 | 'type' => 'int', |
| 1707 | 1707 | 'precision' => '4', |
| 1708 | 1708 | 'nullable' => False, |
| 1709 | 1709 | 'comment' => 'creating user' |
| 1710 | 1710 | )); |
| 1711 | 1711 | |
| 1712 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_created',array( |
|
| 1712 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_created', array( |
|
| 1713 | 1713 | 'type' => 'int', |
| 1714 | 1714 | 'precision' => '8', |
| 1715 | 1715 | 'comment' => 'creation time of event' |
| 1716 | 1716 | )); |
| 1717 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_created=cal_modified',__LINE__,__FILE__); |
|
| 1718 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_created',array( |
|
| 1717 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_created=cal_modified', __LINE__, __FILE__); |
|
| 1718 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_created', array( |
|
| 1719 | 1719 | 'type' => 'int', |
| 1720 | 1720 | 'precision' => '8', |
| 1721 | 1721 | 'nullable' => False, |
| 1722 | 1722 | 'comment' => 'creation time of event' |
| 1723 | 1723 | )); |
| 1724 | 1724 | |
| 1725 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_recurrence',array( |
|
| 1725 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_recurrence', array( |
|
| 1726 | 1726 | 'type' => 'int', |
| 1727 | 1727 | 'precision' => '8', |
| 1728 | 1728 | 'nullable' => False, |
@@ -1733,14 +1733,14 @@ discard block |
||
| 1733 | 1733 | // move RECURRENCE-ID from temporarily (1.6.003) |
| 1734 | 1734 | // used field cal_reference to new field cal_recurrence |
| 1735 | 1735 | // and restore cal_reference field of series exceptions with id of the series master |
| 1736 | - foreach($GLOBALS['egw_setup']->db->query(' |
|
| 1736 | + foreach ($GLOBALS['egw_setup']->db->query(' |
|
| 1737 | 1737 | SELECT cal_ex.cal_id AS cal_id_ex,cal_master.cal_id AS cal_id_master, |
| 1738 | 1738 | cal_ex.cal_reference AS cal_reference_ex,cal_ex.cal_uid AS cal_uid_ex, |
| 1739 | 1739 | cal_master.cal_uid AS cal_uid_master |
| 1740 | 1740 | FROM egw_cal cal_ex |
| 1741 | 1741 | JOIN egw_cal cal_master |
| 1742 | 1742 | ON cal_ex.cal_uid=cal_master.cal_uid AND cal_master.cal_reference = 0 AND cal_ex.cal_owner = cal_master.cal_owner |
| 1743 | - WHERE cal_ex.cal_reference !=0 AND cal_master.cal_id IS NOT NULL',__LINE__,__FILE__) as $row) |
|
| 1743 | + WHERE cal_ex.cal_reference !=0 AND cal_master.cal_id IS NOT NULL',__LINE__, __FILE__) as $row) |
|
| 1744 | 1744 | { |
| 1745 | 1745 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_recurrence='.(int)$row['cal_reference_ex']. |
| 1746 | 1746 | ', cal_reference='.(int)$row['cal_id_master']. |
@@ -1757,7 +1757,7 @@ discard block |
||
| 1757 | 1757 | */ |
| 1758 | 1758 | function calendar_upgrade1_7_001() |
| 1759 | 1759 | { |
| 1760 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_role',array( |
|
| 1760 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_role', array( |
|
| 1761 | 1761 | 'type' => 'varchar', |
| 1762 | 1762 | 'precision' => '64', |
| 1763 | 1763 | 'default' => 'REQ-PARTICIPANT' |
@@ -1773,14 +1773,14 @@ discard block |
||
| 1773 | 1773 | */ |
| 1774 | 1774 | function calendar_upgrade1_7_002() |
| 1775 | 1775 | { |
| 1776 | - $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_timezones',array( |
|
| 1776 | + $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_timezones', array( |
|
| 1777 | 1777 | 'fd' => array( |
| 1778 | - 'tz_id' => array('type' => 'auto','nullable' => False), |
|
| 1779 | - 'tz_tzid' => array('type' => 'varchar','precision' => '128','nullable' => False), |
|
| 1780 | - 'tz_alias' => array('type' => 'int','precision' => '4','comment' => 'tz_id for data'), |
|
| 1781 | - 'tz_latitude' => array('type' => 'int','precision' => '4'), |
|
| 1782 | - 'tz_longitude' => array('type' => 'int','precision' => '4'), |
|
| 1783 | - 'tz_component' => array('type' => 'text','comment' => 'iCal VTIMEZONE component') |
|
| 1778 | + 'tz_id' => array('type' => 'auto', 'nullable' => False), |
|
| 1779 | + 'tz_tzid' => array('type' => 'varchar', 'precision' => '128', 'nullable' => False), |
|
| 1780 | + 'tz_alias' => array('type' => 'int', 'precision' => '4', 'comment' => 'tz_id for data'), |
|
| 1781 | + 'tz_latitude' => array('type' => 'int', 'precision' => '4'), |
|
| 1782 | + 'tz_longitude' => array('type' => 'int', 'precision' => '4'), |
|
| 1783 | + 'tz_component' => array('type' => 'text', 'comment' => 'iCal VTIMEZONE component') |
|
| 1784 | 1784 | ), |
| 1785 | 1785 | 'pk' => array('tz_id'), |
| 1786 | 1786 | 'fk' => array(), |
@@ -1800,38 +1800,38 @@ discard block |
||
| 1800 | 1800 | */ |
| 1801 | 1801 | function calendar_upgrade1_7_003() |
| 1802 | 1802 | { |
| 1803 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_type',array( |
|
| 1803 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_type', array( |
|
| 1804 | 1804 | 'type' => 'varchar', |
| 1805 | 1805 | 'precision' => '1', |
| 1806 | 1806 | 'nullable' => False, |
| 1807 | 1807 | 'default' => 'u', |
| 1808 | 1808 | 'comment' => 'u=user, g=group, c=contact, r=resource, e=email' |
| 1809 | 1809 | )); |
| 1810 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
| 1810 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
| 1811 | 1811 | 'type' => 'varchar', |
| 1812 | 1812 | 'precision' => '128', |
| 1813 | 1813 | 'nullable' => False, |
| 1814 | 1814 | 'comment' => 'id or email-address for type=e' |
| 1815 | 1815 | )); |
| 1816 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_status',array( |
|
| 1816 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_status', array( |
|
| 1817 | 1817 | 'type' => 'char', |
| 1818 | 1818 | 'precision' => '1', |
| 1819 | 1819 | 'default' => 'A', |
| 1820 | 1820 | 'comment' => 'U=unknown, A=accepted, R=rejected, T=tentative' |
| 1821 | 1821 | )); |
| 1822 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_quantity',array( |
|
| 1822 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_quantity', array( |
|
| 1823 | 1823 | 'type' => 'int', |
| 1824 | 1824 | 'precision' => '4', |
| 1825 | 1825 | 'default' => '1', |
| 1826 | 1826 | 'comment' => 'only for certain types (eg. resources)' |
| 1827 | 1827 | )); |
| 1828 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_role',array( |
|
| 1828 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_role', array( |
|
| 1829 | 1829 | 'type' => 'varchar', |
| 1830 | 1830 | 'precision' => '64', |
| 1831 | 1831 | 'default' => 'REQ-PARTICIPANT', |
| 1832 | 1832 | 'comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id' |
| 1833 | 1833 | )); |
| 1834 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_user_modified',array( |
|
| 1834 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_user_modified', array( |
|
| 1835 | 1835 | 'type' => 'timestamp', |
| 1836 | 1836 | 'default' => 'current_timestamp', |
| 1837 | 1837 | 'comment' => 'automatic timestamp of last update' |
@@ -1847,19 +1847,19 @@ discard block |
||
| 1847 | 1847 | */ |
| 1848 | 1848 | function calendar_upgrade1_7_004() |
| 1849 | 1849 | { |
| 1850 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates','cal_start',array( |
|
| 1850 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates', 'cal_start', array( |
|
| 1851 | 1851 | 'type' => 'int', |
| 1852 | 1852 | 'precision' => '8', |
| 1853 | 1853 | 'nullable' => False, |
| 1854 | 1854 | 'comment' => 'starttime in server time' |
| 1855 | 1855 | )); |
| 1856 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates','cal_end',array( |
|
| 1856 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates', 'cal_end', array( |
|
| 1857 | 1857 | 'type' => 'int', |
| 1858 | 1858 | 'precision' => '8', |
| 1859 | 1859 | 'nullable' => False, |
| 1860 | 1860 | 'comment' => 'endtime in server time' |
| 1861 | 1861 | )); |
| 1862 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','tz_id',array( |
|
| 1862 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'tz_id', array( |
|
| 1863 | 1863 | 'type' => 'int', |
| 1864 | 1864 | 'precision' => '4', |
| 1865 | 1865 | 'comment' => 'key into egw_cal_timezones' |
@@ -1868,7 +1868,7 @@ discard block |
||
| 1868 | 1868 | // set id of server timezone for existing events, as that's the timezone their recurrences are using |
| 1869 | 1869 | if (($tzid = date_default_timezone_get()) && ($tz_id = calendar_timezones::tz2id($tzid))) |
| 1870 | 1870 | { |
| 1871 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET tz_id='.(int)$tz_id,__LINE__,__FILE__); |
|
| 1871 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET tz_id='.(int)$tz_id, __LINE__, __FILE__); |
|
| 1872 | 1872 | } |
| 1873 | 1873 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.005'; |
| 1874 | 1874 | } |
@@ -1895,22 +1895,22 @@ discard block |
||
| 1895 | 1895 | */ |
| 1896 | 1896 | function calendar_upgrade1_7_006() |
| 1897 | 1897 | { |
| 1898 | - foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
| 1899 | - WHERE (cal_end-cal_start)%86400=86340',__LINE__,__FILE__) as $row) |
|
| 1898 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
| 1899 | + WHERE (cal_end-cal_start)%86400=86340',__LINE__, __FILE__) as $row) |
|
| 1900 | 1900 | { |
| 1901 | 1901 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end+59 |
| 1902 | - WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__); |
|
| 1902 | + WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'], __LINE__, __FILE__); |
|
| 1903 | 1903 | } |
| 1904 | 1904 | |
| 1905 | - foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
| 1906 | - WHERE cal_end-cal_start>0 AND (cal_end-cal_start)%86400=0',__LINE__,__FILE__) as $row) |
|
| 1905 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
| 1906 | + WHERE cal_end-cal_start>0 AND (cal_end-cal_start)%86400=0',__LINE__, __FILE__) as $row) |
|
| 1907 | 1907 | { |
| 1908 | 1908 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end-1 |
| 1909 | - WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__); |
|
| 1909 | + WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'], __LINE__, __FILE__); |
|
| 1910 | 1910 | } |
| 1911 | 1911 | |
| 1912 | 1912 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1 |
| 1913 | - WHERE recur_interval=0',__LINE__,__FILE__); |
|
| 1913 | + WHERE recur_interval=0',__LINE__, __FILE__); |
|
| 1914 | 1914 | |
| 1915 | 1915 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.007'; |
| 1916 | 1916 | } |
@@ -1926,17 +1926,17 @@ discard block |
||
| 1926 | 1926 | { |
| 1927 | 1927 | // Set UID of series exception to UID of series master |
| 1928 | 1928 | // update cal_etag,cal_modified and cal_modifier to distribute changes on GroupDAV devices |
| 1929 | - foreach($GLOBALS['egw_setup']->db->query(' |
|
| 1929 | + foreach ($GLOBALS['egw_setup']->db->query(' |
|
| 1930 | 1930 | SELECT cal_ex.cal_id,cal_ex.cal_uid AS cal_uid_ex,cal_master.cal_uid AS cal_uid_master |
| 1931 | 1931 | FROM egw_cal cal_ex |
| 1932 | 1932 | JOIN egw_cal cal_master ON cal_ex.cal_reference=cal_master.cal_id |
| 1933 | - WHERE cal_ex.cal_reference != 0',__LINE__,__FILE__) as $row) |
|
| 1933 | + WHERE cal_ex.cal_reference != 0',__LINE__, __FILE__) as $row) |
|
| 1934 | 1934 | { |
| 1935 | 1935 | if (strlen($row['cal_uid_master']) > 0 && $row['cal_uid_ex'] != $row['cal_uid_master']) |
| 1936 | 1936 | { |
| 1937 | 1937 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_uid=\''.$row['cal_uid_master']. |
| 1938 | 1938 | '\',cal_etag=cal_etag+1,cal_modified='.time(). |
| 1939 | - ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
| 1939 | + ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
| 1940 | 1940 | } |
| 1941 | 1941 | } |
| 1942 | 1942 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.008'; |
@@ -1949,7 +1949,7 @@ discard block |
||
| 1949 | 1949 | */ |
| 1950 | 1950 | function calendar_upgrade1_7_008() |
| 1951 | 1951 | { |
| 1952 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user',array('cal_user_type','cal_user_id')); |
|
| 1952 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user', array('cal_user_type', 'cal_user_id')); |
|
| 1953 | 1953 | |
| 1954 | 1954 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.009'; |
| 1955 | 1955 | } |
@@ -1961,22 +1961,22 @@ discard block |
||
| 1961 | 1961 | */ |
| 1962 | 1962 | function calendar_upgrade1_7_009() |
| 1963 | 1963 | { |
| 1964 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_uid'); |
|
| 1965 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_owner'); |
|
| 1964 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_uid'); |
|
| 1965 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_owner'); |
|
| 1966 | 1966 | |
| 1967 | 1967 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.010'; |
| 1968 | 1968 | } |
| 1969 | 1969 | |
| 1970 | 1970 | function calendar_upgrade1_7_010() |
| 1971 | 1971 | { |
| 1972 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_deleted',array( |
|
| 1972 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_deleted', array( |
|
| 1973 | 1973 | 'type' => 'bool', |
| 1974 | 1974 | 'nullable' => False, |
| 1975 | 1975 | 'default' => '0', |
| 1976 | 1976 | 'comment' => '1 if the event has been deleted, but you want to keep it around' |
| 1977 | 1977 | )); |
| 1978 | 1978 | |
| 1979 | - return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.001'; // was 1.7.011 |
|
| 1979 | + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.001'; // was 1.7.011 |
|
| 1980 | 1980 | } |
| 1981 | 1981 | |
| 1982 | 1982 | function calendar_upgrade1_7_011() |
@@ -2006,36 +2006,36 @@ discard block |
||
| 2006 | 2006 | 'precision' => '8', |
| 2007 | 2007 | 'comment' => 'ts when event was deleted' |
| 2008 | 2008 | ));*/ |
| 2009 | - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal',array( |
|
| 2009 | + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal', array( |
|
| 2010 | 2010 | 'fd' => array( |
| 2011 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
| 2012 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False,'comment' => 'unique id of event(-series)'), |
|
| 2013 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'event owner / calendar'), |
|
| 2014 | - 'cal_category' => array('type' => 'varchar','precision' => '30','comment' => 'category id'), |
|
| 2015 | - 'cal_modified' => array('type' => 'int','precision' => '8','comment' => 'ts of last modification'), |
|
| 2016 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
| 2017 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1','comment' => '1=public, 0=private event'), |
|
| 2018 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
| 2011 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
| 2012 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'comment' => 'unique id of event(-series)'), |
|
| 2013 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'event owner / calendar'), |
|
| 2014 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30', 'comment' => 'category id'), |
|
| 2015 | + 'cal_modified' => array('type' => 'int', 'precision' => '8', 'comment' => 'ts of last modification'), |
|
| 2016 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
| 2017 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1', 'comment' => '1=public, 0=private event'), |
|
| 2018 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
| 2019 | 2019 | 'cal_description' => array('type' => 'text'), |
| 2020 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
| 2021 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'cal_id of series for exception'), |
|
| 2022 | - 'cal_modifier' => array('type' => 'int','precision' => '4','comment' => 'user who last modified event'), |
|
| 2023 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0','comment' => '1 for non-blocking events'), |
|
| 2024 | - 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), |
|
| 2025 | - 'cal_etag' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'etag for optimistic locking'), |
|
| 2026 | - 'cal_creator' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'creating user'), |
|
| 2027 | - 'cal_created' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'creation time of event'), |
|
| 2028 | - 'cal_recurrence' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0','comment' => 'cal_start of original recurrence for exception'), |
|
| 2029 | - 'tz_id' => array('type' => 'int','precision' => '4','comment' => 'key into egw_cal_timezones'), |
|
| 2030 | - 'cal_deleted' => array('type' => 'int','precision' => '8','comment' => 'ts when event was deleted') |
|
| 2020 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
| 2021 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'cal_id of series for exception'), |
|
| 2022 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4', 'comment' => 'user who last modified event'), |
|
| 2023 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0', 'comment' => '1 for non-blocking events'), |
|
| 2024 | + 'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
| 2025 | + 'cal_etag' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'comment' => 'etag for optimistic locking'), |
|
| 2026 | + 'cal_creator' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'creating user'), |
|
| 2027 | + 'cal_created' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'comment' => 'creation time of event'), |
|
| 2028 | + 'cal_recurrence' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0', 'comment' => 'cal_start of original recurrence for exception'), |
|
| 2029 | + 'tz_id' => array('type' => 'int', 'precision' => '4', 'comment' => 'key into egw_cal_timezones'), |
|
| 2030 | + 'cal_deleted' => array('type' => 'int', 'precision' => '8', 'comment' => 'ts when event was deleted') |
|
| 2031 | 2031 | ), |
| 2032 | 2032 | 'pk' => array('cal_id'), |
| 2033 | 2033 | 'fk' => array(), |
| 2034 | - 'ix' => array('cal_uid','cal_owner','cal_deleted'), |
|
| 2034 | + 'ix' => array('cal_uid', 'cal_owner', 'cal_deleted'), |
|
| 2035 | 2035 | 'uc' => array() |
| 2036 | - ),array( |
|
| 2036 | + ), array( |
|
| 2037 | 2037 | // for deleted rows use cal_modified as deleted date, NULL for not deleted ones |
| 2038 | - 'cal_deleted' => 'CASE cal_deleted WHEN '.$GLOBALS['egw_setup']->db->quote(true,'bool').' THEN cal_modified ELSE NULL END', |
|
| 2038 | + 'cal_deleted' => 'CASE cal_deleted WHEN '.$GLOBALS['egw_setup']->db->quote(true, 'bool').' THEN cal_modified ELSE NULL END', |
|
| 2039 | 2039 | )); |
| 2040 | 2040 | |
| 2041 | 2041 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.002'; |
@@ -2047,16 +2047,16 @@ discard block |
||
| 2047 | 2047 | */ |
| 2048 | 2048 | function calendar_upgrade1_9_002() |
| 2049 | 2049 | { |
| 2050 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','caldav_name',array( |
|
| 2050 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'caldav_name', array( |
|
| 2051 | 2051 | 'type' => 'varchar', |
| 2052 | 2052 | 'precision' => '64', |
| 2053 | 2053 | 'comment' => 'name part of CalDAV URL, if specified by client' |
| 2054 | 2054 | )); |
| 2055 | - $GLOBALS['egw_setup']->db->query($sql='UPDATE egw_cal SET caldav_name='. |
|
| 2055 | + $GLOBALS['egw_setup']->db->query($sql = 'UPDATE egw_cal SET caldav_name='. |
|
| 2056 | 2056 | $GLOBALS['egw_setup']->db->concat( |
| 2057 | - $GLOBALS['egw_setup']->db->to_varchar('cal_id'),"'.ics'"),__LINE__,__FILE__); |
|
| 2057 | + $GLOBALS['egw_setup']->db->to_varchar('cal_id'), "'.ics'"), __LINE__, __FILE__); |
|
| 2058 | 2058 | |
| 2059 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','caldav_name'); |
|
| 2059 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'caldav_name'); |
|
| 2060 | 2060 | |
| 2061 | 2061 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.003'; |
| 2062 | 2062 | } |
@@ -2067,8 +2067,8 @@ discard block |
||
| 2067 | 2067 | */ |
| 2068 | 2068 | function calendar_upgrade1_9_003() |
| 2069 | 2069 | { |
| 2070 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_modified'); |
|
| 2071 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user','cal_user_modified'); |
|
| 2070 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_modified'); |
|
| 2071 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user', 'cal_user_modified'); |
|
| 2072 | 2072 | |
| 2073 | 2073 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.004'; |
| 2074 | 2074 | } |
@@ -2080,7 +2080,7 @@ discard block |
||
| 2080 | 2080 | */ |
| 2081 | 2081 | function calendar_upgrade1_9_004() |
| 2082 | 2082 | { |
| 2083 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_dates','recur_exception',array( |
|
| 2083 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_dates', 'recur_exception', array( |
|
| 2084 | 2084 | 'type' => 'bool', |
| 2085 | 2085 | 'default' => '', |
| 2086 | 2086 | 'null' => false, |
@@ -2088,16 +2088,16 @@ discard block |
||
| 2088 | 2088 | )); |
| 2089 | 2089 | |
| 2090 | 2090 | // migrate existing exceptions to egw_cal_dates |
| 2091 | - foreach($GLOBALS['egw_setup']->db->select('egw_cal_repeats', |
|
| 2091 | + foreach ($GLOBALS['egw_setup']->db->select('egw_cal_repeats', |
|
| 2092 | 2092 | 'egw_cal_repeats.cal_id AS cal_id,egw_cal_repeats.recur_exception AS recur_exception,MIN(cal_start) AS cal_start,MIN(cal_end) AS cal_end', |
| 2093 | 2093 | 'egw_cal_repeats.recur_exception IS NOT NULL', __LINE__, __FILE__, false, |
| 2094 | 2094 | 'GROUP BY egw_cal_repeats.cal_id,egw_cal_repeats.recur_exception', 'calendar', '', |
| 2095 | 2095 | 'JOIN egw_cal_dates ON egw_cal_repeats.cal_id=egw_cal_dates.cal_id') as $row) |
| 2096 | 2096 | { |
| 2097 | - foreach($row['recur_exception'] ? array_unique(explode(',', $row['recur_exception'])) : array() as $recur_exception) |
|
| 2097 | + foreach ($row['recur_exception'] ? array_unique(explode(',', $row['recur_exception'])) : array() as $recur_exception) |
|
| 2098 | 2098 | { |
| 2099 | 2099 | $GLOBALS['egw_setup']->db->insert('egw_cal_dates', array( |
| 2100 | - 'cal_end' => $recur_exception+$row['cal_end']-$row['cal_start'], |
|
| 2100 | + 'cal_end' => $recur_exception + $row['cal_end'] - $row['cal_start'], |
|
| 2101 | 2101 | 'recur_exception' => true, |
| 2102 | 2102 | ), array( |
| 2103 | 2103 | 'cal_id' => $row['cal_id'], |
@@ -2109,11 +2109,11 @@ discard block |
||
| 2109 | 2109 | |
| 2110 | 2110 | $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array( |
| 2111 | 2111 | 'fd' => array( |
| 2112 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
| 2113 | - 'recur_type' => array('type' => 'int','precision' => '2','nullable' => False), |
|
| 2114 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
| 2115 | - 'recur_interval' => array('type' => 'int','precision' => '2','default' => '1'), |
|
| 2116 | - 'recur_data' => array('type' => 'int','precision' => '2','default' => '1'), |
|
| 2112 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
| 2113 | + 'recur_type' => array('type' => 'int', 'precision' => '2', 'nullable' => False), |
|
| 2114 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
| 2115 | + 'recur_interval' => array('type' => 'int', 'precision' => '2', 'default' => '1'), |
|
| 2116 | + 'recur_data' => array('type' => 'int', 'precision' => '2', 'default' => '1'), |
|
| 2117 | 2117 | ), |
| 2118 | 2118 | 'pk' => array('cal_id'), |
| 2119 | 2119 | 'fk' => array(), |
@@ -2134,19 +2134,19 @@ discard block |
||
| 2134 | 2134 | // returns NULL, if there are no rows! |
| 2135 | 2135 | if ((int)$max_description_length <= 16384 && $GLOBALS['egw_setup']->oProc->max_varchar_length >= 16384) |
| 2136 | 2136 | { |
| 2137 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_description',array( |
|
| 2137 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_description', array( |
|
| 2138 | 2138 | 'type' => 'varchar', |
| 2139 | 2139 | 'precision' => '16384' |
| 2140 | 2140 | )); |
| 2141 | 2141 | } |
| 2142 | 2142 | // allow more categories |
| 2143 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_category',array( |
|
| 2143 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_category', array( |
|
| 2144 | 2144 | 'type' => 'varchar', |
| 2145 | 2145 | 'precision' => '64', |
| 2146 | 2146 | 'comment' => 'category id(s)' |
| 2147 | 2147 | )); |
| 2148 | 2148 | // remove silly default of 1 |
| 2149 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_title',array( |
|
| 2149 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_title', array( |
|
| 2150 | 2150 | 'type' => 'varchar', |
| 2151 | 2151 | 'precision' => '255', |
| 2152 | 2152 | 'nullable' => False |
@@ -2161,14 +2161,14 @@ discard block |
||
| 2161 | 2161 | { |
| 2162 | 2162 | // PostgreSQL needs temporary a nullable column, to not stall on broken events without dates! |
| 2163 | 2163 | // We add that constrain in 1.9.007, after deleting all rows with range_start=0 OR range_start IS NULL |
| 2164 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','range_start',array( |
|
| 2164 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'range_start', array( |
|
| 2165 | 2165 | 'type' => 'int', |
| 2166 | 2166 | 'precision' => '8', |
| 2167 | 2167 | 'comment' => 'startdate (of range)' |
| 2168 | 2168 | )); |
| 2169 | 2169 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET range_start = (SELECT MIN(cal_start) FROM egw_cal_dates WHERE egw_cal_dates.cal_id=egw_cal.cal_id)', __LINE__, __FILE__); |
| 2170 | 2170 | |
| 2171 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','range_end',array( |
|
| 2171 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'range_end', array( |
|
| 2172 | 2172 | 'type' => 'int', |
| 2173 | 2173 | 'precision' => '8', |
| 2174 | 2174 | 'comment' => 'enddate (of range, UNTIL of RRULE)' |
@@ -2184,18 +2184,18 @@ discard block |
||
| 2184 | 2184 | { |
| 2185 | 2185 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET range_end=recur_enddate FROM egw_cal_repeats WHERE egw_cal.cal_id=egw_cal_repeats.cal_id', __LINE__, __FILE__); |
| 2186 | 2186 | } |
| 2187 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats',array( |
|
| 2187 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array( |
|
| 2188 | 2188 | 'fd' => array( |
| 2189 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
| 2190 | - 'recur_type' => array('type' => 'int','precision' => '2','nullable' => False), |
|
| 2191 | - 'recur_interval' => array('type' => 'int','precision' => '2','default' => '1'), |
|
| 2192 | - 'recur_data' => array('type' => 'int','precision' => '2','default' => '1') |
|
| 2189 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
| 2190 | + 'recur_type' => array('type' => 'int', 'precision' => '2', 'nullable' => False), |
|
| 2191 | + 'recur_interval' => array('type' => 'int', 'precision' => '2', 'default' => '1'), |
|
| 2192 | + 'recur_data' => array('type' => 'int', 'precision' => '2', 'default' => '1') |
|
| 2193 | 2193 | ), |
| 2194 | 2194 | 'pk' => array('cal_id'), |
| 2195 | 2195 | 'fk' => array(), |
| 2196 | 2196 | 'ix' => array(), |
| 2197 | 2197 | 'uc' => array() |
| 2198 | - ),'recur_enddate'); |
|
| 2198 | + ), 'recur_enddate'); |
|
| 2199 | 2199 | |
| 2200 | 2200 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.007'; |
| 2201 | 2201 | } |
@@ -2207,14 +2207,14 @@ discard block |
||
| 2207 | 2207 | */ |
| 2208 | 2208 | function calendar_upgrade1_9_007() |
| 2209 | 2209 | { |
| 2210 | - foreach(array('egw_cal_repeats','egw_cal_dates','egw_cal_user','egw_cal_extra') as $table) |
|
| 2210 | + foreach (array('egw_cal_repeats', 'egw_cal_dates', 'egw_cal_user', 'egw_cal_extra') as $table) |
|
| 2211 | 2211 | { |
| 2212 | 2212 | $GLOBALS['egw_setup']->db->query("DELETE FROM $table WHERE cal_id IN (SELECT cal_id FROM egw_cal WHERE range_start=0 OR range_start IS NULL)", __LINE__, __FILE__); |
| 2213 | 2213 | } |
| 2214 | 2214 | $GLOBALS['egw_setup']->db->query("DELETE FROM egw_cal WHERE range_start=0 OR range_start IS NULL", __LINE__, __FILE__); |
| 2215 | 2215 | |
| 2216 | 2216 | // now we can remove temporary default of 0 from range_start and set it NOT NULL |
| 2217 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','range_start',array( |
|
| 2217 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'range_start', array( |
|
| 2218 | 2218 | 'type' => 'int', |
| 2219 | 2219 | 'precision' => '8', |
| 2220 | 2220 | 'nullable' => False, |
@@ -2279,7 +2279,7 @@ discard block |
||
| 2279 | 2279 | |
| 2280 | 2280 | function calendar_upgrade1_9_010() |
| 2281 | 2281 | { |
| 2282 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','caldav_name',array( |
|
| 2282 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'caldav_name', array( |
|
| 2283 | 2283 | 'type' => 'varchar', |
| 2284 | 2284 | 'precision' => '200', |
| 2285 | 2285 | 'comment' => 'name part of CalDAV URL, if specified by client' |
@@ -2309,7 +2309,7 @@ discard block |
||
| 2309 | 2309 | SET cal_reference=0,cal_recurrence=0,cal_etag=cal_etag+1,cal_modifier=0,cal_modified=".time()." |
| 2310 | 2310 | WHERE cal_reference != 0 AND cal_id IN (SELECT cal_id FROM egw_cal_repeats)", __LINE__, __FILE__); |
| 2311 | 2311 | |
| 2312 | - foreach($GLOBALS['egw_setup']->db->query( |
|
| 2312 | + foreach ($GLOBALS['egw_setup']->db->query( |
|
| 2313 | 2313 | "SELECT DISTINCT master.cal_id,egw_cal_user.cal_user_type,egw_cal_user.cal_user_id,'E' AS cal_status |
| 2314 | 2314 | FROM egw_cal_user |
| 2315 | 2315 | JOIN egw_cal ON egw_cal_user.cal_id=egw_cal.cal_id |
@@ -2336,7 +2336,7 @@ discard block |
||
| 2336 | 2336 | */ |
| 2337 | 2337 | function calendar_upgrade14_1_001() |
| 2338 | 2338 | { |
| 2339 | - foreach($GLOBALS['egw_setup']->db->query( |
|
| 2339 | + foreach ($GLOBALS['egw_setup']->db->query( |
|
| 2340 | 2340 | "SELECT egw_cal.cal_id AS cal_id,cal_start,cal_end,range_start,range_end,egw_cal_repeats.*,tz_tzid AS tzid |
| 2341 | 2341 | FROM egw_cal |
| 2342 | 2342 | JOIN egw_cal_repeats ON egw_cal_repeats.cal_id=egw_cal.cal_id |
@@ -2364,7 +2364,7 @@ discard block |
||
| 2364 | 2364 | $enddate->modify(($event['end'] - $event['start']).' second'); |
| 2365 | 2365 | if (($range_end = $enddate->format('server')) != $event['range_end']) |
| 2366 | 2366 | { |
| 2367 | - $GLOBALS['egw_setup']->db->update('egw_cal',array( |
|
| 2367 | + $GLOBALS['egw_setup']->db->update('egw_cal', array( |
|
| 2368 | 2368 | 'range_end' => $range_end, |
| 2369 | 2369 | 'cal_etag=cal_etag+1', |
| 2370 | 2370 | 'cal_modified' => time(), |
@@ -2374,7 +2374,7 @@ discard block |
||
| 2374 | 2374 | //error_log(__FUNCTION__."() #$event[id], start=".date('Y-m-d H:i:s', $event['start']).', end='.date('Y-m-d H:i:s', $event['end']).', range_end='.date('Y-m-d H:i:s', $event['recur_enddate']).' --> '.date('Y-m-d H:i:s', $range_end)); |
| 2375 | 2375 | } |
| 2376 | 2376 | } |
| 2377 | - return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.002'; // skip 14.2.001 update, as query is fixed now |
|
| 2377 | + return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.002'; // skip 14.2.001 update, as query is fixed now |
|
| 2378 | 2378 | } |
| 2379 | 2379 | |
| 2380 | 2380 | /** |
@@ -2398,7 +2398,7 @@ discard block |
||
| 2398 | 2398 | // if maximum is bigger then 3 |
| 2399 | 2399 | if ($values[1] > 3) |
| 2400 | 2400 | { |
| 2401 | - switch($GLOBALS['egw_setup']->db->Type) |
|
| 2401 | + switch ($GLOBALS['egw_setup']->db->Type) |
|
| 2402 | 2402 | { |
| 2403 | 2403 | case 'mysql': |
| 2404 | 2404 | $sql = "UPDATE egw_cal |
@@ -2443,7 +2443,7 @@ discard block |
||
| 2443 | 2443 | |
| 2444 | 2444 | function calendar_upgrade14_2_003() |
| 2445 | 2445 | { |
| 2446 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_uid',array( |
|
| 2446 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_uid', array( |
|
| 2447 | 2447 | 'type' => 'ascii', |
| 2448 | 2448 | 'precision' => '128', |
| 2449 | 2449 | 'nullable' => False, |
@@ -2455,13 +2455,13 @@ discard block |
||
| 2455 | 2455 | { |
| 2456 | 2456 | $GLOBALS['egw_setup']->db->query("UPDATE egw_cal SET cal_category='' WHERE cal_category NOT REGEXP '^[0-9,]*$'", __LINE__, __FILE__); |
| 2457 | 2457 | } |
| 2458 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_category',array( |
|
| 2458 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_category', array( |
|
| 2459 | 2459 | 'type' => 'ascii', |
| 2460 | 2460 | 'meta' => 'category', |
| 2461 | 2461 | 'precision' => '64', |
| 2462 | 2462 | 'comment' => 'category id(s)' |
| 2463 | 2463 | )); |
| 2464 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','caldav_name',array( |
|
| 2464 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'caldav_name', array( |
|
| 2465 | 2465 | 'type' => 'ascii', |
| 2466 | 2466 | 'precision' => '128', |
| 2467 | 2467 | 'comment' => 'name part of CalDAV URL, if specified by client' |
@@ -2518,22 +2518,22 @@ discard block |
||
| 2518 | 2518 | 'type' => 'auto', |
| 2519 | 2519 | 'nullable' => False |
| 2520 | 2520 | ));*/ |
| 2521 | - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user',array( |
|
| 2521 | + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user', array( |
|
| 2522 | 2522 | 'fd' => array( |
| 2523 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
| 2524 | - 'cal_recur_date' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'default' => '0'), |
|
| 2525 | - 'cal_user_type' => array('type' => 'ascii','precision' => '1','nullable' => False,'default' => 'u','comment' => 'u=user, g=group, c=contact, r=resource, e=email'), |
|
| 2526 | - 'cal_user_id' => array('type' => 'varchar','meta' => array("cal_user_type='u'" => 'account'),'precision' => '128','nullable' => False,'comment' => 'id or email-address for type=e'), |
|
| 2527 | - 'cal_status' => array('type' => 'ascii','precision' => '1','default' => 'A','comment' => 'U=unknown, A=accepted, R=rejected, T=tentative'), |
|
| 2528 | - 'cal_quantity' => array('type' => 'int','precision' => '4','default' => '1','comment' => 'only for certain types (eg. resources)'), |
|
| 2529 | - 'cal_role' => array('type' => 'ascii','precision' => '64','default' => 'REQ-PARTICIPANT','comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id'), |
|
| 2530 | - 'cal_user_modified' => array('type' => 'timestamp','default' => 'current_timestamp','comment' => 'automatic timestamp of last update'), |
|
| 2531 | - 'cal_user_auto' => array('type' => 'auto','nullable' => False) |
|
| 2523 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
| 2524 | + 'cal_recur_date' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
| 2525 | + 'cal_user_type' => array('type' => 'ascii', 'precision' => '1', 'nullable' => False, 'default' => 'u', 'comment' => 'u=user, g=group, c=contact, r=resource, e=email'), |
|
| 2526 | + 'cal_user_id' => array('type' => 'varchar', 'meta' => array("cal_user_type='u'" => 'account'), 'precision' => '128', 'nullable' => False, 'comment' => 'id or email-address for type=e'), |
|
| 2527 | + 'cal_status' => array('type' => 'ascii', 'precision' => '1', 'default' => 'A', 'comment' => 'U=unknown, A=accepted, R=rejected, T=tentative'), |
|
| 2528 | + 'cal_quantity' => array('type' => 'int', 'precision' => '4', 'default' => '1', 'comment' => 'only for certain types (eg. resources)'), |
|
| 2529 | + 'cal_role' => array('type' => 'ascii', 'precision' => '64', 'default' => 'REQ-PARTICIPANT', 'comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id'), |
|
| 2530 | + 'cal_user_modified' => array('type' => 'timestamp', 'default' => 'current_timestamp', 'comment' => 'automatic timestamp of last update'), |
|
| 2531 | + 'cal_user_auto' => array('type' => 'auto', 'nullable' => False) |
|
| 2532 | 2532 | ), |
| 2533 | 2533 | 'pk' => array('cal_user_auto'), |
| 2534 | 2534 | 'fk' => array(), |
| 2535 | - 'ix' => array('cal_user_modified',array('cal_user_type','cal_user_id')), |
|
| 2536 | - 'uc' => array(array('cal_id','cal_recur_date','cal_user_type','cal_user_id')) |
|
| 2535 | + 'ix' => array('cal_user_modified', array('cal_user_type', 'cal_user_id')), |
|
| 2536 | + 'uc' => array(array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id')) |
|
| 2537 | 2537 | )); |
| 2538 | 2538 | |
| 2539 | 2539 | return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.005'; |
@@ -2542,12 +2542,12 @@ discard block |
||
| 2542 | 2542 | |
| 2543 | 2543 | function calendar_upgrade14_2_005() |
| 2544 | 2544 | { |
| 2545 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones','tz_tzid',array( |
|
| 2545 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones', 'tz_tzid', array( |
|
| 2546 | 2546 | 'type' => 'ascii', |
| 2547 | 2547 | 'precision' => '128', |
| 2548 | 2548 | 'nullable' => False |
| 2549 | 2549 | )); |
| 2550 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones','tz_component',array( |
|
| 2550 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones', 'tz_component', array( |
|
| 2551 | 2551 | 'type' => 'ascii', |
| 2552 | 2552 | 'precision' => '8192', |
| 2553 | 2553 | 'comment' => 'iCal VTIMEZONE component' |
@@ -2563,7 +2563,7 @@ discard block |
||
| 2563 | 2563 | */ |
| 2564 | 2564 | function calendar_upgrade14_3() |
| 2565 | 2565 | { |
| 2566 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_user_attendee',array( |
|
| 2566 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_user_attendee', array( |
|
| 2567 | 2567 | 'type' => 'varchar', |
| 2568 | 2568 | 'precision' => '255', |
| 2569 | 2569 | 'comment' => 'email or json object with attr. cn, url, ...' |
@@ -2574,12 +2574,12 @@ discard block |
||
| 2574 | 2574 | |
| 2575 | 2575 | // delete all but one row, which would give a doublicate key, after above normalising of email addresses |
| 2576 | 2576 | // by ordering by status we prever accepted over tentative over unknow over deleted |
| 2577 | - foreach($GLOBALS['egw_setup']->db->select('egw_cal_user', "cal_id,cal_recur_date,$email AS email", array( |
|
| 2577 | + foreach ($GLOBALS['egw_setup']->db->select('egw_cal_user', "cal_id,cal_recur_date,$email AS email", array( |
|
| 2578 | 2578 | 'cal_user_type' => 'e', |
| 2579 | 2579 | ), __LINE__, __FILE__, false, "GROUP BY cal_id,cal_recur_date,$email HAVING COUNT(*)>1", 'calendar') as $row) |
| 2580 | 2580 | { |
| 2581 | 2581 | $n = 0; |
| 2582 | - foreach($GLOBALS['egw_setup']->db->select('egw_cal_user', "*,$email AS email", array( |
|
| 2582 | + foreach ($GLOBALS['egw_setup']->db->select('egw_cal_user', "*,$email AS email", array( |
|
| 2583 | 2583 | 'cal_id' => $row['cal_id'], |
| 2584 | 2584 | 'cal_recur_date' => $row['cal_recur_date'], |
| 2585 | 2585 | 'cal_user_type' => 'e', |
@@ -2588,7 +2588,7 @@ discard block |
||
| 2588 | 2588 | { |
| 2589 | 2589 | if (strpos($user['email'], '@') !== false && !$n++) continue; |
| 2590 | 2590 | $GLOBALS['egw_setup']->db->delete('egw_cal_user', |
| 2591 | - array_intersect_key($user, array_flip(array('cal_id','cal_recur_date','cal_user_type','cal_user_id','cal_status'))), |
|
| 2591 | + array_intersect_key($user, array_flip(array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id', 'cal_status'))), |
|
| 2592 | 2592 | __LINE__, __FILE__, 'calendar'); |
| 2593 | 2593 | } |
| 2594 | 2594 | } |
@@ -2598,7 +2598,7 @@ discard block |
||
| 2598 | 2598 | "UPDATE egw_cal_user SET cal_user_attendee=cal_user_id,cal_user_id=MD5($email) WHERE cal_user_type='e'", |
| 2599 | 2599 | __LINE__, __FILE__); |
| 2600 | 2600 | |
| 2601 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
| 2601 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
| 2602 | 2602 | 'type' => 'ascii', |
| 2603 | 2603 | 'meta' => array( |
| 2604 | 2604 | "cal_user_type='u'" => 'account' |
@@ -2620,7 +2620,7 @@ discard block |
||
| 2620 | 2620 | { |
| 2621 | 2621 | $GLOBALS['calendar_upgrade14_3_001-run'] = true; |
| 2622 | 2622 | |
| 2623 | - foreach($GLOBALS['egw_setup']->db->query("SELECT egw_cal_user.cal_id AS cal_id,egw_cal_user.cal_user_id AS cal_user_id,egw_cal_user.cal_user_attendee AS cal_user_attendee |
|
| 2623 | + foreach ($GLOBALS['egw_setup']->db->query("SELECT egw_cal_user.cal_id AS cal_id,egw_cal_user.cal_user_id AS cal_user_id,egw_cal_user.cal_user_attendee AS cal_user_attendee |
|
| 2624 | 2624 | FROM egw_cal_user |
| 2625 | 2625 | JOIN egw_cal_user euser ON euser.cal_id=egw_cal_user.cal_id AND euser.cal_user_type='e' AND euser.cal_user_id=egw_cal_user.cal_user_id AND euser.cal_user_attendee IS NULL |
| 2626 | 2626 | WHERE egw_cal_user.cal_user_type='e' AND egw_cal_user.cal_user_attendee IS NOT NULL |
@@ -2671,8 +2671,8 @@ discard block |
||
| 2671 | 2671 | { |
| 2672 | 2672 | Api\Preferences::change_preference('calendar', '/^favorite_/', function($attr, $old_value, $owner) |
| 2673 | 2673 | { |
| 2674 | - unset($attr, $owner); // not used, but required by function signature |
|
| 2675 | - if($old_value['state'] && is_array($old_value['state'])) |
|
| 2674 | + unset($attr, $owner); // not used, but required by function signature |
|
| 2675 | + if ($old_value['state'] && is_array($old_value['state'])) |
|
| 2676 | 2676 | { |
| 2677 | 2677 | unset($old_value['state']['date']); |
| 2678 | 2678 | unset($old_value['state']['startdate']); |
@@ -2692,15 +2692,15 @@ discard block |
||
| 2692 | 2692 | { |
| 2693 | 2693 | Api\Preferences::change_preference('calendar', 'use_time_grid', function($attr, $old_value, $owner) |
| 2694 | 2694 | { |
| 2695 | - unset($attr, $owner); // not used, but required by function signature |
|
| 2696 | - switch($old_value) |
|
| 2695 | + unset($attr, $owner); // not used, but required by function signature |
|
| 2696 | + switch ($old_value) |
|
| 2697 | 2697 | { |
| 2698 | 2698 | case 'all': |
| 2699 | 2699 | return 0; |
| 2700 | 2700 | case 'day_week': |
| 2701 | - return ['day','day4','week']; |
|
| 2701 | + return ['day', 'day4', 'week']; |
|
| 2702 | 2702 | case 'day4': |
| 2703 | - return ['day','day4']; |
|
| 2703 | + return ['day', 'day4']; |
|
| 2704 | 2704 | } |
| 2705 | 2705 | return null; |
| 2706 | 2706 | }); |
@@ -2725,7 +2725,7 @@ discard block |
||
| 2725 | 2725 | function calendar_upgrade16_1_001() |
| 2726 | 2726 | { |
| 2727 | 2727 | $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_extra', 'cal_extra_value', |
| 2728 | - array('type' => 'varchar','meta' => 'cfvalue','precision' => '16384','nullable' => False,'default' => '')); |
|
| 2728 | + array('type' => 'varchar', 'meta' => 'cfvalue', 'precision' => '16384', 'nullable' => False, 'default' => '')); |
|
| 2729 | 2729 | |
| 2730 | 2730 | Api\Preferences::change_preference('calendar', 'defaultresource_sel', 'resources', 'addressbook', 'forced'); |
| 2731 | 2731 | Api\Preferences::change_preference('calendar', 'defaultresource_sel', 'resources', 'addressbook', 'default'); |
@@ -2737,8 +2737,8 @@ discard block |
||
| 2737 | 2737 | { |
| 2738 | 2738 | // Explicitly add months as showing list of events, no times |
| 2739 | 2739 | $change = function($attr, $old_value, $owner) { |
| 2740 | - if($owner == Api\Preferences::FORCED_ID) return; |
|
| 2741 | - if(is_array($old_value) && !in_array('month', $old_value)) |
|
| 2740 | + if ($owner == Api\Preferences::FORCED_ID) return; |
|
| 2741 | + if (is_array($old_value) && !in_array('month', $old_value)) |
|
| 2742 | 2742 | { |
| 2743 | 2743 | $old_value[] = 'month'; |
| 2744 | 2744 | } |
@@ -1429,13 +1429,18 @@ discard block |
||
| 1429 | 1429 | function calendar_upgrade1_0_1_008() |
| 1430 | 1430 | { |
| 1431 | 1431 | $config_data = Api\Config::read('calendar'); |
| 1432 | - if (isset($config_data['fields'])) // old custom fields |
|
| 1432 | + if (isset($config_data['fields'])) |
|
| 1433 | + { |
|
| 1434 | + // old custom fields |
|
| 1433 | 1435 | { |
| 1434 | 1436 | $customfields = array(); |
| 1437 | + } |
|
| 1435 | 1438 | $order = 0; |
| 1436 | 1439 | foreach($config_data['fields'] as $name => $data) |
| 1437 | 1440 | { |
| 1438 | - if ($name{0} == '#' && !$data['disabled']) // real not-disabled custom field |
|
| 1441 | + if ($name{0} == '#' && !$data['disabled']) |
|
| 1442 | + { |
|
| 1443 | + // real not-disabled custom field |
|
| 1439 | 1444 | { |
| 1440 | 1445 | $customfields[substr($name,1)] = array( |
| 1441 | 1446 | 'type' => 'text', |
@@ -1444,6 +1449,7 @@ discard block |
||
| 1444 | 1449 | 'order' => ($order += 10), |
| 1445 | 1450 | ); |
| 1446 | 1451 | } |
| 1452 | + } |
|
| 1447 | 1453 | } |
| 1448 | 1454 | if (count($customfields)) |
| 1449 | 1455 | { |
@@ -2584,9 +2590,12 @@ discard block |
||
| 2584 | 2590 | 'cal_recur_date' => $row['cal_recur_date'], |
| 2585 | 2591 | 'cal_user_type' => 'e', |
| 2586 | 2592 | $email.'='.$GLOBALS['egw_setup']->db->quote($row['email']), |
| 2587 | - ), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user) // order A, T, U, X |
|
| 2593 | + ), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user) |
|
| 2594 | + { |
|
| 2595 | + // order A, T, U, X |
|
| 2588 | 2596 | { |
| 2589 | 2597 | if (strpos($user['email'], '@') !== false && !$n++) continue; |
| 2598 | + } |
|
| 2590 | 2599 | $GLOBALS['egw_setup']->db->delete('egw_cal_user', |
| 2591 | 2600 | array_intersect_key($user, array_flip(array('cal_id','cal_recur_date','cal_user_type','cal_user_id','cal_status'))), |
| 2592 | 2601 | __LINE__, __FILE__, 'calendar'); |
@@ -2736,8 +2745,12 @@ discard block |
||
| 2736 | 2745 | function calendar_upgrade16_1_002() |
| 2737 | 2746 | { |
| 2738 | 2747 | // Explicitly add months as showing list of events, no times |
| 2739 | - $change = function($attr, $old_value, $owner) { |
|
| 2740 | - if($owner == Api\Preferences::FORCED_ID) return; |
|
| 2748 | + $change = function($attr, $old_value, $owner) |
|
| 2749 | + { |
|
| 2750 | + if($owner == Api\Preferences::FORCED_ID) |
|
| 2751 | + { |
|
| 2752 | + return; |
|
| 2753 | + } |
|
| 2741 | 2754 | if(is_array($old_value) && !in_array('month', $old_value)) |
| 2742 | 2755 | { |
| 2743 | 2756 | $old_value[] = 'month'; |
@@ -17,12 +17,12 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | if (!defined('ACL_TYPE_IDENTIFER')) // used to mark ACL-values for the debug_message methode |
| 19 | 19 | { |
| 20 | - define('ACL_TYPE_IDENTIFER','***ACL***'); |
|
| 20 | + define('ACL_TYPE_IDENTIFER', '***ACL***'); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | -define('HOUR_s',60*60); |
|
| 24 | -define('DAY_s',24*HOUR_s); |
|
| 25 | -define('WEEK_s',7*DAY_s); |
|
| 23 | +define('HOUR_s', 60 * 60); |
|
| 24 | +define('DAY_s', 24 * HOUR_s); |
|
| 25 | +define('WEEK_s', 7 * DAY_s); |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * Required (!) include, as we use the MCAL_* constants, BEFORE instanciating (and therefore autoloading) the class |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * 4 = function-calls to exported conversation-functions like date2ts, date2array, ... |
| 72 | 72 | * 5 = function-calls to private functions |
| 73 | 73 | */ |
| 74 | - var $debug=false; |
|
| 74 | + var $debug = false; |
|
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * @var int $now timestamp in server-time |
@@ -101,12 +101,12 @@ discard block |
||
| 101 | 101 | /** |
| 102 | 102 | * @var int $user nummerical id of the current user-id |
| 103 | 103 | */ |
| 104 | - var $user=0; |
|
| 104 | + var $user = 0; |
|
| 105 | 105 | |
| 106 | 106 | /** |
| 107 | 107 | * @var array $grants grants of the current user, array with user-id / ored-ACL-rights pairs |
| 108 | 108 | */ |
| 109 | - var $grants=array(); |
|
| 109 | + var $grants = array(); |
|
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | 112 | * @var array $verbose_status translated 1-char status values to a verbose name, run through lang() by the constructor |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | function __construct() |
| 221 | 221 | { |
| 222 | - if ($this->debug > 0) $this->debug_message('calendar_bo::bocal() started',True); |
|
| 222 | + if ($this->debug > 0) $this->debug_message('calendar_bo::bocal() started', True); |
|
| 223 | 223 | |
| 224 | 224 | $this->so = new calendar_so(); |
| 225 | 225 | |
@@ -240,11 +240,11 @@ discard block |
||
| 240 | 240 | } |
| 241 | 241 | $GLOBALS['egw_info']['user']['preferences'] = $GLOBALS['egw']->preferences->read_repository(); |
| 242 | 242 | } |
| 243 | - $this->common_prefs =& $GLOBALS['egw_info']['user']['preferences']['common']; |
|
| 244 | - $this->cal_prefs =& $GLOBALS['egw_info']['user']['preferences']['calendar']; |
|
| 243 | + $this->common_prefs = & $GLOBALS['egw_info']['user']['preferences']['common']; |
|
| 244 | + $this->cal_prefs = & $GLOBALS['egw_info']['user']['preferences']['calendar']; |
|
| 245 | 245 | |
| 246 | 246 | $this->now = time(); |
| 247 | - $this->now_su = Api\DateTime::server2user($this->now,'ts'); |
|
| 247 | + $this->now_su = Api\DateTime::server2user($this->now, 'ts'); |
|
| 248 | 248 | |
| 249 | 249 | $this->user = $GLOBALS['egw_info']['user']['account_id']; |
| 250 | 250 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | if (!is_array($this->resources = Api\Cache::getSession('calendar', 'resources'))) |
| 254 | 254 | { |
| 255 | 255 | $this->resources = array(); |
| 256 | - foreach(Api\Hooks::process('calendar_resources') as $app => $data) |
|
| 256 | + foreach (Api\Hooks::process('calendar_resources') as $app => $data) |
|
| 257 | 257 | { |
| 258 | 258 | if ($data && $data['type']) |
| 259 | 259 | { |
@@ -266,8 +266,8 @@ discard block |
||
| 266 | 266 | 'app' => 'email', |
| 267 | 267 | ); |
| 268 | 268 | $this->resources['l'] = array( |
| 269 | - 'type' => 'l',// one char type-identifier for this resources |
|
| 270 | - 'info' => __CLASS__ .'::mailing_lists',// info method, returns array with id, type & name for a given id |
|
| 269 | + 'type' => 'l', // one char type-identifier for this resources |
|
| 270 | + 'info' => __CLASS__.'::mailing_lists', // info method, returns array with id, type & name for a given id |
|
| 271 | 271 | 'app' => 'Distribution list' |
| 272 | 272 | ); |
| 273 | 273 | $this->resources[''] = array( |
@@ -275,22 +275,22 @@ discard block |
||
| 275 | 275 | 'app' => 'api-accounts', |
| 276 | 276 | ); |
| 277 | 277 | $this->resources['l'] = array( |
| 278 | - 'type' => 'l',// one char type-identifier for this resources |
|
| 279 | - 'info' => __CLASS__ .'::mailing_lists',// info method, returns array with id, type & name for a given id |
|
| 278 | + 'type' => 'l', // one char type-identifier for this resources |
|
| 279 | + 'info' => __CLASS__.'::mailing_lists', // info method, returns array with id, type & name for a given id |
|
| 280 | 280 | 'app' => 'Distribution list' |
| 281 | 281 | ); |
| 282 | 282 | Api\Cache::setSession('calendar', 'resources', $this->resources); |
| 283 | 283 | } |
| 284 | 284 | //error_log(__METHOD__ . " registered resources=". array2string($this->resources)); |
| 285 | 285 | |
| 286 | - $this->config = Api\Config::read('calendar'); // only used for horizont, regular calendar config is under phpgwapi |
|
| 286 | + $this->config = Api\Config::read('calendar'); // only used for horizont, regular calendar config is under phpgwapi |
|
| 287 | 287 | $this->require_acl_invite = $GLOBALS['egw_info']['server']['require_acl_invite']; |
| 288 | 288 | |
| 289 | - $this->categories = new Api\Categories($this->user,'calendar'); |
|
| 289 | + $this->categories = new Api\Categories($this->user, 'calendar'); |
|
| 290 | 290 | |
| 291 | 291 | $this->customfields = Api\Storage\Customfields::get('calendar'); |
| 292 | 292 | |
| 293 | - foreach($this->alarms as $secs => &$label) |
|
| 293 | + foreach ($this->alarms as $secs => &$label) |
|
| 294 | 294 | { |
| 295 | 295 | $label = self::secs2label($secs); |
| 296 | 296 | } |
@@ -306,15 +306,15 @@ discard block |
||
| 306 | 306 | { |
| 307 | 307 | if ($secs <= 3600) |
| 308 | 308 | { |
| 309 | - $label = lang('%1 minutes', $secs/60); |
|
| 309 | + $label = lang('%1 minutes', $secs / 60); |
|
| 310 | 310 | } |
| 311 | - elseif($secs <= 86400) |
|
| 311 | + elseif ($secs <= 86400) |
|
| 312 | 312 | { |
| 313 | - $label = lang('%1 hours', $secs/3600); |
|
| 313 | + $label = lang('%1 hours', $secs / 3600); |
|
| 314 | 314 | } |
| 315 | 315 | else |
| 316 | 316 | { |
| 317 | - $label = lang('%1 days', $secs/86400); |
|
| 317 | + $label = lang('%1 days', $secs / 86400); |
|
| 318 | 318 | } |
| 319 | 319 | return $label; |
| 320 | 320 | } |
@@ -330,12 +330,12 @@ discard block |
||
| 330 | 330 | if (!$ids) return null; |
| 331 | 331 | |
| 332 | 332 | $data = array(); |
| 333 | - foreach((array)$ids as $id) |
|
| 333 | + foreach ((array)$ids as $id) |
|
| 334 | 334 | { |
| 335 | 335 | $email = $id; |
| 336 | 336 | $name = ''; |
| 337 | 337 | $matches = null; |
| 338 | - if (preg_match('/^(.*) *<([a-z0-9_.@-]{8,})>$/iU',$email,$matches)) |
|
| 338 | + if (preg_match('/^(.*) *<([a-z0-9_.@-]{8,})>$/iU', $email, $matches)) |
|
| 339 | 339 | { |
| 340 | 340 | $name = $matches[1]; |
| 341 | 341 | $email = $matches[2]; |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | */ |
| 360 | 360 | static function mailing_lists($ids) |
| 361 | 361 | { |
| 362 | - if(!is_array($ids)) |
|
| 362 | + if (!is_array($ids)) |
|
| 363 | 363 | { |
| 364 | 364 | $ids = array($ids); |
| 365 | 365 | } |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | // Email list |
| 369 | 369 | $contacts_obj = new Api\Contacts(); |
| 370 | 370 | $bo = new calendar_bo(); |
| 371 | - foreach($ids as $id) |
|
| 371 | + foreach ($ids as $id) |
|
| 372 | 372 | { |
| 373 | 373 | $list = $contacts_obj->read_list((int)$id); |
| 374 | 374 | |
@@ -395,22 +395,22 @@ discard block |
||
| 395 | 395 | * |
| 396 | 396 | * @return array |
| 397 | 397 | */ |
| 398 | - public function enum_mailing_list($id, $ignore_acl= false, $use_freebusy = true) |
|
| 398 | + public function enum_mailing_list($id, $ignore_acl = false, $use_freebusy = true) |
|
| 399 | 399 | { |
| 400 | 400 | $contact_list = array(); |
| 401 | 401 | $contacts = new Api\Contacts(); |
| 402 | - if($contacts->check_list((int)substr($id,1), ACL::READ) || (int)substr($id,1) < 0) |
|
| 402 | + if ($contacts->check_list((int)substr($id, 1), ACL::READ) || (int)substr($id, 1) < 0) |
|
| 403 | 403 | { |
| 404 | - $options = array('list' => substr($id,1)); |
|
| 405 | - $lists = $contacts->search('',true,'','','',false,'AND',false,$options); |
|
| 406 | - if(!$lists) |
|
| 404 | + $options = array('list' => substr($id, 1)); |
|
| 405 | + $lists = $contacts->search('', true, '', '', '', false, 'AND', false, $options); |
|
| 406 | + if (!$lists) |
|
| 407 | 407 | { |
| 408 | 408 | return $contact_list; |
| 409 | 409 | } |
| 410 | - foreach($lists as &$contact) |
|
| 410 | + foreach ($lists as &$contact) |
|
| 411 | 411 | { |
| 412 | 412 | // Check for user account |
| 413 | - if (($account_id = $GLOBALS['egw']->accounts->name2id($contact['id'],'person_id'))) |
|
| 413 | + if (($account_id = $GLOBALS['egw']->accounts->name2id($contact['id'], 'person_id'))) |
|
| 414 | 414 | { |
| 415 | 415 | $contact = ''.$account_id; |
| 416 | 416 | } |
@@ -418,9 +418,9 @@ discard block |
||
| 418 | 418 | { |
| 419 | 419 | $contact = 'c'.$contact['id']; |
| 420 | 420 | } |
| 421 | - if ($ignore_acl || $this->check_perms(ACL::READ|self::ACL_READ_FOR_PARTICIPANTS|($use_freebusy?self::ACL_FREEBUSY:0),0,$contact)) |
|
| 421 | + if ($ignore_acl || $this->check_perms(ACL::READ|self::ACL_READ_FOR_PARTICIPANTS|($use_freebusy ?self::ACL_FREEBUSY : 0), 0, $contact)) |
|
| 422 | 422 | { |
| 423 | - if ($contact && !in_array($contact,$contact_list)) // already added? |
|
| 423 | + if ($contact && !in_array($contact, $contact_list)) // already added? |
|
| 424 | 424 | { |
| 425 | 425 | $contact_list[] = $contact; |
| 426 | 426 | } |
@@ -439,12 +439,12 @@ discard block |
||
| 439 | 439 | function enum_groups(&$event) |
| 440 | 440 | { |
| 441 | 441 | $added = 0; |
| 442 | - foreach(array_keys($event['participants']) as $uid) |
|
| 442 | + foreach (array_keys($event['participants']) as $uid) |
|
| 443 | 443 | { |
| 444 | 444 | if (is_numeric($uid) && $GLOBALS['egw']->accounts->get_type($uid) == 'g' && |
| 445 | 445 | ($members = $GLOBALS['egw']->accounts->members($uid, true))) |
| 446 | 446 | { |
| 447 | - foreach($members as $member) |
|
| 447 | + foreach ($members as $member) |
|
| 448 | 448 | { |
| 449 | 449 | if (!isset($event['participants'][$member])) |
| 450 | 450 | { |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | * @param boolean $use_freebusy =true should freebusy rights are taken into account, default true, can be set to false eg. for a search |
| 467 | 467 | * @return array of user-ids |
| 468 | 468 | */ |
| 469 | - private function resolve_users($_users, $no_enum_groups=true, $ignore_acl=false, $use_freebusy=true) |
|
| 469 | + private function resolve_users($_users, $no_enum_groups = true, $ignore_acl = false, $use_freebusy = true) |
|
| 470 | 470 | { |
| 471 | 471 | if (!is_array($_users)) |
| 472 | 472 | { |
@@ -474,35 +474,35 @@ discard block |
||
| 474 | 474 | } |
| 475 | 475 | // only query calendars of users, we have READ-grants from |
| 476 | 476 | $users = array(); |
| 477 | - foreach($_users as $user) |
|
| 477 | + foreach ($_users as $user) |
|
| 478 | 478 | { |
| 479 | 479 | $user = trim($user); |
| 480 | 480 | |
| 481 | 481 | // Handle email lists |
| 482 | - if(!is_numeric($user) && $user[0] == 'l') |
|
| 482 | + if (!is_numeric($user) && $user[0] == 'l') |
|
| 483 | 483 | { |
| 484 | - foreach($this->enum_mailing_list($user, $ignore_acl, $use_freebusy) as $contact) |
|
| 484 | + foreach ($this->enum_mailing_list($user, $ignore_acl, $use_freebusy) as $contact) |
|
| 485 | 485 | { |
| 486 | - if ($contact && !in_array($contact,$users)) // already added? |
|
| 486 | + if ($contact && !in_array($contact, $users)) // already added? |
|
| 487 | 487 | { |
| 488 | 488 | $users[] = $contact; |
| 489 | 489 | } |
| 490 | 490 | } |
| 491 | 491 | continue; |
| 492 | 492 | } |
| 493 | - if ($ignore_acl || $this->check_perms(ACL::READ|self::ACL_READ_FOR_PARTICIPANTS|($use_freebusy?self::ACL_FREEBUSY:0),0,$user)) |
|
| 493 | + if ($ignore_acl || $this->check_perms(ACL::READ|self::ACL_READ_FOR_PARTICIPANTS|($use_freebusy ?self::ACL_FREEBUSY : 0), 0, $user)) |
|
| 494 | 494 | { |
| 495 | - if ($user && !in_array($user,$users)) // already added? |
|
| 495 | + if ($user && !in_array($user, $users)) // already added? |
|
| 496 | 496 | { |
| 497 | 497 | // General expansion check |
| 498 | 498 | if (!is_numeric($user) && $this->resources[$user[0]]['info']) |
| 499 | 499 | { |
| 500 | 500 | $info = $this->resource_info($user); |
| 501 | - if($info && $info['resources']) |
|
| 501 | + if ($info && $info['resources']) |
|
| 502 | 502 | { |
| 503 | - foreach($info['resources'] as $_user) |
|
| 503 | + foreach ($info['resources'] as $_user) |
|
| 504 | 504 | { |
| 505 | - if($_user && !in_array($_user, $users)) |
|
| 505 | + if ($_user && !in_array($_user, $users)) |
|
| 506 | 506 | { |
| 507 | 507 | $users[] = $_user; |
| 508 | 508 | } |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | } |
| 516 | 516 | elseif ($GLOBALS['egw']->accounts->get_type($user) != 'g') |
| 517 | 517 | { |
| 518 | - continue; // for non-groups (eg. users), we stop here if we have no read-rights |
|
| 518 | + continue; // for non-groups (eg. users), we stop here if we have no read-rights |
|
| 519 | 519 | } |
| 520 | 520 | // the further code is only for real users |
| 521 | 521 | if (!is_numeric($user)) continue; |
@@ -528,11 +528,11 @@ discard block |
||
| 528 | 528 | $members = $GLOBALS['egw']->accounts->members($user, true); |
| 529 | 529 | if (is_array($members)) |
| 530 | 530 | { |
| 531 | - foreach($members as $member) |
|
| 531 | + foreach ($members as $member) |
|
| 532 | 532 | { |
| 533 | 533 | // use only members which gave the user a read-grant |
| 534 | 534 | if (!in_array($member, $users) && |
| 535 | - ($ignore_acl || $this->check_perms(Acl::READ|($use_freebusy?self::ACL_FREEBUSY:0),0,$member))) |
|
| 535 | + ($ignore_acl || $this->check_perms(Acl::READ|($use_freebusy ?self::ACL_FREEBUSY : 0), 0, $member))) |
|
| 536 | 536 | { |
| 537 | 537 | $users[] = $member; |
| 538 | 538 | } |
@@ -544,9 +544,9 @@ discard block |
||
| 544 | 544 | $memberships = $GLOBALS['egw']->accounts->memberships($user, true); |
| 545 | 545 | if (is_array($memberships)) |
| 546 | 546 | { |
| 547 | - foreach($memberships as $group) |
|
| 547 | + foreach ($memberships as $group) |
|
| 548 | 548 | { |
| 549 | - if (!in_array($group,$users)) |
|
| 549 | + if (!in_array($group, $users)) |
|
| 550 | 550 | { |
| 551 | 551 | $users[] = $group; |
| 552 | 552 | } |
@@ -587,18 +587,18 @@ discard block |
||
| 587 | 587 | * @return iterator|array|boolean array of events or array with YYYYMMDD strings / array of events pairs (depending on $daywise param) |
| 588 | 588 | * or false if there are no read-grants from _any_ of the requested users or iterator/recordset if cols are given |
| 589 | 589 | */ |
| 590 | - function &search($params,$sql_filter=null) |
|
| 590 | + function &search($params, $sql_filter = null) |
|
| 591 | 591 | { |
| 592 | 592 | $params_in = $params; |
| 593 | 593 | |
| 594 | - $params['sql_filter'] = $sql_filter; // dont allow to set it via UI or xmlrpc |
|
| 594 | + $params['sql_filter'] = $sql_filter; // dont allow to set it via UI or xmlrpc |
|
| 595 | 595 | |
| 596 | 596 | // check if any resource wants to hook into |
| 597 | - foreach($this->resources as $data) |
|
| 597 | + foreach ($this->resources as $data) |
|
| 598 | 598 | { |
| 599 | 599 | if (isset($data['search_filter'])) |
| 600 | 600 | { |
| 601 | - $params = ExecMethod($data['search_filter'],$params); |
|
| 601 | + $params = ExecMethod($data['search_filter'], $params); |
|
| 602 | 602 | } |
| 603 | 603 | } |
| 604 | 604 | |
@@ -616,9 +616,9 @@ discard block |
||
| 616 | 616 | if (!empty($params['query'])) |
| 617 | 617 | { |
| 618 | 618 | $params['private_grants'] = array(); |
| 619 | - foreach($this->grants as $user => $rights) |
|
| 619 | + foreach ($this->grants as $user => $rights) |
|
| 620 | 620 | { |
| 621 | - if ($rights & Acl::PRIVAT) $params['private_grants'][] = $user; |
|
| 621 | + if ($rights&Acl::PRIVAT) $params['private_grants'][] = $user; |
|
| 622 | 622 | } |
| 623 | 623 | } |
| 624 | 624 | |
@@ -644,49 +644,49 @@ discard block |
||
| 644 | 644 | $params['enum_recuring'] = $enum_recuring = $daywise || !isset($params['enum_recuring']) || !!$params['enum_recuring']; |
| 645 | 645 | $cat_id = isset($params['cat_id']) ? $params['cat_id'] : 0; |
| 646 | 646 | $filter = isset($params['filter']) ? $params['filter'] : 'all'; |
| 647 | - $offset = isset($params['offset']) && $params['offset'] !== false ? (int) $params['offset'] : false; |
|
| 647 | + $offset = isset($params['offset']) && $params['offset'] !== false ? (int)$params['offset'] : false; |
|
| 648 | 648 | // socal::search() returns rejected group-invitations, as only the user not also the group is rejected |
| 649 | 649 | // as we cant remove them efficiantly in SQL, we kick them out here, but only if just one user is displayed |
| 650 | 650 | $users_in = (array)$params_in['users']; |
| 651 | - $remove_rejected_by_user = !in_array($filter,array('all','rejected','everything')) && |
|
| 651 | + $remove_rejected_by_user = !in_array($filter, array('all', 'rejected', 'everything')) && |
|
| 652 | 652 | count($users_in) == 1 && $users_in[0] > 0 ? $users_in[0] : null; |
| 653 | 653 | //error_log(__METHOD__.'('.array2string($params_in).", $sql_filter) params[users]=".array2string($params['users']).' --> remove_rejected_by_user='.array2string($remove_rejected_by_user)); |
| 654 | 654 | |
| 655 | 655 | if ($this->debug && ($this->debug > 1 || $this->debug == 'search')) |
| 656 | 656 | { |
| 657 | 657 | $this->debug_message('calendar_bo::search(%1) start=%2, end=%3, daywise=%4, cat_id=%5, filter=%6, query=%7, offset=%8, num_rows=%9, order=%10, sql_filter=%11)', |
| 658 | - True,$params,$start,$end,$daywise,$cat_id,$filter,$params['query'],$offset,(int)$params['num_rows'],$params['order'],$params['sql_filter']); |
|
| 658 | + True, $params, $start, $end, $daywise, $cat_id, $filter, $params['query'], $offset, (int)$params['num_rows'], $params['order'], $params['sql_filter']); |
|
| 659 | 659 | } |
| 660 | 660 | // date2ts(,true) converts to server time, db2data converts again to user-time |
| 661 | - $events =& $this->so->search(isset($start) ? $this->date2ts($start,true) : null,isset($end) ? $this->date2ts($end,true) : null, |
|
| 662 | - $users,$cat_id,$filter,$offset,(int)$params['num_rows'],$params,$remove_rejected_by_user); |
|
| 661 | + $events = & $this->so->search(isset($start) ? $this->date2ts($start, true) : null, isset($end) ? $this->date2ts($end, true) : null, |
|
| 662 | + $users, $cat_id, $filter, $offset, (int)$params['num_rows'], $params, $remove_rejected_by_user); |
|
| 663 | 663 | |
| 664 | 664 | if (isset($params['cols'])) |
| 665 | 665 | { |
| 666 | 666 | return $events; |
| 667 | 667 | } |
| 668 | 668 | $this->total = $this->so->total; |
| 669 | - $this->db2data($events,isset($params['date_format']) ? $params['date_format'] : 'ts'); |
|
| 669 | + $this->db2data($events, isset($params['date_format']) ? $params['date_format'] : 'ts'); |
|
| 670 | 670 | |
| 671 | 671 | //echo "<p align=right>remove_rejected_by_user=$remove_rejected_by_user, filter=$filter, params[users]=".print_r($param['users'])."</p>\n"; |
| 672 | - foreach($events as $id => $event) |
|
| 672 | + foreach ($events as $id => $event) |
|
| 673 | 673 | { |
| 674 | 674 | if ($params['enum_groups'] && $this->enum_groups($event)) |
| 675 | 675 | { |
| 676 | 676 | $events[$id] = $event; |
| 677 | 677 | } |
| 678 | 678 | $matches = null; |
| 679 | - if (!(int)$event['id'] && preg_match('/^([a-z_]+)([0-9]+)$/',$event['id'],$matches)) |
|
| 679 | + if (!(int)$event['id'] && preg_match('/^([a-z_]+)([0-9]+)$/', $event['id'], $matches)) |
|
| 680 | 680 | { |
| 681 | - $is_private = self::integration_get_private($matches[1],$matches[2],$event); |
|
| 681 | + $is_private = self::integration_get_private($matches[1], $matches[2], $event); |
|
| 682 | 682 | } |
| 683 | 683 | else |
| 684 | 684 | { |
| 685 | - $is_private = !$this->check_perms(Acl::READ,$event); |
|
| 685 | + $is_private = !$this->check_perms(Acl::READ, $event); |
|
| 686 | 686 | } |
| 687 | 687 | if (!$params['ignore_acl'] && ($is_private || (!$event['public'] && $filter == 'hideprivate'))) |
| 688 | 688 | { |
| 689 | - $this->clear_private_infos($events[$id],$users); |
|
| 689 | + $this->clear_private_infos($events[$id], $users); |
|
| 690 | 690 | } |
| 691 | 691 | } |
| 692 | 692 | |
@@ -694,18 +694,18 @@ discard block |
||
| 694 | 694 | { |
| 695 | 695 | if ($this->debug && ($this->debug > 2 || $this->debug == 'search')) |
| 696 | 696 | { |
| 697 | - $this->debug_message('socalendar::search daywise sorting from %1 to %2 of %3',False,$start,$end,$events); |
|
| 697 | + $this->debug_message('socalendar::search daywise sorting from %1 to %2 of %3', False, $start, $end, $events); |
|
| 698 | 698 | } |
| 699 | 699 | // create empty entries for each day in the reported time |
| 700 | - for($ts = $start; $ts <= $end; $ts += DAY_s) // good enough for array creation, but see while loop below. |
|
| 700 | + for ($ts = $start; $ts <= $end; $ts += DAY_s) // good enough for array creation, but see while loop below. |
|
| 701 | 701 | { |
| 702 | 702 | $daysEvents[$this->date2string($ts)] = array(); |
| 703 | 703 | } |
| 704 | - foreach($events as $k => $event) |
|
| 704 | + foreach ($events as $k => $event) |
|
| 705 | 705 | { |
| 706 | - $e_start = max($this->date2ts($event['start']),$start); |
|
| 706 | + $e_start = max($this->date2ts($event['start']), $start); |
|
| 707 | 707 | // $event['end']['raw']-1 to allow events to end on a full hour/day without the need to enter it as minute=59 |
| 708 | - $e_end = min($this->date2ts($event['end'])-1,$end); |
|
| 708 | + $e_end = min($this->date2ts($event['end']) - 1, $end); |
|
| 709 | 709 | |
| 710 | 710 | // add event to each day in the reported time |
| 711 | 711 | $ts = $e_start; |
@@ -714,23 +714,23 @@ discard block |
||
| 714 | 714 | $ymd = null; |
| 715 | 715 | while ($ts <= $e_end) |
| 716 | 716 | { |
| 717 | - $daysEvents[$ymd = $this->date2string($ts)][] =& $events[$k]; |
|
| 718 | - $ts = strtotime("+1 day",$ts); |
|
| 717 | + $daysEvents[$ymd = $this->date2string($ts)][] = & $events[$k]; |
|
| 718 | + $ts = strtotime("+1 day", $ts); |
|
| 719 | 719 | } |
| 720 | 720 | if ($ymd != ($last = $this->date2string($e_end))) |
| 721 | 721 | { |
| 722 | - $daysEvents[$last][] =& $events[$k]; |
|
| 722 | + $daysEvents[$last][] = & $events[$k]; |
|
| 723 | 723 | } |
| 724 | 724 | } |
| 725 | - $events =& $daysEvents; |
|
| 725 | + $events = & $daysEvents; |
|
| 726 | 726 | if ($this->debug && ($this->debug > 2 || $this->debug == 'search')) |
| 727 | 727 | { |
| 728 | - $this->debug_message('socalendar::search daywise events=%1',False,$events); |
|
| 728 | + $this->debug_message('socalendar::search daywise events=%1', False, $events); |
|
| 729 | 729 | } |
| 730 | 730 | } |
| 731 | 731 | if ($this->debug && ($this->debug > 0 || $this->debug == 'search')) |
| 732 | 732 | { |
| 733 | - $this->debug_message('calendar_bo::search(%1)=%2',True,$params,$events); |
|
| 733 | + $this->debug_message('calendar_bo::search(%1)=%2', True, $params, $events); |
|
| 734 | 734 | } |
| 735 | 735 | //error_log(__METHOD__."() returning ".count($events)." entries, total=$this->total ".function_backtrace()); |
| 736 | 736 | return $events; |
@@ -743,9 +743,9 @@ discard block |
||
| 743 | 743 | * @param string $part |
| 744 | 744 | * @return array |
| 745 | 745 | */ |
| 746 | - static function integration_get_data($app,$part=null) |
|
| 746 | + static function integration_get_data($app, $part = null) |
|
| 747 | 747 | { |
| 748 | - static $integration_data=null; |
|
| 748 | + static $integration_data = null; |
|
| 749 | 749 | |
| 750 | 750 | if (!isset($integration_data)) |
| 751 | 751 | { |
@@ -767,14 +767,14 @@ discard block |
||
| 767 | 767 | * @param int|string $id |
| 768 | 768 | * @return string |
| 769 | 769 | */ |
| 770 | - static function integration_get_private($app,$id,$event) |
|
| 770 | + static function integration_get_private($app, $id, $event) |
|
| 771 | 771 | { |
| 772 | - $app_data = self::integration_get_data($app,'is_private'); |
|
| 772 | + $app_data = self::integration_get_data($app, 'is_private'); |
|
| 773 | 773 | |
| 774 | 774 | // no method, fall back to link title |
| 775 | 775 | if (is_null($app_data)) |
| 776 | 776 | { |
| 777 | - $is_private = !Link::title($app,$id); |
|
| 777 | + $is_private = !Link::title($app, $id); |
|
| 778 | 778 | } |
| 779 | 779 | // boolean value to make all events of $app public (false) or private (true) |
| 780 | 780 | elseif (is_bool($app_data)) |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | } |
| 784 | 784 | else |
| 785 | 785 | { |
| 786 | - $is_private = (bool)ExecMethod2($app_data,$id,$event); |
|
| 786 | + $is_private = (bool)ExecMethod2($app_data, $id, $event); |
|
| 787 | 787 | } |
| 788 | 788 | //echo '<p>'.__METHOD__."($app,$id,) app_data=".array2string($app_data).' returning '.array2string($is_private)."</p>\n"; |
| 789 | 789 | return $is_private; |
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | * @param array &$event |
| 798 | 798 | * @param array $allowed_participants ids of the allowed participants, eg. the ones the search is over or eg. the owner of the calendar |
| 799 | 799 | */ |
| 800 | - function clear_private_infos(&$event,$allowed_participants = array()) |
|
| 800 | + function clear_private_infos(&$event, $allowed_participants = array()) |
|
| 801 | 801 | { |
| 802 | 802 | if ($event == false) return; |
| 803 | 803 | if (!is_array($event['participants'])) error_log(__METHOD__.'('.array2string($event).', '.array2string($allowed_participants).') NO PARTICIPANTS '.function_backtrace()); |
@@ -813,19 +813,19 @@ discard block |
||
| 813 | 813 | 'owner' => $event['owner'], |
| 814 | 814 | 'uid' => $event['uid'], |
| 815 | 815 | 'etag' => $event['etag'], |
| 816 | - 'participants' => array_intersect_key($event['participants'],array_flip($allowed_participants)), |
|
| 816 | + 'participants' => array_intersect_key($event['participants'], array_flip($allowed_participants)), |
|
| 817 | 817 | 'public'=> 0, |
| 818 | - 'category' => $event['category'], // category is visible anyway, eg. by using planner by cat |
|
| 818 | + 'category' => $event['category'], // category is visible anyway, eg. by using planner by cat |
|
| 819 | 819 | 'non_blocking' => $event['non_blocking'], |
| 820 | 820 | 'caldav_name' => $event['caldav_name'], |
| 821 | 821 | // we need full recurrence information, as they are relevant free/busy information |
| 822 | - )+($event['recur_type'] ? array( |
|
| 822 | + ) + ($event['recur_type'] ? array( |
|
| 823 | 823 | 'recur_type' => $event['recur_type'], |
| 824 | 824 | 'recur_interval' => $event['recur_interval'], |
| 825 | 825 | 'recur_data' => $event['recur_data'], |
| 826 | 826 | 'recur_enddate' => $event['recur_enddate'], |
| 827 | 827 | 'recur_exception'=> $event['recur_exception'], |
| 828 | - ):array( |
|
| 828 | + ) : array( |
|
| 829 | 829 | 'reference' => $event['reference'], |
| 830 | 830 | 'recurrence' => $event['recurrence'], |
| 831 | 831 | )); |
@@ -839,15 +839,15 @@ discard block |
||
| 839 | 839 | */ |
| 840 | 840 | function check_move_horizont($_new_horizont) |
| 841 | 841 | { |
| 842 | - if ((int) $this->debug >= 2 || $this->debug == 'check_move_horizont') |
|
| 842 | + if ((int)$this->debug >= 2 || $this->debug == 'check_move_horizont') |
|
| 843 | 843 | { |
| 844 | - $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2',true,$_new_horizont,(int)$this->config['horizont']); |
|
| 844 | + $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2', true, $_new_horizont, (int)$this->config['horizont']); |
|
| 845 | 845 | } |
| 846 | - $new_horizont = $this->date2ts($_new_horizont,true); // now we are in server-time, where this function operates |
|
| 846 | + $new_horizont = $this->date2ts($_new_horizont, true); // now we are in server-time, where this function operates |
|
| 847 | 847 | |
| 848 | 848 | if ($new_horizont <= $this->config['horizont']) // no move necessary |
| 849 | 849 | { |
| 850 | - if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2 is bigger ==> nothing to do',true,$new_horizont,(int)$this->config['horizont']); |
|
| 850 | + if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2 is bigger ==> nothing to do', true, $new_horizont, (int)$this->config['horizont']); |
|
| 851 | 851 | return; |
| 852 | 852 | } |
| 853 | 853 | if (!empty($GLOBALS['egw_info']['server']['calendar_horizont'])) |
@@ -855,15 +855,15 @@ discard block |
||
| 855 | 855 | $maxdays = abs($GLOBALS['egw_info']['server']['calendar_horizont']); |
| 856 | 856 | } |
| 857 | 857 | if (empty($maxdays)) $maxdays = 1000; // old default |
| 858 | - if ($new_horizont > time()+$maxdays*DAY_s) // some user tries to "look" more then the maximum number of days in the future |
|
| 858 | + if ($new_horizont > time() + $maxdays * DAY_s) // some user tries to "look" more then the maximum number of days in the future |
|
| 859 | 859 | { |
| 860 | - if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2 new horizont more then %3 days from now --> ignoring it',true,$new_horizont,(int)$this->config['horizont'],$maxdays); |
|
| 861 | - $this->warnings['horizont'] = lang('Requested date %1 outside allowed range of %2 days: recurring events obmitted!', Api\DateTime::to($new_horizont,true), $maxdays); |
|
| 860 | + if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) horizont=%2 new horizont more then %3 days from now --> ignoring it', true, $new_horizont, (int)$this->config['horizont'], $maxdays); |
|
| 861 | + $this->warnings['horizont'] = lang('Requested date %1 outside allowed range of %2 days: recurring events obmitted!', Api\DateTime::to($new_horizont, true), $maxdays); |
|
| 862 | 862 | return; |
| 863 | 863 | } |
| 864 | - if ($new_horizont < time()+31*DAY_s) |
|
| 864 | + if ($new_horizont < time() + 31 * DAY_s) |
|
| 865 | 865 | { |
| 866 | - $new_horizont = time()+31*DAY_s; |
|
| 866 | + $new_horizont = time() + 31 * DAY_s; |
|
| 867 | 867 | } |
| 868 | 868 | $old_horizont = $this->config['horizont']; |
| 869 | 869 | $this->config['horizont'] = $new_horizont; |
@@ -871,21 +871,21 @@ discard block |
||
| 871 | 871 | // create further recurrences for all recurring and not yet (at the old horizont) ended events |
| 872 | 872 | if (($recuring = $this->so->unfinished_recuring($old_horizont))) |
| 873 | 873 | { |
| 874 | - @set_time_limit(0); // disable time-limit, in case it takes longer to calculate the recurrences |
|
| 875 | - foreach($this->read(array_keys($recuring)) as $cal_id => $event) |
|
| 874 | + @set_time_limit(0); // disable time-limit, in case it takes longer to calculate the recurrences |
|
| 875 | + foreach ($this->read(array_keys($recuring)) as $cal_id => $event) |
|
| 876 | 876 | { |
| 877 | 877 | if ($this->debug == 'check_move_horizont') |
| 878 | 878 | { |
| 879 | - $this->debug_message('calendar_bo::check_move_horizont(%1): calling set_recurrences(%2,%3)',true,$new_horizont,$event,$old_horizont); |
|
| 879 | + $this->debug_message('calendar_bo::check_move_horizont(%1): calling set_recurrences(%2,%3)', true, $new_horizont, $event, $old_horizont); |
|
| 880 | 880 | } |
| 881 | 881 | // insert everything behind max(cal_start), which can be less then $old_horizont because of bugs in the past |
| 882 | - $this->set_recurrences($event,Api\DateTime::server2user($recuring[$cal_id]+1)); // set_recurences operates in user-time! |
|
| 882 | + $this->set_recurrences($event, Api\DateTime::server2user($recuring[$cal_id] + 1)); // set_recurences operates in user-time! |
|
| 883 | 883 | } |
| 884 | 884 | } |
| 885 | 885 | // update the horizont |
| 886 | - Api\Config::save_value('horizont',$this->config['horizont'],'calendar'); |
|
| 886 | + Api\Config::save_value('horizont', $this->config['horizont'], 'calendar'); |
|
| 887 | 887 | |
| 888 | - if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) new horizont=%2, exiting',true,$new_horizont,(int)$this->config['horizont']); |
|
| 888 | + if ($this->debug == 'check_move_horizont') $this->debug_message('calendar_bo::check_move_horizont(%1) new horizont=%2, exiting', true, $new_horizont, (int)$this->config['horizont']); |
|
| 889 | 889 | } |
| 890 | 890 | |
| 891 | 891 | /** |
@@ -896,11 +896,11 @@ discard block |
||
| 896 | 896 | * @param array $event |
| 897 | 897 | * @param mixed $start =0 minimum start-time for new recurrences or !$start = since the start of the event |
| 898 | 898 | */ |
| 899 | - function set_recurrences($event,$start=0) |
|
| 899 | + function set_recurrences($event, $start = 0) |
|
| 900 | 900 | { |
| 901 | - if ($this->debug && ((int) $this->debug >= 2 || $this->debug == 'set_recurrences' || $this->debug == 'check_move_horizont')) |
|
| 901 | + if ($this->debug && ((int)$this->debug >= 2 || $this->debug == 'set_recurrences' || $this->debug == 'check_move_horizont')) |
|
| 902 | 902 | { |
| 903 | - $this->debug_message('calendar_bo::set_recurrences(%1,%2)',true,$event,$start); |
|
| 903 | + $this->debug_message('calendar_bo::set_recurrences(%1,%2)', true, $event, $start); |
|
| 904 | 904 | } |
| 905 | 905 | // check if the caller gave us enough information and if not read it from the DB |
| 906 | 906 | if (!isset($event['participants']) || !isset($event['start']) || !isset($event['end'])) |
@@ -921,29 +921,29 @@ discard block |
||
| 921 | 921 | $read_start = new Api\DateTime($event_read['start']); |
| 922 | 922 | |
| 923 | 923 | $events = array(); |
| 924 | - $this->insert_all_recurrences($event,$start,$this->date2usertime($this->config['horizont']),$events); |
|
| 924 | + $this->insert_all_recurrences($event, $start, $this->date2usertime($this->config['horizont']), $events); |
|
| 925 | 925 | |
| 926 | 926 | $exceptions = array(); |
| 927 | - foreach((array)$event['recur_exception'] as $exception) |
|
| 927 | + foreach ((array)$event['recur_exception'] as $exception) |
|
| 928 | 928 | { |
| 929 | - $exceptions[] = Api\DateTime::to($exception, true); // true = date |
|
| 929 | + $exceptions[] = Api\DateTime::to($exception, true); // true = date |
|
| 930 | 930 | } |
| 931 | - foreach($events as $event) |
|
| 931 | + foreach ($events as $event) |
|
| 932 | 932 | { |
| 933 | 933 | $is_exception = in_array(Api\DateTime::to($event['start'], true), $exceptions); |
| 934 | - $start = $this->date2ts($event['start'],true); |
|
| 934 | + $start = $this->date2ts($event['start'], true); |
|
| 935 | 935 | if ($event['whole_day']) |
| 936 | 936 | { |
| 937 | 937 | $start = new Api\DateTime($event['start'], Api\DateTime::$server_timezone); |
| 938 | - $start->setTime(0,0,0); |
|
| 938 | + $start->setTime(0, 0, 0); |
|
| 939 | 939 | $start = $start->format('ts'); |
| 940 | 940 | $time = $this->so->startOfDay(new Api\DateTime($event['end'], Api\DateTime::$user_timezone)); |
| 941 | 941 | $time->setTime(23, 59, 59); |
| 942 | - $end = $this->date2ts($time,true); |
|
| 942 | + $end = $this->date2ts($time, true); |
|
| 943 | 943 | } |
| 944 | 944 | else |
| 945 | 945 | { |
| 946 | - $end = $this->date2ts($event['end'],true); |
|
| 946 | + $end = $this->date2ts($event['end'], true); |
|
| 947 | 947 | } |
| 948 | 948 | //error_log(__METHOD__."() start=".Api\DateTime::to($start).", is_exception=".array2string($is_exception)); |
| 949 | 949 | $this->so->recurrence($event['id'], $start, $end, $event['participants'], $is_exception); |
@@ -959,7 +959,7 @@ discard block |
||
| 959 | 959 | * @param array &$events array of event-arrays (reference) |
| 960 | 960 | * @param $date_format ='ts' date-formats: 'ts'=timestamp, 'server'=timestamp in server-time, 'array'=array or string with date-format |
| 961 | 961 | */ |
| 962 | - function db2data(&$events,$date_format='ts') |
|
| 962 | + function db2data(&$events, $date_format = 'ts') |
|
| 963 | 963 | { |
| 964 | 964 | if (!is_array($events)) echo "<p>calendar_bo::db2data(\$events,$date_format) \$events is no array<br />\n".function_backtrace()."</p>\n"; |
| 965 | 965 | foreach ($events as &$event) |
@@ -972,65 +972,65 @@ discard block |
||
| 972 | 972 | // database returns timestamps as string, convert them to integer |
| 973 | 973 | // to avoid misinterpretation by Api\DateTime as Ymd string |
| 974 | 974 | // (this will fail on 32bit systems for times > 2038!) |
| 975 | - $event['start'] = (int)$event['start']; // this is for isWholeDay(), which also calls Api\DateTime |
|
| 975 | + $event['start'] = (int)$event['start']; // this is for isWholeDay(), which also calls Api\DateTime |
|
| 976 | 976 | $event['end'] = (int)$event['end']; |
| 977 | 977 | $event['whole_day'] = self::isWholeDay($event); |
| 978 | 978 | if ($event['whole_day'] && $date_format != 'server') |
| 979 | 979 | { |
| 980 | 980 | // Adjust dates to user TZ |
| 981 | - $stime =& $this->so->startOfDay(new Api\DateTime((int)$event['start'], Api\DateTime::$server_timezone), $event['tzid']); |
|
| 981 | + $stime = & $this->so->startOfDay(new Api\DateTime((int)$event['start'], Api\DateTime::$server_timezone), $event['tzid']); |
|
| 982 | 982 | $event['start'] = Api\DateTime::to($stime, $date_format); |
| 983 | - $time =& $this->so->startOfDay(new Api\DateTime((int)$event['end'], Api\DateTime::$server_timezone), $event['tzid']); |
|
| 983 | + $time = & $this->so->startOfDay(new Api\DateTime((int)$event['end'], Api\DateTime::$server_timezone), $event['tzid']); |
|
| 984 | 984 | $time->setTime(23, 59, 59); |
| 985 | 985 | $event['end'] = Api\DateTime::to($time, $date_format); |
| 986 | 986 | if (!empty($event['recurrence'])) |
| 987 | 987 | { |
| 988 | - $time =& $this->so->startOfDay(new Api\DateTime((int)$event['recurrence'], Api\DateTime::$server_timezone), $event['tzid']); |
|
| 988 | + $time = & $this->so->startOfDay(new Api\DateTime((int)$event['recurrence'], Api\DateTime::$server_timezone), $event['tzid']); |
|
| 989 | 989 | $event['recurrence'] = Api\DateTime::to($time, $date_format); |
| 990 | 990 | } |
| 991 | 991 | if (!empty($event['recur_enddate'])) |
| 992 | 992 | { |
| 993 | - $time =& $this->so->startOfDay(new Api\DateTime((int)$event['recur_enddate'], Api\DateTime::$server_timezone), $event['tzid']); |
|
| 993 | + $time = & $this->so->startOfDay(new Api\DateTime((int)$event['recur_enddate'], Api\DateTime::$server_timezone), $event['tzid']); |
|
| 994 | 994 | $time->setTime(23, 59, 59); |
| 995 | 995 | $event['recur_enddate'] = Api\DateTime::to($time, $date_format); |
| 996 | 996 | } |
| 997 | - $timestamps = array('modified','created','deleted'); |
|
| 997 | + $timestamps = array('modified', 'created', 'deleted'); |
|
| 998 | 998 | } |
| 999 | 999 | else |
| 1000 | 1000 | { |
| 1001 | - $timestamps = array('start','end','modified','created','recur_enddate','recurrence','recur_date','deleted'); |
|
| 1001 | + $timestamps = array('start', 'end', 'modified', 'created', 'recur_enddate', 'recurrence', 'recur_date', 'deleted'); |
|
| 1002 | 1002 | } |
| 1003 | 1003 | // we convert here from the server-time timestamps to user-time and (optional) to a different date-format! |
| 1004 | 1004 | foreach ($timestamps as $ts) |
| 1005 | 1005 | { |
| 1006 | 1006 | if (!empty($event[$ts])) |
| 1007 | 1007 | { |
| 1008 | - $event[$ts] = $this->date2usertime((int)$event[$ts],$date_format); |
|
| 1008 | + $event[$ts] = $this->date2usertime((int)$event[$ts], $date_format); |
|
| 1009 | 1009 | } |
| 1010 | 1010 | } |
| 1011 | 1011 | // same with the recur exceptions |
| 1012 | 1012 | if (isset($event['recur_exception']) && is_array($event['recur_exception'])) |
| 1013 | 1013 | { |
| 1014 | - foreach($event['recur_exception'] as &$date) |
|
| 1014 | + foreach ($event['recur_exception'] as &$date) |
|
| 1015 | 1015 | { |
| 1016 | 1016 | if ($event['whole_day'] && $date_format != 'server') |
| 1017 | 1017 | { |
| 1018 | 1018 | // Adjust dates to user TZ |
| 1019 | - $time =& $this->so->startOfDay(new Api\DateTime((int)$date, Api\DateTime::$server_timezone), $event['tzid']); |
|
| 1019 | + $time = & $this->so->startOfDay(new Api\DateTime((int)$date, Api\DateTime::$server_timezone), $event['tzid']); |
|
| 1020 | 1020 | $date = Api\DateTime::to($time, $date_format); |
| 1021 | 1021 | } |
| 1022 | 1022 | else |
| 1023 | 1023 | { |
| 1024 | - $date = $this->date2usertime((int)$date,$date_format); |
|
| 1024 | + $date = $this->date2usertime((int)$date, $date_format); |
|
| 1025 | 1025 | } |
| 1026 | 1026 | } |
| 1027 | 1027 | } |
| 1028 | 1028 | // same with the alarms |
| 1029 | 1029 | if (isset($event['alarm']) && is_array($event['alarm'])) |
| 1030 | 1030 | { |
| 1031 | - foreach($event['alarm'] as &$alarm) |
|
| 1031 | + foreach ($event['alarm'] as &$alarm) |
|
| 1032 | 1032 | { |
| 1033 | - $alarm['time'] = $this->date2usertime((int)$alarm['time'],$date_format); |
|
| 1033 | + $alarm['time'] = $this->date2usertime((int)$alarm['time'], $date_format); |
|
| 1034 | 1034 | } |
| 1035 | 1035 | } |
| 1036 | 1036 | } |
@@ -1043,11 +1043,11 @@ discard block |
||
| 1043 | 1043 | * @param string $date_format ='ts' date-formats: 'ts'=timestamp, 'server'=timestamp in server-time, 'array'=array or string with date-format |
| 1044 | 1044 | * @return mixed depending of $date_format |
| 1045 | 1045 | */ |
| 1046 | - function date2usertime($ts,$date_format='ts') |
|
| 1046 | + function date2usertime($ts, $date_format = 'ts') |
|
| 1047 | 1047 | { |
| 1048 | 1048 | if (empty($ts) || $date_format == 'server') return $ts; |
| 1049 | 1049 | |
| 1050 | - return Api\DateTime::server2user($ts,$date_format); |
|
| 1050 | + return Api\DateTime::server2user($ts, $date_format); |
|
| 1051 | 1051 | } |
| 1052 | 1052 | |
| 1053 | 1053 | /** |
@@ -1061,7 +1061,7 @@ discard block |
||
| 1061 | 1061 | * but call clear_private_infos() with the given users |
| 1062 | 1062 | * @return boolean|array event or array of id => event pairs, false if the acl-check went wrong, null if $ids not found |
| 1063 | 1063 | */ |
| 1064 | - function read($ids,$date=null,$ignore_acl=False,$date_format='ts',$clear_private_infos_users=null) |
|
| 1064 | + function read($ids, $date = null, $ignore_acl = False, $date_format = 'ts', $clear_private_infos_users = null) |
|
| 1065 | 1065 | { |
| 1066 | 1066 | if (!$ids) return false; |
| 1067 | 1067 | |
@@ -1070,21 +1070,21 @@ discard block |
||
| 1070 | 1070 | $return = null; |
| 1071 | 1071 | |
| 1072 | 1072 | $check = $clear_private_infos_users ? self::ACL_FREEBUSY : Acl::READ; |
| 1073 | - if ($ignore_acl || is_array($ids) || ($return = $this->check_perms($check,$ids,0,$date_format,$date))) |
|
| 1073 | + if ($ignore_acl || is_array($ids) || ($return = $this->check_perms($check, $ids, 0, $date_format, $date))) |
|
| 1074 | 1074 | { |
| 1075 | 1075 | if (is_array($ids) || !isset(self::$cached_event['id']) || self::$cached_event['id'] != $ids || |
| 1076 | 1076 | self::$cached_event_date_format != $date_format || |
| 1077 | 1077 | self::$cached_event['recur_type'] != MCAL_RECUR_NONE && self::$cached_event_date != $date) |
| 1078 | 1078 | { |
| 1079 | - $events = $this->so->read($ids,$date ? $this->date2ts($date,true) : 0); |
|
| 1079 | + $events = $this->so->read($ids, $date ? $this->date2ts($date, true) : 0); |
|
| 1080 | 1080 | |
| 1081 | 1081 | if ($events) |
| 1082 | 1082 | { |
| 1083 | - $this->db2data($events,$date_format); |
|
| 1083 | + $this->db2data($events, $date_format); |
|
| 1084 | 1084 | |
| 1085 | 1085 | if (is_array($ids)) |
| 1086 | 1086 | { |
| 1087 | - $return =& $events; |
|
| 1087 | + $return = & $events; |
|
| 1088 | 1088 | } |
| 1089 | 1089 | else |
| 1090 | 1090 | { |
@@ -1100,13 +1100,13 @@ discard block |
||
| 1100 | 1100 | $return = self::$cached_event; |
| 1101 | 1101 | } |
| 1102 | 1102 | } |
| 1103 | - if ($clear_private_infos_users && !is_array($ids) && !$this->check_perms(Acl::READ,$return)) |
|
| 1103 | + if ($clear_private_infos_users && !is_array($ids) && !$this->check_perms(Acl::READ, $return)) |
|
| 1104 | 1104 | { |
| 1105 | 1105 | $this->clear_private_infos($return, (array)$clear_private_infos_users); |
| 1106 | 1106 | } |
| 1107 | 1107 | if ($this->debug && ($this->debug > 1 || $this->debug == 'read')) |
| 1108 | 1108 | { |
| 1109 | - $this->debug_message('calendar_bo::read(%1,%2,%3,%4,%5)=%6',True,$ids,$date,$ignore_acl,$date_format,$clear_private_infos_users,$return); |
|
| 1109 | + $this->debug_message('calendar_bo::read(%1,%2,%3,%4,%5)=%6', True, $ids, $date, $ignore_acl, $date_format, $clear_private_infos_users, $return); |
|
| 1110 | 1110 | } |
| 1111 | 1111 | return $return; |
| 1112 | 1112 | } |
@@ -1124,17 +1124,17 @@ discard block |
||
| 1124 | 1124 | * @param array $events where the repetions get inserted |
| 1125 | 1125 | * @param array $recur_exceptions with date (in Ymd) as key (and True as values), seems not to be used anymore |
| 1126 | 1126 | */ |
| 1127 | - function insert_all_recurrences($event,$_start,$end,&$events) |
|
| 1127 | + function insert_all_recurrences($event, $_start, $end, &$events) |
|
| 1128 | 1128 | { |
| 1129 | - if ((int) $this->debug >= 3 || $this->debug == 'set_recurrences' || $this->debug == 'check_move_horizont' || $this->debug == 'insert_all_recurrences') |
|
| 1129 | + if ((int)$this->debug >= 3 || $this->debug == 'set_recurrences' || $this->debug == 'check_move_horizont' || $this->debug == 'insert_all_recurrences') |
|
| 1130 | 1130 | { |
| 1131 | - $this->debug_message(__METHOD__.'(%1,%2,%3,&$events)',true,$event,$_start,$end); |
|
| 1131 | + $this->debug_message(__METHOD__.'(%1,%2,%3,&$events)', true, $event, $_start, $end); |
|
| 1132 | 1132 | } |
| 1133 | 1133 | $end_in = $end; |
| 1134 | 1134 | |
| 1135 | 1135 | $start = $this->date2ts($_start); |
| 1136 | 1136 | $event_start_ts = $this->date2ts($event['start']); |
| 1137 | - $event_length = $this->date2ts($event['end']) - $event_start_ts; // we use a constant event-length, NOT a constant end-time! |
|
| 1137 | + $event_length = $this->date2ts($event['end']) - $event_start_ts; // we use a constant event-length, NOT a constant end-time! |
|
| 1138 | 1138 | |
| 1139 | 1139 | // if $end is before recur_enddate, use it instead |
| 1140 | 1140 | if (!$event['recur_enddate'] || $this->date2ts($event['recur_enddate']) > $this->date2ts($end)) |
@@ -1143,39 +1143,38 @@ discard block |
||
| 1143 | 1143 | // insert at least the event itself, if it's behind the horizont |
| 1144 | 1144 | $event['recur_enddate'] = $this->date2ts($end) < $this->date2ts($event['end']) ? $event['end'] : $end; |
| 1145 | 1145 | } |
| 1146 | - $event['recur_enddate'] = is_a($event['recur_enddate'],'DateTime') ? |
|
| 1147 | - $event['recur_enddate'] : |
|
| 1148 | - new Api\DateTime($event['recur_enddate'], calendar_timezones::DateTimeZone($event['tzid'])); |
|
| 1146 | + $event['recur_enddate'] = is_a($event['recur_enddate'], 'DateTime') ? |
|
| 1147 | + $event['recur_enddate'] : new Api\DateTime($event['recur_enddate'], calendar_timezones::DateTimeZone($event['tzid'])); |
|
| 1149 | 1148 | // unset exceptions, as we need to add them as recurrence too, but marked as exception |
| 1150 | 1149 | unset($event['recur_exception']); |
| 1151 | 1150 | // loop over all recurrences and insert them, if they are after $start |
| 1152 | - $rrule = calendar_rrule::event2rrule($event, !$event['whole_day'], Api\DateTime::$user_timezone->getName()); // true = we operate in usertime, like the rest of calendar_bo |
|
| 1153 | - foreach($rrule as $time) |
|
| 1151 | + $rrule = calendar_rrule::event2rrule($event, !$event['whole_day'], Api\DateTime::$user_timezone->getName()); // true = we operate in usertime, like the rest of calendar_bo |
|
| 1152 | + foreach ($rrule as $time) |
|
| 1154 | 1153 | { |
| 1155 | - $time->setUser(); // $time is in timezone of event, convert it to usertime used here |
|
| 1156 | - if($event['whole_day']) |
|
| 1154 | + $time->setUser(); // $time is in timezone of event, convert it to usertime used here |
|
| 1155 | + if ($event['whole_day']) |
|
| 1157 | 1156 | { |
| 1158 | 1157 | // All day events are processed in server timezone |
| 1159 | 1158 | $time->setServer(); |
| 1160 | - $time->setTime(0,0,0); |
|
| 1159 | + $time->setTime(0, 0, 0); |
|
| 1161 | 1160 | } |
| 1162 | - if (($ts = $this->date2ts($time)) < $start-$event_length) |
|
| 1161 | + if (($ts = $this->date2ts($time)) < $start - $event_length) |
|
| 1163 | 1162 | { |
| 1164 | 1163 | //echo "<p>".$time." --> ignored as $ts < $start-$event_length</p>\n"; |
| 1165 | - continue; // to early or original event (returned by interator too) |
|
| 1164 | + continue; // to early or original event (returned by interator too) |
|
| 1166 | 1165 | } |
| 1167 | 1166 | |
| 1168 | 1167 | $ts_end = $ts + $event_length; |
| 1169 | 1168 | // adjust ts_end for whole day events in case it does not fit due to |
| 1170 | 1169 | // spans over summer/wintertime adjusted days |
| 1171 | - if($event['whole_day'] && ($arr_end = $this->date2array($ts_end)) && |
|
| 1170 | + if ($event['whole_day'] && ($arr_end = $this->date2array($ts_end)) && |
|
| 1172 | 1171 | !($arr_end['hour'] == 23 && $arr_end['minute'] == 59 && $arr_end['second'] == 59)) |
| 1173 | 1172 | { |
| 1174 | 1173 | $arr_end['hour'] = 23; |
| 1175 | 1174 | $arr_end['minute'] = 59; |
| 1176 | 1175 | $arr_end['second'] = 59; |
| 1177 | 1176 | $ts_end_guess = $this->date2ts($arr_end); |
| 1178 | - if($ts_end_guess - $ts_end > DAY_s/2) |
|
| 1177 | + if ($ts_end_guess - $ts_end > DAY_s / 2) |
|
| 1179 | 1178 | { |
| 1180 | 1179 | $ts_end = $ts_end_guess - DAY_s; // $ts_end_guess was one day too far in the future |
| 1181 | 1180 | } |
@@ -1189,11 +1188,11 @@ discard block |
||
| 1189 | 1188 | $event['end'] = $ts_end; |
| 1190 | 1189 | $events[] = $event; |
| 1191 | 1190 | } |
| 1192 | - if ($this->debug && ((int) $this->debug > 2 || $this->debug == 'set_recurrences' || $this->debug == 'check_move_horizont' || $this->debug == 'insert_all_recurrences')) |
|
| 1191 | + if ($this->debug && ((int)$this->debug > 2 || $this->debug == 'set_recurrences' || $this->debug == 'check_move_horizont' || $this->debug == 'insert_all_recurrences')) |
|
| 1193 | 1192 | { |
| 1194 | 1193 | $event['start'] = $event_start_ts; |
| 1195 | 1194 | $event['end'] = $event_start_ts + $event_length; |
| 1196 | - $this->debug_message(__METHOD__.'(%1,start=%2,end=%3,events) events=%5',True,$event,$_start,$end_in,$events); |
|
| 1195 | + $this->debug_message(__METHOD__.'(%1,start=%2,end=%3,events) events=%5', True, $event, $_start, $end_in, $events); |
|
| 1197 | 1196 | } |
| 1198 | 1197 | } |
| 1199 | 1198 | |
@@ -1204,18 +1203,18 @@ discard block |
||
| 1204 | 1203 | * @param array $event event to insert, it has start- and end-date of the first recurrence, not of $date_ymd |
| 1205 | 1204 | * @param int|string $date_ymd of the date of the event |
| 1206 | 1205 | */ |
| 1207 | - function add_adjusted_event(&$events,$event,$date_ymd) |
|
| 1206 | + function add_adjusted_event(&$events, $event, $date_ymd) |
|
| 1208 | 1207 | { |
| 1209 | 1208 | $event_in = $event; |
| 1210 | 1209 | // calculate the new start- and end-time |
| 1211 | 1210 | $length_s = $this->date2ts($event['end']) - $this->date2ts($event['start']); |
| 1212 | 1211 | $event_start_arr = $this->date2array($event['start']); |
| 1213 | 1212 | |
| 1214 | - $date_arr = $this->date2array((string) $date_ymd); |
|
| 1213 | + $date_arr = $this->date2array((string)$date_ymd); |
|
| 1215 | 1214 | $date_arr['hour'] = $event_start_arr['hour']; |
| 1216 | 1215 | $date_arr['minute'] = $event_start_arr['minute']; |
| 1217 | 1216 | $date_arr['second'] = $event_start_arr['second']; |
| 1218 | - unset($date_arr['raw']); // else date2ts would use it |
|
| 1217 | + unset($date_arr['raw']); // else date2ts would use it |
|
| 1219 | 1218 | $event['start'] = $this->date2ts($date_arr); |
| 1220 | 1219 | $event['end'] = $event['start'] + $length_s; |
| 1221 | 1220 | |
@@ -1223,7 +1222,7 @@ discard block |
||
| 1223 | 1222 | |
| 1224 | 1223 | if ($this->debug && ($this->debug > 2 || $this->debug == 'add_adjust_event')) |
| 1225 | 1224 | { |
| 1226 | - $this->debug_message('calendar_bo::add_adjust_event(,%1,%2) as %3',True,$event_in,$date_ymd,$event); |
|
| 1225 | + $this->debug_message('calendar_bo::add_adjust_event(,%1,%2) as %3', True, $event_in, $date_ymd, $event); |
|
| 1227 | 1226 | } |
| 1228 | 1227 | } |
| 1229 | 1228 | |
@@ -1247,22 +1246,22 @@ discard block |
||
| 1247 | 1246 | { |
| 1248 | 1247 | $info = array( |
| 1249 | 1248 | 'res_id' => $uid, |
| 1250 | - 'email' => $GLOBALS['egw']->accounts->id2name($uid,'account_email'), |
|
| 1251 | - 'name' => trim($GLOBALS['egw']->accounts->id2name($uid,'account_firstname'). ' ' . |
|
| 1252 | - $GLOBALS['egw']->accounts->id2name($uid,'account_lastname')), |
|
| 1249 | + 'email' => $GLOBALS['egw']->accounts->id2name($uid, 'account_email'), |
|
| 1250 | + 'name' => trim($GLOBALS['egw']->accounts->id2name($uid, 'account_firstname').' '. |
|
| 1251 | + $GLOBALS['egw']->accounts->id2name($uid, 'account_lastname')), |
|
| 1253 | 1252 | 'type' => $GLOBALS['egw']->accounts->get_type($uid), |
| 1254 | 1253 | 'app' => 'accounts', |
| 1255 | 1254 | ); |
| 1256 | 1255 | } |
| 1257 | 1256 | else |
| 1258 | 1257 | { |
| 1259 | - list($info) = $this->resources[$uid[0]]['info'] ? ExecMethod($this->resources[$uid[0]]['info'],substr($uid,1)) : false; |
|
| 1258 | + list($info) = $this->resources[$uid[0]]['info'] ? ExecMethod($this->resources[$uid[0]]['info'], substr($uid, 1)) : false; |
|
| 1260 | 1259 | if ($info) |
| 1261 | 1260 | { |
| 1262 | 1261 | $info['type'] = $uid[0]; |
| 1263 | 1262 | if (!$info['email'] && $info['responsible']) |
| 1264 | 1263 | { |
| 1265 | - $info['email'] = $GLOBALS['egw']->accounts->id2name($info['responsible'],'account_email'); |
|
| 1264 | + $info['email'] = $GLOBALS['egw']->accounts->id2name($info['responsible'], 'account_email'); |
|
| 1266 | 1265 | } |
| 1267 | 1266 | $info['app'] = $this->resources[$uid[0]]['app']; |
| 1268 | 1267 | } |
@@ -1271,7 +1270,7 @@ discard block |
||
| 1271 | 1270 | } |
| 1272 | 1271 | if ($this->debug && ($this->debug > 2 || $this->debug == 'resource_info')) |
| 1273 | 1272 | { |
| 1274 | - $this->debug_message('calendar_bo::resource_info(%1) = %2',True,$uid,$res_info_cache[$uid]); |
|
| 1273 | + $this->debug_message('calendar_bo::resource_info(%1) = %2', True, $uid, $res_info_cache[$uid]); |
|
| 1275 | 1274 | } |
| 1276 | 1275 | return $res_info_cache[$uid]; |
| 1277 | 1276 | } |
@@ -1292,7 +1291,7 @@ discard block |
||
| 1292 | 1291 | * @param int $user =null for which user to check, default current user |
| 1293 | 1292 | * @return boolean true permission granted, false for permission denied or null if event not found |
| 1294 | 1293 | */ |
| 1295 | - function check_perms($needed,$event=0,$other=0,$date_format='ts',$date_to_read=null,$user=null) |
|
| 1294 | + function check_perms($needed, $event = 0, $other = 0, $date_format = 'ts', $date_to_read = null, $user = null) |
|
| 1296 | 1295 | { |
| 1297 | 1296 | if (!$user) $user = $this->user; |
| 1298 | 1297 | if ($user == $this->user) |
@@ -1301,13 +1300,13 @@ discard block |
||
| 1301 | 1300 | } |
| 1302 | 1301 | else |
| 1303 | 1302 | { |
| 1304 | - $grants = $GLOBALS['egw']->acl->get_grants('calendar',true,$user); |
|
| 1303 | + $grants = $GLOBALS['egw']->acl->get_grants('calendar', true, $user); |
|
| 1305 | 1304 | } |
| 1306 | 1305 | |
| 1307 | 1306 | if ($other && !is_numeric($other)) |
| 1308 | 1307 | { |
| 1309 | 1308 | $resource = $this->resource_info($other); |
| 1310 | - return $needed & $resource['rights']; |
|
| 1309 | + return $needed&$resource['rights']; |
|
| 1311 | 1310 | } |
| 1312 | 1311 | if (is_int($event) && $event == 0) |
| 1313 | 1312 | { |
@@ -1317,15 +1316,15 @@ discard block |
||
| 1317 | 1316 | { |
| 1318 | 1317 | if (!is_array($event)) |
| 1319 | 1318 | { |
| 1320 | - $event = $this->read($event,$date_to_read,true,$date_format); // = no ACL check !!! |
|
| 1319 | + $event = $this->read($event, $date_to_read, true, $date_format); // = no ACL check !!! |
|
| 1321 | 1320 | } |
| 1322 | 1321 | if (!is_array($event)) |
| 1323 | 1322 | { |
| 1324 | 1323 | if ($this->xmlrpc) |
| 1325 | 1324 | { |
| 1326 | - $GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['not_exist'],$GLOBALS['xmlrpcstr']['not_exist']); |
|
| 1325 | + $GLOBALS['server']->xmlrpc_error($GLOBALS['xmlrpcerr']['not_exist'], $GLOBALS['xmlrpcstr']['not_exist']); |
|
| 1327 | 1326 | } |
| 1328 | - return null; // event not found |
|
| 1327 | + return null; // event not found |
|
| 1329 | 1328 | } |
| 1330 | 1329 | $owner = $event['owner']; |
| 1331 | 1330 | $private = !$event['public']; |
@@ -1333,7 +1332,7 @@ discard block |
||
| 1333 | 1332 | $grant = $grants[$owner]; |
| 1334 | 1333 | |
| 1335 | 1334 | // now any ACL rights (but invite rights!) implicate FREEBUSY rights (at least READ has to include FREEBUSY) |
| 1336 | - if ($grant & ~self::ACL_INVITE) $grant |= self::ACL_FREEBUSY; |
|
| 1335 | + if ($grant&~self::ACL_INVITE) $grant |= self::ACL_FREEBUSY; |
|
| 1337 | 1336 | |
| 1338 | 1337 | if (is_array($event) && ($needed == Acl::READ || $needed == self::ACL_FREEBUSY)) |
| 1339 | 1338 | { |
@@ -1342,15 +1341,15 @@ discard block |
||
| 1342 | 1341 | // |
| 1343 | 1342 | if ($event['participants'] && is_array($event['participants'])) |
| 1344 | 1343 | { |
| 1345 | - foreach(array_keys($event['participants']) as $uid) |
|
| 1344 | + foreach (array_keys($event['participants']) as $uid) |
|
| 1346 | 1345 | { |
| 1347 | - if ($uid == $user || $uid < 0 && in_array($user, (array)$GLOBALS['egw']->accounts->members($uid,true))) |
|
| 1346 | + if ($uid == $user || $uid < 0 && in_array($user, (array)$GLOBALS['egw']->accounts->members($uid, true))) |
|
| 1348 | 1347 | { |
| 1349 | 1348 | // if we are a participant, we have an implicite FREEBUSY, READ and PRIVAT grant |
| 1350 | - $grant |= self::ACL_FREEBUSY | Acl::READ | Acl::PRIVAT; |
|
| 1349 | + $grant |= self::ACL_FREEBUSY|Acl::READ|Acl::PRIVAT; |
|
| 1351 | 1350 | break; |
| 1352 | 1351 | } |
| 1353 | - elseif ($grants[$uid] & Acl::READ) |
|
| 1352 | + elseif ($grants[$uid]&Acl::READ) |
|
| 1354 | 1353 | { |
| 1355 | 1354 | // if we have a READ grant from a participant, we dont give an implicit privat grant too |
| 1356 | 1355 | $grant |= Acl::READ; |
@@ -1369,12 +1368,12 @@ discard block |
||
| 1369 | 1368 | } |
| 1370 | 1369 | if ($GLOBALS['egw']->accounts->get_type($owner) == 'g' && $needed == Acl::ADD) |
| 1371 | 1370 | { |
| 1372 | - $access = False; // a group can't be the owner of an event |
|
| 1371 | + $access = False; // a group can't be the owner of an event |
|
| 1373 | 1372 | } |
| 1374 | 1373 | else |
| 1375 | 1374 | { |
| 1376 | - $access = $user == $owner || $grant & $needed |
|
| 1377 | - && ($needed == self::ACL_FREEBUSY || !$private || $grant & Acl::PRIVAT); |
|
| 1375 | + $access = $user == $owner || $grant&$needed |
|
| 1376 | + && ($needed == self::ACL_FREEBUSY || !$private || $grant&Acl::PRIVAT); |
|
| 1378 | 1377 | } |
| 1379 | 1378 | // do NOT allow users to purge deleted events, if we dont have 'userpurge' enabled |
| 1380 | 1379 | if ($access && $needed == Acl::DELETE && $event['deleted'] && |
@@ -1385,7 +1384,7 @@ discard block |
||
| 1385 | 1384 | } |
| 1386 | 1385 | if ($this->debug && ($this->debug > 2 || $this->debug == 'check_perms')) |
| 1387 | 1386 | { |
| 1388 | - $this->debug_message('calendar_bo::check_perms(%1,%2,other=%3,%4,%5,user=%6)=%7',True,ACL_TYPE_IDENTIFER.$needed,$event,$other,$date_format,$date_to_read,$user,$access); |
|
| 1387 | + $this->debug_message('calendar_bo::check_perms(%1,%2,other=%3,%4,%5,user=%6)=%7', True, ACL_TYPE_IDENTIFER.$needed, $event, $other, $date_format, $date_to_read, $user, $access); |
|
| 1389 | 1388 | } |
| 1390 | 1389 | //error_log(__METHOD__."($needed,".array2string($event).",$other,...,$user) returning ".array2string($access)); |
| 1391 | 1390 | return $access; |
@@ -1400,9 +1399,9 @@ discard block |
||
| 1400 | 1399 | * array with keys 'second', 'minute', 'hour', 'day' or 'mday' (depricated !), 'month' and 'year' |
| 1401 | 1400 | * @param boolean $user2server =False conversion between user- and server-time; default False == Off |
| 1402 | 1401 | */ |
| 1403 | - static function date2ts($date,$user2server=False) |
|
| 1402 | + static function date2ts($date, $user2server = False) |
|
| 1404 | 1403 | { |
| 1405 | - return $user2server ? Api\DateTime::user2server($date,'ts') : Api\DateTime::to($date,'ts'); |
|
| 1404 | + return $user2server ? Api\DateTime::user2server($date, 'ts') : Api\DateTime::to($date, 'ts'); |
|
| 1406 | 1405 | } |
| 1407 | 1406 | |
| 1408 | 1407 | /** |
@@ -1412,9 +1411,9 @@ discard block |
||
| 1412 | 1411 | * @param boolean $server2user conversation between user- and server-time default False == Off |
| 1413 | 1412 | * @return array with keys 'second', 'minute', 'hour', 'day', 'month', 'year', 'raw' (timestamp) and 'full' (Ymd-string) |
| 1414 | 1413 | */ |
| 1415 | - static function date2array($date,$server2user=False) |
|
| 1414 | + static function date2array($date, $server2user = False) |
|
| 1416 | 1415 | { |
| 1417 | - return $server2user ? Api\DateTime::server2user($date,'array') : Api\DateTime::to($date,'array'); |
|
| 1416 | + return $server2user ? Api\DateTime::server2user($date, 'array') : Api\DateTime::to($date, 'array'); |
|
| 1418 | 1417 | } |
| 1419 | 1418 | |
| 1420 | 1419 | /** |
@@ -1425,9 +1424,9 @@ discard block |
||
| 1425 | 1424 | * @param string $format ='Ymd' format of the date to return, eg. 'Y-m-d\TH:i:sO' (2005-11-01T15:30:00+0100) |
| 1426 | 1425 | * @return string date formatted according to $format |
| 1427 | 1426 | */ |
| 1428 | - static function date2string($date,$server2user=False,$format='Ymd') |
|
| 1427 | + static function date2string($date, $server2user = False, $format = 'Ymd') |
|
| 1429 | 1428 | { |
| 1430 | - return $server2user ? Api\DateTime::server2user($date,$format) : Api\DateTime::to($date,$format); |
|
| 1429 | + return $server2user ? Api\DateTime::server2user($date, $format) : Api\DateTime::to($date, $format); |
|
| 1431 | 1430 | } |
| 1432 | 1431 | |
| 1433 | 1432 | /** |
@@ -1437,9 +1436,9 @@ discard block |
||
| 1437 | 1436 | * @param string|boolean $format ='' default common_prefs[dateformat], common_prefs[timeformat], false=time only, true=date only |
| 1438 | 1437 | * @return string the formated date (incl. time) |
| 1439 | 1438 | */ |
| 1440 | - static function format_date($date,$format='') |
|
| 1439 | + static function format_date($date, $format = '') |
|
| 1441 | 1440 | { |
| 1442 | - return Api\DateTime::to($date,$format); |
|
| 1441 | + return Api\DateTime::to($date, $format); |
|
| 1443 | 1442 | } |
| 1444 | 1443 | |
| 1445 | 1444 | /** |
@@ -1461,7 +1460,7 @@ discard block |
||
| 1461 | 1460 | * @param mixed $param a variable number of parameters, to be inserted in $msg |
| 1462 | 1461 | * arrays get serialized with print_r() ! |
| 1463 | 1462 | */ |
| 1464 | - static function debug_message($msg,$backtrace=True) |
|
| 1463 | + static function debug_message($msg, $backtrace = True) |
|
| 1465 | 1464 | { |
| 1466 | 1465 | static $acl2string = array( |
| 1467 | 1466 | 0 => 'ACL-UNKNOWN', |
@@ -1472,22 +1471,22 @@ discard block |
||
| 1472 | 1471 | Acl::PRIVAT => 'ACL_PRIVATE', |
| 1473 | 1472 | self::ACL_FREEBUSY => 'ACL_FREEBUSY', |
| 1474 | 1473 | ); |
| 1475 | - for($i = 2; $i < func_num_args(); ++$i) |
|
| 1474 | + for ($i = 2; $i < func_num_args(); ++$i) |
|
| 1476 | 1475 | { |
| 1477 | 1476 | $param = func_get_arg($i); |
| 1478 | 1477 | |
| 1479 | 1478 | if (is_null($param)) |
| 1480 | 1479 | { |
| 1481 | - $param='NULL'; |
|
| 1480 | + $param = 'NULL'; |
|
| 1482 | 1481 | } |
| 1483 | 1482 | else |
| 1484 | 1483 | { |
| 1485 | - switch(gettype($param)) |
|
| 1484 | + switch (gettype($param)) |
|
| 1486 | 1485 | { |
| 1487 | 1486 | case 'string': |
| 1488 | - if (substr($param,0,strlen(ACL_TYPE_IDENTIFER))== ACL_TYPE_IDENTIFER) |
|
| 1487 | + if (substr($param, 0, strlen(ACL_TYPE_IDENTIFER)) == ACL_TYPE_IDENTIFER) |
|
| 1489 | 1488 | { |
| 1490 | - $param = (int) substr($param,strlen(ACL_TYPE_IDENTIFER)); |
|
| 1489 | + $param = (int)substr($param, strlen(ACL_TYPE_IDENTIFER)); |
|
| 1491 | 1490 | $param = (isset($acl2string[$param]) ? $acl2string[$param] : $acl2string[0])." ($param)"; |
| 1492 | 1491 | } |
| 1493 | 1492 | else |
@@ -1510,11 +1509,11 @@ discard block |
||
| 1510 | 1509 | $param = $param ? 'True' : 'False'; |
| 1511 | 1510 | break; |
| 1512 | 1511 | case 'integer': |
| 1513 | - if ($param >= mktime(0,0,0,1,1,2000)) $param = adodb_date('Y-m-d H:i:s',$param)." ($param)"; |
|
| 1512 | + if ($param >= mktime(0, 0, 0, 1, 1, 2000)) $param = adodb_date('Y-m-d H:i:s', $param)." ($param)"; |
|
| 1514 | 1513 | break; |
| 1515 | 1514 | } |
| 1516 | 1515 | } |
| 1517 | - $msg = str_replace('%'.($i-1),$param,$msg); |
|
| 1516 | + $msg = str_replace('%'.($i - 1), $param, $msg); |
|
| 1518 | 1517 | } |
| 1519 | 1518 | error_log($msg); |
| 1520 | 1519 | if ($backtrace) error_log(function_backtrace(1)); |
@@ -1529,7 +1528,7 @@ discard block |
||
| 1529 | 1528 | * @param boolean $display_day =false should a day-name prefix the date, eg. monday June 20, 2006 |
| 1530 | 1529 | * @return string with formated date |
| 1531 | 1530 | */ |
| 1532 | - function long_date($_first,$last=0,$display_time=false,$display_day=false) |
|
| 1531 | + function long_date($_first, $last = 0, $display_time = false, $display_day = false) |
|
| 1533 | 1532 | { |
| 1534 | 1533 | $first = $this->date2array($_first); |
| 1535 | 1534 | if ($last) |
@@ -1544,27 +1543,27 @@ discard block |
||
| 1544 | 1543 | |
| 1545 | 1544 | if ($display_day) |
| 1546 | 1545 | { |
| 1547 | - $range = lang(adodb_date('l',$first['raw'])).($this->common_prefs['dateformat'][0] != 'd' ? ' ' : ', '); |
|
| 1546 | + $range = lang(adodb_date('l', $first['raw'])).($this->common_prefs['dateformat'][0] != 'd' ? ' ' : ', '); |
|
| 1548 | 1547 | } |
| 1549 | 1548 | for ($i = 0; $i < 5; $i += 2) |
| 1550 | 1549 | { |
| 1551 | - switch($datefmt[$i]) |
|
| 1550 | + switch ($datefmt[$i]) |
|
| 1552 | 1551 | { |
| 1553 | 1552 | case 'd': |
| 1554 | - $range .= $first['day'] . ($datefmt[1] == '.' ? '.' : ''); |
|
| 1553 | + $range .= $first['day'].($datefmt[1] == '.' ? '.' : ''); |
|
| 1555 | 1554 | if ($first['month'] != $last['month'] || $first['year'] != $last['year']) |
| 1556 | 1555 | { |
| 1557 | 1556 | if (!$month_before_day) |
| 1558 | 1557 | { |
| 1559 | - $range .= ' '.lang(strftime('%B',$first['raw'])); |
|
| 1558 | + $range .= ' '.lang(strftime('%B', $first['raw'])); |
|
| 1560 | 1559 | } |
| 1561 | 1560 | if ($first['year'] != $last['year'] && $datefmt[0] != 'Y') |
| 1562 | 1561 | { |
| 1563 | - $range .= ($datefmt[0] != 'd' ? ', ' : ' ') . $first['year']; |
|
| 1562 | + $range .= ($datefmt[0] != 'd' ? ', ' : ' ').$first['year']; |
|
| 1564 | 1563 | } |
| 1565 | 1564 | if ($display_time) |
| 1566 | 1565 | { |
| 1567 | - $range .= ' '.adodb_date($timefmt,$first['raw']); |
|
| 1566 | + $range .= ' '.adodb_date($timefmt, $first['raw']); |
|
| 1568 | 1567 | } |
| 1569 | 1568 | if (!$last) |
| 1570 | 1569 | { |
@@ -1574,43 +1573,43 @@ discard block |
||
| 1574 | 1573 | |
| 1575 | 1574 | if ($first['year'] != $last['year'] && $datefmt[0] == 'Y') |
| 1576 | 1575 | { |
| 1577 | - $range .= $last['year'] . ', '; |
|
| 1576 | + $range .= $last['year'].', '; |
|
| 1578 | 1577 | } |
| 1579 | 1578 | |
| 1580 | 1579 | if ($month_before_day) |
| 1581 | 1580 | { |
| 1582 | - $range .= lang(strftime('%B',$last['raw'])); |
|
| 1581 | + $range .= lang(strftime('%B', $last['raw'])); |
|
| 1583 | 1582 | } |
| 1584 | 1583 | } |
| 1585 | 1584 | else |
| 1586 | 1585 | { |
| 1587 | 1586 | if ($display_time) |
| 1588 | 1587 | { |
| 1589 | - $range .= ' '.adodb_date($timefmt,$first['raw']); |
|
| 1588 | + $range .= ' '.adodb_date($timefmt, $first['raw']); |
|
| 1590 | 1589 | } |
| 1591 | 1590 | $range .= ' - '; |
| 1592 | 1591 | } |
| 1593 | - $range .= ' ' . $last['day'] . ($datefmt[1] == '.' ? '.' : ''); |
|
| 1592 | + $range .= ' '.$last['day'].($datefmt[1] == '.' ? '.' : ''); |
|
| 1594 | 1593 | break; |
| 1595 | 1594 | case 'm': |
| 1596 | 1595 | case 'M': |
| 1597 | - $range .= ' '.lang(strftime('%B',$month_before_day ? $first['raw'] : $last['raw'])) . ' '; |
|
| 1596 | + $range .= ' '.lang(strftime('%B', $month_before_day ? $first['raw'] : $last['raw'])).' '; |
|
| 1598 | 1597 | break; |
| 1599 | 1598 | case 'Y': |
| 1600 | 1599 | if ($datefmt[0] != 'm') |
| 1601 | 1600 | { |
| 1602 | - $range .= ' ' . ($datefmt[0] == 'Y' ? $first['year'].($datefmt[2] == 'd' ? ', ' : ' ') : $last['year'].' '); |
|
| 1601 | + $range .= ' '.($datefmt[0] == 'Y' ? $first['year'].($datefmt[2] == 'd' ? ', ' : ' ') : $last['year'].' '); |
|
| 1603 | 1602 | } |
| 1604 | 1603 | break; |
| 1605 | 1604 | } |
| 1606 | 1605 | } |
| 1607 | 1606 | if ($display_time && $last) |
| 1608 | 1607 | { |
| 1609 | - $range .= ' '.adodb_date($timefmt,$last['raw']); |
|
| 1608 | + $range .= ' '.adodb_date($timefmt, $last['raw']); |
|
| 1610 | 1609 | } |
| 1611 | 1610 | if ($datefmt[4] == 'Y' && $datefmt[0] == 'm') |
| 1612 | 1611 | { |
| 1613 | - $range .= ', ' . $last['year']; |
|
| 1612 | + $range .= ', '.$last['year']; |
|
| 1614 | 1613 | } |
| 1615 | 1614 | return $range; |
| 1616 | 1615 | } |
@@ -1622,25 +1621,25 @@ discard block |
||
| 1622 | 1621 | * @param int $end_m end time in minutes since 0h |
| 1623 | 1622 | * @param boolean $both =false display the end-time too, duration is always displayed |
| 1624 | 1623 | */ |
| 1625 | - function timespan($start_m,$end_m,$both=false) |
|
| 1624 | + function timespan($start_m, $end_m, $both = false) |
|
| 1626 | 1625 | { |
| 1627 | 1626 | $duration = $end_m - $start_m; |
| 1628 | - if ($end_m == 24*60-1) ++$duration; |
|
| 1629 | - $duration = floor($duration/60).lang('h').($duration%60 ? $duration%60 : ''); |
|
| 1627 | + if ($end_m == 24 * 60 - 1) ++$duration; |
|
| 1628 | + $duration = floor($duration / 60).lang('h').($duration % 60 ? $duration % 60 : ''); |
|
| 1630 | 1629 | |
| 1631 | - $timespan = $t = Api\DateTime::to('20000101T'.sprintf('%02d',$start_m/60).sprintf('%02d',$start_m%60).'00', false); |
|
| 1630 | + $timespan = $t = Api\DateTime::to('20000101T'.sprintf('%02d', $start_m / 60).sprintf('%02d', $start_m % 60).'00', false); |
|
| 1632 | 1631 | |
| 1633 | 1632 | if ($both) // end-time too |
| 1634 | 1633 | { |
| 1635 | - $timespan .= ' - '.Api\DateTime::to('20000101T'.sprintf('%02d',$end_m/60).sprintf('%02d',$end_m%60).'00', false); |
|
| 1634 | + $timespan .= ' - '.Api\DateTime::to('20000101T'.sprintf('%02d', $end_m / 60).sprintf('%02d', $end_m % 60).'00', false); |
|
| 1636 | 1635 | // dont double am/pm if they are the same in both times |
| 1637 | - if ($this->common_prefs['timeformat'] == 12 && substr($timespan,-2) == substr($t,-2)) |
|
| 1636 | + if ($this->common_prefs['timeformat'] == 12 && substr($timespan, -2) == substr($t, -2)) |
|
| 1638 | 1637 | { |
| 1639 | - $timespan = str_replace($t,substr($t,0,-3),$timespan); |
|
| 1638 | + $timespan = str_replace($t, substr($t, 0, -3), $timespan); |
|
| 1640 | 1639 | } |
| 1641 | 1640 | $timespan .= ':'; |
| 1642 | 1641 | } |
| 1643 | - return $timespan . ' ' . $duration; |
|
| 1642 | + return $timespan.' '.$duration; |
|
| 1644 | 1643 | } |
| 1645 | 1644 | |
| 1646 | 1645 | /** |
@@ -1651,7 +1650,7 @@ discard block |
||
| 1651 | 1650 | * @param boolean $append_email =false append email (Name <email>) |
| 1652 | 1651 | * @return string with name |
| 1653 | 1652 | */ |
| 1654 | - function participant_name($id,$use_type=false, $append_email=false) |
|
| 1653 | + function participant_name($id, $use_type = false, $append_email = false) |
|
| 1655 | 1654 | { |
| 1656 | 1655 | static $id2lid = array(); |
| 1657 | 1656 | static $id2email = array(); |
@@ -1672,7 +1671,7 @@ discard block |
||
| 1672 | 1671 | else |
| 1673 | 1672 | { |
| 1674 | 1673 | $id2lid[$id] = Api\Accounts::username($id); |
| 1675 | - $id2email[$id] = $GLOBALS['egw']->accounts->id2name($id,'account_email'); |
|
| 1674 | + $id2email[$id] = $GLOBALS['egw']->accounts->id2name($id, 'account_email'); |
|
| 1676 | 1675 | } |
| 1677 | 1676 | } |
| 1678 | 1677 | return $id2lid[$id].(($append_email || $id[0] == 'e') && $id2email[$id] ? ' <'.$id2email[$id].'>' : ''); |
@@ -1686,37 +1685,37 @@ discard block |
||
| 1686 | 1685 | * @param boolean $show_group_invitation =false show group-invitations (status == 'G') or not (default) |
| 1687 | 1686 | * @return array with id / names with status pairs |
| 1688 | 1687 | */ |
| 1689 | - function participants($event,$long_status=false,$show_group_invitation=false) |
|
| 1688 | + function participants($event, $long_status = false, $show_group_invitation = false) |
|
| 1690 | 1689 | { |
| 1691 | 1690 | //error_log(__METHOD__.__LINE__.array2string($event['participants'])); |
| 1692 | 1691 | $names = array(); |
| 1693 | - foreach((array)$event['participants'] as $id => $status) |
|
| 1692 | + foreach ((array)$event['participants'] as $id => $status) |
|
| 1694 | 1693 | { |
| 1695 | 1694 | if (!is_string($status)) continue; |
| 1696 | 1695 | $quantity = $role = null; |
| 1697 | - calendar_so::split_status($status,$quantity,$role); |
|
| 1696 | + calendar_so::split_status($status, $quantity, $role); |
|
| 1698 | 1697 | |
| 1699 | - if ($status == 'G' && !$show_group_invitation) continue; // dont show group-invitation |
|
| 1698 | + if ($status == 'G' && !$show_group_invitation) continue; // dont show group-invitation |
|
| 1700 | 1699 | |
| 1701 | 1700 | $lang_status = lang($this->verbose_status[$status]); |
| 1702 | 1701 | if (!$long_status) |
| 1703 | 1702 | { |
| 1704 | - switch($status[0]) |
|
| 1703 | + switch ($status[0]) |
|
| 1705 | 1704 | { |
| 1706 | 1705 | case 'A': // accepted |
| 1707 | - $status = Api\Html::image('calendar','accepted',$lang_status); |
|
| 1706 | + $status = Api\Html::image('calendar', 'accepted', $lang_status); |
|
| 1708 | 1707 | break; |
| 1709 | 1708 | case 'R': // rejected |
| 1710 | - $status = Api\Html::image('calendar','rejected',$lang_status); |
|
| 1709 | + $status = Api\Html::image('calendar', 'rejected', $lang_status); |
|
| 1711 | 1710 | break; |
| 1712 | 1711 | case 'T': // tentative |
| 1713 | - $status = Api\Html::image('calendar','tentative',$lang_status); |
|
| 1712 | + $status = Api\Html::image('calendar', 'tentative', $lang_status); |
|
| 1714 | 1713 | break; |
| 1715 | 1714 | case 'U': // no response = unknown |
| 1716 | - $status = Api\Html::image('calendar','needs-action',$lang_status); |
|
| 1715 | + $status = Api\Html::image('calendar', 'needs-action', $lang_status); |
|
| 1717 | 1716 | break; |
| 1718 | 1717 | case 'D': // delegated |
| 1719 | - $status = Api\Html::image('calendar','forward',$lang_status); |
|
| 1718 | + $status = Api\Html::image('calendar', 'forward', $lang_status); |
|
| 1720 | 1719 | break; |
| 1721 | 1720 | case 'G': // group invitation |
| 1722 | 1721 | // Todo: Image, seems not to be used |
@@ -1738,13 +1737,13 @@ discard block |
||
| 1738 | 1737 | $role = lang($this->roles[$role]); |
| 1739 | 1738 | } |
| 1740 | 1739 | // allow to use cats as roles (beside regular iCal ones) |
| 1741 | - elseif (substr($role,0,6) == 'X-CAT-' && ($cat_id = (int)substr($role,6)) > 0) |
|
| 1740 | + elseif (substr($role, 0, 6) == 'X-CAT-' && ($cat_id = (int)substr($role, 6)) > 0) |
|
| 1742 | 1741 | { |
| 1743 | 1742 | $role = $GLOBALS['egw']->categories->id2name($cat_id); |
| 1744 | 1743 | } |
| 1745 | 1744 | else |
| 1746 | 1745 | { |
| 1747 | - $role = lang(str_replace('X-','',$role)); |
|
| 1746 | + $role = lang(str_replace('X-', '', $role)); |
|
| 1748 | 1747 | } |
| 1749 | 1748 | $names[$id] .= ' '.$role; |
| 1750 | 1749 | } |
@@ -1761,13 +1760,13 @@ discard block |
||
| 1761 | 1760 | * @param int $color color of the category, if multiple cats, the color of the last one with color is returned |
| 1762 | 1761 | * @return array with id / names |
| 1763 | 1762 | */ |
| 1764 | - function categories($category,&$color) |
|
| 1763 | + function categories($category, &$color) |
|
| 1765 | 1764 | { |
| 1766 | 1765 | static $id2cat = array(); |
| 1767 | 1766 | $cats = array(); |
| 1768 | 1767 | $color = 0; |
| 1769 | 1768 | |
| 1770 | - foreach(explode(',',$category) as $cat_id) |
|
| 1769 | + foreach (explode(',', $category) as $cat_id) |
|
| 1771 | 1770 | { |
| 1772 | 1771 | if (!$cat_id) continue; |
| 1773 | 1772 | |
@@ -1782,7 +1781,7 @@ discard block |
||
| 1782 | 1781 | { |
| 1783 | 1782 | $color = $cat['data']['color']; |
| 1784 | 1783 | } |
| 1785 | - elseif(preg_match('/(#[0-9A-Fa-f]{6})/', $cat['description'], $parts)) |
|
| 1784 | + elseif (preg_match('/(#[0-9A-Fa-f]{6})/', $cat['description'], $parts)) |
|
| 1786 | 1785 | { |
| 1787 | 1786 | $color = $parts[1]; |
| 1788 | 1787 | } |
@@ -1794,12 +1793,12 @@ discard block |
||
| 1794 | 1793 | /** |
| 1795 | 1794 | * This is called only by list_cals(). It was moved here to remove fatal error in php5 beta4 |
| 1796 | 1795 | */ |
| 1797 | - private static function _list_cals_add($id,&$users,&$groups) |
|
| 1796 | + private static function _list_cals_add($id, &$users, &$groups) |
|
| 1798 | 1797 | { |
| 1799 | 1798 | $name = Api\Accounts::username($id); |
| 1800 | 1799 | if (!($egw_name = $GLOBALS['egw']->accounts->id2name($id))) |
| 1801 | 1800 | { |
| 1802 | - return; // do not return no longer existing accounts which eg. still mentioned in acl |
|
| 1801 | + return; // do not return no longer existing accounts which eg. still mentioned in acl |
|
| 1803 | 1802 | } |
| 1804 | 1803 | if (($type = $GLOBALS['egw']->accounts->get_type($id)) == 'g') |
| 1805 | 1804 | { |
@@ -1811,7 +1810,7 @@ discard block |
||
| 1811 | 1810 | } |
| 1812 | 1811 | $arr[$id] = array( |
| 1813 | 1812 | 'grantor' => $id, |
| 1814 | - 'value' => ($type == 'g' ? 'g_' : '') . $id, |
|
| 1813 | + 'value' => ($type == 'g' ? 'g_' : '').$id, |
|
| 1815 | 1814 | 'name' => $name, |
| 1816 | 1815 | 'sname' => $egw_name |
| 1817 | 1816 | ); |
@@ -1833,26 +1832,26 @@ discard block |
||
| 1833 | 1832 | * @param int $user account_id of user to generate list for |
| 1834 | 1833 | * @param array $grants =null calendar grants from user, or null to query them from acl class |
| 1835 | 1834 | */ |
| 1836 | - public static function list_calendars($user, array $grants=null) |
|
| 1835 | + public static function list_calendars($user, array $grants = null) |
|
| 1837 | 1836 | { |
| 1838 | 1837 | if (is_null($grants)) $grants = $GLOBALS['egw']->acl->get_grants('calendar', true, $user); |
| 1839 | 1838 | |
| 1840 | 1839 | $users = $groups = array(); |
| 1841 | - foreach(array_keys($grants) as $id) |
|
| 1840 | + foreach (array_keys($grants) as $id) |
|
| 1842 | 1841 | { |
| 1843 | - self::_list_cals_add($id,$users,$groups); |
|
| 1842 | + self::_list_cals_add($id, $users, $groups); |
|
| 1844 | 1843 | } |
| 1845 | 1844 | if (($memberships = $GLOBALS['egw']->accounts->memberships($user, true))) |
| 1846 | 1845 | { |
| 1847 | - foreach($memberships as $group) |
|
| 1846 | + foreach ($memberships as $group) |
|
| 1848 | 1847 | { |
| 1849 | - self::_list_cals_add($group,$users,$groups); |
|
| 1848 | + self::_list_cals_add($group, $users, $groups); |
|
| 1850 | 1849 | |
| 1851 | - if (($account_perms = $GLOBALS['egw']->acl->get_ids_for_location($group,Acl::READ,'calendar'))) |
|
| 1850 | + if (($account_perms = $GLOBALS['egw']->acl->get_ids_for_location($group, Acl::READ, 'calendar'))) |
|
| 1852 | 1851 | { |
| 1853 | - foreach($account_perms as $id) |
|
| 1852 | + foreach ($account_perms as $id) |
|
| 1854 | 1853 | { |
| 1855 | - self::_list_cals_add($id,$users,$groups); |
|
| 1854 | + self::_list_cals_add($id, $users, $groups); |
|
| 1856 | 1855 | } |
| 1857 | 1856 | } |
| 1858 | 1857 | } |
@@ -1860,7 +1859,7 @@ discard block |
||
| 1860 | 1859 | usort($users, array(__CLASS__, 'name_cmp')); |
| 1861 | 1860 | usort($groups, array(__CLASS__, 'name_cmp')); |
| 1862 | 1861 | |
| 1863 | - return array_merge($users, $groups); // users first and then groups, both alphabeticaly |
|
| 1862 | + return array_merge($users, $groups); // users first and then groups, both alphabeticaly |
|
| 1864 | 1863 | } |
| 1865 | 1864 | |
| 1866 | 1865 | /** |
@@ -1900,28 +1899,27 @@ discard block |
||
| 1900 | 1899 | * month: numerical month |
| 1901 | 1900 | * occurence: numerical year or 0 for every year |
| 1902 | 1901 | */ |
| 1903 | - function read_holidays($year=0) |
|
| 1902 | + function read_holidays($year = 0) |
|
| 1904 | 1903 | { |
| 1905 | - if (!$year) $year = (int) date('Y',$this->now_su); |
|
| 1904 | + if (!$year) $year = (int)date('Y', $this->now_su); |
|
| 1906 | 1905 | |
| 1907 | 1906 | $holidays = calendar_holidays::read( |
| 1908 | 1907 | !empty($GLOBALS['egw_info']['server']['ical_holiday_url']) ? |
| 1909 | - $GLOBALS['egw_info']['server']['ical_holiday_url'] : |
|
| 1910 | - $GLOBALS['egw_info']['user']['preferences']['common']['country'], $year); |
|
| 1908 | + $GLOBALS['egw_info']['server']['ical_holiday_url'] : $GLOBALS['egw_info']['user']['preferences']['common']['country'], $year); |
|
| 1911 | 1909 | |
| 1912 | 1910 | // search for birthdays |
| 1913 | 1911 | if ($GLOBALS['egw_info']['server']['hide_birthdays'] != 'yes') |
| 1914 | 1912 | { |
| 1915 | 1913 | $contacts = new Api\Contacts(); |
| 1916 | - foreach($contacts->get_addressbooks() as $owner => $name) |
|
| 1914 | + foreach ($contacts->get_addressbooks() as $owner => $name) |
|
| 1917 | 1915 | { |
| 1918 | 1916 | $holidays += $contacts->read_birthdays($owner, $year); |
| 1919 | 1917 | } |
| 1920 | 1918 | } |
| 1921 | 1919 | |
| 1922 | - if ((int) $this->debug >= 2 || $this->debug == 'read_holidays') |
|
| 1920 | + if ((int)$this->debug >= 2 || $this->debug == 'read_holidays') |
|
| 1923 | 1921 | { |
| 1924 | - $this->debug_message('calendar_bo::read_holidays(%1)=%2',true,$year,$holidays); |
|
| 1922 | + $this->debug_message('calendar_bo::read_holidays(%1)=%2', true, $year, $holidays); |
|
| 1925 | 1923 | } |
| 1926 | 1924 | return $holidays; |
| 1927 | 1925 | } |
@@ -1932,10 +1930,10 @@ discard block |
||
| 1932 | 1930 | * @param type $event |
| 1933 | 1931 | * @return array array of selected calendar fields |
| 1934 | 1932 | */ |
| 1935 | - public static function get_link_options ($event = array()) |
|
| 1933 | + public static function get_link_options($event = array()) |
|
| 1936 | 1934 | { |
| 1937 | - unset($event); // not used, but required by function signature |
|
| 1938 | - $options = array ( |
|
| 1935 | + unset($event); // not used, but required by function signature |
|
| 1936 | + $options = array( |
|
| 1939 | 1937 | 'end' => lang('End date'), |
| 1940 | 1938 | 'id' => lang('ID'), |
| 1941 | 1939 | 'owner' => lang('Event owner'), |
@@ -1962,7 +1960,7 @@ discard block |
||
| 1962 | 1960 | list($id, $recur) = explode('-', $event, 2); |
| 1963 | 1961 | $event = $this->read($id, $recur); |
| 1964 | 1962 | } |
| 1965 | - else if (!is_array($event) && (int) $event > 0) |
|
| 1963 | + else if (!is_array($event) && (int)$event > 0) |
|
| 1966 | 1964 | { |
| 1967 | 1965 | $event = $this->read($event); |
| 1968 | 1966 | } |
@@ -1970,7 +1968,7 @@ discard block |
||
| 1970 | 1968 | { |
| 1971 | 1969 | return $event; |
| 1972 | 1970 | } |
| 1973 | - $type = explode(',',$this->cal_prefs['link_title']); |
|
| 1971 | + $type = explode(',', $this->cal_prefs['link_title']); |
|
| 1974 | 1972 | if (is_array($type)) |
| 1975 | 1973 | { |
| 1976 | 1974 | foreach ($type as &$val) |
@@ -1996,10 +1994,10 @@ discard block |
||
| 1996 | 1994 | $extra_fields [] = $event[$val]; |
| 1997 | 1995 | } |
| 1998 | 1996 | } |
| 1999 | - $str_fields = implode(', ',$extra_fields); |
|
| 2000 | - if (is_array($extra_fields)) return $this->format_date($event['start']) . ': ' . $event['title'] . ($str_fields? ', ' . $str_fields:''); |
|
| 1997 | + $str_fields = implode(', ', $extra_fields); |
|
| 1998 | + if (is_array($extra_fields)) return $this->format_date($event['start']).': '.$event['title'].($str_fields ? ', '.$str_fields : ''); |
|
| 2001 | 1999 | } |
| 2002 | - return $this->format_date($event['start']) . ': ' . $event['title']; |
|
| 2000 | + return $this->format_date($event['start']).': '.$event['title']; |
|
| 2003 | 2001 | } |
| 2004 | 2002 | |
| 2005 | 2003 | /** |
@@ -2018,10 +2016,10 @@ discard block |
||
| 2018 | 2016 | 'offset' => $options['start'], |
| 2019 | 2017 | 'order' => 'cal_start DESC', |
| 2020 | 2018 | ); |
| 2021 | - if($options['num_rows']) { |
|
| 2019 | + if ($options['num_rows']) { |
|
| 2022 | 2020 | $query['num_rows'] = $options['num_rows']; |
| 2023 | 2021 | } |
| 2024 | - foreach((array) $this->search($query) as $event) |
|
| 2022 | + foreach ((array)$this->search($query) as $event) |
|
| 2025 | 2023 | { |
| 2026 | 2024 | $result[$event['id']] = $this->link_title($event); |
| 2027 | 2025 | } |
@@ -2038,11 +2036,11 @@ discard block |
||
| 2038 | 2036 | * @param int $user =null for which user to check, default current user |
| 2039 | 2037 | * @return boolean true if access is granted or false otherwise |
| 2040 | 2038 | */ |
| 2041 | - function file_access($id,$check,$rel_path,$user=null) |
|
| 2039 | + function file_access($id, $check, $rel_path, $user = null) |
|
| 2042 | 2040 | { |
| 2043 | - unset($rel_path); // not used, but required by function signature |
|
| 2041 | + unset($rel_path); // not used, but required by function signature |
|
| 2044 | 2042 | |
| 2045 | - return $this->check_perms($check,$id,0,'ts',null,$user); |
|
| 2043 | + return $this->check_perms($check, $id, 0, 'ts', null, $user); |
|
| 2046 | 2044 | } |
| 2047 | 2045 | |
| 2048 | 2046 | /** |
@@ -2058,36 +2056,36 @@ discard block |
||
| 2058 | 2056 | } |
| 2059 | 2057 | Api\Cache::setSession('calendar', 'default_prefs_set', 'set'); |
| 2060 | 2058 | |
| 2061 | - $default_prefs =& $GLOBALS['egw']->preferences->default['calendar']; |
|
| 2062 | - $forced_prefs =& $GLOBALS['egw']->preferences->forced['calendar']; |
|
| 2059 | + $default_prefs = & $GLOBALS['egw']->preferences->default['calendar']; |
|
| 2060 | + $forced_prefs = & $GLOBALS['egw']->preferences->forced['calendar']; |
|
| 2063 | 2061 | |
| 2064 | - $subject = lang('Calendar Event') . ' - $$action$$: $$startdate$$ $$title$$'."\n"; |
|
| 2062 | + $subject = lang('Calendar Event').' - $$action$$: $$startdate$$ $$title$$'."\n"; |
|
| 2065 | 2063 | $values = array( |
| 2066 | - 'notifyAdded' => $subject . lang ('You have a meeting scheduled for %1','$$startdate$$'), |
|
| 2067 | - 'notifyCanceled' => $subject . lang ('Your meeting scheduled for %1 has been canceled','$$startdate$$'), |
|
| 2068 | - 'notifyModified' => $subject . lang ('Your meeting that had been scheduled for %1 has been rescheduled to %2','$$olddate$$','$$startdate$$'), |
|
| 2069 | - 'notifyDisinvited'=> $subject . lang ('You have been disinvited from the meeting at %1','$$startdate$$'), |
|
| 2070 | - 'notifyResponse' => $subject . lang ('On %1 %2 %3 your meeting request for %4','$$date$$','$$fullname$$','$$action$$','$$startdate$$'), |
|
| 2071 | - 'notifyAlarm' => lang('Alarm for %1 at %2 in %3','$$title$$','$$startdate$$','$$location$$')."\n".lang ('Here is your requested alarm.'), |
|
| 2064 | + 'notifyAdded' => $subject.lang('You have a meeting scheduled for %1', '$$startdate$$'), |
|
| 2065 | + 'notifyCanceled' => $subject.lang('Your meeting scheduled for %1 has been canceled', '$$startdate$$'), |
|
| 2066 | + 'notifyModified' => $subject.lang('Your meeting that had been scheduled for %1 has been rescheduled to %2', '$$olddate$$', '$$startdate$$'), |
|
| 2067 | + 'notifyDisinvited'=> $subject.lang('You have been disinvited from the meeting at %1', '$$startdate$$'), |
|
| 2068 | + 'notifyResponse' => $subject.lang('On %1 %2 %3 your meeting request for %4', '$$date$$', '$$fullname$$', '$$action$$', '$$startdate$$'), |
|
| 2069 | + 'notifyAlarm' => lang('Alarm for %1 at %2 in %3', '$$title$$', '$$startdate$$', '$$location$$')."\n".lang('Here is your requested alarm.'), |
|
| 2072 | 2070 | 'interval' => 30, |
| 2073 | 2071 | ); |
| 2074 | - foreach($values as $var => $default) |
|
| 2072 | + foreach ($values as $var => $default) |
|
| 2075 | 2073 | { |
| 2076 | - $type = substr($var,0,6) == 'notify' ? 'forced' : 'default'; |
|
| 2074 | + $type = substr($var, 0, 6) == 'notify' ? 'forced' : 'default'; |
|
| 2077 | 2075 | |
| 2078 | 2076 | // only set, if neither default nor forced pref exists |
| 2079 | 2077 | if ((!isset($default_prefs[$var]) || (string)$default_prefs[$var] === '') && (!isset($forced_prefs[$var]) || (string)$forced_prefs[$var] === '')) |
| 2080 | 2078 | { |
| 2081 | - $GLOBALS['egw']->preferences->add('calendar',$var,$default,'default'); // always store default, even if we have a forced too |
|
| 2082 | - if ($type == 'forced') $GLOBALS['egw']->preferences->add('calendar',$var,$default,'forced'); |
|
| 2079 | + $GLOBALS['egw']->preferences->add('calendar', $var, $default, 'default'); // always store default, even if we have a forced too |
|
| 2080 | + if ($type == 'forced') $GLOBALS['egw']->preferences->add('calendar', $var, $default, 'forced'); |
|
| 2083 | 2081 | $this->cal_prefs[$var] = $default; |
| 2084 | 2082 | $need_save = True; |
| 2085 | 2083 | } |
| 2086 | 2084 | } |
| 2087 | 2085 | if ($need_save) |
| 2088 | 2086 | { |
| 2089 | - $GLOBALS['egw']->preferences->save_repository(False,'default'); |
|
| 2090 | - $GLOBALS['egw']->preferences->save_repository(False,'forced'); |
|
| 2087 | + $GLOBALS['egw']->preferences->save_repository(False, 'default'); |
|
| 2088 | + $GLOBALS['egw']->preferences->save_repository(False, 'forced'); |
|
| 2091 | 2089 | } |
| 2092 | 2090 | } |
| 2093 | 2091 | |
@@ -2097,7 +2095,7 @@ discard block |
||
| 2097 | 2095 | * @param int|string $user account_id or account_lid |
| 2098 | 2096 | * @param string $pw =null password |
| 2099 | 2097 | */ |
| 2100 | - static function freebusy_url($user='',$pw=null) |
|
| 2098 | + static function freebusy_url($user = '', $pw = null) |
|
| 2101 | 2099 | { |
| 2102 | 2100 | if (is_numeric($user)) $user = $GLOBALS['egw']->accounts->id2name($user); |
| 2103 | 2101 | |
@@ -2110,8 +2108,8 @@ discard block |
||
| 2110 | 2108 | elseif ($GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy'] == 2) |
| 2111 | 2109 | { |
| 2112 | 2110 | $credentials = $GLOBALS['egw_info']['user']['account_lid'] |
| 2113 | - . ':' . $GLOBALS['egw_info']['user']['passwd']; |
|
| 2114 | - $credentials = '&cred=' . base64_encode($credentials); |
|
| 2111 | + . ':'.$GLOBALS['egw_info']['user']['passwd']; |
|
| 2112 | + $credentials = '&cred='.base64_encode($credentials); |
|
| 2115 | 2113 | } |
| 2116 | 2114 | return (!$GLOBALS['egw_info']['server']['webserver_url'] || $GLOBALS['egw_info']['server']['webserver_url'][0] == '/' ? |
| 2117 | 2115 | ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['HTTP_HOST'] : ''). |
@@ -2143,11 +2141,11 @@ discard block |
||
| 2143 | 2141 | * @param string &$schedule_tag=null on return schedule-tag (egw_cal.cal_id:egw_cal.cal_etag, no participant modifications!) |
| 2144 | 2142 | * @return string|boolean string with etag or false |
| 2145 | 2143 | */ |
| 2146 | - function get_etag($entry, &$schedule_tag=null) |
|
| 2144 | + function get_etag($entry, &$schedule_tag = null) |
|
| 2147 | 2145 | { |
| 2148 | 2146 | if (!is_array($entry)) |
| 2149 | 2147 | { |
| 2150 | - list($id,$recur_date) = explode(':',$entry); |
|
| 2148 | + list($id, $recur_date) = explode(':', $entry); |
|
| 2151 | 2149 | $entry = $this->read($id, $recur_date, true, 'server'); |
| 2152 | 2150 | } |
| 2153 | 2151 | $etag = $schedule_tag = $entry['id'].':'.$entry['etag']; |
@@ -2165,15 +2163,15 @@ discard block |
||
| 2165 | 2163 | * @param boolean $master_only =false only check recurance master (egw_cal_user.recur_date=0) |
| 2166 | 2164 | * @return integer |
| 2167 | 2165 | */ |
| 2168 | - public function get_ctag($user, $filter='owner', $master_only=false) |
|
| 2166 | + public function get_ctag($user, $filter = 'owner', $master_only = false) |
|
| 2169 | 2167 | { |
| 2170 | 2168 | if ($this->debug > 1) $startime = microtime(true); |
| 2171 | 2169 | |
| 2172 | 2170 | // resolve users to add memberships for users and members for groups |
| 2173 | 2171 | $users = $this->resolve_users($user); |
| 2174 | - $ctag = $users ? $this->so->get_ctag($users, $filter == 'owner', $master_only) : 0; // no rights, return 0 as ctag (otherwise we get SQL error!) |
|
| 2172 | + $ctag = $users ? $this->so->get_ctag($users, $filter == 'owner', $master_only) : 0; // no rights, return 0 as ctag (otherwise we get SQL error!) |
|
| 2175 | 2173 | |
| 2176 | - if ($this->debug > 1) error_log(__METHOD__. "($user, '$filter', $master_only) = $ctag = ".date('Y-m-d H:i:s',$ctag)." took ".(microtime(true)-$startime)." secs"); |
|
| 2174 | + if ($this->debug > 1) error_log(__METHOD__."($user, '$filter', $master_only) = $ctag = ".date('Y-m-d H:i:s', $ctag)." took ".(microtime(true) - $startime)." secs"); |
|
| 2177 | 2175 | return $ctag; |
| 2178 | 2176 | } |
| 2179 | 2177 | |
@@ -2193,7 +2191,7 @@ discard block |
||
| 2193 | 2191 | |
| 2194 | 2192 | $content = array( |
| 2195 | 2193 | 'info_cat' => $GLOBALS['egw']->categories->check_list(Acl::READ, $calendar['category']), |
| 2196 | - 'info_priority' => $calendar['priority'] , |
|
| 2194 | + 'info_priority' => $calendar['priority'], |
|
| 2197 | 2195 | 'info_public' => $calendar['public'] != 'private', |
| 2198 | 2196 | 'info_subject' => $calendar['title'], |
| 2199 | 2197 | 'info_des' => $calendar['description'], |
@@ -2208,7 +2206,7 @@ discard block |
||
| 2208 | 2206 | $content['link_app'][] = $calendar['info_link']['app']; |
| 2209 | 2207 | $content['link_id'][] = $calendar['info_link']['id']; |
| 2210 | 2208 | // Copy claendar's links |
| 2211 | - foreach(Link::get_links('calendar',$calendar['id'],'','link_lastmod DESC',true) as $link) |
|
| 2209 | + foreach (Link::get_links('calendar', $calendar['id'], '', 'link_lastmod DESC', true) as $link) |
|
| 2212 | 2210 | { |
| 2213 | 2211 | if ($link['app'] != Link::VFS_APPNAME) |
| 2214 | 2212 | { |
@@ -2221,7 +2219,7 @@ discard block |
||
| 2221 | 2219 | } |
| 2222 | 2220 | } |
| 2223 | 2221 | // Copy same custom fields |
| 2224 | - foreach(array_keys(Api\Storage\Customfields::get('infolog')) as $name) |
|
| 2222 | + foreach (array_keys(Api\Storage\Customfields::get('infolog')) as $name) |
|
| 2225 | 2223 | { |
| 2226 | 2224 | if ($this->customfields[$name]) $content['#'.$name] = $calendar['#'.$name]; |
| 2227 | 2225 | } |
@@ -2239,20 +2237,20 @@ discard block |
||
| 2239 | 2237 | function timesheet_set($data) |
| 2240 | 2238 | { |
| 2241 | 2239 | $set = array(); |
| 2242 | - list($id,$recurrence) = explode(':',$data['id']); |
|
| 2243 | - if ((int)$id && ($event = $this->read($id,$recurrence))) |
|
| 2240 | + list($id, $recurrence) = explode(':', $data['id']); |
|
| 2241 | + if ((int)$id && ($event = $this->read($id, $recurrence))) |
|
| 2244 | 2242 | { |
| 2245 | 2243 | $set['ts_start'] = $event['start']; |
| 2246 | 2244 | $set['ts_title'] = $this->link_title($event); |
| 2247 | - $set['start_time'] = Api\DateTime::to($event['start'],'H:i'); |
|
| 2245 | + $set['start_time'] = Api\DateTime::to($event['start'], 'H:i'); |
|
| 2248 | 2246 | $set['ts_description'] = $event['description']; |
| 2249 | - if ($this->isWholeDay($event)) $event['end']++; // whole day events are 1sec short |
|
| 2247 | + if ($this->isWholeDay($event)) $event['end']++; // whole day events are 1sec short |
|
| 2250 | 2248 | $set['ts_duration'] = ($event['end'] - $event['start']) / 60; |
| 2251 | 2249 | $set['ts_quantity'] = ($event['end'] - $event['start']) / 3600; |
| 2252 | - $set['end_time'] = null; // unset end-time |
|
| 2250 | + $set['end_time'] = null; // unset end-time |
|
| 2253 | 2251 | $set['cat_id'] = (int)$event['category']; |
| 2254 | 2252 | |
| 2255 | - foreach(Link::get_links('calendar',$id,'','link_lastmod DESC',true) as $link) |
|
| 2253 | + foreach (Link::get_links('calendar', $id, '', 'link_lastmod DESC', true) as $link) |
|
| 2256 | 2254 | { |
| 2257 | 2255 | if ($link['app'] != 'timesheet' && $link['app'] != Link::VFS_APPNAME) |
| 2258 | 2256 | { |