getParam('locale'); $siteDao =& DAORegistry::getDAO('SiteDAO', $this->dbconn); $site = $siteDao->newDataObject(); $site->setRedirect(0); $site->setMinPasswordLength(INSTALLER_DEFAULT_MIN_PASSWORD_LENGTH); $site->setPrimaryLocale($locale); $site->setInstalledLocales($this->installedLocales); $site->setSupportedLocales($this->installedLocales); if (!$siteDao->insertSite($site)) { $this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg()); return false; } $siteSettingsDao =& DAORegistry::getDAO('SiteSettingsDAO'); $siteSettingsDao->installSettings('registry/siteSettings.xml', array( 'contactEmail' => $this->getParam('adminEmail') )); // Add initial site administrator user $userDao =& DAORegistry::getDAO('UserDAO', $this->dbconn); $user = new User(); $user->setUsername($this->getParam('adminUsername')); $user->setPassword(Validation::encryptCredentials($this->getParam('adminUsername'), $this->getParam('adminPassword'), $this->getParam('encryption'))); $user->setFirstName($user->getUsername()); $user->setLastName(''); $user->setEmail($this->getParam('adminEmail')); if (!$userDao->insertUser($user)) { $this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg()); return false; } $roleDao =& DAORegistry::getDao('RoleDAO', $this->dbconn); $role = new Role(); $role->setJournalId(0); $role->setUserId($user->getId()); $role->setRoleId(ROLE_ID_SITE_ADMIN); if (!$roleDao->insertRole($role)) { $this->setError(INSTALLER_ERROR_DB, $this->dbconn->errorMsg()); return false; } // Install email template list and data for each locale $emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO'); $emailTemplateDao->installEmailTemplates($emailTemplateDao->getMainEmailTemplatesFilename()); foreach ($this->installedLocales as $locale) { $emailTemplateDao->installEmailTemplateData($emailTemplateDao->getMainEmailTemplateDataFilename($locale)); } return true; } } ?>