linea21-core
[ class tree: linea21-core ] [ index: linea21-core ] [ all elements ]

Source for file add.php

Documentation is available at add.php

  1. <?php
  2. /**
  3.  * @package linea21.core
  4.  * @subpackage user
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10.  
  11. //////////// Check Inclusion de pages ////////////
  12. if (!function_exists('AuthenthificationProcess')) {
  13.     include_once("../lib/lib_common.php");
  14.     ReloadIndex('admin');
  15. ////////////
  16.  
  17. //////////// Check Droits utilisateur ////////////
  18. if (!IsSuperAdmin()) ReloadIndex('admin');
  19. ////////////
  20. ?>
  21.  
  22. <div id="chemin">
  23.     <ul>
  24.         <li>
  25.             <a href="index.php"><? echo $GLOBALS['lang']['way']['home']?></a>
  26.         </li>
  27.         <li>
  28.             <a href="<?php echo $rub_link?>"><? echo $GLOBALS['lang']['menu']['user']?></a>
  29.         </li>
  30.         <li>
  31.             <span><? echo formatNavTitle($GLOBALS['lang']['user']['add'])?></span>
  32.         </li>
  33.     </ul>
  34. </div>
  35. <!--end barre haute -->
  36. <?php
  37. $form_pseudo='';
  38. $form_email='';
  39. $layer_rights"style=\"display:none;\"";
  40. $mask_type_S='';
  41. $mask_type_P='';
  42. $mask_type_A='';
  43.  
  44. $mask_dashboard_1="checked=\"checked\"";
  45. $mask_dashboard_2='';
  46. $mask_publication_1="checked=\"checked\"";
  47. $mask_publication_2='';
  48. $mask_news_1="checked=\"checked\"";
  49. $mask_news_2='';
  50. $mask_workshop_1="checked=\"checked\"";
  51. $mask_workshop_2='';
  52.  
  53.  
  54. if(isset($_POST['enregistrer'])) {
  55.     $data_table_user=unserialize(urldecode($_POST['data_table_user']));
  56.     $data_table_right=unserialize(urldecode($_POST['data_table_right']));
  57.     $user_objectnew user;
  58.     $data_table_user[3$user_object -> GetNewPassword();
  59.     
  60.     /** include envoi de mail */
  61.     $todo_mail='add_user';
  62.     include_once('../user/mail_actions.php');
  63.     include_once('../mail/template.php');
  64.     /** end mail */
  65.     
  66.     $result=$user_object->AddUser($data_table_user$data_table_right$sql_object);
  67.     $link_confirm="confirm.php?rub=".$rub."&todo=".$todo;
  68.     if(is_numeric($result)) header("Location: ".$link_confirm);
  69.     else  system_error();
  70. }
  71.  
  72.  
  73. if(isset($_POST['valider'])) {
  74.     $table_user[0]=$_POST['pseudo'];
  75.     $table_user[1]=$_POST['email'];
  76.     $table_user[2]='N';
  77.     $user_objectnew user;
  78.     $integrity=$user_object->CheckDataIntegrity($table_user$sql_object);
  79.  
  80.     if($_POST['user_type']=='simple_user'{
  81.         $table_right=$user_object->InitUserRight('SIMPLE_USER');
  82.         $mask_type_S="checked=\"checked\"";
  83.     }
  84.     if($_POST['user_type']=='admin_user'{
  85.         $table_right=$user_object->InitUserRight('ADMIN_USER');
  86.         $mask_type_A="checked=\"checked\"";
  87.     }
  88.     if($_POST['user_type']=='privilege_user'{
  89.         $table_right['dashboard']=$_POST['dashboard'];
  90.         $table_right['workshop']=$_POST['workshop'];
  91.         $table_right['publication']=$_POST['publication'];
  92.         $table_right['news']=$_POST['news'];
  93.         $table_right['yellowpages']='U';
  94.         $table_right['theme']='U';
  95.         $table_right['scale']='U';
  96.         $table_right['level']='U';
  97.         $table_right['category_user']='U';
  98.         $layer_rights"style=\"display:block;\"";
  99.         $mask_type_P="checked=\"checked\"";
  100.     }
  101.     
  102.     $form_pseudo=$_POST['pseudo'];
  103.     $form_email=$_POST['email'];
  104.     $table_user=urlencode(serialize($table_user));
  105.     $table_right=urlencode(serialize($table_right));
  106.     
  107.     if($_POST['dashboard']=='O'{
  108.         $mask_dashboard_1='';
  109.         $mask_dashboard_2="checked=\"checked\"";
  110.     }
  111.     if($_POST['publication']=='O'{
  112.         $mask_publication_1='';
  113.         $mask_publication_2="checked=\"checked\"";
  114.     }
  115.     if($_POST['news']=='O'{
  116.         $mask_news_1='';
  117.         $mask_news_2="checked=\"checked\"";
  118.     }
  119.     if($_POST['workshop']=='O'{
  120.         $mask_workshop_1='';
  121.         $mask_workshop_2="checked=\"checked\"";
  122.     }
  123. }
  124.  
  125. // preparation affichage detaill√© 
  126. $rights_display='';
  127. if(defined('MOD_SDI')) {
  128.     $rights_display.= "<label for=\"dashboard_1\" class=\"rights\">>> ".$GLOBALS['lang']['menu']['dashboard']." : </label><br />\n";
  129.     $rights_display.= "<div class=\"radiomargin\">\n";
  130.     $rights_display.= "<input type=\"radio\" id=\"dashboard_1\" class=\"radio\" name=\"dashboard\" value=\"U\" ".$mask_dashboard_1." /><span class=\"radio\">"$GLOBALS['lang']['user']['norights']."</span>\n";
  131.     $rights_display.= "<input type=\"radio\" id=\"dashboard_2\" class=\"radio\" name=\"dashboard\" value=\"O\" ".$mask_dashboard_2."/><span class=\"radio\">"$GLOBALS['lang']['user']['redactorrights']."</span>\n";
  132.     $rights_display.= "</div>\n";
  133. else $rights_display.="<input type=\"hidden\" id=\"dashboard\" name=\"dashboard\" value=\"U\" />\n";
  134. if(defined('MOD_PUBLICATION')) {
  135.     $rights_display.= "<label for=\"publication_1\" class=\"rights\">>> ".$GLOBALS['lang']['menu']['publication']." : </label><br />\n";
  136.     $rights_display.= "<div class=\"radiomargin\">\n";
  137.     $rights_display.= "<input type=\"radio\" id=\"publication_1\" class=\"radio\" name=\"publication\" value=\"U\" ".$mask_publication_1." /><span class=\"radio\">"$GLOBALS['lang']['user']['norights']."</span>\n";
  138.     $rights_display.= "<input type=\"radio\" id=\"publication_2\" class=\"radio\" name=\"publication\" value=\"O\" ".$mask_publication_2." /><span class=\"radio\">"$GLOBALS['lang']['user']['redactorrights']."</span>\n";
  139.     $rights_display.= "</div>\n";
  140. else $rights_display.="<input type=\"hidden\" id=\"publication\" name=\"publication\" value=\"U\" />\n";
  141. if(defined('MOD_NEWS')) {
  142.     $rights_display.= "<label for=\"news_1\" class=\"rights\">>> ".$GLOBALS['lang']['menu']['news']." : </label><br />\n";
  143.     $rights_display.= "<div class=\"radiomargin\">\n";
  144.     $rights_display.= "<input type=\"radio\" id=\"news_1\" class=\"radio\" name=\"news\" value=\"U\" ".$mask_news_1." /><span class=\"radio\">"$GLOBALS['lang']['user']['norights']."</span>\n";
  145.     $rights_display.= "<input type=\"radio\" id=\"news_2\" class=\"radio\" name=\"news\" value=\"O\" ".$mask_news_2."/><span class=\"radio\">"$GLOBALS['lang']['user']['redactorrights']."</span>\n";
  146.     $rights_display.= "</div>\n";
  147. else $rights_display.="<input type=\"hidden\" id=\"news\" name=\"news\" value=\"U\" />\n";
  148. if(defined('MOD_WORKSHOP')) {
  149.     $rights_display.= "<label for=\"workshop_1\" class=\"rights\">>> ".$GLOBALS['lang']['menu']['workshop']." : </label><br />\n";
  150.     $rights_display.= "<div class=\"radiomargin\">\n";
  151.     $rights_display.= "<input type=\"radio\" id=\"workshop_1\" class=\"radio\" name=\"workshop\" value=\"U\" ".$mask_workshop_1." /><span class=\"radio\">"$GLOBALS['lang']['user']['norights']."</span>\n";
  152.     $rights_display.= "<input type=\"radio\" id=\"workshop_2\" class=\"radio\" name=\"workshop\" value=\"O\" ".$mask_workshop_2." /><span class=\"radio\">"$GLOBALS['lang']['user']['animatorrights']."</span>\n";
  153.     $rights_display.= "</div>\n";
  154. else $rights_display.="<input type=\"hidden\" id=\"wokshop\" name=\"workshop\" value=\"U\" />\n";
  155.  
  156. include_once("quickicons.php");
  157.  
  158. if(!isset($_POST['valider'])) $mask_type_S='checked="checked"';
  159. ?>
  160.  
  161. <?php
  162. if(!isset($integrity|| is_string($integrity)) {
  163. ?>
  164. <div class="contentcontainer">
  165.         <?php
  166.         include_once($dir."/menurub.php");
  167.         ?>
  168.         <div id="content">
  169.             <?php
  170.             if(isset($integrity&& is_string($integrity)) display_errors($integrity);
  171.             ?>
  172.             <h2><? echo formatTitleh2($GLOBALS['lang']['user']['add_title'])?></h2>
  173.             <form id="adduser" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  174.                 <p>
  175.                 <label for="simple_user" ><? echo $GLOBALS['lang']['user']['type']?> : *</label>
  176.                 <input name="user_type" type="radio" id="simple_user" maxlength="150" value="simple_user" class="radio" onclick="ShowthemeTableRights('')" <?php echo $mask_type_S?> /><span class="radio"><?php echo $GLOBALS['lang']['user']['type_simple']?></span>
  177.                 <input name="user_type" type="radio" id="privilege_user" maxlength="150" value="privilege_user" class="radio" onclick="ShowthemeTableRights('rights')" <?php echo $mask_type_P;  ?> /><span class="radio"><?php echo $GLOBALS['lang']['user']['type_privilege']?></span>
  178.                 <input name="user_type" type="radio" id="admin_user" maxlength="150" value="admin_user" class="radio" onclick="ShowthemeTableRights('')" <?php echo $mask_type_A;  ?> /><span class="radio"><?php echo $GLOBALS['lang']['user']['type_admin']?></span>
  179.                 </p>
  180.                 <div id="rights" <?php echo $layer_rights?>>
  181.                     <h3><? echo $GLOBALS['lang']['user']['set_rights']?> : <br /></h3>
  182.                     <?php echo $rights_display?>
  183.                 </div>
  184.                 <p>
  185.                 <label for="pseudo" ><? echo $GLOBALS['lang']['user']['pseudo']?> : *</label>
  186.                 <input name="pseudo" type="text" class="textfield" id="pseudo" maxlength="150" value="<?php echo $form_pseudo?>" />
  187.                 </p>
  188.                 <p>
  189.                 <label for="email" ><? echo $GLOBALS['lang']['user']['email']?> : *</label>
  190.                 <input name="email" type="text" class="textfield" id="email" maxlength="200" value="<?php echo $form_email?>" />
  191.                 </p>
  192.                 <div>
  193.                 <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  194.                 <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  195.                 <?php 
  196.                 if(isset($table_user&& isset($table_right)) {
  197.                 echo "<input name=\"data_table_user\" type=\"hidden\" value=\"".$table_user."\" id=\"data_table_user\" />\n";
  198.                 echo "<input name=\"data_table_right\" type=\"hidden\" value=\"".$table_right."\" id=\"data_table_right\" />\n";
  199.                 
  200.                 ?>
  201.                 <?php echo cancel_button('javascript:history.go(-1);')?>
  202.                 <input name="valider" type="submit" value="<? echo $GLOBALS['lang']['btn']['valid']?>" class="button" id="valider" />
  203.                 </div>
  204.             </form>
  205.         </div>
  206. <?php include_once($dir."/help.php")?>
  207. </div>
  208. <?php
  209. // R√©capitulatif
  210. else    {
  211. $reca_droits='';
  212. if($_POST['user_type']=='simple_user'{
  213.     $display_type=$GLOBALS['lang']['user']['type_simple'];
  214. }
  215. if($_POST['user_type']=='admin_user'{
  216.     $display_type=$GLOBALS['lang']['user']['type_admin'];
  217. }
  218. if($_POST['user_type']=='privilege_user')  {
  219.     $display_type=$GLOBALS['lang']['user']['type_privilege'];
  220.     
  221.     $reca_droits.="<dt>".$GLOBALS['lang']['user']['set_rights']." : </dt>";
  222.     $reca_droits.="<dd>&nbsp;<br /></dd>";
  223.     if(defined('MOD_SDI'))  {
  224.         $reca_droits.="<dt> . ".$GLOBALS['lang']['menu']['sdi']." : </dt>";
  225.         $reca_droits.="<dd>".GetDisplayUserRight($_POST['dashboard']'dashboard')."<br /></dd>";
  226.     }
  227.     if(defined('MOD_PUBLICATION'))  {
  228.         $reca_droits.="<dt>  . ".$GLOBALS['lang']['menu']['publication']." : </dt>";
  229.         $reca_droits.="<dd>".GetDisplayUserRight($_POST['publication'])."<br /></dd>";
  230.     }
  231.     if(defined('MOD_WORKSHOP'))  {
  232.         $reca_droits.="<dt>  . ".$GLOBALS['lang']['menu']['workshop']." : </dt>";
  233.         $reca_droits.="<dd>".GetDisplayUserRight($_POST['workshop']'workshop')."<br /></dd>";
  234.     }
  235.     if(defined('MOD_NEWS'))  {
  236.         $reca_droits.="<dt>  . ".$GLOBALS['lang']['menu']['news']." : </dt>";
  237.         $reca_droits.="<dd>".GetDisplayUserRight($_POST['news'])."<br /></dd>";
  238.     }
  239. }
  240.  
  241. ?>
  242. <div class="contentcontainer">
  243. <?php
  244. include_once($dir."/menurub.php");
  245. ?>
  246. <div id="content">
  247.             <h2><? echo formatTitleh2($GLOBALS['lang']['recap']['title'])?></h2>
  248.             <dl class="dl3">
  249.                 <dt><? echo $GLOBALS['lang']['user']['type'?> : </dt>
  250.                 <dd><?php echo $display_type?><br /></dd>
  251.                 <dt><? echo $GLOBALS['lang']['user']['pseudo'?> : </dt>
  252.                 <dd><?php echo $form_pseudo?><br /></dd>
  253.                 <dt><? echo $GLOBALS['lang']['user']['email'?> :</dt>
  254.                 <dd><?php echo $form_email?><br /></dd>
  255.                 <?php echo $reca_droits?>
  256.             </dl>
  257.             <form id="adduser" action="<?php echo $_SERVER['SCRIPT_NAME']?>" method="post">
  258.                 <div>
  259.                 <input name="rub" type="hidden" value="<?php echo $rub?>" id="rub" />
  260.                 <input name="todo" type="hidden" value="<?php echo $todo?>" id="todo" />
  261.                 <input name="data_table_user" type="hidden" value="<?php echo $table_user?>" id="data_table_user" />
  262.                 <input name="data_table_right" type="hidden" value="<?php echo $table_right?>" id="data_table_right" />
  263.                 <?php echo cancel_button('?rub=user&todo=list')?>
  264.                 <input name="retour" type="button" value="<? echo $GLOBALS['lang']['btn']['preview'?>" class="button" id="retour" onclick="history.go(-1);" />
  265.                 <input name="enregistrer" type="submit" value="<? echo $GLOBALS['lang']['btn']['save'?>" class="button" id="valider" />
  266.                 </div>
  267.             </form>
  268.         </div>
  269.     <?php include_once($dir."/help.php")?>
  270. </div>
  271. <?php
  272. }
  273. ?>

Documentation generated on Sat, 08 Nov 2008 14:50:34 +0100 by phpDocumentor 1.4.1