Massive intval and formatting update - previous version in tag 'cal_008-2'

This commit is contained in:
Miles Lott 2004-01-04 00:47:37 +00:00
parent 27f2acb285
commit 94ea6c3c0a
24 changed files with 4975 additions and 4966 deletions

View File

@ -62,64 +62,70 @@
$CPre = '|['; $CPreReg = '\|\['; // |{csv-fieldname} is expanded to the value of the csv-field
$CPos = ']'; $CPosReg = '\]'; // if used together with @ (replacement is eval-ed) value gets autom. quoted
function addr_id( $n_family,$n_given,$org_name )
{ // find in Addressbook, at least n_family AND (n_given OR org_name) have to match
$contacts = createobject('phpgwapi.contacts');
function addr_id( $n_family,$n_given,$org_name )
{ // find in Addressbook, at least n_family AND (n_given OR org_name) have to match
$contacts = createobject('phpgwapi.contacts');
$addrs = $contacts->read( 0,0,array('id'),'',"n_family=$n_family,n_given=$n_given,org_name=$org_name" );
if (!count($addrs))
$addrs = $contacts->read( 0,0,array('id'),'',"n_family=$n_family,n_given=$n_given" );
if (!count($addrs))
$addrs = $contacts->read( 0,0,array('id'),'',"n_family=$n_family,org_name=$org_name" );
$addrs = $contacts->read(0,0,array('id'),'',"n_family=$n_family,n_given=$n_given,org_name=$org_name");
if(!count($addrs))
{
$addrs = $contacts->read(0,0,array('id'),'',"n_family=$n_family,n_given=$n_given");
}
if(!count($addrs))
{
$addrs = $contacts->read(0,0,array('id'),'',"n_family=$n_family,org_name=$org_name");
}
if (count($addrs))
return $addrs[0]['id'];
if (count($addrs))
{
return $addrs[0]['id'];
}
return False;
}
$cat2id = array( );
function cat_id($cats)
{
if (!$cats)
{
return '';
return False;
}
$cats = split('[,;]',$cats);
$cat2id = array( );
foreach($cats as $k => $cat)
function cat_id($cats)
{
if (isset($cat2id[$cat]))
if (!$cats)
{
$ids[$cat] = $cat2id[$cat]; // cat is in cache
return '';
}
else
$cats = split('[,;]',$cats);
foreach($cats as $k => $cat)
{
if (!is_object($GLOBALS['phpgw']->categories))
if (isset($cat2id[$cat]))
{
$GLOBALS['phpgw']->categories = createobject('phpgwapi.categories');
}
if ($id = $GLOBALS['phpgw']->categories->name2id( addslashes($cat) ))
{ // cat exists
$cat2id[$cat] = $ids[$cat] = $id;
$ids[$cat] = $cat2id[$cat]; // cat is in cache
}
else
{ // create new cat
$GLOBALS['phpgw']->categories->add( array('name' => $cat,'descr' => $cat ));
$cat2id[$cat] = $ids[$cat] = $GLOBALS['phpgw']->categories->name2id( addslashes($cat) );
{
if (!is_object($GLOBALS['phpgw']->categories))
{
$GLOBALS['phpgw']->categories = createobject('phpgwapi.categories');
}
if ($id = $GLOBALS['phpgw']->categories->name2id( addslashes($cat) ))
{ // cat exists
$cat2id[$cat] = $ids[$cat] = $id;
}
else
{ // create new cat
$GLOBALS['phpgw']->categories->add( array('name' => $cat,'descr' => $cat ));
$cat2id[$cat] = $ids[$cat] = $GLOBALS['phpgw']->categories->name2id( addslashes($cat) );
}
}
}
}
$id_str = implode( ',',$ids );
$id_str = implode( ',',$ids );
if (count($ids) > 1) // multiple cats need to be in ','
{
$id_str = ",$id_str,";
if (count($ids) > 1) // multiple cats need to be in ','
{
$id_str = ",$id_str,";
}
return $id_str;
}
return $id_str;
}
if (!is_object($GLOBALS['phpgw']->html))
{
@ -168,12 +174,12 @@ function cat_id($cats)
'start' => 'Start Date: start: Timestamp or eg. YYYY-MM-DD hh:mm',
'end' => 'End Date: start',
'participants' => 'Participants: comma separated user-id\'s or -names',
'category' => 'Categories: id\'s or names, comma separated (new ones got created)',
'category' => 'Categories: id\'s or names, comma separated (new ones got created)',
'priority' => 'Priority: 1=Low, 2=Normal, 3=High',
'public' => 'Access: 1=public, 0=private',
'owner' => 'Owner: int(11) user-id/-name',
'modtime' => 'Modification date',
// 'groups' => 'Groups (dont know what this field is for)',
'modtime' => 'Modification date',
// 'groups' => 'Groups (dont know what this field is for)',
// 'cal_type' => 'cal_type: single_event=E (default) else M',
);
@ -181,26 +187,26 @@ function cat_id($cats)
$mktime_lotus = "${PSep}0?([0-9]+)[ .:-]+0?([0-9]*)[ .:-]+0?([0-9]*)[ .:-]+0?([0-9]*)[ .:-]+0?([0-9]*)[ .:-]+0?([0-9]*).*$ASep@mktime(${VPre}4,${VPre}5,${VPre}6,${VPre}2,${VPre}3,${VPre}1)";
$cal_name_options = "<option value=\"\">none\n";
foreach($cal_names as $field => $name)
foreach($cal_names as $field => $name)
{
$cal_name_options .= "<option value=\"$field\">".$GLOBALS['phpgw']->strip_html($name)."\n";
}
$csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']);
$csv_fields = $GLOBALS['phpgw']->translation->convert($csv_fields,$_POST['charset']);
$csv_fields[] = 'no CSV 1'; // eg. for static assignments
$csv_fields[] = 'no CSV 1'; // eg. for static assignments
$csv_fields[] = 'no CSV 2';
$csv_fields[] = 'no CSV 3';
foreach($csv_fields as $csv_idx => $csv_field)
foreach($csv_fields as $csv_idx => $csv_field)
{
$GLOBALS['phpgw']->template->set_var('csv_field',$csv_field);
$GLOBALS['phpgw']->template->set_var('csv_idx',$csv_idx);
if ($def = $defaults[$csv_field])
if ($def = $defaults[$csv_field])
{
list( $info,$trans ) = explode($PSep,$def,2);
$GLOBALS['phpgw']->template->set_var('trans',$trans);
$GLOBALS['phpgw']->template->set_var('cal_fields',str_replace('="'.$info.'">','="'.$info.'" selected>',$cal_name_options));
}
else
}
else
{
$GLOBALS['phpgw']->template->set_var('trans','');
$GLOBALS['phpgw']->template->set_var('cal_fields',$cal_name_options);
@ -222,7 +228,7 @@ function cat_id($cats)
'fieldsep'=> $_POST['fieldsep'],
'charset' => $_POST['charset']
));
$help_on_trans = "<a name=\"help\"></a><b>How to use Translation's</b><p>".
$help_on_trans = "<a name=\"help\"></a><b>How to use Translation's</b><p>".
"Translations enable you to change / adapt the content of each CSV field for your needs. <br>".
"General syntax is: <b>pattern1 ${ASep} replacement1 ${PSep} ... ${PSep} patternN ${ASep} replacementN</b><br>".
"If the pattern-part of a pair is ommited it will match everything ('^.*$'), which is only ".
@ -276,7 +282,7 @@ function cat_id($cats)
$fp=fopen($csvfile,'r');
$csv_fields = fgetcsv($fp,8000,$_POST['fieldsep']);
$csv_fields = $GLOBALS['phpgw']->translation->convert($csv_fields,$_POST['charset']);
$csv_fields[] = 'no CSV 1'; // eg. for static assignments
$csv_fields[] = 'no CSV 1'; // eg. for static assignments
$csv_fields[] = 'no CSV 2';
$csv_fields[] = 'no CSV 3';
@ -303,14 +309,14 @@ function cat_id($cats)
// if (!$debug) echo "<p>$csv_idx: ".$csv_fields[$csv_idx].": $info".($trans[$csv_idx] ? ': '.$trans[$csv_idx] : '')."</p>";
$pat_reps = explode($PSep,stripslashes($_POST['trans'][$csv_idx]));
$replaces = ''; $values = '';
if ($pat_reps[0] != '')
if ($pat_reps[0] != '')
{
foreach($pat_reps as $k => $pat_rep)
foreach($pat_reps as $k => $pat_rep)
{
list($pattern,$replace) = explode($ASep,$pat_rep,2);
if ($replace == '')
{
$replace = $pattern; $pattern = '^.*$';
if ($replace == '')
{
$replace = $pattern; $pattern = '^.*$';
}
$values[$pattern] = $replace; // replace two with only one, added by the form
$replaces .= ($replaces != '' ? $PSep : '') . $pattern . $ASep . $replace;
@ -334,7 +340,7 @@ function cat_id($cats)
$start = $_POST['start'] < 1 ? 1 : $_POST['start'];
// ignore empty lines, is_null($fields[0]) is returned on empty lines !!!
for($i = 1; $i < $start; ++$i) // overread lines before our start-record
for($i = 1; $i < $start; ++$i) // overread lines before our start-record
{
while(($fields = fgetcsv($fp,8000,$_POST['fieldsep'])) && is_null($fields[0])) ;
}

View File

@ -36,7 +36,7 @@
function boalarm()
{
$cal_id = (isset($_POST['cal_id'])?intval($_POST['cal_id']):'');
$cal_id = (isset($_POST['cal_id'])?(int)$_POST['cal_id']:'');
if($cal_id)
{
$this->cal_id = $cal_id;
@ -71,7 +71,7 @@
function read_entry($cal_id)
{
return $this->bo->read_entry(intval($cal_id));
return $this->bo->read_entry((int)$cal_id);
}
/*!
@ -168,7 +168,7 @@
{
return -1;
}
$alarm['enabled'] = intval(!$alarm['enabled']);
$alarm['enabled'] = (int)(!$alarm['enabled']);
if ($this->so->save_alarm($alarm['cal_id'],$alarm))
{
++$enabled;

View File

@ -111,11 +111,11 @@
var $cached_holidays;
var $g_owner = 0;
var $filter;
var $cat_id;
var $users_timeformat;
var $modified;
var $deleted;
var $added;
@ -123,7 +123,7 @@
var $is_group = False;
var $soap = False;
var $use_session = False;
var $today;
@ -143,7 +143,7 @@
{
$this->debug_string = '';
ob_start();
}
}
foreach($this->grants as $grantor => $rights)
{
@ -166,13 +166,13 @@
$this->check_set_default_prefs();
$owner = get_var('owner',array('GET','POST'),$GLOBALS['owner']);
ereg('menuaction=([a-zA-Z.]+)',$_SERVER['HTTP_REFERER'],$regs);
$from = $regs[1];
if ((substr($_SERVER['PHP_SELF'],-8) == 'home.php' && substr($this->prefs['calendar']['defaultcalendar'],0,7) == 'planner'
|| $_GET['menuaction'] == 'calendar.uicalendar.planner' &&
$from != 'calendar.uicalendar.planner' && !$this->save_owner)
&& intval($this->prefs['calendar']['planner_start_with_group']) > 0)
|| $_GET['menuaction'] == 'calendar.uicalendar.planner' &&
$from != 'calendar.uicalendar.planner' && !$this->save_owner)
&& (int)$this->prefs['calendar']['planner_start_with_group'] > 0)
{
// entering planner for the first time ==> saving owner in save_owner, setting owner to default
//
@ -180,11 +180,11 @@
$owner = 'g_'.$this->prefs['calendar']['planner_start_with_group'];
}
elseif ($_GET['menuaction'] != 'calendar.uicalendar.planner' &&
$this->save_owner)
$this->save_owner)
{
// leaving planner with an unchanged user/owner ==> setting owner back to save_owner
//
$owner = intval(isset($_GET['owner']) ? $_GET['owner'] : $this->save_owner);
$owner = (int)(isset($_GET['owner']) ? $_GET['owner'] : $this->save_owner);
unset($this->save_owner);
}
elseif (!empty($owner) && $owner != $this->owner && $from == 'calendar.uicalendar.planner')
@ -193,22 +193,22 @@
//
unset($this->save_owner);
}
if(isset($owner) && $owner!='' && substr($owner,0,2) == 'g_')
{
$this->set_owner_to_group(substr($owner,2));
}
elseif(isset($owner) && $owner!='')
{
$this->owner = intval($owner);
$this->owner = (int)$owner;
}
elseif(!@isset($this->owner) || !@$this->owner)
{
$this->owner = intval($GLOBALS['phpgw_info']['user']['account_id']);
$this->owner = (int)$GLOBALS['phpgw_info']['user']['account_id'];
}
elseif(isset($this->owner) && $GLOBALS['phpgw']->accounts->get_type($this->owner) == 'g')
{
$this->set_owner_to_group(intval($this->owner));
$this->set_owner_to_group((int)$this->owner);
}
$this->prefs['common'] = $GLOBALS['phpgw_info']['user']['preferences']['common'];
@ -226,7 +226,7 @@
$friendly = (isset($_GET['friendly'])?$_GET['friendly']:'');
$friendly = ($friendly=='' && isset($_POST['friendly'])?$_POST['friendly']:$friendly);
$this->printer_friendly = (intval($friendly) == 1?True:False);
$this->printer_friendly = ((int)$friendly == 1?True:False);
if(isset($_POST['filter'])) { $this->filter = $_POST['filter']; }
if(isset($_POST['sortby'])) { $this->sortby = $_POST['sortby']; }
@ -239,7 +239,7 @@
if(!isset($this->sortby))
{
$this->sortby = $this->prefs['calendar']['defaultcalendar'] == 'planner_user' ? 'user' : 'category';
$this->sortby = $this->prefs['calendar']['defaultcalendar'] == 'planner_user' ? 'user' : 'category';
}
if($GLOBALS['phpgw']->accounts->get_type($this->owner)=='g')
@ -283,7 +283,7 @@
MCAL_RECUR_MONTHLY_MDAY => 'Monthly (by date)',
MCAL_RECUR_YEARLY => 'Yearly'
);
$localtime = $GLOBALS['phpgw']->datetime->users_localtime;
$date = (isset($GLOBALS['date'])?$GLOBALS['date']:'');
@ -304,9 +304,9 @@
if(isset($date) && $date!='')
{
$this->year = intval(substr($date,0,4));
$this->month = intval(substr($date,4,2));
$this->day = intval(substr($date,6,2));
$this->year = (int)(substr($date,0,4));
$this->month = (int)(substr($date,4,2));
$this->day = (int)(substr($date,6,2));
}
else
{
@ -435,7 +435,7 @@
function set_owner_to_group($owner)
{
print_debug('calendar::bocalendar::set_owner_to_group:owner',$owner);
$this->owner = intval($owner);
$this->owner = (int)$owner;
$this->is_group = True;
$this->g_owner = Array();
$members = $GLOBALS['phpgw']->accounts->member($owner);
@ -512,12 +512,12 @@
$this->filter = $data['filter'];
$this->cat_id = $data['cat_id'];
$this->sortby = $data['sortby'];
$this->owner = intval($data['owner']);
$this->save_owner = intval($data['save_owner']);
$this->year = intval($data['year']);
$this->month = intval($data['month']);
$this->day = intval($data['day']);
$this->num_months = intval($data['num_months']);
$this->owner = (int)$data['owner'];
$this->save_owner = (int)$data['save_owner'];
$this->year = (int)$data['year'];
$this->month = (int)$data['month'];
$this->day = (int)$data['day'];
$this->num_months = (int)$data['num_months'];
$this->return_to = $data['return_to'];
}
@ -533,7 +533,7 @@
$event = $this->so->read_entry($id);
if(!isset($event['participants'][$this->owner]) && $this->user_is_a_member($event,$this->owner))
{
$this->so->add_attribute('participants','U',intval($this->owner));
$this->so->add_attribute('participants','U',(int)$this->owner);
$this->so->add_entry($event);
$event = $this->get_cached_event();
}
@ -544,20 +544,20 @@
function delete_single($param)
{
if($this->check_perms(PHPGW_ACL_DELETE,intval($param['id'])))
if($this->check_perms(PHPGW_ACL_DELETE,(int)$param['id']))
{
$temp_event = $this->get_cached_event();
$event = $this->read_entry(intval($param['id']));
$event = $this->read_entry((int)$param['id']);
// if($this->owner == $event['owner'])
// {
$exception_time = mktime($event['start']['hour'],$event['start']['min'],0,$param['month'],$param['day'],$param['year']) - $GLOBALS['phpgw']->datetime->tz_offset;
$event['recur_exception'][] = intval($exception_time);
$event['recur_exception'][] = (int)$exception_time;
$this->so->cal->event = $event;
// print_debug('exception time',$event['recur_exception'][count($event['recur_exception']) -1]);
// print_debug('count event exceptions',count($event['recur_exception']));
$this->so->add_entry($event);
$cd = 16;
$this->so->cal->event = $temp_event;
unset($temp_event);
}
@ -600,17 +600,17 @@
{
while(list($key,$value) = each($params['reinstate_index']))
{
print_debug('reinstate_index ['.$key.']',intval($value));
print_debug('exception time',$event['recur_exception'][intval($value)]);
unset($event['recur_exception'][intval($value)]);
print_debug('reinstate_index ['.$key.']',(int)$value);
print_debug('exception time',$event['recur_exception'][(int)$value]);
unset($event['recur_exception'][(int)$value]);
print_debug('count event exceptions',count($event['recur_exception']));
}
}
}
else
{
print_debug('reinstate_index[0]',intval($params['reinstate_index'][0]));
print_debug('exception time',$event['recur_exception'][intval($params['reinstate_index'][0])]);
unset($event['recur_exception'][intval($params['reinstate_index'][0])]);
print_debug('reinstate_index[0]',(int)$params['reinstate_index'][0]);
print_debug('exception time',$event['recur_exception'][(int)$params['reinstate_index'][0]]);
unset($event['recur_exception'][(int)$params['reinstate_index'][0]]);
print_debug('count event exceptions',count($event['recur_exception']));
}
$this->so->cal->event = $event;
@ -664,7 +664,7 @@
{
$type = $GLOBALS['phpgw']->accounts->get_type($this->owner);
if($type == 'g')
if($type == 'g')
{
$members = $GLOBALS['phpgw']->acl->get_ids_for_location($this->owner, 1, 'phpgw_group');
}
@ -808,7 +808,7 @@
$l_categories = 0;
}
$is_public = intval(isset($l_cal['public']) ? $l_cal['public'] : $l_cal['private'] == 'public');
$is_public = (int)(isset($l_cal['public']) ? $l_cal['public'] : $l_cal['private'] == 'public');
$this->so->event_init();
$this->add_attribute('uid',$l_cal['uid']);
if(count($l_categories) >= 2)
@ -842,36 +842,36 @@
$l_recur_enddate = $this->jscal->input2date($l_recur_enddate['str'],False,'mday');
}
switch(intval($l_cal['recur_type']))
switch((int)$l_cal['recur_type'])
{
case MCAL_RECUR_NONE:
$this->so->set_recur_none();
break;
case MCAL_RECUR_DAILY:
$this->so->set_recur_daily(intval($l_recur_enddate['year']),intval($l_recur_enddate['month']),intval($l_recur_enddate['mday']),intval($l_cal['recur_interval']));
$this->so->set_recur_daily((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
break;
case MCAL_RECUR_WEEKLY:
foreach(array('rpt_sun','rpt_mon','rpt_tue','rpt_wed','rpt_thu','rpt_fri','rpt_sat') as $rpt_day)
{
$l_cal['recur_data'] += intval($l_cal[$rpt_day]);
$l_cal['recur_data'] += (int)$l_cal[$rpt_day];
}
if (is_array($l_cal['rpt_day']))
{
foreach ($l_cal['rpt_day'] as $mask)
{
$l_cal['recur_data'] |= intval($mask);
$l_cal['recur_data'] |= (int)$mask;
}
}
$this->so->set_recur_weekly(intval($l_recur_enddate['year']),intval($l_recur_enddate['month']),intval($l_recur_enddate['mday']),intval($l_cal['recur_interval']),$l_cal['recur_data']);
$this->so->set_recur_weekly((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval'],$l_cal['recur_data']);
break;
case MCAL_RECUR_MONTHLY_MDAY:
$this->so->set_recur_monthly_mday(intval($l_recur_enddate['year']),intval($l_recur_enddate['month']),intval($l_recur_enddate['mday']),intval($l_cal['recur_interval']));
$this->so->set_recur_monthly_mday((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
break;
case MCAL_RECUR_MONTHLY_WDAY:
$this->so->set_recur_monthly_wday(intval($l_recur_enddate['year']),intval($l_recur_enddate['month']),intval($l_recur_enddate['mday']),intval($l_cal['recur_interval']));
$this->so->set_recur_monthly_wday((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
break;
case MCAL_RECUR_YEARLY:
$this->so->set_recur_yearly(intval($l_recur_enddate['year']),intval($l_recur_enddate['month']),intval($l_recur_enddate['mday']),intval($l_cal['recur_interval']));
$this->so->set_recur_yearly((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
break;
}
@ -882,23 +882,23 @@
$part = Array();
for($i=0;$i<count($parts);$i++)
{
if (($accept_type = substr($parts[$i],-1,1)) == '0' || intval($accept_type) > 0)
if (($accept_type = substr($parts[$i],-1,1)) == '0' || (int)$accept_type > 0)
{
$accept_type = 'U';
}
$acct_type = $GLOBALS['phpgw']->accounts->get_type(intval($parts[$i]));
$acct_type = $GLOBALS['phpgw']->accounts->get_type((int)$parts[$i]);
if($acct_type == 'u')
{
$part[intval($parts[$i])] = $accept_type;
$part[(int)$parts[$i]] = $accept_type;
}
elseif($acct_type == 'g')
{
$part[intval($parts[$i])] = $accept_type;
$part[(int)$parts[$i]] = $accept_type;
$groups[] = $parts[$i];
/* This pulls ALL users of a group and makes them as participants to the event */
/* I would like to turn this back into a group thing. */
$acct = CreateObject('phpgwapi.accounts',intval($parts[$i]));
$members = $acct->member(intval($parts[$i]));
$acct = CreateObject('phpgwapi.accounts',(int)$parts[$i]);
$members = $acct->member((int)$parts[$i]);
unset($acct);
if($members == False)
{
@ -921,14 +921,14 @@
@reset($part);
while(list($key,$accept_type) = each($part))
{
$this->so->add_attribute('participants',$accept_type,intval($key));
$this->so->add_attribute('participants',$accept_type,(int)$key);
}
}
if($groups)
{
@reset($groups);
$this->so->add_attribute('groups',intval($group_id));
$this->so->add_attribute('groups',(int)$group_id);
}
$event = $this->get_cached_event();
@ -1027,10 +1027,10 @@
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
ExecMethod('calendar.uicalendar.overlap',
Array(
'o_events' => $overlapping_events,
'this_event' => $event
)
Array(
'o_events' => $overlapping_events,
'this_event' => $event
)
);
$GLOBALS['phpgw']->common->phpgw_exit(True);
}
@ -1055,7 +1055,7 @@
// if old event has alarm and the start-time changed => update them
//echo "<p>checking ".count($old_event['alarm'])." alarms of event #$event[id] start moved from ".print_r($old_event['start'],True)." to ".print_r($event['start'],True)."</p>\n";
if ($old_event['alarm'] &&
$this->maketime($old_event['start']) != $this->maketime($event['start']))
$this->maketime($old_event['start']) != $this->maketime($event['start']))
{
$this->so->delete_alarms($old_event['id']);
foreach($old_event['alarm'] as $id => $alarm)
@ -1083,7 +1083,7 @@
}
else
{
return intval($event['id']);
return (int)$event['id'];
}
}
return True;
@ -1141,13 +1141,13 @@
function time2array($time,$alarm = 0)
{
return array(
'year' => intval(date('Y',$time)),
'month' => intval(date('m',$time)),
'mday' => intval(date('d',$time)),
'hour' => intval(date('H',$time)),
'min' => intval(date('i',$time)),
'sec' => intval(date('s',$time)),
'alarm' => intval($alarm)
'year' => (int)(date('Y',$time)),
'month' => (int)(date('m',$time)),
'mday' => (int)(date('d',$time)),
'hour' => (int)(date('H',$time)),
'min' => (int)(date('i',$time)),
'sec' => (int)(date('s',$time)),
'alarm' => (int)($alarm)
);
}
@ -1196,7 +1196,7 @@
$time_param['hour'] -= 12;
}
}
if($time_param['hour'] > 24)
{
$time_param['hour'] -= 12;
@ -1245,7 +1245,7 @@
{
//echo "testing event[participants][uid=$uid] = '".$event['participants'][$uid]."'<br>\n";
if (isset($event['participants'][$uid]) && $event['participants'][$uid] != 'R' &&
$status != 'R')
$status != 'R')
{
return True; // found not rejected participant in event
}
@ -1265,14 +1265,14 @@
$temp_cache_events = $this->cached_events;
}
// $temp_start = intval($GLOBALS['phpgw']->common->show_date($starttime,'Ymd'));
// $temp_start_time = intval($GLOBALS['phpgw']->common->show_date($starttime,'Hi'));
// $temp_end = intval($GLOBALS['phpgw']->common->show_date($endtime,'Ymd'));
// $temp_end_time = intval($GLOBALS['phpgw']->common->show_date($endtime,'Hi'));
$temp_start = intval(date('Ymd',$starttime));
$temp_start_time = intval(date('Hi',$starttime));
$temp_end = intval(date('Ymd',$endtime));
$temp_end_time = intval(date('Hi',$endtime));
// $temp_start = (int)$GLOBALS['phpgw']->common->show_date($starttime,'Ymd');
// $temp_start_time = (int)($GLOBALS['phpgw']->common->show_date($starttime,'Hi');
// $temp_end = (int)$GLOBALS['phpgw']->common->show_date($endtime,'Ymd');
// $temp_end_time = (int)$GLOBALS['phpgw']->common->show_date($endtime,'Hi');
$temp_start = (int)(date('Ymd',$starttime));
$temp_start_time = (int)(date('Hi',$starttime));
$temp_end = (int)(date('Ymd',$endtime));
$temp_end_time = (int)(date('Hi',$endtime));
if($this->debug)
{
echo '<!-- Temp_Start: '.$temp_start.' -->'."\n";
@ -1349,19 +1349,19 @@
echo '<!-- Checking event id #'.$event['id'];
}
$temp_event_start = sprintf("%d%02d",$event['start']['hour'],$event['start']['min']);
$temp_event_end = sprintf("%d%02d",$event['end']['hour'],$event['end']['min']);
$temp_event_end = sprintf("%d%02d",$event['end']['hour'],$event['end']['min']);
// if((($temp_start_time <= $temp_event_start) && ($temp_end_time >= $temp_event_start) && ($temp_end_time <= $temp_event_end)) ||
if(($temp_start_time <= $temp_event_start &&
$temp_end_time > $temp_event_start &&
$temp_end_time <= $temp_event_end ||
$temp_start_time >= $temp_event_start &&
$temp_start_time < $temp_event_end &&
$temp_end_time >= $temp_event_end ||
$temp_start_time <= $temp_event_start &&
$temp_end_time >= $temp_event_end ||
$temp_start_time >= $temp_event_start &&
$temp_end_time <= $temp_event_end) &&
$this->participants_not_rejected($participants,$event))
if(($temp_start_time <= $temp_event_start &&
$temp_end_time > $temp_event_start &&
$temp_end_time <= $temp_event_end ||
$temp_start_time >= $temp_event_start &&
$temp_start_time < $temp_event_end &&
$temp_end_time >= $temp_event_end ||
$temp_start_time <= $temp_event_start &&
$temp_end_time >= $temp_event_end ||
$temp_start_time >= $temp_event_start &&
$temp_end_time <= $temp_event_end) &&
$this->participants_not_rejected($participants,$event))
{
if($this->debug)
{
@ -1393,7 +1393,7 @@
/*!
@function check_perms( )
@syntax check_perms($needed,$event=0,$other=0)
@abstract Checks if the current user has the necessary ACL rights
@abstract Checks if the current user has the necessary ACL rights
@author ralfbecker
@discussion The check is performed on an event or general on the cal of an other user
@param $needed necessary ACL right: PHPGW_ACL_{READ|EDIT|DELETE}
@ -1424,7 +1424,7 @@
}
$user = $GLOBALS['phpgw_info']['user']['account_id'];
$grants = $this->grants[$owner];
if (is_array($event) && $needed == PHPGW_ACL_READ)
{
// Check if the $user is one of the participants or has a read-grant from one of them
@ -1447,7 +1447,7 @@
{
$access = $user == $owner || $grants & $needed && (!$private || $grants & PHPGW_ACL_PRIVATE);
}
//echo "<p>".function_backtrace()." check_perms($needed,$event_id,$other) for user $user and needed_acl $needed: event='$event[title]': owner=$owner, privat=$private, grants=$grants ==> access=$access</p>\n";
//echo "<p>".function_backtrace()." check_perms($needed,$event_id,$other) for user $user and needed_acl $needed: event='$event[title]': owner=$owner, private=$private, grants=$grants ==> access=$access</p>\n";
return $access;
}
@ -1553,7 +1553,7 @@
$last['day'] = $last['mday'];
}
$datefmt = $this->prefs['common']['dateformat'];
$month_before_day = strtolower($datefmt[0]) == 'm' ||
strtolower($datefmt[2]) == 'm' && $datefmt[4] == 'd';
@ -1578,7 +1578,7 @@
return $range;
}
$range .= ' - ';
if ($first['year'] != $last['year'] && $datefmt[0] == 'Y')
{
$range .= $last['year'] . ', ';
@ -1611,14 +1611,14 @@
{
$first = $GLOBALS['phpgw']->datetime->gmtdate($GLOBALS['phpgw']->datetime->get_weekday_start($this->year, $this->month, $this->day));
$last = $GLOBALS['phpgw']->datetime->gmtdate($first['raw'] + 518400);
return ($this->long_date($first,$last));
}
function normalizeminutes(&$minutes)
{
$hour = 0;
$min = intval($minutes);
$min = (int)$minutes;
if($min >= 60)
{
$hour += $min / 60;
@ -1633,9 +1633,9 @@
{
$temp = array('hour','minute','second','ampm');
$time = strrev($time);
$second = intval(strrev(substr($time,0,2)));
$minute = intval(strrev(substr($time,2,2)));
$hour = intval(strrev(substr($time,4)));
$second = (int)(strrev(substr($time,0,2)));
$minute = (int)(strrev(substr($time,2,2)));
$hour = (int)(strrev(substr($time,4)));
$hour += $this->normalizeminutes(&$minute);
$temp['second'] = $second;
$temp['minute'] = $minute;
@ -1647,16 +1647,16 @@
{
return $temp;
}
$temp['ampm'] = 'am';
if ((int)$temp['hour'] > 12)
{
$temp['hour'] = (int)((int)$temp['hour'] - 12);
$temp['ampm'] = 'pm';
}
elseif ((int)$temp['hour'] == 12)
{
}
elseif ((int)$temp['hour'] == 12)
{
$temp['ampm'] = 'pm';
}
}
@ -1671,12 +1671,12 @@
$exceptions = explode(',',$exception_str);
for($exception_count=0;$exception_count<count($exceptions);$exception_count++)
{
$exception[] = intval($exceptions[$exception_count]);
$exception[] = (int)$exceptions[$exception_count];
}
}
elseif($exception_str != '')
{
$exception[] = intval($exception_str);
$exception[] = (int)$exception_str;
}
return $exception;
}
@ -1685,12 +1685,12 @@
{
$time = $this->splittime($fixed_time);
$str = $time['hour'].':'.((int)$time['minute']<=9?'0':'').$time['minute'];
if ($this->prefs['common']['timeformat'] == '12')
{
$str .= ' ' . $time['ampm'];
}
return $str;
}
@ -1699,7 +1699,7 @@
$inserted = False;
if(isset($event['recur_exception']))
{
$event_time = mktime($event['start']['hour'],$event['start']['min'],0,intval(substr($date,4,2)),intval(substr($date,6,2)),intval(substr($date,0,4))) - $GLOBALS['phpgw']->datetime->tz_offset;
$event_time = mktime($event['start']['hour'],$event['start']['min'],0,(int)(substr($date,4,2)),(int)(substr($date,6,2)),(int)(substr($date,0,4))) - $GLOBALS['phpgw']->datetime->tz_offset;
while($inserted == False && list($key,$exception_time) = each($event['recur_exception']))
{
if($this->debug)
@ -2028,7 +2028,7 @@
return;
}
$cache_start = intval(sprintf("%04d%02d%02d",$syear,$smonth,$sday));
$cache_start = (int)(sprintf("%04d%02d%02d",$syear,$smonth,$sday));
if($c_cached_ids)
{
for($i=0;$i<$c_cached_ids;$i++)
@ -2038,15 +2038,15 @@
{
continue; // fetch recuring events only in 2. loop
}
$startdate = intval(date('Ymd',$this->maketime($event['start'])));
$enddate = intval(date('Ymd',$this->maketime($event['end'])));
$startdate = (int)(date('Ymd',$this->maketime($event['start'])));
$enddate = (int)(date('Ymd',$this->maketime($event['end'])));
$this->cached_events[$startdate][] = $event;
if($startdate != $enddate)
{
$start['year'] = intval(substr($startdate,0,4));
$start['month'] = intval(substr($startdate,4,2));
$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']))))
$start['year'] = (int)(substr($startdate,0,4));
$start['month'] = (int)(substr($startdate,4,2));
$start['mday'] = (int)(substr($startdate,6,2));
for($j=$startdate,$k=0;$j<=$enddate;$k++,$j=(int)(date('Ymd',mktime(0,0,0,$start['month'],$start['mday'] + $k,$start['year']))))
{
$c_evt_day = count($this->cached_events[$j]) - 1;
if($c_evt_day < 0)
@ -2206,7 +2206,7 @@
{
foreach(array('year','month','mday','hour','min','sec') as $n => $name)
{
$date[$name] = intval($arr[$n]);
$date[$name] = (int)$arr[$n];
}
return $timestamp ? mktime($date['hour'],$date['min'],$date['sec'],
$date['month'],$date['mday'],$date['year']) : $date;
@ -2234,7 +2234,7 @@
{
return $this->so->get_cached_event();
}
function add_attribute($var,$value,$index='**(**')
{
$this->so->add_attribute($var,$value,$index);
@ -2336,7 +2336,7 @@
for($m=0;$m<$interval;$m++)
{
$minutes = $increment * $m;
if(intval($starttemp['minute']) > $minutes && intval($starttemp['minute']) < ($minutes + $increment))
if((int)$starttemp['minute'] > $minutes && (int)$starttemp['minute'] < ($minutes + $increment))
{
$subminute = ($starttemp['minute'] - $minutes) * 100;
}
@ -2356,17 +2356,17 @@
$end += $addminute;
$starttemp = $this->splittime("$start",False);
$endtemp = $this->splittime("$end",False);
for($h=$starttemp['hour'];$h<=$endtemp['hour'];$h++)
{
$startminute = 0;
$endminute = $interval;
$hour = $h * 10000;
if($h == intval($starttemp['hour']))
if($h == (int)$starttemp['hour'])
{
$startminute = ($starttemp['minute'] / $increment);
}
if($h == intval($endtemp['hour']))
if($h == (int)$endtemp['hour'])
{
$endminute = ($endtemp['minute'] / $increment);
}
@ -2425,7 +2425,7 @@
return True; // always True for now
}
$want_update = 0;
// the following switch fall-through all cases, as each included the following too
//
$msg_is_response = $msg_type == MSG_REJECTED || $msg_type == MSG_ACCEPTED || $msg_type == MSG_TENTATIVE;
@ -2453,7 +2453,7 @@
}
case 'add_cancel':
if ($old_event['owner'] == $userid && $msg_is_response ||
$msg_type == MSG_DELETED || $msg_type == MSG_ADDED)
$msg_type == MSG_DELETED || $msg_type == MSG_ADDED)
{
++$want_update;
}
@ -2495,7 +2495,7 @@
$temp_timeformat = $this->prefs['common']['timeformat'];
$temp_dateformat = $this->prefs['common']['dateformat'];
$tz_offset = ((60 * 60) * intval($temp_tz_offset));
$tz_offset = ((60 * 60) * (int)$temp_tz_offset);
if($old_event != False)
{
@ -2593,7 +2593,7 @@
foreach($to_notify as $userid => $statusid)
{
$userid = intval($userid);
$userid = (int)$userid;
if ($statusid == 'R')
{
@ -2626,7 +2626,7 @@
$GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] = $part_prefs['common']['timeformat'];
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] = $part_prefs['common']['dateformat'];
$GLOBALS['phpgw']->datetime->tz_offset = ((60 * 60) * intval($GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']));
$GLOBALS['phpgw']->datetime->tz_offset = ((60 * 60) * (int)$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset']);
if($old_starttime)
{
@ -2634,7 +2634,7 @@
}
$details['startdate'] = $GLOBALS['phpgw']->common->show_date($starttime);
$details['enddate'] = $GLOBALS['phpgw']->common->show_date($endtime);
list($subject,$body) = split("\n",$GLOBALS['phpgw']->preferences->parse_notify($notify_msg,$details),2);
$subject = $send->encode_subject($subject);
switch($part_prefs['calendar']['update_format'])
@ -2670,7 +2670,7 @@
}
$returncode = $send->msg('email',$to,$subject,$body,''/*$msgtype*/,'','','',$sender, $content_type/*,$boundary*/);
//echo "<p>send(to='$to', sender='$sender'<br>subject='$subject') returncode=$returncode<br>".nl2br($body)."</p>\n";
if (!$returncode) // not nice, but better than failing silently
{
echo '<p><b>bocalendar::send_update</b>: '.lang("Failed sending message to '%1' #%2 subject='%3', sender='%4' !!!",$to,$userid,htmlspecialchars($subject), $sender)."<br>\n";
@ -2681,7 +2681,7 @@
}
}
unset($send);
if((is_int($this->user) && $this->user != $temp_user['account_id']) ||
(is_string($this->user) && $this->user != $temp_user['account_lid']))
{
@ -2692,7 +2692,7 @@
$GLBOALS['phpgw']->datetime->tz_offset = ((60 * 60) * $temp_tz_offset);
$GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] = $temp_timeformat;
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'] = $temp_dateformat;
return $returncode;
}
@ -2764,7 +2764,7 @@
print_debug('Found',$found);
return $found;
}
function prepare_recipients(&$new_event,$old_event)
{
// Find modified and deleted users.....
@ -2773,12 +2773,12 @@
if(isset($new_event['participants'][$old_userid]))
{
print_debug('Modifying event for user',$old_userid);
$this->modified[intval($old_userid)] = $new_status;
$this->modified[(int)$old_userid] = $new_status;
}
else
{
print_debug('Deleting user from the event',$old_userid);
$this->deleted[intval($old_userid)] = $old_status;
$this->deleted[(int)$old_userid] = $old_status;
}
}
// Find new users.....
@ -2791,7 +2791,7 @@
$new_event['participants'][$new_userid] = 'U';
}
}
if(count($this->added) > 0 || count($this->modified) > 0 || count($this->deleted) > 0)
{
if(count($this->added) > 0)
@ -2836,7 +2836,7 @@
}
}
}
function get_dirty_entries($lastmod=-1)
{
$events = false;
@ -2859,7 +2859,7 @@
}
}
unset($rep_event_ids);
return $events;
}
@ -2868,7 +2868,7 @@
echo '<br>UI:';
_debug_array($data);
}
/*!
@function rejected_no_show
@abstract checks if event is rejected from user and he's not the owner and dont want rejected
@ -2877,13 +2877,13 @@
*/
function rejected_no_show($event)
{
$ret = !$this->prefs['calendar']['show_rejected'] &&
$event['owner'] != $this->owner &&
$event['participants'][$this->owner] == 'R';
$ret = !$this->prefs['calendar']['show_rejected'] &&
$event['owner'] != $this->owner &&
$event['participants'][$this->owner] == 'R';
//echo "<p>rejected_no_show($event[title])='$ret': user=$this->owner, event-owner=$event[owner], status='".$event['participants'][$this->owner]."', show_rejected='".$this->prefs['calendar']['show_rejected']."'</p>\n";
return $ret;
}
/*!
@function list_cals
@abstract generate list of user- / group-calendars for the selectbox in the header
@ -2933,7 +2933,7 @@
return $users + $groups; // users first and then groups, both alphabeticaly
}
/*!
@function event2array
@abstract create array with name, translated name and readable content of each attributes of an event
@ -2994,7 +2994,7 @@
$pri = Array(
1 => lang('Low'),
2 => lang('Normal'),
3 => lang('High')
3 => lang('High')
);
$var['priority'] = Array(
'field' => lang('Priority'),
@ -3013,7 +3013,7 @@
$var['access'] = Array(
'field' => lang('Access'),
'data' => $event['public'] ? lang('Public') : lang('Privat')
'data' => $event['public'] ? lang('Public') : lang('Private')
);
if(@isset($event['groups'][0]))

View File

@ -39,16 +39,16 @@
var $start;
var $query;
var $sort;
var $locales = Array();
var $holidays;
var $cached_holidays;
function boholiday()
{
$this->so = CreateObject('calendar.soholiday');
$this->start = intval(get_var('start',array('POST','GET')));
$this->start = (int)get_var('start',array('POST','GET'));
$this->query = get_var('query',array('POST','GET'));
$this->sort = get_var('sort',array('POST','GET'));
$this->order = get_var('order',array('POST','GET'));
@ -59,7 +59,7 @@
{
$this->locales[] = $this->locale;
}
if($this->debug)
{
echo '<-- Locale = '.$this->locales[0].' -->'."\n";
@ -75,7 +75,7 @@
{
echo "BO : Reading Holiday ID : ".$id."<br>\n";
}
if(!$id)
{
if(!$this->id)
@ -112,7 +112,7 @@
$this->ui->admin();
}
}
function delete_locale($locale='')
{
if(!$locale)
@ -153,7 +153,7 @@
}
Header('Location: '.$send_back_to);
}
function get_holiday_list($locale='', $sort='', $order='', $query='', $total='', $year=0)
{
$locale = ($locale?$locale:$this->locales[0]);
@ -194,7 +194,7 @@
{
$this->locales[] = 'US';
}
if($this->owner != $GLOBALS['phpgw_info']['user']['account_id'])
{
$owner_pref = CreateObject('phpgwapi.preferences',$owner);
@ -219,7 +219,7 @@
}
}
}
function auto_load_holidays($locale)
{
if($this->so->holiday_total($locale) == 0)
@ -270,11 +270,11 @@
{
$holiday['locale'] = $holiday[0];
$holiday['name'] = $GLOBALS['phpgw']->db->db_addslashes($holiday[1]);
$holiday['mday'] = intval($holiday[2]);
$holiday['month_num'] = intval($holiday[3]);
$holiday['occurence'] = intval($holiday[4]);
$holiday['dow'] = intval($holiday[5]);
$holiday['observance_rule'] = intval($holiday[6]);
$holiday['mday'] = (int)$holiday[2];
$holiday['month_num'] = (int)$holiday[3];
$holiday['occurence'] = (int)$holiday[4];
$holiday['dow'] = (int)$holiday[5];
$holiday['observance_rule'] = (int)$holiday[6];
$holiday['hol_id'] = 0;
$this->so->save_holiday($holiday);
}
@ -309,7 +309,7 @@
{
$holiday['hol_id'] = $this->bo->id;
}
// some input validation
if (!$holiday['mday'] == !$holiday['occurence'])
@ -322,11 +322,10 @@
}
else
{
$holiday['occurence'] = intval($holiday['occurence'] ? $holiday['occurence'] : $holiday['year']);
$holiday['occurence'] = (int)($holiday['occurence'] ? $holiday['occurence'] : $holiday['year']);
unset($holiday['year']);
}
// Still need to put some validation in here.....
$this->ui = CreateObject('calendar.uiholiday');
@ -385,7 +384,7 @@
if(count($holidays) == 0)
{
return $holidays;
}
}
$temp_locale = $GLOBALS['phpgw_info']['user']['preferences']['common']['country'];
for($i=0;$i<count($holidays);$i++)
@ -421,7 +420,7 @@
Header('Location: ' . $GLOBALS['phpgw']->link('/index.php'));
}
}
function rule_string($holiday)
{
if (!is_array($holiday))

File diff suppressed because it is too large Load Diff

View File

@ -12,310 +12,303 @@
/* $Id$ */
class calendar_holiday
{
var $db;
var $year;
var $tz_offset;
var $holidays = Array();
var $index = Array();
var $users = Array();
var $datetime;
function calendar_holiday($owner='')
class calendar_holiday
{
global $phpgw, $phpgw_info;
var $db;
var $year;
var $tz_offset;
var $holidays = Array();
var $index = Array();
var $users = Array();
var $datetime;
$this->datetime = CreateObject('phpgwapi.datetime');
$this->db = $phpgw->db;
if(@$phpgw_info['user']['preferences']['common']['country'])
function calendar_holiday($owner='')
{
$this->users['user'] = $phpgw_info['user']['preferences']['common']['country'];
}
else
{
$this->users['user'] = 'US';
}
$owner_id = get_account_id($owner);
if($owner_id != $phpgw_info['user']['account_id'])
{
$owner_pref = CreateObject('phpgwapi.preferences',$owner_id);
$owner_prefs = $owner_pref->read_repository();
if(isset($owner_prefs['calendar']['locale']) && $owner_prefs['common']['country'])
$this->datetime = CreateObject('phpgwapi.datetime');
$this->db = $GLOBALS['phpgw']->db;
if(@$GLOBALS['phpgw_info']['user']['preferences']['common']['country'])
{
$this->users['owner'] = $owner_prefs['common']['country'];
$this->users['user'] = $GLOBALS['phpgw_info']['user']['preferences']['common']['country'];
}
else
{
$this->users['owner'] = 'US';
$this->users['user'] = 'US';
}
}
if($phpgw_info['server']['auto_load_holidays'] == True)
{
while(list($key,$value) = each($this->users))
$owner_id = get_account_id($owner);
if($owner_id != $GLOBALS['phpgw_info']['user']['account_id'])
{
$this->is_network_load_needed($value);
}
}
}
function is_network_load_needed($locale)
{
$sql = "SELECT count(*) FROM phpgw_cal_holidays WHERE locale='".$locale."'";
$this->db->query($sql,__LINE__,__FILE__);
$this->db->next_record();
$rows = $this->db->f(0);
if($rows==0)
{
$this->load_from_network($locale);
}
}
function save_holiday($holiday)
{
if(isset($holiday['hol_id']) && $holiday['hol_id'])
{
// echo "Updating LOCALE='".$holiday['locale']."' NAME='".$holiday['name']."' extra=(".$holiday['mday'].'/'.$holiday['month_num'].'/'.$holiday['occurence'].'/'.$holiday['dow'].'/'.$holiday['observance_rule'].")<br>\n";
$sql = "UPDATE phpgw_cal_holidays SET name='".$holiday['name']."', mday=".$holiday['mday'].', month_num='.$holiday['month_num'].', occurence='.$holiday['occurence'].', dow='.$holiday['dow'].', observance_rule='.intval($holiday['observance_rule']).' WHERE hol_id='.$holiday['hol_id'];
}
else
{
// echo "Inserting LOCALE='".$holiday['locale']."' NAME='".$holiday['name']."' extra=(".$holiday['mday'].'/'.$holiday['month_num'].'/'.$holiday['occurence'].'/'.$holiday['dow'].'/'.$holiday['observance_rule'].")<br>\n";
$sql = 'INSERT INTO phpgw_cal_holidays(locale,name,mday,month_num,occurence,dow,observance_rule) '
. "VALUES('".strtoupper($holiday['locale'])."','".$holiday['name']."',".$holiday['mday'].','.$holiday['month_num'].','.$holiday['occurence'].','.$holiday['dow'].','.intval($holiday['observance_rule']).")";
}
$this->db->query($sql,__LINE__,__FILE__);
}
function delete_holiday($id)
{
$sql = 'DELETE FROM phpgw_cal_holidays WHERE hol_id='.$id;
$this->db->query($sql,__LINE__,__FILE__);
}
function delete_locale($locale)
{
$sql = "DELETE FROM phpgw_cal_holidays WHERE locale='".$locale."'";
$this->db->query($sql,__LINE__,__FILE__);
}
function load_from_network($locale)
{
global $phpgw_info, $HTTP_HOST, $SERVER_PORT;
@set_time_limit(0);
// get the file that contains the calendar events for your locale
// "http://www.phpgroupware.org/headlines.rdf";
$network = CreateObject('phpgwapi.network');
if(isset($phpgw_info['server']['holidays_url_path']) && $phpgw_info['server']['holidays_url_path'] != 'localhost')
{
$load_from = $phpgw_info['server']['holidays_url_path'];
}
else
{
$pos = strpos(' '.$phpgw_info['server']['webserver_url'],$HTTP_HOST);
if($pos == 0)
{
switch($SERVER_PORT)
$owner_pref = CreateObject('phpgwapi.preferences',$owner_id);
$owner_prefs = $owner_pref->read_repository();
if(isset($owner_prefs['calendar']['locale']) && $owner_prefs['common']['country'])
{
case 80:
$http_protocol = 'http://';
break;
case 443:
$http_protocol = 'https://';
break;
}
$server_host = $http_protocol.$HTTP_HOST.$phpgw_info['server']['webserver_url'];
}
else
{
$server_host = $phpgw_info['server']['webserver_url'];
}
$load_from = $server_host.'/calendar/setup';
}
// echo 'Loading from: '.$load_from.'/holidays.'.strtoupper($locale)."<br>\n";
$lines = $network->gethttpsocketfile($load_from.'/holidays.'.strtoupper($locale));
if (!$lines) return false;
$c_lines = count($lines);
for($i=0;$i<$c_lines;$i++)
{
// echo 'Line #'.$i.' : '.$lines[$i]."<br>\n";
$holiday = explode("\t",$lines[$i]);
if(count($holiday) == 7)
{
$holiday['locale'] = $holiday[0];
$holiday['name'] = addslashes($holiday[1]);
$holiday['mday'] = intval($holiday[2]);
$holiday['month_num'] = intval($holiday[3]);
$holiday['occurence'] = intval($holiday[4]);
$holiday['dow'] = intval($holiday[5]);
$holiday['observance_rule'] = intval($holiday[6]);
$holiday['hol_id'] = 0;
$this->save_holiday($holiday);
}
}
}
function read_holiday()
{
global $phpgw, $phpgw_info;
$this->year = intval($phpgw->calendar->tempyear);
$sql = $this->build_holiday_query();
if($sql == False)
{ return False;
}
$this->holidays = Null;
$this->db->query($sql,__LINE__,__FILE__);
$i = 0;
$temp_locale = $phpgw_info['user']['preferences']['common']['country'];
while($this->db->next_record())
{
$this->index[$this->db->f('hol_id')] = $i;
$this->holidays[$i]['locale'] = $this->db->f('locale');
$this->holidays[$i]['name'] = $phpgw->strip_html($this->db->f('name'));
$this->holidays[$i]['day'] = intval($this->db->f('mday'));
$this->holidays[$i]['month'] = intval($this->db->f('month_num'));
$this->holidays[$i]['occurence'] = intval($this->db->f('occurence'));
$this->holidays[$i]['dow'] = intval($this->db->f('dow'));
$this->holidays[$i]['observance_rule'] = $this->db->f('observance_rule');
if(count($this->users) == 2 && $this->users[0] != $this->users[1])
{
if($this->holidays[$i]['locale'] == $this->users[1])
{
$this->holidays[$i]['owner'] = 'user';
$this->users['owner'] = $owner_prefs['common']['country'];
}
else
{
$this->holidays[$i]['owner'] = 'owner';
$this->users['owner'] = 'US';
}
}
if($GLOBALS['phpgw_info']['server']['auto_load_holidays'] == True)
{
while(list($key,$value) = each($this->users))
{
$this->is_network_load_needed($value);
}
}
}
function is_network_load_needed($locale)
{
$sql = "SELECT count(*) FROM phpgw_cal_holidays WHERE locale='".$locale."'";
$this->db->query($sql,__LINE__,__FILE__);
$this->db->next_record();
$rows = $this->db->f(0);
if($rows==0)
{
$this->load_from_network($locale);
}
}
function save_holiday($holiday)
{
if(isset($holiday['hol_id']) && $holiday['hol_id'])
{
// echo "Updating LOCALE='".$holiday['locale']."' NAME='".$holiday['name']."' extra=(".$holiday['mday'].'/'.$holiday['month_num'].'/'.$holiday['occurence'].'/'.$holiday['dow'].'/'.$holiday['observance_rule'].")<br>\n";
$sql = "UPDATE phpgw_cal_holidays SET name='".$holiday['name']."', mday=".$holiday['mday'].', month_num='.$holiday['month_num'].', occurence='.$holiday['occurence'].', dow='.$holiday['dow'].', observance_rule='.(int)$holiday['observance_rule'].' WHERE hol_id='.$holiday['hol_id'];
}
else
{
$this->holidays[$i]['owner'] = 'user';
// echo "Inserting LOCALE='".$holiday['locale']."' NAME='".$holiday['name']."' extra=(".$holiday['mday'].'/'.$holiday['month_num'].'/'.$holiday['occurence'].'/'.$holiday['dow'].'/'.$holiday['observance_rule'].")<br>\n";
$sql = 'INSERT INTO phpgw_cal_holidays(locale,name,mday,month_num,occurence,dow,observance_rule) '
. "VALUES('".strtoupper($holiday['locale'])."','".$holiday['name']."',".$holiday['mday'].','.$holiday['month_num'].','.$holiday['occurence'].','.$holiday['dow'].','.(int)$holiday['observance_rule'].")";
}
$c = $i;
$phpgw_info['user']['preferences']['common']['country'] = $this->holidays[$i]['locale'];
$holidaycalc = CreateObject('calendar.holidaycalc');
$this->holidays[$i]['date'] = $holidaycalc->calculate_date($this->holidays[$i], $this->holidays, $this->year, $this->datetime, $c);
unset($holidaycalc);
if($c != $i)
$this->db->query($sql,__LINE__,__FILE__);
}
function delete_holiday($id)
{
$sql = 'DELETE FROM phpgw_cal_holidays WHERE hol_id='.$id;
$this->db->query($sql,__LINE__,__FILE__);
}
function delete_locale($locale)
{
$sql = "DELETE FROM phpgw_cal_holidays WHERE locale='".$locale."'";
$this->db->query($sql,__LINE__,__FILE__);
}
function load_from_network($locale)
{
@set_time_limit(0);
// get the file that contains the calendar events for your locale
// "http://www.phpgroupware.org/headlines.rdf";
$network = CreateObject('phpgwapi.network');
if(isset($GLOBALS['phpgw_info']['server']['holidays_url_path']) && $GLOBALS['phpgw_info']['server']['holidays_url_path'] != 'localhost')
{
$i = $c;
$load_from = $GLOBALS['phpgw_info']['server']['holidays_url_path'];
}
$i++;
}
$this->holidays = $this->sort_by_date($this->holidays);
$phpgw_info['user']['preferences']['common']['country'] = $temp_locale;
return $this->holidays;
}
function build_list_for_submission($locale)
{
global $phpgw;
$i = -1;
$this->db->query("SELECT * FROM phpgw_cal_holidays WHERE locale='".$locale."'");
while($this->db->next_record())
{
$i++;
$holidays[$i]['locale'] = $this->db->f('locale');
$holidays[$i]['name'] = $phpgw->strip_html($this->db->f('name'));
$holidays[$i]['day'] = intval($this->db->f('mday'));
$holidays[$i]['month'] = intval($this->db->f('month_num'));
$holidays[$i]['occurence'] = intval($this->db->f('occurence'));
$holidays[$i]['dow'] = intval($this->db->f('dow'));
$holidays[$i]['observance_rule'] = $this->db->f('observance_rule');
}
return $holidays;
}
function build_holiday_query()
{
if(!isset($this->users) || count($this->users) == 0)
{
return False;
}
$sql = 'SELECT * FROM phpgw_cal_holidays WHERE locale in (';
$find_it = '';
reset($this->users);
while(list($key,$value) = each($this->users))
{
if($find_it)
else
{
$find_it .= ',';
}
$find_it .= "'".$value."'";
}
$sql .= $find_it.')';
return $sql;
}
function sort_by_date($holidays)
{
$c_holidays = count($holidays);
for($outer_loop=0;$outer_loop<($c_holidays - 1);$outer_loop++)
{
$outer_date = $holidays[$outer_loop]['date'];
for($inner_loop=$outer_loop;$inner_loop<$c_holidays;$inner_loop++)
{
$inner_date = $holidays[$inner_loop]['date'];
if($outer_date > $inner_date)
$pos = strpos(' '.$GLOBALS['phpgw_info']['server']['webserver_url'],$_SERVER['HTTP_HOST']);
if($pos == 0)
{
$temp = $holidays[$inner_loop];
$holidays[$inner_loop] = $holidays[$outer_loop];
$holidays[$outer_loop] = $temp;
switch($_SERVER['SERVER_PORT'])
{
case 80:
$http_protocol = 'http://';
break;
case 443:
$http_protocol = 'https://';
break;
}
$server_host = $http_protocol.$_SERVER['HTTP_HOST'].$GLOBALS['phpgw_info']['server']['webserver_url'];
}
else
{
$server_host = $GLOBALS['phpgw_info']['server']['webserver_url'];
}
$load_from = $server_host.'/calendar/setup';
}
// echo 'Loading from: '.$load_from.'/holidays.'.strtoupper($locale)."<br>\n";
$lines = $network->gethttpsocketfile($load_from.'/holidays.'.strtoupper($locale));
if(!$lines)
{
return False;
}
$c_lines = count($lines);
for($i=0;$i<$c_lines;$i++)
{
// echo 'Line #'.$i.' : '.$lines[$i]."<br>\n";
$holiday = explode("\t",$lines[$i]);
if(count($holiday) == 7)
{
$holiday['locale'] = $holiday[0];
$holiday['name'] = addslashes($holiday[1]);
$holiday['mday'] = (int)$holiday[2];
$holiday['month_num'] = (int)$holiday[3];
$holiday['occurence'] = (int)$holiday[4];
$holiday['dow'] = (int)$holiday[5];
$holiday['observance_rule'] = (int)$holiday[6];
$holiday['hol_id'] = 0;
$this->save_holiday($holiday);
}
}
}
return $holidays;
}
function find_date($date)
{
global $phpgw;
if($this->holidays == Null)
function read_holiday()
{
return False;
}
$c_holidays = count($this->holidays);
for($i=0;$i<$c_holidays;$i++)
{
if($this->holidays[$i]['date'] > $date)
$this->year = (int)$GLOBALS['phpgw']->calendar->tempyear;
$sql = $this->build_holiday_query();
if($sql == False)
{
$i = $c_holidays + 1;
return False;
}
elseif($this->holidays[$i]['date'] == $date)
$this->holidays = Null;
$this->db->query($sql,__LINE__,__FILE__);
$i = 0;
$temp_locale = $GLOBALS['phpgw_info']['user']['preferences']['common']['country'];
while($this->db->next_record())
{
$return_value[] = $i;
$this->index[$this->db->f('hol_id')] = $i;
$this->holidays[$i]['locale'] = $this->db->f('locale');
$this->holidays[$i]['name'] = $GLOBALS['phpgw']->strip_html($this->db->f('name'));
$this->holidays[$i]['day'] = (int)$this->db->f('mday');
$this->holidays[$i]['month'] = (int)$this->db->f('month_num');
$this->holidays[$i]['occurence'] = (int)$this->db->f('occurence');
$this->holidays[$i]['dow'] = (int)$this->db->f('dow');
$this->holidays[$i]['observance_rule'] = $this->db->f('observance_rule');
if(count($this->users) == 2 && $this->users[0] != $this->users[1])
{
if($this->holidays[$i]['locale'] == $this->users[1])
{
$this->holidays[$i]['owner'] = 'user';
}
else
{
$this->holidays[$i]['owner'] = 'owner';
}
}
else
{
$this->holidays[$i]['owner'] = 'user';
}
$c = $i;
$GLOBALS['phpgw_info']['user']['preferences']['common']['country'] = $this->holidays[$i]['locale'];
$holidaycalc = CreateObject('calendar.holidaycalc');
$this->holidays[$i]['date'] = $holidaycalc->calculate_date($this->holidays[$i], $this->holidays, $this->year, $this->datetime, $c);
unset($holidaycalc);
if($c != $i)
{
$i = $c;
}
$i++;
}
$this->holidays = $this->sort_by_date($this->holidays);
$GLOBALS['phpgw_info']['user']['preferences']['common']['country'] = $temp_locale;
return $this->holidays;
}
function build_list_for_submission($locale)
{
$i = -1;
$this->db->query("SELECT * FROM phpgw_cal_holidays WHERE locale='".$locale."'");
while($this->db->next_record())
{
$i++;
$holidays[$i]['locale'] = $this->db->f('locale');
$holidays[$i]['name'] = $GLOBALS['phpgw']->strip_html($this->db->f('name'));
$holidays[$i]['day'] = (int)$this->db->f('mday');
$holidays[$i]['month'] = (int)$this->db->f('month_num');
$holidays[$i]['occurence'] = (int)$this->db->f('occurence');
$holidays[$i]['dow'] = (int)$this->db->f('dow');
$holidays[$i]['observance_rule'] = $this->db->f('observance_rule');
}
return $holidays;
}
function build_holiday_query()
{
if(!isset($this->users) || count($this->users) == 0)
{
return False;
}
$sql = 'SELECT * FROM phpgw_cal_holidays WHERE locale in (';
$find_it = '';
reset($this->users);
while(list($key,$value) = each($this->users))
{
if($find_it)
{
$find_it .= ',';
}
$find_it .= "'".$value."'";
}
$sql .= $find_it.')';
return $sql;
}
function sort_by_date($holidays)
{
$c_holidays = count($holidays);
for($outer_loop=0;$outer_loop<($c_holidays - 1);$outer_loop++)
{
$outer_date = $holidays[$outer_loop]['date'];
for($inner_loop=$outer_loop;$inner_loop<$c_holidays;$inner_loop++)
{
$inner_date = $holidays[$inner_loop]['date'];
if($outer_date > $inner_date)
{
$temp = $holidays[$inner_loop];
$holidays[$inner_loop] = $holidays[$outer_loop];
$holidays[$outer_loop] = $temp;
}
}
}
return $holidays;
}
function find_date($date)
{
if($this->holidays == Null)
{
return False;
}
$c_holidays = count($this->holidays);
for($i=0;$i<$c_holidays;$i++)
{
if($this->holidays[$i]['date'] > $date)
{
$i = $c_holidays + 1;
}
elseif($this->holidays[$i]['date'] == $date)
{
$return_value[] = $i;
}
}
// echo 'Searching for '.$GLOBALS['phpgw']->common->show_date($date).' Found = '.count($return_value)."<br>\n";
if(isset($return_value))
{
return $return_value;
}
else
{
return False;
}
}
// echo 'Searching for '.$phpgw->common->show_date($date).' Found = '.count($return_value)."<br>\n";
if(isset($return_value))
function get_holiday($index)
{
return $return_value;
return $this->holidays[$index];
}
else
function get_name($id)
{
return False;
return $this->holidays[$id]['name'];
}
}
function get_holiday($index)
{
return $this->holidays[$index];
}
function get_name($id)
{
return $this->holidays[$id]['name'];
}
}
?>

