diff --git a/contrib/fusiondirectory.conf b/contrib/fusiondirectory.conf index f976f074ca165f2ff45e66de19d3aeb96e6d654f..91dede14d42a79dd2c3aa85ad78f5c0c220ba624 100644 --- a/contrib/fusiondirectory.conf +++ b/contrib/fusiondirectory.conf @@ -5,8 +5,8 @@ Old services that are not based on simpleService needs to be listed here --> <serverservice> - <tab class="serviceDHCP" /> - <tab class="serviceDNS" /> + <tab class="serviceDHCP" /> + <tab class="serviceDNS" /> </serverservice> <!-- Main section ********************************************************** @@ -17,23 +17,23 @@ the FusionDirectory.conf(5) manual page. --> <main default="{$cv.location}" -{if $cv.optional.logging} +{if $cv.fdLogging} logging="TRUE" {else} logging="FALSE" {/if} -{if $cv.errorlvl} +{if $cv.fdDisplayErrors} displayErrors="TRUE" {else} displayErrors="FALSE" {/if} -{if $cv.optional.forcessl} +{if $cv.fdForceSSL} forceSSL="TRUE" {else} forceSSL="FALSE" {/if} - templateCompileDirectory="{$cv.optional.compile}" - debugLevel="{$cv.optional.debuglevel}" + templateCompileDirectory="{$templateCompileDirectory}" + debugLevel="{$cv.fdDebugLevel}" > <!-- Location definition --> diff --git a/html/setup.php b/html/setup.php index debb18c0ca9c8bc7c8b34bbebb19bb50604ad755..38e6e29ba6232285b7c19a41deab6a2a0277c9b8 100644 --- a/html/setup.php +++ b/html/setup.php @@ -86,6 +86,7 @@ setlocale(LC_ALL, $lang); $GLOBALS['t_language'] = $lang; $GLOBALS['t_gettext_message_dir'] = $BASE_DIR.'/locale/'; $smarty->assign("rtl", language_is_rtl($lang)); +$smarty->assign("must", '<span class="must">*</span>'); /* Set the text domain as 'fusiondirectory' */ $domain = 'fusiondirectory'; @@ -95,6 +96,14 @@ textdomain($domain); /* Load themes */ IconTheme::loadThemes('themes'); +/* Minimal config */ +if (!session::global_is_set('config')) { + $config = new config(''); + session::global_set('config', $config); +} +$config = session::global_get('config'); +load_plist(FALSE); +IconTheme::loadThemes('themes'); /* Call setup */ $display = ""; require_once("../setup/main.inc"); @@ -119,11 +128,12 @@ $focus .= '</script>'; /* show web frontend */ $setup = session::global_get('setup'); -$smarty->assign("contents", $display); -$smarty->assign("navigation", $setup->get_navigation_html()); -$smarty->assign("header", $setup->get_header_html()); -$smarty->assign("bottom", $focus.$setup->get_bottom_html()); -$smarty->assign("msg_dialogs", msg_dialog::get_dialogs()); +$smarty->assign("contents", $display.$setup->get_bottom_html()); +$smarty->assign("navigation", $setup->get_navigation_html()); +$smarty->assign("headline_image", $setup->get_header_image()); +$smarty->assign("headline", $setup->get_header_text()); +$smarty->assign("focus", $focus); +$smarty->assign("msg_dialogs", msg_dialog::get_dialogs()); if ($error_collector != "") { $smarty->assign("php_errors", preg_replace("/%BUGBODY%/", $error_collector_mailto, $error_collector)."</div>"); diff --git a/html/themes/default/setup.css b/html/themes/default/setup.css index 388f6f95ddb9bc330fa7b51080626d9b9ba6b90c..e040b19f90be1da9b270db63c983f4ca68227d2c 100644 --- a/html/themes/default/setup.css +++ b/html/themes/default/setup.css @@ -1,17 +1,6 @@ - - /********* * Setup *********/ -html.ltr body.setup div#header_left .plugtop { -margin-left:80px; -} -html.rtl div.setup_dialog { -text-align:left; -} -body.setup .plugin_window { -border-radius:5px; -} div.setup_menu { background-color:#F8F8F8; @@ -19,14 +8,6 @@ padding:4px 5px; border-bottom:1px solid #B0B0B0; } -/* Setup content header container */ -div.setup_plug_header_container { -} - -/* Setup content container */ -div.setup_contents_container { -} - /* Setup footer */ div.setup_bottom { clear:left; @@ -65,15 +46,8 @@ padding:2px 10px; vertical-align:middle; } -/* Navigation col */ #menucell.setup_navigation { -width:19%; -} -html.ltr #menucell.setup_navigation { -float:left; -} -html.rtl #menucell.setup_navigation { -float:right; +width:200px; } /* Navigation title */ @@ -95,6 +69,10 @@ padding-bottom:8px; margin-top:5px; margin-bottom:5px; } +div.navigation_element:first-child, div.navigation_element_active:first-child { +border-top:none; +margin-top:0; +} /* The box used for each setup step */ #menucell.setup_navigation li.menuitem > a { @@ -136,6 +114,10 @@ html.rtl #menucell.setup_navigation li.menuitem a.navigation_info { padding:4px 15px 3px 4px; } +.setup_language select#lang_selected { +width:100%; +} + /* Setup step 2 styles */ diff --git a/ihtml/themes/default/framework.tpl b/ihtml/themes/default/framework.tpl index 32f0d9f4382d5349a5ef07f59156d67c1c91da08..299d42975d400e6d44d841eea22ecea54161b74d 100644 --- a/ihtml/themes/default/framework.tpl +++ b/ihtml/themes/default/framework.tpl @@ -25,31 +25,30 @@ </div> </div> - <table class="framework"> - <tbody> - <tr> + <table class="framework"> + <tbody> + <tr> + {if !$hideMenus} + <!-- Menu --> + <td class="optional" id="menucell"> + {$menu} + <br/> + </td> + {/if} - {if !$hideMenus} - <!-- Menu --> - <td class="optional" id="menucell"> - {$menu} - <br/> - </td> + <!-- Plugin window --> + <td id="maincell"> + {$msg_dialogs} + <div class="plugin_window"> + {$contents} + </div> + {if $channel != ""} + <input type="hidden" name="_channel_" value="{$channel}"/> {/if} - - <!-- Plugin window --> - <td id="maincell"> - {$msg_dialogs} - <div class="plugin_window"> - {$contents} - </div> - {if $channel != ""} - <input type="hidden" name="_channel_" value="{$channel}"/> - {/if} - </td> - </tr> - </tbody> - </table> + </td> + </tr> + </tbody> + </table> {$errors} {$focus} diff --git a/include/class_config.inc b/include/class_config.inc index ab8fb0e13f9c238e38d5a485ca530db4e68a1d00..b8ec47f86ea1f949d1ed6a8a0c9d6b2a236e8d40 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -82,12 +82,8 @@ class config { */ function __construct($filename, $basedir = "") { - $this->parser = xml_parser_create(); $this->basedir = $basedir; - xml_set_object($this->parser, $this); - xml_set_element_handler($this->parser, "tag_open", "tag_close"); - /* Parse config file directly? */ if ($filename != "") { $this->parse($filename); @@ -123,9 +119,6 @@ class config { $this->section = ""; $this->currentLocation = ""; - $this->parser = xml_parser_create(); - xml_set_object($this->parser, $this); - xml_set_element_handler($this->parser, "tag_open", "tag_close"); $this->parse($this->filename); $this->set_current($this->current['NAME']); } @@ -141,6 +134,16 @@ class config { * \param string $filename The filename of the configuration file. */ function parse($filename) + { + $this->last_modified = filemtime($filename); + $this->filename = $filename; + $fh = fopen($filename, "r"); + $xmldata = fread($fh, 100000); + fclose($fh); + $this->parse_data($xmldata); + } + + function parse_data ($xmldata) { $this->data = array( "TABS" => array(), @@ -149,11 +152,10 @@ class config { "MENU" => array() ); - $this->last_modified = filemtime($filename); - $this->filename = $filename; - $fh = fopen($filename, "r"); - $xmldata = fread($fh, 100000); - fclose($fh); + $this->parser = xml_parser_create(); + xml_set_object($this->parser, $this); + xml_set_element_handler($this->parser, "tag_open", "tag_close"); + if (!xml_parse($this->parser, chop($xmldata))) { $msg = sprintf(_("XML error in fusiondirectory.conf: %s at line %d"), xml_error_string(xml_get_error_code($this->parser)), @@ -161,6 +163,7 @@ class config { msg_dialog::display(_("Configuration error"), $msg, FATAL_ERROR_DIALOG); exit; } + xml_parser_free($this->parser); } diff --git a/include/functions.inc b/include/functions.inc index 515cd6f0584dace3e9d761e1184073a0715b8dbb..e7af87c21cc54c004bc26aa000d4a5066a598473 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -178,7 +178,7 @@ function plugin_available($plugin) /*! * \brief Loads plist and load it in config object */ -function load_plist () +function load_plist ($ldap_available = TRUE) { global $config, $ui; if (!session::global_is_set('plist')) { @@ -188,8 +188,10 @@ function load_plist () $plist = new pluglist($config, $ui); session::global_set('plist', $plist); $config->loadPlist($plist); - $config->get_departments(); - $config->make_idepartments(); + if ($ldap_available) { + $config->get_departments(); + $config->make_idepartments(); + } } return session::global_get('plist'); } diff --git a/plugins/config/class_configInLdap.inc b/plugins/config/class_configInLdap.inc index 2d6aca7a6aff6c48004c75d3c3ed1d61bf40500d..b48f8c15c5fbe3247d83c17dcbe797bec91006dc 100644 --- a/plugins/config/class_configInLdap.inc +++ b/plugins/config/class_configInLdap.inc @@ -72,6 +72,7 @@ class configInLdap extends simplePlugin static function getAttributesInfo () { + global $config; $plugins = array(); if (session::global_is_set('plist')) { $plugins = array_keys(session::global_get('plist')->info); @@ -105,12 +106,12 @@ class configInLdap extends simplePlugin 'attrs' => array( new BooleanAttribute ( _('rfc2307bis'), - _('Enables rfc2307bis style groups. You can use member attributes instead of memberUid in this case.'), + _('Enables rfc2307bis style groups. You can use "member" attributes instead of "memberUid" with this schema.'), 'fdRfc2307bis', FALSE, FALSE ), new BooleanAttribute ( - _('Schema check'), + _('Schema validation'), _('Enables schema checking during login.'), 'fdSchemaCheck', FALSE, FALSE @@ -230,11 +231,13 @@ class configInLdap extends simplePlugin 'attrs' => array( new BooleanAttribute ( _('Enable snapshots'), _('This enables you to save certain states of entries and restore them later on.'), - 'fdEnableSnapshots' + 'fdEnableSnapshots', FALSE, + TRUE ), new StringAttribute ( _('Snapshot base'), _('The base where snapshots should be stored inside of the LDAP.'), - 'fdSnapshotBase' + 'fdSnapshotBase', FALSE, + 'ou=snapshots,'.$config->current['BASE'] ), ) ), diff --git a/plugins/config/main.inc b/plugins/config/main.inc index 7966b5f102dddce6f684ff185c9f1433020c8b7a..26fce5abb46c03b1d49d21b88e13cc04f889f215 100644 --- a/plugins/config/main.inc +++ b/plugins/config/main.inc @@ -1,7 +1,7 @@ <?php /* This code is part of FusionDirectory (http://www.fusiondirectory.org/) - Copyright (C) 2012-2013 FusionDirectory + Copyright (C) 2012-2014 FusionDirectory This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,5 +18,5 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -configInLdap::mainInc('configInLdap', CONFIGRDN.$config->current['BASE'], 'tabs_configInLdap'); +simplePlugin::mainInc('configInLdap', CONFIGRDN.$config->current['BASE'], 'tabs_configInLdap'); ?> diff --git a/setup/class_setup.inc b/setup/class_setup.inc index 2f6a75e2bac77df55fd8bc63aeb771ebbfc3d367..a442258afb349ac4d3a2cfc12a428d2c6e1b3b39 100644 --- a/setup/class_setup.inc +++ b/setup/class_setup.inc @@ -25,27 +25,27 @@ require_once("class_setupStep.inc"); class setup { - var $i_steps = 9; // Number of setup steps - var $i_current = 1; // Current step - var $i_last = 1; // Last setup step; + var $i_steps; // Number of setup steps + var $i_current = 0; // Current step + var $i_previous = 0; // Previous setup step; + var $i_config = 5; var $o_steps = array(); var $captured_values = array(); function __construct() { - $i = 1; - $this->o_steps[$i++] = new Step_Welcome(); - $this->o_steps[$i++] = new Step_Language(); - $this->o_steps[$i++] = new Step_Checks(); - $this->o_steps[$i++] = new Step_Ldap(); - $this->o_steps[$i++] = new Step_Schema(); - $this->o_steps[$i++] = new Step_Config1(); - $this->o_steps[$i++] = new Step_Config2(); - $this->o_steps[$i++] = new Step_Config3(); - $this->o_steps[$i++] = new Step_Migrate(); - $this->o_steps[$i++] = new Step_Finish(); - - $this->i_steps = $i - 1; + $this->o_steps = array( + new Step_Welcome(), + new Step_Language(), + new Step_Checks(), + new Step_Ldap(), + new Step_Schema(), + new Step_Config_before_init(), + new Step_Migrate(), + new Step_Finish(), + ); + + $this->i_steps = count($this->o_steps); /* Ensure that setup is not reachable if fusiondirectory.conf exist (CONFIG_FILE) */ if (file_exists(CONFIG_DIR."/".CONFIG_FILE)) { @@ -79,7 +79,7 @@ class setup $smarty = get_smarty(); $smarty->assign('usePrototype', 'true'); - $this->o_steps[$this->i_last]->set_active(FALSE); + $this->o_steps[$this->i_previous]->set_active(FALSE); $this->o_steps[$this->i_current]->set_active(); $content = $this->o_steps[$this->i_current]->execute(); return $content; @@ -118,22 +118,23 @@ class setup /* check if current setup step is completed now and activate the next step if possible */ - for ($i = 1; $i <= $this->i_steps; $i++) { + for ($i = 0; $i < $this->i_steps; $i++) { if ($this->o_steps[$i]->is_completed()) { if (isset($this->o_steps[($i + 1)])) { $this->o_steps[($i + 1)]->set_enabled(); } } else { $this->disable_steps_from($i + 1); + break; } } } /* Disable all following steps, if one step isn't compelted right now .*/ - for ($i = 1; $i <= $this->i_steps; $i++) { - if ($this->o_steps[$i]->is_completed()) { - } else { + for ($i = 0; $i < $this->i_steps; $i++) { + if (!$this->o_steps[$i]->is_completed()) { $this->disable_steps_from($i + 1); + break; } } @@ -151,34 +152,26 @@ class setup $step = $this->i_current - 1; } - $once = TRUE; foreach ($_POST as $name => $value) { - if (preg_match("/^step_[0-9]*$/", $name) && $once) { + if (preg_match("/^step_[0-9]*$/", $name)) { $step = preg_replace("/^step_/", "", $name); + break; } } if ($this->selectable_step($step)) { - $this->i_last = $this->i_current; - $this->i_current = $step; + $this->i_previous = $this->i_current; + $this->i_current = $step; } } function disable_steps_from($start) { - $found = FALSE; - foreach ($this->o_steps as $key => &$step) { - if ($key == $start) { - $found = TRUE; - } - - if ($found) { - $step->set_enabled(FALSE); - $step->set_completed(FALSE); - } + for ($i = $start; $i < $this->i_steps; $i++) { + $this->o_steps[$i]->set_enabled(FALSE); + $this->o_steps[$i]->set_completed(FALSE); } - unset($step); } @@ -246,12 +239,16 @@ class setup return $str; } + /* Create header entry */ + function get_header_text() + { + return $this->o_steps[$this->i_current]->get_long_title(); + } /* Create header entry */ - function get_header_html() + function get_header_image() { - $str = $this->o_steps[$this->i_current]->print_header(); - return $str; + return $this->o_steps[$this->i_current]->header_image; } @@ -273,5 +270,32 @@ class setup } return 0; } + + /* Called when LDAP is configured */ + function read_ldap_config() + { + global $config; + /* Get attributes from current ldap step */ + $tmp = $this->o_steps[$this->i_current]->get_attributes(); + foreach ($tmp as $name => $value) { + $this->captured_values[$name] = $value; + } + $smarty = get_smarty(); + $cv = $this->captured_values; + /* Fill missing values needed by config file template (config step not done yet) */ + $cv['fdLogging'] = FALSE; + $cv['fdDisplayErrors'] = FALSE; + $cv['fdForceSSL'] = TRUE; + $cv['fdDebugLevel'] = 0; + $smarty->assign("cv", xmlentities($cv)); + $smarty->assign("config_checksum", md5(file_get_contents(CONFIG_TEMPLATE_DIR.CONFIG_FILE))); + $smarty->assign("templateCompileDirectory", SPOOL_DIR); + $xml = $smarty->fetch(CONFIG_TEMPLATE_DIR.CONFIG_FILE); + $config->parse_data($xml); + $config->set_current($config->data['MAIN']['DEFAULT']); + session::global_un_set('plist'); + load_plist(); + $this->o_steps[$this->i_config] = new Step_Config($this->captured_values); + } } ?> diff --git a/setup/class_setupStep.inc b/setup/class_setupStep.inc index c485adf932539748779323bed52575e21c8bda00..51cb65c56f1f75f28fb923c79c7366afa22286d5 100644 --- a/setup/class_setupStep.inc +++ b/setup/class_setupStep.inc @@ -19,6 +19,147 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +class setupStep extends simplePlugin +{ + protected $s_title = "Still undefined"; + protected $s_title_long = "Still undefined"; + protected $s_info = "Still undefined"; + var $is_active = FALSE; + var $is_enabled = FALSE; + var $is_completed = FALSE; + + var $header_image = "images/setup/user.png"; + + static function getAttributesInfo() + { + return array(); + } + + function __construct() + { + global $config; + parent::__construct($config); + $this->update_strings(); + } + + function update_strings() + { + die('abstract method'); + } + + function get_title() + { + return $this->s_title; + } + + function get_long_title() + { + return $this->s_title_long; + } + + function get_small_info() + { + return $this->s_info; + } + + function is_active() + { + return $this->is_active; + } + + function is_enabled() + { + return $this->is_enabled; + } + + function is_completed() + { + return $this->is_completed; + } + + function set_active($value = TRUE) + { + $this->is_active = ($value == TRUE); + } + + function set_enabled($value = TRUE) + { + $this->is_enabled = ($value == TRUE); + } + + function set_completed($value = TRUE) + { + $this->is_completed = ($value == TRUE); + } + + /* Return attributes handled by this setup step */ + function get_attributes() + { + $tmp = array(); + foreach (array_keys($this->attributesAccess) as $attr) { + $tmp[$attr] = $this->$attr; + } + return $tmp; + } + + /* bypass acl system as there is no user login */ + function acl_is_writeable($attribute, $skip_write = FALSE) + { + return TRUE; + } + function acl_is_readable($attribute) + { + return TRUE; + } + function acl_is_createable($base = "") + { + return TRUE; + } + function acl_is_removeable($base = "") + { + return TRUE; + } + function acl_is_moveable($base = "") + { + return TRUE; + } + function getacl($attribute, $skip_write = FALSE) + { + return 'cmdrw'; + } + + /* bypass LDAP loading */ + protected function loadAttributes() + { + foreach ($this->attributesInfo as &$sectionInfo) { + foreach ($sectionInfo['attrs'] as $name => &$attr) { + $attr->setParent($this); + } + unset($attr); + } + unset($sectionInfo); + + $this->updateAttributesValues(); + } + + /* Establish ldap connection */ + function get_ldap_link() + { + $cv = $this->parent->captured_values; + $ldap_l = new LDAP( + $cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls'] + ); + + $ldap = new ldapMultiplexer($ldap_l); + $ldap->cd($cv['base']); + return $ldap; + } +} + class setup_step extends plugin { var $s_title = "Still undefined"; @@ -102,16 +243,6 @@ class setup_step extends plugin return $tmp; } - function print_header() - { - $image = get_template_path($this->header_image); - $display = "<div style='padding:3px;'>"; - $display .= " <p class=\"center\" style=\"margin:0px 0px 0px 5px;padding:0px;font-size:24px;font-weight:bold;\"><img class=\"center\" src=\"$image\" align=\"middle\" alt=\"*\"> ".$this->s_title_long."</p>\n"; - $display .= "</div>\n"; - - return $display; - } - function get_ldap_link() { /* Establish ldap connection */ diff --git a/setup/class_setupStep_Checks.inc b/setup/class_setupStep_Checks.inc index bd05ba92d1b007ab7b07bb580c9eac99a7375506..b1a2f7493264c461c70200199ac6b0b8115b004f 100644 --- a/setup/class_setupStep_Checks.inc +++ b/setup/class_setupStep_Checks.inc @@ -1,5 +1,4 @@ <?php - /* This code is part of FusionDirectory (http://www.fusiondirectory.org/) Copyright (C) 2003 Cajus Pollmeier @@ -20,19 +19,36 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -class Step_Checks extends setup_step +class Step_Checks extends setupStep { - var $basic_checks = array(); - var $config_checks = array(); - var $is_writeable = array(); var $header_image = 'geticon.php?context=categories&icon=checks&size=48'; + static function getAttributesInfo() + { + return array( + 'modules' => array( + 'name' => _('PHP module and extension checks'), + 'template' => get_template_path("setup_checks.tpl", TRUE, dirname(__FILE__)), + 'attrs' => array( + new FakeAttribute('basic_checks') + ) + ), + 'setup' => array( + 'name' => _('PHP setup configuration (<a href="?info" target="_blank">show information)</a>)'), + 'template' => get_template_path("setup_checks.tpl", TRUE, dirname(__FILE__)), + 'attrs' => array( + new FakeAttribute('config_checks') + ) + ) + ); + } + function __construct() { + parent::__construct(); $this->update_strings(); } - function update_strings() { $this->s_title = _("Installation check"); @@ -40,25 +56,18 @@ class Step_Checks extends setup_step $this->s_info = _("Basic checks for PHP compatibility and extensions"); } - /* Execute and display template */ function execute() { $this->run_checks(); - $smarty = get_smarty(); - $smarty->assign("basic", $this->basic_checks); - $smarty->assign("config", $this->config_checks); - $smarty->assign("is_writeable", $this->is_writeable); - return $smarty->fetch(get_template_path("setup_checks.tpl", TRUE, dirname(__FILE__))); + return parent::execute(); } - /* Execute all checks */ function run_checks() { - $this->basic_checks = array(); - $this->config_checks = array(); - $this->is_writeable = array(); + $basic_checks = array(); + $config_checks = array(); /* PHP version check */ $N = _("Checking PHP version"); @@ -66,7 +75,7 @@ class Step_Checks extends setup_step $S = _("Please upgrade to a supported version."); $R = $this->check_php_version(); $M = TRUE; - $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + $basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); /* Check for imap extension */ $N = msgPool::checkingFor("LDAP"); @@ -74,7 +83,7 @@ class Step_Checks extends setup_step $S = msgPool::installPhpModule("LDAP"); $R = is_callable("ldap_bind"); $M = TRUE; - $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + $basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); /* Check for gettext support */ $N = msgPool::checkingFor("gettext"); @@ -82,7 +91,7 @@ class Step_Checks extends setup_step $S = msgPool::installPhpModule("gettext"); $R = is_callable("bindtextdomain"); $M = TRUE; - $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + $basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); /* Check for php5-curl support */ $N = msgPool::checkingFor("curl"); @@ -90,7 +99,7 @@ class Step_Checks extends setup_step $S = msgPool::installPhpModule("php5-curl"); $R = is_callable("curl_init"); $M = TRUE; - $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + $basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); /* Check for iconv */ $N = msgPool::checkingFor("inconv"); @@ -98,7 +107,7 @@ class Step_Checks extends setup_step $S = msgPool::installPhpModule("iconv"); $R = is_callable("iconv"); $M = TRUE; - $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + $basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); /* Check for installed mhash module */ $N = msgPool::checkingFor("hash method"); @@ -106,7 +115,7 @@ class Step_Checks extends setup_step $S = msgPool::installPhpModule("mhash/sha1"); $R = is_callable('mhash') || is_callable('sha1'); $M = FALSE; - $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + $basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); /* Check if imap module is available */ $N = msgPool::checkingFor("IMAP"); @@ -114,7 +123,7 @@ class Step_Checks extends setup_step $S = msgPool::installPhpModule("IMAP"); $R = is_callable("imap_open"); $M = TRUE; - $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + $basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); /* Check if mbstring module is available */ $N = msgPool::checkingFor(_("mbstring")); @@ -122,7 +131,7 @@ class Step_Checks extends setup_step $S = msgPool::installPhpModule("mbstring"); $R = is_callable("mb_strlen"); $M = TRUE; - $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + $basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); /* Check if MDB2 module is available */ $N = msgPool::checkingFor(_("MDB2")); @@ -133,7 +142,7 @@ class Step_Checks extends setup_step if ($M) { $D .= "<br/>"._("If you do not want to install MDB2 and won't use databases, remove the class_databaseManagement.inc file."); } - $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + $basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); $N = msgPool::checkingFor(_("imagick")); $D = _("FusionDirectory requires this extension to handle images."); @@ -148,14 +157,14 @@ class Step_Checks extends setup_step } $M = TRUE; - $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + $basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); $N = msgPool::checkingFor(_("compression module")); $D = _("FusionDirectory requires this extension to handle snapshots."); $S = msgPool::installPhpModule("compile with --with-zlib"); $R = is_callable("gzcompress"); $M = FALSE; - $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + $basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); /* PHP Configuration checks */ @@ -165,7 +174,7 @@ class Step_Checks extends setup_step $S = _("Search for 'register_globals' in your php.ini and switch it to 'Off'."); $R = ini_get("register_globals") == 0; $M = FALSE; - $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + $config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); /* session lifetime set to >=86400 seconds ? */ $N = "session.gc_maxlifetime >= <b>86400</b>"; @@ -174,7 +183,7 @@ class Step_Checks extends setup_step $S = _("Search for 'session.gc_maxlifetime' in your php.ini and set it to 86400 or higher."); $R = ini_get("session.gc_maxlifetime") >= 86400; $M = FALSE; - $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + $config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); /* Session auto start must be turned off */ $session_auto_start = ini_get('session.auto_start'); @@ -183,7 +192,7 @@ class Step_Checks extends setup_step $S = _("Search for 'session.auto_start' in your php.ini and set it to 'Off'."); $R = !$session_auto_start; $M = TRUE; - $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + $config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); /* Check if memory limit is set to 128 or > */ $N = "memory_limit >= <b>128</b>"; @@ -191,7 +200,7 @@ class Step_Checks extends setup_step $S = _("Search for 'memory_limit' in your php.ini and set it to '128M' or higher."); $R = ini_get('memory_limit') >= 128; $M = TRUE; - $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + $config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); /* Implicit Flush disabled can increase performance */ $N = "implicit_flush = <b>"._("Off")."</b>"; @@ -199,7 +208,7 @@ class Step_Checks extends setup_step $S = _("Search for 'implicit_flush' in your php.ini and set it to 'Off'."); $R = !ini_get('implicit_flush'); $M = FALSE; - $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + $config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); /* Check if execution time is set to 30 */ $N = "max_execution_time >= <b>30</b>"; @@ -207,7 +216,7 @@ class Step_Checks extends setup_step $S = _("Search for 'max_execution_time' in your php.ini and set it to '30' or higher."); $R = ini_get("max_execution_time") >= 30; $M = TRUE; - $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + $config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); /* Expose php should be set to off */ $N = "expose_php = <b>"._("Off")."</b>"; @@ -215,7 +224,7 @@ class Step_Checks extends setup_step $S = _("Search for 'expose_php' in your php.ini and set if to 'Off'."); $R = !ini_get("expose_php"); $M = FALSE; - $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + $config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); /* Emulating old stuff? */ $N = "zend.ze1_compatibility_mode = <b>"._("Off")."</b>"; @@ -223,28 +232,19 @@ class Step_Checks extends setup_step $S = _("Search for 'zend.ze1_compatibility_mode' in your php.ini and set it to 'Off'."); $R = !ini_get('zend.ze1_compatibility_mode'); $M = FALSE; - $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); - - /* Configuration file */ + $config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); - /* Check if we can create a config file.*/ - $N = _("Configuration writeable"); - $D = _("The configuration file can't be written"); - $S = sprintf(_("FusionDirectory reads its configuration from a file located in (%s/%s). The setup can write the configuration directly if it is writeable."), CONFIG_DIR, CONFIG_FILE); - /* is there a config file ? or There is none, but can we create a file there ?*/ - $R = ( file_exists(CONFIG_DIR."/".CONFIG_FILE) && is_writeable(CONFIG_DIR."/".CONFIG_FILE)) - || (!file_exists(CONFIG_DIR."/".CONFIG_FILE) && is_writeable(CONFIG_DIR)); - $M = FALSE; - $this->is_writeable[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + $this->basic_checks = $basic_checks; + $this->config_checks = $config_checks; } - function save_object() { + parent::save_object(); /* If everything is fine, set this step to completed * and allow switching to next setup step */ $failed = FALSE; - foreach (array("basic_checks","config_checks","is_writeable") as $type) { + foreach (array('basic_checks','config_checks') as $type) { foreach ($this->$type as $obj) { if ($obj['MUST'] && !$obj['RESULT']) { $failed = TRUE; @@ -255,12 +255,11 @@ class Step_Checks extends setup_step $this->is_completed = !$failed; } - /* Check if current PHP version is compatible with the current version of FusionDirectory */ function check_php_version() { - return version_compare(phpversion(), "5.2.0", ">="); + return version_compare(phpversion(), '5.2.0', '>='); } } diff --git a/setup/class_setupStep_Config.inc b/setup/class_setupStep_Config.inc new file mode 100644 index 0000000000000000000000000000000000000000..54518956665232a6390696815b4c4cdcf70e3926 --- /dev/null +++ b/setup/class_setupStep_Config.inc @@ -0,0 +1,166 @@ +<?php +/* + This code is part of FusionDirectory (http://www.fusiondirectory.org/) + Copyright (C) 2007 Fabian Hickert + Copyright (C) 2011-2014 FusionDirectory + + This program 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 2 of the License, or + (at your option) any later version. + + This program 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 this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +class Step_Config_before_init extends setupStep +{ + function update_strings() + { + global $config; + if (!isset($config->current['BASE'])) { + $config->current['BASE'] = ''; + } + $infos = configInLdap::plInfo(); + $this->header_image = $infos['plIcon']; + $this->s_title = $infos['plShortName']; + $this->s_title_long = $infos['plDescription']; + $this->s_info = $infos['plDescription']; + } +} + +class Step_Config extends configInLdap +{ + var $is_active = FALSE; + var $is_enabled = FALSE; + var $is_completed = FALSE; + var $header_image; + + static function plInfo() + { + return array(); + } + + function __construct($cv) + { + global $config; + parent::__construct($config, CONFIGRDN.$config->current['BASE']); + + $this->fdRfc2307bis = $cv['rfc2307bis']; + $this->fdLanguage = $cv['lang_selected']; + $this->fdSchemaCheck = $cv['enable_schema_check']; + } + + function update_strings() + { + $infos = parent::plInfo(); + $this->header_image = $infos['plIcon']; + } + + function get_title() + { + $infos = parent::plInfo(); + return $infos['plShortName']; + } + + function get_long_title() + { + $infos = parent::plInfo(); + return $infos['plDescription']; + } + + function get_small_info() + { + $infos = parent::plInfo(); + return $infos['plDescription']; + } + + /* Return attributes handled by this setup step */ + function get_attributes() + { + $tmp = array(); + foreach (array_keys($this->attributesAccess) as $attr) { + $tmp[$attr] = $this->$attr; + } + return $tmp; + } + + function save_object() + { + global $config; + parent::save_object(); + $tmp = $this->check(); + if (count($tmp) == 0) { + /* Save in LDAP */ + $this->save(); + /* Reload config from LDAP */ + $config->set_current($config->current['NAME']); + $this->is_completed = TRUE; + } else { + $this->is_completed = FALSE; + } + } + + function is_active() + { + return $this->is_active; + } + + function is_enabled() + { + return $this->is_enabled; + } + + function is_completed() + { + return $this->is_completed; + } + + function set_active($value = TRUE) + { + $this->is_active = ($value == TRUE); + } + + function set_enabled($value = TRUE) + { + $this->is_enabled = ($value == TRUE); + } + + function set_completed($value = TRUE) + { + $this->is_completed = ($value == TRUE); + } + + /* bypass acl system as there is no user login */ + function acl_is_writeable($attribute, $skip_write = FALSE) + { + return TRUE; + } + function acl_is_readable($attribute) + { + return TRUE; + } + function acl_is_createable($base = "") + { + return TRUE; + } + function acl_is_removeable($base = "") + { + return TRUE; + } + function acl_is_moveable($base = "") + { + return TRUE; + } + function getacl($attribute, $skip_write = FALSE) + { + return 'cmdrw'; + } +} +?> diff --git a/setup/class_setupStep_Config1.inc b/setup/class_setupStep_Config1.inc deleted file mode 100644 index ac0d96ee4fd74a777f61e1ad5166ff1809a3e629..0000000000000000000000000000000000000000 --- a/setup/class_setupStep_Config1.inc +++ /dev/null @@ -1,258 +0,0 @@ -<?php - -/* - This code is part of FusionDirectory (http://www.fusiondirectory.org/) - Copyright (C) 2007 Fabian Hickert - Copyright (C) 2011-2015 FusionDirectory - - This program 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 2 of the License, or - (at your option) any later version. - - This program 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 this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -class Step_Config1 extends setup_step -{ - - var $peopleou = "ou=people"; - var $groupou = "ou=groups"; - var $aclroleou = "ou=aclroles"; - var $peopledn = "uid"; - var $uidbase = 1100; - var $strict = TRUE; - - var $cngen_active = FALSE; - var $cngen = "%sn% %givenName%"; - - var $header_image = 'geticon.php?context=categories&icon=settings&size=48'; - var $account_expiration = FALSE; - var $base_hook = ""; - var $base_hook_active = FALSE; - - var $encryption = "ssha"; - var $theme = "default"; - - var $include_personal_title = FALSE; - - var $pwd_rules = array( - "pwminlen" => 6, - "pwminlen_active" => FALSE, - "pwdiffer" => 5, - "pwdiffer_active" => FALSE, - "externalpwdhook" => "", - "externalpwdhook_active" => FALSE - ); - - var $id_settings = array( - "idgen" => "%laS|sn%-%laSs[2-4]|givenName%", - "idgen_active" => FALSE, - "minid" => "100", - "minid_active" => FALSE - ); - - var $crypt_methods = array(); - - var $attributes = array("peopleou","groupou","aclroleou","peopledn","uidbase","encryption","theme", - "base_hook","base_hook_active","account_expiration","strict","include_personal_title", - "cngen_active","cngen"); - - function __construct() - { - $this->update_strings(); - - $tmp = passwordMethod::get_available_methods(); - foreach ($tmp['name'] as $name) { - $this->crypt_methods[$name] = $name; - } - } - - - function update_strings() - { - $this->s_title = _("FusionDirectory settings 1/3"); - $this->s_title_long = _("FusionDirectory settings 1/3"); - $this->s_info = _("FusionDirectory generic settings"); - } - - - function execute() - { - global $BASE_DIR; - $smarty = get_smarty(); - $smarty->assign("peopledns", array("uid","cn")); - $smarty->assign("id_settings", reverse_html_entities($this->id_settings)); - $smarty->assign("crypt_methods", reverse_html_entities($this->crypt_methods)); - $smarty->assign("themes", reverse_html_entities($this->get_themes())); - $smarty->assign("pwd_rules", reverse_html_entities($this->pwd_rules)); - $smarty->assign("bool", array(FALSE => _("No"), TRUE => _("Yes"))); - foreach ($this->attributes as $attr) { - $smarty->assign($attr, htmlentities($this->$attr, ENT_QUOTES, "UTF-8")); - } - - /* !!! Attention strict is inverse. If you change this, - * don't forget to change save_object too - */ - $smarty->assign("strict", !$this->strict); - return $smarty->fetch("$BASE_DIR/setup/setup_config1.tpl"); - } - - - function get_themes() - { - $dir = opendir( "../ihtml/themes/"); - $themes = array(); - while (($file = readdir($dir)) !== FALSE) { - if (is_dir("../ihtml/themes/".$file) && !preg_match("/^\./", $file)) { - $themes[$file] = $file; - } - } - return $themes; - } - - function check() - { - $message = array(); - - if (isset($this->id_settings['minid_active']) && !is_numeric($this->id_settings['minid'])) { - $message[] = sprintf(_("The specified value for '%s' must be a numeric value"), _("Group/user min id")); - } - - if (preg_match("/,$/", $this->peopleou)) { - $message[] = sprintf(_("Don't add a trailing comma to '%s'."), _("People storage ou")); - } - - if (preg_match("/,$/", $this->groupou)) { - $message[] = sprintf(_("Don't add a trailing comma to '%s'."), _("Group storage ou")); - } - - if (preg_match("/,$/", $this->aclroleou)) { - $message[] = sprintf(_("Don't add a trailing comma to '%s'."), _("ACL role storage ou")); - } - - if (!is_numeric($this->uidbase)) { - $message[] = _("User id base must be numeric"); - } - - if (($this->pwd_rules['pwminlen_active']) && !is_numeric($this->pwd_rules['pwminlen'])) { - $message[] = _("The given password minimum length is not numeric."); - } - if (($this->pwd_rules['pwdiffer_active']) && !is_numeric($this->pwd_rules['pwdiffer'])) { - $message[] = _("The given password differ value is not numeric."); - } - return $message; - } - - function save_object() - { - if (isset($_POST['step5_posted'])) { - - /* Get attributes */ - foreach ($this->attributes as $attr) { - if (isset($_POST[$attr])) { - $this->$attr = validate(get_post($attr)); - } - } - - /* !!! Attention strict is inverse. If you change this, - * don't forget to change the smarty assignment too - */ - if (isset($_POST['strict'])) { - if ($_POST['strict']) { - $this->strict = FALSE; - } else { - $this->strict = TRUE; - } - } - - if (isset($_POST['minid_active'])) { - $this->id_settings['minid_active'] = TRUE; - if (isset($_POST['minid'])) { - $this->id_settings['minid'] = get_post('minid'); - } - } else { - $this->id_settings['minid_active'] = FALSE; - } - - /* Generic settings */ - if (isset($_POST['idgen_active'])) { - $this->id_settings['idgen_active'] = TRUE; - if (isset($_POST['idgen'])) { - $this->id_settings['idgen'] = get_post('idgen'); - } - } else { - $this->id_settings['idgen_active'] = FALSE; - } - - /* Get password settings */ - if (isset($_POST['pwdiffer_active'])) { - $this->pwd_rules['pwdiffer_active'] = TRUE; - if (isset($_POST['pwdiffer'])) { - $this->pwd_rules['pwdiffer'] = get_post('pwdiffer'); - } - } else { - $this->pwd_rules['pwdiffer_active'] = FALSE; - } - - /* Get password minimum length posts */ - if (isset($_POST['pwminlen_active'])) { - $this->pwd_rules['pwminlen_active'] = TRUE; - if (isset($_POST['pwminlen'])) { - $this->pwd_rules['pwminlen'] = get_post('pwminlen'); - } - } else { - $this->pwd_rules['pwminlen_active'] = FALSE; - } - - /* External pwd settings */ - if (isset($_POST['externalpwdhook_active'])) { - $this->pwd_rules['externalpwdhook_active'] = TRUE; - if (isset($_POST['externalpwdhook'])) { - $this->pwd_rules['externalpwdhook'] = get_post('externalpwdhook'); - } - } else { - $this->pwd_rules['externalpwdhook_active'] = FALSE; - } - - /* base hook settings */ - $this->pwd_rules['base_hook_active'] = FALSE; - - if (isset($_POST['cngen_active'])) { - $this->cngen_active = TRUE; - if (isset($_POST['cngen'])) { - $this->cngen = get_post('cngen'); - } - } else { - $this->cngen_active = FALSE; - } - } - - $tmp = $this->check(); - if (count($tmp) == 0) { - $this->is_completed = TRUE; - } else { - $this->is_completed = FALSE; - } - } // if template posted - - - /* Attributes that are interesting for configuration generation */ - function get_attributes() - { - $tmp = setup_step::get_attributes(); - foreach (array("pwd_rules","id_settings") as $attr) { - $tmp[$attr] = $this->$attr; - } - return $tmp; - } -} - -?> diff --git a/setup/class_setupStep_Config2.inc b/setup/class_setupStep_Config2.inc deleted file mode 100644 index 9f0b0a59d6c76895581d6d36599d81cd76d56641..0000000000000000000000000000000000000000 --- a/setup/class_setupStep_Config2.inc +++ /dev/null @@ -1,129 +0,0 @@ -<?php - -/* - This code is part of FusionDirectory (http://www.fusiondirectory.org/) - Copyright (C) 2007 Fabian Hickert - Copyright (C) 2011-2015 FusionDirectory - - This program 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 2 of the License, or - (at your option) any later version. - - This program 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 this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - - -class Step_Config2 extends setup_step -{ - var $sambaidmapping = FALSE; - var $header_image = 'geticon.php?context=categories&icon=settings&size=48'; - - var $generic_settings = array( "snapshot_active" => TRUE, - "snapshot_base" => "ou=snapshots,%base%"); - - var $timezone = "Europe/Paris"; - var $timezones = array(); - - var $attributes = array("timezone"); - var $called = FALSE; - - function __construct() - { - $this->update_strings(); - - $this->timezones = timezone::_get_tz_zones(); - } - - - function update_strings() - { - $this->s_title = _("FusionDirectory settings 2/3"); - $this->s_title_long = _("FusionDirectory settings 2/3"); - $this->s_info = _("Customize special parameters"); - } - - - function execute() - { - global $BASE_DIR; - - /* Update snapshot values, with already collected values */ - foreach (array("snapshot_base") as $attr) { - foreach ($this->parent->captured_values as $replace_name => $replace_value) { - if (is_string($replace_value)) { - $this->generic_settings[$attr] = preg_replace("/%".$replace_name."%/", $replace_value, $this->generic_settings[$attr]); - } - } - } - - $smarty = get_smarty(); - $smarty->assign("generic_settings", reverse_html_entities($this->generic_settings)); - - foreach ($this->attributes as $attr) { - $smarty->assign($attr, reverse_html_entities($this->$attr)); - } - $smarty->assign("timezone", $this->timezone); - $smarty->assign("timezones", $this->timezones); - return $smarty->fetch("$BASE_DIR/setup/setup_config2.tpl"); - } - - function save_object() - { - if (isset($_POST['step6_posted'])) { - - if (isset($_POST['timezone']) && isset($this->timezones[$_POST['timezone']])) { - $this->timezone = $_POST['timezone']; - } - - /* Get attributes */ - foreach ($this->attributes as $attr) { - if (isset($_POST[$attr])) { - $this->$attr = validate(get_post($attr)); - } - } - - if (isset($_POST['snapshot_active'])) { - $this->generic_settings['snapshot_active'] = TRUE; - if (isset($_POST['snapshot_base'])) { - $this->generic_settings['snapshot_base'] = get_post('snapshot_base'); - } - } else { - $this->generic_settings['snapshot_active'] = FALSE; - } - } - - $tmp = $this->check(); - if (count($tmp) == 0) { - $this->is_completed = TRUE; - } else { - $this->is_completed = FALSE; - } - } - - - function check() - { - return array(); - } - - - /* Attributes that are interesting for configuration generation */ - function get_attributes() - { - $tmp = setup_step::get_attributes(); - foreach (array("generic_settings") as $attr) { - $tmp[$attr] = $this->$attr; - } - return $tmp; - } -} - -?> diff --git a/setup/class_setupStep_Config3.inc b/setup/class_setupStep_Config3.inc deleted file mode 100644 index 4862c484e08180aa02092c7ca670c106e6cb9837..0000000000000000000000000000000000000000 --- a/setup/class_setupStep_Config3.inc +++ /dev/null @@ -1,293 +0,0 @@ -<?php - -/* - This code is part of FusionDirectory (http://www.fusiondirectory.org/) - Copyright (C) 2007 Fabian Hickert - Copyright (C) 2011-2015 FusionDirectory - - This program 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 2 of the License, or - (at your option) any later version. - - This program 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 this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - - -class Step_Config3 extends setup_step -{ - var $header_image = 'geticon.php?context=categories&icon=settings&size=48'; - - var $errorlvl = FALSE; - - var $login_attributes = array("uid" => "uid", - "mail" => "mail", - "uid,mail" => "both"); - var $optional = array( - "login_attribute" => "uid", - "list_summary" => TRUE, - "forceglobals" => TRUE, - "forcessl" => FALSE, - "ldapstats" => FALSE, - "warnssl" => TRUE, - "debuglevel" => 0, - "session_lifetime" => 1800, - "compile" => SPOOL_DIR, - "max_ldap_query_time" => "5.0", - "max_ldap_query_time_active" => FALSE, - - "mailQueueScriptPath_active" => FALSE, - "notifydir_active" => FALSE, - "ppd_path_active" => FALSE, - "kioskpath_active" => FALSE, - "gosaSupportURI_active" => FALSE, - "kioskpath_active" => FALSE, - - "enableCopyPaste" => TRUE, - "logging" => TRUE, - "uniq_identifier" => "entryCSN", - "uniq_identifier_active" => TRUE, - - "sudoou_active" => FALSE, - - "noprimarygroup" => FALSE); - - var $attributes = array("errorlvl"); - - function __construct() - { - $this->update_strings(); - } - - - function update_strings() - { - $this->s_title = _("FusionDirectory settings 3/3"); - $this->s_title_long = _("FusionDirectory settings 3/3"); - $this->s_info = _("Tweak some FusionDirectory core behaviour"); - } - - - function execute() - { - global $BASE_DIR; - $smarty = get_smarty(); - $smarty->assign("bool", array(FALSE => _("No"), TRUE => _("Yes"))); - $smarty->assign("uniq_identifiers", array("entryCSN" => "entryCSN", - "contextCSN" => "contextCSN" )); - - $smarty->assign("logging", $this->optional['logging']); - $smarty->assign("optional", reverse_html_entities($this->optional)); - foreach ($this->attributes as $attr) { - $smarty->assign($attr, reverse_html_entities($this->$attr)); - } - $smarty->assign("login_attributes", $this->login_attributes); - return $smarty->fetch("$BASE_DIR/setup/setup_config3.tpl"); - } - - - function save_object() - { - if (isset($_POST['step6a_posted'])) { - - /* Get attributes */ - foreach ($this->attributes as $attr) { - if (isset($_POST[$attr])) { - $this->$attr = validate(get_post($attr)); - } - } - - foreach (array("login_attribute","list_summary","noprimarygroup","forceglobals","forcessl","ldapstats","warnssl","compile","debuglevel","session_lifetime","enableCopyPaste","logging") as $name) { - if (isset($_POST[$name])) { - $this->optional[$name] = get_post($name); - } - } - - $this->optional['ppd_path_active'] = FALSE; - - if (isset($_POST['max_ldap_query_time_active'])) { - $this->optional['max_ldap_query_time_active'] = TRUE; - if (isset($_POST['max_ldap_query_time'])) { - $this->optional['max_ldap_query_time'] = get_post('max_ldap_query_time'); - } - } else { - $this->optional['max_ldap_query_time_active'] = FALSE; - } - - $this->optional['mailQueueScriptPath_active'] = FALSE; - - $this->optional['kioskpath_active'] = FALSE; - - $this->optional['sudoou_active'] = FALSE; - - $this->optional['notifydir_active'] = FALSE; - - $this->optional['gosaSupportURI_active'] = FALSE; - - if (isset($_POST['enableCopyPaste'])) { - $this->optional['enableCopyPaste'] = get_post('enableCopyPaste'); - } - - /* Get logging */ - $this->optional['logging'] = isset($_POST['logging']); - - if (isset($_POST['uniq_identifier_active'])) { - $this->optional['uniq_identifier_active'] = TRUE; - if (isset($_POST['uniq_identifier'])) { - $this->optional['uniq_identifier'] = get_post('uniq_identifier'); - } - } else { - $this->optional['uniq_identifier_active'] = FALSE; - } - } - - $tmp = $this->check(); - if (count($tmp) == 0) { - $error = $this->save_config_in_ldap(); - if (!empty($error)) { - msg_dialog::display(_("Setup error"), $error, ERROR_DIALOG); - } - $this->is_completed = TRUE; - } else { - $this->is_completed = FALSE; - } - } - - function save_config_in_ldap () - { - $cv = $this->parent->captured_values; - - $attrs = array( - 'objectClass' => 'fusionDirectoryConf', - 'fdPasswordDefaultHash' => $cv['encryption'], - 'fdUserRDN' => $cv['peopleou'], - 'fdGroupRDN' => $cv['groupou'], - 'fdAclRoleRDN' => $cv['aclroleou'], - 'fdGidNumberBase' => $cv['uidbase'], - 'fdUidNumberBase' => $cv['uidbase'], - ); - if ($cv['cngen_active']) { - $attrs['fdAccountRDN'] = 'cn='.$cv['cngen']; - } else { - $attrs['fdAccountPrimaryAttribute'] = $cv['peopledn']; - } - - if ($this->optional['login_attribute']) { - $attrs['fdLoginAttribute'] = $this->optional['login_attribute']; - } else { - $attrs['fdLoginAttribute'] = 'uid'; - } - if ($cv['timezone']) { - $attrs['fdTimezone'] = $cv['timezone']; - } - $attrs['fdRfc2307bis'] = ($cv['rfc2307bis']?"TRUE":"FALSE"); - $attrs['fdPersonalTitleInDN'] = ($cv['include_personal_title']?"TRUE":"FALSE"); - if ($cv['base_hook_active']) { - $attrs['fdNextIdHook'] = $cv['base_hook']; - } - if ($cv['id_settings']['idgen_active']) { - $attrs['fdIdGenerator'] = $cv['id_settings']['idgen']; - } - $attrs['fdStrictNamingRules'] = ($cv['strict']?"TRUE":"FALSE"); - if ($cv['id_settings']['minid_active']) { - $attrs['fdMinId'] = $cv['id_settings']['minid']; - } - $attrs['fdHandleExpiredAccounts'] = ($cv['account_expiration']?"TRUE":"FALSE"); - $attrs['fdEnableSnapshots'] = ($cv['generic_settings']['snapshot_active']?"TRUE":"FALSE"); - $attrs['fdSnapshotBase'] = $cv['generic_settings']['snapshot_base']; - - $attrs['fdLanguage'] = $cv['lang_selected']; - $attrs['fdTheme'] = $cv['theme']; - - if ($this->optional['max_ldap_query_time_active']) { - $attrs['fdLdapMaxQueryTime'] = $this->optional['max_ldap_query_time']; - } - $attrs['fdPrimaryGroupFilter'] = ($this->optional['noprimarygroup']?"TRUE":"FALSE"); - if ($this->optional['uniq_identifier_active']) { - $attrs['fdModificationDetectionAttribute'] = $this->optional['uniq_identifier']; - } - $attrs['fdCopyPaste'] = ($this->optional['enableCopyPaste']?"TRUE":"FALSE"); - $attrs['fdListSummary'] = ($this->optional['list_summary']?"TRUE":"FALSE"); - $attrs['fdLdapStats'] = ($this->optional['ldapstats']?"TRUE":"FALSE"); - $attrs['fdWarnSSL'] = ($this->optional['warnssl']?"TRUE":"FALSE"); - $attrs['fdForceSSL'] = ($this->optional['forcessl']?"TRUE":"FALSE"); - - if ($cv['pwd_rules']['pwminlen_active']) { - $attrs['fdPasswordMinLength'] = $cv['pwd_rules']['pwminlen']; - } - if ($cv['pwd_rules']['pwdiffer_active']) { - $attrs['fdPasswordMinDiffer'] = $cv['pwd_rules']['pwdiffer']; - } - if ($cv['pwd_rules']['externalpwdhook_active']) { - $attrs['fdPasswordHook'] = $cv['pwd_rules']['externalpwdhook']; - } - $attrs['fdSchemaCheck'] = ($cv['enable_schema_check']?"TRUE":"FALSE"); - - $attrs['fdLogging'] = ($this->optional['logging']?"TRUE":"FALSE"); - $attrs['fdDisplayErrors'] = ($this->errorlvl?"TRUE":"FALSE"); - $attrs['fdSessionLifetime'] = $this->optional['session_lifetime']; - $attrs['fdDebugLevel'] = $this->optional['debuglevel']; - - $ldap_l = new LDAP( - $cv['admin'], $cv['password'], $cv['connection'], - FALSE, $cv['tls'] - ); - - $ldap = new ldapMultiplexer($ldap_l); - $dn = CONFIGRDN.$cv['base']; - $ldap->cd($cv['base']); - $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $dn)); // create the branch (default is ou=configs) - if (!$ldap->success()) { - return msgPool::ldaperror($ldap->get_error(), $dn, 'create_missing_trees', get_class()); - } - $ldap->cat($dn); - if ($ldap->count()) { // delete existing config - $ldap->rmdir($dn); - if (!$ldap->success()) { - return msgPool::ldaperror($ldap->get_error(), $dn, 'rmdir', get_class()); - } - } - $ldap->cd($dn); - $ldap->add($attrs); // create the config object - if (!$ldap->success()) { - return msgPool::ldaperror($ldap->get_error(), $dn, 'add', get_class()); - } - } - - - function check() - { - $message = array(); - - if (!is_numeric($this->optional['session_lifetime'])) { - $message[] = _("Session lifetime must be a numeric value!"); - } - - if (!is_numeric($this->optional['max_ldap_query_time'])) { - $message[] = _("Maximum LDAP query time must be a numeric value!"); - } - - return $message; - } - - - /* Attributes that are interesting for configuration generation */ - function get_attributes() - { - $tmp = setup_step::get_attributes(); - foreach (array("optional") as $attr) { - $tmp[$attr] = $this->$attr; - } - return $tmp; - } - -} - -?> diff --git a/setup/class_setupStep_Finish.inc b/setup/class_setupStep_Finish.inc index ab50e654edf75a7a38689cee439a6ecf4554e135..b727b2a4eb11f72c41dde18b91273a623df0d3fa 100644 --- a/setup/class_setupStep_Finish.inc +++ b/setup/class_setupStep_Finish.inc @@ -1,5 +1,4 @@ <?php - /* This code is part of FusionDirectory (http://www.fusiondirectory.org/) Copyright (C) 2007 Fabian Hickert @@ -22,7 +21,6 @@ class Step_Finish extends setup_step { - var $cfg_file_written = FALSE; var $header_image = 'geticon.php?context=devices&icon=server&size=48'; function __construct() @@ -42,8 +40,9 @@ class Step_Finish extends setup_step function get_conf_data() { $smarty = get_smarty(); - $smarty->assign("cv", xmlentities($this->parent->captured_values)); - $smarty->assign("config_checksum", md5(file_get_contents(CONFIG_TEMPLATE_DIR.CONFIG_FILE))); + $smarty->assign("cv", xmlentities($this->parent->captured_values)); + $smarty->assign("config_checksum", md5(file_get_contents(CONFIG_TEMPLATE_DIR.CONFIG_FILE))); + $smarty->assign("templateCompileDirectory", SPOOL_DIR); return $smarty->fetch(CONFIG_TEMPLATE_DIR.CONFIG_FILE); } @@ -79,15 +78,7 @@ class Step_Finish extends setup_step { global $BASE_DIR; - if (!function_exists("posix_getgrgid")) { - $webgroup = ""; - } else { - $info = posix_getgrgid(posix_getgid()); - $webgroup = $info['name']; - } - - /* Check if there is currently an active fusiondirectory.conf - */ + /* Check if there is currently an active fusiondirectory.conf */ $exists = file_exists(CONFIG_DIR."/".CONFIG_FILE); /* Redirect to FusionDirectory login, if : @@ -118,12 +109,12 @@ class Step_Finish extends setup_step $smarty = get_smarty(); $smarty->assign("err_msg", $err_msg); $smarty->assign("msg2", sprintf(_("After downloading and placing the file under %s, please make sure that the user the webserver is running with is able to read %s, while other users shouldn't."), CONFIG_DIR, CONFIG_FILE)); - $smarty->assign("cv", $this->parent->captured_values); + + //~ Changer ça pour du sp. return $smarty->fetch("$BASE_DIR/setup/setup_finish.tpl"); } - /* check if given file is world readable */ function is_world_readable($file) { @@ -131,19 +122,6 @@ class Step_Finish extends setup_step $p = fileperms($file); return (decbin($p & 4) == TRUE); } - - - function save_object() - { - if (isset($_POST['step8_posted'])) { - /* Get attributes */ - foreach ($this->attributes as $attr) { - if (isset($_POST[$attr])) { - $this->$attr = validate($_POST[$attr]); - } - } - } - } } ?> diff --git a/setup/class_setupStep_Language.inc b/setup/class_setupStep_Language.inc index 2ca340058d5c49eb5a2224b768614c439314c017..e2852c55367b86935b0bda6a65c7736db36d5e3c 100644 --- a/setup/class_setupStep_Language.inc +++ b/setup/class_setupStep_Language.inc @@ -1,5 +1,4 @@ <?php - /* This code is part of FusionDirectory (http://www.fusiondirectory.org/) Copyright (C) 2007 Fabian Hickert @@ -20,20 +19,39 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ - -class Step_Language extends setup_step +class Step_Language extends setupStep { - var $lang_selected = ""; /* Language selected from select box */ - var $lang = "en_EN"; /* Detected language */ - var $languages = array(); - var $attributes = array("lang","lang_selected"); var $header_image = 'geticon.php?context=applications&icon=config-language&size=48'; + static function getAttributesInfo() + { + return array( + 'lang' => array( + 'name' => _('Preferred language'), + 'class' => array('fullwidth', 'setup_language'), + 'attrs' => array( + new DisplayAttribute( + '', '', + 'msg', FALSE + ), + new SelectAttribute( + '', '', + 'lang_selected', FALSE + ), + new HiddenAttribute( + 'lang', FALSE, + 'en_EN' + ) + ) + ) + ); + } + function __construct() { - $this->lang = get_browser_language(); - $this->lang_selected = ""; - $this->update_strings(); + parent::__construct(); + $this->lang = get_browser_language(); + $this->attributesAccess['lang_selected']->setSize(20); } function update_strings() @@ -41,32 +59,27 @@ class Step_Language extends setup_step $this->s_title = _("Language setup"); $this->s_title_long = _("Language setup"); $this->s_info = _("This step allows you to select your preferred language."); + $this->msg = _('At this point, you can select the site wide default language. Choosing "automatic" will use the language requested by the browser. This setting can be overriden per user.'); } function execute() { - $this->languages = get_languages(TRUE); - asort($this->languages); - $this->languages = array_merge(array("" => _("Automatic")), $this->languages); - $smarty = get_smarty(); - $smarty->assign("languages", $this->languages); - $smarty->assign("lang", $this->lang); - $smarty->assign("rtl", language_is_rtl($this->lang)); - $smarty->assign("lang_selected", $this->lang_selected); - return $smarty->fetch(get_template_path("setup_language.tpl", TRUE, dirname(__FILE__))); + $languages = get_languages(TRUE); + asort($languages); + $languages = array_merge(array("" => _("Automatic")), $languages); + $this->attributesAccess['lang_selected']->setChoices(array_keys($languages), array_values($languages)); + return parent::execute(); } function save_object() { - if ((isset($_POST['lang_selected'])) && isset($this->languages[$_POST['lang_selected']])) { - $this->lang_selected = $_POST['lang_selected']; - $this->is_completed = TRUE; + parent::save_object(); + $this->is_completed = TRUE; - if ($this->lang_selected != "") { - session::set('lang', $this->lang_selected); - } else { - session::set('lang', $this->lang); - } + if ($this->lang_selected != "") { + session::set('lang', $this->lang_selected); + } else { + session::set('lang', $this->lang); } } } diff --git a/setup/class_setupStep_Ldap.inc b/setup/class_setupStep_Ldap.inc index 5a6d3bce44a353d8be39360261ea3f5ddbc5f8ab..cc8207b74dfe0f588ca83323e5b45e45d23991d2 100644 --- a/setup/class_setupStep_Ldap.inc +++ b/setup/class_setupStep_Ldap.inc @@ -1,5 +1,4 @@ <?php - /* This code is part of FusionDirectory (http://www.fusiondirectory.org/) Copyright (C) 2007 Fabian Hickert @@ -20,36 +19,97 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -class Step_Ldap extends setup_step +class Step_Ldap extends setupStep { - var $connection = "ldap://localhost:389"; - var $location = "default"; - var $admin = ""; - var $password = ""; - var $base = ""; - var $admin_given = ""; - - var $append_base_to_admin_dn = TRUE; + var $header_image = 'geticon.php?context=places&icon=network-server&size=48'; var $connect_id = FALSE; var $bind_id = FALSE; - var $resolve_filter = "*"; - var $resolve_user = FALSE; - var $tls = FALSE; - - var $rfc2307bis = FALSE; - var $attributes = array("connection","location","admin","password","base","admin_given", - "append_base_to_admin_dn","tls","rfc2307bis"); - - var $header_image = 'geticon.php?context=places&icon=network-server&size=48'; + static function getAttributesInfo() + { + return array( + 'connection' => array( + 'name' => _('LDAP connexion'), + 'attrs' => array( + new StringAttribute( + _('Location name'), _('Name of this connexion to show in the LDAP server list'), + 'location', TRUE, + 'default' + ), + new StringAttribute( + _('Connection URI'), _('URI to contact the LDAP server. Usually starts with ldap://'), + 'connection', TRUE, + 'ldap://localhost:389' + ), + new BooleanAttribute( + _('TLS connection'), _('Should TLS be used to connect to this LDAP server?'), + 'tls', FALSE + ), + new SelectAttribute( + _('Base'), _('The LDAP directory base'), + 'base', TRUE + ) + ) + ), + 'auth' => array( + 'name' => _('Authentication'), + 'attrs' => array( + new CompositeAttribute( + _('DN of the admin account to use for binding to the LDAP. Base is automatically appended.'), + 'admin', + array( + new StringAttribute( + '', '', + 'admin_given', TRUE, + 'cn=admin' + ), + new DisplayAttribute( + '', '', 'base_append' + ) + ), + '^(.+)(.*)$', + '%s%s', + '', + _('Admin DN') + ), + new PasswordAttribute( + _('Admin password'), _('Password for the admin account to use for binding to the LDAP'), + 'password', TRUE + ), + ) + ), + 'schema' => array( + 'name' => _('Schema settings'), + 'attrs' => array( + new BooleanAttribute( + _('Use rfc2307bis compliant groups'), _('Enables rfc2307bis style groups. You can use "member" attributes instead of "memberUid" with this schema.'), + 'rfc2307bis', FALSE + ), + ) + ), + 'status' => array( + 'name' => _('Status'), + 'attrs' => array( + new DisplayAttribute( + _('Current status'), _('Result of last attempt at checking LDAP binding and basic schemas'), + 'status', FALSE + ), + ) + ) + ); + } function __construct() { + parent::__construct(); $this->update_strings(); + $this->attributesAccess['base']->setSubmitForm(TRUE); + $this->attributesAccess['admin']->setLinearRendering(TRUE); + $this->update_base_choices(); + $this->status = $this->get_connection_status(); } - function update_strings() { $this->s_title = _("LDAP setup"); @@ -57,43 +117,36 @@ class Step_Ldap extends setup_step $this->s_info = _("This dialog performs the basic configuration of the LDAP connectivity for FusionDirectory."); } - - function execute() + function update_base_choices() { - global $BASE_DIR; - $smarty = get_smarty(); - foreach ($this->attributes as $attr) { - $smarty->assign($attr, htmlentities($this->$attr, ENT_QUOTES, "UTF-8")); - } - - /* Assign connection status */ - $smarty->assign("connection_status", $this->get_connection_status()); - - /* Handle namingContext detection */ $attr = @LDAP::get_naming_contexts($this->connection); unset($attr['count']); - if (!empty($attr) && !in_array($this->base, $attr)) { - $this->base = $attr[0]; - } - $smarty->assign("namingContexts", $attr); - $smarty->assign("namingContextsCount", count($attr)); - $smarty->assign("bool", array(FALSE => _("No"), TRUE => _("Yes"))); - - /* Assign resolved users */ - $smarty->assign("resolve_user", $this->resolve_user); - if ($this->resolve_user) { - $tmp = $this->resolve_user(); - $smarty->assign("resolved_users", $tmp); - $smarty->assign("resolved_users_count", count($tmp)); - $smarty->assign("resolve_filter", $this->resolve_filter); + $this->attributesAccess['base']->setChoices($attr); + $this->attributesAccess['admin']->attributes[1]->setValue(','.$this->base); + } + + function save_object() + { + $base = $this->base; + $connection = $this->connection; + parent::save_object(); + $this->connection = preg_replace("/\/$/", "", $this->connection); + if (($this->base != $base) || ($this->connection != $connection)) { + $this->parent->disable_steps_from(($this->parent->step_name_to_id(get_class($this))) + 1); + if ($this->connection != $connection) { + $this->update_base_choices(); + } } - $base_to_append = $this->base; - if (strlen($base_to_append) > 20) { - $base_to_append = substr($base_to_append, 0, 17)."..."; + $this->attributesAccess['admin']->attributes[1]->setValue(','.$this->base); + + $this->status = $this->get_connection_status(); + if ($this->bind_id && !empty($this->admin) && !empty($this->base)) { + $this->is_completed = TRUE; + $this->parent->read_ldap_config(); + } else { + $this->is_completed = FALSE; } - $smarty->assign("base_to_append", $base_to_append); - return $smarty->fetch("$BASE_DIR/setup/setup_ldap.tpl"); } function get_connection_status() @@ -132,97 +185,5 @@ class Step_Ldap extends setup_step } } } - - - function resolve_user() - { - $filter = $this->resolve_filter; - - /* Establish ldap connection */ - $ldap_l = new LDAP("", "", $this->connection, FALSE, $this->tls); - $ldap = new ldapMultiplexer($ldap_l); - $ldap->cd($this->base); - $ldap->search("(&(objectClass=person)(|(uid=".$filter.")(cn=".$filter.")))"); - $tmp = array(); - while ($attrs = $ldap->fetch()) { - $tmp[base64_encode($attrs['dn'])] = LDAP::fix($attrs['dn']); - natcasesort($tmp); - } - return $tmp; - } - - - function save_object() - { - $reset = FALSE; - foreach ($this->attributes as $attr) { - if (isset($_POST[$attr])) { - if (in_array($attr, array("base","connection")) && $this->$attr != get_post($attr)) { - $reset = TRUE; - } - $this->$attr = get_post($attr); - } - } - - $this->connection = preg_replace("/\/$/", "", $this->connection); - - if ($reset) { - $this->parent->disable_steps_from(($this->parent->step_name_to_id(get_class($this))) + 1); - $attr = @LDAP::get_naming_contexts($this->connection); - if (is_array($attr) && !in_array(get_post("base"), $attr)) { - if (isset($attr[0])) { - $this->base = $attr[0]; - } - } - } - - if ($this->resolve_user) { - if (isset($_POST['resolve_user'])) { - $this->resolve_user = FALSE; - } else { - if (isset($_POST['resolve_filter'])) { - $this->resolve_filter = get_post('resolve_filter'); - } - if (isset($_POST['use_selected_user'])) { - if (isset($_POST['admin_to_use'])) { - $this->admin_given = base64_decode(get_post('admin_to_use')); - $this->append_base_to_admin_dn = FALSE; - $this->resolve_user = FALSE; - } - } - } - } else { - if (isset($_POST['resolve_user_x'])) { - $this->resolve_user = TRUE; - } else { - if (isset($_POST['append_base_to_admin_dn'])) { - $this->append_base_to_admin_dn = TRUE; - } else { - $this->append_base_to_admin_dn = FALSE; - } - } - } - - /* Hide backward forward button*/ - $this->dialog = $this->resolve_user; - - if ($this->append_base_to_admin_dn) { - $base = $this->base; - if (!preg_match("/,$/", $this->admin_given)) { - $base = ",".$base; - } - $this->admin = $this->admin_given.$base; - } else { - $this->admin = $this->admin_given; - } - - $this->get_connection_status(); - if ($this->bind_id && !empty($this->admin) && !empty($this->base)) { - $this->is_completed = TRUE; - } else { - $this->is_completed = FALSE; - } - } } - ?> diff --git a/setup/class_setupStep_Migrate.inc b/setup/class_setupStep_Migrate.inc index c5c2547f6af174e264dd1d6f85c1470bcb18a438..e6e81b691531c8908abfff346db917904fafb7d2 100644 --- a/setup/class_setupStep_Migrate.inc +++ b/setup/class_setupStep_Migrate.inc @@ -244,11 +244,10 @@ class Step_Migrate extends setup_step /* Check if there are uidNumbers which are used more than once */ function check_uidNumber() { - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); + global $config; + $ldap = $config->get_ldap_link(); - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); $res = $ldap->search("(&(objectClass=posixAccount)(uidNumber=*))", array("dn","uidNumber")); if (!$res) { $this->checks['uidNumber_usage']['STATUS'] = FALSE; @@ -289,11 +288,10 @@ class Step_Migrate extends setup_step /* Check if there are duplicated gidNumbers present in ldap */ function check_gidNumber() { - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); + global $config; + $ldap = $config->get_ldap_link(); - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); $res = $ldap->search("(&(objectClass=posixGroup)(gidNumber=*))", array("dn","gidNumber")); if (!$res) { $this->checks['gidNumber_usage']['STATUS'] = FALSE; @@ -333,19 +331,18 @@ class Step_Migrate extends setup_step /* Search for groups outside the group ou */ function search_outside_groups() { - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); + global $config; + $ldap = $config->get_ldap_link(); - $group_ou = $cv['groupou']; - $ldap->cd($cv['base']); + $group_ou = get_ou('groupRDN'); + $ldap->cd($config->current['BASE']); /*********** * Get all gosaDepartments to be able to * validate correct ldap tree position of every single user ***********/ $valid_deps = array(); - $valid_deps['/'] = $cv['base']; + $valid_deps['/'] = $config->current['BASE']; $ldap->search("(&(objectClass=gosaDepartment)(ou=*))", array("dn","ou")); while ($attrs = $ldap->fetch()) { $valid_deps[] = $attrs['dn']; @@ -365,7 +362,7 @@ class Step_Migrate extends setup_step $this->outside_groups = array(); $this->groups_list = array();; while ($attrs = $ldap->fetch()) { - $group_db_base = preg_replace("/^[^,]+,".preg_quote($group_ou, '/')."+,/i", "", $attrs['dn']); + $group_db_base = preg_replace("/^[^,]+,".preg_quote($group_ou, '/')."+/i", "", $attrs['dn']); /* Check if entry is not an addressbook only user * and verify that he is in a valid department @@ -398,17 +395,17 @@ class Step_Migrate extends setup_step /* Search for users outside the people ou */ function search_outside_users() { - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); - $ldap->cd($cv['base']); + global $config; + $ldap = $config->get_ldap_link(); + + $ldap->cd($config->current['BASE']); /*********** * Get all gosaDepartments to be able to * validate correct ldap tree position of every single user ***********/ $valid_deps = array(); - $valid_deps['/'] = $cv['base']; + $valid_deps['/'] = $config->current['BASE']; $ldap->search("(&(objectClass=gosaDepartment)(ou=*))", array("dn","ou")); while ($attrs = $ldap->fetch()) { $valid_deps[] = $attrs['dn']; @@ -429,10 +426,7 @@ class Step_Migrate extends setup_step * Check if returned users are within a valid GOsa department. (peopleou,gosaDepartment,base) ***********/ $this->outside_users = array(); - $people_ou = trim($cv['peopleou']); - if (!empty($people_ou)) { - $people_ou = $people_ou.","; - } + $people_ou = trim(get_ou('userRDN')); while ($attrs = $ldap->fetch()) { $people_db_base = preg_replace("/^[^,]+,".preg_quote($people_ou, '/')."/i", "", $attrs['dn']); @@ -471,13 +465,12 @@ class Step_Migrate extends setup_step */ function check_ldap_permissions() { - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); + global $config; + $ldap = $config->get_ldap_link(); /* Create dummy entry */ $name = "GOsa_setup_text_entry_".session_id().rand(0, 999999); - $dn = "ou=".$name.",".$cv['base']; + $dn = "ou=".$name.",".$config->current['BASE']; $testEntry = array(); $testEntry['objectClass'][] = "top"; @@ -487,7 +480,7 @@ class Step_Migrate extends setup_step $testEntry['ou'] = $name; /* check if simple ldap cat will be successful */ - $res = $ldap->cat($cv['base']); + $res = $ldap->cat($config->current['BASE']); if (!$res) { $this->checks['permissions']['STATUS'] = FALSE; $this->checks['permissions']['STATUS_MSG'] = _("LDAP query failed"); @@ -505,7 +498,7 @@ class Step_Migrate extends setup_step $this->checks['permissions']['STATUS'] = FALSE; $this->checks['permissions']['STATUS_MSG'] = _("Failed"); $this->checks['permissions']['ERROR_MSG'] = - sprintf(_("The specified user '%s' does not have full access to your ldap database."), $cv['admin']); + sprintf(_("The specified user '%s' does not have full access to your ldap database."), $config->current['ADMINDN']); return FALSE; } @@ -517,7 +510,7 @@ class Step_Migrate extends setup_step $this->checks['permissions']['STATUS'] = FALSE; $this->checks['permissions']['STATUS_MSG'] = _("Failed"); $this->checks['permissions']['ERROR_MSG'] = - sprintf(_("The specified user '%s' does not have full access to your ldap database."), $cv['admin']); + sprintf(_("The specified user '%s' does not have full access to your ldap database."), $config->current['ADMINDN']); return FALSE; } @@ -534,18 +527,17 @@ class Step_Migrate extends setup_step */ function check_gosaAccounts() { + global $config; + $ldap = $config->get_ldap_link(); + /* Remember old list of invisible users, to be able to set * the 'html checked' status for the checkboxes again */ $old = $this->users_to_migrate; $this->users_to_migrate = array(); - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); - /* Get all invisible users */ - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); $res = $ldap->search("(&(|(objectClass=posixAccount)(&(objectClass=inetOrgPerson)(objectClass=organizationalPerson))(objectClass=OpenLDAPperson))(!(objectClass=gosaAccount))(!(&(objectClass=Account)(objectClass=sambaSamAccount)))(uid=*))", array("sn","givenName","cn","uid")); while ($attrs = $ldap->fetch()) { @@ -584,10 +576,10 @@ class Step_Migrate extends setup_step /* Start user account migration */ function migrate_gosaAccounts($only_ldif = FALSE) { - $this->show_details = $only_ldif; + global $config; + $ldap = $config->get_ldap_link(); - /* Establish ldap connection */ - $ldap = $this->get_ldap_link(); + $this->show_details = $only_ldif; /* Add gosaAccount objectClass to the selected users */ foreach ($this->users_to_migrate as $key => $dep) { @@ -628,23 +620,22 @@ class Step_Migrate extends setup_step /* Check if there are invisible organizational Units */ function check_organizationalUnits() { + global $config; + $ldap = $config->get_ldap_link(); + $old = $this->deps_to_migrate; $this->deps_to_migrate = array(); - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); - /* Skip FusionDirectory internal departments */ - $skip_dns = array("/".$cv['peopleou']."/","/".$cv['groupou']."/","/".$cv['aclroleou']."/", + $skip_dns = array("/".get_ou('userRDN')."/","/".get_ou('groupRDN')."/","/".get_ou('aclRoleRDN')."/", "/^ou=people,/","/^ou=groups,/","/^ou=sudoers,/", "/(,|)ou=configs,/","/(,|)ou=systems,/","/(,|)ou=tokens,/", "/(,|)ou=apps,/","/(,|)ou=mime,/","/(,|)ou=devices/", - "/ou=snapshots,/","/(,|)dc=addressbook,/","/^(,|)ou=machineaccounts,/", + "/ou=snapshots,/","/(,|)dc=addressbook,/","/^(,|)ou=machineaccounts,/","/^ou=opsi,/","/^ou=structures,/", "/(,|)ou=winstations,/","/^ou=hosts,/","/^ou=computers,/","/^ou=idmap,/","/^ou=Idmap,/","/(,|)ou=roles,/"); /* Get all invisible departments */ - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); $res = $ldap->search("(&(objectClass=organizationalUnit)(!(objectClass=gosaDepartment)))", array("ou","description","dn")); while ($attrs = $ldap->fetch()) { $attrs['checked'] = FALSE; @@ -709,10 +700,10 @@ class Step_Migrate extends setup_step /* Start deparmtment migration */ function migrate_organizationalUnits($only_ldif = FALSE) { - $this->show_details = $only_ldif; + global $config; + $ldap = $config->get_ldap_link(); - /* Establish ldap connection */ - $ldap = $this->get_ldap_link(); + $this->show_details = $only_ldif; /* Add gosaDepartment objectClass to each selected entry */ foreach ($this->deps_to_migrate as $key => $dep) { @@ -756,6 +747,8 @@ class Step_Migrate extends setup_step /* Check Acls if there is at least one object with acls defined */ function check_administrativeAccount() { + global $config; + /* Reset settings */ $FD_1_0_8_found = FALSE; $this->migrate_users = array(); @@ -764,10 +757,9 @@ class Step_Migrate extends setup_step $valid_admin = FALSE; /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); - $ldap->cd($cv['base']); - $res = $ldap->cat($cv['base']); + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); + $res = $ldap->cat($config->current['BASE']); if (!$res) { $this->checks['acls']['STATUS'] = FALSE; @@ -980,11 +972,10 @@ class Step_Migrate extends setup_step /* Check if default roles and groupes have been inserted */ function check_defaultACLs() { - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); - $ldap->cd($cv['base']); - $res = $ldap->cat($cv['base']); + global $config; + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); + $res = $ldap->cat($config->current['BASE']); if (!$res) { $this->checks['default_acls']['STATUS'] = FALSE; @@ -995,7 +986,7 @@ class Step_Migrate extends setup_step $existings = 0; foreach ($this->defaultRoles as $role) { - $dn = 'cn='.$role['cn'].','.$cv['aclroleou'].",".$cv['base']; + $dn = 'cn='.$role['cn'].','.get_ou('aclRoleRDN').$config->current['BASE']; $ldap->cat($dn, array('dn')); if ($ldap->count() > 0) { $existings++; @@ -1019,13 +1010,12 @@ class Step_Migrate extends setup_step function insert_defaultRoles() { - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); - $ldap->cd($cv['base']); + global $config; + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); foreach ($this->defaultRoles as $role) { - $dn = 'cn='.$role['cn'].','.$cv['aclroleou'].",".$cv['base']; + $dn = 'cn='.$role['cn'].','.get_ou('aclRoleRDN').$config->current['BASE']; $ldap->cat($dn); if ($ldap->count() == 0) { $ldap->cd($dn); @@ -1048,6 +1038,8 @@ class Step_Migrate extends setup_step function create_admin($only_ldif = FALSE) { + global $config; + /* Reset '' */ $this->acl_create_changes = ""; @@ -1055,16 +1047,15 @@ class Step_Migrate extends setup_step $dn = $this->acl_create_selected; /* Get collected configuration settings */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); + $ldap = $config->get_ldap_link(); $ldap->search("(&(objectClass=gosaRole)(gosaAclTemplate=*:all;cmdrw))", array('dn')); if ($attrs = $ldap->fetch()) { $roledn = $attrs['dn']; } else { - $roledn = 'cn=admin,'.$cv['aclroleou'].",".$cv['base']; + $roledn = 'cn=admin,'.get_ou('aclRoleRDN').$config->current['BASE']; if (!$only_ldif) { - $ldap->create_missing_trees($cv['aclroleou'].",".$cv['base']); + $ldap->create_missing_trees(get_ou('aclRoleRDN').$config->current['BASE']); $ldap->cd($roledn); $attrs_role = array( 'cn' => 'admin', @@ -1081,8 +1072,8 @@ class Step_Migrate extends setup_step } /* Get current base attributes */ - $ldap->cd($cv['base']); - $ldap->cat($cv['base'], array("dn","objectClass","gosaAclEntry")); + $ldap->cd($config->current['BASE']); + $ldap->cat($config->current['BASE'], array("dn","objectClass","gosaAclEntry")); $attrs = $ldap->fetch(); /* Add acls for the selcted user to the base */ @@ -1107,12 +1098,12 @@ class Step_Migrate extends setup_step } if ($only_ldif) { - $this->acl_create_changes = "\n".($ldap->fix($cv['base']))."\n"; + $this->acl_create_changes = "\n".($ldap->fix($config->current['BASE']))."\n"; $this->acl_create_changes .= $this->array_to_ldif($attrs)."\n"; - $this->acl_create_changes .= "\n".($ldap->fix($cv['base']))."\n"; + $this->acl_create_changes .= "\n".($ldap->fix($config->current['BASE']))."\n"; $this->acl_create_changes .= $this->array_to_ldif($attrs_new); } else { - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); $ldap->modify($attrs_new); if (!$ldap->success()) { msg_dialog::display(_("Migration error"), sprintf(_("Cannot add ACL for user '%s':")."<br><br><i>%s</i>", LDAP::fix($dn), $ldap->get_error()), ERROR_DIALOG); @@ -1126,11 +1117,11 @@ class Step_Migrate extends setup_step function create_admin_user() { + global $config; $pw1 = $pw2 = ""; $uid = ""; - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); + $ldap = $config->get_ldap_link(); if (isset($_POST['new_user_uid'])) { $uid = $_POST['new_user_uid']; @@ -1142,7 +1133,7 @@ class Step_Migrate extends setup_step $pw2 = $_POST['new_user_password2']; } - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); $ldap->search("(uid=".$uid.")"); if ($ldap->count()) { msg_dialog::display(_("Input error"), msgPool::duplicated(_("Uid")), ERROR_DIALOG); @@ -1160,20 +1151,20 @@ class Step_Migrate extends setup_step } /* Get current base attributes */ - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); - $people_ou = trim($cv['peopleou']); + $people_ou = trim(get_ou('userRDN')); if (!empty($people_ou)) { - $people_ou = trim($people_ou).","; + $people_ou .= ","; } - if ($cv['peopledn'] == "cn") { - $dn = "cn=System Administrator-".$uid.",".$people_ou.$cv['base']; + if ($config->get_cfg_value('accountPrimaryAttribute') == 'cn') { + $dn = "cn=System Administrator-".$uid.",".$people_ou.$config->current['BASE']; } else { - $dn = "uid=".$uid.",".$people_ou.$cv['base']; + $dn = "uid=".$uid.",".$people_ou.$config->current['BASE']; } - $hash = passwordMethod::make_hash($pw2, $cv['encryption']); + $hash = passwordMethod::make_hash($pw2, $config->get_cfg_value('passwordDefaultHash', 'ssha')); $new_user = array(); @@ -1184,7 +1175,7 @@ class Step_Migrate extends setup_step $new_user['uid'] = $uid; $new_user['userPassword'] = $hash; - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); $ldap->cat($dn, array("dn")); if ($ldap->count()) { @@ -1210,10 +1201,9 @@ class Step_Migrate extends setup_step function migrate_outside_groups($perform = FALSE) { - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); - $ldap->cd($cv['base']); + global $config; + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); /* Check if there was a destination department posted */ if (isset($_POST['move_group_to'])) { @@ -1253,10 +1243,9 @@ class Step_Migrate extends setup_step function migrate_outside_users($perform = FALSE) { - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); - $ldap->cd($cv['base']); + global $config; + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); /* Check if there was a destination department posted */ if (isset($_POST['move_user_to'])) { @@ -1295,6 +1284,7 @@ class Step_Migrate extends setup_step function execute() { + global $config; /* Initialise checks if this is the first call */ if (!$this->checks_initialised || isset($_POST['reload'])) { $this->initialize_checks(); @@ -1821,12 +1811,11 @@ class Step_Migrate extends setup_step */ function checkBase($just_check = TRUE) { - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); + global $config; + $ldap = $config->get_ldap_link(); /* Check if root object exists */ - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); $ldap->set_size_limit(1); $res = $ldap->search("(objectClass=*)"); $ldap->set_size_limit(0); @@ -1846,8 +1835,8 @@ class Step_Migrate extends setup_step } else { /* Add root object */ - $ldap->cd($cv['base']); - $res = $ldap->create_missing_trees($cv['base']); + $ldap->cd($config->current['BASE']); + $res = $ldap->create_missing_trees($config->current['BASE']); /* If adding failed, tell the user */ if (!$res) { @@ -1872,13 +1861,12 @@ class Step_Migrate extends setup_step */ function checkBaseOC($just_check = TRUE) { - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); + global $config; + $ldap = $config->get_ldap_link(); /* Check if root object exists */ - $ldap->cd($cv['base']); - $ldap->cat($cv['base']); + $ldap->cd($config->current['BASE']); + $ldap->cat($config->current['BASE']); if (!$ldap->count()) { $this->checks['rootOC']['STATUS'] = FALSE; $this->checks['rootOC']['STATUS_MSG'] = _("LDAP query failed"); @@ -1906,13 +1894,6 @@ class Step_Migrate extends setup_step return; } - /* Create a minimal config object for objectType infos */ - global $config, $plist; - $config = new config(""); - load_all_classes(); - $plist = new pluglist($config, $ui); - $config->loadPlist($plist); - /* Try to detect base class type, e.g. is it a dcObject */ $dep_types = departmentManagement::getDepartmentTypes(); $dep_type = ""; @@ -1940,14 +1921,14 @@ class Step_Migrate extends setup_step /* Create 'current' and 'target' object properties, to be able to display * a set of modifications required to create a valid FusionDirectory department. */ - $str = "dn: ".$cv['base']."\n"; + $str = "dn: ".$config->current['BASE']."\n"; for ($i = 0; $i < $attrs['objectClass']['count']; $i++) { $str .= "objectClass: ".$attrs['objectClass'][$i]."\n"; } $this->rootOC_details['current'] = $str; /* Create target infos */ - $str = "dn: ".$cv['base']."\n"; + $str = "dn: ".$config->current['BASE']."\n"; for ($i = 0; $i < $attrs['objectClass']['count']; $i++) { $str .= "objectClass: ".$attrs['objectClass'][$i]."\n"; $mods['objectClass'][] = $attrs['objectClass'][$i]; @@ -1990,11 +1971,11 @@ class Step_Migrate extends setup_step } else { /* Add root object */ - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); if (isset($this->rootOC_details['mods'])) { $res = $ldap->modify($this->rootOC_details['mods']); if (!$res) { - msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $cv['base'], LDAP_MOD, get_class()), LDAP_ERROR); + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $config->current['BASE'], LDAP_MOD, get_class()), LDAP_ERROR); } $this->checkBaseOC(); $this->check_administrativeAccount(); @@ -2040,8 +2021,8 @@ class Step_Migrate extends setup_step function get_user_list($class = 'gosaAccount') { - /* Establish ldap connection */ - $ldap = $this->get_ldap_link(); + global $config; + $ldap = $config->get_ldap_link(); $ldap->search("(objectClass=$class)", array("dn")); $tmp = array(); @@ -2053,20 +2034,20 @@ class Step_Migrate extends setup_step function get_all_people_ous() { - return $this->get_all_ous('peopleou'); + return $this->get_all_ous('userRDN'); } function get_all_group_ous() { - return $this->get_all_ous('groupou'); + return $this->get_all_ous('groupRDN'); } - function get_all_ous($cv_key) + function get_all_ous($ou_name) { - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); - $ou = trim($cv[$cv_key]); + global $config; + $ldap = $config->get_ldap_link(); + $ou = trim(get_ou($ou_name)); + $ou = preg_replace('/,$/', '', $ou); /************ * If ou is NOT empty @@ -2075,7 +2056,7 @@ class Step_Migrate extends setup_step if (!empty($ou)) { $ldap->search("($ou)", array('dn')); if ($ldap->count() == 0 ) { - $ldap->create_missing_trees($ou.$cv['base']); + $ldap->create_missing_trees($ou.','.$config->current['BASE']); } $ldap->search("($ou)", array('dn')); $tmp = array(); @@ -2089,12 +2070,12 @@ class Step_Migrate extends setup_step * If ou is empty * Get all valid gosaDepartments ************/ - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); $tmp = array(); $ldap->search('(&(objectClass=gosaDepartment)(ou=*))', array('dn')); - $tmp[base64_encode($cv['base'])] = $ldap->fix($cv['base']); + $tmp[base64_encode($config->current['BASE'])] = $ldap->fix($config->current['BASE']); while ($attrs = $ldap->fetch()) { - $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);; + $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']); } } return $tmp; @@ -2103,8 +2084,8 @@ class Step_Migrate extends setup_step function move($source, $destination) { - /* Establish ldap connection */ - $ldap = $this->get_ldap_link(); + global $config; + $ldap = $config->get_ldap_link(); /* Update object references in gosaGroupOfNames */ $ogs_to_fix = array(); @@ -2181,10 +2162,9 @@ class Step_Migrate extends setup_step */ function check_usb_devices () { - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); - $ldap->cd($cv['base']); + global $config; + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); $res = $ldap->search("(&(|(objectClass=posixAccount)(objectClass=posixGroup))(gotoHotplugDevice=*))", array("cn","gotoHotplugDevice")); @@ -2270,9 +2250,8 @@ class Step_Migrate extends setup_step */ function migrate_usb_devices () { - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); + global $config; + $ldap = $config->get_ldap_link(); /* Walk through migrateable devices and initiate migration for all devices that are checked (DETAILS==TRUE) @@ -2283,7 +2262,7 @@ class Step_Migrate extends setup_step /* Get source object and verify that the specified device is a member attribute of it. */ - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); $ldap->cat($device['DN']); $attrs = $ldap->fetch(); if (in_array($device['OLD_DEVICE'], $attrs['gotoHotplugDevice'])) { @@ -2297,7 +2276,7 @@ class Step_Migrate extends setup_step $new_attr['gotoHotplugDevice'] = "$desc|$serial|$vendor|$product"; /* Add new object */ - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); $ldap->create_missing_trees(preg_replace("/^[^,]+,/", "", $newdn)); $ldap->cd($newdn); $ldap->add($new_attr); @@ -2346,19 +2325,12 @@ class Step_Migrate extends setup_step */ function check_services() { - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap_l = new LDAP( - $cv['admin'], $cv['password'], - $cv['connection'], FALSE, - $cv['tls'] - ); - - $ldap = new ldapMultiplexer($ldap_l); + global $config; + $ldap = $config->get_ldap_link(); $this->service = array(); /* Check for Ldap services that must be migrated */ - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); $res = $ldap->search('(objectClass=goLdapServer)'); /* Check if we were able to query the ldap server */ @@ -2414,8 +2386,8 @@ class Step_Migrate extends setup_step */ function migrate_services() { - /* Establish ldap connection */ - $ldap = $this->get_ldap_link(); + global $config; + $ldap = $config->get_ldap_link(); /* Handle each service */ foreach ($this->service as $key => $service) { @@ -2467,12 +2439,11 @@ class Step_Migrate extends setup_step */ function check_menus() { - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); + global $config; + $ldap = $config->get_ldap_link(); /* First detect all release names */ - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); $res = $ldap->search("(&(objectClass=organizational)(objectClass=FAIbranch))", array("ou","objectClass")); /* Check if we were able to query the ldap server */ @@ -2488,7 +2459,7 @@ class Step_Migrate extends setup_step */ $amap = array(); $todo = array(); - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); $ldap->search("(objectClass=gosaApplication)", array("cn", "gosaApplicationParameter")); while ($info = $ldap->fetch()) { if (isset($info['gosaApplicationParameter']['count'])) { @@ -2505,7 +2476,7 @@ class Step_Migrate extends setup_step } /* Search for all groups that have an old style application menu configured */ - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); $ldap->search("(&(objectClass=gosaApplicationGroup)(objectClass=posixGroup)(FAIrelease=*))", array("gosaMemberApplication","gosaApplicationParameter","FAIrelease","objectClass")); @@ -2684,10 +2655,9 @@ class Step_Migrate extends setup_step */ function migrate_menus() { - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); - $ldap->cd($cv['base']); + global $config; + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); /* Walk through menus and detect selected menu */ foreach ($this->menu as $key => $menu) { @@ -2696,7 +2666,7 @@ class Step_Migrate extends setup_step /* Excute all LDAP-ADD actions */ $success = TRUE; foreach ($menu['TODO']['ADD'] as $dn => $data) { - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); if (!$ldap->dn_exists($dn)) { $ldap->cd($dn); $ldap->add($data); @@ -2709,7 +2679,7 @@ class Step_Migrate extends setup_step /* Execute all LDAP-MODIFY actions */ foreach ($menu['TODO']['MODIFY'] as $dn => $data) { - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); if ($ldap->dn_exists($dn)) { $ldap->cd($dn); $ldap->modify($data); @@ -2734,15 +2704,15 @@ class Step_Migrate extends setup_step function migrate_selected_admin_users() { + global $config; + /* Updated ui selection */ $this->migrate_users(); - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); + $ldap = $config->get_ldap_link(); /* Get current ACL configuration for the ldap base */ - $ldap->cat($cv['base']); + $ldap->cat($config->current['BASE']); $base_attrs = $ldap->fetch(); $acl_entries = array(); $acl_id = -1; @@ -2777,13 +2747,13 @@ class Step_Migrate extends setup_step if (count($acl_entries)) { $new_entry['gosaAclEntry'] = $acl_entries; $new_entry['objectClass'] = $ocs; - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); $ldap->modify($new_entry); if (!$ldap->success()) { $this->checks['acls']['TITLE'] = _("Checking for super administrator"); $this->checks['acls']['STATUS'] = FALSE; $this->checks['acls']['STATUS_MSG'] = _("Failed"); - $this->checks['acls']['ERROR_MSG'] = "<br>".msgPool::ldaperror($cv['base'], $ldap->get_error(), LDAP_MOD); + $this->checks['acls']['ERROR_MSG'] = "<br>".msgPool::ldaperror($config->current['BASE'], $ldap->get_error(), LDAP_MOD); } else { $this->check_administrativeAccount(); } @@ -2791,14 +2761,13 @@ class Step_Migrate extends setup_step } + /* Collect a list of available FusionDirectory users and groups */ function migrate_users() { - /* Collect a list of available FusionDirectory users and groups */ + global $config; + $ldap = $config->get_ldap_link(); - /* Establish ldap connection */ - $cv = $this->parent->captured_values; - $ldap = $this->get_ldap_link(); - $ldap->cd($cv['base']); + $ldap->cd($config->current['BASE']); $users = array(); $ldap->search("(&(objectClass=gosaAccount)(objectClass=person)". diff --git a/setup/class_setupStep_Welcome.inc b/setup/class_setupStep_Welcome.inc index 69e0bfef70028124032bf7db692992ae786f222c..b43374e00869bc4cfde7d2cdc9f4cddc29843f9b 100644 --- a/setup/class_setupStep_Welcome.inc +++ b/setup/class_setupStep_Welcome.inc @@ -19,21 +19,32 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -class Step_Welcome extends setup_step +class Step_Welcome extends setupStep { - var $languages = array(); - var $attributes = array(); var $header_image = 'geticon.php?context=applications&icon=config-welcome&size=48'; - var $authPath; + + static function getAttributesInfo() + { + return array( + 'welcome' => array( + 'name' => _('Welcome'), + 'template' => get_template_path("setup_welcome.tpl", TRUE, dirname(__FILE__)), + 'attrs' => array( + ) + ) + ); + } function __construct() { + parent::__construct(); + $this->is_enabled = TRUE; $this->is_active = TRUE; $this->authPath = CACHE_DIR.'fusiondirectory.auth'; - $this->update_strings(); } + /* We need to init them with a method to be able to use _() */ function update_strings() { $this->s_title = _("Welcome"); @@ -46,12 +57,13 @@ class Step_Welcome extends setup_step $smarty = get_smarty(); $smarty->assign('auth_id', session_id()); - $smarty->assign("path", $this->authPath); - return $smarty->fetch(get_template_path("setup_welcome.tpl", TRUE, dirname(__FILE__))); + $smarty->assign('path', $this->authPath); + return parent::execute(); } function save_object() { + parent::save_object(); $id = ""; /* Get auth ID from file */ @@ -66,7 +78,6 @@ class Step_Welcome extends setup_step } else { $this->is_completed = FALSE; } - } } diff --git a/setup/setup.tpl b/setup/setup.tpl deleted file mode 100644 index 3bb21f7958750db7880e1d2a6f7ac2ee9c75a801..0000000000000000000000000000000000000000 --- a/setup/setup.tpl +++ /dev/null @@ -1,4 +0,0 @@ -<div style='background-color: #009900;'> -{$php_errors} -sadffasdsdfa -</div> diff --git a/setup/setup_checks.tpl b/setup/setup_checks.tpl index 8094080407797172d8ec029cdd20a7956d70c7bb..6cd4c6a314765d393d9d8ae20696fb93c932cf1e 100644 --- a/setup/setup_checks.tpl +++ b/setup/setup_checks.tpl @@ -1,122 +1,54 @@ -<!-- - Div container with PHP module checks ---> -<div style='float:left;width:50%;'> - - <!-- Set content styles --> - <div class='default' style='margin:10px;'> - <!-- Beginning PHP module check output --> - <h2 class='step2_container_title'>{t}PHP module and extension checks{/t}</h2> - <!-- {cycle reset=true values="#F0F0F0, #FFF"} --> - {foreach from=$basic item=val key=key} - <!-- Entry {$key} --> - {if $basic[$key].SOLUTION != "" && !$basic[$key].RESULT} - - <!-- Add ability to display info popup --> - <div class='step2_entry_container_info' style='background-color:{cycle values="#F0F0F0, #FFF"}'> - {else} +<div id="{$sectionId}" class="plugin_section"> + <span class="legend"> + {$section} + </span> + <div> + {foreach from=$attributes item=infos} + + {foreach from=$infos item=val key=key} + <!-- Entry {$key} --> + {if $val.SOLUTION != "" && !$val.RESULT} + + <!-- Add ability to display info popup --> + <div class='step2_entry_container_info' style='background-color:{cycle values="#F0F0F0, #FFF"}'> + {else} - <!-- Normal entry everything is fine --> - <div class='step2_entry_container' style='background-color:{cycle values="#F0F0F0, #FFF"}'> - {/if} + <!-- Normal entry everything is fine --> + <div class='step2_entry_container' style='background-color:{cycle values="#F0F0F0, #FFF"}'> + {/if} - <div class='step2_entry_name'>{$basic[$key].NAME}</div> - <div class='step2_entry_status'> + <div class='step2_entry_name'>{$val.NAME}</div> + <div class='step2_entry_status'> - {if $basic[$key].RESULT} - <div class='step2_successful'>{t}Ok{/t}</div> - {else} - {if $basic[$key].MUST} - <div class='step2_failed'>{t}Error{/t}</div> + {if $val.RESULT} + <div class='step2_successful'>{t}Ok{/t}</div> {else} - <div class='step2_warning'>{t}Warning{/t}</div> - {/if} - {if $basic[$key].SOLUTION != ""} - - <!-- Inforamtion popup --> - <div class='solution_visible' id='sol_{$key}'> - {if $basic[$key].MUST} - <div class='step2_failed_text' style="background-image: url('geticon.php?context=status&icon=dialog-error&size=16')"> - {$basic[$key].SOLUTION}<br/> - <b>{t}FusionDirectory will NOT run without fixing this.{/t}</b> + {if $val.MUST} + <div class='step2_failed'>{t}Error{/t}</div> {else} - <div class="step2_warning_text" style="background-image: url('geticon.php?context=status&icon=dialog-warning&size=16')"> - {$basic[$key].SOLUTION}<br/> - <b>{t}FusionDirectory will run without fixing this.{/t}</b> + <div class='step2_warning'>{t}Warning{/t}</div> {/if} - </div> - </div> - {/if} - {/if} - </div> - </div> - {/foreach} - </div> -</div> - - -<!-- - Div container with PHP config checks ---> -<div style='width:50%; float:left;'> - - <!-- Set content styles --> - <div class='default' style='margin:10px;'> - - <!-- Beginning PHP config check output --> - <h2 class='step2_container_title'>{t}PHP setup configuration{/t} (<a style='text-decoration:underline' href='?info' target='_blank'>{t}show information{/t})</a></h2> - - <!-- {cycle reset=true values="#F0F0F0, #FFF"} --> - {foreach from=$config item=val key=key} - - <!-- Entry {$key} --> - {if $config[$key].SOLUTION != "" && !$config[$key].RESULT} - - <!-- Add ability to display info popup --> - <div class='step2_entry_container_info' style='background-color:{cycle values="#FFF, #F0F0F0"}'> + {if $val.SOLUTION != ""} + + <!-- Information popup --> + <div class='solution_visible' id='sol_{$key}'> + {if $val.MUST} + <div class='step2_failed_text' style="background-image: url('images/small_error.png')"> + {$val.SOLUTION}<br/> + <b>{t}FusionDirectory will NOT run without fixing this.{/t}</b> {else} - - <!-- Normal entry everything is fine --> - <div class='step2_entry_container' style='background-color:{cycle values="#FFF, #F0F0F0"}'> + <div class="step2_warning_text" style="background-image: url('images/small_warning.png')"> + {$val.SOLUTION}<br/> + <b>{t}FusionDirectory will run without fixing this.{/t}</b> {/if} - - - <div class='step2_entry_name'>{$config[$key].NAME}</div> - <div class='step2_entry_status'> - {if $config[$key].RESULT} - <div class='step2_successful'>{t}Ok{/t}</div> - {else} - - {if $config[$key].MUST} - <div class='step2_failed'>{t}Error{/t}</div> - {else} - <div class='step2_warning'>{t}Warning{/t}</div> - {/if} - - {if $config[$key].SOLUTION != ""} - - <!-- Inforamtion popup --> - <div class='solution_visible' id='sol_config_{$key}'> - {if $config[$key].MUST} - <div class='step2_failed_text' style="background-image: url('geticon.php?context=status&icon=dialog-error&size=16')"> - {$config[$key].SOLUTION} - <b>{t}FusionDirectory will NOT run without fixing this.{/t}</b> - {else} - <div class='step2_warning_text' style="background-image: url('geticon.php?context=status&icon=dialog-warning&size=16')"> - {$config[$key].SOLUTION} - <b>{t}FusionDirectory will run without fixing this.{/t}</b> + </div> + </div> {/if} + {/if} </div> </div> - {/if} - {/if} - </div> - </div> - {/foreach} - + {/foreach} + {/foreach} </div> </div> - -<div style="clear:both"></div> - diff --git a/setup/setup_config1.tpl b/setup/setup_config1.tpl deleted file mode 100644 index 79d6fb393b03594a4b1a3754fd569af4588c9a35..0000000000000000000000000000000000000000 --- a/setup/setup_config1.tpl +++ /dev/null @@ -1,211 +0,0 @@ -<div class='default'> - <p><b>{t}Look and feel{/t}</b></p> - - <div class='step4_container'> - <div class='step4_name'> - {t}Theme{/t} - </div> - <div class='step4_value'> - <select name="theme"> - {html_options options=$themes selected=$theme} - </select> - </div> - </div> - - <p><b>{t}People and group storage{/t}</b></p> - <div class='step4_container'> - <div class='step4_name'> - {t}People DN attribute{/t} - </div> - <div class='step4_value'> - <select size="1" name="peopledn" id="peopledn"> - {html_options values=$peopledns output=$peopledns selected=$peopledn} - </select> - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - {t}Customized CN{/t} - </div> - <div class='step4_value'> - {if $cngen_active == FALSE} - <input type='checkbox' value='1' name='cngen_active' - onClick='changeState("cngen");changeState("peopledn");changeState("include_personal_title");'> - <input size='20' id='cngen' name='cngen' type='text' value='{$cngen}' disabled> - {else} - <input type='checkbox' value='1' name='cngen_active' checked> - <input size='20' id='cngen' name='cngen' type='text' value='{$cngen}' > - {/if} - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - {t}People storage subtree{/t} - </div> - <div class='step4_value'> - <input type='text' name='peopleou' maxlength='40' size='40' value='{$peopleou}'> - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - {t}Group storage subtree{/t} - </div> - <div class='step4_value'> - <input type='text' name='groupou' maxlength='40' size='40' value='{$groupou}'> - </div> - </div> - - <div class="step4_container"> - <div class="step4_name"> - <label for="aclroleou">{t}ACL roles storage subtree{/t}</label> - </div> - <div class="step4_value"> - <input type="text" name="aclroleou" id="aclroleou" maxlength="40" size="40" value="{$aclroleou}"> - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - {t}Include personal title in user DN{/t} - </div> - <div class='step4_value'> - <select name="include_personal_title" id="include_personal_title" size="1" title=""> - {html_options options=$bool selected=$include_personal_title} - </select> - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - {t}Relaxed naming policies{/t} - </div> - <div class='step4_value'> - <select name="strict" size="1" title=""> - {html_options options=$bool selected=$strict} - </select> - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - {t}Automatic logins{/t} - </div> - <div class='step4_value'> - {if $id_settings.idgen_active == FALSE} - <input type='checkbox' value='1' name='idgen_active' - onClick='changeState("idgen");'> - <input size='20' id='idgen' name='idgen' type='text' value='{$id_settings.idgen}' disabled> - {else} - <input type='checkbox' value='1' name='idgen_active' checked> - <input size='20' id='idgen' name='idgen' type='text' value='{$id_settings.idgen}' > - {/if} - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - {t}Group/user min id{/t} - </div> - <div class='step4_value'> - {if $id_settings.minid_active == FALSE} - <input type='checkbox' value='1' name='minid_active' - onClick='changeState("minid");'> - <input size='10' id='minid' name='minid' type='text' value='{$id_settings.minid}' disabled> - {else} - <input type='checkbox' value='1' name='minid_active' checked> - <input size='10' id='minid' name='minid' type='text' value='{$id_settings.minid}' > - {/if} - </div> - </div> - - <div class='step4_container' style="margin-bottom:5px;"> - <div class='step4_name'> - {t}Base number for user/group id{/t} - </div> - <div class='step4_value'> - <input type='text' name='uidbase' maxlength='20' size='10' value='{$uidbase}'> - </div> - </div> - - <p><b>{t}Password settings{/t}</b></p> - - <div class='step4_container'> - <div class='step4_name'> - {t}Password encryption algorithm{/t} - </div> - <div class='step4_value'> - <select name="encryption" size="1" title=""> - {html_options options=$crypt_methods selected=$encryption} - </select> - </div> - </div> - - <div class='step4_container' style='height:4em;'> - <div class='step4_name' style='height:4em;'> - {t}Password restrictions{/t} - </div> - <div class='step4_value' style='height:4em;'> - - {if $pwd_rules.pwminlen_active == FALSE} - <input type='checkbox' value='1' name='pwminlen_active' - onClick='changeState("pwminlen");'> - {t}Password minimum length{/t} - <input id='pwminlen' name='pwminlen' type='text' value='{$pwd_rules.pwminlen}' size=3 disabled> - {else} - <input type='checkbox' value='1' name='pwminlen_active' checked> - {t}Password minimum length{/t} - <input id='pwminlen' name='pwminlen' type='text' value='{$pwd_rules.pwminlen}' size=3 > - {/if} - <br> - {if $pwd_rules.pwdiffer_active == FALSE} - <input type='checkbox' value='1' name='pwdiffer_active' - onClick='changeState("pwdiffer");'> - {t}Different characters from old password{/t} - <input id='pwdiffer' name='pwdiffer' type='text' value='{$pwd_rules.pwdiffer}' size=3 disabled> - {else} - <input type='checkbox' value='1' name='pwdiffer_active' checked> - {t}Different characters from old password{/t} - <input id='pwdiffer' name='pwdiffer' type='text' value='{$pwd_rules.pwdiffer}' size=3 > - {/if} - - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - {t}Password change hook{/t} - </div> - <div class='step4_value'> - {if $pwd_rules.externalpwdhook_active == FALSE} - <input type='checkbox' value='1' name='externalpwdhook_active' - onClick='changeState("externalpwdhook");'> - <input size=40 id='externalpwdhook' name='externalpwdhook' type='text' value='{$pwd_rules.externalpwdhook}' disabled> - {else} - <input type='checkbox' value='1' name='externalpwdhook_active' checked> - <input size=40 id='externalpwdhook' name='externalpwdhook' type='text' value='{$pwd_rules.externalpwdhook}' > - {/if} - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - {t}Use account expiration{/t} - </div> - <div class='step4_value'> - <select name="account_expiration" size="1" title=""> - {html_options options=$bool selected=$account_expiration} - </select> - </div> - </div> - - -<input type='hidden' value='1' name='step5_posted'> -<!-- - {t}FusionDirectory supports several encryption types for your passwords. Normally this is adjustable via user templates, but you can specify a default method to be used here, too.{/t} - {t}FusionDirectory always acts as admin and manages access rights internally. This is a workaround till OpenLDAP's in directory ACI's are fully implemented. For this to work, we need the admin DN and the corresponding password.{/t} - {t}Some basic LDAP parameters are tunable and affect the locations where FusionDirectory saves people and groups, including the way accounts get created. Check the values below if the fit your needs.{/t} - {t}FusionDirectory has modular support for several mail methods. These methods provide interfaces to users mailboxes and general handling for quotas. You can choose the dummy plugin to leave all your mail settings untouched.{/t}--> - diff --git a/setup/setup_config2.tpl b/setup/setup_config2.tpl deleted file mode 100644 index 178c098a5d93c6c8ccae2043557d855a38230046..0000000000000000000000000000000000000000 --- a/setup/setup_config2.tpl +++ /dev/null @@ -1,46 +0,0 @@ -<div class='default' style='margin:12px; '> - <div class='step4_container'> - <div class='step4_name'> - <label for='timezone'>{t}Timezone{/t}</label> - </div> - <div class='step4_value'> - <select id='timezone' name='timezone' title='{t}Please choose your preferred timezone here{/t}' style="width:100%"> - {foreach from=$timezones item=val} - <option {if $val == $timezone}selected{/if} value="{$val}">{$val}</option> - {/foreach} - </select> - </div> - </div> - - <p><b>{t}Snapshots{/t}</b></p> - <div class='step4_container'> - <div class='step4_name'> - <label for='snapshot_active'>{t}Enable snapshots{/t}</label> - </div> - <div class='step4_value'> - <input type='checkbox' value='1' - id='snapshot_active' name='snapshot_active' - onClick='changeState("snapshot_base");' -{if $generic_settings.snapshot_active} - checked='checked' -{/if} - /> - </div> - </div> - <div class='step4_container'> - <div class='step4_name'> - <label for='snapshot_base'>{t}Snapshot base{/t}</label> - </div> - <div class='step4_value'> - <input style='width:220' id='snapshot_base' name='snapshot_base' - type='text' value='{$generic_settings.snapshot_base}' -{if $generic_settings.snapshot_active == FALSE} - disabled='disabled' -{/if} - /> - </div> - </div> -</div> - -<input type='hidden' value='1' name='step6_posted'/> -<div style="clear:both"></div> diff --git a/setup/setup_config3.tpl b/setup/setup_config3.tpl deleted file mode 100644 index 7466debcab1ce1dc4efb94e328fbf309595203d7..0000000000000000000000000000000000000000 --- a/setup/setup_config3.tpl +++ /dev/null @@ -1,194 +0,0 @@ -<div class='default' style='margin:12px; '> - <p><b>{t}FusionDirectory core settings{/t}</b></p> - - <div class='step4_container'> - <div class='step4_name'> - {t}Enable primary group filter{/t} - </div> - <div class='step4_value'> - - <select name="noprimarygroup" size="1" title=""> - {html_options options=$bool selected=$optional.noprimarygroup} - </select> - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - {t}Display summary in listings{/t} - </div> - <div class='step4_value'> - - <select name="list_summary" size="1" title=""> - {html_options options=$bool selected=$optional.list_summary} - </select> - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - {t}Enable edit locking{/t} - </div> - <div class='step4_value'> - {if $optional.uniq_identifier_active == FALSE} - <input type='checkbox' value='1' name='uniq_identifier_active' - onClick='changeState("uniq_identifier");'> - <select name="uniq_identifier" id="uniq_identifier" disabled> - {html_options options=$uniq_identifiers selected=$optional.uniq_identifier} - </select> - {else} - <input type='checkbox' value='1' name='uniq_identifier_active' checked - onClick='changeState("uniq_identifier");'> - <select name="uniq_identifier" id="uniq_identifier" > - {html_options options=$uniq_identifiers selected=$optional.uniq_identifier} - </select> - {/if} - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - {t}Enable Copy & Paste{/t} - </div> - <div class='step4_value'> - <select name="enableCopyPaste" size="1" title=""> - {html_options options=$bool selected=$optional.enableCopyPaste} - </select> - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - {t}FusionDirectory logging{/t} - </div> - <div class='step4_value'> - {if $logging} - <input checked type='checkbox' name='logging' value='1' class='center'> - {else} - <input type='checkbox' name='logging' value='1' class='center'> - {/if} - </div> - </div> - - <p><b>{t}Login and session{/t}</b></p> - <div class='step4_container'> - <div class='step4_name'> - {t}Login attribute{/t} - </div> - <div class='step4_value'> - <select name="login_attribute" size="1" title=""> - {html_options options=$login_attributes selected=$optional.login_attribute} - </select> - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - {t}Enforce register_globals to be deactivated{/t} - </div> - <div class='step4_value'> - - <select name="forceglobals" size="1" title=""> - {html_options options=$bool selected=$optional.forceglobals} - </select> - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - {t}Enforce encrypted connections{/t} - </div> - <div class='step4_value'> - - <select name="forcessl" size="1" title=""> - {html_options options=$bool selected=$optional.forcessl} - </select> - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - {t}Warn if session is not encrypted{/t} - </div> - <div class='step4_value'> - - <select name="warnssl" size="1" title=""> - {html_options options=$bool selected=$optional.warnssl} - </select> - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - {t}Session lifetime{/t} - </div> - <div class='step4_value'> - <input size=10 id='session_lifetime' name='session_lifetime' - type='text' value='{$optional.session_lifetime}'> - </div> - </div> - - - <p><b>{t}Debugging{/t}</b></p> - - <div class='step4_container'> - <div class='step4_name'> - {t}Show PHP errors{/t} - </div> - <div class='step4_value'> - <select name="errorlvl" size="1" title=""> - {html_options options=$bool selected=$errorlvl} - </select> - </div> - </div> - - - <div class='step4_container'> - <div class='step4_name'> - {t}Maximum LDAP query time{/t} - </div> - <div class='step4_value'> - {if $optional.max_ldap_query_time_active == FALSE} - <input type='checkbox' value='1' name='max_ldap_query_time_active' - onClick='changeState("max_ldap_query_time");'> - <input size=10 id='max_ldap_query_time' name='max_ldap_query_time' - type='text' value='{$optional.max_ldap_query_time}' disabled> - {else} - <input type='checkbox' value='1' name='max_ldap_query_time_active' checked> - <input size=10 id='max_ldap_query_time' name='max_ldap_query_time' - type='text' value='{$optional.max_ldap_query_time}' > - {/if} - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - {t}Log LDAP statistics{/t} - </div> - <div class='step4_value'> - - <select name="ldapstats" size="1" title=""> - {html_options options=$bool selected=$optional.ldapstats} - </select> - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - {t}Debug level{/t} - </div> - <div class='step4_value'> - <select name='debuglevel'> - {if $optional.debuglevel == 0} - <option value='0' selected>0 {t}Disabled{/t}</option> - <option value='1'>1 {t}Enabled{/t}</option> - {else} - <option value='0'>0 {t}Disabled{/t}</option> - <option value='1' selected>1 {t}Enabled{/t}</option> - {/if} - </select> - </div> - </div> -</div> - -<input type='hidden' value='1' name='step6a_posted'> diff --git a/setup/setup_finish.tpl b/setup/setup_finish.tpl index 556a6dc3593339b7c79e088a9d062ab63864a83d..b9fcaa5a87b1972b7864baca0d9615b94fca26f5 100644 --- a/setup/setup_finish.tpl +++ b/setup/setup_finish.tpl @@ -1,22 +1,22 @@ -<div class='default'> +<div class="default"> <p> <b>{t}Create your configuration file{/t}</b> </p> - <p> + <p> {$msg2} </p> - {t}Run {/t} - <a style='color:black ; font-weight:bold '> fusiondirectory-setup --check-config</a> - {t}to put the correct right on fusiondirectory.conf{/t} - <p> - <input type='submit' name='getconf' value='{t}Download configuration{/t}'> + <p> + {t}Run {/t}<a style="color:black ; font-weight:bold ">fusiondirectory-setup --check-config</a>{t} to put the correct right on fusiondirectory.conf{/t} + </p> + <p> + <input type="submit" name="getconf" value="{t}Download configuration{/t}"/> </p> {if $err_msg != ""} <hr/> <br/> {t}Status: {/t} - <a style='color:red ; font-weight:bold '>{$err_msg}</a> + <a style="color:red ; font-weight:bold ">{$err_msg}</a> {/if} </div> -<input type='hidden' value='1' name='step8_posted'> +<input type="hidden" value="1" name="step8_posted"/> diff --git a/setup/setup_frame.tpl b/setup/setup_frame.tpl index 71dfd1937c881714aafc4b04aea1df0231343109..2d9f8e33aefa46ad6a7e8d0518ac1a5fd35618cc 100644 --- a/setup/setup_frame.tpl +++ b/setup/setup_frame.tpl @@ -1,36 +1,45 @@ -<body class='setup_body'> -{$php_errors} -<form action='setup.php' name='mainform' method='post' enctype='multipart/form-data'> - {$msg_dialogs} -<div class='setup_dialog'> - {include file={filePath file="setup_header.tpl"}} - <div class='setup_menu'> - <b>{t}FusionDirectory setup wizard{/t}</b> - </div> - - <div style="padding:10px;background-color:white;"> - - <div class='setup_navigation' id='menucell'> - {$navigation} - </div> - - <div class='setup_contents'> - <div style='border-bottom:1px dashed #AAAAAA'> - {$errors} - {$header} +<!-- Headline --> +<body> + {$php_errors} + <form action="setup.php" name="mainform" id="mainform" method="post" enctype="multipart/form-data"> + <div class="setup_header"> + <div id="header_left"> + <img id="fd_logo" class="optional" src="geticon.php?context=applications&icon=fusiondirectory&size=48" alt="FusionDirectory"/> + <a class="plugtop"> + <img src="{$headline_image}" alt="{t}{$headline}{/t}"/>{t}{$headline}{/t} + </a> </div> - <div style='padding-left:12px;'> - {$contents} - {$bottom} - <br> + <div id="header_right"> + <div class="logout-label"> + {$version} + </div> </div> </div> - <div style="clear:both"> </div> - </div> -</div> + <table class="framework"> + <tbody> + <tr> + <!-- Menu --> + <td id="menucell" class="setup_navigation"> + {$navigation} + <br/> + </td> + + <!-- Plugin window --> + <td id="maincell"> + {$msg_dialogs} + <div class="plugin_window"> + {$contents} + </div> + </td> + </tr> + </tbody> + </table> + + {$errors} + {$focus} + <input type="hidden" name="setup_goto_step" value=""/> + </form> -<input type='hidden' name='setup_goto_step' value=''> -</form> </body> </html> diff --git a/setup/setup_language.tpl b/setup/setup_language.tpl deleted file mode 100644 index 73fcc2adda7e3b9a3a63209496864ce4e510e906..0000000000000000000000000000000000000000 --- a/setup/setup_language.tpl +++ /dev/null @@ -1,13 +0,0 @@ -<div> - <div class='default'> - <p><b>{t}Please select the preferred language{/t}</b></p> - <p> - {t}At this point, you can select the site wide default language. Choosing 'automatic' will use the language requested by the browser. This setting can be overriden per user.{/t} - </p> - </div> - <div class='default' style='padding-right:10px; margin-bottom:20px;'> - <select name='lang_selected' title='{t}Please select your preferred language here{/t}' size=20 style="width:100%"> - {html_options options=$languages selected=$lang_selected} - </select> - </div> -</div> diff --git a/setup/setup_ldap.tpl b/setup/setup_ldap.tpl deleted file mode 100644 index 00814a2f6ad783ab41f4d01e0b4f9d7a405fa226..0000000000000000000000000000000000000000 --- a/setup/setup_ldap.tpl +++ /dev/null @@ -1,136 +0,0 @@ -<div class='default' style="width:100%; margin-right:20px;"> - - {if $resolve_user} - - <div style='float:left; width:99%; margin-bottom:20px;'> - <p> - <b>{t}Please choose the LDAP user to be used by FusionDirectory{/t}</b> - </p> - <select name='admin_to_use' size=20 style="width:100%; margin-bottom:10px;"> - {html_options options=$resolved_users selected=$admin} - </select> - <input type='text' value='{$resolve_filter}' name='resolve_filter'> - <input type='submit' value='{t}Search{/t}' name='resolve_search'> - <p class='seperator' style='margin-bottom:10px;'> </p> - <div style='text-align:right'> - <input type='submit' value='{t}Apply{/t}' name='use_selected_user'> - <input type='submit' value='{t}Cancel{/t}' name='resolve_user'> - </div> - </div> - - <div style="clear:both;"></div> - - {else} - <p> - <b>{t}LDAP connection{/t}</b> - </p> - <div class='step4_container'> - <div class='step4_name'> - {t}Location name{/t} - </div> - <div class='step4_value'> - <input type='text' name='location' maxlength='80' size='40' value='{$location}'> - </div> - </div> - <div class='step4_container'> - <div class='step4_name'> - <div style='vertical-align:middle;height:100%;'>{t}Connection URI{/t}</div> - </div> - <div class='step4_value'> - <input type='text' name='connection' maxlength='80' size='40' value='{$connection}'> - </div> - </div> - <div class='step4_container'> - <div class='step4_name'> - {t}TLS connection{/t} - </div> - <div class='step4_value'> - <select name="tls" size="1" title=""> - {html_options options=$bool selected=$tls} - </select> - </div> - </div> - <div class='step4_container'> - <div class='step4_name'> - {t}Base{/t} - </div> - <div class='step4_value'> - {if $namingContextsCount >= 1} - <select name='base'> - {html_options values=$namingContexts output=$namingContexts selected=$base} - </select> - {else} - <input type='text' name='base' maxlength='80' size='40' value='{$base}'> - {/if} - <input type='image' class='center' src='geticon.php?context=actions&icon=view-refresh&size=16' title='{t}Reload{/t}' name='reload' alt='{t}Reload{/t}'> - </div> - </div> - <p style="margin-top:20px"> - <b>{t}Authentication{/t}</b> - </p> - <div class='step4_container'> - <div class='step4_name'> - {t}Admin DN{/t} - </div> - <div class='step4_value'> - <input type='text' name='admin_given' maxlength='160' size='40' value='{$admin_given}'> - {if $append_base_to_admin_dn},{$base_to_append}{/if} - <input type='image' class='center' src='geticon.php?context=places&icon=folder&size=16' title='{t}Select user{/t}' name='resolve_user' alt='{t}Select user{/t}'> - </div> - </div> - - <div class='step4_container'> - <div class='step4_name'> - </div> - <div class='step4_value'> - <input onClick='document.mainform.submit();' {if $append_base_to_admin_dn} checked {/if} type='checkbox' name='append_base_to_admin_dn' id='append_base_to_admin_dn' value='1'/><label for="append_base_to_admin_dn"> {t}Automatically append LDAP base to admin DN{/t}</label> - </div> - </div> - - - <div class='step4_container'> - <div class='step4_name'> - {t}Admin password{/t} - </div> - <div class='step4_value'> - <input type='password' name='password' value='{$password}'> - </div> - </div> - - <p style="margin-top:20px"> - <b>{t}Schema based settings{/t}</b> - </p> - <div class='step4_container'> - <div class='step4_name'> - {t}Use rfc2307bis compliant groups{/t} - </div> - <div class='step4_value'> - <select name="rfc2307bis" size="1" title=""> - {html_options options=$bool selected=$rfc2307bis} - </select> - </div> - </div> - {/if} - - {if ! $resolve_user} - <p style="margin-top:20px"> - <b>{t}Current status{/t}</b> - </p> - <div class='step4_container' style='height:45px;'> - <div class='step4_name' style='height:45px;'> - {t}Information{/t} - </div> - <div class='step4_value' style='height:45px;'> - {$connection_status} - </div> - </div> - {/if} - -</div> -<!-- Place cursor --> -<script type="text/javascript"> - <!-- // First input field on page - focus_field('location'); - --> -</script> - diff --git a/setup/setup_welcome.tpl b/setup/setup_welcome.tpl index 51c7fe4f61ad5a0f24eb8a01463ebec4d276a53e..11492f6ecd7ba76c1a66527a9a6af2d2eb6c271b 100644 --- a/setup/setup_welcome.tpl +++ b/setup/setup_welcome.tpl @@ -1,7 +1,6 @@ -<div> - <div class='default'> +<div class="default"> <p> - {t}This seems to be the first time you start FusionDirectory - we didn't find any configuration right now. This simple wizard intends to help you while setting it up.{/t} + {t}This seems to be the first time you start FusionDirectory - we didn't find any configuration right now. This simple wizard intends to help you while setting it up.{/t} </p> <hr/> @@ -9,17 +8,17 @@ <b>{t}What will the wizard do for you?{/t}</b> </p> <ul> - <li>{t}Create a basic, single site configuration{/t}</li> - <li>{t}Tries to find problems within your PHP and LDAP setup{/t}</li> - <li>{t}Let you choose from a set of basic and advanced configuration switches{/t}</li> - <li>{t}Guided migration of existing LDAP trees{/t}</li> + <li>{t}Create a basic, single site configuration{/t}</li> + <li>{t}Tries to find problems within your PHP and LDAP setup{/t}</li> + <li>{t}Let you choose from a set of basic and advanced configuration switches{/t}</li> + <li>{t}Guided migration of existing LDAP trees{/t}</li> </ul> <p> - <b>{t}What will the wizard NOT do for you?{/t}</b> + <b>{t}What will the wizard NOT do for you?{/t}</b> </p> <ul> - <li>{t}Find every possible configuration error{/t}</li> - <li>{t}Migrate every possible LDAP setup - create backup dumps!{/t}</li> + <li>{t}Find every possible configuration error{/t}</li> + <li>{t}Migrate every possible LDAP setup - create backup dumps!{/t}</li> </ul> <hr/> @@ -27,13 +26,12 @@ <b>{t}To continue:{/t}</b> </p> <p> - {t 1=$path}For security reasons you need to authenticate for the installation by creating the file '%1', containing the current session ID on the servers local filesystem. This can be done by executing the following command:{/t} + {t 1=$path}For security reasons you need to authenticate for the installation by creating the file '%1', containing the current session ID on the servers local filesystem. This can be done by executing the following command:{/t} </p> <tt> - echo -n <b>{$auth_id}</b> > {$path} + echo -n <b>{$auth_id}</b> > {$path} </tt> <p> - {t}Click the 'Next' button when you've finished.{/t} + {t}Click the 'Next' button when you've finished.{/t} </p> - </div> </div>