verify() static public method

@param void
static public verify ( ) : boolean
return boolean True if installed, false otherwise
Ejemplo n.º 1
0
require 'bootstrap.php';
require_once Pommo::$_baseDir . 'classes/Pommo_Install.php';
Pommo::init(array('authLevel' => 0, 'install' => TRUE));
session_start();
// required by smartyValidate. TODO -> move to prepareForForm() ??
$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 not already installed.
if (Pommo_Install::verify()) {
    $logger->addErr(Pommo::_T('poMMo is already installed.'));
    $smarty->assign('installed', TRUE);
    $smarty->display('install.tpl');
    Pommo::kill();
}
if (isset($_REQUEST['disableDebug'])) {
    unset($_REQUEST['debugInstall']);
} elseif (isset($_REQUEST['debugInstall'])) {
    $smarty->assign('debug', TRUE);
}
if (!SmartyValidate::is_registered_form() || empty($_POST)) {
    // ___ USER HAS NOT SENT FORM ___
    SmartyValidate::connect($smarty, true);
    SmartyValidate::register_validator('list_name', 'list_name', 'notEmpty', false, false, 'trim');
    SmartyValidate::register_validator('site_name', 'site_name', 'notEmpty', false, false, 'trim');
Ejemplo n.º 2
0
 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();
     }
 }