View File

@ -12,334 +12,330 @@
/* $Id$ */
if (isset($phpgw_info['flags']['included_classes']['calendar_']) &&
$phpgw_info['flags']['included_classes']['calendar_'] == True)
{
return;
}
$phpgw_info['flags']['included_classes']['calendar_'] = True;
class calendar_ extends calendar__
{
function open($calendar='',$user='',$passwd='',$options='')
if (isset($GLOBALS['phpgw_info']['flags']['included_classes']['calendar_']) &&
$GLOBALS['phpgw_info']['flags']['included_classes']['calendar_'] == True)
{
global $phpgw, $phpgw_info;
if($user=='')
{
$user = $phpgw_info['user']['account_lid'];
}
elseif(is_int($user))
{
$this->user = $phpgw->accounts->id2name($user);
}
elseif(is_string($user))
{
$this->user = $user;
}
if($options != '')
{
$this->stream = mcal_open('{'.$phpgw_info['server']['icap_server'].'/'.$phpgw_info['server']['icap_type'].'}'.$calendar,$this->user,$passwd,$options);
}
else
{
$this->stream = mcal_open('{'.$phpgw_info['server']['icap_server'].'/'.$phpgw_info['server']['icap_type'].'}'.$calendar,$this->user,$passwd);
}
return;
}
function popen($calendar='',$user='',$passwd='',$options='')
$GLOBALS['phpgw_info']['flags']['included_classes']['calendar_'] = True;
class calendar_ extends calendar__
{
global $phpgw, $phpgw_info;
if($user=='')
function open($calendar='',$user='',$passwd='',$options='')
{
$this->user = $phpgw_info['user']['account_lid'];
}
elseif(is_int($user))
{
$this->user = $phpgw->accounts->id2name($user);
}
elseif(is_string($user))
{
$this->user = $user;
}
if($options != '')
{
$this->stream = mcal_popen('{'.$phpgw_info['server']['icap_server'].'/'.$phpgw_info['server']['icap_type'].'}'.$calendar,$this->user,$passwd,$options);
}
else
{
$this->stream = mcal_popen('{'.$phpgw_info['server']['icap_server'].'/'.$phpgw_info['server']['icap_type'].'}'.$calendar,$this->user,$passwd);
}
}
function reopen($calendar,$options='')
{
if($options != '')
{
$this->stream = mcal_reopen($calendar,$options);
}
else
{
$this->stream = mcal_reopen($calendar);
}
}
function close($options='')
{
if($options != '')
{
return mcal_close($this->stream,$options);
}
else
{
return mcal_close($this->stream);
}
}
function create_calendar($calendar)
{
return mcal_create_calendar($this->stream,$calendar);
}
function rename_calendar($old_name,$new_name)
{
return mcal_rename_calendar($this->stream,$old_name,$new_name);
}
function delete_calendar($calendar)
{
return mcal_delete_calendar($this->stream,$calendar);
}
function fetch_event($event_id,$options='')
{
if(!isset($this->stream))
{
return False;
}
$this->event = CreateObject('calendar.calendar_item');
if($options != '')
{
$this->event = mcal_fetch_event($this->stream,$event_id,$options);
}
else
{
$this->event = mcal_fetch_event($this->stream,$event_id);
}
// Need to load the $this->event variable with the $event structure from
// the mcal_fetch_event() call
// Use http://www.php.net/manual/en/function.mcal-fetch-event.php as the reference
// This only needs legacy support
return $this->event;
}
function list_events($startYear,$startMonth,$startDay,$endYear='',$endMonth='',$endYear='')
{
if($endYear != '' && $endMonth != '' && $endDay != '')
{
$events = mcal_list_events($this->stream,$startYear,$startMonth,$startDay,$endYear,$endMonth,$endYear);
}
else
{
$events = mcal_list_events($this->stream,$startYear,$startMonth,$startDay);
}
return $events;
}
function append_event()
{
return mcal_append_event($this->stream);
}
function store_event()
{
return mcal_store_event($this->stream);
}
function delete_event($event_id)
{
return mcal_delete_event($this->stream,$event_id);
}
function snooze($event_id)
{
return mcal_snooze($this->stream,$event_id);
}
function list_alarms($begin_year='',$begin_month='',$begin_day='',$end_year='',$end_month='',$end_day='')
{
if($end_day == '')
{
if($end_month == '')
if($user=='')
{
if($end_year == '')
$user = $GLOBALS['phpgw_info']['user']['account_lid'];
}
elseif(is_int($user))
{
$this->user = $GLOBALS['phpgw']->accounts->id2name($user);
}
elseif(is_string($user))
{
$this->user = $user;
}
if($options != '')
{
$this->stream = mcal_open('{'.$GLOBALS['phpgw_info']['server']['icap_server'].'/'.$GLOBALS['phpgw_info']['server']['icap_type'].'}'.$calendar,$this->user,$passwd,$options);
}
else
{
$this->stream = mcal_open('{'.$GLOBALS['phpgw_info']['server']['icap_server'].'/'.$GLOBALS['phpgw_info']['server']['icap_type'].'}'.$calendar,$this->user,$passwd);
}
}
function popen($calendar='',$user='',$passwd='',$options='')
{
if($user=='')
{
$this->user = $GLOBALS['phpgw_info']['user']['account_lid'];
}
elseif(is_int($user))
{
$this->user = $GLOBALS['phpgw']->accounts->id2name($user);
}
elseif(is_string($user))
{
$this->user = $user;
}
if($options != '')
{
$this->stream = mcal_popen('{'.$GLOBALS['phpgw_info']['server']['icap_server'].'/'.$GLOBALS['phpgw_info']['server']['icap_type'].'}'.$calendar,$this->user,$passwd,$options);
}
else
{
$this->stream = mcal_popen('{'.$GLOBALS['phpgw_info']['server']['icap_server'].'/'.$GLOBALS['phpgw_info']['server']['icap_type'].'}'.$calendar,$this->user,$passwd);
}
}
function reopen($calendar,$options='')
{
if($options != '')
{
$this->stream = mcal_reopen($calendar,$options);
}
else
{
$this->stream = mcal_reopen($calendar);
}
}
function close($options='')
{
if($options != '')
{
return mcal_close($this->stream,$options);
}
else
{
return mcal_close($this->stream);
}
}
function create_calendar($calendar)
{
return mcal_create_calendar($this->stream,$calendar);
}
function rename_calendar($old_name,$new_name)
{
return mcal_rename_calendar($this->stream,$old_name,$new_name);
}
function delete_calendar($calendar)
{
return mcal_delete_calendar($this->stream,$calendar);
}
function fetch_event($event_id,$options='')
{
if(!isset($this->stream))
{
return False;
}
$this->event = CreateObject('calendar.calendar_item');
if($options != '')
{
$this->event = mcal_fetch_event($this->stream,$event_id,$options);
}
else
{
$this->event = mcal_fetch_event($this->stream,$event_id);
}
// Need to load the $this->event variable with the $event structure from
// the mcal_fetch_event() call
// Use http://www.php.net/manual/en/function.mcal-fetch-event.php as the reference
// This only needs legacy support
return $this->event;
}
function list_events($startYear,$startMonth,$startDay,$endYear='',$endMonth='',$endYear='')
{
if($endYear != '' && $endMonth != '' && $endDay != '')
{
$events = mcal_list_events($this->stream,$startYear,$startMonth,$startDay,$endYear,$endMonth,$endYear);
}
else
{
$events = mcal_list_events($this->stream,$startYear,$startMonth,$startDay);
}
return $events;
}
function append_event()
{
return mcal_append_event($this->stream);
}
function store_event()
{
return mcal_store_event($this->stream);
}
function delete_event($event_id)
{
return mcal_delete_event($this->stream,$event_id);
}
function snooze($event_id)
{
return mcal_snooze($this->stream,$event_id);
}
function list_alarms($begin_year='',$begin_month='',$begin_day='',$end_year='',$end_month='',$end_day='')
{
if($end_day == '')
{
if($end_month == '')
{
if($begin_day == '')
if($end_year == '')
{
if($begin_month == '')
if($begin_day == '')
{
if($begin_year == '')
if($begin_month == '')
{
return mcal_list_alarms($this->stream);
if($begin_year == '')
{
return mcal_list_alarms($this->stream);
}
else
{
return mcal_list_alarms($this->stream,$begin_year);
}
}
else
{
return mcal_list_alarms($this->stream,$begin_year);
return mcal_list_alarms($this->stream,$begin_year,$begin_month);
}
}
else
{
return mcal_list_alarms($this->stream,$begin_year,$begin_month);
return mcal_list_alarms($this->stream,$begin_year,$begin_month,$begin_day);
}
}
else
{
return mcal_list_alarms($this->stream,$begin_year,$begin_month,$begin_day);
return mcal_list_alarms($this->stream,$begin_year,$begin_month,$begin_day,$end_year);
}
}
else
{
return mcal_list_alarms($this->stream,$begin_year,$begin_month,$begin_day,$end_year);
return mcal_list_alarms($this->stream,$begin_year,$begin_month,$begin_day,$end_year,$end_month);
}
}
else
{
return mcal_list_alarms($this->stream,$begin_year,$begin_month,$begin_day,$end_year,$end_month);
return mcal_list_alarms($this->stream,$begin_year,$begin_month,$begin_day,$end_year,$end_month,$end_day);
}
}
else
function event_init()
{
return mcal_list_alarms($this->stream,$begin_year,$begin_month,$begin_day,$end_year,$end_month,$end_day);
$this->event = CreateObject('calendar.calendar_item');
return mcal_event_init($this->stream);
}
function set_category($category='')
{
calendar__::set_category($category);
return mcal_event_set_category($this->stream,$category);
}
function set_title($title='')
{
calendar__::set_title($title);
return mcal_event_set_title($this->stream,$title);
}
function set_description($description='')
{
calendar__::set_description($description);
return mcal_event_set_description($this->stream,$description);
}
function set_start($year,$month,$day=0,$hour=0,$min=0,$sec=0)
{
calendar__::set_start($year,$month,$day,$hour,$min,$sec);
return mcal_event_set_start($this->stream,$year,$month,$day,$hour,$min,$sec);
}
function set_end($year,$month,$day=0,$hour=0,$min=0,$sec=0)
{
calendar__::set_end($year,$month,$day,$hour,$min,$sec);
return mcal_event_set_end($this->stream,$year,$month,$day,$hour,$min,$sec);
}
function set_alarm($alarm)
{
calendar__::set_alarm($alarm);
return mcal_event_set_alarm ($this->stream,$alarm);
}
function set_class($class)
{
calendar__::set_class($class);
return mcal_event_set_class($this->stream,$class);
}
// The function definition doesn't look correct...
// Need more information for this function
function next_recurrence($weekstart,$next)
{
return mcal_next_recurrence($this->stream,$weekstart,$next);
}
function set_recur_none()
{
calendar__::set_recur_none();
return mcal_event_set_recur_none($this->stream);
}
function set_recur_daily($year,$month,$day,$interval)
{
calendar__::set_recur_daily($year,$month,$day,$interval);
return mcal_event_set_recur_daily($this->stream,$year,$month,$day,$interval);
}
function set_recur_weekly($year,$month,$day,$interval,$weekdays)
{
calendar__::set_recur_weekly($year,$month,$day,$interval,$weekdays);
return mcal_event_set_recur_weekly($this->stream,$year,$month,$day,$interval,$weekdays);
}
function set_recur_monthly_mday($year,$month,$day,$interval)
{
calendar__::set_recur_monthly_mday($year,$month,$day,$interval);
return mcal_event_set_recur_monthly_mday($this->stream,$year,$month,$day,$interval);
}
function set_recur_monthly_wday($year,$month,$day,$interval)
{
calendar__::set_recur_monthly_wday($year,$month,$day,$interval);
return mcal_event_set_recur_monthly_wday($this->stream,$year,$month,$day,$interval);
}
function set_recur_yearly($year,$month,$day,$interval)
{
calendar__::set_recur_yearly($year,$month,$day,$interval);
return mcal_event_set_recur_yearly($this->stream,$year,$month,$day,$interval);
}
function fetch_current_stream_event()
{
$this->event = mcal_fetch_current_stream_event($this->stream);
return $this->event
}
function add_attribute($attribute,$value)
{
calendar__::add_attribute($attribute,$value);
return mcal_event_add_attribute($this->stream,$attribute,$value);
}
function expunge()
{
return mcal_expunge($this->stream);
}
/**************** Local functions for ICAL based Calendar *****************/
function set_status($id,$owner,$status)
{
$status_code_short = Array(
REJECTED => 'R',
NO_RESPONSE => 'U',
TENTATIVE => 'T',
ACCEPTED => 'A'
);
$this->add_attribute('status['.$owner.']',$status_code_short[$status]);
// $this->stream->query("UPDATE calendar_entry_user SET cal_status='".$status_code_short[$status]."' WHERE cal_id=".$id." AND cal_login=".$owner,__LINE__,__FILE__);
return True;
}
}
function event_init()
{
$this->event = CreateObject('calendar.calendar_item');
return mcal_event_init($this->stream);
}
function set_category($category='')
{
calendar__::set_category($category);
return mcal_event_set_category($this->stream,$category);
}
function set_title($title='')
{
calendar__::set_title($title);
return mcal_event_set_title($this->stream,$title);
}
function set_description($description='')
{
calendar__::set_description($description);
return mcal_event_set_description($this->stream,$description);
}
function set_start($year,$month,$day=0,$hour=0,$min=0,$sec=0)
{
calendar__::set_start($year,$month,$day,$hour,$min,$sec);
return mcal_event_set_start($this->stream,$year,$month,$day,$hour,$min,$sec);
}
function set_end($year,$month,$day=0,$hour=0,$min=0,$sec=0)
{
calendar__::set_end($year,$month,$day,$hour,$min,$sec);
return mcal_event_set_end($this->stream,$year,$month,$day,$hour,$min,$sec);
}
function set_alarm($alarm)
{
calendar__::set_alarm($alarm);
return mcal_event_set_alarm ($this->stream,$alarm);
}
function set_class($class)
{
calendar__::set_class($class);
return mcal_event_set_class($this->stream,$class);
}
// The function definition doesn't look correct...
// Need more information for this function
function next_recurrence($weekstart,$next)
{
return mcal_next_recurrence($this->stream,$weekstart,$next);
}
function set_recur_none()
{
calendar__::set_recur_none();
return mcal_event_set_recur_none($this->stream);
}
function set_recur_daily($year,$month,$day,$interval)
{
calendar__::set_recur_daily($year,$month,$day,$interval);
return mcal_event_set_recur_daily($this->stream,$year,$month,$day,$interval);
}
function set_recur_weekly($year,$month,$day,$interval,$weekdays)
{
calendar__::set_recur_weekly($year,$month,$day,$interval,$weekdays);
return mcal_event_set_recur_weekly($this->stream,$year,$month,$day,$interval,$weekdays);
}
function set_recur_monthly_mday($year,$month,$day,$interval)
{
calendar__::set_recur_monthly_mday($year,$month,$day,$interval);
return mcal_event_set_recur_monthly_mday($this->stream,$year,$month,$day,$interval);
}
function set_recur_monthly_wday($year,$month,$day,$interval)
{
calendar__::set_recur_monthly_wday($year,$month,$day,$interval);
return mcal_event_set_recur_monthly_wday($this->stream,$year,$month,$day,$interval);
}
function set_recur_yearly($year,$month,$day,$interval)
{
calendar__::set_recur_yearly($year,$month,$day,$interval);
return mcal_event_set_recur_yearly($this->stream,$year,$month,$day,$interval);
}
function fetch_current_stream_event()
{
$this->event = mcal_fetch_current_stream_event($this->stream);
return $this->event
}
function add_attribute($attribute,$value)
{
calendar__::add_attribute($attribute,$value);
return mcal_event_add_attribute($this->stream,$attribute,$value);
}
function expunge()
{
return mcal_expunge($this->stream);
}
/**************** Local functions for ICAL based Calendar *****************/
function set_status($id,$owner,$status)
{
$status_code_short = Array(
REJECTED => 'R',
NO_RESPONSE => 'U',
TENTATIVE => 'T',
ACCEPTED => 'A'
);
$this->add_attribute('status['.$owner.']',$status_code_short[$status]);
// $this->stream->query("UPDATE calendar_entry_user SET cal_status='".$status_code_short[$status]."' WHERE cal_id=".$id." AND cal_login=".$owner,__LINE__,__FILE__);
return True;
}
}

