This file is part of poMMo.
poMMo is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
poMMo is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Pommo. If not, see .
This fork is from https://github.com/soonick/poMMo
Please see docs/contribs for Contributors
/** * validateInstallationData * Validates data necessary for installation * * @param array $data.- Data to be validated * * @return boolean True on success, false otherwise */ public static function validateInstallationData($data) { require_once Pommo::$_baseDir . 'classes/Pommo_Validate.php'; self::$errors = array(); $validator = new Pommo_Validate(); $validator->setPost($data); $validator->addData('list_name', 'Other', false); $validator->addData('site_name', 'Other', false); $validator->addData('site_url', 'Url', false); $validator->addData('admin_password', 'Other', false); $validator->addData('admin_email', 'Email', false); $validator->addPasswordMatch('admin_password', 'admin_password2'); $result = $validator->checkData(); self::$errors = $validator->getErrors(); return $result; }
if ($install) { // installation of DB went OK, set configuration values to user supplied ones $pass = $_POST['admin_password']; // install configuration $_POST['admin_password'] = md5($_POST['admin_password']); Pommo_Api::configUpdate($_POST); // generate key to uniquely identify this installation $key = Pommo_Helper::makeCode(6); Pommo_Api::configUpdate(array('key' => $key), TRUE); Pommo::reloadConfig(); // load configuration [depricated?], set message defaults, load templates require_once Pommo::$_baseDir . 'classes/Pommo_Helper_Messages.php'; Pommo_Helper_Messages::resetDefault('all'); // install templates $file = Pommo::$_baseDir . 'sql/sql.templates.php'; if (!Pommo_Install::parseSQL(false, $file)) { $logger->addErr('Error Loading Default Mailing Templates.'); } $logger->addMsg(Pommo::_T('Installation Complete! You may now login and setup poMMo.')); $logger->addMsg(Pommo::_T('Login Username: '******'admin'); $logger->addMsg(Pommo::_T('Login Password: '******'installed', TRUE); } else { // INSTALL FAILED $dbo->debug(FALSE); // drop existing poMMo tables foreach (array_keys($dbo->table) as $key) { $table = $dbo->table[$key]; $sql = 'DROP TABLE IF EXISTS ' . $table; $dbo->query($sql); }
public static function init($args = array()) { $defaults = array('authLevel' => 1, 'keep' => FALSE, 'noSession' => FALSE, 'sessionID' => NULL, 'install' => FALSE); // merge submitted parameters $p = Pommo_Api::getParams($defaults, $args); // Return if not config.php file present if (!self::$_hasConfigFile) { return false; } // Bypass Reading of Config, SESSION creation, and authentication checks // and return if 'install' passed if ($p['install']) { return; } // load configuration data. Note: cannot save in session, as session // needs unique key -- this is simplest method. self::$_config = Pommo_Api::configGetBase(); // toggle DB debugging if (self::$_debug) { self::$_dbo->debug(TRUE); } // Bypass SESSION creation, reading of config, authentication checks // and return if 'noSession' passed if ($p['noSession']) { return; } // Start the session if (!empty($p['sessionID'])) { session_id($p['sessionID']); } self::startSession(); // check for "session" language -- user defined language on the fly. if (self::$_slanguage) { self::$_session['slanguage'] = self::$_slanguage; } if (isset(self::$_session['slanguage'])) { if (self::$_session['slanguage'] == 'en') { self::$_l10n = FALSE; } else { self::$_l10n = TRUE; require_once self::$_baseDir . 'classes/Pommo_Helper_L10n.php'; Pommo_Helper_L10n::init(self::$_session['slanguage'], self::$_baseDir); } self::$_slanguage = self::$_session['slanguage']; } // if authLevel == '*' || _poMMo_support (0 if poMMo not installed, // 1 if installed) if (defined('_poMMo_support')) { require_once self::$_baseDir . 'classes/Pommo_Install.php'; $p['authLevel'] = Pommo_Install::verify() ? 1 : 0; } // check authentication levels self::$_auth = new Pommo_Auth(array('requiredLevel' => $p['authLevel'])); // clear SESSION 'data' unless keep is passed. // TODO --> phase this out in favor of page state system? // -- add "persistent" flag & complicate state initilization... if (!$p['keep']) { self::$_session['data'] = array(); } }
*********************************/ require 'bootstrap.php'; require_once Pommo::$_baseDir . 'classes/Pommo_Install.php'; Pommo::init(array('authLevel' => 0, 'install' => TRUE)); Pommo::reloadConfig(); $logger =& Pommo::$_logger; $dbo =& Pommo::$_dbo; $dbo->dieOnQuery(FALSE); /********************************** SETUP TEMPLATE, PAGE *********************************/ require_once Pommo::$_baseDir . 'classes/Pommo_Template.php'; $smarty = new Pommo_Template(); $smarty->prepareForForm(); // Check to make sure poMMo is installed if (!Pommo_Install::verify()) { $logger->addErr(sprintf(Pommo::_T('poMMo does not appear to be installed! Please %s INSTALL %s before attempting an upgrade.'), '<a href="' . Pommo::$_baseUrl . 'install/install.php">', '</a>')); $smarty->display('upgrade.tpl'); Pommo::kill(); } // Check to make sure poMMo is PR14 or higher. if (Pommo::$_config['revision'] < 26) { $logger->addErr('Upgrade path unavailable. Cannot upgrade from Aardvark PR13.2 or below!'); $smarty->display('upgrade.tpl'); Pommo::kill(); } // Check to make sure poMMo is not already up to date. if (Pommo::$_config['revision'] == Pommo::$_revision && !isset($_REQUEST['forceUpgrade']) && !isset($_REQUEST['continue'])) { $logger->addErr(sprintf(Pommo::_T('poMMo appears to be up to date. If you want to force an upgrade, %s click here %s'), '<a href="' . $_SERVER['PHP_SELF'] . '?forceUpgrade=TRUE">', '</a>')); $smarty->display('upgrade.tpl'); Pommo::kill();