/[ludap]/ludap/www/index.php
ViewVC logotype

Diff of /ludap/www/index.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by mose, Wed Sep 3 12:49:06 2003 UTC revision 1.6 by mose, Thu Sep 4 18:19:42 2003 UTC
# Line 22  That file is adapted from ludap work at Line 22  That file is adapted from ludap work at
22  copyright (C) 2001, 2002 mose, makina corpus - mose@makina-corpus.org  copyright (C) 2001, 2002 mose, makina corpus - mose@makina-corpus.org
23  */  */
24    
 // Change that !!  
 // ////////////////////////////////////////////////////////////////////////  
   
 define(LUDAP_DIR,dirname(dirname($_SERVER['SCRIPT_FILENAME'])).'/');  
   
 // ////////////////////////////////////////////////////////////////////////  
   
25  /**  /**
26   * \brief main LuDAP page   * \brief main LuDAP page
27   * That file is the only that can be used by the web server   * That file is the only that can be used by the web server
# Line 37  define(LUDAP_DIR,dirname(dirname($_SERVE Line 30  define(LUDAP_DIR,dirname(dirname($_SERVE
30   * \author mose@ludap.org   * \author mose@ludap.org
31   */   */
32    
33  $ipath = ini_get('include_path');  require_once('../setup.php');
 $isep = (strstr($ipath,';')) ? ';' : ':';  
 ini_set('include_path', LUDAP_DIR.$isep.$ipath);  
   
 require_once('setup.php');  
34    
35  /* variables setup */  /* variables setup */
36    
# Line 260  if ($view and $view == "form") { Line 249  if ($view and $view == "form") {
249          function Output($str) { echo "$str"; }          function Output($str) { echo "$str"; }
250          function OutputDebug($error) { echo "$error\n"; }          function OutputDebug($error) { echo "$error\n"; }
251    
252          include_once("smarty/plugins/prefilter.form.php");          include_once(SMARTY_DIR."plugins/prefilter.form.php");
253          include_once("form/forms.lib.php");          include_once(LUDAP_DIR."form/forms.lib.php");
254          $F = new form_class;          $F = new form_class;
255    
256          $F->NAME   = "modifs";          $F->NAME   = "modifs";
257          $F->METHOD = "POST";          $F->METHOD = "POST";
258          $F->ACTION = $_SERVER["PHP_SELF"]."?view=form";          $F->ACTION = $_SERVER["PHP_SELF"]."?view=form";
259          $F->debug  = "OutputDebug";          $F->debug  = "OutputDebug";
260          $F->ResubmitConfirmMessage = "Etes-vous sûr(e) de vouloir enovyer le résultat de ce formulaire à nouveau ?";          $F->ResubmitConfirmMessage = "Etes-vous sûr(e) de vouloir envoyer le résultat de ce formulaire à nouveau ?";
261          $F->OutputPasswordValues = 0;          $F->OutputPasswordValues = 0;
262    
263          foreach ($L->schema_user as $it=>$data) {          foreach ($L->schema_user as $it=>$data) {
# Line 278  if ($view and $view == "form") { Line 267  if ($view and $view == "form") {
267                  $data['CLASS'] = "acto";                  $data['CLASS'] = "acto";
268                  $data['SIZE'] = "42";                  $data['SIZE'] = "42";
269                  $data['ID'] = $data['NAME'];                  $data['ID'] = $data['NAME'];
270                    if ($id) {
271                            if ($data['TYPE'] == 'password') {
272                                    if (isset($data['ValidateAsNotEmpty'])) unset($data['ValidateAsNotEmpty']);
273                                    if (isset($data['ValidateMinimumLength'])) unset($data['ValidateMinimumLength']);
274                            } elseif ($it == $L->conf['baseattr']) {
275                                    $data['Accessible'] = 0;
276                            }
277                    }
278                  $F->AddInput($data);                  $F->AddInput($data);
279          }          }
280          $F->AddInput(array(          $F->AddInput(array(
# Line 286  if ($view and $view == "form") { Line 283  if ($view and $view == "form") {
283                  "CLASS"=>"act",                  "CLASS"=>"act",
284                  "VALUE"=>"Enregistrer"                  "VALUE"=>"Enregistrer"
285          ));          ));
286            if ($id) {
287                    $F->AddInput(array(
288                    "TYPE"=>"hidden",
289                    "NAME"=>"id",
290                    "VALUE"=>"$id"
291                    ));
292            }
293          $F->AddInput(array(          $F->AddInput(array(
294          "TYPE"=>"hidden",          "TYPE"=>"hidden",
295          "NAME"=>"doit",          "NAME"=>"doit",
# Line 293  if ($view and $view == "form") { Line 297  if ($view and $view == "form") {
297          ));          ));
298    
299          $F->LoadInputValues($F->WasSubmitted("doit"));          $F->LoadInputValues($F->WasSubmitted("doit"));
300    //echo'<pre>';print_r($F);echo'</pre>';
301    //die();
302    
303          $verify = array();          $verify = array();
304          if ($F->WasSubmitted("doit")) {          if ($F->WasSubmitted("doit")) {
# Line 308  if ($view and $view == "form") { Line 314  if ($view and $view == "form") {
314          }          }
315    
316          if ($doit) {          if ($doit) {
                 $F->ReadOnly = 1;  
317                  $inserts = array();                  $inserts = array();
318                  foreach ($L->attributes_user as $attr) {                  foreach ($L->attributes_user as $attr) {
319                          if (!strstr($F->inputs["$attr"]['NAME'],'_') and $F->inputs["$attr"]['VALUE']) {                          if (!strstr($F->inputs["$attr"]['NAME'],'_') and $F->inputs["$attr"]['VALUE']) {
320                                  $inserts["$attr"][] = $F->inputs["$attr"]['VALUE'];                                  $inserts["$attr"][] = $F->inputs["$attr"]['VALUE'];
321                          }                          }
322                  }                  }
323                  $output = $L->write_id($inserts);                  if (isset($F->inputs["id"]["VALUE"])) {
324                            $inserts["id"][] = $F->inputs["id"]["VALUE"];
325                    }
326                    $outpi = $L->write_id($inserts);
327                  $id = $F->inputs["{$L->conf['baseattr']}"]['VALUE'];                  $id = $F->inputs["{$L->conf['baseattr']}"]['VALUE'];
328                  header("Location: $self?id=".urlencode($id));                  if (is_array($outpi)) {
329                            $error_message = HtmlEntities(implode('<br />',$outpi));
330                            $doit = 0;
331                    } else {
332                            header("Location: $self?id=".urlencode($id));
333                            die();
334                    }
335          }          }
336    
337            //echo'<pre>';print_r($outpi);echo'</pre>';die();
338          $S->assign_by_ref("form",$F);          $S->assign_by_ref("form",$F);
339          $S->assign("error_message",$error_message);          $S->assign("error_message",$error_message);
340          $S->assign_by_ref("verify",$verify);          $S->assign_by_ref("verify",$verify);
341          $S->assign("doit",$doit);          $S->assign("doit",$doit);
342          $S->assign("mark","[Vérifier]");          $S->assign("mark","&lt;-- Vérifiez");
343          $S->register_prefilter("smarty_prefilter_form");          $S->register_prefilter("smarty_prefilter_form");
344          $S->fetch("form.tpl");          $S->fetch("form.tpl");
345    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26