View File

@ -1,4 +1,4 @@
<?php
<?php
/**************************************************************************\
* phpGroupWare - holidaycalc_JP *
* http://www.phpgroupware.org *
@ -13,141 +13,141 @@
/* $Id$ */
class holidaycalc {
function calculate_date($holiday, &$holidays, $year, &$i)
class holidaycalc
{
static $cached_month;
static $cached_day;
static $cached_observance_rule;
if ($holiday['day'] == 0 && $holiday['dow'] != 0 && $holiday['occurence'] != 0)
function calculate_date($holiday, &$holidays, $year, &$i)
{
$dow = $GLOBALS['phpgw']->datetime->day_of_week($year, $holiday['month'], 1);
$dayshift = (($holiday['dow'] + 7) - $dow) % 7;
$day = ($holiday['occurence'] - 1) * 7 + $dayshift + 1;
static $cached_month;
static $cached_day;
static $cached_observance_rule;
// Happy monday law.
if ($holiday['month'] == 1)
if ($holiday['day'] == 0 && $holiday['dow'] != 0 && $holiday['occurence'] != 0)
{
if ($year < 2000)
$dow = $GLOBALS['phpgw']->datetime->day_of_week($year, $holiday['month'], 1);
$dayshift = (($holiday['dow'] + 7) - $dow) % 7;
$day = ($holiday['occurence'] - 1) * 7 + $dayshift + 1;
// Happy monday law.
if ($holiday['month'] == 1)
{
$day = 15;
if ($year < 2000)
{
$day = 15;
}
}
elseif ($holiday['month'] == 7)
{
if ($year < 2003)
{
$day = 20;
}
}
elseif ($holiday['month'] == 9)
{
if ($year < 2003)
{
$day = 15;
}
}
elseif ($holiday['month'] == 10)
{
if ($year < 2000)
{
$day = 10;
}
}
}
elseif ($holiday['month'] == 7)
elseif ($holiday['day'] == 0 && $holiday['dow'] == 0 && $holiday['occurence'] == 0)
{
if ($year < 2003)
// For the next generation.
// over 2151, please set $factor...
if ($holiday['month'] == 3)
{
$day = 20;
// for Vernal Equinox
if ($year >= 1980 && $year <= 2099)
{
$factor = 20.8431;
}
elseif ($year >= 2100 && $year <= 2150)
{
$factor = 21.851;
}
}
elseif ($holiday['month'] == 9)
{
// for Autumnal Equinox
if ($year >= 1980 && $year <= 2099)
{
$factor = 23.2488;
}
elseif ($year >= 2100 && $year <= 2150)
{
$factor = 24.2488;
}
}
$day = (int)($factor + 0.242194 * ($year - 1980)
- (int)(($year - 1980) / 4));
}
elseif ($holiday['month'] == 9)
else
{
if ($year < 2003)
{
$day = 15;
}
// normal holiday
$day = $holiday['day'];
}
elseif ($holiday['month'] == 10)
if ($year >= 1985 && $holiday['month'] == $cached_month && $day == $cached_day + 2 && $cached_observance_rule == True && $holiday['observance_rule'] == True)
{
if ($year < 2000)
$pdow = $GLOBALS['phpgw']->datetime->day_of_week($year,$holiday['month'],$day-1);
if ($pdow != 0)
{
$day = 10;
}
}
}
elseif ($holiday['day'] == 0 && $holiday['dow'] == 0 && $holiday['occurence'] == 0)
{
// For the next generation.
// over 2151, please set $factor...
if ($holiday['month'] == 3)
{
// for Vernal Equinox
if ($year >= 1980 && $year <= 2099)
{
$factor = 20.8431;
}
elseif ($year >= 2100 && $year <= 2150)
{
$factor = 21.851;
}
}
elseif ($holiday['month'] == 9)
{
// for Autumnal Equinox
if ($year >= 1980 && $year <= 2099)
{
$factor = 23.2488;
}
elseif ($year >= 2100 && $year <= 2150)
{
$factor = 24.2488;
$addcnt = count($holidays) + 1;
$holidays[$addcnt]['locale'] = $holiday['locale'];
if ($pdow == 1)
{
$holidays[$addcnt]['name'] = lang('overlap holiday');
}
else
{
$holidays[$addcnt]['name'] = lang('people holiday');
}
$holidays[$addcnt]['day'] = $day - 1;
$holidays[$addcnt]['month'] = $holiday['month'];
$holidays[$addcnt]['occurence'] = 0;
$holidays[$addcnt]['dow'] = 0;
$holidays[$addcnt]['date'] = mktime(0,0,0,$holiday['month'],$day-1,$year);
$holidays[$addcnt]['observance_rule'] = 0;
}
}
$day = (int)($factor + 0.242194 * ($year - 1980)
- (int)(($year - 1980) / 4));
}
else
{
// normal holiday
$day = $holiday['day'];
}
$cached_month = $holiday['month'];
$cached_day = $day;
$cached_observance_rule = $holiday['observance_rule'];
if ($year >= 1985 && $holiday['month'] == $cached_month && $day == $cached_day + 2 && $cached_observance_rule == True && $holiday['observance_rule'] == True)
{
$pdow = $GLOBALS['phpgw']->datetime->day_of_week($year,$holiday['month'],$day-1);
if ($pdow != 0)
if ($year >= 1985 && $holiday['month'] == 5 && $day == 3)
{
$addcnt = count($holidays) + 1;
$holidays[$addcnt]['locale'] = $holiday['locale'];
if ($pdow == 1)
;
}
elseif ($holiday['observance_rule'] == True)
{
$dow = $GLOBALS['phpgw']->datetime->day_of_week($year,$holiday['month'],$day);
// This now calulates Observed holidays and creates a new entry for them.
if($dow == 0)
{
$addcnt = count($holidays) + 1;
$holidays[$addcnt]['locale'] = $holiday['locale'];
$holidays[$addcnt]['name'] = lang('overlap holiday');
$holidays[$addcnt]['day'] = $day + 1;
$holidays[$addcnt]['month'] = $holiday['month'];
$holidays[$addcnt]['occurence'] = $holiday['occurence'];
$holidays[$addcnt]['dow'] = $holiday['dow'];
$holidays[$addcnt]['date'] = mktime(0,0,0,$holiday['month'],$day+1,$year);
$holidays[$addcnt]['observance_rule'] = 0;
}
else
{
$holidays[$addcnt]['name'] = lang('people holiday');
}
$holidays[$addcnt]['day'] = $day - 1;
$holidays[$addcnt]['month'] = $holiday['month'];
$holidays[$addcnt]['occurence'] = 0;
$holidays[$addcnt]['dow'] = 0;
$holidays[$addcnt]['date'] = mktime(0,0,0,$holiday['month'],$day-1,$year);
$holidays[$addcnt]['observance_rule'] = 0;
}
$date = mktime(0,0,0,$holiday['month'],$day,$year);
return $date;
}
$cached_month = $holiday['month'];
$cached_day = $day;
$cached_observance_rule = $holiday['observance_rule'];
if ($year >= 1985 && $holiday['month'] == 5 && $day == 3)
{
;
}
elseif ($holiday['observance_rule'] == True)
{
$dow = $GLOBALS['phpgw']->datetime->day_of_week($year,$holiday['month'],$day);
// This now calulates Observed holidays and creates a new entry for them.
if($dow == 0)
{
$addcnt = count($holidays) + 1;
$holidays[$addcnt]['locale'] = $holiday['locale'];
$holidays[$addcnt]['name'] = lang('overlap holiday');
$holidays[$addcnt]['day'] = $day + 1;
$holidays[$addcnt]['month'] = $holiday['month'];
$holidays[$addcnt]['occurence'] = $holiday['occurence'];
$holidays[$addcnt]['dow'] = $holiday['dow'];
$holidays[$addcnt]['date'] = mktime(0,0,0,$holiday['month'],$day+1,$year);
$holidays[$addcnt]['observance_rule'] = 0;
}
}
$date = mktime(0,0,0,$holiday['month'],$day,$year);
return $date;
}
}
?>

