Source for file mod.php
Documentation is available at mod.php
* @author linea21 <info@linea21.com>
* @license http://opensource.org/licenses/gpl-3.0.html
//////////// Check Inclusion de pages ////////////
include_once("../lib/lib_common.php");
//////////// Check Droits utilisateur ////////////
include_once('../lib/input_helpers.php');
if (isset ($_GET['id'])) $id= $_GET['id'];
if (isset ($_POST['id'])) $id= $_POST['id'];
if(isset ($_POST['switch_type'])) {
$switch_type= $_POST['switch_type'];
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);
$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;
$switch_type= '2SIMPLE_USER';
$switch_link= $GLOBALS['lang']['user']['2SIMPLE_USER'];
$switch_type= '2ADMIN_USER';
$switch_link= $GLOBALS['lang']['user']['2ADMIN_USER'];
$switch_form= "<form id=\"switchform\" name=\"switchform\" action=\"". $_SERVER['SCRIPT_NAME']. "\" method=\"post\" >\n";
$switch_form.= "<div>\n";
$switch_form.= "<input type=\"hidden\" name=\"switch_type\" id=\"switch_type\" value=\"". $switch_type. "\" />\n";
$switch_form.= "<input name=\"id\" type=\"hidden\" value=\"". $id. "\" id=\"id\" />\n";
$switch_form.= "<input name=\"rub\" type=\"hidden\" value=\"". $rub. "\" id=\"rub\" />\n";
$switch_form.= "<input name=\"todo\" type=\"hidden\" value=\"". $todo. "\" id=\"todo\" />\n";
$switch_form.= "</div>\n";
$switch_form.= "</form>\n";
$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;
$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;
$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)) {
if(is_string($date_integrity)) $integrity = $date_integrity;
$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'];
$current_email= $_POST['current_email'];
$data_user_integrity= $user_object->CheckDataIntegrity($table_user);
if(is_string($data_user_integrity)) $integrity= $data_user_integrity;
if(isset ($_FILES['avatar']) && $_FILES['avatar']['name']!= '') {
include_once('../class/system/class.upload.php');
$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;
$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);
$table_profile[8]= $form_profile_avatar;
if(isset ($_POST['enregistrer'])) {
$current_email= $_POST['current_email'];
include_once('../class/system/class.upload.php');
$new_email= $table_profile[0];
$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');
$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);
// 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= '<img src="'. $complete_uri. '" alt="'. $GLOBALS['lang']['user']['avatar']. ' '. $user_login. '" />';
} else $user_profile_avatar= $GLOBALS['lang']['divers']['none'];
// preparation affichage detaillé
if(defined('MOD_SDI') && $user_category!= 1) {
$rights_display.= "<label for=\"dashboard_1\" class=\"rights\">>> ". $GLOBALS['lang']['menu']['dashboard']. " : </label><br />\n";
$rights_display.= "<div class=\"radiomargin\">\n";
$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";
$rights_display.= "<input type=\"radio\" id=\"dashboard_2\" class=\"radio\" name=\"dashboard\" value=\"O\" ". $mask_dashboard_2. "/><span class=\"radio\">". $GLOBALS['lang']['user']['managerrights']. "</span>\n";
$rights_display.= "</div>\n";
} else $rights_display.= "<input type=\"hidden\" id=\"dashboard\" name=\"dashboard\" value=\"". $form_rights_dashboard. "\" />\n";
if(defined('MOD_PUBLICATION') && $user_category!= 1) {
$rights_display.= "<label for=\"publication_1\" class=\"rights\">>> ". $GLOBALS['lang']['menu']['publication']. " : </label><br />\n";
$rights_display.= "<div class=\"radiomargin\">\n";
$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";
$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";
$rights_display.= "</div>\n";
} else $rights_display.= "<input type=\"hidden\" id=\"publication\" name=\"publication\" value=\"". $form_rights_publication. "\" />\n";
if(defined('MOD_NEWS') && $user_category!= 1) {
$rights_display.= "<label for=\"news_1\" class=\"rights\">>> ". $GLOBALS['lang']['menu']['news']. " : </label><br />\n";
$rights_display.= "<div class=\"radiomargin\">\n";
$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";
$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";
$rights_display.= "</div>\n";
} else $rights_display.= "<input type=\"hidden\" id=\"news\" name=\"news\" value=\"". $form_rights_news. "\" />\n";
if(defined('MOD_WORKSHOP') && $user_category!= 1) {
$rights_display.= "<label for=\"workshop_1\" class=\"rights\">>> ". $GLOBALS['lang']['menu']['workshop']. " : </label><br />\n";
$rights_display.= "<div class=\"radiomargin\">\n";
$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";
$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";
$rights_display.= "</div>\n";
} else $rights_display.= "<input type=\"hidden\" id=\"wokshop\" name=\"workshop\" value=\"". $form_rights_workshop. "\" />\n";
$rights_display.= "<p class=\"info\">\n";
$rights_display.= $GLOBALS['lang']['user']['admin_type_info'];
$rights_display.= "\n</p>\n";
<a href="index.php"> <?php echo $GLOBALS['lang']['way']['home']; ?></a>
<a href=" <?php echo $rub_link; ?>"> <?php echo $GLOBALS['lang']['menu']['user']; ?></a>
<span> <?php echo formatNavTitle($GLOBALS['lang']['user']['mod']. ' : '. $current_title); ?></span>
include_once("quickicons.php");
if(!isset ($integrity) || is_string($integrity)) {
<div class="contentcontainer">
include_once($dir. "/menurub.php");
<a href=" <?php echo $rub_link. "&todo=mod_p&id=". $id; ?>"> <?php echo $GLOBALS['lang']['user']['new_password']; ?></a> |
<?php echo "<a href=\"#\" onclick=\"document.getElementById('switchform').submit()\">". $switch_link. "</a>"; ?>
<form id="moduser" action=" <?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post" enctype="multipart/form-data">
<h3> <?php echo $GLOBALS['lang']['user']['update_rights']; ?> : <br /></h3>
<?php echo $rights_display; ?>
<h3> <?php echo $GLOBALS['lang']['user']['profile']; ?> : </h3>
<label for="email" > <?php echo $GLOBALS['lang']['user']['email']; ?> : *</label>
<input name="email" type="text" class="textfield" id="email" maxlength="200" value=" <?php echo $form_profile_email; ?>" />
<label for="email_display_Y" > <?php echo $GLOBALS['lang']['user']['email_display']; ?> : </label>
<div class="radiomargin">
<input type="radio" id="email_display_Y" class="radio" name="email_display" value="Y" <?php echo $mask_display_mail_1; ?> /><span class="radio"> <?php echo $GLOBALS['lang']['divers']['yes']; ?></span>
<input type="radio" id="email_display_N" class="radio" name="email_display" value="N" <?php echo $mask_display_mail_2; ?> /><span class="radio"> <?php echo $GLOBALS['lang']['divers']['no']; ?></span>
<dt> <?php echo $GLOBALS['lang']['user']['avatar']; ?></dt>
<dd> <?php echo $user_profile_avatar; ?></dd>
<label for="avatar" > <?php echo $GLOBALS['lang']['user']['avatar']; ?> : </label>
<input name="avatar" type="file" id="avatar" size="47" class="file" />
<label for="birthdate_d" > <?php echo $GLOBALS['lang']['user']['birthdate']; ?> :</label>
<?php echo input_date($form_date_y, $form_date_m, $form_date_d); ?>
<label for="city" > <?php echo $GLOBALS['lang']['user']['city']; ?> :</label>
<input name="city" type="text" class="textfield" id="city" maxlength="100" value=" <?php echo $form_profile_city; ?>" />
<label for="leisures" > <?php echo $GLOBALS['lang']['user']['leisures']; ?> :</label>
<input name="leisures" type="text" class="textfield" id="leisures" maxlength="150" value=" <?php echo $form_profile_leisures; ?>" />
<label for="job" > <?php echo $GLOBALS['lang']['user']['job']; ?> :</label>
<input name="job" type="text" class="textfield" id="job" maxlength="150" value=" <?php echo $form_profile_job; ?>" />
<label for="quotation" > <?php echo $GLOBALS['lang']['user']['quotation']; ?> :</label>
<input name="quotation" type="text" class="textfield" id="quotation" maxlength="150" value=" <?php echo $form_profile_quotation; ?>" />
<label for="signature" > <?php echo $GLOBALS['lang']['user']['signature'] ?> :</label>
<input name="signature" type="text" class="textfield" id="signature" maxlength="200" value=" <?php echo $form_profile_signature; ?>" />
<input name="current_email" type="hidden" value=" <?php echo $current_email; ?>" id="current_email" />
<input name="id" type="hidden" value=" <?php echo $id; ?>" id="id" />
<input name="rub" type="hidden" value=" <?php echo $rub; ?>" id="rub" />
<input name="todo" type="hidden" value=" <?php echo $todo; ?>" id="todo" />
<input name="valider" type="submit" value=" <?php echo $GLOBALS['lang']['btn']['valid'] ?>" class="button" id="valider" />
<?php echo $switch_form; ?>
<?php include_once($dir. "/help.php"); ?>
//prepa affichage de droits
$reca_droits.= "<dl class=\"dl3\">\n";
$reca_droits.= "<dt class=\"dl_intitule\">". $GLOBALS['lang']['user']['rights']. " : </dt>\n";
$reca_droits.= "<dd> <br /></dd>\n";
$reca_droits.= "<dt> . ". $GLOBALS['lang']['menu']['sdi']. "</dt>\n";
$reca_droits.= "<dt> . ". $GLOBALS['lang']['menu']['publication']. "</dt>\n";
$reca_droits.= "<dt> . ". $GLOBALS['lang']['menu']['workshop']. "</dt>\n";
$reca_droits.= "<dt> . ". $GLOBALS['lang']['menu']['news']. "</dt>\n";
if($form_profile_email_display== 'Y') $form_profile_email_string= $GLOBALS['lang']['divers']['yes'];
if($form_profile_email_display== 'N') $form_profile_email_string= $GLOBALS['lang']['divers']['no'];
$form_profile_email= '<a href="mailto:'. $form_profile_email. '">'. $form_profile_email. '</a>';
$form_profile_city= empty_nc($form_profile_city);
$form_profile_birthdate = ($form_profile_birthdate== '--') ? '' : $form_profile_birthdate;
$form_profile_birthdate= empty_nc($form_profile_birthdate);
$form_profile_leisures= empty_nc($form_profile_leisures);
$form_profile_job= empty_nc($form_profile_job);
$user_profile_avatar= empty_none($user_profile_avatar);
$form_profile_signature= empty_nc($form_profile_signature);
$form_profile_quotation= empty_nc($form_profile_quotation);
<div class="contentcontainer">
include_once($dir. "/menurub.php");
echo "<h2>". formatTitleh2($GLOBALS['lang']['recap']['title']). "</h2>";
echo "<dl class=\"dl3\">\n";
echo "<dt class=\"dl_intitule\">". $GLOBALS['lang']['user']['profile']. " :</dt>\n";
echo "<dd> </dd>\n";
echo "<dt>". $GLOBALS['lang']['user']['email']. "</dt>\n";
echo "<dd>". $form_profile_email. "</dd>\n";
echo "<dt>". $GLOBALS['lang']['user']['email_display']. "</dt>\n";
echo "<dd>". $form_profile_email_string. "</dd>\n";
echo "<dt>". $GLOBALS['lang']['user']['birthdate']. "</dt>\n";
echo "<dd>". stripslashes($form_profile_birthdate). "</dd>\n";
echo "<dt>". $GLOBALS['lang']['user']['city']. "</dt>\n";
echo "<dt>". $GLOBALS['lang']['user']['leisures']. "</dt>\n";
echo "<dd>". stripslashes($form_profile_leisures). "</dd>\n";
echo "<dt>". $GLOBALS['lang']['user']['job']. "</dt>\n";
echo "<dt>". $GLOBALS['lang']['user']['avatar']. "</dt>\n";
echo "<dt>". $GLOBALS['lang']['user']['quotation']. "</dt>\n";
echo "<dd>". stripslashes($form_profile_quotation). "</dd>\n";
echo "<dt>". $GLOBALS['lang']['user']['signature']. "</dt>\n";
echo "<dd>". stripslashes($form_profile_signature). "</dd>\n";
<form id="moduser" action=" <?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">
<input name="id" type="hidden" value=" <?php echo $id; ?>" id="id" />
<input name="rub" type="hidden" value=" <?php echo $rub; ?>" id="rub" />
<input name="todo" type="hidden" value=" <?php echo $todo; ?>" id="todo" />
<input name="current_email" type="hidden" value=" <?php echo $current_email; ?>" id="current_email" />
<input name="table_right" type="hidden" value=" <?php echo $table_right; ?>" id="table_right" />
<input name="table_profile" type="hidden" value=" <?php echo $table_profile; ?>" id="table_profile" />
<input name="retour" type="button" value=" <?php echo $GLOBALS['lang']['btn']['preview'] ?>" class="button" id="retour" onclick="history.go(-1);" />
<input name="enregistrer" type="submit" value=" <?php echo $GLOBALS['lang']['btn']['save'] ?>" class="button" id="valider" />
<?php include_once($dir. "/help.php"); ?>
|