From 94ea6c3c0a3a23b89d40d0fc324473b9912ff3d0 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Sun, 4 Jan 2004 00:47:37 +0000 Subject: [PATCH] Massive intval and formatting update - previous version in tag 'cal_008-2' --- calendar/csv_import.php | 122 +- calendar/inc/class.boalarm.inc.php | 6 +- calendar/inc/class.bocalendar.inc.php | 298 +- calendar/inc/class.boholiday.inc.php | 37 +- calendar/inc/class.boicalendar.inc.php | 5564 ++++++++++--------- calendar/inc/class.calendar_holiday.inc.php | 531 +- calendar/inc/class.calendar_icap.inc.php | 590 +- calendar/inc/class.holidaycalc_JP.inc.php | 224 +- calendar/inc/class.holidaycalc_US.inc.php | 114 +- calendar/inc/class.socalendar.inc.php | 8 +- calendar/inc/class.socalendar__.inc.php | 334 +- calendar/inc/class.socalendar_sql.inc.php | 1548 +++--- calendar/inc/class.soholiday.inc.php | 18 +- calendar/inc/class.uialarm.inc.php | 10 +- calendar/inc/class.uicalendar.inc.php | 363 +- calendar/inc/class.uicustom_fields.inc.php | 8 +- calendar/inc/class.uiholiday.inc.php | 10 +- calendar/inc/hook_add_def_pref.inc.php | 16 +- calendar/inc/hook_deleteaccount.inc.php | 8 +- calendar/inc/hook_home.inc.php | 8 +- calendar/inc/hook_settings.inc.php | 8 +- calendar/inc/hook_sidebox_menu.inc.php | 2 +- calendar/index.php | 6 +- calendar/preferences.php | 108 +- 24 files changed, 4975 insertions(+), 4966 deletions(-) diff --git a/calendar/csv_import.php b/calendar/csv_import.php index 09e69b1d40..006c075f20 100644 --- a/calendar/csv_import.php +++ b/calendar/csv_import.php @@ -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 = "