diff --git a/calendar/inc/class.bocalendar.inc.php b/calendar/inc/class.bocalendar.inc.php index ff8ec4e3c2..cb683d23b7 100755 --- a/calendar/inc/class.bocalendar.inc.php +++ b/calendar/inc/class.bocalendar.inc.php @@ -98,13 +98,15 @@ var $use_session = False; + var $today; + function bocalendar($session=0) { - global $phpgw, $phpgw_info, $date, $year, $month, $day, $owner, $filter, $cat_id, $friendly; + global $GLOBALS; + + $GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs'); - $phpgw->nextmatchs = CreateObject('phpgwapi.nextmatchs'); - - $this->grants = $phpgw->acl->get_grants('calendar'); + $this->grants = $GLOBALS['phpgw']->acl->get_grants('calendar'); if($this->debug) { echo "Read Use_Session : (".$session.")
\n"; } @@ -120,17 +122,17 @@ echo "Owner : ".$this->owner."
\n"; } - if(isset($owner)) + if(isset($GLOBALS['owner'])) { - $this->owner = intval($owner); + $this->owner = intval($GLOBALS['owner']); } elseif(!isset($this->owner) || !$this->owner) { - $this->owner = $phpgw_info['user']['account_id']; + $this->owner = $GLOBALS['phpgw_info']['user']['account_id']; } - $this->prefs['common'] = $phpgw_info['user']['preferences']['common']; - $this->prefs['calendar'] = $phpgw_info['user']['preferences']['calendar']; + $this->prefs['common'] = $GLOBALS['phpgw_info']['user']['preferences']['common']; + $this->prefs['calendar'] = $GLOBALS['phpgw_info']['user']['preferences']['calendar']; if ($this->prefs['common']['timeformat'] == '12') { @@ -141,45 +143,45 @@ $this->users_timeformat = 'H:i'; } - $this->holiday_color = (substr($phpgw_info['theme']['bg07'],0,1)=='#'?'':'#').$phpgw_info['theme']['bg07']; + $this->holiday_color = (substr($GLOBALS['phpgw_info']['theme']['bg07'],0,1)=='#'?'':'#').$GLOBALS['phpgw_info']['theme']['bg07']; - $this->printer_friendly = ($friendly == 1?True:False); + $this->printer_friendly = ($GLOBALS['friendly'] == 1?True:False); - if(isset($filter)) { $this->filter = $filter; } - if(isset($cat_id)) { $this->cat_id = $cat_id; } + if(isset($GLOBALS['filter'])) { $this->filter = $GLOBALS['filter']; } + if(isset($GLOBALS['cat_id'])) { $this->cat_id = $GLOBALS['cat_id']; } if(!isset($this->filter)) { $this->filter = ' '.$this->prefs['calendar']['defaultfilter'].' '; } - if(isset($date)) + if(isset($GLOBALS['date'])) { - $this->year = intval(substr($date,0,4)); - $this->month = intval(substr($date,4,2)); - $this->day = intval(substr($date,6,2)); + $this->year = intval(substr($GLOBALS['date'],0,4)); + $this->month = intval(substr($GLOBALS['date'],4,2)); + $this->day = intval(substr($GLOBALS['date'],6,2)); } else { - if(isset($year)) + if(isset($GLOBALS['year'])) { - $this->year = $year; + $this->year = $GLOBALS['year']; } elseif($this->year == 0) { $this->year = date('Y',time()); } - if(isset($month)) + if(isset($GLOBALS['month'])) { - $this->month = $month; + $this->month = $GLOBALS['month']; } elseif($this->month == 0) { $this->month = date('m',time()); } - if(isset($day)) + if(isset($GLOBALS['day'])) { - $this->day = $day; + $this->day = $GLOBALS['day']; } elseif($this->day == 0) { @@ -187,9 +189,17 @@ } } - $this->so = CreateObject('calendar.socalendar',$this->owner,$this->filter,$this->cat_id); + $this->so = CreateObject('calendar.socalendar', + Array( + 'owner' => $this->owner, + 'filter' => $this->filter, + 'category' => $this->cat_id + ) + ); $this->datetime = $this->so->datetime; + $this->today = date('Ymd',time()); + if($this->debug) { echo "BO Filter : (".$this->filter.")
\n"; @@ -210,9 +220,9 @@ function read_sessiondata() { - global $phpgw; - - $data = $phpgw->session->appsession('session_data','calendar'); + global $GLOBALS; + + $data = $GLOBALS['phpgw']->session->appsession('session_data','calendar'); if($this->debug) { echo '
Read:'; _debug_array($data); } $this->filter = $data['filter']; @@ -252,8 +262,9 @@ function delete_calendar($owner) { - global $phpgw_info; - if($phpgw_info['user']['apps']['admin']) + global $GLOBALS; + + if($GLOBALS['phpgw_info']['user']['apps']['admin']) { $this->so->delete_calendar($owner); } @@ -261,8 +272,9 @@ function change_owner($account_id,$new_owner) { - global $phpgw_info; - if($phpgw_info['server']['calendar_type'] == 'sql') + global $GLOBALS; + + if($GLOBALS['phpgw_info']['server']['calendar_type'] == 'sql') { $this->so->change_owner($account_id,$new_owner); } @@ -290,13 +302,13 @@ function update($p_cal=0,$p_participants=0,$p_start=0,$p_end=0,$p_recur_enddata=0) { - global $phpgw, $phpgw_info, $readsess, $cal, $participants, $start, $end, $recur_enddate; - - $cal = ($p_cal?$p_cal:$cal); - $participants = ($p_participants?$p_participants:$participants); - $start = ($p_start?$p_start:$start); - $end = ($p_end?$p_end:$end); - $recur_enddate = ($p_recur_enddate?$p_recur_enddate:$recur_enddate); + global $GLOBALS, $HTTP_POST_VARS, $HTTP_GET_VARS; + + $l_cal = ($p_cal?$p_cal:$HTTP_POST_VARS['cal']); + $l_participants = ($p_participants?$p_participants:$HTTP_POST_VARS['participants']); + $l_start = ($p_start?$p_start:$HTTP_POST_VARS['start']); + $l_end = ($p_end?$p_end:$HTTP_POST_VARS['end']); + $l_recur_enddate = ($p_recur_enddate?$p_recur_enddate:$HTTP_POST_VARS['recur_enddate']); $send_to_ui = True; if($p_cal || $p_participants || $p_start || $p_end || $p_recur_enddata) @@ -306,89 +318,94 @@ if($this->debug) { - echo "ID : ".$cal['id']."
\n"; + echo "ID : ".$l_cal['id']."
\n"; } $ui = CreateObject('calendar.uicalendar'); - if(isset($readsess)) + if(isset($HTTP_GET_VARS['readsess'])) { $event = $this->restore_from_appsession(); $datetime_check = $this->validate_update($event); if($datetime_check) { - $ui->edit($datetime_check,1); + $ui->edit( + Array( + 'cd' => $datetime_check, + 'readsess' => 1 + ) + ); } $overlapping_events = False; } else { - if(!$cal['id'] && !$this->check_perms(PHPGW_ACL_ADD)) + if(!$l_cal['id'] && !$this->check_perms(PHPGW_ACL_ADD)) { $ui->index(); } - elseif($cal['id'] && !$this->check_perms(PHPGW_ACL_EDIT)) + elseif($l_cal['id'] && !$this->check_perms(PHPGW_ACL_EDIT)) { $ui->index(); } - $this->fix_update_time($start); - $this->fix_update_time($end); + $this->fix_update_time($l_start); + $this->fix_update_time($l_end); - if(!isset($cal['private'])) + if(!isset($l_cal['private'])) { - $cal['private'] = 'public'; + $l_cal['private'] = 'public'; } - $is_public = ($cal['private'] == 'public'?1:0); + $is_public = ($l_cal['private'] == 'public'?1:0); $this->so->event_init(); - $this->so->set_category($cal['category']); - $this->so->set_title($cal['title']); - $this->so->set_description($cal['description']); - $this->so->set_start($start['year'],$start['month'],$start['mday'],$start['hour'],$start['min'],0); - $this->so->set_end($end['year'],$end['month'],$end['mday'],$end['hour'],$end['min'],0); + $this->so->set_category($l_cal['category']); + $this->so->set_title($l_cal['title']); + $this->so->set_description($l_cal['description']); + $this->so->set_start($l_start['year'],$l_start['month'],$l_start['mday'],$l_start['hour'],$l_start['min'],0); + $this->so->set_end($l_end['year'],$l_end['month'],$l_end['mday'],$l_end['hour'],$l_end['min'],0); $this->so->set_class($is_public); - if($cal['id']) + if($l_cal['id']) { - $this->so->add_attribute('id',$cal['id']); + $this->so->add_attribute('id',$l_cal['id']); } - if($cal['rpt_use_end'] != 'y') + if($l_cal['rpt_use_end'] != 'y') { - $recur_enddate['year'] = 0; - $recur_enddate['month'] = 0; - $recur_enddate['mday'] = 0; + $l_recur_enddate['year'] = 0; + $l_recur_enddate['month'] = 0; + $l_recur_enddate['mday'] = 0; } - switch($cal['recur_type']) + switch($l_cal['recur_type']) { case MCAL_RECUR_NONE: $this->so->set_recur_none(); break; case MCAL_RECUR_DAILY: - $this->so->set_recur_daily($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$cal['recur_interval']); + $this->so->set_recur_daily($l_recur_enddate['year'],$l_recur_enddate['month'],$l_recur_enddate['mday'],$l_cal['recur_interval']); break; case MCAL_RECUR_WEEKLY: - $cal['recur_data'] = $cal['rpt_sun'] + $cal['rpt_mon'] + $cal['rpt_tue'] + $cal['rpt_wed'] + $cal['rpt_thu'] + $cal['rpt_fri'] + $cal['rpt_sat']; - $this->so->set_recur_weekly($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$cal['recur_interval'],$cal['recur_data']); + $cal['recur_data'] = $l_cal['rpt_sun'] + $l_cal['rpt_mon'] + $l_cal['rpt_tue'] + $l_cal['rpt_wed'] + $l_cal['rpt_thu'] + $l_cal['rpt_fri'] + $l_cal['rpt_sat']; + $this->so->set_recur_weekly($l_recur_enddate['year'],$l_recur_enddate['month'],$l_recur_enddate['mday'],$cal['recur_interval'],$cal['recur_data']); break; case MCAL_RECUR_MONTHLY_MDAY: - $this->so->set_recur_monthly_mday($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$cal['recur_interval']); + $this->so->set_recur_monthly_mday($l_recur_enddate['year'],$l_recur_enddate['month'],$l_recur_enddate['mday'],$l_cal['recur_interval']); break; case MCAL_RECUR_MONTHLY_WDAY: - $this->so->set_recur_monthly_wday($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$cal['recur_interval']); + $this->so->set_recur_monthly_wday($l_recur_enddate['year'],$l_recur_enddate['month'],$l_recur_enddate['mday'],$l_cal['recur_interval']); break; case MCAL_RECUR_YEARLY: - $this->so->set_recur_yearly($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$cal['recur_interval']); + $this->so->set_recur_yearly($l_recur_enddate['year'],$l_recur_enddate['month'],$l_recur_enddate['mday'],$l_cal['recur_interval']); break; } - $parts = $participants; - $minparts = min($participants); + $parts = $l_participants; + $minparts = min($l_participants); $part = Array(); for($i=0;$iaccounts->get_type(intval($parts[$i])); + $acct_type = $GLOBALS['phpgw']->accounts->get_type(intval($parts[$i])); if($acct_type == 'u') { $part[$parts[$i]] = 1; @@ -420,22 +437,27 @@ // reset($participants); $event = $this->get_cached_event(); - if(!@$event['participants'][$cal['owner']]) + if(!@$event['participants'][$l_cal['owner']]) { $this->so->add_attribute('owner',$minparts); } else { - $this->so->add_attribute('owner',$cal['owner']); + $this->so->add_attribute('owner',$l_cal['owner']); } - $this->so->add_attribute('priority',$cal['priority']); + $this->so->add_attribute('priority',$l_cal['priority']); $event = $this->get_cached_event(); $this->store_to_appsession($event); $datetime_check = $this->validate_update($event); if($datetime_check) { - $ui->edit($datetime_check,1); + $ui->edit( + Array( + 'cd' => $datetime_check, + 'readsess' => 1 + ) + ); } $overlapping_events = $this->overlap( @@ -451,10 +473,10 @@ { if($send_to_ui) { - unset($phpgw_info['flags']['noheader']); - unset($phpgw_info['flags']['nonavbar']); + unset($GLOBALS['phpgw_info']['flags']['noheader']); + unset($GLOBALS['phpgw_info']['flags']['nonavbar']); $ui->overlap($overlapping_events,$event); - $phpgw_info['flags']['nofooter'] = True; + $GLOBALS['phpgw_info']['flags']['nofooter'] = True; return; } else @@ -487,73 +509,74 @@ function preferences() { - global $phpgw, $phpgw_info, $submit, $prefs; - if ($submit) + global $GLOBALS, $HTTP_POST_VARS; + + if ($HTTP_POST_VARS['submit']) { - $phpgw->preferences->read_repository(); - $phpgw->preferences->add('calendar','weekdaystarts',$prefs['weekdaystarts']); - $phpgw->preferences->add('calendar','workdaystarts',$prefs['workdaystarts']); - $phpgw->preferences->add('calendar','workdayends',$prefs['workdayends']); - $phpgw->preferences->add('calendar','defaultcalendar',$prefs['defaultcalendar']); - $phpgw->preferences->add('calendar','defaultfilter',$prefs['defaultfilter']); - $phpgw->preferences->add('calendar','interval',$prefs['interval']); - if ($prefs['mainscreen_showevents'] == True) + $GLOBALS['phpgw']->preferences->read_repository(); + $GLOBALS['phpgw']->preferences->add('calendar','weekdaystarts',$HTTP_POST_VARS['prefs']['weekdaystarts']); + $GLOBALS['phpgw']->preferences->add('calendar','workdaystarts',$HTTP_POST_VARS['prefs']['workdaystarts']); + $GLOBALS['phpgw']->preferences->add('calendar','workdayends',$HTTP_POST_VARS['prefs']['workdayends']); + $GLOBALS['phpgw']->preferences->add('calendar','defaultcalendar',$HTTP_POST_VARS['prefs']['defaultcalendar']); + $GLOBALS['phpgw']->preferences->add('calendar','defaultfilter',$HTTP_POST_VARS['prefs']['defaultfilter']); + $GLOBALS['phpgw']->preferences->add('calendar','interval',$HTTP_POST_VARS['prefs']['interval']); + if ($HTTP_POST_VARS['prefs']['mainscreen_showevents'] == True) { - $phpgw->preferences->add('calendar','mainscreen_showevents',$prefs['mainscreen_showevents']); + $GLOBALS['phpgw']->preferences->add('calendar','mainscreen_showevents',$HTTP_POST_VARS['prefs']['mainscreen_showevents']); } else { - $phpgw->preferences->delete('calendar','mainscreen_showevents'); + $GLOBALS['phpgw']->preferences->delete('calendar','mainscreen_showevents'); } - if ($prefs['send_updates'] == True) + if ($HTTP_POST_VARS['prefs']['send_updates'] == True) { - $phpgw->preferences->add('calendar','send_updates',$prefs['send_updates']); + $GLOBALS['phpgw']->preferences->add('calendar','send_updates',$HTTP_POST_VARS['prefs']['send_updates']); } else { - $phpgw->preferences->delete('calendar','send_updates'); + $GLOBALS['phpgw']->preferences->delete('calendar','send_updates'); } - if ($prefs['display_status'] == True) + if ($HTTP_POST_VARS['prefs']['display_status'] == True) { - $phpgw->preferences->add('calendar','display_status',$prefs['display_status']); + $GLOBALS['phpgw']->preferences->add('calendar','display_status',$HTTP_POST_VARS['prefs']['display_status']); } else { - $phpgw->preferences->delete('calendar','display_status'); + $GLOBALS['phpgw']->preferences->delete('calendar','display_status'); } - if ($prefs['default_private'] == True) + if ($HTTP_POST_VARS['prefs']['default_private'] == True) { - $phpgw->preferences->add('calendar','default_private',$prefs['default_private']); + $GLOBALS['phpgw']->preferences->add('calendar','default_private',$HTTP_POST_VARS['prefs']['default_private']); } else { - $phpgw->preferences->delete('calendar','default_private'); + $GLOBALS['phpgw']->preferences->delete('calendar','default_private'); } - if ($prefs['display_minicals'] == True) + if ($HTTP_POST_VARS['prefs']['display_minicals'] == True) { - $phpgw->preferences->add('calendar','display_minicals',$prefs['display_minicals']); + $GLOBALS['phpgw']->preferences->add('calendar','display_minicals',$HTTP_POST_VARS['prefs']['display_minicals']); } else { - $phpgw->preferences->delete('calendar','display_minicals'); + $GLOBALS['phpgw']->preferences->delete('calendar','display_minicals'); } - if ($prefs['print_black_white'] == True) + if ($HTTP_POST_VARS['prefs']['print_black_white'] == True) { - $phpgw->preferences->add('calendar','print_black_white',$prefs['print_black_white']); + $GLOBALS['phpgw']->preferences->add('calendar','print_black_white',$HTTP_POST_VARS['prefs']['print_black_white']); } else { - $phpgw->preferences->delete('calendar','print_black_white'); + $GLOBALS['phpgw']->preferences->delete('calendar','print_black_white'); } - $phpgw->preferences->save_repository(True); - - Header('Location: '.$phpgw->link('/preferences/index.php')); - $phpgw->common->phpgw_exit(); + $GLOBALS['phpgw']->preferences->save_repository(True); + + Header('Location: '.$GLOBALS['phpgw']->link('/preferences/index.php')); + $GLOBALS['phpgw']->common->phpgw_exit(); } } @@ -646,14 +669,14 @@ function overlap($starttime,$endtime,$participants,$owner=0,$id=0) { - global $phpgw, $phpgw_info; + global $GLOBALS; $retval = Array(); $ok = False; - if($starttime == $endtime && $phpgw->common->show_date($starttime,'Hi') == 0) + if($starttime == $endtime && $GLOBALS['phpgw']->common->show_date($starttime,'Hi') == 0) { - $endtime = mktime(23,59,59,$phpgw->common->show_date($starttime,'m'),$phpgw->common->show_date($starttime,'d') + 1,$phpgw->common->show_date($starttime,'Y')) - $this->datetime->tz_offset; + $endtime = mktime(23,59,59,$GLOBALS['phpgw']->common->show_date($starttime,'m'),$GLOBALS['phpgw']->common->show_date($starttime,'d') + 1,$GLOBALS['phpgw']->common->show_date($starttime,'Y')) - $this->datetime->tz_offset; } $sql = 'AND ((('.$starttime.' <= phpgw_cal.datetime) AND ('.$endtime.' >= phpgw_cal.datetime) AND ('.$endtime.' <= phpgw_cal.edatetime)) ' @@ -695,7 +718,7 @@ return false; } - $db2 = $phpgw->db; + $db2 = $GLOBALS['phpgw']->db; for($i=0;$iaccounts->exists($account_id) == False) + if($GLOBALS['phpgw']->accounts->exists($account_id) == False) { return False; } - $db = $phpgw->db; + $db = $GLOBALS['phpgw']->db; $db->query('SELECT account_lid,account_lastname,account_firstname FROM phpgw_accounts WHERE account_id='.$account_id,__LINE__,__FILE__); if($db->num_rows()) { @@ -800,13 +823,13 @@ function is_private($event,$owner) { - global $phpgw, $phpgw_info; + global $GLOBALS; if($owner == 0) { $owner = $this->owner; } - if ($owner == $phpgw_info['user']['account_id'] || ($event['public']==1) || ($this->check_perms(PHPGW_ACL_PRIVATE,$owner) && $event['public']==0)) + if ($owner == $GLOBALS['phpgw_info']['user']['account_id'] || ($event['public']==1) || ($this->check_perms(PHPGW_ACL_PRIVATE,$owner) && $event['public']==0)) { return False; } @@ -817,7 +840,7 @@ elseif($event['public'] == 2) { $is_private = True; - $groups = $phpgw->accounts->membership($owner); + $groups = $GLOBALS['phpgw']->accounts->membership($owner); while (list($key,$group) = each($groups)) { if (strpos(' '.implode($event['groups'],',').' ',$group['account_id'])) @@ -887,8 +910,6 @@ function splittime($time,$follow_24_rule=True) { - global $phpgw_info; - $temp = array('hour','minute','second','ampm'); $time = strrev($time); $second = intval(strrev(substr($time,0,2))); @@ -923,8 +944,6 @@ function build_time_for_display($fixed_time) { - global $phpgw_info; - $time = $this->splittime($fixed_time); $str = $time['hour'].':'.((int)$time['minute']<=9?'0':'').$time['minute']; @@ -941,27 +960,43 @@ $inserted = False; if($this->cached_events[$date]) { + $year = substr($date,0,4); + $month = substr($date,4,2); + $day = substr($date,6,2); + + if($this->debug) + { + echo "Date : ".$date." Count : ".count($this->cached_events[$date])."
\n"; + } + for($i=0;$icached_events[$date]);$i++) { $events = $this->cached_events[$date][$i]; - $events_id = $events['id']; - $event_id = $event['id']; - if($events['id'] == $event['id']) + if($this->cached_events[$date][$i]['id'] == $event['id']) { + if($this->debug) + { + echo "Item already inserted!
\n"; + } $inserted = True; break; } - $year = substr($date,0,4); - $month = substr($date,4,2); - $day = substr($date,6,2); - if(date('Hi',mktime($event['start']['hour'],$event['start']['min'],$event['start']['sec'],$month,$day,$year)) < date('Hi',mktime($events['start']['hour'],$events['start']['min'],$events['start']['sec'],$month,$day,$year))) + /* This puts all spanning events across multiple days up at the top. */ + if($this->cached_events[$date][$i]['recur_type'] == MCAL_RECUR_NONE) + { + if($this->cached_events[$date][$i]['start']['mday'] != $day && $this->cached_events[$date][$i]['end']['mday'] >= $day) + { + continue; + } + } + if(date('Hi',mktime($event['start']['hour'],$event['start']['min'],$event['start']['sec'],$month,$day,$year)) < date('Hi',mktime($this->cached_events[$date][$i]['start']['hour'],$this->cached_events[$date][$i]['start']['min'],$this->cached_events[$date][$i]['start']['sec'],$month,$day,$year))) { for($j=count($this->cached_events[$date]);$j>=$i;$j--) { - $this->cached_events[$date][$j + 1] = $this->cached_events[$date][$j]; + $this->cached_events[$date][$j] = $this->cached_events[$date][$j-1]; } $inserted = True; - $this->cached_events[$date][$j] = $event; + $this->cached_events[$date][$i] = $event; break; } } @@ -974,8 +1009,6 @@ function check_repeating_events($datetime) { - global $phpgw, $phpgw_info; - @reset($this->repeating_events); $search_date_full = date('Ymd',$datetime); $search_date_year = date('Y',$datetime); @@ -1102,13 +1135,6 @@ function store_to_cache($syear,$smonth,$sday,$eyear=0,$emonth=0,$eday=0) { - global $phpgw, $phpgw_info; - - if($this->debug) - { - echo "Start Date : ".sprintf("%04d%02d%02d",$syear,$smonth,$sday)."
\n"; - } - if(!$eyear && !$emonth && !$eday) { $edate = mktime(23,59,59,$smonth + 1,$sday + 1,$syear); @@ -1133,6 +1159,12 @@ $edate = mktime(23,59,59,$emonth,$eday,$eyear); } + if($this->debug) + { + echo "Start Date : ".sprintf("%04d%02d%02d",$syear,$smonth,$sday)."
\n"; + echo "End Date : ".sprintf("%04d%02d%02d",$eyear,$emonth,$eday)."
\n"; + } + $cached_event_ids = $this->so->list_events($syear,$smonth,$sday,$eyear,$emonth,$eday); $cached_event_ids_repeating = $this->so->list_repeated_events($syear,$smonth,$sday,$eyear,$emonth,$eday); @@ -1159,20 +1191,33 @@ { $event = $this->so->read_entry($cached_event_ids[$i]); $startdate = intval(date('Ymd',$this->maketime($event['start']))); - $enddate= intval(date('Ymd',$this->maketime($event['end']))); + $enddate = intval(date('Ymd',$this->maketime($event['end']))); $this->cached_events[$startdate][] = $event; -// if($startdate != $enddate) -// { + if($startdate != $enddate) + { $start['year'] = intval(substr($startdate,0,4)); $start['month'] = intval(substr($startdate,4,2)); - $start['day'] = intval(substr($startdate,6,2)); - for($j=$startdate,$k=0;$j<=$enddate;$k++,$j=intval(date('Ymd',mktime(0,0,0,$start['month'],$start['day'] + $k,$start['year'])))) + $start['mday'] = intval(substr($startdate,6,2)); + for($j=$startdate,$k=0;$j<=$enddate;$k++,$j=intval(date('Ymd',mktime(0,0,0,$start['month'],$start['mday'] + $k,$start['year'])))) { - if($this->cached_events[$j][count($this->cached_events[$j]) - 1] != $event) + $c_evt_day = count($this->cached_events[$j]) - 1; +// if($c_evt_day < 0) +// { +// $c_evt_day = 0; +// } + if($this->debug) { + echo "Date: ".$j." Count : ".$c_evt_day."
\n"; + } + if($this->cached_events[$j][$c_evt_day]['id'] != $event['id']) + { + if($this->debug) + { + echo "Adding Event for Date: ".$j."
\n"; + } $this->cached_events[$j][] = $event; } -// } + } } } } @@ -1185,7 +1230,7 @@ $this->repeating_events[$i] = $this->so->read_entry($cached_event_ids_repeating[$i]); } $edate -= $this->datetime->tz_offset; - for($date=mktime(0,0,0,$smonth,$sday,$syear) - $this->datetime->tz_offset;$date<$edate;$date += (60 * 60 * 24)) + for($date=mktime(0,0,0,$smonth,$sday,$syear) - $this->datetime->tz_offset;$date<$edate;$date += 86400) { $this->check_repeating_events($date); } @@ -1196,16 +1241,16 @@ /* Begin Appsession Data */ function store_to_appsession($event) { - global $phpgw; - $phpgw->session->appsession('entry','calendar',$event); + global $GLOBALS; + $GLOBALS['phpgw']->session->appsession('entry','calendar',$event); } function restore_from_appsession() { - global $phpgw; + global $GLOBALS; $this->event_init(); -// $event = unserialize(str_replace('O:8:"stdClass"','O:13:"calendar_time"',serialize($phpgw->session->appsession('entry','calendar')))); - $event = $phpgw->session->appsession('entry','calendar'); +// $event = unserialize(str_replace('O:8:"stdClass"','O:13:"calendar_time"',serialize($GLOBALS['phpgw']->session->appsession('entry','calendar')))); + $event = $GLOBALS['phpgw']->session->appsession('entry','calendar'); $this->so->cal->event = $event; return $event; } @@ -1295,17 +1340,21 @@ function set_week_array($startdate,$cellcolor,$weekly) { - global $phpgw, $phpgw_info; + global $GLOBALS, $phpgw, $phpgw_info; - $today = date('Ymd',time()); - for ($j=0;$j<7;$j++) + for ($j=0,$datetime=$startdate - $this->datetime->tz_offset;$j<7;$j++,$datetime += 86400) { - $date = $this->datetime->gmtdate($startdate + ($j * 86400)); + $date = date('Ymd',$datetime); - $holidays = $this->cached_holidays[$date['full']]; + if($this->debug) + { + echo "set_week_array : Date : ".$date."
\n"; + } + + $holidays = $this->cached_holidays[$date]; if($weekly) { - $cellcolor = $phpgw->nextmatchs->alternate_row_color($cellcolor); + $cellcolor = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($cellcolor); } $day_image = ''; @@ -1313,21 +1362,21 @@ { $extra = ' bgcolor="'.$this->holiday_color.'"'; $class = 'minicalhol'; - if ($date['full'] == $today) + if ($date == $this->today) { - $day_image = ' background="'.$phpgw->common->image('calendar','mini_day_block.gif').'"'; + $day_image = ' background="'.$GLOBALS['phpgw']->common->image('calendar','mini_day_block.gif').'"'; } } - elseif ($date['full'] != $today) + elseif ($date != $this->today) { $extra = ' bgcolor="'.$cellcolor.'"'; $class = 'minicalendar'; } else { - $extra = ' bgcolor="'.$phpgw_info['theme']['cal_today'].'"'; + $extra = ' bgcolor="'.$GLOBALS['phpgw_info']['theme']['cal_today'].'"'; $class = 'minicalendar'; - $day_image = ' background="'.$phpgw->common->image('calendar','mini_day_block.gif').'"'; + $day_image = ' background="'.$GLOBALS['phpgw']->common->image('calendar','mini_day_block.gif').'"'; } if($this->printer_friendly && @$this->prefs['calendar']['print_black_white']) @@ -1335,11 +1384,14 @@ $extra = ''; } - $new_event = False; if(!$this->printer_friendly && $this->check_perms(PHPGW_ACL_ADD)) { $new_event = True; } + else + { + $new_event = False; + } $holiday_name = Array(); if($holidays) { @@ -1348,18 +1400,24 @@ $holiday_name[] = $holidays[$k]['name']; } } - $rep_events = $this->cached_events[$date['full']]; - $appts = False; - if($rep_events) + if($this->cached_events[$date]) { + if($this->debug) + { + echo "Date : ".$date." Appointments found : ".count($this->cached_events[$date])."
\n"; + } $appts = True; } + else + { + $appts = False; + } $week = ''; - if (!$j || ($j && substr($date['full'],6,2) == '01')) + if (!$j || ($j && substr($date,6,2) == '01')) { $week = 'week ' .(int)((date('z',($startdate+(24*3600*4)))+7)/7); } - $daily[$date['full']] = Array( + $daily[$date] = Array( 'extra' => $extra, 'new_event' => $new_event, 'holidays' => $holiday_name, @@ -1380,7 +1438,7 @@ function prepare_matrix($interval,$increment,$part,$status,$fulldate) { - global $phpgw; + global $GLOBALS; for($h=0;$h<24;$h++) { for($m=0;$m<$interval;$m++) @@ -1441,7 +1499,7 @@ $endminute = ($endtemp['minute'] / $increment); } $private = $this->is_private($event,$part); - $time_display = $phpgw->common->show_date($eventstart['raw'],$this->users_timeformat).'-'.$phpgw->common->show_date($eventend['raw'],$this->users_timeformat); + $time_display = $GLOBALS['phpgw']->common->show_date($eventstart['raw'],$this->users_timeformat).'-'.$GLOBALS['phpgw']->common->show_date($eventend['raw'],$this->users_timeformat); $time_description = '('.$time_display.') '.$this->get_short_field($event,$private,'title').$this->display_status($event['participants'][$part]); for($m=$startminute;$m<=$endminute;$m++) { @@ -1479,16 +1537,16 @@ function send_update($msg_type,$participants,$old_event=False,$new_event=False) { - global $phpgw, $phpgw_info; + global $GLOBALS; - $db = $phpgw->db; + $db = $GLOBALS['phpgw']->db; $db->query("SELECT app_version FROM phpgw_applications WHERE app_name='calendar'",__LINE__,__FILE__); $db->next_record(); $version = $db->f('app_version'); unset($db); - $phpgw_info['user']['preferences'] = $phpgw->common->create_emailpreferences($phpgw_info['user']['preferences']); - $sender = $phpgw_info['user']['preferences']['email']['address']; + $GLOBALS['phpgw_info']['user']['preferences'] = $GLOBALS['phpgw']->common->create_emailpreferences($GLOBALS['phpgw_info']['user']['preferences']); + $sender = $GLOBALS['phpgw_info']['user']['preferences']['email']['address']; $temp_tz_offset = $this->prefs['common']['tz_offset']; $temp_timeformat = $this->prefs['common']['timeformat']; @@ -1505,7 +1563,7 @@ } } - $temp_user = $phpgw_info['user']; + $temp_user = $GLOBALS['phpgw_info']['user']; if($this->owner != $temp_user['account_id']) { @@ -1515,14 +1573,14 @@ $phpgw_info['user'] = $accounts->read_repository(); $pref = CreateObject('phpgwapi.preferences',$user); - $phpgw_info['user']['preferences'] = $pref->read_repository(); + $GLOBALS['phpgw_info']['user']['preferences'] = $pref->read_repository(); } else { - $user = $phpgw_info['user']['account_id']; + $user = $GLOBALS['phpgw_info']['user']['account_id']; } - $phpgw_info['user']['preferences'] = $phpgw->common->create_emailpreferences($phpgw_info['user']['preferences'],$user); + $GLOBALS['phpgw_info']['user']['preferences'] = $GLOBALS['phpgw']->common->create_emailpreferences($GLOBALS['phpgw_info']['user']['preferences'],$user); switch($msg_type) { @@ -1570,10 +1628,13 @@ while(list($userid,$statusid) = each($participants)) { - if(intval($userid) != $phpgw_info['user']['account_id']) + if(intval($userid) != $GLOBALS['phpgw_info']['user']['account_id']) { -// echo "Msg Type = ".$msg_type."
\n"; -// echo "userid = ".$userid."
\n"; + if($this->debug) + { + echo "Msg Type = ".$msg_type."
\n"; + echo "userid = ".$userid."
\n"; + } if(!is_object($send)) { $send = CreateObject('phpgwapi.send'); @@ -1585,24 +1646,28 @@ { continue; } - $part_prefs = $phpgw->common->create_emailpreferences($part_prefs,intval($userid)); + $part_prefs = $GLOBALS['phpgw']->common->create_emailpreferences($part_prefs,intval($userid)); $to = $part_prefs['email']['address']; -// echo "Email being sent to: ".$to."
\n"; + + if($this->debug) + { + echo "Email being sent to: ".$to."
\n"; + } - $phpgw_info['user']['preferences']['common']['tz_offset'] = $part_prefs['common']['tz_offset']; - $phpgw_info['user']['preferences']['common']['timeformat'] = $part_prefs['common']['timeformat']; - $phpgw_info['user']['preferences']['common']['dateformat'] = $part_prefs['common']['dateformat']; + $GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'] = $part_prefs['common']['tz_offset']; + $GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] = $part_prefs['common']['timeformat']; + $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] = $part_prefs['common']['dateformat']; - $new_tz_offset = ((60 * 60) * intval($phpgw_info['user']['preferences']['common']['tz_offset'])); + $new_tz_offset = ((60 * 60) * intval($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])); if($old_event != False) { - $old_event_date = $phpgw->common->show_date($old_event_datetime); + $old_event_date = $GLOBALS['phpgw']->common->show_date($old_event_datetime); } if($new_event != False) { - $new_event_date = $phpgw->common->show_date($new_event_datetime); + $new_event_date = $GLOBALS['phpgw']->common->show_date($new_event_datetime); } switch($msg_type) @@ -1635,12 +1700,12 @@ if((is_int($this->user) && $this->user != $temp_user['account_id']) || (is_string($this->user) && $this->user != $temp_user['account_lid'])) { - $phpgw_info['user'] = $temp_user; + $GLOBALS['phpgw_info']['user'] = $temp_user; } - $phpgw_info['user']['preferences']['common']['tz_offset'] = $temp_tz_offset; - $phpgw_info['user']['preferences']['common']['timeformat'] = $temp_timeformat; - $phpgw_info['user']['preferences']['common']['dateformat'] = $temp_dateformat; + $GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'] = $temp_tz_offset; + $GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] = $temp_timeformat; + $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] = $temp_dateformat; } function prepare_recipients(&$new_event,$old_event) diff --git a/calendar/inc/class.socalendar.inc.php b/calendar/inc/class.socalendar.inc.php index f7c89f397d..240f103da3 100755 --- a/calendar/inc/class.socalendar.inc.php +++ b/calendar/inc/class.socalendar.inc.php @@ -24,30 +24,32 @@ var $filter; var $cat_id; - function socalendar($owner=0,$filter='',$cat_id='') + function socalendar($param) { global $phpgw, $phpgw_info; $this->db = $phpgw->db; $this->datetime = CreateObject('phpgwapi.datetime'); - if($owner == 0) + + if(!isset($param['owner']) || $param['owner'] == 0) { $this->owner = $phpgw_info['user']['account_id']; } else { - $this->owner = $owner; + $this->owner = $param['owner']; } - if($filter != '') + if(isset($param['filter']) && $param['filter'] != '') { - $this->filter = $filter; + $this->filter = $param['filter']; } - if($cat_id != '') + if(isset($param['category']) && $param['category'] != '') { - $this->cat_id = $cat_id; + $this->cat_id = $param['category']; } + if($this->debug) { echo 'SO Filter : '.$this->filter."
\n"; diff --git a/calendar/inc/class.socalendar__.inc.php b/calendar/inc/class.socalendar__.inc.php index a24500fc64..d171a51d24 100755 --- a/calendar/inc/class.socalendar__.inc.php +++ b/calendar/inc/class.socalendar__.inc.php @@ -64,6 +64,7 @@ class socalendar__ var $user; var $users_status; var $datetime; + var $debug = False; function socalendar__() { diff --git a/calendar/inc/class.socalendar_sql.inc.php b/calendar/inc/class.socalendar_sql.inc.php index d876418982..672aaee7dc 100755 --- a/calendar/inc/class.socalendar_sql.inc.php +++ b/calendar/inc/class.socalendar_sql.inc.php @@ -176,7 +176,10 @@ class socalendar_ extends socalendar__ $this->add_attribute('recur_enddate',0,'sec'); } $this->add_attribute('recur_enddate',0,'alarm'); -// echo 'Event ID#'.$this->event['id'].' : Enddate = '.$enddate."
\n"; + if($this->debug) + { + echo 'Event ID#'.$this->event['id'].' : Enddate = '.$enddate."
\n"; + } $this->add_attribute('recur_data',$this->stream->f('recur_data')); } @@ -216,19 +219,29 @@ class socalendar_ extends socalendar__ $datetime = mktime(0,0,0,$startMonth,$startDay,$startYear) - $tz_offset; $user_where = ' AND (phpgw_cal_user.cal_login = '.$this->user.') '; - $startDate = 'AND (phpgw_cal.datetime >= '.$datetime.') '; - + $startDate = 'AND ( ( (phpgw_cal.datetime >= '.$datetime.') '; + + $enddate = ''; if($endYear != 0 && $endMonth != 0 && $endDay != 0) { $edatetime = mktime(23,59,59,intval($endMonth),intval($endDay),intval($endYear)) - $tz_offset; - $endDate = 'AND (phpgw_cal.edatetime <= '.$edatetime.') '; - } - else - { - $endDate = ''; + $endDate .= 'AND (phpgw_cal.edatetime <= '.$edatetime.') ) ' + . 'OR ( (phpgw_cal.datetime <= '.$datetime.') ' + . 'AND (phpgw_cal.edatetime >= '.$edatetime.') ) ' + . 'OR ( (phpgw_cal.datetime >= '.$datetime.') ' + . 'AND (phpgw_cal.datetime <= '.$edatetime.') ' + . 'AND (phpgw_cal.edatetime >= '.$edatetime.') ) ' + . 'OR ( (phpgw_cal.datetime <= '.$datetime.') ' + . 'AND (phpgw_cal.edatetime >= '.$datetime.') ' + . 'AND (phpgw_cal.edatetime <= '.$edatetime.') '; } + $endDate .= ') ) '; $order_by = 'ORDER BY phpgw_cal.datetime ASC, phpgw_cal.edatetime ASC, phpgw_cal.priority ASC'; + if($this->debug) + { + echo "SQL : ".$user_where.$startDate.$endDate.$extra."
\n"; + } return $this->get_event_ids(False,$user_where.$startDate.$endDate.$extra.$order_by); } @@ -316,11 +329,21 @@ class socalendar_ extends socalendar__ . $repeats_from . 'WHERE (phpgw_cal_user.cal_id = phpgw_cal.cal_id) ' . $repeats_where . $extra; + + if($this->debug) + { + echo "FULL SQL : ".$sql."
\n"; + } + $this->stream->query($sql,__LINE__,__FILE__); $retval = Array(); if($this->stream->num_rows() == 0) { + if($this->debug) + { + echo "No records found!
\n"; + } return $retval; } @@ -328,6 +351,10 @@ class socalendar_ extends socalendar__ { $retval[] = intval($this->stream->f('cal_id')); } + if($this->debug) + { + echo "Records found!
\n"; + } return $retval; } diff --git a/calendar/inc/class.uicalendar.inc.php b/calendar/inc/class.uicalendar.inc.php index f4ae0f4ee9..f5e878dd98 100755 --- a/calendar/inc/class.uicalendar.inc.php +++ b/calendar/inc/class.uicalendar.inc.php @@ -53,9 +53,9 @@ function uicalendar() { - global $phpgw, $phpgw_info; - - $phpgw->browser = CreateObject('phpgwapi.browser'); + global $GLOBALS; + + $GLOBALS['phpgw']->browser = CreateObject('phpgwapi.browser'); $this->bo = CreateObject('calendar.bocalendar',1); @@ -65,11 +65,11 @@ } - $this->template = $phpgw->template; - $this->template_dir = $phpgw->common->get_tpl_dir('calendar'); + $this->template = $GLOBALS['phpgw']->template; + $this->template_dir = $GLOBALS['phpgw']->common->get_tpl_dir('calendar'); $this->cat = CreateObject('phpgwapi.categories'); - $this->holiday_color = (substr($phpgw_info['theme']['bg07'],0,1)=='#'?'':'#').$phpgw_info['theme']['bg07']; + $this->holiday_color = (substr($GLOBALS['phpgw_info']['theme']['bg07'],0,1)=='#'?'':'#').$GLOBALS['phpgw_info']['theme']['bg07']; $this->cat_id = $this->bo->cat_id; @@ -88,7 +88,7 @@ function mini_calendar($day,$month,$year,$link='',$buttons="none",$outside_month=True) { - global $phpgw, $phpgw_info; + global $GLOBALS; $this->bo->read_holidays(); @@ -114,19 +114,19 @@ if($this->bo->printer_friendly == False) { - $month = '' . lang($phpgw->common->show_date($date['raw'],'F')).' '.$phpgw->common->show_date($date['raw'],'Y').''; + $month = '' . lang($GLOBALS['phpgw']->common->show_date($date['raw'],'F')).' '.$GLOBALS['phpgw']->common->show_date($date['raw'],'Y').''; } else { - $month = lang($phpgw->common->show_date($date['raw'],'F')).' '.$phpgw->common->show_date($date['raw'],'Y'); + $month = lang($GLOBALS['phpgw']->common->show_date($date['raw'],'F')).' '.$GLOBALS['phpgw']->common->show_date($date['raw'],'Y'); } $var = Array( - 'cal_img_root' => $phpgw->common->image('calendar','mini-calendar-bar.gif'), - 'bgcolor' => $phpgw_info['theme']['bg_color'], - 'bgcolor1' => $phpgw_info['theme']['bg_color'], + 'cal_img_root' => $GLOBALS['phpgw']->common->image('calendar','mini-calendar-bar.gif'), + 'bgcolor' => $GLOBALS['phpgw_info']['theme']['bg_color'], + 'bgcolor1' => $GLOBALS['phpgw_info']['theme']['bg_color'], 'month' => $month, - 'bgcolor2' => $phpgw_info['theme']['cal_dayview'], + 'bgcolor2' => $GLOBALS['phpgw_info']['theme']['cal_dayview'], 'holiday_color' => $this->holiday_color ); @@ -136,18 +136,18 @@ { case 'right': $var = Array( - 'nextmonth' => '' + 'nextmonth' => '' ); break; case 'left': $var = Array( - 'prevmonth' => '' + 'prevmonth' => '' ); break; case 'both': $var = Array( - 'prevmonth' => '', - 'nextmonth' => '' + 'prevmonth' => '', + 'nextmonth' => '' ); break; case 'none': @@ -218,14 +218,12 @@ function index($params='') { - global $phpgw, $phpgw_info; - Header('Location: '. $this->page('',$params)); } function month() { - global $phpgw, $phpgw_info; + global $GLOBALS; $this->bo->read_holidays(); @@ -233,11 +231,11 @@ if (!$this->bo->printer_friendly) { - unset($phpgw_info['flags']['noheader']); - unset($phpgw_info['flags']['nonavbar']); - unset($phpgw_info['flags']['noappheader']); - unset($phpgw_info['flags']['noappfooter']); - $phpgw->common->phpgw_header(); + unset($GLOBALS['phpgw_info']['flags']['noheader']); + unset($GLOBALS['phpgw_info']['flags']['nonavbar']); + unset($GLOBALS['phpgw_info']['flags']['noappheader']); + unset($GLOBALS['phpgw_info']['flags']['noappfooter']); + $GLOBALS['phpgw']->common->phpgw_header(); $printer = ''; $param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'; $print = '[".lang('Printer Friendly').']'; @@ -263,10 +261,10 @@ $var = Array( 'printer_friendly' => $printer, - 'bg_text' => $phpgw_info['theme']['bg_text'], + 'bg_text' => $GLOBALS['phpgw_info']['theme']['bg_text'], 'small_calendar_prev' => $minical_prev, 'month_identifier' => lang(strftime("%B",$m)).' '.$this->bo->year, - 'username' => $phpgw->common->grab_owner_name($this->bo->owner), + 'username' => $GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner), 'small_calendar_next' => $minical_next, 'large_month' => $this->display_month($this->bo->month,$this->bo->year,True,$this->bo->owner), 'print' => $print @@ -286,7 +284,7 @@ function week() { - global $phpgw, $phpgw_info; + global $GLOBALS; $this->bo->read_holidays(); @@ -295,9 +293,9 @@ if (!$this->bo->printer_friendly) { - unset($phpgw_info['flags']['noheader']); - unset($phpgw_info['flags']['nonavbar']); - $phpgw->common->phpgw_header(); + unset($GLOBALS['phpgw_info']['flags']['noheader']); + unset($GLOBALS['phpgw_info']['flags']['nonavbar']); + $GLOBALS['phpgw']->common->phpgw_header(); $printer = ''; $prev_week_link = '<<'; $next_week_link = '>>'; @@ -308,7 +306,7 @@ } else { - $printer = ''; + $printer = ''; $prev_week_link = '<<'; $next_week_link = '>>'; $print = ''; @@ -324,20 +322,26 @@ $minical_prev = ''; $minical_next = ''; } - $phpgw_info['flags']['nofooter'] = True; + $GLOBALS['phpgw_info']['flags']['nofooter'] = True; } $var = Array( 'printer_friendly' => $printer, - 'bg_text' => $phpgw_info['themem']['bg_text'], + 'bg_text' => $GLOBALS['phpgw_info']['theme']['bg_text'], 'small_calendar_prev' => $minical_prev, 'prev_week_link' => $prev_week_link, 'small_calendar_this' => $minical_this, 'week_identifier' => $this->bo->get_week_label(), 'next_week_link' => $next_week_link, - 'username' => $phpgw->common->grab_owner_name($this->bo->owner), + 'username' => $GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner), 'small_calendar_next' => $minical_next, - 'week_display' => $this->display_weekly($this->bo->day,$this->bo->month,$this->bo->year,true,$this->bo->owner), + 'week_display' => $this->display_weekly( + Array( + 'date' => sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->day), + 'showyear' => true, + 'owners' => $this->bo->owner + ) + ), 'print' => $print ); @@ -353,13 +357,13 @@ function year() { - global $phpgw, $phpgw_info; + global $GLOBALS; if(!$this->bo->printer_friendly) { - unset($phpgw_info['flags']['noheader']); - unset($phpgw_info['flags']['nonavbar']); - $phpgw->common->phpgw_header(); + unset($GLOBALS['phpgw_info']['flags']['noheader']); + unset($GLOBALS['phpgw_info']['flags']['nonavbar']); + $GLOBALS['phpgw']->common->phpgw_header(); $print = ''; $left_link = '<<'; $right_link = '>>'; @@ -368,18 +372,18 @@ } else { - $print = ''; + $print = ''; $left_link = ''; $right_link = ''; $link = ''; $printer = ''; - $phpgw_info['flags']['nofooter'] = True; + $GLOBALS['phpgw_info']['flags']['nofooter'] = True; } $var = Array( 'print' => $print, 'left_link' => $left_link, - 'font' => $phpgw_info['theme']['font'], + 'font' => $GLOBALS['phpgw_info']['theme']['font'], 'year_text' => $this->bo->year, 'right_link'=> $right_link, 'printer_friendly'=> $printer @@ -411,19 +415,15 @@ function view($vcal_id=0) { - global $phpgw,$phpgw_info,$cal_id,$submit,$referer; - - unset($phpgw_info['flags']['noheader']); - unset($phpgw_info['flags']['nonavbar']); - $phpgw->common->phpgw_header(); + global $GLOBALS, $HTTP_GET_VARS; + + unset($GLOBALS['phpgw_info']['flags']['noheader']); + unset($GLOBALS['phpgw_info']['flags']['nonavbar']); + $GLOBALS['phpgw']->common->phpgw_header(); echo '
'; - if(!isset($cal_id) && $vcal_id) - { - $cal_id = $vcal_id; - } - + $cal_id = $vcal_id?$vcal_id:$HTTP_GET_VARS['cal_id']; // First, make sure they have permission to this entry if ($cal_id < 1) @@ -484,37 +484,49 @@ echo '
'; } - function edit($cd=0,$readsess=0) + function edit($params='') { - global $phpgw, $phpgw_info, $cal_id, $hour, $minute; + global $HTTP_GET_VARS; if(!$this->bo->check_perms(PHPGW_ACL_EDIT)) { $this->no_edit(); } - - if(@$readsess) + + if($params != '' && @isset($params['readsess'])) { $event = $this->bo->restore_from_appsession; $can_edit = True; + $this->edit_form( + Array( + 'event' => $event, + 'cd' => $params['cd'] + ) + ); } - elseif($cal_id) + elseif(isset($HTTP_GET_VARS['cal_id'])) { - $event = $this->bo->read_entry(intval($cal_id)); + $cal_id = $HTTP_GET_VARS['cal_id']; + $event = $this->bo->read_entry(intval($HTTP_GET_VARS['cal_id'])); $can_edit = $this->bo->can_user_edit($event); if(!$can_edit) { - $this->view($cal_id); + $this->view(intval($HTTP_GET_VAR['cal_id'])); } + $this->edit_form( + Array( + 'event' => $event, + 'cd' => $cd + ) + ); } - $this->edit_form($event,$cd); - } + } function add($cd=0,$readsess=0) { - global $phpgw, $phpgw_info, $cal_id, $hour, $minute; + global $HTTP_GET_VARS; if(!$this->bo->check_perms(PHPGW_ACL_ADD)) { @@ -537,8 +549,8 @@ $can_edit = True; - $thishour = (isset($hour)?(int)$hour:0); - $thisminute = (isset($minute)?(int)$minute:0); + $thishour = (isset($HTTP_GET_VARS['hour'])?intval($HTTP_GET_VARS['hour']):0); + $thisminute = (isset($HTTP_GET_VARS['minute'])?intval($HTTP_GET_VARS['minute']):0); $this->bo->set_start($this->bo->year,$this->bo->month,$this->bo->day,$thishour,$thisminute,0); $this->bo->set_end($this->bo->year,$this->bo->month,$this->bo->day,$thishour,$thisminute,0); $this->bo->set_title(''); @@ -556,13 +568,24 @@ $this->bo->set_recur_none(); $event = $this->bo->get_cached_event(); } - $this->edit_form($event,$cd); + $this->edit_form( + Array( + 'event' => $event, + 'cd' => $cd + ) + ); } function delete() { - global $cal_id; - + global $HTTP_GET_VARS; + + if(!isset($HTTP_GET_VARS['cal_id'])) + { + Header('Location: '.$this->page('','&date'.sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->day))); + } + + $cal_id = $HTTP_GET_VARS['cal_id']; $event = $this->bo->read_entry(intval($cal_id)); if(($cal_id > 0) && ($event['owner'] == $this->bo->owner) && $this->bo->check_perms(PHPGW_ACL_DELETE)) { @@ -581,13 +604,13 @@ function preferences() { - global $phpgw, $phpgw_info; + global $GLOBALS; - unset($phpgw_info['flags']['noheader']); - unset($phpgw_info['flags']['nonavbar']); - $phpgw_info['flags']['noappheader'] = True; - $phpgw_info['flags']['noappfooter'] = True; - $phpgw->common->phpgw_header(); + unset($GLOBALS['phpgw_info']['flags']['noheader']); + unset($GLOBALS['phpgw_info']['flags']['nonavbar']); + $GLOBALS['phpgw_info']['flags']['noappheader'] = True; + $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; + $GLOBALS['phpgw']->common->phpgw_header(); $p = CreateObject('phpgwapi.Template',$this->template_dir); $p->set_file( @@ -600,8 +623,8 @@ $var = Array( 'title' => lang('Calendar preferences'), - 'action_url' => $phpgw->link('/index.php','menuaction=calendar.bocalendar.preferences'), - 'bg_color ' => $phpgw_info['theme']['th_bg'], + 'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.bocalendar.preferences'), + 'bg_color ' => $GLOBALS['phpgw_info']['theme']['th_bg'], 'submit_lang' => lang('submit'), 'text' => ' ' ); @@ -708,24 +731,24 @@ function day() { - global $phpgw, $phpgw_info; + global $GLOBALS; $this->bo->read_holidays(); if (!$this->bo->printer_friendly) { - unset($phpgw_info['flags']['noheader']); - unset($phpgw_info['flags']['nonavbar']); - $phpgw->common->phpgw_header(); + unset($GLOBALS['phpgw_info']['flags']['noheader']); + unset($GLOBALS['phpgw_info']['flags']['nonavbar']); + $GLOBALS['phpgw']->common->phpgw_header(); $printer = ''; - $param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&day='.$this->bo->day.'&friendly=1'; + $param = '&date='.sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->day).'&friendly=1'; $print = '[".lang('Printer Friendly').']'; $minical = $this->mini_calendar($this->bo->day,$this->bo->month,$this->bo->year,'day'); } else { - $phpgw_info['flags']['nofooter'] = True; - $printer = ''; + $GLOBALS['phpgw_info']['flags']['nofooter'] = True; + $printer = ''; $print = ''; if($this->bo->prefs['calendar']['display_minicals'] == 'Y' || $this->bo->prefs['calendar']['display_minicals']) { @@ -750,11 +773,17 @@ $var = Array( 'printer_friendly' => $printer, - 'bg_text' => $phpgw_info['themem']['bg_text'], - 'daily_events' => $this->print_day($this->bo->year,$this->bo->month,$this->bo->day), + 'bg_text' => $GLOBALS['phpgw_info']['themem']['bg_text'], + 'daily_events' => $this->print_day( + Array( + 'year' => $this->bo->year, + 'month' => $this->bo->month, + 'day' => $this->bo->day + ) + ), 'small_calendar' => $minical, 'date' => lang(date('F',$m)).' '.sprintf("%02d",$this->bo->day).', '.$this->bo->year, - 'username' => $phpgw->common->grab_owner_name($owner), + 'username' => $GLOBALS['phpgw']->common->grab_owner_name($owner), 'print' => $print ); @@ -764,21 +793,21 @@ function edit_status() { - global $phpgw, $phpgw_info, $cal_id; + global $GLOBALS, $HTTP_GET_VARS; - unset($phpgw_info['flags']['noheader']); - unset($phpgw_info['flags']['nonavbar']); - $phpgw_info['flags']['noappheader'] = True; - $phpgw_info['flags']['noappfooter'] = True; - $phpgw->common->phpgw_header(); + unset($GLOBALS['phpgw_info']['flags']['noheader']); + unset($GLOBALS['phpgw_info']['flags']['nonavbar']); + $GLOBALS['phpgw_info']['flags']['noappheader'] = True; + $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; + $GLOBALS['phpgw']->common->phpgw_header(); - $event = $this->bo->read_entry($cal_id); + $event = $this->bo->read_entry($HTTP_GET_VARS['cal_id']); reset($event['participants']); if(!$event->participants[$this->bo->owner]) { - echo '
The user '.$phpgw->common->grab_owner_name($this->bo->owner).' is not participating in this event!
'; + echo '
The user '.$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner).' is not participating in this event!
'; return; } @@ -789,7 +818,14 @@ } $freetime = $this->bo->datetime->localdates(mktime(0,0,0,$event['start']['month'],$event['start']['mday'],$event['start']['year']) - $this->bo->datetime->tz_offset); - echo $this->timematrix($freetime,$this->bo->splittime('000000',False),0,$event['participants']); + echo $this->timematrix( + Array( + 'date' => $freetime, + 'starttime' => $this->bo->splittime('000000',False), + 'endtime' => 0, + 'participants' => $event['participants'] + ) + ); echo $this->view_event($event); @@ -798,7 +834,7 @@ function set_action() { - global $phpgw, $cal_id, $action; + global $HTTP_GET_VARS; if(!$this->bo->check_perms(PHPGW_ACL_EDIT)) { @@ -806,18 +842,18 @@ return; } - $this->bo->set_status(intval($cal_id),intval($action)); + $this->bo->set_status(intval($HTTP_GET_VARS['cal_id']),intval($HTTP_GET_VARS['action'])); Header('Location: '.$this->page('','')); } function planner() { - global $phpgw, $phpgw_info; + global $GLOBALS; - unset($phpgw_info['flags']['noheader']); - unset($phpgw_info['flags']['nonavbar']); - $phpgw->common->phpgw_header(); + unset($GLOBALS['phpgw_info']['flags']['noheader']); + unset($GLOBALS['phpgw_info']['flags']['nonavbar']); + $GLOBALS['phpgw']->common->phpgw_header(); $html = CreateObject('infolog.html'); $sbox = CreateObject('phpgwapi.sbox'); @@ -963,7 +999,7 @@ { if (is_array($r)) { - $rows['.'.$k] = 'bgcolor="'.$phpgw->nextmatchs->alternate_row_color().'"'; + $rows['.'.$k] = 'bgcolor="'.$GLOBALS['phpgw']->nextmatchs->alternate_row_color().'"'; $row = &$rows[$k]; $akt_cell = &$rows['.nr_'.$k]; if ($akt_cell <= $last_cell) @@ -974,7 +1010,7 @@ } } } - $bgcolor = 'bgcolor="'.$phpgw_info['theme']['th_bg'].'"'; + $bgcolor = 'bgcolor="'.$GLOBALS['phpgw_info']['theme']['th_bg'].'"'; echo $html->table( array( '_h' => $header, @@ -986,15 +1022,15 @@ function matrixselect() { - global $phpgw, $phpgw_info; + global $GLOBALS; $datetime = mktime(0,0,0,$this->bo->month,$this->bo->day,$this->bo->year) - $this->bo->datetime->tz_offset; $sb = CreateObject('phpgwapi.sbox'); - unset($phpgw_info['flags']['noheader']); - unset($phpgw_info['flags']['nonavbar']); - $phpgw->common->phpgw_header(); + unset($GLOBALS['phpgw_info']['flags']['noheader']); + unset($GLOBALS['phpgw_info']['flags']['nonavbar']); + $GLOBALS['phpgw']->common->phpgw_header(); $p = CreateObject('phpgwapi.Template',$this->template_dir); $p->set_file( @@ -1016,10 +1052,10 @@ // Date $var[] = Array( 'field' => lang('Date'), - 'data' => $phpgw->common->dateformatorder( - $sb->getYears('year',intval($phpgw->common->show_date($datetime,'Y')),intval($phpgw->common->show_date($datetime,'Y'))), - $sb->getMonthText('month',intval($phpgw->common->show_date($datetime,'n'))), - $sb->getDays('day',intval($phpgw->common->show_date($datetime,'d'))) + 'data' => $GLOBALS['phpgw']->common->dateformatorder( + $sb->getYears('year',intval($GLOBALS['phpgw']->common->show_date($datetime,'Y')),intval($GLOBALS['phpgw']->common->show_date($datetime,'Y'))), + $sb->getMonthText('month',intval($GLOBALS['phpgw']->common->show_date($datetime,'n'))), + $sb->getDays('day',intval($GLOBALS['phpgw']->common->show_date($datetime,'d'))) ) ); @@ -1033,24 +1069,24 @@ ); // Participants - $accounts = $phpgw->acl->get_ids_for_location('run',1,'calendar'); + $accounts = $GLOBALS['phpgw']->acl->get_ids_for_location('run',1,'calendar'); $users = Array(); for($i=0;$icommon->grab_owner_name($user); - if($phpgw->accounts->get_type($user) == 'g') + $users[$user] = $GLOBALS['phpgw']->common->grab_owner_name($user); + if($GLOBALS['phpgw']->accounts->get_type($user) == 'g') { - $group_members = $phpgw->acl->get_ids_for_location($user,1,'phpgw_group'); + $group_members = $GLOBALS['phpgw']->acl->get_ids_for_location($user,1,'phpgw_group'); if($group_members != False) { for($j=0;$jcommon->grab_owner_name($group_members[$j]); + $users[$group_members[$j]] = $GLOBALS['phpgw']->common->grab_owner_name($group_members[$j]); } } } @@ -1075,9 +1111,9 @@ @reset($users); while ($user = each($users)) { - if(($phpgw->accounts->exists($user[0]) && $this->bo->check_perms(PHPGW_ACL_READ,$user[0])) || $phpgw->accounts->get_type($user[0]) == 'g') + if(($GLOBALS['phpgw']->accounts->exists($user[0]) && $this->bo->check_perms(PHPGW_ACL_READ,$user[0])) || $GLOBALS['phpgw']->accounts->get_type($user[0]) == 'g') { - $str .= ' '."\n"; + $str .= ' '."\n"; } } $var[] = Array( @@ -1105,13 +1141,15 @@ function viewmatrix() { - global $phpgw, $phpgw_info, $participants, $matrixtype; - + global $GLOBALS, $HTTP_POST_VARS; + + $participants = $HTTP_POST_VARS['participants']; $parts = Array(); $acct = CreateObject('phpgwapi.accounts',$this->bo->owner); - for($i=0;$iaccounts->get_type($participants[$i])) + switch ($GLOBALS['phpgw']->accounts->get_type($participants[$i])) { case 'g': $members = $acct->members(intval($participants[$i])); @@ -1142,18 +1180,31 @@ reset($participants); - unset($phpgw_info['flags']['noheader']); - unset($phpgw_info['flags']['nonavbar']); - $phpgw->common->phpgw_header(); + unset($GLOBALS['phpgw_info']['flags']['noheader']); + unset($GLOBALS['phpgw_info']['flags']['nonavbar']); + $GLOBALS['phpgw']->common->phpgw_header(); - switch($matrixtype) + switch($HTTP_POST_VARS['matrixtype']) { case 'free/busy': $freetime = $this->bo->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day,$this->bo->year); - echo $this->timematrix($freetime,$this->bo->splittime('000000',False),0,$parts); + echo $this->timematrix( + Array( + 'date' => $freetime, + 'starttime' => $this->bo->splittime('000000',False), + 'endtime' => 0, + 'participants' => $parts + ) + ); break; case 'weekly': - echo $this->display_weekly($this->bo->day,$this->bo->month,$this->bo->year,true,$participants); + echo $this->display_weekly( + Array( + 'date' => sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->day), + 'showyear' => true, + 'owners' => $participants + ) + ); break; } echo "\n".'
'."\n"; @@ -1161,10 +1212,11 @@ echo ' '."\n"; echo ' '."\n"; echo ' '."\n"; - echo ' '."\n"; - for ($i=0;$i'."\n"; + reset($parts); + while(list($key,$value) = each($parts)) { - echo ' '."\n"; + echo ' '."\n"; } echo ' '."\n"; echo ' '."\n"; @@ -1173,24 +1225,22 @@ function search() { - global $phpgw, $phpgw_info, $keywords, $from; - - if (! $keywords) + global $GLOBALS, $HTTP_POST_VARS; + + if (!$HTTP_POST_VARS['keywords']) { // If we reach this, it is because they didn't search for anything, // attempt to send them back to where they where. - Header('Location: ' . $phpgw->link($from,'owner='.$owner.'&month='.$month.'&day='.$day.'&year='.$year)); + Header('Location: ' . $phpgw->link($from)); } - else - { - unset($phpgw_info['flags']['noheader']); - unset($phpgw_info['flags']['nonavbar']); - $phpgw->common->phpgw_header(); - } - + + unset($GLOBALS['phpgw_info']['flags']['noheader']); + unset($GLOBALS['phpgw_info']['flags']['nonavbar']); + $GLOBALS['phpgw']->common->phpgw_header(); + $error = ''; - if (strlen($keywords) == 0) + if (strlen($HTTP_POST_VARS['keywords']) == 0) { echo ''.lang('Error').':'; echo lang('You must enter one or more search keywords.'); @@ -1205,16 +1255,16 @@ // This has been solved by the little icon indicator for recurring events. - $event_ids = $this->bo->search_keywords($keywords); + $event_ids = $this->bo->search_keywords($HTTP_POST_VARS['keywords']); $ids = Array(); while(list($key,$id) = each($event_ids)) { $event = $this->bo->read_entry($id); - $datetime = $this->bo->maketime($event['start']) - $phpgw->calendar->datetime->tz_offset; + $datetime = $this->bo->maketime($event['start']) - $this->bo->datetime->tz_offset; $ids[strval($event['id'])]++; - $info[strval($event['id'])] = $phpgw->common->show_date($datetime).$this->link_to_entry($event,$event['start']['month'],$event['start']['mday'],$event['start']['year']); + $info[strval($event['id'])] = $GLOBALS['phpgw']->common->show_date($datetime).$this->link_to_entry($event,$event['start']['month'],$event['start']['mday'],$event['start']['year']); } $matches = count($event_ids); @@ -1251,7 +1301,7 @@ $p->set_block('search_form','search_list_footer','search_list_footer'); $var = Array( - 'color' => $phpgw_info['theme']['bg_text'], + 'color' => $GLOBALS['phpgw_info']['theme']['bg_text'], 'search_text' => lang('Search Results'), 'quantity' => $quantity ); @@ -1314,9 +1364,9 @@ function display_item(&$p,$field,$data) { - global $phpgw; + global $GLOBALS; static $tr_color; - $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); + $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color); $var = Array( 'bg_color' => $tr_color, 'field' => $field, @@ -1327,7 +1377,7 @@ function page($page='',$params='') { - global $phpgw, $phpgw_info; + global $GLOBALS; if($page == '') { @@ -1336,16 +1386,16 @@ if ($page=='index' || ($page != 'day' && $page != 'week' && $page != 'month' && $page != 'year')) { $page = 'month'; - $phpgw->preferences->add('calendar','defaultcalendar','month'); - $phpgw->preferences->save_repository(); + $GLOBALS['phpgw']->preferences->add('calendar','defaultcalendar','month'); + $GLOBALS['phpgw']->preferences->save_repository(); } } - return $phpgw->link('/index.php','menuaction='.$phpgw_info['flags']['currentapp'].'.ui'.$phpgw_info['flags']['currentapp'].'.'.$page.$params); + return $GLOBALS['phpgw']->link('/index.php','menuaction='.$GLOBALS['phpgw_info']['flags']['currentapp'].'.ui'.$GLOBALS['phpgw_info']['flags']['currentapp'].'.'.$page.$params); } function header() { - global $phpgw, $cal_id, $date, $keywords, $matrixtype, $participants, $tpl, $menuaction; + global $GLOBALS, $HTTP_POST_VARS, $HTTP_GET_VARS; $cols = 8; if($this->bo->check_perms(PHPGW_ACL_PRIVATE) == True) @@ -1364,9 +1414,9 @@ function footer() { - global $phpgw, $menuaction; - - list(,,$method) = explode('.',$menuaction); + global $GLOBALS; + + list(,,$method) = explode('.',$GLOBALS['menuaction']); if (@$this->bo->printer_friendly) { @@ -1426,9 +1476,9 @@ { $begin = $sun + (3600 * 24 * 7 * $i); $end = $begin + (3600 * 24 * 6); - $str .= ''."\n"; + $str .= ''."\n"; } $var = Array( @@ -1466,15 +1516,15 @@ function no_edit() { - global $phpgw, $phpgw_info; + global $GLOBALS; - if(!$isset($phpgw_info['flags']['noheader'])) + if(!$isset($GLOBALS['phpgw_info']['flags']['noheader'])) { - unset($phpgw_info['flags']['noheader']); - unset($phpgw_info['flags']['nonavbar']); - $phpgw_info['flags']['noappheader'] = True; - $phpgw_info['flags']['noappfooter'] = True; - $phpgw->common->phpgw_header(); + unset($GLOBALS['phpgw_info']['flags']['noheader']); + unset($GLOBALS['phpgw_info']['flags']['nonavbar']); + $GLOBALS['phpgw_info']['flags']['noappheader'] = True; + $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; + $GLOBALS['phpgw']->common->phpgw_header(); } echo '
You do not have permission to edit this appointment!
'; return; @@ -1482,7 +1532,7 @@ function link_to_entry($event,$month,$day,$year) { - global $phpgw, $phpgw_info, $grants; + global $GLOBALS; $str = ''; $is_private = $this->bo->is_private($event,$this->bo->owner); @@ -1505,32 +1555,32 @@ $rawdate = mktime(0,0,0,$month,$day,$year); $rawdate_offset = $rawdate - $this->bo->datetime->tz_offset; $nextday = mktime(0,0,0,$month,$day + 1,$year) - $this->bo->datetime->tz_offset; - if (intval($phpgw->common->show_date($starttime,'Hi')) && $starttime == $endtime) + if (intval($GLOBALS['phpgw']->common->show_date($starttime,'Hi')) && $starttime == $endtime) { - $time = $phpgw->common->show_date($starttime,$this->bo->users_timeformat); + $time = $GLOBALS['phpgw']->common->show_date($starttime,$this->bo->users_timeformat); } elseif ($starttime <= $rawdate_offset && $endtime >= $nextday - 60) { $time = '[ '.lang('All Day').' ]'; } - elseif (intval($phpgw->common->show_date($starttime,'Hi')) || $starttime != $endtime) + elseif (intval($GLOBALS['phpgw']->common->show_date($starttime,'Hi')) || $starttime != $endtime) { if($starttime < $rawdate_offset && $event['recur_type']==MCAL_RECUR_NONE) { - $start_time = $phpgw->common->show_date($rawdate_offset,$this->bo->users_timeformat); + $start_time = $GLOBALS['phpgw']->common->show_date($rawdate_offset,$this->bo->users_timeformat); } else { - $start_time = $phpgw->common->show_date($starttime,$this->bo->users_timeformat); + $start_time = $GLOBALS['phpgw']->common->show_date($starttime,$this->bo->users_timeformat); } if($endtime >= ($rawdate_offset + 86400)) { - $end_time = $phpgw->common->show_date(mktime(23,59,59,$month,$day,$year) - $this->bo->datetime->tz_offset,$this->bo->users_timeformat); + $end_time = $GLOBALS['phpgw']->common->show_date(mktime(23,59,59,$month,$day,$year) - $this->bo->datetime->tz_offset,$this->bo->users_timeformat); } else { - $end_time = $phpgw->common->show_date($endtime,$this->bo->users_timeformat); + $end_time = $GLOBALS['phpgw']->common->show_date($endtime,$this->bo->users_timeformat); } $time = $start_time.'-'.$end_time; } @@ -1543,7 +1593,7 @@ { $text .= $this->bo->display_status($event['users_status']); } - $text = ''.$time.' '.$this->bo->get_short_field($event,$is_private,'title').$text.''.$phpgw->browser->br; + $text = ''.$time.' '.$this->bo->get_short_field($event,$is_private,'title').$text.''.$GLOBALS['phpgw']->browser->br; if ($editable) { @@ -1554,7 +1604,7 @@ if($event['priority'] == 3) { $picture[] = Array( - 'pict' => $phpgw->common->image('calendar','high.gif'), + 'pict' => $GLOBALS['phpgw']->common->image('calendar','high.gif'), 'width' => 8, 'height' => 17 ); @@ -1562,7 +1612,7 @@ if($event['recur_type'] == MCAL_RECUR_NONE) { $picture[] = Array( - 'pict' => $phpgw->common->image('calendar','circle.gif'), + 'pict' => $GLOBALS['phpgw']->common->image('calendar','circle.gif'), 'width' => 5, 'height' => 7 ); @@ -1570,7 +1620,7 @@ else { $picture[] = Array( - 'pict' => $phpgw->common->image('calendar','recur.gif'), + 'pict' => $GLOBALS['phpgw']->common->image('calendar','recur.gif'), 'width' => 12, 'height' => 12 ); @@ -1578,7 +1628,7 @@ if(count($event['participants']) > 1) { $picture[] = Array( - 'pict' => $phpgw->common->image('calendar','multi_3.gif'), + 'pict' => $GLOBALS['phpgw']->common->image('calendar','multi_3.gif'), 'width' => 14, 'height' => 14 ); @@ -1586,7 +1636,7 @@ if($event['public'] == 0) { $picture[] = Array( - 'pict' => $phpgw->common->image('calendar','private.gif'), + 'pict' => $GLOBALS['phpgw']->common->image('calendar','private.gif'), 'width' => 13, 'height' => 13 ); @@ -1623,7 +1673,7 @@ function overlap($overlapping_events,$event) { - global $phpgw, $phpgw_info; + global $GLOBALS; $month = $event['start']['month']; $mday = $event['start']['mday']; @@ -1638,10 +1688,10 @@ $overlap .= '
  • '.$this->link_to_entry($this->bo->read_entry($overlapping_events[$i]),$month,$mday,$year); } - unset($phpgw_info['flags']['noheader']); - unset($phpgw_info['flags']['nonavbar']); - $phpgw_info['flags']['nofooter'] = True; - $phpgw->common->phpgw_header(); + unset($GLOBALS['phpgw_info']['flags']['noheader']); + unset($GLOBALS['phpgw_info']['flags']['nonavbar']); + $GLOBALS['phpgw_info']['flags']['nofooter'] = True; + $GLOBALS['phpgw']->common->phpgw_header(); $p = CreateObject('phpgwapi.Template',$this->template_dir); $p->set_file( @@ -1652,16 +1702,16 @@ ); $var = Array( - 'color' => $phpgw_info['theme']['bg_text'], + 'color' => $GLOBALS['phpgw_info']['theme']['bg_text'], 'overlap_title' => lang('Scheduling Conflict'), - 'overlap_text' => lang('Your suggested time of x - x conflicts with the following existing calendar entries:',$phpgw->common->show_date($start),$phpgw->common->show_date($end)), + 'overlap_text' => lang('Your suggested time of x - x conflicts with the following existing calendar entries:',$GLOBALS['phpgw']->common->show_date($start),$GLOBALS['phpgw']->common->show_date($end)), 'overlap_list' => $overlap ); $p->set_var($var); $date = sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->mday); $var = Array( - 'action_url_button' => $phpgw->link('/index.php',Array('menuaction'=>'calendar.bocalendar.update','readsess'=>1,'date'=>$date)), + 'action_url_button' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.bocalendar.update','readsess'=>1)), 'action_text_button' => lang('Ignore Conflict'), 'action_confirm_button' => '', 'action_extra_field' => '' @@ -1669,7 +1719,7 @@ $this->output_template_array($p,'resubmit_button','form_button',$var); $var = Array( - 'action_url_button' => $phpgw->link('/index.php',Array('menuaction'=>'calendar.uicalendar.edit','readsess'=>1,'date'=>$date)), + 'action_url_button' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.edit','readsess'=>1,'date'=>$date)), 'action_text_button' => lang('Re-Edit Event'), 'action_confirm_button' => '', 'action_extra_field' => '' @@ -1680,7 +1730,7 @@ function planner_participants($parts) { - global $phpgw; + global $GLOBALS; static $id2lid = array(); $names = ''; @@ -1688,7 +1738,7 @@ { if (!isset($id2lid[$id])) { - $id2lid[$id] = $phpgw->common->grab_owner_name($id); + $id2lid[$id] = $GLOBALS['phpgw']->common->grab_owner_name($id); } if (strlen($names)) { @@ -1705,7 +1755,6 @@ function planner_category($id) { - global $phpgw; static $cats = array(); if (!isset($cats[$id])) @@ -1719,7 +1768,7 @@ function week_header($month,$year,$display_name = False) { - global $phpgw_info; + global $GLOBALS; $this->weekstarttime = $this->bo->datetime->get_weekday_start($year,$month,1); @@ -1734,8 +1783,8 @@ $p->set_block('month_header','column_title','column_title'); $var = Array( - 'bgcolor' => $phpgw_info['theme']['th_bg'], - 'font_color' => $phpgw_info['theme']['th_text'] + 'bgcolor' => $GLOBALS['phpgw_info']['theme']['th_bg'], + 'font_color' => $GLOBALS['phpgw_info']['theme']['th_text'] ); if($this->bo->printer_friendly && @$this->bo->prefs['calendar']['print_black_white']) { @@ -1764,9 +1813,9 @@ function display_week($startdate,$weekly,$cellcolor,$display_name = False,$owner=0,$monthstart=0,$monthend=0) { - global $phpgw, $phpgw_info, $grants; + global $GLOBALS; - if($owner == 0) { $owner= $phpgw_info['user']['account_id']; } + if($owner == 0) { $owner = $GLOBALS['phpgw_info']['user']['account_id']; } $temp_owner = $this->bo->owner; $this->bo->owner = $owner; @@ -1791,7 +1840,7 @@ $p->set_var('col_width','14'); if($display_name) { - $p->set_var('column_data',$phpgw->common->grab_owner_name($owner)); + $p->set_var('column_data',$GLOBALS['phpgw']->common->grab_owner_name($owner)); $p->parse('column_header','month_column',True); $p->set_var('col_width','12'); } @@ -1813,9 +1862,9 @@ if ($day_params['new_event']) { $new_event_link = '' - . ''.lang('New Entry').'' + . ''.lang('New Entry').'' . ''; - $day_number = ''.$day.''; + $day_number = ''.$day.''; } else { @@ -1837,7 +1886,7 @@ while(list($key,$value) = each($day_params['holidays'])) { $var = Array( - 'day_events' => ''.$value.''.$phpgw->browser->br + 'day_events' => ''.$value.''.$GLOBALS['phpgw']->browser->br ); $this->output_template_array($p,'daily_events','event',$var); } @@ -1883,7 +1932,7 @@ function display_month($month,$year,$showyear,$owner=0) { - global $phpgw, $phpgw_info; + global $GLOBALS; $this->bo->store_to_cache($year,$month,1); @@ -1910,11 +1959,11 @@ ); $this->output_template_array($p,'row','event',$var); - $cellcolor = $phpgw_info['theme']['row_on']; + $cellcolor = $GLOBALS['phpgw_info']['theme']['row_on']; for ($i=intval($start);intval(date('Ymd',$i)) <= $monthend;$i += 604800) { - $cellcolor = $phpgw->nextmatchs->alternate_row_color($cellcolor); + $cellcolor = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($cellcolor); $var = Array( 'day_events' => $this->display_week($i,False,$cellcolor,False,$owner,$monthstart,$monthend) ); @@ -1923,10 +1972,21 @@ return $p->fp('out','m_w_table'); } - function display_weekly($day,$month,$year,$showyear,$owners=0) + function display_weekly($params) { - global $phpgw, $phpgw_info; + global $GLOBALS; + if(!is_array($params)) + { + $this->index(); + } + + $year = substr($params['date'],0,4); + $month = substr($params['date'],4,2); + $year = substr($params['date'],6,2); + $showyear = $params['showyear']; + $owners = $params['owners']; + $p = CreateObject('phpgwapi.Template',$this->template_dir); $p->set_unknowns('keep'); @@ -1940,7 +2000,7 @@ $start = $this->bo->datetime->get_weekday_start($year, $month, $day); - $cellcolor = $phpgw_info['theme']['row_off']; + $cellcolor = $GLOBALS['phpgw_info']['theme']['row_off']; $true_printer_friendly = $this->bo->printer_friendly; @@ -1988,7 +2048,7 @@ function view_event($event) { - global $phpgw, $phpgw_info; + global $GLOBALS; if(!$event['participants'][$this->bo->owner]) { @@ -2013,7 +2073,7 @@ $p->set_block('view','list','list'); $var = Array( - 'bg_text'=> $phpgw_info['theme']['bg_text'], + 'bg_text'=> $GLOBALS['phpgw_info']['theme']['bg_text'], 'name' => $event->title ); $p->set_var($var); @@ -2041,12 +2101,12 @@ $var[] = Array( 'field' => lang('Start Date/Time'), - 'data' => $phpgw->common->show_date($this->bo->maketime($event['start']) - $this->bo->datetime->tz_offset) + 'data' => $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['start']) - $this->bo->datetime->tz_offset) ); $var[] = Array( 'field' => lang('End Date/Time'), - 'data' => $phpgw->common->show_date($this->bo->maketime($event['end']) - $this->bo->datetime->tz_offset) + 'data' => $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['end']) - $this->bo->datetime->tz_offset) ); $var[] = Array( @@ -2056,12 +2116,12 @@ $var[] = Array( 'field' => lang('Created By'), - 'data' => $phpgw->common->grab_owner_name($event['owner']) + 'data' => $GLOBALS['phpgw']->common->grab_owner_name($event['owner']) ); $var[] = Array( 'field' => lang('Updated'), - 'data' => $phpgw->common->show_date($this->bo->maketime($event['modtime']) - $this->bo->datetime->tz_offset) + 'data' => $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['modtime']) - $this->bo->datetime->tz_offset) ); $var[] = Array( @@ -2074,9 +2134,9 @@ $cal_grps = ''; for($i=0;$iaccounts->exists($event['groups'][$i])) + if($GLOBALS['phpgw']->accounts->exists($event['groups'][$i])) { - $cal_grps .= ($i>0?'
    ':'').$phpgw->accounts->id2name($event['groups'][$i]); + $cal_grps .= ($i>0?'
    ':'').$GLOBALS['phpgw']->accounts->id2name($event['groups'][$i]); } } @@ -2090,9 +2150,9 @@ reset($event['participants']); while (list($user,$short_status) = each($event['participants'])) { - if($phpgw->accounts->exists($user)) + if($GLOBALS['phpgw']->accounts->exists($user)) { - $str .= ($str?'
    ':'').$phpgw->common->grab_owner_name($user).' ('.($this->bo->check_perms(PHPGW_ACL_EDIT,$user)?''.$this->bo->get_long_status($short_status).'':$this->bo->get_long_status($short_status)).')'."\n"; + $str .= ($str?'
    ':'').$GLOBALS['phpgw']->common->grab_owner_name($user).' ('.($this->bo->check_perms(PHPGW_ACL_EDIT,$user)?''.$this->bo->get_long_status($short_status).'':$this->bo->get_long_status($short_status)).')'."\n"; } } $var[] = Array( @@ -2119,7 +2179,7 @@ if($recur_end != 0) { $recur_end -= $this->bo->datetime->tz_offset; - $str_extra .= lang('ends').': '.lang($phpgw->common->show_date($recur_end,'l')).', '.lang($phpgw->common->show_date($recur_end,'F')).' '.$phpgw->common->show_date($recur_end,'d, Y').' '; + $str_extra .= lang('ends').': '.lang($GLOBALS['phpgw']->common->show_date($recur_end,'l')).', '.lang($GLOBALS['phpgw']->common->show_date($recur_end,'F')).' '.$GLOBALS['phpgw']->common->show_date($recur_end,'d, Y').' '; } } if($event['recur_type'] == MCAL_RECUR_WEEKLY || $event['recur_type'] == MCAL_RECUR_DAILY) @@ -2192,11 +2252,20 @@ return $p->fp('out','view_event'); } - function print_day($year,$month,$day) + function print_day($param) { - global $phpgw, $phpgw_info; + global $GLOBALS; - $this->bo->store_to_cache($year,$month,$day,$year,$month,$day + 1); + if(!is_array($param)) + { + $this->index(); + } + + $year = $param['year']; + $month = $param['month']; + $day = $param['day']; + + $this->bo->store_to_cache($year,$month,$day,$year,$month,$day + 7); $p = CreateObject('phpgwapi.Template',$this->template_dir); $p->set_unknowns('keep'); @@ -2214,16 +2283,15 @@ ! $this->bo->prefs['calendar']['workdayends']) { - $phpgw->preferences->add('calendar','workdaystarts',8); - $phpgw->preferences->add('calendar','workdayends',16); - $phpgw->preferences->save_repository(); + $GLOBALS['phpgw']->preferences->add('calendar','workdaystarts',8); + $GLOBALS['phpgw']->preferences->add('calendar','workdayends',16); + $GLOBALS['phpgw']->preferences->save_repository(); $this->bo->prefs['calendar']['workdaystarts'] = 8; $this->bo->prefs['calendar']['workdayends'] = 16; } - $phpgw->browser->browser(); - $browser_agent = $phpgw->browser->get_agent(); - if($browser_agent == 'MOZILLA') + $GLOBALS['phpgw']->browser->browser(); + if($GLOBALS['phpgw']->browser->get_agent() == 'MOZILLA') { $time_width = ($this->bo->prefs['common']['time_format'] == '12'?12:8); } @@ -2233,10 +2301,10 @@ } $var = Array( 'time_width' => $time_width, - 'time_bgcolor' => $phpgw_info['theme']['navbar_bg'], - 'font_color' => $phpgw_info['theme']['bg_text'], - 'time_border_color' => $phpgw_info['theme']['navbar_text'], - 'font' => $phpgw_info['theme']['font'] + 'time_bgcolor' => $GLOBALS['phpgw_info']['theme']['navbar_bg'], + 'font_color' => $GLOBALS['phpgw_info']['theme']['bg_text'], + 'time_border_color' => $GLOBALS['phpgw_info']['theme']['navbar_text'], + 'font' => $GLOBALS['phpgw_info']['theme']['font'] ); $p->set_var($var); @@ -2250,16 +2318,38 @@ $time = Array(); - $daily = $this->bo->set_week_array($this->bo->datetime->get_weekday_start($year, $month, $day),$phpgw_info['theme']['row_on'],True); - + $daily = $this->bo->set_week_array($this->bo->datetime->get_weekday_start($year, $month, $day),$GLOBALS['phpgw_info']['theme']['row_on'],True); +//echo "Date to Eval : ".$date_to_eval."
    \n"; if($daily[$date_to_eval]['appts']) { $events = $this->bo->cached_events[$date_to_eval]; $c_events = count($events); +//echo "Date : ".$date_to_eval." Count : ".$c_events."
    \n"; for($i=0;$i<$c_events;$i++) { - $event = $events[$i]; - $ind = intval($event['start']['hour']); +// $event = $events[$i]; + if($events[$i]['recur_type'] == MCAL_RECUR_NONE) + { + if($events[$i]['start']['mday'] < $day) + { + if($events[$i]['end']['mday'] > $day) + { + $ind = 99; + } + elseif($events[$i]['end']['mday'] == $day) + { + $ind = 0; + } + } + elseif($events[$i]['start']['mday'] == $day) + { + $ind = intval($events[$i]['start']['hour']); + } + } + else + { + $ind = intval($events[$i]['start']['hour']); + } if($ind < (int)$this->bo->prefs['calendar']['workdaystarts'] || $ind > (int)$this->bo->prefs['calendar']['workdayends']) { @@ -2271,10 +2361,10 @@ $time[$ind] = ''; } - $time[$ind] .= $this->link_to_entry($event,$month,$day,$year); + $time[$ind] .= $this->link_to_entry($events[$i],$month,$day,$year); - $starttime = $this->bo->maketime($event['start']); - $endtime = $this->bo->maketime($event['end']); + $starttime = $this->bo->maketime($events[$i]['start']); + $endtime = $this->bo->maketime($events[$i]['end']); if ($starttime <> $endtime) { @@ -2326,11 +2416,11 @@ $holiday_names = $daily[$date_to_eval]['holidays']; if(!$holiday_names) { - $bgcolor = $phpgw->nextmatchs->alternate_row_color(); + $bgcolor = $GLOBALS['phpgw']->nextmatchs->alternate_row_color(); } else { - $bgcolor = $phpgw_info['theme']['bg04']; + $bgcolor = $GLOBALS['phpgw_info']['theme']['bg04']; while(list($index,$name) = each($holiday_names)) { $time[99] = '
    '.$name.'
    '.$time[99]; @@ -2367,7 +2457,7 @@ if (isset($time[$i]) && strlen($time[$i])) { $p->set_var('event',$time[$i]); - $p->set_var('bgcolor',$phpgw->nextmatchs->alternate_row_color()); + $p->set_var('bgcolor',$GLOBALS['phpgw']->nextmatchs->alternate_row_color()); $p->parse('item','day_event',False); } $rowspan--; @@ -2375,7 +2465,7 @@ elseif (!isset($time[$i]) || !strlen($time[$i])) { $p->set_var('event',' '); - $p->set_var('bgcolor',$phpgw->nextmatchs->alternate_row_color()); + $p->set_var('bgcolor',$GLOBALS['phpgw']->nextmatchs->alternate_row_color()); $p->parse('item','day_event',False); } else @@ -2386,7 +2476,7 @@ $p->set_var('extras',' rowspan="'.$rowspan.'"'); } $p->set_var('event',$time[$i]); - $p->set_var('bgcolor',$phpgw->nextmatchs->alternate_row_color()); + $p->set_var('bgcolor',$GLOBALS['phpgw']->nextmatchs->alternate_row_color()); $p->parse('item','day_event',False); } @@ -2420,28 +2510,38 @@ return $p->fp('out','day'); } // end function - function timematrix($date,$starttime,$endtime,$participants) + function timematrix($param) { - global $phpgw, $phpgw_info; + global $GLOBALS; + + if(!is_array($param)) + { + $this->index(); + } + + $date = $param['date']; + $starttime = $param['starttime']; + $endtime = $param['endtime']; + $participants = $param['participants']; if(!isset($this->bo->prefs['calendar']['interval'])) { $this->bo->prefs['calendar']['interval'] = 15; - $phpgw->preferences->add('calendar','interval',15); - $phpgw->preferences->save_repository(); + $GLOBALS['phpgw']->preferences->add('calendar','interval',15); + $GLOBALS['phpgw']->preferences->save_repository(); } // $increment = $this->bo->prefs['calendar']['interval']; $increment = 15; $interval = (int)(60 / $increment); - $pix = $phpgw->common->image('calendar','pix.gif'); + $pix = $GLOBALS['phpgw']->common->image('calendar','pix.gif'); - $str = '
    '.lang($phpgw->common->show_date($date['raw'],'l')) - . ', '.lang($phpgw->common->show_date($date['raw'],'F')) - . ' '.$phpgw->common->show_date($date['raw'],'d, Y').'
    ' + $str = '
    '.lang($GLOBALS['phpgw']->common->show_date($date['raw'],'l')) + . ', '.lang($GLOBALS['phpgw']->common->show_date($date['raw'],'F')) + . ' '.$GLOBALS['phpgw']->common->show_date($date['raw'],'d, Y').'
    ' . '' . '' - . ''; + . ''; for($i=0;$i<24;$i++) { for($j=0;$j<$interval;$j++) @@ -2465,12 +2565,12 @@ { $k .= substr(strval($i),strlen(strval($i)) - 1,1); } - $str .= ''; break; default: - $str .= ''; break; @@ -2487,7 +2587,7 @@ while(list($part,$status) = each($participants)) { $str .= '' - . ''; + . ''; $this->bo->cached_events = Array(); $this->bo->owner = $part; @@ -2500,7 +2600,7 @@ { for($k=0;$k<$interval;$k++) { - $str .= ''; + $str .= ''; } } } @@ -2516,13 +2616,13 @@ switch($time_slice[$index]['marker']) { case ' ': - $time_slice[$index]['color'] = $phpgw_info['theme']['bg_color']; + $time_slice[$index]['color'] = $GLOBALS['phpgw_info']['theme']['bg_color']; break; case '-': - $time_slice[$index]['color'] = $phpgw_info['theme']['bg01']; + $time_slice[$index]['color'] = $GLOBALS['phpgw_info']['theme']['bg01']; break; } - $str .= ''; + $str .= ''; } } } @@ -2536,7 +2636,7 @@ function get_response($cal_id) { - global $phpgw; + global $GLOBALS; $p = CreateObject('phpgwapi.Template',$this->template_dir); $p->set_file( @@ -2566,19 +2666,33 @@ return '
    '.lang('Participant').'
    '.lang('Participant').'' + $str .= '' . '" . $k.'' + $str .= '' . '" . ' 
    '.$this->bo->get_fullname($part).''.$this->bo->get_fullname($part).'  ".''.$time_slice[$index]['marker'].'".''.$time_slice[$index]['marker'].'
    '."\n".$str.'
    '."\n"; } - function edit_form($event,$cd) + function edit_form($param) { - global $phpgw, $phpgw_info; + global $GLOBALS; + + if(!is_array($param)) + { + $this-index(); + } + + if(isset($param['event'])) + { + $event = $param['event']; + } + if(isset($param['cd'])) + { + $cd = $param['cd']; + } $hourformat = substr($this->bo->users_timeformat,0,1); $sb = CreateObject('phpgwapi.sbox'); - unset($phpgw_info['flags']['noheader']); - unset($phpgw_info['flags']['nonavbar']); - $phpgw_info['flags']['noappheader'] = True; - $phpgw_info['flags']['noappfooter'] = True; - $phpgw->common->phpgw_header(); + unset($GLOBALS['phpgw_info']['flags']['noheader']); + unset($GLOBALS['phpgw_info']['flags']['nonavbar']); + $GLOBALS['phpgw_info']['flags']['noappheader'] = True; + $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; + $GLOBALS['phpgw']->common->phpgw_header(); $p = CreateObject('phpgwapi.Template',$this->template_dir); $p->set_file( @@ -2592,14 +2706,14 @@ $p->set_block('edit','hr','hr'); $vars = Array( - 'font' => $phpgw_info['theme']['font'], - 'bg_color' => $phpgw_info['theme']['bg_text'], + 'font' => $GLOBALS['phpgw_info']['theme']['font'], + 'bg_color' => $GLOBALS['phpgw_info']['theme']['bg_text'], 'calendar_action' => ($event->id?lang('Calendar - Edit'):lang('Calendar - Add')), -/* 'action_url' => $phpgw->link('/index.php','menuaction=calendar.bocalendar.'.($event['id']?'update':'add')), */ - 'action_url' => $phpgw->link('/index.php','menuaction=calendar.bocalendar.update'), +/* 'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.bocalendar.'.($event['id']?'update':'add')), */ + 'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.bocalendar.update'), 'common_hidden' => ''."\n" . ''."\n", - 'errormsg' => ($cd?$phpgw->common->check_code($cd):'') + 'errormsg' => ($cd?$GLOBALS['phpgw']->common->check_code($cd):'') ); $p->set_var($vars); @@ -2625,10 +2739,10 @@ $start = $this->bo->maketime($event['start']) - $this->bo->datetime->tz_offset; $var[] = Array( 'field' => lang('Start Date'), - 'data' => $phpgw->common->dateformatorder( - $sb->getYears('start[year]',intval($phpgw->common->show_date($start,'Y'))), - $sb->getMonthText('start[month]',intval($phpgw->common->show_date($start,'n'))), - $sb->getDays('start[mday]',intval($phpgw->common->show_date($start,'d'))) + 'data' => $GLOBALS['phpgw']->common->dateformatorder( + $sb->getYears('start[year]',intval($GLOBALS['phpgw']->common->show_date($start,'Y'))), + $sb->getMonthText('start[month]',intval($GLOBALS['phpgw']->common->show_date($start,'n'))), + $sb->getDays('start[mday]',intval($GLOBALS['phpgw']->common->show_date($start,'d'))) ) ); @@ -2640,17 +2754,17 @@ } $var[] = Array( 'field' => lang('Start Time'), - 'data' => ':'."\n".$str + 'data' => ':'."\n".$str ); // End Date $end = $this->bo->maketime($event['end']) - $this->bo->datetime->tz_offset; $var[] = Array( 'field' => lang('End Date'), - 'data' => $phpgw->common->dateformatorder( - $sb->getYears('end[year]',intval($phpgw->common->show_date($end,'Y'))), - $sb->getMonthText('end[month]',intval($phpgw->common->show_date($end,'n'))), - $sb->getDays('end[mday]',intval($phpgw->common->show_date($end,'d'))) + 'data' => $GLOBALS['phpgw']->common->dateformatorder( + $sb->getYears('end[year]',intval($GLOBALS['phpgw']->common->show_date($end,'Y'))), + $sb->getMonthText('end[month]',intval($GLOBALS['phpgw']->common->show_date($end,'n'))), + $sb->getDays('end[mday]',intval($GLOBALS['phpgw']->common->show_date($end,'d'))) ) ); @@ -2662,7 +2776,7 @@ } $var[] = Array( 'field' => lang("End Time"), - 'data' => ':'."\n".$str + 'data' => ':'."\n".$str ); // Priority @@ -2678,7 +2792,7 @@ ); // Participants - $accounts = $phpgw->acl->get_ids_for_location('run',1,'calendar'); + $accounts = $GLOBALS['phpgw']->acl->get_ids_for_location('run',1,'calendar'); $users = Array(); $this->build_part_list($users,$accounts,$event['owner']); @@ -2689,7 +2803,7 @@ { if(intval($id) != intval($this->bo->owner)) { - $str .= ' '."\n"; + $str .= ' '."\n"; } } $var[] = Array( @@ -2707,7 +2821,7 @@ $checked = ''; } $var[] = Array( - 'field' => $phpgw->common->grab_owner_name($this->bo->owner).' '.lang('Participates'), + 'field' => $GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner).' '.lang('Participates'), 'data' => '' ); @@ -2763,10 +2877,10 @@ $var[] = Array( 'field' => lang('Repeat End Date'), 'data' => ''.lang('Use End Date').' ' - .$phpgw->common->dateformatorder( - $sb->getYears('recur_enddate[year]',intval($phpgw->common->show_date($recur_end,'Y'))), - $sb->getMonthText('recur_enddate[month]',intval($phpgw->common->show_date($recur_end,'n'))), - $sb->getDays('recur_enddate[mday]',intval($phpgw->common->show_date($recur_end,'d'))) + .$GLOBALS['phpgw']->common->dateformatorder( + $sb->getYears('recur_enddate[year]',intval($GLOBALS['phpgw']->common->show_date($recur_end,'Y'))), + $sb->getMonthText('recur_enddate[month]',intval($GLOBALS['phpgw']->common->show_date($recur_end,'n'))), + $sb->getDays('recur_enddate[mday]',intval($GLOBALS['phpgw']->common->show_date($recur_end,'d'))) ) ); @@ -2813,7 +2927,7 @@ function build_part_list(&$users,$accounts,$owner) { - global $phpgw; + global $GLOBALS; if($accounts == False) { return; @@ -2826,13 +2940,13 @@ } if(!isset($users[intval($id)])) { - if($phpgw->accounts->exists(intval($id)) == True) + if($GLOBALS['phpgw']->accounts->exists(intval($id)) == True) { - $users[intval($id)] = $phpgw->common->grab_owner_name(intval($id)); + $users[intval($id)] = $GLOBALS['phpgw']->common->grab_owner_name(intval($id)); } - if($phpgw->accounts->get_type(intval($id)) == 'g') + if($GLOBALS['phpgw']->accounts->get_type(intval($id)) == 'g') { - $this->build_part_list($users,$phpgw->acl->get_ids_for_location(intval($id),1,'phpgw_group'),$owner); + $this->build_part_list($users,$GLOBALS['phpgw']->acl->get_ids_for_location(intval($id),1,'phpgw_group'),$owner); } } } diff --git a/calendar/templates/default/header.inc.php b/calendar/templates/default/header.inc.php index bbf42d27f2..5c24b62ce3 100755 --- a/calendar/templates/default/header.inc.php +++ b/calendar/templates/default/header.inc.php @@ -19,11 +19,11 @@ function add_image_ahref($link,$image,$alt) { - global $phpgw; - return ''.$alt.''; + global $GLOBALS; + return ''.$alt.''; } - $refer = explode('.',$menuaction); + $refer = explode('.',$HTTP_GET_VARS['menuaction']); $referrer = $refer[2]; $templates = Array( @@ -70,27 +70,27 @@ if($this->bo->check_perms(PHPGW_ACL_PRIVATE)) { $remainder -= 28; - $hidden_vars = ''."\n"; - if(isset($date) && $date) + $hidden_vars = ''."\n"; + if(isset($HTTP_GET_VARS['date']) && $HTTP_GET_VARS['date']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; - if(isset($keywords) && $keywords) + if(isset($HTTP_POST_VARS['keywords']) && $HTTP_POST_VARS['keywords']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } - if(isset($matrixtype) && $matrixtype) + if(isset($HTTP_POST_VARS['matrixtype']) && $HTTP_POST_VARS['matrixtype']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } - if(isset($participants) && $participants) + if(isset($HTTP_POST_VARS['participants']) && $HTTP_POST_VARS['participants']) { - for ($i=0;$i'."\n"; + $hidden_vars .= ' '."\n"; } } if($this->debug) { echo 'Filter = ('.$this->bo->filter.")
    \n"; } @@ -113,27 +113,27 @@ if(count($this->bo->grants) > 0) { - $hidden_vars = ' '."\n"; - if(isset($date) && $date) + $hidden_vars = ' '."\n"; + if(isset($HTTP_GET_VARS['date']) && $HTTP_GET_VARS['date']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; - if(isset($keywords) && $keywords) + if(isset($HTTP_POST_VARS['keywords']) && $HTTP_POST_VARS['keywords']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } - if(isset($cal_id) && $cal_id != 0) + if(isset($HTTP_GET_VARS['cal_id']) && $HTTP_GET_VARS['cal_id'] != 0) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } $form_options = ''; reset($this->bo->grants); while(list($grantor,$temp_rights) = each($this->bo->grants)) { - $form_options .= ' '."\n"; + $form_options .= ' '."\n"; } reset($this->bo->grants); @@ -151,29 +151,25 @@ $tpl->parse('header_column','head_col',True); } - $hidden_vars = ' '."\n"; - if(isset($date) && $date) + $hidden_vars = ' '."\n"; + if(isset($HTTP_GET_VARS['date']) && $HTTP_GET_VARS['date']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; - if(isset($keywords) && $keywords) - { - $hidden_vars .= ' '."\n"; - } if(isset($this->bo->filter) && $this->bo->filter) { $hidden_vars .= ' '."\n"; } - $extra_field = $hidden_vars.' '; + $hidden_vars .= ' '; $var = Array( 'action_url_button' => $this->page('search'), 'action_text_button' => lang('Search'), 'action_confirm_button' => '', - 'action_extra_field' => $extra_field + 'action_extra_field' => $hidden_vars ); $tpl->set_var($var); $button = $tpl->fp('out','form_button'); diff --git a/calendar/templates/idsociety/header.inc.php b/calendar/templates/idsociety/header.inc.php index bbf42d27f2..5c24b62ce3 100755 --- a/calendar/templates/idsociety/header.inc.php +++ b/calendar/templates/idsociety/header.inc.php @@ -19,11 +19,11 @@ function add_image_ahref($link,$image,$alt) { - global $phpgw; - return ''.$alt.''; + global $GLOBALS; + return ''.$alt.''; } - $refer = explode('.',$menuaction); + $refer = explode('.',$HTTP_GET_VARS['menuaction']); $referrer = $refer[2]; $templates = Array( @@ -70,27 +70,27 @@ if($this->bo->check_perms(PHPGW_ACL_PRIVATE)) { $remainder -= 28; - $hidden_vars = ''."\n"; - if(isset($date) && $date) + $hidden_vars = ''."\n"; + if(isset($HTTP_GET_VARS['date']) && $HTTP_GET_VARS['date']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; - if(isset($keywords) && $keywords) + if(isset($HTTP_POST_VARS['keywords']) && $HTTP_POST_VARS['keywords']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } - if(isset($matrixtype) && $matrixtype) + if(isset($HTTP_POST_VARS['matrixtype']) && $HTTP_POST_VARS['matrixtype']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } - if(isset($participants) && $participants) + if(isset($HTTP_POST_VARS['participants']) && $HTTP_POST_VARS['participants']) { - for ($i=0;$i'."\n"; + $hidden_vars .= ' '."\n"; } } if($this->debug) { echo 'Filter = ('.$this->bo->filter.")
    \n"; } @@ -113,27 +113,27 @@ if(count($this->bo->grants) > 0) { - $hidden_vars = ' '."\n"; - if(isset($date) && $date) + $hidden_vars = ' '."\n"; + if(isset($HTTP_GET_VARS['date']) && $HTTP_GET_VARS['date']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; - if(isset($keywords) && $keywords) + if(isset($HTTP_POST_VARS['keywords']) && $HTTP_POST_VARS['keywords']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } - if(isset($cal_id) && $cal_id != 0) + if(isset($HTTP_GET_VARS['cal_id']) && $HTTP_GET_VARS['cal_id'] != 0) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } $form_options = ''; reset($this->bo->grants); while(list($grantor,$temp_rights) = each($this->bo->grants)) { - $form_options .= ' '."\n"; + $form_options .= ' '."\n"; } reset($this->bo->grants); @@ -151,29 +151,25 @@ $tpl->parse('header_column','head_col',True); } - $hidden_vars = ' '."\n"; - if(isset($date) && $date) + $hidden_vars = ' '."\n"; + if(isset($HTTP_GET_VARS['date']) && $HTTP_GET_VARS['date']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; - if(isset($keywords) && $keywords) - { - $hidden_vars .= ' '."\n"; - } if(isset($this->bo->filter) && $this->bo->filter) { $hidden_vars .= ' '."\n"; } - $extra_field = $hidden_vars.' '; + $hidden_vars .= ' '; $var = Array( 'action_url_button' => $this->page('search'), 'action_text_button' => lang('Search'), 'action_confirm_button' => '', - 'action_extra_field' => $extra_field + 'action_extra_field' => $hidden_vars ); $tpl->set_var($var); $button = $tpl->fp('out','form_button'); diff --git a/calendar/templates/justweb/header.inc.php b/calendar/templates/justweb/header.inc.php index bbf42d27f2..5c24b62ce3 100755 --- a/calendar/templates/justweb/header.inc.php +++ b/calendar/templates/justweb/header.inc.php @@ -19,11 +19,11 @@ function add_image_ahref($link,$image,$alt) { - global $phpgw; - return ''.$alt.''; + global $GLOBALS; + return ''.$alt.''; } - $refer = explode('.',$menuaction); + $refer = explode('.',$HTTP_GET_VARS['menuaction']); $referrer = $refer[2]; $templates = Array( @@ -70,27 +70,27 @@ if($this->bo->check_perms(PHPGW_ACL_PRIVATE)) { $remainder -= 28; - $hidden_vars = ''."\n"; - if(isset($date) && $date) + $hidden_vars = ''."\n"; + if(isset($HTTP_GET_VARS['date']) && $HTTP_GET_VARS['date']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; - if(isset($keywords) && $keywords) + if(isset($HTTP_POST_VARS['keywords']) && $HTTP_POST_VARS['keywords']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } - if(isset($matrixtype) && $matrixtype) + if(isset($HTTP_POST_VARS['matrixtype']) && $HTTP_POST_VARS['matrixtype']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } - if(isset($participants) && $participants) + if(isset($HTTP_POST_VARS['participants']) && $HTTP_POST_VARS['participants']) { - for ($i=0;$i'."\n"; + $hidden_vars .= ' '."\n"; } } if($this->debug) { echo 'Filter = ('.$this->bo->filter.")
    \n"; } @@ -113,27 +113,27 @@ if(count($this->bo->grants) > 0) { - $hidden_vars = ' '."\n"; - if(isset($date) && $date) + $hidden_vars = ' '."\n"; + if(isset($HTTP_GET_VARS['date']) && $HTTP_GET_VARS['date']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; - if(isset($keywords) && $keywords) + if(isset($HTTP_POST_VARS['keywords']) && $HTTP_POST_VARS['keywords']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } - if(isset($cal_id) && $cal_id != 0) + if(isset($HTTP_GET_VARS['cal_id']) && $HTTP_GET_VARS['cal_id'] != 0) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } $form_options = ''; reset($this->bo->grants); while(list($grantor,$temp_rights) = each($this->bo->grants)) { - $form_options .= ' '."\n"; + $form_options .= ' '."\n"; } reset($this->bo->grants); @@ -151,29 +151,25 @@ $tpl->parse('header_column','head_col',True); } - $hidden_vars = ' '."\n"; - if(isset($date) && $date) + $hidden_vars = ' '."\n"; + if(isset($HTTP_GET_VARS['date']) && $HTTP_GET_VARS['date']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; - if(isset($keywords) && $keywords) - { - $hidden_vars .= ' '."\n"; - } if(isset($this->bo->filter) && $this->bo->filter) { $hidden_vars .= ' '."\n"; } - $extra_field = $hidden_vars.' '; + $hidden_vars .= ' '; $var = Array( 'action_url_button' => $this->page('search'), 'action_text_button' => lang('Search'), 'action_confirm_button' => '', - 'action_extra_field' => $extra_field + 'action_extra_field' => $hidden_vars ); $tpl->set_var($var); $button = $tpl->fp('out','form_button'); diff --git a/calendar/templates/verdilak/header.inc.php b/calendar/templates/verdilak/header.inc.php index bbf42d27f2..5c24b62ce3 100755 --- a/calendar/templates/verdilak/header.inc.php +++ b/calendar/templates/verdilak/header.inc.php @@ -19,11 +19,11 @@ function add_image_ahref($link,$image,$alt) { - global $phpgw; - return ''.$alt.''; + global $GLOBALS; + return ''.$alt.''; } - $refer = explode('.',$menuaction); + $refer = explode('.',$HTTP_GET_VARS['menuaction']); $referrer = $refer[2]; $templates = Array( @@ -70,27 +70,27 @@ if($this->bo->check_perms(PHPGW_ACL_PRIVATE)) { $remainder -= 28; - $hidden_vars = ''."\n"; - if(isset($date) && $date) + $hidden_vars = ''."\n"; + if(isset($HTTP_GET_VARS['date']) && $HTTP_GET_VARS['date']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; - if(isset($keywords) && $keywords) + if(isset($HTTP_POST_VARS['keywords']) && $HTTP_POST_VARS['keywords']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } - if(isset($matrixtype) && $matrixtype) + if(isset($HTTP_POST_VARS['matrixtype']) && $HTTP_POST_VARS['matrixtype']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } - if(isset($participants) && $participants) + if(isset($HTTP_POST_VARS['participants']) && $HTTP_POST_VARS['participants']) { - for ($i=0;$i'."\n"; + $hidden_vars .= ' '."\n"; } } if($this->debug) { echo 'Filter = ('.$this->bo->filter.")
    \n"; } @@ -113,27 +113,27 @@ if(count($this->bo->grants) > 0) { - $hidden_vars = ' '."\n"; - if(isset($date) && $date) + $hidden_vars = ' '."\n"; + if(isset($HTTP_GET_VARS['date']) && $HTTP_GET_VARS['date']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; - if(isset($keywords) && $keywords) + if(isset($HTTP_POST_VARS['keywords']) && $HTTP_POST_VARS['keywords']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } - if(isset($cal_id) && $cal_id != 0) + if(isset($HTTP_GET_VARS['cal_id']) && $HTTP_GET_VARS['cal_id'] != 0) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } $form_options = ''; reset($this->bo->grants); while(list($grantor,$temp_rights) = each($this->bo->grants)) { - $form_options .= ' '."\n"; + $form_options .= ' '."\n"; } reset($this->bo->grants); @@ -151,29 +151,25 @@ $tpl->parse('header_column','head_col',True); } - $hidden_vars = ' '."\n"; - if(isset($date) && $date) + $hidden_vars = ' '."\n"; + if(isset($HTTP_GET_VARS['date']) && $HTTP_GET_VARS['date']) { - $hidden_vars .= ' '."\n"; + $hidden_vars .= ' '."\n"; } $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; $hidden_vars .= ' '."\n"; - if(isset($keywords) && $keywords) - { - $hidden_vars .= ' '."\n"; - } if(isset($this->bo->filter) && $this->bo->filter) { $hidden_vars .= ' '."\n"; } - $extra_field = $hidden_vars.' '; + $hidden_vars .= ' '; $var = Array( 'action_url_button' => $this->page('search'), 'action_text_button' => lang('Search'), 'action_confirm_button' => '', - 'action_extra_field' => $extra_field + 'action_extra_field' => $hidden_vars ); $tpl->set_var($var); $button = $tpl->fp('out','form_button');