Exemple #1
0
     if (trim($sql) !== '') {
         // Prefix fuer die Tabellen einsetzen und SQL-Statement ausfuehren
         $sql = str_replace('%PREFIX%', $g_tbl_praefix, $sql);
         $db->query($sql);
     }
 }
 // create default data
 // add system component to database
 $component = new ComponentUpdate($db);
 $component->setValue('com_type', 'SYSTEM');
 $component->setValue('com_name', 'Admidio Core');
 $component->setValue('com_name_intern', 'CORE');
 $component->setValue('com_version', ADMIDIO_VERSION);
 $component->setValue('com_beta', (string) ADMIDIO_VERSION_BETA);
 $component->setValue('com_update_step', $component->getMaxUpdateStep());
 $component->save();
 // create a hidden system user for internal use
 // all recordsets created by installation will get the create id of the system user
 $gCurrentUser = new TableUsers($db);
 $gCurrentUser->setValue('usr_login_name', $gL10n->get('SYS_SYSTEM'));
 $gCurrentUser->setValue('usr_valid', '0');
 $gCurrentUser->setValue('usr_timestamp_create', DATETIME_NOW);
 $gCurrentUser->save(false);
 // no registered user -> UserIdCreate couldn't be filled
 $systemUserId = $gCurrentUser->getValue('usr_id');
 // create all modules components
 $sql = 'INSERT INTO ' . TBL_COMPONENTS . ' (com_type, com_name, com_name_intern, com_version, com_beta)
         VALUES (\'MODULE\', \'ANN_ANNOUNCEMENTS\', \'ANNOUCEMENTS\', \'' . ADMIDIO_VERSION . '\', ' . ADMIDIO_VERSION_BETA . ')
              , (\'MODULE\', \'BAC_DATABASE_BACKUP\', \'BACKUP\', \'' . ADMIDIO_VERSION . '\', ' . ADMIDIO_VERSION_BETA . ')
              , (\'MODULE\', \'SYS_CATEGORIES\', \'CATEGORIES\', \'' . ADMIDIO_VERSION . '\', ' . ADMIDIO_VERSION_BETA . ')
              , (\'MODULE\', \'DAT_DATES\', \'DATES\', \'' . ADMIDIO_VERSION . '\', ' . ADMIDIO_VERSION_BETA . ')