View File

@ -1,4 +1,4 @@
<?php
<?php
/**************************************************************************\
* phpGroupWare - holidaycalc_US *
* http://www.phpgroupware.org *
@ -13,73 +13,73 @@
/* $Id$ */
class holidaycalc {
function calculate_date($holiday, &$holidays, $year, &$i)
class holidaycalc
{
// if($holiday['day'] == 0 && $holiday['dow'] != 0 && $holiday['occurence'] != 0)
if($holiday['day'] == 0 && $holiday['occurence'] != 0)
function calculate_date($holiday, &$holidays, $year, &$i)
{
if($holiday['occurence'] != 99)
// if($holiday['day'] == 0 && $holiday['dow'] != 0 && $holiday['occurence'] != 0)
if($holiday['day'] == 0 && $holiday['occurence'] != 0)
{
$dow = $GLOBALS['phpgw']->datetime->day_of_week($year,$holiday['month'],1);
$day = (((7 * $holiday['occurence']) - 6) + ((($holiday['dow'] + 7) - $dow) % 7));
$day += ($day < 1 ? 7 : 0);
// What is the point of this?
// Add 7 when the holiday falls on a Monday???
//$day += ($holiday['dow']==1 ? 7 : 0);
// Sometimes the 5th occurance of a weekday (ie the 5th monday)
// can spill over to the next month. This prevents that.
$ld = $GLOBALS['phpgw']->datetime->days_in_month($holiday['month'],$year);
if ($day > $ld)
if($holiday['occurence'] != 99)
{
return;
$dow = $GLOBALS['phpgw']->datetime->day_of_week($year,$holiday['month'],1);
$day = (((7 * $holiday['occurence']) - 6) + ((($holiday['dow'] + 7) - $dow) % 7));
$day += ($day < 1 ? 7 : 0);
// What is the point of this?
// Add 7 when the holiday falls on a Monday???
//$day += ($holiday['dow']==1 ? 7 : 0);
// Sometimes the 5th occurance of a weekday (ie the 5th monday)
// can spill over to the next month. This prevents that.
$ld = $GLOBALS['phpgw']->datetime->days_in_month($holiday['month'],$year);
if ($day > $ld)
{
return;
}
}
else
{
$ld = $GLOBALS['phpgw']->datetime->days_in_month($holiday['month'],$year);
$dow = $GLOBALS['phpgw']->datetime->day_of_week($year,$holiday['month'],$ld);
$day = $ld - (($dow + 7) - $holiday['dow']) % 7 ;
}
}
else
{
$ld = $GLOBALS['phpgw']->datetime->days_in_month($holiday['month'],$year);
$dow = $GLOBALS['phpgw']->datetime->day_of_week($year,$holiday['month'],$ld);
$day = $ld - (($dow + 7) - $holiday['dow']) % 7 ;
}
}
else
{
$day = $holiday['day'];
if($holiday['observance_rule'] == True)
{
$dow = $GLOBALS['phpgw']->datetime->day_of_week($year,$holiday['month'],$day);
// This now calulates Observed holidays and creates a new entry for them.
if($dow == 0)
$day = $holiday['day'];
if($holiday['observance_rule'] == True)
{
$i++;
$holidays[$i]['locale'] = $holiday['locale'];
$holidays[$i]['name'] = $holiday['name'].' (Observed)';
$holidays[$i]['day'] = $holiday['day'] + 1;
$holidays[$i]['month'] = $holiday['month'];
$holidays[$i]['occurence'] = $holiday['occurence'];
$holidays[$i]['dow'] = $holiday['dow'];
$holidays[$i]['date'] = mktime(0,0,0,$holiday['month'],$day+1,$year);
$holidays[$i]['obervance_rule'] = 0;
}
elseif($dow == 6)
{
$i++;
$holidays[$i]['locale'] = $holiday['locale'];
$holidays[$i]['name'] = $holiday['name'].' (Observed)';
$holidays[$i]['day'] = $holiday['day'] - 1;
$holidays[$i]['month'] = $holiday['month'];
$holidays[$i]['occurence'] = $holiday['occurence'];
$holidays[$i]['dow'] = $holiday['dow'];
$holidays[$i]['date'] = mktime(0,0,0,$holiday['month'],$day-1,$year);
$holidays[$i]['obervance_rule'] = 0;
$dow = $GLOBALS['phpgw']->datetime->day_of_week($year,$holiday['month'],$day);
// This now calulates Observed holidays and creates a new entry for them.
if($dow == 0)
{
$i++;
$holidays[$i]['locale'] = $holiday['locale'];
$holidays[$i]['name'] = $holiday['name'].' (Observed)';
$holidays[$i]['day'] = $holiday['day'] + 1;
$holidays[$i]['month'] = $holiday['month'];
$holidays[$i]['occurence'] = $holiday['occurence'];
$holidays[$i]['dow'] = $holiday['dow'];
$holidays[$i]['date'] = mktime(0,0,0,$holiday['month'],$day+1,$year);
$holidays[$i]['obervance_rule'] = 0;
}
elseif($dow == 6)
{
$i++;
$holidays[$i]['locale'] = $holiday['locale'];
$holidays[$i]['name'] = $holiday['name'].' (Observed)';
$holidays[$i]['day'] = $holiday['day'] - 1;
$holidays[$i]['month'] = $holiday['month'];
$holidays[$i]['occurence'] = $holiday['occurence'];
$holidays[$i]['dow'] = $holiday['dow'];
$holidays[$i]['date'] = mktime(0,0,0,$holiday['month'],$day-1,$year);
$holidays[$i]['obervance_rule'] = 0;
}
}
}
}
$date = mktime(0,0,0,$holiday['month'],$day,$year);
$date = mktime(0,0,0,$holiday['month'],$day,$year);
return $date;
return $date;
}
}
}
?>

