/** * Initialize Galette relevant objects * * @param I18n $i18n I18n * @param Db $zdb Database instance * * @return boolean */ public function initObjects($i18n, $zdb) { if ($this->isInstall()) { $preferences = new Preferences($zdb, false); $ct = new \Galette\Entity\ContributionsTypes(); $status = new \Galette\Entity\Status(); include_once '../includes/fields_defs/members_fields.php'; include_once '../includes/fields_defs/members_fields_cats.php'; $fc = new \Galette\Entity\FieldsConfig(\Galette\Entity\Adherent::TABLE, $members_fields, $members_fields_cats, true); //$fc = new \Galette\Entity\FieldsCategories(); include_once GALETTE_ROOT . 'includes/fields_defs/texts_fields.php'; $texts = new \Galette\Entity\Texts($texts_fields, $preferences); $titles = new \Galette\Repository\Titles(); include_once GALETTE_ROOT . 'includes/fields_defs/pdfmodels_fields.php'; $models = new \Galette\Repository\PdfModels($zdb, $preferences); $this->_error = false; //Install preferences $res = $preferences->installInit($i18n->getID(), $this->getAdminLogin(), $this->getAdminPass()); $this->_proceedReport(_T("Preferences"), $res); //Install contributions types $res = $ct->installInit(); $this->_proceedReport(_T("Contributions types"), $res); //Install statuses $res = $status->installInit(); $this->_proceedReport(_T("Status"), $res); //Install fields configuration and categories $res = $fc->installInit($zdb); $this->_proceedReport(_T("Fields config and categories"), $res); //Install texts $res = $texts->installInit(false); $this->_proceedReport(_T("Mails texts"), $res); //Install titles $res = $titles->installInit($zdb); $this->_proceedReport(_T("Titles"), $res); //Install PDF models $res = $models->installInit($pdfmodels_fields, false); $this->_proceedReport(_T("PDF Models"), $res); return !$this->_error; } else { if ($this->isUpgrade()) { $preferences = new Preferences($zdb); $preferences->store(); $this->_proceedReport(_T("Update preferences"), true); return true; } } }
$session_name = null; //since PREFIX_DB and NAME_DB are required to properly instanciate sessions, // we have to check here if they're assigned if ($installer || !defined('PREFIX_DB') || !defined('NAME_DB')) { $session_name = 'galette_install'; } else { $session_name = PREFIX_DB . '_' . NAME_DB; } $session =& $_SESSION['galette'][$session_name]; /** * Language instantiation */ if (isset($session['lang'])) { $i18n = unserialize($session['lang']); } else { $i18n = new Core\I18n(); } if (isset($_POST['pref_lang']) && (strpos($_SERVER['PHP_SELF'], 'self_adherent.php') !== false || strpos($_SERVER['PHP_SELF'], 'install/index.php') !== false)) { $_GET['pref_lang'] = $_POST['pref_lang']; } if (isset($_GET['pref_lang'])) { $i18n->changeLanguage($_GET['pref_lang']); } $session['lang'] = serialize($i18n); require_once GALETTE_ROOT . 'includes/i18n.inc.php'; // initialize messages arrays $error_detected = array(); $warning_detected = array(); $success_detected = array(); /** * "Flash" messages management