* @version $Id$ * @access public * @license http://opensource.org/licenses/gpl-3.0.html */ //////////// Check Inclusion de pages //////////// if (!class_exists('auth')) { include_once("../lib/lib_common.php"); ReloadIndex('admin'); } //////////// //////////// Check Droits utilisateur //////////// if (!$l21auth->isSuperAdmin()) ReloadIndex('admin'); //////////// include_once("../lib/input_helpers.php"); include_once(override('../level/mysql.inc.php', THEME_ADMIN_PATH)); // Multiple select CSS/JS inclusion addDynamicCSS('../lib/js/multipleSelect/dist/multiple-select.css'); footerAddJS('../lib/js/multipleSelect/dist/multiple-select.js'); ?>
DBSelect($q); $default_wg = array(); $form_projects = array(); $user_object= new user; $pwdsec = []; if (defined('PASSWD_STRENGTH')) { if (strpos(PASSWD_STRENGTH, 'a') !== false) array_push($pwdsec, _t('user', 'lowercase_char') ); if (strpos(PASSWD_STRENGTH, 'A') !== false) array_push($pwdsec, _t('user', 'uppercase_char') ) . '' . _t('user', 'security_policy') . ''. sprintf(_t('user', 'security_policy_msg'), join(', ', $pwdsec)) .'
'; } if(isset($_POST['enregistrer'])) { /** include envoi de mail */ include_once(override('../mail/mail_actions.php')); include_once(override('../mail/send.php')); $a = array(); $data_table_user=unserialize(urldecode($_POST['data_table_user'])); $data_table_right=unserialize(urldecode($_POST['data_table_right'])); $data_table_workgroups=unserialize(urldecode($_POST['data_table_workgroups'])); $data_table_projects=unserialize(urldecode($_POST['data_table_projects'])); if(empty($data_table_user[5])) $data_table_user[5] = $user_object -> GetNewPassword(); $a['login'] = $data_table_user[0]; $a['password'] = $data_table_user[5]; $a['action'] ='add_user'; $a['recipient'] = $data_table_user[1]; // we notify user only if asked if($data_table_user['notify'] === true) { $emailContainer = prepare_email($a); $r = send_email($emailContainer); } /** end mail */ $result=$user_object->AddUser($data_table_user, $data_table_right, $sql_object); $link_confirm="confirm.php?rub=".$rub."&todo=".$todo; if(is_numeric($result)) { $r = $user_object -> AddWorkshops($result, $data_table_workgroups, 'U' , $sql_object); $r = $user_object -> AddProjects($result, $data_table_projects, $sql_object); header("Location: ".safe_redirect($link_confirm)); exit; } else system_error(); } if(isset($_POST['valider'])) { $table_user = array(); $table_right = array(); $table_user[0] = $_POST['pseudo']; $table_user[1] = $_POST['email']; $table_user[2] = 'N'; $table_user[3] = $_POST['first_name']; $table_user[4] = $_POST['last_name']; $table_user[5] = $_POST['password']; $table_user["leisures"] = $_POST['leisures']; $table_user["job"] = $_POST['job']; isset($_POST['notify-user']) ? $table_user['notify'] = true : $table_user['notify'] = false; $user_object= new user; if(!empty($table_user[5])) $integrity = $user_object->checkPasswordValidity($table_user[5]); else $integrity = true; if($integrity === true ) $integrity = $user_object->CheckDataIntegrity($table_user, $sql_object); if($_POST['user_type']=='simple_user') { $table_right=$user_object->InitUserRight('SIMPLE_USER'); $mask_type_S="checked=\"checked\""; } if($_POST['user_type']=='admin_user') { $table_right=$user_object->InitUserRight('ADMIN_USER'); $mask_type_A="checked=\"checked\""; } if($_POST['user_type']=='privilege_user') { $table_right['sdi']=$_POST['sdi']; $table_right['dashboard']=$_POST['dashboard']; $table_right['project']=$_POST['project']; $table_right['workshop']=$_POST['workshop']; $table_right['publication']=$_POST['publication']; $table_right['news']=$_POST['news']; $table_right['yellowpages']='U'; $table_right['level']='U'; $table_right['scale']='U'; $table_right['category_user']='U'; $layer_rights= "style=\"display:block;\""; $mask_type_P="checked=\"checked\""; } if(isset($_POST['workgroups'])) { $table_workgroups=$_POST['workgroups']; $default_wg=$table_workgroups; } else $table_workgroups=array(); if(isset($_POST['projects'])) { $table_projects=$_POST['projects']; } else $table_projects=array(); if($table_right['project'] == 'U') $table_projects = array(); // to be sure no projects is associated to user with no given rights on projects if(is_string($integrity)) $format_text='2FIELD'; else $format_text='2HTML'; $form_pseudo=$_POST['pseudo']; $form_email=$_POST['email']; $form_first_name=$_POST['first_name']; $form_last_name=$_POST['last_name']; $form_profile_leisures = formatText($_POST['leisures'], $format_text); $form_profile_job = formatText($_POST['job'], $format_text); if(!isset($_POST['notify-user'])) $mask_notify = ''; if(isset($_POST['projects']) && $table_right['project'] != 'U') $form_projects = $_POST['projects']; $table_user=urlencode(serialize($table_user)); $table_right=urlencode(serialize($table_right)); $table_workgroups=urlencode(serialize($table_workgroups)); $table_projects=urlencode(serialize($table_projects)); if($_POST['sdi']=='O') { $mask_sdi_1=''; $mask_sdi_2="checked=\"checked\""; } if($_POST['dashboard']=='O') { $mask_dashboard_1=''; $mask_dashboard_2="checked=\"checked\""; } if($_POST['project']=='O') { $mask_project_1=''; $mask_project_2="checked=\"checked\""; } if($_POST['publication']=='O') { $mask_publication_1=''; $mask_publication_2="checked=\"checked\""; } if($_POST['news']=='O') { $mask_news_1=''; $mask_news_2="checked=\"checked\""; } if($_POST['workshop']=='O') { $mask_workshop_1=''; $mask_workshop_2="checked=\"checked\""; } } // preparation affichage detaillé $rights_display='
/>