mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
fix to create uid's for the calendar and a db-update to create them for the already existing events
This commit is contained in:
parent
7d5faa667a
commit
5ec6ce4d75
@ -563,6 +563,15 @@
|
||||
return $retval;
|
||||
}
|
||||
|
||||
function generate_uid($event)
|
||||
{
|
||||
if (!$event['id']) return False; // we need the id !!!
|
||||
|
||||
$suffix = $GLOBALS['phpgw_info']['server']['hostname'] ? $GLOBALS['phpgw_info']['server']['hostname'] : 'local';
|
||||
$prefix = 'cal-'.$event['id'].'-'.$GLOBALS['phpgw_info']['server']['install_id'];
|
||||
return $prefix . '@' . $suffix;
|
||||
}
|
||||
|
||||
function save_event(&$event)
|
||||
{
|
||||
$locks = Array(
|
||||
@ -575,38 +584,12 @@
|
||||
$this->stream->lock($locks);
|
||||
if($event['id'] == 0)
|
||||
{
|
||||
if(!$event['uid'])
|
||||
{
|
||||
if ($GLOBALS['phpgw_info']['server']['hostname'] != '')
|
||||
{
|
||||
$id_suffix = $GLOBALS['phpgw_info']['server']['hostname'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$id_suffix = $GLOBALS['phpgw']->common->randomstring(3).'local';
|
||||
}
|
||||
$parts = Array(
|
||||
0 => 'title',
|
||||
1 => 'description'
|
||||
);
|
||||
@reset($parts);
|
||||
while(list($key,$field) = each($parts))
|
||||
{
|
||||
$part[$key] = substr($GLOBALS['phpgw']->crypto->encrypt($event[$field]),0,20);
|
||||
if(!$GLOBALS['phpgw']->crypto->enabled)
|
||||
{
|
||||
$part[$key] = bin2hex(unserialize($part[$key]));
|
||||
}
|
||||
}
|
||||
$event['uid'] = $part[0].'-'.$part[1].'@'.$id_suffix;
|
||||
}
|
||||
$this->stream->query('INSERT INTO phpgw_cal(uid,title,owner,priority,is_public,category) '
|
||||
. "values('".$event['uid']."','".$this->stream->db_addslashes($event['title'])
|
||||
$this->stream->query('INSERT INTO phpgw_cal(title,owner,priority,is_public,category) '
|
||||
. "values('".$this->stream->db_addslashes($event['title'])
|
||||
. "',".(int)$event['owner'].','.(int)$event['priority'].','.(int)$event['public'].",'"
|
||||
. $event['category']."')",__LINE__,__FILE__);
|
||||
$event['id'] = $this->stream->get_last_insert_id('phpgw_cal','cal_id');
|
||||
}
|
||||
|
||||
$date = $this->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset;
|
||||
$enddate = $this->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset;
|
||||
$today = time() - $GLOBALS['phpgw']->datetime->tz_offset;
|
||||
@ -620,7 +603,13 @@
|
||||
$type = 'E';
|
||||
}
|
||||
|
||||
// new event or new created referencing event
|
||||
if (!$event['uid'] || $event['reference'] && strstr($event['uid'],'cal-'.$event['reference'].'-'))
|
||||
{
|
||||
$event['uid'] = $this->generate_uid($event);
|
||||
}
|
||||
$sql = 'UPDATE phpgw_cal SET '
|
||||
. 'uid='.$this->stream->quote($event['uid']).','
|
||||
. 'owner='.(int)$event['owner'].', '
|
||||
. 'datetime='.(int)$date.', '
|
||||
. 'mdatetime='.(int)$today.', '
|
||||
|
@ -12,7 +12,7 @@
|
||||
/* $Id$ */
|
||||
|
||||
$setup_info['calendar']['name'] = 'calendar';
|
||||
$setup_info['calendar']['version'] = '0.9.16.005';
|
||||
$setup_info['calendar']['version'] = '0.9.16.006';
|
||||
$setup_info['calendar']['app_order'] = 3;
|
||||
$setup_info['calendar']['enable'] = 1;
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
$setup_info['calendar']['description'] =
|
||||
'Powerful calendar with meeting request system and ACL security.';
|
||||
$setup_info['calendar']['note'] =
|
||||
'Bassed on Webcalendar by <a href="http://www.radix.net/~cknudsen" target="_blank">Craig Knudsen</a>.<p>
|
||||
'Originaly based on Webcalendar by <a href="http://www.radix.net/~cknudsen" target="_blank">Craig Knudsen</a>.<p>
|
||||
';
|
||||
$setup_info['calendar']['maintainer'] = array(
|
||||
'name' => 'Ralf Becker',
|
||||
|
@ -1030,4 +1030,24 @@
|
||||
$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.16.005';
|
||||
return $GLOBALS['setup_info']['calendar']['currentver'];
|
||||
}
|
||||
|
||||
|
||||
$test[] = '0.9.16.005';
|
||||
function calendar_upgrade0_9_16_005()
|
||||
{
|
||||
// creates uid's for all entries which do not have unique ones, they are '-@domain.com'
|
||||
$GLOBALS['phpgw_setup']->oProc->query("SELECT config_name,config_value FROM phpgw_config WHERE config_name IN ('install_id','mail_suffix') AND config_app='phpgwapi'",__LINE__,__FILE__);
|
||||
while ($GLOBALS['phpgw_setup']->oProc->next_record())
|
||||
{
|
||||
$config[$GLOBALS['phpgw_setup']->oProc->f(0)] = $GLOBALS['phpgw_setup']->oProc->f(1);
|
||||
}
|
||||
$GLOBALS['phpgw_setup']->oProc->query('UPDATE phpgw_cal SET uid='.
|
||||
$GLOBALS['phpgw_setup']->db->concat($GLOBALS['phpgw_setup']->db->quote('cal-'),'cal_id',
|
||||
$GLOBALS['phpgw_setup']->db->quote('-'.$config['install_id'].'@'.
|
||||
($config['mail_suffix'] ? $config['mail_suffix'] : 'local'))).
|
||||
" WHERE uid LIKE '-@%'");
|
||||
|
||||
$GLOBALS['setup_info']['calendar']['currentver'] = '0.9.16.006';
|
||||
return $GLOBALS['setup_info']['calendar']['currentver'];
|
||||
}
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user