View File

@ -55,7 +55,7 @@
function open_box($owner)
{
$this->cal->open('INBOX',intval($owner));
$this->cal->open('INBOX',(int)$owner);
}
function maketime($time)
@ -90,7 +90,7 @@
$owner_id = $this->is_group ? $this->g_owner : $this->owner;
}
if($GLOBALS['phpgw_info']['server']['calendar_type'] != 'sql' ||
!count($owner_id)) // happens with empty groups
!count($owner_id)) // happens with empty groups
{
return Array();
}
@ -130,7 +130,7 @@
$members[] = $this->owner;
}
$sql = 'AND (phpgw_cal_user.cal_login IN ('.implode(',',$members).')) AND '.
'(phpgw_cal_user.cal_login='.intval($this->owner).' OR phpgw_cal.is_public=1) AND (';
'(phpgw_cal_user.cal_login=' . (int)$this->owner . ' OR phpgw_cal.is_public=1) AND (';
$words = split(' ',$keywords);
foreach($words as $i => $word)
@ -286,7 +286,7 @@
{
while($this->cal->next_record())
{
$arr[] = intval($this->cal->f('datetime'));
$arr[] = (int)$this->cal->f('datetime');
}
}
if(count($arr) == 0)

View File

@ -14,187 +14,187 @@
/* $Id$ */
if (@$GLOBALS['phpgw_info']['flags']['included_classes']['socalendar__'])
{
return;
}
$GLOBALS['phpgw_info']['flags']['included_classes']['socalendar__'] = True;
/* include(PHPGW_SERVER_ROOT.'/calendar/setup/setup.inc.php'); */
if(extension_loaded('mcal') == False)
{
define('MCAL_RECUR_NONE',0);
define('MCAL_RECUR_DAILY',1);
define('MCAL_RECUR_WEEKLY',2);
define('MCAL_RECUR_MONTHLY_MDAY',3);
define('MCAL_RECUR_MONTHLY_WDAY',4);
define('MCAL_RECUR_YEARLY',5);
define('MCAL_M_SUNDAY',1);
define('MCAL_M_MONDAY',2);
define('MCAL_M_TUESDAY',4);
define('MCAL_M_WEDNESDAY',8);
define('MCAL_M_THURSDAY',16);
define('MCAL_M_FRIDAY',32);
define('MCAL_M_SATURDAY',64);
define('MCAL_M_WEEKDAYS',62);
define('MCAL_M_WEEKEND',65);
define('MCAL_M_ALLDAYS',127);
}
define('MSG_DELETED',0);
define('MSG_MODIFIED',1);
define('MSG_ADDED',2);
define('MSG_REJECTED',3);
define('MSG_TENTATIVE',4);
define('MSG_ACCEPTED',5);
define('MSG_ALARM',6);
define('REJECTED',0);
define('NO_RESPONSE',1);
define('TENTATIVE',2);
define('ACCEPTED',3);
class socalendar__
{
var $event;
var $stream;
var $user;
var $users_status;
var $debug = False;
// var $debug = True;
function socalendar__()
if (@$GLOBALS['phpgw_info']['flags']['included_classes']['socalendar__'])
{
return;
}
function maketime($time)
$GLOBALS['phpgw_info']['flags']['included_classes']['socalendar__'] = True;
/* include(PHPGW_SERVER_ROOT.'/calendar/setup/setup.inc.php'); */
if(extension_loaded('mcal') == False)
{
return mktime($time['hour'],$time['min'],$time['sec'],$time['month'],$time['mday'],$time['year']);
define('MCAL_RECUR_NONE',0);
define('MCAL_RECUR_DAILY',1);
define('MCAL_RECUR_WEEKLY',2);
define('MCAL_RECUR_MONTHLY_MDAY',3);
define('MCAL_RECUR_MONTHLY_WDAY',4);
define('MCAL_RECUR_YEARLY',5);
define('MCAL_M_SUNDAY',1);
define('MCAL_M_MONDAY',2);
define('MCAL_M_TUESDAY',4);
define('MCAL_M_WEDNESDAY',8);
define('MCAL_M_THURSDAY',16);
define('MCAL_M_FRIDAY',32);
define('MCAL_M_SATURDAY',64);
define('MCAL_M_WEEKDAYS',62);
define('MCAL_M_WEEKEND',65);
define('MCAL_M_ALLDAYS',127);
}
function get_cached_event()
{
return $this->event;
}
define('MSG_DELETED',0);
define('MSG_MODIFIED',1);
define('MSG_ADDED',2);
define('MSG_REJECTED',3);
define('MSG_TENTATIVE',4);
define('MSG_ACCEPTED',5);
define('MSG_ALARM',6);
function event_init()
{
$this->event = Array();
$this->add_attribute('owner',intval($this->user));
}
define('REJECTED',0);
define('NO_RESPONSE',1);
define('TENTATIVE',2);
define('ACCEPTED',3);
function set_category($category='')
class socalendar__
{
$this->add_attribute('category',$category);
}
var $event;
var $stream;
var $user;
var $users_status;
var $debug = False;
// var $debug = True;
function set_title($title='')
{
$this->add_attribute('title',$title);
}
function set_description($description='')
{
$this->add_attribute('description',$description);
}
function set_date($element,$year,$month,$day=0,$hour=0,$min=0,$sec=0)
{
$this->add_attribute($element,intval($year),'year');
$this->add_attribute($element,intval($month),'month');
$this->add_attribute($element,intval($day),'mday');
$this->add_attribute($element,intval($hour),'hour');
$this->add_attribute($element,intval($min),'min');
$this->add_attribute($element,intval($sec),'sec');
$this->add_attribute($element,0,'alarm');
}
function set_start($year,$month,$day=0,$hour=0,$min=0,$sec=0)
{
$this->set_date('start',$year,$month,$day,$hour,$min,$sec);
}
function set_end($year,$month,$day=0,$hour=0,$min=0,$sec=0)
{
$this->set_date('end',$year,$month,$day,$hour,$min,$sec);
}
function set_alarm($alarm)
{
$this->add_attribute('alarm',intval($alarm));
}
function set_class($class)
{
$this->add_attribute('public',$class);
}
function set_common_recur($year=0,$month=0,$day=0,$interval=0)
{
$this->add_attribute('recur_interval',intval($interval));
$this->set_date('recur_enddate',$year,$month,$day,0,0,0);
$this->add_attribute('recur_data',0);
}
function set_recur_none()
{
$this->set_common_recur(0,0,0,0);
$this->add_attribute('recur_type',MCAL_RECUR_NONE);
}
function set_recur_daily($year,$month,$day,$interval)
{
$this->set_common_recur(intval($year),intval($month),intval($day),$interval);
$this->add_attribute('recur_type',MCAL_RECUR_DAILY);
}
function set_recur_weekly($year,$month,$day,$interval,$weekdays)
{
$this->set_common_recur(intval($year),intval($month),intval($day),$interval);
$this->add_attribute('recur_type',MCAL_RECUR_WEEKLY);
$this->add_attribute('recur_data',intval($weekdays));
}
function set_recur_monthly_mday($year,$month,$day,$interval)
{
$this->set_common_recur(intval($year),intval($month),intval($day),$interval);
$this->add_attribute('recur_type',MCAL_RECUR_MONTHLY_MDAY);
}
function set_recur_monthly_wday($year,$month,$day,$interval)
{
$this->set_common_recur(intval($year),intval($month),intval($day),$interval);
$this->add_attribute('recur_type',MCAL_RECUR_MONTHLY_WDAY);
}
function set_recur_yearly($year,$month,$day,$interval)
{
$this->set_common_recur(intval($year),intval($month),intval($day),$interval);
$this->add_attribute('recur_type',MCAL_RECUR_YEARLY);
}
function fetch_current_stream_event()
{
return $this->fetch_event($this->event['id']);
}
function add_attribute($attribute,$value,$element='**(**')
{
if(is_array($value))
function socalendar__()
{
reset($value);
}
if($element!='**(**')
function maketime($time)
{
$this->event[$attribute][$element] = $value;
return mktime($time['hour'],$time['min'],$time['sec'],$time['month'],$time['mday'],$time['year']);
}
else
function get_cached_event()
{
$this->event[$attribute] = $value;
return $this->event;
}
function event_init()
{
$this->event = Array();
$this->add_attribute('owner',(int)$this->user);
}
function set_category($category='')
{
$this->add_attribute('category',$category);
}
function set_title($title='')
{
$this->add_attribute('title',$title);
}
function set_description($description='')
{
$this->add_attribute('description',$description);
}
function set_date($element,$year,$month,$day=0,$hour=0,$min=0,$sec=0)
{
$this->add_attribute($element,(int)$year,'year');
$this->add_attribute($element,(int)$month,'month');
$this->add_attribute($element,(int)$day,'mday');
$this->add_attribute($element,(int)$hour,'hour');
$this->add_attribute($element,(int)$min,'min');
$this->add_attribute($element,(int)$sec,'sec');
$this->add_attribute($element,0,'alarm');
}
function set_start($year,$month,$day=0,$hour=0,$min=0,$sec=0)
{
$this->set_date('start',$year,$month,$day,$hour,$min,$sec);
}
function set_end($year,$month,$day=0,$hour=0,$min=0,$sec=0)
{
$this->set_date('end',$year,$month,$day,$hour,$min,$sec);
}
function set_alarm($alarm)
{
$this->add_attribute('alarm',(int)$alarm);
}
function set_class($class)
{
$this->add_attribute('public',$class);
}
function set_common_recur($year=0,$month=0,$day=0,$interval=0)
{
$this->add_attribute('recur_interval',(int)$interval);
$this->set_date('recur_enddate',$year,$month,$day,0,0,0);
$this->add_attribute('recur_data',0);
}
function set_recur_none()
{
$this->set_common_recur(0,0,0,0);
$this->add_attribute('recur_type',MCAL_RECUR_NONE);
}
function set_recur_daily($year,$month,$day,$interval)
{
$this->set_common_recur((int)$year,(int)$month,(int)$day,$interval);
$this->add_attribute('recur_type',MCAL_RECUR_DAILY);
}
function set_recur_weekly($year,$month,$day,$interval,$weekdays)
{
$this->set_common_recur((int)$year,(int)$month,(int)$day,$interval);
$this->add_attribute('recur_type',MCAL_RECUR_WEEKLY);
$this->add_attribute('recur_data',(int)$weekdays);
}
function set_recur_monthly_mday($year,$month,$day,$interval)
{
$this->set_common_recur((int)$year,(int)$month,(int)$day,$interval);
$this->add_attribute('recur_type',MCAL_RECUR_MONTHLY_MDAY);
}
function set_recur_monthly_wday($year,$month,$day,$interval)
{
$this->set_common_recur((int)$year,(int)$month,(int)$day,$interval);
$this->add_attribute('recur_type',MCAL_RECUR_MONTHLY_WDAY);
}
function set_recur_yearly($year,$month,$day,$interval)
{
$this->set_common_recur((int)$year,(int)$month,(int)$day,$interval);
$this->add_attribute('recur_type',MCAL_RECUR_YEARLY);
}
function fetch_current_stream_event()
{
return $this->fetch_event($this->event['id']);
}
function add_attribute($attribute,$value,$element='**(**')
{
if(is_array($value))
{
reset($value);
}
if($element!='**(**')
{
$this->event[$attribute][$element] = $value;
}
else
{
$this->event[$attribute] = $value;
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@
{
echo "Updating LOCALE='".$holiday['locale']."' NAME='".$holiday['name']."' extra=(".$holiday['mday'].'/'.$holiday['month_num'].'/'.$holiday['occurence'].'/'.$holiday['dow'].'/'.$holiday['observance_rule'].")<br>\n";
}
$sql = "UPDATE phpgw_cal_holidays SET name='".$holiday['name']."', mday=".$holiday['mday'].', month_num='.$holiday['month_num'].', occurence='.$holiday['occurence'].', dow='.$holiday['dow'].', observance_rule='.intval($holiday['observance_rule']).' WHERE hol_id='.$holiday['hol_id'];
$sql = "UPDATE phpgw_cal_holidays SET name='".$holiday['name']."', mday=".$holiday['mday'].', month_num='.$holiday['month_num'].', occurence='.$holiday['occurence'].', dow='.$holiday['dow'].', observance_rule='.(int)$holiday['observance_rule'].' WHERE hol_id='.$holiday['hol_id'];
}
else
{
@ -40,7 +40,7 @@
echo "Inserting LOCALE='".$holiday['locale']."' NAME='".$holiday['name']."' extra=(".$holiday['mday'].'/'.$holiday['month_num'].'/'.$holiday['occurence'].'/'.$holiday['dow'].'/'.$holiday['observance_rule'].")<br>\n";
}
$sql = 'INSERT INTO phpgw_cal_holidays(locale,name,mday,month_num,occurence,dow,observance_rule) '
. "VALUES('".strtoupper($holiday['locale'])."','".$holiday['name']."',".$holiday['mday'].','.$holiday['month_num'].','.$holiday['occurence'].','.$holiday['dow'].','.intval($holiday['observance_rule']).")";
. "VALUES('".strtoupper($holiday['locale'])."','".$holiday['name']."',".$holiday['mday'].','.$holiday['month_num'].','.$holiday['occurence'].','.$holiday['dow'].','.(int)$holiday['observance_rule'].")";
}
$this->db->query($sql,__LINE__,__FILE__);
}
@ -53,10 +53,10 @@
'index' => $this->db->f('hol_id'),
'locale' => $this->db->f('locale'),
'name' => $GLOBALS['phpgw']->strip_html($this->db->f('name')),
'day' => intval($this->db->f('mday')),
'month' => intval($this->db->f('month_num')),
'occurence' => intval($this->db->f('occurence')),
'dow' => intval($this->db->f('dow')),
'day' => (int)$this->db->f('mday'),
'month' => (int)$this->db->f('month_num'),
'occurence' => (int)$this->db->f('occurence'),
'dow' => (int)$this->db->f('dow'),
'observance_rule' => $this->db->f('observance_rule')
);
if($this->debug)
@ -136,7 +136,7 @@
{
$querymethod = " AND name like '%".$query."%'";
}
if (intval($year) > 1900)
if ((int)$year > 1900)
{
$querymethod .= " AND (occurence < 1900 OR occurence = $year)";
}
@ -172,7 +172,7 @@
{
$querymethod = " AND name like '%".$query."%'";
}
if (intval($year) >= 1900)
if ((int)$year >= 1900)
{
$querymethod .= " AND (occurence < 1900 OR occurence = $year)";
}
@ -185,7 +185,7 @@
$this->db->query($sql,__LINE__,__FILE__);
$this->db->next_record();
$retval = intval($this->db->f(0));
$retval = (int)$this->db->f(0);
if($this->debug)
{
echo 'Total Holidays for : '.$locale.' : '.$retval."<br>\n";

View File

@ -57,7 +57,7 @@
function prep_page()
{
if ($this->bo->cal_id <= 0 ||
!$this->event = $this->bo->read_entry($this->bo->cal_id))
!$this->event = $this->bo->read_entry($this->bo->cal_id))
{
$GLOBALS['phpgw']->redirect_link('/index.php',Array(
'menuaction' => 'calendar.uicalendar.index'
@ -122,9 +122,9 @@
if ($_POST['add'])
{
$time = intval($_POST['time']['days'])*24*3600 +
intval($_POST['time']['hours'])*3600 +
intval($_POST['time']['mins'])*60;
$time = (int)($_POST['time']['days'])*24*3600 +
(int)($_POST['time']['hours'])*3600 +
(int)($_POST['time']['mins'])*60;
if ($time > 0 && !$this->bo->add($this->event,$time,$_POST['owner']))
{
@ -184,7 +184,7 @@
}
$this->template->parse('rows','buttons',True);
}
if (isset($this->event['participants'][intval($GLOBALS['phpgw_info']['user']['account_id'])]))
if (isset($this->event['participants'][(int)$GLOBALS['phpgw_info']['user']['account_id']]))
{
$this->template->set_var(Array(
'input_days' => $this->html->select('time[days]',$_POST['time']['days'],range(0,31),True).' '.lang('days'),

View File

@ -102,15 +102,15 @@
$this->template_dir = $GLOBALS['phpgw']->common->get_tpl_dir('calendar');
$this->holiday_color = (substr($this->theme['bg06'],0,1)=='#'?'':'#').$this->theme['bg06'];
$this->cat_id = $this->bo->cat_id;
$this->link_tpl = CreateObject('phpgwapi.Template',$this->template_dir);
$this->link_tpl->set_unknowns('remove');
$this->link_tpl->set_file(
Array(
'link_picture' => 'link_pict.tpl'
)
Array(
'link_picture' => 'link_pict.tpl'
)
);
$this->link_tpl->set_block('link_picture','link_pict','link_pict');
$this->link_tpl->set_block('link_picture','pict','pict');
@ -168,7 +168,7 @@
'syear' => $params['year']
)
);
$params['link'] = (!isset($params['link'])?'':$params['link']);
$params['buttons'] = (!isset($params['buttons'])?'none':$params['buttons']);
$params['outside_month'] = (!isset($params['outside_month'])?True:$params['outside_month']);
@ -176,10 +176,10 @@
$this->bo->read_holidays($params['year']);
$date = $GLOBALS['phpgw']->datetime->makegmttime(0,0,0,$params['month'],$params['day'],$params['year']);
$month_ago = intval(date('Ymd',mktime(0,0,0,$params['month'] - 1,$params['day'],$params['year'])));
$month_ahead = intval(date('Ymd',mktime(0,0,0,$params['month'] + 1,$params['day'],$params['year'])));
$monthstart = intval(date('Ymd',mktime(0,0,0,$params['month'],1,$params['year'])));
$monthend = intval(date('Ymd',mktime(0,0,0,$params['month'] + 1,0,$params['year'])));
$month_ago = (int)(date('Ymd',mktime(0,0,0,$params['month'] - 1,$params['day'],$params['year'])));
$month_ahead = (int)(date('Ymd',mktime(0,0,0,$params['month'] + 1,$params['day'],$params['year'])));
$monthstart = (int)(date('Ymd',mktime(0,0,0,$params['month'],1,$params['year'])));
$monthend = (int)(date('Ymd',mktime(0,0,0,$params['month'] + 1,0,$params['year'])));
$weekstarttime = $GLOBALS['phpgw']->datetime->get_weekday_start($params['year'],$params['month'],1);
@ -231,7 +231,7 @@
case 'left':
$var = Array(
'prevmonth' => '<a href="'.$this->page('month','&date='.$month_ago).'"><img src="'.$GLOBALS['phpgw']->common->image('phpgwapi','left').'" border="0"></a>'
);
);
break;
case 'both':
$var = Array(
@ -269,9 +269,9 @@
foreach($daily as $date => $day_params)
{
print_debug('Mini-Cal Date',$date);
$year = intval(substr($date,0,4));
$month = intval(substr($date,4,2));
$day = intval(substr($date,6,2));
$year = (int)(substr($date,0,4));
$month = (int)(substr($date,4,2));
$day = (int)(substr($date,6,2));
$str = '';
if(($date >= $monthstart && $date <= $monthend) || $params['outside_month'] == True)
{
@ -302,7 +302,7 @@
$mini_cal_tpl->set_var('dayname','');
$mini_cal_tpl->set_var('monthweek_day','');
}
$return_value = $mini_cal_tpl->fp('out','mini_cal');
$mini_cal_tpl->set_var('display_monthweek','');
// $mini_cal_tpl->set_var('daynames','');
@ -505,7 +505,7 @@
$minical_prev = '';
$minical_next = '';
}
if (!$this->bo->printer_friendly)
{
$printer = '';
@ -553,7 +553,7 @@
/*
$this->bo->read_holidays();
if (!$this->bo->printer_friendly || ($this->bo->printer_friendly && @$this->bo->prefs['calendar']['display_minicals']))
{
$minical = $this->mini_calendar(
@ -569,7 +569,7 @@
{
$minical = '';
}
if (!$this->bo->printer_friendly)
{
unset($GLOBALS['phpgw_info']['flags']['noheader']);
@ -691,7 +691,7 @@
}
return $p->fp('out','year_t');
}
function view($vcal_id=0,$cal_date=0)
{
unset($GLOBALS['phpgw_info']['flags']['noheader']);
@ -701,8 +701,8 @@
$cal_id = get_var('cal_id',array('GET','POST'),$vcal_id);
$date = $cal_date?$cal_date:0;
$date = $date?$date:intval($_GET['date']);
$date = $cal_date ? $cal_date : 0;
$date = $date ? $date : (int)$_GET['date'];
// First, make sure they have permission to this entry
if ($cal_id < 1)
@ -909,7 +909,7 @@
'button_right' => $button_right
));
$p->pfp('phpgw_body','view_event');
$GLOBALS['phpgw']->hooks->process(array(
'location' => 'calendar_view',
'cal_id' => $cal_id
@ -948,7 +948,7 @@
}
elseif(isset($_GET['cal_id']))
{
$cal_id = intval($_GET['cal_id']);
$cal_id = (int)$_GET['cal_id'];
$event = $this->bo->read_entry($cal_id);
if(!$this->bo->check_perms(PHPGW_ACL_EDIT,$event))
@ -992,7 +992,7 @@
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['calendar']['title'].' - '.lang('Export');
$GLOBALS['phpgw']->common->phpgw_header();
$p = $GLOBALS['phpgw']->template;
$p->set_file(
Array(
@ -1018,20 +1018,20 @@
// $vfs->mkdir('.calendar',array(RELATIVE_USER));
// }
$content = ExecMethod('calendar.boicalendar.export',
Array(
'l_event_id' => $_POST['cal_id'],
'chunk_split' => False,
)
);
$content = ExecMethod('calendar.boicalendar.export', Array(
'l_event_id' => $_POST['cal_id'],
'chunk_split' => False,
));
$vfs->cd(array('string' => '/',
'relatives' => array(RELATIVE_USER)
));
$vfs->write(array('string' => $output_file,
'relatives' => array (RELATIVE_USER),
'content' => $content
));
$vfs->cd(array(
'string' => '/',
'relatives' => array(RELATIVE_USER)
));
$vfs->write(array(
'string' => $output_file,
'relatives' => array (RELATIVE_USER),
'content' => $content
));
if($this->debug)
{
@ -1055,7 +1055,7 @@
{
if(!$this->bo->check_perms(PHPGW_ACL_EDIT))
{
$this->no_edit();
$this->no_edit();
}
elseif(!$this->bo->check_perms(PHPGW_ACL_ADD))
{
@ -1135,7 +1135,7 @@
);
$p->set_var($var);
$button_left .= '<td>'.$p->fp('out','form_button').'</td>';
$p->set_var('button_left',$button_left);
$p->pfp('phpgw_body','view_event');
}
@ -1144,17 +1144,17 @@
{
if(!$this->bo->check_perms(PHPGW_ACL_EDIT))
{
$this->no_edit();
$this->no_edit();
}
elseif(!$this->bo->check_perms(PHPGW_ACL_ADD))
{
$this->index();
}
$cal_id = (isset($params['cal_id'])?intval($params['cal_id']):'');
$cal_id = ($cal_id==''?intval($_GET['cal_id']):$cal_id);
$cal_id = (isset($params['cal_id']) ? (int)$params['cal_id'] : '');
$cal_id = ($cal_id == '' ? (int)$_GET['cal_id'] : $cal_id);
$reinstate_index = (isset($params['reinstate_index'])?intval($params['reinstate_index']):'');
$reinstate_index = ($reinstate_index==''?intval($_POST['reinstate_index']):$reinstate_index);
$reinstate_index = (isset($params['reinstate_index']) ? (int)$params['reinstate_index'] : '');
$reinstate_index = ($reinstate_index == '' ? (int)$_POST['reinstate_index'] : $reinstate_index);
if($this->debug)
{
echo '<!-- Calling bo->reinstate -->'."\n";
@ -1172,12 +1172,12 @@
if ($this->bo->return_to)
{
Header('Location: '.$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->bo->return_to));
}
}
else
{
Header('Location: '.$this->page('',($cd?'&cd='.$cd:'')));
}
$GLOBALS['phpgw']->common->phpgw_exit();
$GLOBALS['phpgw']->common->phpgw_exit();
}
function add($cd=0,$readsess=0)
@ -1186,7 +1186,7 @@
{
$this->index();
}
if($readsess)
{
$event = $this->bo->restore_from_appsession;
@ -1203,9 +1203,9 @@
$can_edit = True;
$starthour = intval(get_var('hour',array('GET'),$this->bo->prefs['calendar']['workdaystarts']));
$startmin = intval(get_var('minute',array('GET'),0));
$endmin = $startmin + intval($this->bo->prefs['calendar']['defaultlength']);
$starthour = (int)(get_var('hour',array('GET'),$this->bo->prefs['calendar']['workdaystarts']));
$startmin = (int)(get_var('minute',array('GET'),0));
$endmin = $startmin + (int)$this->bo->prefs['calendar']['defaultlength'];
$endhour = $starthour + $this->bo->normalizeminutes($endmin);
;
$this->bo->set_start($this->bo->year,$this->bo->month,$this->bo->day,$starthour,$startmin,0);
@ -1244,7 +1244,7 @@
}
$date = sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->day);
if($this->bo->check_perms(PHPGW_ACL_DELETE,$cal_id=intval($_GET['cal_id'])))
if($this->bo->check_perms(PHPGW_ACL_DELETE,$cal_id = (int)$_GET['cal_id']))
{
if(isset($_POST['delete_type']) && $_POST['delete_type'] == 'single')
{
@ -1298,7 +1298,7 @@
{
$minical = '';
}
if (!$this->bo->printer_friendly)
{
$printer = '';
@ -1362,24 +1362,24 @@
if(is_array($todo_label))
{
list($label,$showall)=$todo_label;
}
}
else
{
$label=$todo_label;
$showall=true;
}
$maxshow = intval($GLOBALS['phpgw_info']['user']['preferences']['infolog']['mainscreen_maxshow']);
$maxshow = (int)$GLOBALS['phpgw_info']['user']['preferences']['infolog']['mainscreen_maxshow'];
if($maxshow<=0)
{
$maxshow=10;
}
}
//print_debug("get_todos(): label=$label; showall=$showall; max=$maxshow");
$content = $todo_label = '';
if (is_array($todos_from_hook) && count($todos_from_hook))
{
$todo_label = !empty($label)?$label:lang("open ToDo's:");
foreach($todos_from_hook as $todos)
{
$i = 0;
@ -1388,7 +1388,7 @@
foreach($todos as $todo)
{
if(!$showall && ($i++>$maxshow))
{
{
break;
}
$icons = '';
@ -1420,7 +1420,7 @@
$GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['calendar']['title'].' - '.lang('Change Status');
$GLOBALS['phpgw']->common->phpgw_header();
$event = $this->bo->read_entry($_GET['cal_id']);
reset($event['participants']);
@ -1433,8 +1433,8 @@
if(!$this->bo->check_perms(PHPGW_ACL_EDIT))
{
$this->no_edit();
return;
$this->no_edit();
return;
}
$freetime = $GLOBALS['phpgw']->datetime->localdates(mktime(0,0,0,$event['start']['month'],$event['start']['mday'],$event['start']['year']) - $GLOBALS['phpgw']->datetime->tz_offset);
@ -1462,7 +1462,7 @@
return;
}
$this->bo->set_status(intval($_GET['cal_id']),intval($_GET['action']));
$this->bo->set_status((int)$_GET['cal_id'],(int)$_GET['action']);
if ($this->bo->return_to)
{
@ -1470,7 +1470,7 @@
}
else
{
Header('Location: '.$this->page('',''));
Header('Location: '.$this->page('',''));
}
$GLOBALS['phpgw']->common->phpgw_exit();
}
@ -1523,7 +1523,7 @@
}
else
{
$this->planner_group_members = array(
$this->planner_group_members = array(
$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner) => $this->bo->owner
);
}
@ -1660,8 +1660,8 @@
$this->planner_end_month = $m - 1;
$this->planner_end_year = $y;
$this->planner_days_in_end_month = $GLOBALS['phpgw']->datetime->days_in_month($this->planner_end_month,$this->planner_end_year);
$this->planner_firstday = intval(date('Ymd',mktime(0,0,0,$this->bo->month,1,$this->bo->year)));
$this->planner_lastday = intval(date('Ymd',mktime(0,0,0,$this->planner_end_month,$this->planner_days_in_end_month,$this->planner_end_year)));
$this->planner_firstday = (int)(date('Ymd',mktime(0,0,0,$this->bo->month,1,$this->bo->year)));
$this->planner_lastday = (int)(date('Ymd',mktime(0,0,0,$this->planner_end_month,$this->planner_days_in_end_month,$this->planner_end_year)));
// generate line with calendar weeks in observed interval
//
@ -1669,9 +1669,9 @@
$w = date('W', $d);
if ($w == 'W') // php < 4.1
{
$w = 1 + intval(date('z',$d) / 7); // a bit simplistic
$w = 1 + (int)(date('z',$d) / 7); // a bit simplistic
}
$offset = (7-date("w", $d)+1)%7;
$offset = (7-date('w', $d)+1)%7;
$offset = $offset == 0 ? 7 : $offset;
$color = $this->theme[$w % 2 ? 'th_bg' : 'row_on'];
@ -1691,7 +1691,7 @@
$w = date('W', $d);
if ($w == 'W') // php < 4.1
{
$w = 1 + intval(date('z',$d) / 7); // a bit simplistic
$w = 1 + (int)(date('z',$d) / 7); // a bit simplistic
}
$w += (isset($hdr[1][$w]))?1:0; // bug in "date('W')" ?
@ -1723,7 +1723,7 @@
$rows = &$this->planner_rows;
$intervals_per_day = $this->bo->prefs['calendar']['planner_intervals_per_day'];
$is_private = !$this->bo->check_perms(PHPGW_ACL_READ,$event);
$view = $this->html->link('/index.php',
array(
'menuaction' => 'calendar.uicalendar.view',
@ -1777,7 +1777,7 @@
if (!$is_private)
{
$max_chars = intval(3*$colspan/$intervals_per_day-2);
$max_chars = (int)(3*$colspan/$intervals_per_day-2);
$min_chars = 3; // minimum for max_chars to display -> this should be configurable
if ($max_chars >= $min_chars)
@ -1878,12 +1878,18 @@
// caluculate start and end of event
//
$event_start = intval(date('Ymd',mktime(0,0,0,$event['start']['month'],
$event['start']['mday'],
$event['start']['year'])));
$event_end = intval(date('Ymd',mktime(0,0,0,$event['end']['month'],
$event['end']['mday'],
$event['end']['year'])));
$event_start = (int)(date('Ymd',mktime(
0,0,0,
$event['start']['month'],
$event['start']['mday'],
$event['start']['year']
)));
$event_end = (int)(date('Ymd',mktime(
0,0,0,
$event['end']['month'],
$event['end']['mday'],
$event['end']['year']
)));
// calculate first cell of event within observed interval
//
@ -2096,9 +2102,9 @@
$var[] = Array(
'field' => lang('Date'),
'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')))
$sb->getYears('year',(int)$GLOBALS['phpgw']->common->show_date($datetime,'Y'),(int)$GLOBALS['phpgw']->common->show_date($datetime,'Y')),
$sb->getMonthText('month',(int)$GLOBALS['phpgw']->common->show_date($datetime,'n')),
$sb->getDays('day',(int)$GLOBALS['phpgw']->common->show_date($datetime,'d'))
)
);
@ -2193,7 +2199,7 @@
$participants = $_POST['participants'];
$parts = Array();
$acct = CreateObject('phpgwapi.accounts',$this->bo->owner);
if (is_array($participants))
{
foreach($participants as $participant)
@ -2201,7 +2207,7 @@
switch ($GLOBALS['phpgw']->accounts->get_type($participant))
{
case 'g':
if ($members = $acct->member(intval($participant)))
if ($members = $acct->member((int)$participant))
{
foreach($members as $member)
{
@ -2425,7 +2431,7 @@
}
}
if($GLOBALS['phpgw_info']['flags']['currentapp'] == 'home' ||
strstr($GLOBALS['phpgw_info']['flags']['currentapp'],'mail')) // email, felamimail, ...
strstr($GLOBALS['phpgw_info']['flags']['currentapp'],'mail')) // email, felamimail, ...
{
$page_app = 'calendar';
}
@ -2469,14 +2475,14 @@
{
$menuaction = $_GET['menuaction'];
list(,,$method) = explode('.',$menuaction);
if (@$this->bo->printer_friendly)
{
return;
return;
}
$p = $GLOBALS['phpgw']->template;
$p->set_file(
Array(
'footer' => 'footer.tpl',
@ -2531,8 +2537,8 @@
$end = $begin + 6*24*60*60;
// echo "<br>$i: ".date('d.m.Y H:i',$begin).' - '.date('d.m.Y H:i',$end);
$str .= '<option value="' . $GLOBALS['phpgw']->common->show_date($begin,'Ymd') . '"'.($begin <= $thisdate && $end >= $thisdate?' selected':'').'>'
. $GLOBALS['phpgw']->common->show_date($begin,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']) . ' - '
. $GLOBALS['phpgw']->common->show_date($end,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
. $GLOBALS['phpgw']->common->show_date($begin,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']) . ' - '
. $GLOBALS['phpgw']->common->show_date($end,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
}
$var = Array(
@ -2616,11 +2622,11 @@
$GLOBALS['phpgw']->browser->browser();
if($GLOBALS['phpgw']->browser->get_agent() == 'MOZILLA')
{
$time_width = (intval($this->bo->prefs['common']['time_format']) == 12?12:8);
$time_width = ((int)($this->bo->prefs['common']['time_format']) == 12?12:8);
}
else
{
$time_width = (intval($this->bo->prefs['common']['time_format']) == 12?10:7);
$time_width = ((int)($this->bo->prefs['common']['time_format']) == 12?10:7);
}
return 'A.minicalendar { color: #000000; font: x-small '.$this->theme['font'].' }'."\n"
@ -2665,7 +2671,7 @@
$rawdate = mktime(0,0,0,$month,$day,$year);
$rawdate_offset = $rawdate - $GLOBALS['phpgw']->datetime->tz_offset;
$nextday = mktime(0,0,0,$month,$day + 1,$year) - $GLOBALS['phpgw']->datetime->tz_offset;
if (intval($GLOBALS['phpgw']->common->show_date($starttime,'Hi')) && $starttime == $endtime)
if ((int)$GLOBALS['phpgw']->common->show_date($starttime,'Hi') && $starttime == $endtime)
{
$time = $GLOBALS['phpgw']->common->show_date($starttime,$this->bo->users_timeformat);
}
@ -2673,9 +2679,9 @@
{
$time = '[ '.lang('All Day').' ]';
}
elseif (intval($GLOBALS['phpgw']->common->show_date($starttime,'Hi')) || $starttime != $endtime)
elseif ((int)$GLOBALS['phpgw']->common->show_date($starttime,'Hi') || $starttime != $endtime)
{
if($starttime < $rawdate_offset && $event['recur_type']==MCAL_RECUR_NONE)
if($starttime < $rawdate_offset && $event['recur_type'] == MCAL_RECUR_NONE)
{
$start_time = $GLOBALS['phpgw']->common->show_date($rawdate_offset,$this->bo->users_timeformat);
}
@ -2781,8 +2787,8 @@
if($this->bo->alarm_today($event,$rawdate_offset,$starttime))
{
$picture[] = Array(
'pict' => $GLOBALS['phpgw']->common->image('calendar','alarm'),
'width' => 13,
'pict' => $GLOBALS['phpgw']->common->image('calendar','alarm'),
'width' => 13,
'height'=> 13,
'title' => lang('alarm')
);
@ -2793,10 +2799,10 @@
for($i=0;$i<count($picture);$i++)
{
$var = Array(
'pic_image' => $picture[$i]['pict'],
'width' => $picture[$i]['width'],
'height' => $picture[$i]['height'],
'title' => $picture[$i]['title']
'pic_image' => $picture[$i]['pict'],
'width' => $picture[$i]['width'],
'height' => $picture[$i]['height'],
'title' => $picture[$i]['title']
);
$this->output_template_array($this->link_tpl,'picture','pict',$var);
}
@ -2813,7 +2819,7 @@
$this->link_tpl->parse('picture','link_close',True);
}
$str = $this->link_tpl->fp('out','link_pict');
$this->link_tpl->set_var('picture','');
$this->link_tpl->set_var('picture','');
$this->link_tpl->set_var('out','');
// unset($p);
return $str;
@ -2898,12 +2904,12 @@
function planner_participants($parts)
{
static $id2lid;
$names = '';
while (list($id,$status) = each($parts))
{
$status = substr($this->bo->get_long_status($status),0,1);
if (!isset($id2lid[$id]))
{
$id2lid[$id] = $GLOBALS['phpgw']->common->grab_owner_name($id);
@ -2920,7 +2926,7 @@
}
return $names;
}
function planner_category($ids)
{
static $cats;
@ -3005,7 +3011,7 @@
$str = '';
$p = CreateObject('phpgwapi.Template',$this->template_dir);
$p->set_unknowns('keep');
$p->set_file(
Array(
'month_header' => 'month_header.tpl',
@ -3030,12 +3036,12 @@
$daily = $this->set_week_array($startdate - $GLOBALS['phpgw']->datetime->tz_offset,$cellcolor,$weekly);
foreach($daily as $date => $day_params)
{
$year = intval(substr($date,0,4));
$month = intval(substr($date,4,2));
$day = intval(substr($date,6,2));
$var = Array(
'column_data' => '',
'extra' => ''
$year = (int)substr($date,0,4);
$month = (int)substr($date,4,2);
$day = (int)substr($date,6,2);
$var = Array(
'column_data' => '',
'extra' => ''
);
$p->set_var($var);
if ($weekly || ($date >= $monthstart && $date <= $monthend))
@ -3065,7 +3071,7 @@
}
$p->set_var($var);
if(@$day_params['holidays'])
{
foreach($day_params['holidays'] as $key => $value)
@ -3116,7 +3122,7 @@
$this->bo->owner = $temp_owner;
return $p->fp('out','monthly_header');
}
function display_month($month,$year,$showyear,$owner=0)
{
if($this->debug)
@ -3132,8 +3138,8 @@
)
);
$monthstart = intval(date('Ymd',mktime(0,0,0,$month ,1,$year)));
$monthend = intval(date('Ymd',mktime(0,0,0,$month + 1,0,$year)));
$monthstart = (int)(date('Ymd',mktime(0,0,0,$month ,1,$year)));
$monthend = (int)(date('Ymd',mktime(0,0,0,$month + 1,0,$year)));
$start = $GLOBALS['phpgw']->datetime->get_weekday_start($year, $month, 1);
@ -3145,16 +3151,15 @@
$p = CreateObject('phpgwapi.Template',$this->template_dir);
$p->set_unknowns('keep');
$p->set_file(
Array(
'week' => 'month_day.tpl'
)
'week' => 'month_day.tpl'
)
);
$p->set_block('week','m_w_table','m_w_table');
$p->set_block('week','event','event');
$var = Array(
'cols' => 7,
'day_events'=> $this->week_header($month,$year,False)
@ -3163,7 +3168,7 @@
$cellcolor = $this->theme['row_on'];
for ($i=intval($start + $GLOBALS['phpgw']->datetime->tz_offset);intval(date('Ymd',$i)) <= $monthend;$i += 604800)
for($i = (int)($start + $GLOBALS['phpgw']->datetime->tz_offset);(int)(date('Ymd',$i)) <= $monthend;$i += 604800)
{
$cellcolor = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($cellcolor);
$var = Array(
@ -3186,7 +3191,7 @@
$day = substr($params['date'],6,2);
$showyear = $params['showyear'];
$owners = $params['owners'];
$p = CreateObject('phpgwapi.Template',$this->template_dir);
$p->set_unknowns('keep');
@ -3197,7 +3202,7 @@
);
$p->set_block('week','m_w_table','m_w_table');
$p->set_block('week','event','event');
$start = $GLOBALS['phpgw']->datetime->get_weekday_start($year, $month, $day) + $GLOBALS['phpgw']->datetime->tz_offset;
$cellcolor = $this->theme['row_off'];
@ -3219,8 +3224,8 @@
$cols = 7;
}
$var = Array(
'cols' => $cols,
'day_events' => $this->week_header($month,$year,$display_name)
'cols' => $cols,
'day_events' => $this->week_header($month,$year,$display_name)
);
$this->output_template_array($p,'row','event',$var);
@ -3275,11 +3280,11 @@
{
if ($this->bo->check_perms(PHPGW_ACL_EDIT,0,$user) && ereg('^(.*) \((.*)\)$',$str,$parts))
{
$vars['participants']['data'][$user] = $parts[1].' (<a href="'.$this->page('edit_status','&cal_id='.$event['id'].'&owner='.$user).'">'.$parts[2].'</a>)';
$vars['participants']['data'][$user] = $parts[1].' (<a href="'.$this->page('edit_status','&cal_id='.$event['id'].'&owner='.$user).'">'.$parts[2].'</a>)';
}
}
$vars['participants']['data'] = implode("<br>\n",$vars['participants']['data']);
foreach($vars as $var)
{
if (strlen($var['data']))
@ -3319,20 +3324,20 @@
function slot_num($time,$set_day_start=0,$set_day_end=0)
{
static $day_start, $day_end, $interval=0;
if ($set_day_start) $day_start = $set_day_start;
if ($set_day_end) $day_end = $set_day_end;
if (!$interval) $interval = 60*$this->bo->prefs['calendar']['interval'];
if ($time > $day_end)
{
$time = $day_end;
}
$slot = intval(($time - $day_start) / $interval);
$slot = (int)(($time - $day_start) / $interval);
return $slot < 0 ? 0 : 1+$slot;
}
function print_day($params)
{
if(!is_array($params))
@ -3365,7 +3370,7 @@
$templates = Array(
'day_cal' => $tpl
);
$p->set_file($templates);
$p->set_block('day_cal','day','day');
$p->set_block('day_cal','day_row','day_row');
@ -3483,7 +3488,7 @@
}
else
{
$rowspan = intval($row_span[$slot]);
$rowspan = (int)$row_span[$slot];
if ($rowspan > 1)
{
$p->set_var('extras',' rowspan="'.$rowspan.'"');
@ -3559,7 +3564,7 @@
for($j=0;$j<$interval;$j++)
{
$k = ($j == 0 ? sprintf('%02d',$i).'<br>':'').sprintf('%02d',$j*$increment);
$str .= '<td align="left" bgcolor="'.$this->theme['bg_color'].'"><font color="'.$phpgw_info['theme']['bg_text'].'" face="'.$this->theme['font'].'" size="-2">'
. '<a href="'.$this->page('add','&date='.$date['full'].'&hour='.$i.'&minute='.(interval * $j))."\" onMouseOver=\"window.status='".$i.':'.(($increment * $j)<=9?'0':'').($increment * $j)."'; return true;\">"
. $k."</a>&nbsp;</font></td>\n";
@ -3635,7 +3640,7 @@
$this->bo->so->owner = $owner;
$this->bo->so->open_box($owner);
return $str.'</table></center>'."\n";
}
}
function get_response($cal_id)
{
@ -3699,7 +3704,7 @@
}
$hourformat = substr($this->bo->users_timeformat,0,1);
// $sb = CreateObject('phpgwapi.sbox');
$sb = CreateObject('phpgwapi.sbox2');
$jscal = CreateObject('phpgwapi.jscalendar'); // before phpgw_header() !!!
@ -3721,19 +3726,19 @@
$p->set_block('edit','edit_entry','edit_entry');
$p->set_block('edit','list','list');
$p->set_block('edit','hr','hr');
$vars = Array(
'font' => $this->theme['font'],
'bg_color' => $this->theme['bg_text'],
'action_url' => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.bocalendar.update')),
'accounts_link' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicalendar.accounts_popup'),
'common_hidden' => '<input type="hidden" name="cal[id]" value="'.$event['id'].'">'."\n"
. '<input type="hidden" name="cal[owner]" value="'.$event['owner'].'">'."\n"
. '<input type="hidden" name="cal[uid]" value="'.$event['uid'].'">'."\n"
. ($_GET['cal_id'] && $event['id'] == 0?'<input type="hidden" name="cal[reference]" value="'.$_GET['cal_id'].'">'."\n":
(@isset($event['reference'])?'<input type="hidden" name="cal[reference]" value="'.$event['reference'].'">'."\n":''))
. (@isset($GLOBALS['phpgw_info']['server']['deny_user_grants_access']) && $GLOBALS['phpgw_info']['server']['deny_user_grants_access']?
'<input type="hidden" name="participants[]" value="'.$this->bo->owner.'">'."\n":''),
. '<input type="hidden" name="cal[owner]" value="'.$event['owner'].'">'."\n"
. '<input type="hidden" name="cal[uid]" value="'.$event['uid'].'">'."\n"
. ($_GET['cal_id'] && $event['id'] == 0?'<input type="hidden" name="cal[reference]" value="'.$_GET['cal_id'].'">'."\n":
(@isset($event['reference'])?'<input type="hidden" name="cal[reference]" value="'.$event['reference'].'">'."\n":''))
. (@isset($GLOBALS['phpgw_info']['server']['deny_user_grants_access']) && $GLOBALS['phpgw_info']['server']['deny_user_grants_access']?
'<input type="hidden" name="participants[]" value="'.$this->bo->owner.'">'."\n":''),
'errormsg' => ($param['cd']?$GLOBALS['phpgw']->common->check_code($param['cd']):'')
);
$p->set_var($vars);
@ -3758,12 +3763,12 @@
@reset($temp_cats);
while(list($key,$value) = each($temp_cats))
{
$check_cats[] = intval($value);
$check_cats[] = (int)$value;
}
}
elseif($event['category'])
{
$check_cats[] = intval($event['category']);
$check_cats[] = (int)$event['category'];
}
else
{
@ -3787,9 +3792,9 @@
'field' => lang('Start Date'),
/*
'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')))
$sb->getYears('start[year]',(int)$GLOBALS['phpgw']->common->show_date($start,'Y')),
$sb->getMonthText('start[month]',(int)$GLOBALS['phpgw']->common->show_date($start,'n')),
$sb->getDays('start[mday]',(int)$GLOBALS['phpgw']->common->show_date($start,'d'))
)
*/
'data' => $jscal->input('start[str]',$start)
@ -3812,9 +3817,9 @@
'field' => lang('End Date'),
/*
'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')))
$sb->getYears('end[year]',(int)$GLOBALS['phpgw']->common->show_date($end,'Y')),
$sb->getMonthText('end[month]',(int)$GLOBALS['phpgw']->common->show_date($end,'n')),
$sb->getDays('end[mday]',(int)$GLOBALS['phpgw']->common->show_date($end,'d'))
)
*/
'data' => $jscal->input('end[str]',$end)
@ -3859,10 +3864,10 @@
case 'popup':
while (is_array($event['participants']) && list($id) = each($event['participants']))
{
if($id != intval($event['owner']))
if($id != (int)$event['owner'])
{
$str .= '<option value="' . $id.$event['participants'][$id] . '"'.($event['participants'][$id]?' selected':'').'>('.$GLOBALS['phpgw']->accounts->get_type($id)
.') ' . $GLOBALS['phpgw']->common->grab_owner_name($id) . '</option>' . "\n";
.') ' . $GLOBALS['phpgw']->common->grab_owner_name($id) . '</option>' . "\n";
}
}
$var['participants'] = array
@ -3875,7 +3880,7 @@
default:
foreach($users as $id => $user_array)
{
if($id != intval($event['owner']))
if($id != (int)$event['owner'])
{
$str .= ' <option value="' . $id.$event['participants'][$id] . '"'.($event['participants'][$id]?' selected':'').'>('.$user_array['type'].') '.$user_array['name'].'</option>'."\n";
}
@ -3945,7 +3950,7 @@
'data' => '<input type="checkbox" name="participants[]" value="'.$event['owner'].$event['participants'][$event['owner']].'"'.$checked.'>'
);
}
// Reminder
// The user must use "Alarm Management" to change/modify an alarm
// so only display the email reminder fields if this is a new event
@ -3970,11 +3975,11 @@
@reset($event['alarm']);
// just get the first one see above!!!
list($key,$alarm) = @each($event['alarm']);
$diff = $start - $alarm['time'];
$days = intval($diff / (24*3600));
$hours = intval(($diff - ($days * 24 * 3600))/3600);
$min = intval(($diff - ($days * 24 * 3600) - ($hours * 3600))/60);
}
$diff = $start - $alarm['time'];
$days = (int)($diff / (24*3600));
$hours = (int)(($diff - ($days * 24 * 3600))/3600);
$min = (int)(($diff - ($days * 24 * 3600) - ($hours * 3600))/60);
}
// days
$dout = '<select name="cal[alarmdays]">'."\n";
@ -4026,15 +4031,15 @@
$checked = '';
$recur_end = $this->bo->maketime($event['start']) + 86400 - $GLOBALS['phpgw']->datetime->tz_offset;
}
$var['recure_enddate'] = Array(
'field' => lang('Repeat End Date'),
'data' => '<input type="checkbox" name="cal[rpt_use_end]" value="y"'.$checked.'>'.lang('Use End Date').' '.
/*
$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')))
$sb->getYears('recur_enddate[year]',(int)$GLOBALS['phpgw']->common->show_date($recur_end,'Y')),
$sb->getMonthText('recur_enddate[month]',(int)$GLOBALS['phpgw']->common->show_date($recur_end,'n')),
$sb->getDays('recur_enddate[mday]',(int)$GLOBALS['phpgw']->common->show_date($recur_end,'d'))
)
*/
$jscal->input('recur_enddate[str]',$recur_end)
@ -4204,7 +4209,7 @@
$p->set_block('T_edit_partlist_blocks','B_partlist','V_partlist');
$p->set_block('T_edit_partlist_blocks','B_participants_none','V_participants_none');
$p->set_block('T_edit_partlist_blocks','B_delete_btn','V_delete_btn');
global $query_addr;
$sb = CreateObject('phpgwapi.sbox2');
$addy = $sb->getAddress('addr','',$query_addr);
@ -4228,11 +4233,11 @@
for ($i=0; $i<count($control_data['part']); $i++)
{
$id = $control_data['part'][$i];
list($contact) = $this->read_contact($id);
$id = $control_data['part'][$i];
list($contact) = $this->read_contact($id);
$participant[$id] = array();
$participant[$id]['name'] = $contact['n_given'].' '.$contact['n_family'];
$participant[$id] = array();
$participant[$id]['name'] = $contact['n_given'].' '.$contact['n_family'];
}
if ($control_data['action'] == lang('Delete selected contacts'))
@ -4243,11 +4248,11 @@
unset($participant[$id]);
}
}
if ($control_data['action'] == lang('Add Contact'))
{
$id = $_POST['id_addr'];
if (isset($id) && intval($id) != 0)
if (isset($id) && (int)$id != 0)
{
list($contact) = $this->read_contact($id);
$participant[$id] = array();
@ -4295,11 +4300,11 @@
.'" vlink="'.$GLOBALS['phpgw_info']['theme']['vlink'].'"';
$form_action = $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'calendar.uicalendar.modify'));
$charset = lang('charset');
$p->set_var('charset',$charset);
$p->set_var('page_title',$GLOBALS['phpgw_flags']['currentapp']
. ' - ' .lang('External Participants'));
$p->set_var('page_title',$GLOBALS['phpgw_flags']['currentapp']
. ' - ' .lang('External Participants'));
$p->set_var('font_family',$GLOBALS['phpgw_info']['theme']['font']);
$p->set_var('body_tags',$body_tags);
$p->set_var('form_method','POST');
@ -4313,7 +4318,7 @@
$p->set_var('btn_done_js','copyback()');
$p->set_var('form1_name','ext_form');
$p->pfp('out','T_edit_partlist');
$p->pfp('out','T_edit_partlist');
}
function read_contact($id)
@ -4325,7 +4330,7 @@
'email_home' => 'email_home'
);
/*
/*
if ($this->rights & PHPGW_ACL_READ)
{
return $this->contacts->read_single_entry($id,$fields);
@ -4335,10 +4340,10 @@
$rtrn = array(0 => array('No access' => 'No access'));
return $rtrn;
}
*/
*/
$contacts = CreateObject('phpgwapi.contacts', False);
return $contacts->read_single_entry($id,$query_fields);
$contacts = CreateObject('phpgwapi.contacts', False);
return $contacts->read_single_entry($id,$query_fields);
}
function build_part_list(&$users,$accounts,$owner)
@ -4349,7 +4354,7 @@
}
foreach($accounts as $id)
{
$id = intval($id);
$id = (int)$id;
if($id == $owner)
{
continue;
@ -4422,7 +4427,7 @@
{
$cellcolor = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($cellcolor);
}
$day_image = '';
if($holidays)
{
@ -4486,7 +4491,7 @@
{
_debug_array($daily);
}
return $daily;
}
}

View File

@ -129,8 +129,8 @@
$ordered[$order] = array(
'field' => $field,
'name' => stripslashes($_POST['name'][$field]),
'length' => intval($_POST['length'][$field]),
'shown' => intval($_POST['shown'][$field]),
'length' => (int)$_POST['length'][$field],
'shown' => (int)$_POST['shown'][$field],
'title' => !!$_POST['title'][$field],
'disabled' => !!$_POST['disabled'][$field]
);
@ -158,8 +158,8 @@
$ordered[$order] = array(
'field' => '#'.$name,
'name' => $name,
'length' => intval($_POST['length']['***new***']),
'shown' => intval($_POST['shown']['***new***']),
'length' => (int)$_POST['length']['***new***'],
'shown' => (int)$_POST['shown']['***new***'],
'title' => !!$_POST['title']['***new***'],
'disabled' => !!$_POST['disabled']['***new***']
);

View File

@ -264,11 +264,11 @@
}
$var = Array(
'title_holiday'=> ($this->bo->id ? lang('Edit') : lang('Add')).' '.lang('Holiday'),
'message' => $message,
'actionurl' => $GLOBALS['phpgw']->link($this->base_url,'menuaction=calendar.boholiday.add&year='.$this->bo->year),
'hidden_vars' => '<input type="hidden" name="holiday[hol_id]" value="'.$this->bo->id.'">'."\n"
. '<input type="hidden" name="holiday[locales]" value="'.$this->bo->locales[0].'">'."\n"
'title_holiday' => ($this->bo->id ? lang('Edit') : lang('Add')).' '.lang('Holiday'),
'message' => $message,
'actionurl' => $GLOBALS['phpgw']->link($this->base_url,'menuaction=calendar.boholiday.add&year='.$this->bo->year),
'hidden_vars' => '<input type="hidden" name="holiday[hol_id]" value="'.$this->bo->id.'">'."\n"
. '<input type="hidden" name="holiday[locales]" value="'.$this->bo->locales[0].'">'."\n"
);
$t->set_var($var);

