33 |
require_once('../setup.php'); |
require_once('../setup.php'); |
34 |
|
|
35 |
/* variables setup */ |
/* variables setup */ |
|
|
|
36 |
if ($id) { |
if ($id) { |
37 |
|
|
38 |
if (isset($_POST['delgp'])) { |
if (isset($_POST['delgp'])) { |
78 |
|
|
79 |
include_once(SMARTY_DIR."plugins/prefilter.form.php"); |
include_once(SMARTY_DIR."plugins/prefilter.form.php"); |
80 |
include_once(LUDAP_DIR."form/forms.lib.php"); |
include_once(LUDAP_DIR."form/forms.lib.php"); |
81 |
|
|
82 |
$F = new form_class; |
$F = new form_class; |
83 |
|
|
84 |
$F->NAME = "modifs"; |
$F->NAME = "modifs"; |
85 |
$F->METHOD = "POST"; |
$F->METHOD = "post"; |
86 |
$F->ACTION = "form.php"; |
$F->ACTION = "form.php"; |
87 |
$F->debug = "OutputDebug"; |
$F->debug = "OutputDebug"; |
88 |
$F->ResubmitConfirmMessage = "Etes-vous sûr(e) de vouloir envoyer le résultat de ce formulaire à nouveau ?"; |
$F->ResubmitConfirmMessage = "Etes-vous sûr(e) de vouloir envoyer le résultat de ce formulaire à nouveau ?"; |
89 |
$F->OutputPasswordValues = 0; |
$F->OutputPasswordValues = 0; |
90 |
|
|
91 |
|
/* |
92 |
|
function ldap_check_user($id) { |
93 |
|
return $L->check_id($id); |
94 |
|
} |
95 |
|
*/ |
96 |
foreach ($L->schema_user as $it=>$data) { |
foreach ($L->schema_user as $it=>$data) { |
97 |
if (isset($fres["$it"])) { |
if (isset($fres["$it"])) { |
98 |
$data['VALUE'] = $fres["$it"]; |
$data['VALUE'] = $fres["$it"]; |
102 |
$data['ID'] = $data['NAME']; |
$data['ID'] = $data['NAME']; |
103 |
if ($id) { |
if ($id) { |
104 |
if ($data['TYPE'] == 'password') { |
if ($data['TYPE'] == 'password') { |
105 |
|
if ($data['NAME'] == 'userpassword') { |
106 |
|
$data['LABEL'].= " <i>intact si vide</i>."; |
107 |
|
} |
108 |
if (isset($data['ValidateAsNotEmpty'])) unset($data['ValidateAsNotEmpty']); |
if (isset($data['ValidateAsNotEmpty'])) unset($data['ValidateAsNotEmpty']); |
109 |
if (isset($data['ValidateMinimumLength'])) unset($data['ValidateMinimumLength']); |
if (isset($data['ValidateMinimumLength'])) unset($data['ValidateMinimumLength']); |
110 |
} elseif ($it == $L->conf['baseattr']) { |
} elseif ($it == $L->conf['baseattr']) { |
111 |
$data['Accessible'] = 0; |
#$data['ValidationServerFunction'] = 'ldap_check_user'; |
112 |
|
#$data['Accessible'] = 0; |
113 |
} |
} |
114 |
|
} else { |
115 |
|
#$data['ValidationServerFunction'] = 'ldap_check_user'; |
116 |
} |
} |
117 |
$F->AddInput($data); |
$F->AddInput($data); |
118 |
} |
} |
122 |
"CLASS"=>"act", |
"CLASS"=>"act", |
123 |
"VALUE"=>"Enregistrer" |
"VALUE"=>"Enregistrer" |
124 |
)); |
)); |
125 |
if ($id) { |
$F->AddInput(array( |
126 |
$F->AddInput(array( |
"TYPE"=>"hidden", |
127 |
"TYPE"=>"hidden", |
"NAME"=>"id", |
128 |
"NAME"=>"id", |
"VALUE"=>"$id" |
129 |
"VALUE"=>"$id" |
)); |
130 |
)); |
|
|
} |
|
131 |
$F->AddInput(array( |
$F->AddInput(array( |
132 |
"TYPE"=>"hidden", |
"TYPE"=>"hidden", |
133 |
"NAME"=>"doit", |
"NAME"=>"doit", |
153 |
|
|
154 |
if ($doit) { |
if ($doit) { |
155 |
$inserts = array(); |
$inserts = array(); |
156 |
foreach ($L->attributes_user as $attr) { |
foreach ($L->schema_user as $attr=>$dat) { |
157 |
if (!strstr($F->inputs["$attr"]['NAME'],'_') and $F->inputs["$attr"]['VALUE']) { |
if (!strstr($F->inputs["$attr"]['NAME'],'_') and !empty($F->inputs["$attr"]['VALUE'])) { |
158 |
$inserts["$attr"][] = $F->inputs["$attr"]['VALUE']; |
$inserts["$attr"][] = $F->inputs["$attr"]['VALUE']; |
159 |
} |
} |
160 |
} |
} |
161 |
if (isset($F->inputs["id"]["VALUE"])) { |
//echo'<pre>';print_r($F->inputs);echo'</pre>';die(); |
162 |
$inserts["id"][] = $F->inputs["id"]["VALUE"]; |
$outpi = $L->write_id($inserts,$fres); |
|
} |
|
|
$outpi = $L->write_id($inserts); |
|
|
$id = $F->inputs["{$L->conf['baseattr']}"]['VALUE']; |
|
163 |
if (is_array($outpi)) { |
if (is_array($outpi)) { |
164 |
$error_message = HtmlEntities(implode('<br />',$outpi)); |
$error_message = HtmlEntities(implode('<br />',$outpi)); |
165 |
$doit = 0; |
$doit = 0; |
166 |
} else { |
} else { |
167 |
|
$id = $F->inputs["{$L->conf['baseattr']}"]['VALUE']; |
168 |
header("Location: page.php?id=".urlencode($id)); |
header("Location: page.php?id=".urlencode($id)); |
169 |
die(); |
die(); |
170 |
} |
} |
171 |
} |
} |
172 |
$S->assign('bodyargs','ONLOAD="PageLoad()"'); |
$S->assign('bodyargs','ONLOAD="PageLoad()"'); |
173 |
|
$S->display('header.tpl'); |
174 |
|
if (!$useframe) { $S->display("topbar.tpl"); } |
175 |
|
|
176 |
|
|
177 |
//echo'<pre>';print_r($outpi);echo'</pre>';die(); |
//echo'<pre>';print_r($outpi);echo'</pre>';die(); |
178 |
$S->assign_by_ref("form",$F); |
$S->assign_by_ref("form",$F); |
181 |
$S->assign("doit",$doit); |
$S->assign("doit",$doit); |
182 |
$S->assign("mark","<-- Vérifiez"); |
$S->assign("mark","<-- Vérifiez"); |
183 |
$S->register_prefilter("smarty_prefilter_form"); |
$S->register_prefilter("smarty_prefilter_form"); |
184 |
|
$S->display("form.tpl"); |
|
$S->display('header.tpl'); |
|
|
|
|
|
if ($useframe) { |
|
|
$S->display("form.tpl"); |
|
|
} else { |
|
|
$S->display('topbar.tpl'); |
|
|
$S->display("form.tpl"); |
|
|
$S->display('botbar.tpl'); |
|
|
} |
|
|
$S->display('footer.tpl'); |
|
185 |
|
|
186 |
if($doit) { |
if($doit) { |
187 |
$F->AddFunction(array( |
$F->AddFunction(array( |
202 |
"EndOfLine"=>"\n" |
"EndOfLine"=>"\n" |
203 |
)); |
)); |
204 |
|
|
205 |
|
if (!$useframe) { $S->display("botbar.tpl"); } |
206 |
|
$S->display('footer.tpl'); |
207 |
|
|
208 |
ldap_close($L->conn); |
ldap_close($L->conn); |
209 |
/* |
/* |