<?php	
/* $Id: step_4.inc.php,v 1.10 2003/11/18 20:36:35 k-fish Exp $ */
if(!defined("SETUP_RUNNING")) die('Use index.php for running setup!');

if($_SESSION["SETUP"]['uninstall'] === true){
    @include($configFile);

    function recDel($path){
	$dir = opendir($path);
	while(($file = readdir($dir)) !== false){
	    if($file != '.' && $file != '..'){
		if(is_dir("$path/$file")){
		    recDel("$path/$file");
		    @rmdir("$path/$file");
		}
		else
		    @unlink("$path/$file");
	    }
	}
    } // end recDel()

    recDel(ROOTPATH);
    @rmdir(ROOTPATH);

    $_SESSION = array();
    session_destroy();

    header('Location: '.ROOTURL);
    exit();
}
else{
    /* settings should always be checked after showing this page */
    $_SESSION["SETUP"]["ldap_ok"] = false;

    $smarty->assign('explain', Lang::getLanguageString($_SESSION["SETUP"]["auth_method"].'_explain'));
    $smarty->assign('authtype', $_SESSION["SETUP"]["auth_method"]);

    switch($_SESSION["SETUP"]["auth_method"]){
    case 'ldap':
	if (isset($_SESSION["SETUP"]["auth_ldaptype"])){
	    if($_SESSION["SETUP"]["auth_ldaptype"] == 0){
		$smarty->assign("oldap", ' selected="selected"');
		$smarty->assign("adir", '');
	    }
	    else{
		$smarty->assign("oldap", '');
		$smarty->assign("adir", ' selected="selected"');
	    }
	}
	if (isset($_SESSION["SETUP"]["auth_ldaphost"])) $smarty->assign("auth_ldaphost", $_SESSION["SETUP"]["auth_ldaphost"]); else $smarty->assign("auth_ldaphost", "");
	if (isset($_SESSION["SETUP"]["auth_ldapbase"])) $smarty->assign("auth_ldapbase", $_SESSION["SETUP"]["auth_ldapbase"]); else $smarty->assign("auth_ldapbase", "");
	if (isset($_SESSION["SETUP"]["auth_ldapsuffixe"])) $smarty->assign("auth_ldapsuffix", $_SESSION["SETUP"]["auth_ldapsuffix"]); else $smarty->assign("auth_ldapsuffix", "");
	if (isset($_SESSION["SETUP"]["create_accounts_on_login"])){
	    if($_SESSION["SETUP"]["create_accounts_on_login"] == 0){
		$smarty->assign("can", ' selected="selected"');
		$smarty->assign("cay", '');
	    }
	    else{
		$smarty->assign("can", '');
		$smarty->assign("cay", ' selected="selected"');
	    }
	}
	break;
    case 'sql':
	break;
    case 'ntlm':
    }

    if (isset($errors)) $smarty->assign("errors", $errors);
    if (isset($ldaperrorarray)) $smarty->assign("ldaperrorarray", $ldaperrorarray);
}
?>