View File

@ -11,12 +11,12 @@
\**************************************************************************/
/* $Id$ */
global $pref;
$pref->change("calendar","weekstarts","Monday");
$pref->change("calendar","workdaystarts","9");
$pref->change("calendar","workdayends","17");
$pref->change("calendar","defaultcalendar","month.php");
$pref->change("calendar","defaultfilter","all");
$pref->change("calendar","mainscreen_showevents","Y");
global $pref;
$pref->change('calendar','weekstarts','Monday');
$pref->change('calendar','workdaystarts','9');
$pref->change('calendar','workdayends','17');
$pref->change('calendar','defaultcalendar','month.php');
$pref->change('calendar','defaultfilter',"all');
$pref->change('calendar','mainscreen_showevents','Y');
?>

View File

@ -12,16 +12,16 @@
/* $Id$ */
// Delete all records for a user
if(intval($GLOBALS['HTTP_POST_VARS']['new_owner'])==0)
if((int)$_POST['new_owner'] == 0)
{
ExecMethod('calendar.bocalendar.delete_calendar',intval($GLOBALS['HTTP_POST_VARS']['account_id']));
ExecMethod('calendar.bocalendar.delete_calendar',(int)$_POST['account_id']);
}
else
{
ExecMethod('calendar.bocalendar.change_owner',
Array(
'old_owner' => intval($GLOBALS['HTTP_POST_VARS']['account_id']),
'new_owner' => intval($GLOBALS['HTTP_POST_VARS']['new_owner'])
'old_owner' => (int)$_POST['account_id'],
'new_owner' => (int)$_POST['new_owner']
)
);
}

View File

@ -22,7 +22,7 @@
}
unset($d1);
$showevents = intval($GLOBALS['phpgw_info']['user']['preferences']['calendar']['mainscreen_showevents']);
$showevents = (int)$GLOBALS['phpgw_info']['user']['preferences']['calendar']['mainscreen_showevents'];
if($showevents>0)
{
$GLOBALS['phpgw']->translation->add_app('calendar');
@ -60,9 +60,9 @@
$_page = 'day';
}
include(PHPGW_INCLUDE_ROOT.'/calendar/inc/hook_home_'.$_page.'.inc.php');
$title = lang('Calendar');
$portalbox = CreateObject('phpgwapi.listbox',
Array(
'title' => $title,
@ -94,7 +94,7 @@
echo "\n".'<!-- BEGIN Calendar info -->'."\n".$portalbox->draw($GLOBALS['extra_data'])."\n".'<!-- END Calendar info -->'."\n";
unset($cal);
}
}
flush();
unset($showevents);
?>

