* @version $id SVN * @access public * @license http://opensource.org/licenses/gpl-3.0.html */ //////////// Check Inclusion de pages //////////// if (!function_exists('AuthenthificationProcess')) { include_once("../lib/lib_common.php"); ReloadIndex('admin'); } //////////// //////////// Check Droits utilisateur //////////// if (!IsSuperAdmin()) ReloadIndex('admin'); //////////// include_once('../lib/input_helpers.php'); // USER if (isset($_GET['id'])) $id=$_GET['id']; if (isset($_POST['id'])) $id=$_POST['id']; $mask_dashboard_1=''; $mask_dashboard_2=''; $mask_publication_1=''; $mask_publication_2=''; $mask_news_1=''; $mask_news_2=''; $mask_workshop_1=''; $mask_workshop_2=''; $mask_display_mail_1=''; $mask_display_mail_2=''; if(isset($_POST['switch_type'])) { $switch_type=$_POST['switch_type']; $user_object= new user; if($switch_type=='2SIMPLE_USER') $table_right=$user_object->InitUserRight('SIMPLE_USER'); if($switch_type=='2ADMIN_USER') $table_right=$user_object->InitUserRight('ADMIN_USER'); $result=$user_object->ModifyRight($id, $table_right, $sql_object); $link_confirm="confirm.php?rub=".$rub."&todo=".$todo."_t&id=".$id; if($result) header("Location: ".$link_confirm); else system_error(); } $requete=SQL_getAllUserInfo($id); $data=$sql_object->DBSelect($requete, 'OBJECT'); if(count($data)>1) exit(); $current_title =$data[0]->user_login; $user_login =$data[0]->user_login; $user_category = $data[0]->user_category; if($user_category==1) { $switch_type='2SIMPLE_USER'; $switch_link=_t('user','2SIMPLE_USER'); } else { $switch_type='2ADMIN_USER'; $switch_link=_t('user','2ADMIN_USER'); } $switch_form= "
\n"; // droits utilisateur $rights_id=$data[0]->rights_id; $form_rights_dashboard=$data[0]->rights_dashboard; $form_rights_publication=$data[0]->rights_publication; $form_rights_news=$data[0]->rights_news; $form_rights_workshop=$data[0]->rights_workshop; // profil utilisateur $profile_id=$data[0]->profile_id; $form_profile_email = $current_email = $data[0]->profile_email; $form_profile_email_display=$data[0]->profile_email_display; $form_profile_city=formatText($data[0]->profile_city, '2FIELD'); $form_profile_birthdate= isNullDate($data[0]->profile_birthdate) ? '--' : formatDate($data[0]->profile_birthdate, true); list($form_date_y, $form_date_m, $form_date_d)=explode('-', $form_profile_birthdate); $form_profile_leisures=formatText($data[0]->profile_leisures, '2FIELD'); $form_profile_job=formatText($data[0]->profile_job, '2FIELD'); $form_profile_avatar=$data[0]->profile_avatar; $form_profile_quotation=formatText($data[0]->profile_quotation, '2FIELD'); $form_profile_signature=formatText($data[0]->profile_signature, '2FIELD'); $form_profile_last_modify_display=$data[0]->profile_last_modify_display; if(isset($_POST['valider'])) { $table_user[0]=$user_login; $integrity=1; $form_profile_email = $table_profile[0] = $table_user[1] =$_POST['email']; $form_profile_email_display = $table_profile[1] = $_POST['email_display']; $form_profile_city = $table_profile[2] = $_POST['city']; $form_date_d = $_POST['date_d']; $form_date_m = $_POST['date_m']; $form_date_y = $_POST['date_y']; $form_birthdate=$form_date_d . '-' . $form_date_m . '-' . $form_date_y; if(!empty($form_date_d) && !empty($form_date_m) && !empty($form_date_y)) { $date_integrity=checkdate_validity($form_birthdate); } else { $date_integrity=true; } if(is_string($date_integrity)) $integrity = $date_integrity; else { $table_profile[3]= $form_date_y.'-'.$form_date_m.'-'.$form_date_d; $form_profile_birthdate=$table_profile[3]; $form_profile_birthdate=formatDate($form_profile_birthdate); } $table_profile[4] = $_POST['leisures']; $table_profile[5] = $_POST['job']; $table_profile[6] = $_POST['quotation']; $table_profile[7] = $_POST['signature']; $table_right['dashboard']=$_POST['dashboard']; $table_right['publication']=$_POST['publication']; $table_right['news']=$_POST['news']; $table_right['workshop']=$_POST['workshop']; if(is_string($integrity)) $format_text='2FIELD'; else $format_text='2HTML'; $form_profile_leisures = formatText($_POST['leisures'], $format_text); $form_profile_job = formatText($_POST['job'], $format_text); $form_profile_quotation = formatText($_POST['quotation'], $format_text); $form_profile_signature = formatText($_POST['signature'], $format_text); $form_rights_dashboard = $_POST['dashboard']; $form_rights_publication = $_POST['publication']; $form_rights_news = $_POST['news']; $form_rights_workshop = $_POST['workshop']; $table_right=urlencode(serialize($table_right)); $current_email=$_POST['current_email']; $user_object= new user; $data_user_integrity=$user_object->CheckDataIntegrity($table_user); if(is_string($data_user_integrity)) $integrity=$data_user_integrity; if(!is_string($integrity)) { if(isset($_FILES['avatar']) && $_FILES['avatar']['name']!='') { include_once('../class/system/class.upload.php'); $upload_object= new upload; $upload=$_FILES['avatar']; $size_integrity=$upload_object->CheckMaxFile($upload['size'], $user_object->UPLOAD_MAX_MO); if(is_string($size_integrity)) $integrity=$size_integrity; $format_integrity=$upload_object->CheckExtImage($upload['name']); if(is_string($format_integrity)) $integrity=$format_integrity; if(!is_string($integrity)) { $final_name=$id.".".$upload_object->GetExtension($upload ['name']); $temp_name="temp_".$final_name; $destination="../".$user_object->URI_INPUT; $table_profile[8]=$user_object->URI_INPUT.$final_name; $form_profile_avatar=$user_object->URI_INPUT.$temp_name; $result_upload=$upload_object->UploadFile($upload, $temp_name, $destination); } } else { $table_profile[8]=$form_profile_avatar; $archive_it=0; } } $table_profile=urlencode(serialize($table_profile)); } if(isset($_POST['enregistrer'])) { $current_email=$_POST['current_email']; include_once('../class/system/class.upload.php'); $table_right=unserialize(urldecode($_POST['table_right'])); $table_profile=unserialize(urldecode($_POST['table_profile'])); $new_email=$table_profile[0]; $user_object= new user; $result1=$user_object->ModifyRight($id, $table_right, $sql_object); $result2=$user_object->ModifyProfile($id, $table_profile, $sql_object); if($new_email!=$current_email) { $new_pass=$user_object->GetNewPassword(); $user_object->UpdateUserPassword($id, $new_pass, $sql_object); /** include envoi de mail */ $todo_mail='change_mail'; include_once('../user/mail_actions.php'); include_once('../mail/template.php'); } $upload_object= new upload; $visual_uri="../".$table_profile[8]; $result_rename=$upload_object->Archivefile($visual_uri); $link_confirm="confirm.php?rub=".$rub."&todo=".$todo; if($result1 && $result2) header("Location: ".$link_confirm); else system_error(); } // préparation des données if($form_rights_dashboard=='U') $mask_dashboard_1="checked=\"checked\""; if($form_rights_dashboard=='O') $mask_dashboard_2="checked=\"checked\""; if($form_rights_publication=='U') $mask_publication_1="checked=\"checked\""; if($form_rights_publication=='O') $mask_publication_2="checked=\"checked\""; if($form_rights_news=='U') $mask_news_1="checked=\"checked\""; if($form_rights_news=='O') $mask_news_2="checked=\"checked\""; if($form_rights_workshop=='U') $mask_workshop_1="checked=\"checked\""; if($form_rights_workshop=='O') $mask_workshop_2="checked=\"checked\""; if($form_profile_email_display=='Y') $mask_display_mail_1="checked=\"checked\""; if($form_profile_email_display=='N') $mask_display_mail_2="checked=\"checked\""; if(!empty($form_profile_avatar)) { $complete_uri='../'.$form_profile_avatar; $user_profile_avatar='\n"; $rights_display.=_t('user','admin_type_info'); $rights_display.="\n
\n"; } ?>