1<?php
2/* $Id: step_4.inc.php,v 1.11 2005/01/27 17:59:57 k-fish Exp $ */
3if(!defined("SETUP_RUNNING")) die('Use index.php for running setup!');
4
5if($_SESSION["SETUP"]['uninstall'] === true){
6    @include($configFile);
7
8    function recDel($path){
9	$dir = opendir($path);
10	while(($file = readdir($dir)) !== false){
11	    if($file != '.' && $file != '..'){
12		if(is_dir("$path/$file")){
13		    recDel("$path/$file");
14		    @rmdir("$path/$file");
15		}
16		else
17		    @unlink("$path/$file");
18	    }
19	}
20    } // end recDel()
21
22    recDel(ROOTPATH);
23    @rmdir(ROOTPATH);
24
25    $_SESSION = array();
26    session_destroy();
27
28    header('Location: '.ROOTURL);
29    exit();
30}
31else{
32    /* settings should always be checked after showing this page */
33    $_SESSION["SETUP"]["ldap_ok"] = false;
34
35    $smarty->assign('explain', Lang::getLanguageString($_SESSION["SETUP"]["auth_method"].'_explain'));
36    $smarty->assign('authtype', $_SESSION["SETUP"]["auth_method"]);
37
38    switch($_SESSION["SETUP"]["auth_method"]){
39    case 'ldap':
40	if (isset($_SESSION["SETUP"]["auth_ldaptype"])){
41	    if($_SESSION["SETUP"]["auth_ldaptype"] == 0){
42		$smarty->assign("oldap", ' selected="selected"');
43		$smarty->assign("adir", '');
44	    }
45	    else{
46		$smarty->assign("oldap", '');
47		$smarty->assign("adir", ' selected="selected"');
48	    }
49	}
50	if (isset($_SESSION["SETUP"]["auth_ldaphost"])) $smarty->assign("auth_ldaphost", $_SESSION["SETUP"]["auth_ldaphost"]); else $smarty->assign("auth_ldaphost", "");
51	if (isset($_SESSION["SETUP"]["auth_ldapbase"])) $smarty->assign("auth_ldapbase", $_SESSION["SETUP"]["auth_ldapbase"]); else $smarty->assign("auth_ldapbase", "");
52	if (isset($_SESSION["SETUP"]["auth_ldapsuffixe"])) $smarty->assign("auth_ldapsuffix", $_SESSION["SETUP"]["auth_ldapsuffix"]); else $smarty->assign("auth_ldapsuffix", "");
53	if (isset($_SESSION["SETUP"]["create_accounts_on_login"])){
54	    if($_SESSION["SETUP"]["create_accounts_on_login"] == 0){
55		$smarty->assign("can", ' selected="selected"');
56		$smarty->assign("cay", '');
57	    }
58	    else{
59		$smarty->assign("can", '');
60		$smarty->assign("cay", ' selected="selected"');
61	    }
62	}
63	break;
64    case 'sql':
65	break;
66    case 'ntlm':
67    break;
68    }
69
70    if (isset($errors)) $smarty->assign("errors", $errors);
71    if (isset($ldaperrorarray)) $smarty->assign("ldaperrorarray", $ldaperrorarray);
72}
73?>