Esempio n. 1
0
function get_admin()
{
    if ($a = get_attributes()) {
        if ($admin = issetweb('ssp_uid_attribute')) {
            return $a['saml'][$admin][0];
        }
    }
    return false;
}
Esempio n. 2
0
File: steps.php Progetto: GEANT/CORE
<?php

//
require_once 'functions.php';
$steps = array(array('name' => 'Server requirements', 'fields' => array(array('type' => 'info', 'value' => 'Before proceeding with the full installation, we will carry out some tests on your server configuration to ensure that you are able to install and run our software. Please ensure you read through the results thoroughly and do not proceed until all the required tests are passed.'), array('type' => 'php-config', 'label' => 'Required PHP settings', 'items' => array('php_version' => array('>=5.3', 'PHP 5.3 or newer'), 'short_open_tag' => true, 'register_globals' => false, 'safe_mode' => false, 'upload_max_filesize' => '>=2mb')), array('type' => 'php-modules', 'label' => 'Required PHP modules', 'items' => array('pdo_pgsql' => array(true, 'PDO PostgreSQL functions (pdo_pgsql)'), 'apc' => array(true, 'Alternative PHP Cache (apc)'), 'fileinfo' => array(true, 'File Information (fileinfo)'), 'gd' => array(true, 'GD Graphics (gd)'))), array('type' => 'file-permissions', 'label' => 'Folders and files', 'items' => array(CORE_DIR . '/cache/' => 'write', CORE_DIR . '/uploads/' => 'write', CORE_DIR . '/logs/' => 'write', CORE_DIR . '/data/mails/' => 'write', CORE_DIR . '/public/.htaccess' => 'write', CORE_DIR . '/application/configs/application.ini' => 'write')))), array('name' => 'Zend Framework', 'fields' => array(array('type' => 'info', 'value' => 'Where is the Zend Framework library located?<br />
								This is directory that contains the "Zend" directory.'), array('label' => 'Location', 'type' => 'text', 'name' => 'zend_location', 'default' => ($z = file_path('Zend/Version.php')) ? $z : '', 'validate' => array(array('rule' => 'required')))), 'callbacks' => array(array('name' => 'zend_check', 'execute' => 'after', 'params' => array(array('version' => '1.11', 'location' => isset($_REQUEST['zend_location']) ? $_REQUEST['zend_location'] : null))))), array('name' => 'SimpleSAMLphp', 'fields' => array(array('type' => 'info', 'value' => 'Where is SimpleSAMLphp library located?'), array('label' => 'Location', 'type' => 'text', 'name' => 'ssp_location', 'default' => ($s = file_path('lib/SimpleSAML/Utilities.php')) ? $s : '', 'validate' => array(array('rule' => 'required')))), 'callbacks' => array(array('name' => 'simplesamlphp_check', 'execute' => 'after', 'params' => array('location' => isset($_REQUEST['ssp_location']) ? $_REQUEST['ssp_location'] : null)))), array('name' => 'Authenticate', 'fields' => array(array('type' => 'info', 'value' => '<p>Select the SimpleSAMLphp authentication source that will be used for CORE.</p><p>The next step will try to authenticate you. If this succeeds, the installer will make you the first administrative user.</p><p>Please make sure that the selected authsource actually <strong>WORKS</strong>, otherwise you will be <strong>lost</strong> after the redirect with no way back, and you have to restart your browser to try again...</p>'), array('label' => 'authsource', 'type' => 'select', 'name' => 'ssp_authsource', 'items' => get_authsources(), 'validate' => array(array('rule' => 'required'))))), array('name' => 'Attribute mappings', 'fields' => array(array('type' => 'info', 'value' => 'Choose which SAML atttributes should be used for:'), array('label' => 'Unique user ID', 'type' => 'select', 'name' => 'ssp_uid_attribute', 'items' => get_attributes()), array('label' => 'First name', 'type' => 'select', 'name' => 'ssp_fname_attribute', 'items' => get_attributes()), array('label' => 'Last name', 'type' => 'select', 'name' => 'ssp_lname_attribute', 'items' => get_attributes()), array('label' => 'E-mail', 'type' => 'select', 'name' => 'ssp_email_attribute', 'items' => get_attributes()), array('label' => 'Organisation', 'type' => 'select', 'name' => 'ssp_organisation_attribute', 'items' => get_attributes()), array('label' => 'Country', 'type' => 'select', 'name' => 'ssp_country_attribute', 'items' => get_attributes()))), array('name' => 'PostgreSQL', 'fields' => array(array('type' => 'info', 'value' => 'Please note that the database must be created prior to this step. If you have not created one yet, do so now.'), array('label' => 'hostname', 'name' => 'db_hostname', 'type' => 'text', 'default' => 'localhost', 'validate' => array(array('rule' => 'required'))), array('label' => 'database', 'name' => 'db_name', 'type' => 'text', 'default' => 'core_test_db', 'highlight_on_error' => false, 'validate' => array(array('rule' => 'required'), array('rule' => 'database', 'params' => array('db_host' => 'db_hostname', 'db_user' => 'db_username', 'db_pass' => 'db_password', 'db_name' => 'db_name')))), array('label' => 'username', 'name' => 'db_username', 'type' => 'text', 'default' => 'core_user', 'validate' => array(array('rule' => 'required'))), array('label' => 'password', 'name' => 'db_password', 'type' => 'text', 'default' => 'hackme', 'validate' => array(array('rule' => 'required'))))), array('name' => 'Mail options', 'fields' => array(array('type' => 'info', 'value' => 'CORE needs to send various e-mail messages'), array('label' => 'SMTP host', 'type' => 'text', 'name' => 'mail_transport_host', 'default' => 'localhost', 'validate' => array(array('rule' => 'required'))), array('label' => 'SMTP port', 'type' => 'text', 'name' => 'mail_transport_port', 'default' => '25', 'validate' => array(array('rule' => 'required'), array('rule' => 'numeric'))), array('label' => 'Default "From" mail address', 'type' => 'text', 'name' => 'default_from_email', 'default' => 'webmaster@' . mydomain(), 'validate' => array(array('rule' => 'required'))), array('label' => 'Default "From" name', 'type' => 'text', 'name' => 'default_from_name', 'default' => 'CORE', 'validate' => array(array('rule' => 'required'))), array('label' => 'Default "Reply-To" address', 'type' => 'text', 'name' => 'default_replyto_email', 'default' => 'webmaster+core@' . mydomain(), 'validate' => array(array('rule' => 'required'))), array('label' => 'Default "Reply-To" name', 'type' => 'text', 'name' => 'default_replyto_name', 'default' => 'CORE admins', 'validate' => array(array('rule' => 'required'))), array('label' => 'Send critical errors to', 'type' => 'text', 'name' => 'debug_mailto', 'default' => 'webmaster@' . mydomain(), 'validate' => array(array('rule' => 'required'))))), array('name' => 'Conference details', 'fields' => array(array('type' => 'info', 'value' => 'Here you can configure the initial conference. This will also be used to manage things'), array('label' => 'Conference name', 'type' => 'text', 'name' => 'conf_name', 'default' => ($bits = preg_split('/\\./', $_SERVER['HTTP_HOST'])) ? strtoupper($bits[0]) . ' Conference ' : '', 'validate' => array(array('rule' => 'required'))), array('label' => 'Conference abbreviation', 'type' => 'text', 'name' => 'conf_abbr', 'default' => ($bits = preg_split('/\\./', $_SERVER['HTTP_HOST'])) ? $bits[0] : 'niets', 'validate' => array(array('rule' => 'required'))), array('label' => 'hostname', 'type' => 'text', 'name' => 'conf_hostname', 'default' => $_SERVER['HTTP_HOST'], 'validate' => array(array('rule' => 'required'))))), array('name' => 'Save and install', 'fields' => array(array('type' => 'info', 'value' => '<p>All the information needed to bootstrap the installation is collected. We will now:
																									<ul>
																									<li>Install an empty database template</li>
																									<li>Give administrative permission to your account with:
																										<ul>
																											<li>SAML uid attribute: <strong>' . issetweb('ssp_uid_attribute') . '</strong></li>
																											<li>value: <strong>' . get_admin() . '</strong></li>
																										</ul>
																									</li>
																									</ul></p><p>This will take some seconds to complete. If everything goes well, you will be redirected to CORE</p>')), 'callbacks' => array(array('name' => 'install', 'params' => array(get_attributes())))));