diff --git a/importexport/setup/default_records.inc.php b/importexport/setup/default_records.inc.php index cd08b9fc52..31ac816c32 100644 --- a/importexport/setup/default_records.inc.php +++ b/importexport/setup/default_records.inc.php @@ -10,30 +10,26 @@ */ require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.bodefinitions.inc.php'); -require_once(EGW_INCLUDE_ROOT. '/phpgwapi/inc/class.accounts.inc.php'); -require_once(EGW_INCLUDE_ROOT. '/phpgwapi/inc/class.translation.inc.php'); -// some globals we need -if ( !is_object($GLOBALS['egw']->accounts) ) $GLOBALS['egw']->accounts = new accounts(); -if ( !is_object($GLOBALS['egw']->translation) ) $GLOBALS['egw']->translation = new translation(); -if ( !is_object($GLOBALS['egw']->db)) $GLOBALS['egw']->db = $GLOBALS['egw_setup']->db; +// This sets up $GLOBALS['egw']->accounts and $GLOBALS['egw']->db +$GLOBALS['egw_setup']->setup_account_object(); -// apps, whose definitions should be installed automatically -// i don't know how to ask setup which apps are / ore are going to be installed. -$appnames = array ( - 'addressbook', -); +// Fetch translation object +$GLOBALS['egw_setup']->translation->setup_translation_sql(); +if ( !is_object($GLOBALS['egw']->translation) ) $GLOBALS['egw']->translation = $GLOBALS['egw_setup']->translation->sql; -foreach ($appnames as $appname) { - $defdir = EGW_INCLUDE_ROOT. "/$appname/importexport/definitions"; - if(!is_dir($defdir)) continue; - $d = dir($defdir); - - // step through each file in appdir - while (false !== ($entry = $d->read())) { - $file = $defdir. '/'. $entry; - list( $filename, $extension) = explode('.',$entry); - if ( $extension != 'xml' ) continue; - bodefinitions::import( $file ); - } +// step through every source code intstalled app +$egwdir = dir(EGW_INCLUDE_ROOT); +while (false !== ($appdir = $egwdir->read())) { + $defdir = EGW_INCLUDE_ROOT. "/$appdir/importexport/definitions"; + if ( !is_dir( $defdir ) ) continue; + + // step through each file in defdir of app + $d = dir($defdir); + while (false !== ($entry = $d->read())) { + $file = $defdir. '/'. $entry; + list( $filename, $extension) = explode('.',$entry); + if ( $extension != 'xml' ) continue; + bodefinitions::import( $file ); + } }