View File

@ -33,7 +33,7 @@
for the main calendar page. But the list could be added to the
default list above, if requested. - shrykedude. */
$mainpage = array(
'1' => lang('Yes'),
'1' => lang('Yes'),
'0' => lang('No'),
'2' => lang('No').' - '.lang('show list of upcoming events'),
);
@ -112,7 +112,7 @@
);
create_select_box('weekday starts on','weekdaystarts',$weekdaystarts,
'This day is shown as first day in the week or month view.');
for ($i=0; $i < 24; ++$i)
{
$options[$i] = $GLOBALS['phpgw']->common->formattime($i,'00');
@ -146,7 +146,7 @@
}
create_select_box('Preselected group for entering the planner','planner_start_with_group',$options,
'This group that is preselected when you enter the planner. You can change it in the planner anytime you want.');
$planner_intervals = array(
1 => '1',
2 => '2',
@ -154,7 +154,7 @@
4 => '4',
);
create_select_box('Intervals per day in planner view','planner_intervals_per_day',
$planner_intervals,'Specifies the the number of intervals shown in the planner view.');
$planner_intervals,'Specifies the the number of intervals shown in the planner view.');
$defaultfilter = array(
'all' => lang('all'),

View File

@ -14,7 +14,7 @@
{
/*
This hookfile is for generating an app-specific side menu used in the idots
This hookfile is for generating an app-specific side menu used in the idots
template set.
$menu_title speaks for itself

View File

@ -24,18 +24,18 @@
);
$GLOBALS['phpgw_info']['flags'] = $phpgw_flags;
include('../header.inc.php');
if(!is_object($GLOBALS['phpgw']->datetime))
{
$GLOBALS['phpgw']->datetime = CreateObject('phpgwapi.datetime');
}
$parms = Array(
# 'menuaction'=> 'calendar.uicalendar.index',
'date' => date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime)
);
//echo 'Local DateTime: '.date('Ymd H:i:s',$GLOBALS['phpgw']->datetime->users_localtime).'<br>'."\n";
# $GLOBALS['phpgw']->redirect_link('/index.php',$parms);

View File

@ -11,7 +11,7 @@
/* $Id$ */
$phpgw_flags = Array(
$GLOBALS['phpgw']_flags = Array(
'currentapp' => 'calendar',
'enable_nextmatchs_class' => True,
'noheader' => True,
@ -20,82 +20,82 @@
'noappfooter' => True
);
$phpgw_info['flags'] = $phpgw_flags;
$GLOBALS['phpgw_info']['flags'] = $GLOBALS['phpgw']_flags;
include('../header.inc.php');
if ($submit)
{
$phpgw->preferences->read_repository();
$phpgw->preferences->add('calendar','weekdaystarts');
$phpgw->preferences->add('calendar','workdaystarts');
$phpgw->preferences->add('calendar','workdayends');
$phpgw->preferences->add('calendar','defaultcalendar');
$phpgw->preferences->add('calendar','defaultfilter');
$phpgw->preferences->add('calendar','interval');
$GLOBALS['phpgw']->preferences->read_repository();
$GLOBALS['phpgw']->preferences->add('calendar','weekdaystarts');
$GLOBALS['phpgw']->preferences->add('calendar','workdaystarts');
$GLOBALS['phpgw']->preferences->add('calendar','workdayends');
$GLOBALS['phpgw']->preferences->add('calendar','defaultcalendar');
$GLOBALS['phpgw']->preferences->add('calendar','defaultfilter');
$GLOBALS['phpgw']->preferences->add('calendar','interval');
if ($mainscreen_showevents == True)
{
$phpgw->preferences->add('calendar','mainscreen_showevents');
$GLOBALS['phpgw']->preferences->add('calendar','mainscreen_showevents');
}
else
{
$phpgw->preferences->delete('calendar','mainscreen_showevents');
$GLOBALS['phpgw']->preferences->delete('calendar','mainscreen_showevents');
}
if ($send_updates == True)
{
$phpgw->preferences->add('calendar','send_updates');
$GLOBALS['phpgw']->preferences->add('calendar','send_updates');
}
else
{
$phpgw->preferences->delete('calendar','send_updates');
$GLOBALS['phpgw']->preferences->delete('calendar','send_updates');
}
if ($display_status == True)
{
$phpgw->preferences->add('calendar','display_status');
$GLOBALS['phpgw']->preferences->add('calendar','display_status');
}
else
{
$phpgw->preferences->delete('calendar','display_status');
$GLOBALS['phpgw']->preferences->delete('calendar','display_status');
}
if ($default_private == True)
{
$phpgw->preferences->add('calendar','default_private');
$GLOBALS['phpgw']->preferences->add('calendar','default_private');
}
else
{
$phpgw->preferences->delete('calendar','default_private');
$GLOBALS['phpgw']->preferences->delete('calendar','default_private');
}
if ($display_minicals == True)
{
$phpgw->preferences->add('calendar','display_minicals');
$GLOBALS['phpgw']->preferences->add('calendar','display_minicals');
}
else
{
$phpgw->preferences->delete('calendar','display_minicals');
$GLOBALS['phpgw']->preferences->delete('calendar','display_minicals');
}
if ($print_black_white == True)
{
$phpgw->preferences->add('calendar','print_black_white');
$GLOBALS['phpgw']->preferences->add('calendar','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();
}
function display_item($field,$data)
{
global $phpgw, $p, $tr_color;
global $GLOBALS['phpgw'], $p, $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,
@ -105,10 +105,10 @@
$p->parse('row','pref_list',True);
}
$phpgw->common->phpgw_header();
$GLOBALS['phpgw']->common->phpgw_header();
echo parse_navbar();
$p = CreateObject('phpgwapi.Template',$phpgw->common->get_tpl_dir('calendar'));
$p = CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir('calendar'));
$templates = Array(
'pref' => 'pref.tpl',
'pref_colspan' => 'pref_colspan.tpl',
@ -118,24 +118,24 @@
$var = Array(
'title' => lang('Calendar preferences'),
'action_url' => $phpgw->link('/'.$phpgw_info['flags']['currentapp'].'/preferences.php'),
'bg_color' => $phpgw_info['theme']['th_bg'],
'action_url' => $GLOBALS['phpgw']->link('/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/preferences.php'),
'bg_color' => $GLOBALS['phpgw_info']['theme']['th_bg'],
'submit_lang' => lang('submit')
);
$p->set_var($var);
$p->set_var('text','&nbsp;');
$p->parse('row','pref_colspan',True);
// if ($totalerrors)
// {
// echo '<p><center>' . $phpgw->common->error_list($errors) . '</center>';
// echo '<p><center>' . $GLOBALS['phpgw']->common->error_list($errors) . '</center>';
// }
$str = '<input type="checkbox" name="mainscreen_showevents" value="True"'.($phpgw_info['user']['preferences']['calendar']['mainscreen_showevents'] == 'Y' || $phpgw_info['user']['preferences']['calendar']['mainscreen_showevents'] == True?' checked':'').'>';
$str = '<input type="checkbox" name="mainscreen_showevents" value="True"'.($GLOBALS['phpgw_info']['user']['preferences']['calendar']['mainscreen_showevents'] == 'Y' || $GLOBALS['phpgw_info']['user']['preferences']['calendar']['mainscreen_showevents'] == True?' checked':'').'>';
display_item(lang('show day view on main screen'),$str);
$t_weekday[$phpgw_info['user']['preferences']['calendar']['weekdaystarts']] = ' selected';
$t_weekday[$GLOBALS['phpgw_info']['user']['preferences']['calendar']['weekdaystarts']] = ' selected';
$str = '<select name="weekdaystarts">'
. '<option value="Monday"'.$t_weekday['Monday'].'>'.lang('Monday').'</option>'
. '<option value="Sunday"'.$t_weekday['Sunday'].'>'.lang('Sunday').'</option>'
@ -144,28 +144,28 @@
. '</select>';
display_item(lang('weekday starts on'),$str);
$t_workdaystarts[$phpgw_info['user']['preferences']['calendar']['workdaystarts']] = ' selected';
$t_workdaystarts[$GLOBALS['phpgw_info']['user']['preferences']['calendar']['workdaystarts']] = ' selected';
$str = '<select name="workdaystarts">';
for ($i=0; $i<24; $i++)
{
$str .= '<option value="'.$i.'"'.$t_workdaystarts[$i].'>'
. $phpgw->common->formattime($i,'00') . '</option>';
. $GLOBALS['phpgw']->common->formattime($i,'00') . '</option>';
}
$str .= '</select>';
display_item(lang('work day starts on'),$str);
$t_workdayends[$phpgw_info['user']['preferences']['calendar']['workdayends']] = ' selected';
$t_workdayends[$GLOBALS['phpgw_info']['user']['preferences']['calendar']['workdayends']] = ' selected';
$str = '<select name="workdayends">';
for ($i=0; $i<24; $i++)
{
$str .= '<option value="'.$i.'"'.$t_workdayends[$i].'>'
. $phpgw->common->formattime($i,'00') . '</option>';
. $GLOBALS['phpgw']->common->formattime($i,'00') . '</option>';
}
$str .= '</select>';
display_item(lang('work day ends on'),$str);
$selected[$phpgw_info['user']['preferences']['calendar']['defaultcalendar']] = ' selected';
if (!isset($phpgw_info['user']['preferences']['calendar']['defaultcalendar']))
$selected[$GLOBALS['phpgw_info']['user']['preferences']['calendar']['defaultcalendar']] = ' selected';
if (!isset($GLOBALS['phpgw_info']['user']['preferences']['calendar']['defaultcalendar']))
{
$selected['month.php'] = ' selected';
}
@ -179,8 +179,8 @@
$selected = array();
$selected[$phpgw_info['user']['preferences']['calendar']['defaultfilter']] = ' selected';
if (! isset($phpgw_info['user']['preferences']['calendar']['defaultfilter']) || $phpgw_info['user']['preferences']['calendar']['defaultfilter'] == 'private')
$selected[$GLOBALS['phpgw_info']['user']['preferences']['calendar']['defaultfilter']] = ' selected';
if (! isset($GLOBALS['phpgw_info']['user']['preferences']['calendar']['defaultfilter']) || $GLOBALS['phpgw_info']['user']['preferences']['calendar']['defaultfilter'] == 'private')
{
$selected['private'] = ' selected';
}
@ -196,8 +196,8 @@
display_item(lang('Default calendar filter'),$str);
$selected = array();
$selected[intval($phpgw_info['user']['preferences']['calendar']['interval'])] = ' selected';
if (! isset($phpgw_info['user']['preferences']['calendar']['interval']))
$selected[intval($GLOBALS['phpgw_info']['user']['preferences']['calendar']['interval'])] = ' selected';
if (! isset($GLOBALS['phpgw_info']['user']['preferences']['calendar']['interval']))
{
$selected[60] = ' selected';
}
@ -210,7 +210,7 @@
45 => '45',
60 => '60'
);
$str = '<select name="interval">';
while(list($key,$value) = each($var))
{
@ -219,21 +219,21 @@
$str .= '</select>';
display_item(lang('Display interval in Day View'),$str);
$str = '<input type="checkbox" name="send_updates" value="True"'.($phpgw_info['user']['preferences']['calendar']['send_updates'] == 'Y' || $phpgw_info['user']['preferences']['calendar']['send_updates'] == True?' checked':'').'>';
$str = '<input type="checkbox" name="send_updates" value="True"'.($GLOBALS['phpgw_info']['user']['preferences']['calendar']['send_updates'] == 'Y' || $GLOBALS['phpgw_info']['user']['preferences']['calendar']['send_updates'] == True?' checked':'').'>';
display_item(lang('Send/receive updates via email'),$str);
$str = '<input type="checkbox" name="display_status" value="True"'.($phpgw_info['user']['preferences']['calendar']['display_status'] == 'Y' || $phpgw_info['user']['preferences']['calendar']['display_status'] == True?' checked':'').'>';
$str = '<input type="checkbox" name="display_status" value="True"'.($GLOBALS['phpgw_info']['user']['preferences']['calendar']['display_status'] == 'Y' || $GLOBALS['phpgw_info']['user']['preferences']['calendar']['display_status'] == True?' checked':'').'>';
display_item(lang('Display status of events'),$str);
$str = '<input type="checkbox" name="default_private" value="True"'.($phpgw_info['user']['preferences']['calendar']['default_private'] == 'Y' || $phpgw_info['user']['preferences']['calendar']['default_private'] == True?' checked':'').'>';
$str = '<input type="checkbox" name="default_private" value="True"'.($GLOBALS['phpgw_info']['user']['preferences']['calendar']['default_private'] == 'Y' || $GLOBALS['phpgw_info']['user']['preferences']['calendar']['default_private'] == True?' checked':'').'>';
display_item(lang('When creating new events default set to private'),$str);
$str = '<input type="checkbox" name="display_minicals" value="True"'.($phpgw_info['user']['preferences']['calendar']['display_minicals'] == 'Y' || $phpgw_info['user']['preferences']['calendar']['display_minicals'] == True?' checked':'').'>';
$str = '<input type="checkbox" name="display_minicals" value="True"'.($GLOBALS['phpgw_info']['user']['preferences']['calendar']['display_minicals'] == 'Y' || $GLOBALS['phpgw_info']['user']['preferences']['calendar']['display_minicals'] == True?' checked':'').'>';
display_item(lang('Display mini calendars when printing'),$str);
$str = '<input type="checkbox" name="print_black_white" value="True"'.($phpgw_info['user']['preferences']['calendar']['print_black_white'] == 'Y' || $phpgw_info['user']['preferences']['calendar']['print_black_white'] == True?' checked':'').'>';
$str = '<input type="checkbox" name="print_black_white" value="True"'.($GLOBALS['phpgw_info']['user']['preferences']['calendar']['print_black_white'] == 'Y' || $GLOBALS['phpgw_info']['user']['preferences']['calendar']['print_black_white'] == True?' checked':'').'>';
display_item(lang('Print calendars in black & white'),$str);
$p->pparse('out','pref');
$phpgw->common->phpgw_footer();
$GLOBALS['phpgw']->common->phpgw_footer();
?>