Commit 8de3917e authored by Côme Bernigaud's avatar Côme Bernigaud
Browse files

Fixes #2919 Finished migrating setup to simplePlugin

Conflicts:
	setup/class_setup.inc
	setup/class_setupStep_Finish.inc
parent f585e4de
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2003 Cajus Pollmeier
......
......@@ -133,103 +133,4 @@ class setupStep extends simplePlugin
return $ldap;
}
}
class setup_step extends plugin
{
var $s_title = "Still undefined";
var $s_title_long = "This is a still undefined long title";
var $s_info = "This info is still undefined. This setup step detect the type of your ldap for FusionDirectory.This is a basic requirement for fusiondirectory.";
var $is_active = FALSE;
var $is_enabled = FALSE;
var $is_completed = FALSE;
var $header_image = "";
var $attributes = array();
var $parent = NULL;
var $dialog = FALSE;
function __construct()
{
}
function execute()
{
}
function save_object()
{
/* Do not call plugin::save_object. This causes acl trouble */
}
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 ($this->attributes as $attr) {
$tmp[$attr] = $this->$attr;
}
return $tmp;
}
function get_ldap_link()
{
/* 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);
$ldap->cd($cv['base']);
return $ldap;
}
}
?>
......@@ -19,28 +19,35 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Step_Finish extends setup_step
class Step_Finish extends setupStep
{
var $header_image = 'geticon.php?context=devices&icon=server&size=48';
function __construct()
static function getAttributesInfo()
{
$this->update_strings();
return array(
'welcome' => array(
'name' => _('Welcome'),
'template' => get_template_path("setup_finish.tpl", TRUE, dirname(__FILE__)),
'attrs' => array(
)
)
);
}
function update_strings()
{
$this->s_title = _("Finish");
$this->s_info = _("Write configuration file");
$this->s_title_long = _("Finish - write the configuration file");
$this->s_title = _('Finish');
$this->s_info = _('Write configuration file');
$this->s_title_long = _('Finish - write the configuration file');
}
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("templateCompileDirectory", SPOOL_DIR);
$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);
}
......@@ -74,43 +81,43 @@ class Step_Finish extends setup_step
function execute()
{
global $BASE_DIR;
/* Check if there is currently an active fusiondirectory.conf */
$exists = file_exists(CONFIG_DIR."/".CONFIG_FILE);
$exists = file_exists(CONFIG_DIR."/".CONFIG_FILE);
$err_msg = '';
if ($exists && $this->is_world_readable(CONFIG_DIR.'/'.CONFIG_FILE)) {
$err_msg = _('Your configuration file is currently world readable. Please update the file permissions!');
} elseif (!$exists) {
$err_msg = _('The configuration is currently not readable or it does not exists.');
}
$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));
return parent::execute();
}
function save_object()
{
parent::save_object();
$exists = file_exists(CONFIG_DIR.'/'.CONFIG_FILE);
/* Redirect to FusionDirectory login, if :
* - fusiondirectory.conf exists
* - Permisssion are set correctly
*/
if (isset($_POST['next']) && $exists && !$this->is_world_readable(CONFIG_DIR."/".CONFIG_FILE)) {
if (isset($_POST['next']) && $exists && !$this->is_world_readable(CONFIG_DIR.'/'.CONFIG_FILE)) {
$this->insertConfigDefaults();
session::destroy();
header("Location: index.php");
header('Location: index.php');
exit();
}
/* Download config */
if (isset($_POST['getconf'])) {
send_binary_content($this->get_conf_data(), CONFIG_FILE, "text/plain");
}
$err_msg = "";
if ($exists && $this->is_world_readable(CONFIG_DIR."/".CONFIG_FILE)) {
$err_msg = _("Your configuration file is currently world readable. Please update the file permissions!");
} elseif (!$exists) {
$err_msg = _("The configuration is currently not readable or it does not exists.");
send_binary_content($this->get_conf_data(), CONFIG_FILE, 'text/plain');
}
$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));
//~ Changer ça pour du sp.
return $smarty->fetch("$BASE_DIR/setup/setup_finish.tpl");
}
/* check if given file is world readable */
......@@ -121,5 +128,4 @@ class Step_Finish extends setup_step
return (decbin($p & 4) == TRUE);
}
}
?>
......@@ -142,7 +142,6 @@ class StepMigrateCheck
public function save_object()
{
$this->is_completed = TRUE;
if (isset($_POST[$this->name.'_create'])) {
$fnc = $this->fnc.'_create';
$this->step->$fnc($this);
......@@ -309,6 +308,7 @@ class Step_Migrate extends setupStep
function save_object()
{
$this->is_completed = TRUE;
parent::save_object();
foreach ($this->checks as &$check) {
$check->save_object();
......
......@@ -6,7 +6,7 @@
{$msg2}
</p>
<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}
{t escape=no 1="<strong>fusiondirectory-setup --check-config</strong>"}Run %1 to put the correct right on fusiondirectory.conf{/t}
</p>
<p>
<input type="submit" name="getconf" value="{t}Download configuration{/t}"/>
......@@ -15,8 +15,6 @@
<hr/>
<br/>
{t}Status: {/t}
<a style="color:red ; font-weight:bold ">{$err_msg}</a>
<strong>{$err_msg}</strong>
{/if}
</div>
<input type="hidden" value="1" name="step8_posted"/>
......@@ -4,25 +4,24 @@
</span>
<div>
{foreach from=$attributes item=checks}
<p>{t}During the LDAP inspection, we're going to check for several common pitfalls that may occur when migration to FusionDirectory base LDAP administration. You may want to fix the problems below, in order to provide smooth services.{/t}
</p>
{foreach from=$checks item=check key=key}
<div style='width:98%; padding:4px; background-color:{cycle values="#F0F0F0, #FFF"}'>
<div style="width:98%; padding:4px; background-color:{cycle values="#F0F0F0, #FFF"}">
{if $check->error}
<!-- Add ability to display info popup -->
<div class='step2_entry_container_info'>
<div class="step2_entry_container_info">
{else}
<!-- Normal entry everything is fine -->
<div class='step2_entry_container'>
<div class="step2_entry_container">
{/if}
<div class='step2_entry_name'><b>{$check->title}</b></div>
<div class='step2_entry_status'>
<div class="step2_entry_name"><b>{$check->title}</b></div>
<div class="step2_entry_status">
{if $check->status}
<div class='step2_successful'>{$check->msg}</div>
<div class="step2_successful">{$check->msg}</div>
{else}
<div class='step2_failed'>{$check->msg}</div>
<div class="step2_failed">{$check->msg}</div>
{/if}
</div>
{if $check->error}
......@@ -31,9 +30,8 @@
</div>
</div>
{/foreach}
<br/>
<input type='submit' name='reload' value='{t}Check again{/t}'/>
{/foreach}
<br/>
<input type="submit" name="reload" value="{t}Check again{/t}"/>
</div>
</div>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment