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

Source for file display.php

Documentation is available at display.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. include_once(themePath('../user/'.SQL.'.inc.php'));
  12.  
  13. if(!function_exists('DisplayInfoUser')) {
  14.  
  15.   function DisplayInfoUser($user_id{
  16.  
  17.     $data=$GLOBALS['sql_object'-> DBSelect(SQL_getAllUserInfo($user_id));
  18.  
  19.     $content '';
  20.     if(count($data)!=1return false;
  21.     else
  22.     {
  23.       // Récupération infos groupes de travail
  24.       include_once('../class/class.user.php');
  25.       $user_objectnew user;
  26.       $r=$user_object->GetUserWorkshops($user_id$GLOBALS['sql_object']);
  27.       $default_wgarray();
  28.       foreach($r as $value{
  29.         array_push($default_wg$value['jwu_workshop_id']);
  30.       }
  31.       $user_workgroups '';
  32.       if(!empty($default_wg)) {
  33.         $q=SQL_Get_WorkshopsDenomination($default_wg);
  34.         $workgroups=$GLOBALS['sql_object']->DBSelect($q);
  35.         $user_workgroups .= '<ul>';
  36.         foreach($workgroups as $wg{
  37.           $link array('rub'=> $GLOBALS['links'][U_L]['workgroup']['linkvalue']'id' => $wg['workshop_id']'name' => $wg['workshop_denomination']);
  38.           $user_workgroups .= '<li><a href="'.HrefMaker($link).'" title="'._t('name','workshop_module').' : '.formatText($wg['workshop_denomination']'2ATT').'">'.formatText($wg['workshop_denomination']'2HTML').'</a></li>'.END_LINE;
  39.         }
  40.         $user_workgroups .= '</ul>';
  41.       else $user_workgroups .= _t('divers''none');
  42.  
  43.       // formattage des données
  44.       $user_login=formatText($data[0]['user_login']'2HTML');
  45.       $user_public_email=$data[0]['profile_email_display'];
  46.       $user_email=$data[0]['profile_email'];
  47.       $user_email=formatText('<a href="mailto:'.$user_email.'">'.$user_email.'</a>''2HTML');
  48.       $user_groupe=formatText($data[0]['catus_name']'2HTML');
  49.  
  50.       $user_profile_firstname=formatText(empty_nc($data[0]['profile_firstname'])'2HTML');
  51.       $user_profile_lastname=formatText(empty_nc($data[0]['profile_lastname'])'2HTML');
  52.       $user_profile_city=formatText(empty_nc($data[0]['profile_city'])'2HTML');
  53.       $user_profile_birthdate=formatText(empty_nc($data[0]['profile_birthdate'])'2HTML');
  54.       $user_profile_leisures=formatText(empty_nc($data[0]['profile_leisures'])'2HTML');
  55.       $user_profile_job=formatText(empty_nc($data[0]['profile_job'])'2HTML');
  56.       $user_profile_quotation=formatText(empty_nc($data[0]['profile_quotation'])'2HTML');
  57.       $user_profile_signature=formatText(empty_nc($data[0]['profile_signature'])'2HTML');
  58.  
  59.       if(!empty($data[0]['profile_avatar'])) {
  60.         list($complete_uri)=GetAllPhotoUri('../'.$data[0]['profile_avatar']);
  61.         $user_profile_avatar='<img src="'.$complete_uri.'" alt="'._t('user','avatar').' '.$user_login.'" />';
  62.       else $user_profile_avatar=_t('divers','none');
  63.  
  64.       $profile_last_modify_display=$data[0]['profile_last_modify_display'];
  65.       $profile_date_crea_display=$data[0]['profile_date_crea_display'];
  66.  
  67.       $content.='<h1>'._t('user','profile').' '.$user_login.'</h1>'.END_LINE;
  68.       $content.='<div class="sub-title">';
  69.       $content.=_t('user','h1_public_comment');
  70.       $content.='</div>';
  71.       $content.=GetLinkModifyUserInfo($user_id);
  72.       $content.='<div>'.END_LINE;
  73.       $content.='<dl>'.END_LINE;
  74.       $content.='<dt>'._t('user','type').'</dt>'.END_LINE;
  75.       $content.='<dd>'.$user_groupe.'</dd>'.END_LINE;
  76.       $content.='<dt>'ucfirst(_t('user','email'))'</dt>'.END_LINE;
  77.       if($user_public_email=='Y')    $content.='<dd>'.$user_email.'</dd>'.END_LINE;
  78.       else $content.='<dd>'._t('statut','draftpdf').'</dd>'.END_LINE;
  79.       $content.='<dt>'.ucfirst(_t('user','first_name')).'</dt>'.END_LINE;
  80.       $content.='<dd>'$user_profile_firstname.'</dd>'.END_LINE;
  81.       $content.='<dt>'.ucfirst(_t('user','last_name')).'</dt>'.END_LINE;
  82.       $content.='<dd>'$user_profile_lastname.'</dd>'.END_LINE;
  83.       $content.='<dt>'._t('user','birthdate').'</dt>'.END_LINE;
  84.       $content.='<dd>'$user_profile_birthdate.'</dd>'.END_LINE;
  85.       $content.='<dt>'._t('user','city').'</dt>'.END_LINE;
  86.       $content.='<dd>'$user_profile_city.'</dd>'.END_LINE;
  87.       $content.='<dt>'._t('user','leisures').'</dt>'.END_LINE;
  88.       $content.='<dd>'$user_profile_leisures.'</dd>'.END_LINE;
  89.       $content.='<dt>'._t('user','job').'</dt>'.END_LINE;
  90.       $content.='<dd>'$user_profile_job.'</dd>'.END_LINE;
  91.       $content.='<dt>'._t('user','avatar').'</dt>'.END_LINE;
  92.       $content.='<dd>'$user_profile_avatar.'</dd>'.END_LINE;
  93.       $content.='<dt>'._t('user','quotation').'</dt>'.END_LINE;
  94.       $content.='<dd>'$user_profile_quotation.'</dd>'.END_LINE;
  95.       $content.='<dt>'._t('user','signature').'</dt>'.END_LINE;
  96.       $content.='<dd>'$user_profile_signature.'</dd>'.END_LINE;
  97.       $content.='<dt>'._t('groups','his').'</dt>'.END_LINE;
  98.       $content.='<dd>'$user_workgroups.'</dd>'.END_LINE;
  99.       $content.='<dt>'.ucfirst(_t('divers','last_modify')).'</dt>'.END_LINE;
  100.       $content.='<dd>'$profile_last_modify_display.'</dd>'.END_LINE;
  101.       $content.='<dt>'.ucfirst(_t('divers','date_crea')).'</dt>'.END_LINE;
  102.       $content.='<dd>'$profile_date_crea_display.'</dd>'.END_LINE;
  103.       $content.='</dl>'.END_LINE;
  104.       $content.='</div>'.END_LINE;
  105.  
  106.  
  107.     }
  108.     echo $content;
  109.   }
  110. }
  111.  
  112. if(!function_exists('DisplayFormProfileUser')) {
  113.  
  114.   function DisplayFormProfileUser($user_id$submitted=-1{
  115.  
  116.     $data=$GLOBALS['sql_object'-> DBSelect(SQL_getAllUserInfo($user_id));
  117.     $content '';
  118.     $mask_display_mail_1='';
  119.     $mask_display_mail_2='';
  120.  
  121.     // en modification simple
  122.     if($submitted==-1{
  123.       if(count($data)!=1return false;
  124.       else
  125.       {
  126.         // formattage des données
  127.         $form_login=formatText($data[0]['user_login']'2FIELD');
  128.         $form_public_email=$data[0]['profile_email_display'];
  129.         $form_email=formatText($data[0]['profile_email']'2FIELD');
  130.         $current_email=formatText($data[0]['profile_email']'2FIELD');
  131.         $form_groupe=formatText($data[0]['catus_name']'2FIELD');
  132.         $current_avatar=$data[0]['profile_avatar'];
  133.          
  134.         if($form_public_email=='Y'$mask_display_mail_1=' checked="checked"';
  135.         else $mask_display_mail_2=' checked="checked"';
  136.         $form_profile_firstname=formatText($data[0]['profile_firstname']'2FIELD');
  137.         $form_profile_lastname=formatText($data[0]['profile_lastname']'2FIELD');
  138.         $form_profile_city=formatText($data[0]['profile_city']'2FIELD');
  139.         $form_profile_birthdate isNullDate($data[0]['profile_birthdate']'--' formatDate($data[0]['profile_birthdate']true);
  140.         list($form_date_y$form_date_m$form_date_d)=explode('-'$form_profile_birthdate);
  141.         $form_profile_leisures=formatText($data[0]['profile_leisures']'2FIELD');
  142.         $form_profile_job=formatText($data[0]['profile_job']'2FIELD');
  143.         $form_profile_quotation=formatText($data[0]['profile_quotation']'2FIELD');
  144.         $form_profile_signature=formatText($data[0]['profile_signature']'2FIELD');
  145.  
  146.         if(!empty($data[0]['profile_avatar'])) {
  147.           list($complete_uri)=GetAllPhotoUri('../'.$data[0]['profile_avatar']);
  148.           $user_profile_avatar='<img src="'.$complete_uri.'" alt="'._t('user','avatar').' '.$_COOKIE['linea21']['login'].'" />';
  149.         else $user_profile_avatar=_t('divers','none');
  150.          
  151.         $profile_last_modify_display=$data[0]['profile_last_modify_display'];
  152.         $profile_date_crea_display=$data[0]['profile_date_crea_display'];
  153.       }
  154.  
  155.       // un submit à déjà été fait, on affiche les infos entrées par l'utilisateur
  156.     else {
  157.       $form_email=$_REQUEST['email'];
  158.       $current_email=$_REQUEST['current_email'];
  159.       $current_avatar=base64_decode($_REQUEST['current_avatar']);
  160.  
  161.       if(!empty($current_avatar)) {
  162.         list($complete_uri)=GetAllPhotoUri('../'.$current_avatar);
  163.         $user_profile_avatar='<img src="'.$complete_uri.'" alt="'._t('user','avatar').' '.$_COOKIE['linea21']['login'].'" />';
  164.       else $user_profile_avatar=_t('divers','none');
  165.        
  166.       if($_REQUEST['email_display']=='Y'$mask_display_mail_1=' checked="checked"';
  167.       else $mask_display_mail_2=' checked="checked"';
  168.       $form_profile_firstname=$_REQUEST['firstname'];
  169.       $form_profile_lastname=$_REQUEST['lastname'];
  170.       $form_date_d=$_REQUEST['date_d'];
  171.       $form_date_m=$_REQUEST['date_m'];
  172.       $form_date_y=$_REQUEST['date_y'];
  173.       $form_profile_city=$_REQUEST['city'];
  174.       $form_profile_leisures=$_REQUEST['leisures'];
  175.       $form_profile_job=$_REQUEST['job'];
  176.       $form_profile_quotation=$_REQUEST['quotation'];
  177.       $form_profile_signature=$_REQUEST['signature'];
  178.     }
  179.  
  180.     $content.='<form action="index.php" method="post" enctype="multipart/form-data">'.END_LINE;
  181.     $content.='<div>'.END_LINE;
  182.     $content.='<table class="modifyuser" summary="'._t('user','p_mod_table_summary').'">'.END_LINE;
  183.     $content.='<tr>'.END_LINE;
  184.     $content.='<td>'.END_LINE;
  185.     $content.='<label for="email" class="labelised">'._t('user','email').' : </label>'.END_LINE;
  186.     $content.='</td>'.END_LINE;
  187.     $content.='<td>'.END_LINE;
  188.     $content.='<input name="email" type="text" class="textfield" id="email" maxlength="200" value="'.$form_email.'" />'.END_LINE;
  189.     $content.='<br />';
  190.     $content.='<div class="advertise">'.END_LINE;
  191.     $content.=_t('user','info_mail').END_LINE;
  192.     $content.='</div>'.END_LINE;
  193.     $content.='</td>'.END_LINE;
  194.     $content.='</tr>'.END_LINE;
  195.  
  196.     $content.='<tr>'.END_LINE;
  197.     $content.='<td>'.END_LINE;
  198.     $content.='<label for="email_display_Y" class="labelised">'._t('user','email_display').' : </label>'.END_LINE;
  199.     $content.='</td>'.END_LINE;
  200.     $content.='<td>'.END_LINE;
  201.     $content.='<input type="radio" id="email_display_Y" class="radio" name="email_display" value="Y"'.$mask_display_mail_1.' /><span class="radio">'._t('divers','yes').'</span>'.END_LINE;
  202.     $content.='<input type="radio" id="email_display_N" class="radio" name="email_display" value="N"'.$mask_display_mail_2.' /><span class="radio">'._t('divers','no').'</span>'.END_LINE;
  203.     $content.='</td>'.END_LINE;
  204.     $content.='</tr>'.END_LINE;
  205.     $content.='<tr>'.END_LINE;
  206.     $content.='<td>'.END_LINE;
  207.     $content.='<label for="firstname" class="labelised">'.ucfirst(_t('user','first_name')).' : </label>'.END_LINE;
  208.     $content.='</td>'.END_LINE;
  209.     $content.='<td>'.END_LINE;
  210.     $content.='<input name="firstname" type="text" class="textfield" id="firstname" maxlength="200" value="'.$form_profile_firstname.'" />'.END_LINE;
  211.     $content.='</td>'.END_LINE;
  212.     $content.='</tr>'.END_LINE;
  213.     $content.='<tr>'.END_LINE;
  214.     $content.='<td>'.END_LINE;
  215.     $content.='<label for="lastname" class="labelised">'.ucfirst(_t('user','last_name')).' : </label>'.END_LINE;
  216.     $content.='</td>'.END_LINE;
  217.     $content.='<td>'.END_LINE;
  218.     $content.='<input name="lastname" type="text" class="textfield" id="lastname" maxlength="200" value="'.$form_profile_lastname.'" />'.END_LINE;
  219.     $content.='</td>'.END_LINE;
  220.     $content.='</tr>'.END_LINE;
  221.     $content.='<tr>'.END_LINE;
  222.     $content.='<td>'.END_LINE;
  223.     $content.='<label for="date_d" class="labelised">'._t('user','birthdate').' : </label>'.END_LINE;
  224.     $content.='</td>'.END_LINE;
  225.     $content.='<td>'.END_LINE;
  226.     $content.= sprintf(input_date($form_date_y$form_date_m$form_date_d));
  227.     $content.='</td>'.END_LINE;
  228.     $content.='</tr>'.END_LINE;
  229.     $content.='<tr>'.END_LINE;
  230.     $content.='<td>'.END_LINE;
  231.     $content.='<label for="city" class="labelised">'._t('user','city').' : </label>'.END_LINE;
  232.     $content.='</td>'.END_LINE;
  233.     $content.='<td>'.END_LINE;
  234.     $content.='<input name="city" type="text" class="textfield" id="city" maxlength="100" value="'.$form_profile_city.'" />'.END_LINE;
  235.     $content.='</td>'.END_LINE;
  236.     $content.='</tr>'.END_LINE;
  237.     $content.='<tr>'.END_LINE;
  238.     $content.='<td>'.END_LINE;
  239.     $content.='<label for="leisures" class="labelised">'._t('user','leisures').' :</label>'.END_LINE;
  240.     $content.='</td>'.END_LINE;
  241.     $content.='<td>'.END_LINE;
  242.     $content.='<input name="leisures" type="text" class="textfield" id="leisures" maxlength="150" value="'.$form_profile_leisures.'" />'.END_LINE;
  243.     $content.='</td>'.END_LINE;
  244.     $content.='</tr>'.END_LINE;
  245.     $content.='<tr>'.END_LINE;
  246.     $content.='<td>'.END_LINE;
  247.     $content.='<label for="job" class="labelised">'._t('user','job').' :</label>'.END_LINE;
  248.     $content.='</td>'.END_LINE;
  249.     $content.='<td>'.END_LINE;
  250.     $content.='<input name="job" type="text" class="textfield" id="job" maxlength="150" value="'.$form_profile_job.'" />'.END_LINE;
  251.     $content.='</td>'.END_LINE;
  252.     $content.='</tr>'.END_LINE;
  253.  
  254.     $content.='<tr>'.END_LINE;
  255.     $content.='<td>'.END_LINE;
  256.     $content.='<span class="labelmargin labelised">' _t('user','current_avatar').' : '.'</span>'.END_LINE;
  257.     $content.='</td>'.END_LINE;
  258.     $content.='<td>'.END_LINE;
  259.     $content.=$user_profile_avatar.END_LINE;
  260.     $content.='</td>'.END_LINE;
  261.     $content.='</tr>'.END_LINE;
  262.  
  263.     $content.='<tr>'.END_LINE;
  264.     $content.='<td>'.END_LINE;
  265.     $content.='<label for="avatar" class="labelised">'._t('user','avatar').' :</label>'.END_LINE;
  266.     $content.='</td>'.END_LINE;
  267.     $content.='<td>'.END_LINE;
  268.     $content.='<input name="avatar" type="file" size="47" id="avatar" class="textfield" />'.END_LINE;
  269.     $content.='</td>'.END_LINE;
  270.     $content.='</tr>'.END_LINE;
  271.  
  272.     $content.='<tr>'.END_LINE;
  273.     $content.='<td>'.END_LINE;
  274.     $content.='<label for="quotation" class="labelised">'._t('user','quotation').' :</label>'.END_LINE;
  275.     $content.='</td>'.END_LINE;
  276.     $content.='<td>'.END_LINE;
  277.     $content.='<input name="quotation" type="text" class="textfield" id="quotation" maxlength="150" value="'.$form_profile_quotation.'" />'.END_LINE;
  278.     $content.='</td>'.END_LINE;
  279.     $content.='</tr>'.END_LINE;
  280.     $content.='<tr>'.END_LINE;
  281.     $content.='<td>'.END_LINE;
  282.     $content.='<label for="signature" class="labelised">'._t('user','signature').' :</label>'.END_LINE;
  283.     $content.='</td>'.END_LINE;
  284.     $content.='<td>'.END_LINE;
  285.     $content.='<input name="signature" type="text" class="textfield" id="signature" maxlength="200" value="'.$form_profile_signature.'" />'.END_LINE;
  286.     $content.='</td>'.END_LINE;
  287.     $content.='</tr>'.END_LINE;
  288.     $content.='</table>'.END_LINE;
  289.  
  290.     $content.='<hr />'.END_LINE;
  291.     $content.='<div class="advertise">'.END_LINE;
  292.     $content.=_t('user','info_password').END_LINE;
  293.     $content.='</div>'.END_LINE;
  294.     $content.='<table class="modifyuser" summary="">'.END_LINE;
  295.     $content.='<tr>'.END_LINE;
  296.     $content.='<td>'.END_LINE;
  297.     $content.='<label for="password" class="labelised">'._t('user','p_new_password').' : </label>'.END_LINE;
  298.     $content.='</td>'.END_LINE;
  299.     $content.='<td>'.END_LINE;
  300.     $content.='<input name="password" type="password" class="textfield" id="password" maxlength="20" value="" />'.END_LINE;
  301.     $content.='</td>'.END_LINE;
  302.     $content.='</tr>'.END_LINE;
  303.     $content.='<tr>'.END_LINE;
  304.     $content.='<td>'.END_LINE;
  305.     $content.='<label for="password2" class="labelised">'._t('user','p_new_password_confirm').' : </label>'.END_LINE;
  306.     $content.='</td>'.END_LINE;
  307.     $content.='<td>'.END_LINE;
  308.     $content.='<input name="password2" type="password" class="textfield" id="password2" maxlength="20" value="" />'.END_LINE;
  309.     $content.='</td>'.END_LINE;
  310.     $content.='</tr>'.END_LINE;
  311.     $content.='</table>'.END_LINE;
  312.  
  313.     $content.='</div>'.END_LINE;
  314.     $content.='<input name="current_email" type="hidden" value="'.$current_email.'" id="current_email" />'.END_LINE;
  315.     $content.='<input name="current_avatar" type="hidden" value="'.base64_encode($current_avatar).'" id="current_avatar" />'.END_LINE;
  316.     $content.='<input name="id" type="hidden" value="'.$user_id.'" id="id" />'.END_LINE;
  317.     $content.='<input name="rub" type="hidden" id="rub" value="'.$GLOBALS['links'][U_L]['user-prefs']['linkvalue'].'" />'.END_LINE;
  318.     $content.='<input type="submit" class="submitbut" value="'._t('btn','valid').'" title="'._t('btn','valid').'" name="modprofile" id="modprofile" />'.END_LINE;
  319.     $content.='</form>'.END_LINE;
  320.  
  321.     echo $content;
  322.   }
  323. }
  324.  
  325. if(!function_exists('ModifyProfile')) {
  326.  
  327.   function ModifyProfile({
  328.  
  329.     $link_homearray('rub'=> $GLOBALS['links'][U_L]['home']['linkvalue']);
  330.  
  331.     $id=$_COOKIE['linea21']['id'];
  332.     $integrity=1;
  333.     $table_user[0]''// valeur login --> Non checké
  334.     $table_user[1=$_REQUEST['email'];
  335.     $table_profile[0$_REQUEST['email'];
  336.     $table_profile[1$_REQUEST['email_display'];
  337.     $table_profile[2$_REQUEST['city'];
  338.     $form_date_d trim($_REQUEST['date_d']);
  339.     $form_date_m trim($_REQUEST['date_m']);
  340.     $form_date_y trim($_REQUEST['date_y']);
  341.     $form_date=$form_date_d '-' $form_date_m '-' $form_date_y;
  342.  
  343.     if(!empty($form_date_d&& !empty($form_date_m&& !empty($form_date_y)) {
  344.       $date_integrity=checkdate_validity($form_date);
  345.     else {
  346.       $date_integrity=true;
  347.     }
  348.     if(is_string($date_integrity)) $integrity $date_integrity;
  349.     else {
  350.       $table_profile[3]$form_date;
  351.     }
  352.  
  353.     $table_profile[4$_REQUEST['leisures'];
  354.     $table_profile[5$_REQUEST['job'];
  355.     $table_profile[6$_REQUEST['quotation'];
  356.     $table_profile[7$_REQUEST['signature'];
  357.     $table_profile[8$_REQUEST['firstname'];
  358.     $table_profile[9$_REQUEST['lastname'];
  359.     $table_profile[10base64_decode($_REQUEST['current_avatar']);
  360.  
  361.  
  362.     include_once('../class/class.user.php');
  363.     $user_objectnew user;
  364.     $data_user_integrity=$user_object->CheckDataIntegrity($table_user);
  365.     if(is_string($data_user_integrity)) $integrity=$data_user_integrity;
  366.  
  367.     if(!empty($_REQUEST['password'])) {
  368.       $integrity=$user_object->checkPasswordValidity($_REQUEST['password']$_REQUEST['password2']);
  369.     }
  370.     if(!is_string($integrity)) {
  371.       if(isset($_FILES['avatar']&& $_FILES['avatar']['name']!=''{
  372.         include_once('../class/system/class.upload.php');
  373.         $upload_objectnew upload;
  374.         $upload=$_FILES['avatar'];
  375.         $size_integrity=$upload_object->CheckMaxFile($upload['size']$user_object->UPLOAD_MAX_MO);
  376.         if(is_string($size_integrity)) $integrity=$size_integrity;
  377.         $format_integrity=$upload_object->CheckExtImage($upload['name']);
  378.         if(is_string($format_integrity)) $integrity=$format_integrity;
  379.         if(!is_string($integrity)) {
  380.           $final_name=$id.".".$upload_object->GetExtension($upload ['name']);
  381.           $table_profile[10]=$user_object->URI_INPUT.$final_name;
  382.  
  383.           $destination="../".$user_object->URI_INPUT;
  384.           $result_upload=$upload_object->UploadFile($upload$final_name$destination);
  385.         }
  386.       }
  387.     }
  388.  
  389.  
  390.     if(!is_string($integrity)) {
  391.       $result=$user_object->ModifyProfile($id$table_profile$GLOBALS['sql_object']);
  392.  
  393.       if($result == true{
  394.         $string =_t('user','p_confirm_mod').'.';
  395.         $string.=' <a href="'.HrefMaker($link_home).'" title="'._t('user','p_confirm_back').'" >'._t('user','p_confirm_back').'</a>';
  396.         $integrity array('code'=> 'confirm''string' => $string);
  397.       }
  398.       if(($_REQUEST['email']!=$_REQUEST['current_email']|| !empty($_REQUEST['password'])) {
  399.         if($_REQUEST['email']!=$_REQUEST['current_email']{
  400.           $new_pass=$user_object->GetNewPassword();
  401.           $todo_mail='change_mail';     // choix template pour mail
  402.           $new_email=$_REQUEST['email'];     // renseignement nouvel email
  403.           $user_login=$_COOKIE['linea21']['login']// retrieve login
  404.         }
  405.         if(!empty($_REQUEST['password'])) {
  406.           $new_pass=$_REQUEST['password'];
  407.           $todo_mail='change_pass';     // choix template pour mail
  408.           $user_email=$_REQUEST['email'];        // renseignement email
  409.           $user_login=$_COOKIE['linea21']['login']// retrieve login
  410.         }
  411.         $user_object->UpdateUserPassword($id$new_pass$GLOBALS['sql_object']);
  412.         UpdateCookiePassword(crypt($new_passSALT_CRYPT));
  413.          
  414.         /** include envoi de mail */
  415.         include_once(themePath('../user/mail_actions.php'));
  416.         include_once('../mail/template.php');
  417.       }
  418.     else {
  419.       $integrity array('code'=> 'error''string' => $integrity);
  420.     }
  421.  
  422.     $return_result ='<div class="'.$integrity['code'].'">'.END_LINE;
  423.     $return_result.=$integrity['string'].END_LINE;
  424.     $return_result.='</div>'.END_LINE;
  425.  
  426.     echo $return_result;
  427.     if(!isset($result)) return DisplayFormProfileUser($_COOKIE['linea21']['id']1);
  428.   }
  429. }
  430.  
  431. if(!function_exists('ChangeNotifySettings')) {
  432.  
  433.   function ChangeNotifySettings($user_id{
  434.      
  435.     include_once('../class/class.user.php');
  436.     $user_objectnew user;
  437.      
  438.     $allgroups array();
  439.     $checked array();
  440.     $disabled array();
  441.      
  442.     // get workgroups
  443.     $data=$GLOBALS['sql_object'-> DBSelect(SQL_getUserWorkgroups($user_id));
  444.     if($data == 0return false;
  445.      
  446.     foreach($data as $el{
  447.       array_push($allgroups'topic-'.$el['id']);
  448.       array_push($allgroups'post-'.$el['id']);
  449.       array_push($allgroups'file-'.$el['id']);
  450.     }
  451.  
  452.     if(isset($_POST['topic'])) {
  453.       foreach($_POST['topic'as $el{
  454.         array_push($checked'topic-'.$el);
  455.       }
  456.     }
  457.     if(isset($_POST['post'])) {
  458.       foreach($_POST['post'as $el{
  459.         array_push($checked'post-'.$el);
  460.       }
  461.     }
  462.     if(isset($_POST['file'])) {
  463.       foreach($_POST['file'as $el{
  464.         array_push($checked'file-'.$el);
  465.       }
  466.     }
  467.     if(isset($_POST['disabledfields'])) {
  468.       $disabled unserialize(rawurldecode($_POST['disabledfields']));
  469.     }
  470.  
  471.     $checked array_merge($disabled$checked);
  472.      
  473.     // diff between all groups and checked boxes
  474.     $exceptions array_diff($allgroups$checked);
  475.     $r $user_object->changeWorkshopsNotification($user_id$exceptions$GLOBALS['sql_object']);
  476.      
  477.     $str ='<div class="confirm">'.END_LINE;
  478.     $str.=_t('user','notify_changes_success').END_LINE;
  479.     $str.='</div>'.END_LINE;
  480.     echo $str;
  481.   }
  482. }
  483.  
  484.  
  485. if(!function_exists('GetLinkModifyUserInfo')) {
  486.  
  487.   function GetLinkModifyUserInfo($user_id{
  488.  
  489.     $content ='';
  490.     if(isset($_COOKIE['linea21']['whois']&& $user_id==$_COOKIE['linea21']['id']{
  491.       $link_editarray('rub'=> $GLOBALS['links'][U_L]['user-prefs']['linkvalue']);
  492.  
  493.       $content.='<div id="editprofile">'.END_LINE;
  494.       $content.='<a class="button buttonmargin" href="'.HrefMaker($link_edit).'" title="'._t('user','p_mod').'">'._t('user','p_mod').'</a>';
  495.       $content.='</div>'.END_LINE;
  496.     }
  497.     return $content;
  498.   }
  499. }
  500.  
  501. if(!function_exists('DisplayAuthTextInfo')) {
  502.  
  503.   function DisplayAuthTextInfo({
  504.     $link_accountarray('rub'=> $GLOBALS['links'][U_L]['user-registration']['linkvalue']);
  505.     $content ='<div class="info">'.END_LINE;
  506.     $content.=_t('user','info_inscription').END_LINE;
  507.     $content.='<a href="'.HrefMaker($link_account).'">'._t('user','info_inscription2').' </a>'.END_LINE;
  508.     $content.='.<br />'._t('user','info_inscription3').''.END_LINE;
  509.     $content.='</div>'.END_LINE;
  510.     echo $content;
  511.   }
  512. }
  513.  
  514. if(!function_exists('DisplaySubscribeTextInfo')) {
  515.  
  516.   function DisplaySubscribeTextInfo({
  517.     $content ='<div class="info">'.END_LINE;
  518.     $content.=_t('user','info_inscription5').END_LINE;
  519.     $content.='</div>';
  520.     echo $content;
  521.   }
  522. }
  523.  
  524. if(!function_exists('DisplayWorkgroupsSettings')) {
  525.  
  526.   function DisplayWorkgroupsSettings($user_id{
  527.     $content ='<h2>'._t('user','my_workgroups').'</h2>'.END_LINE;
  528.     $content.='<div class="personnalsettings">'.END_LINE;
  529.     $content.='<p>'._t('user','workgroups_notification').'</p>'.END_LINE;
  530.     $content.=getWorkgroupsNotificationTable($user_id);
  531.     $content.='</div>';
  532.     
  533.     echo $content;
  534.   }
  535. }
  536.  
  537. if(!function_exists('getWorkgroupsNotificationTable')) {
  538.  
  539.   function getWorkgroupsNotificationTable($user_id{
  540.     
  541.     $exceptions array();
  542.     $disabled_fields array();
  543.     
  544.     // get workgroups
  545.     $data=$GLOBALS['sql_object'-> DBSelect(SQL_getUserWorkgroups($user_id));
  546.      
  547.     // get notification exceptions
  548.     $exc=$GLOBALS['sql_object'-> DBSelect(SQL_getUserNotifyExceptionsSettings($user_id));
  549.      
  550.    
  551.     if($exc!=0{
  552.       foreach($exc as $el{
  553.         array_push($exceptions$el['exception']);
  554.       }
  555.     }
  556.     // default mask
  557.     $dmask='checked="checked"';
  558.      
  559.     if($data==0return false;
  560.     
  561.     // general config
  562.     if(ALERT_NEWTOPIC==2{
  563.         $is_topicDisabled='';
  564.     else {
  565.         $is_topicDisabled=' disabled="disabled"';
  566.     }
  567.     if(ALERT_NEWPOST==2{
  568.         $is_postDisabled='';
  569.     else {
  570.         $is_postDisabled=' disabled="disabled"';
  571.     }
  572.     if(ALERT_NEWFILE==2{
  573.       $is_fileDisabled='';
  574.     else {
  575.       $is_fileDisabled=' disabled="disabled"';
  576.     }
  577.     
  578.  
  579.     $content  ='<form action="index.php" method="post">'.END_LINE;
  580.     $content .= "<table>";
  581.     $content .= "<thead>";
  582.     $content .= "<tr>";
  583.     $content .= "<td>"._t('user','workgroups_label')."</td>";
  584.     $content .= "<td class=\"center\">".str_replace(' - ''<br />'_t('user','notify_topic'))."</td>";
  585.     $content .= "<td class=\"center\">".str_replace(' - ''<br />',_t('user','notify_post'))."</td>";
  586.     $content .= "<td class=\"center\">".str_replace(' - ''<br />',_t('user','notify_file'))."</td>";
  587.     $content .= "</tr>";
  588.     $content  .= "</thead>";
  589.     $content  .= "<tbody>";
  590.     foreach($data as $el{
  591.        
  592.       if(in_array('topic-'.$el['id']$exceptions)) {
  593.         $topic_mask '';
  594.         $topic_on_class='';
  595.         $topic_off_class=' selected';
  596.       else {
  597.         $topic_mask $dmask;
  598.         $topic_on_class=' selected';
  599.         $topic_off_class='';
  600.         // we handle disabled fields because they are not sent to server !!!
  601.         if(ALERT_NEWTOPIC!=2array_push($disabled_fields'topic-'.$el['id']);
  602.       }
  603.       if(in_array('post-'.$el['id']$exceptions)) {
  604.         $post_mask '';
  605.         $post_on_class='';
  606.         $post_off_class=' selected';
  607.       else {
  608.         $post_mask $dmask;
  609.         $post_on_class=' selected';
  610.         $post_off_class='';
  611.         // we handle disabled fields because they are not sent to server !!!
  612.         if(ALERT_NEWPOST!=2array_push($disabled_fields'post-'.$el['id']);
  613.       }
  614.       if(in_array('file-'.$el['id']$exceptions) ) {
  615.         $file_mask '';
  616.         $file_on_class='';
  617.         $file_off_class=' selected';
  618.       else {
  619.         $file_mask $dmask;
  620.         $file_on_class=' selected';
  621.         $file_off_class='';
  622.         // we handle disabled fields because they are not sent to server !!!
  623.         if(ALERT_NEWFILE!=2array_push($disabled_fields'file-'.$el['id']);
  624.       }
  625.       
  626.       $content .= "<tr>";
  627.       $content .= "<td>".$el['name']."</td>";
  628.       $content .= "<td class=\"center\"><p class=\"switch\"><label class=\"cb-enable".$topic_on_class."\"><span>"._t('divers''yes')."</span></label><label class=\"cb-disable".$topic_off_class."\"><span>"._t('divers''no')."</span></label><input".$is_topicDisabled." type=\"checkbox\" ".$topic_mask." value=\"".$el['id']."\" id=\"topic-".$el['id']."\" name=\"topic[]\" /></p></td>";
  629.       $content .= "<td class=\"center\"><p class=\"switch\"><label class=\"cb-enable".$post_on_class."\"><span>"._t('divers''yes')."</span></label><label class=\"cb-disable".$post_off_class."\"><span>"._t('divers''no')."</span></label><input".$is_postDisabled." type=\"checkbox\" ".$post_mask." value=\"".$el['id']."\" id=\"post-".$el['id']."\" name=\"post[]\" /></p></td>";
  630.       $content .= "<td class=\"center\"><p class=\"switch\"><label class=\"cb-enable".$file_on_class."\"><span>"._t('divers''yes')."</span></label><label class=\"cb-disable".$file_off_class."\"><span>"._t('divers''no')."</span></label><input".$is_fileDisabled." type=\"checkbox\" ".$file_mask." value=\"".$el['id']."\" id=\"file-".$el['id']."\" name=\"file[]\" /></p></td>";
  631.       $content .= "</tr>";
  632.     }
  633.     $content .= "</tbody>";
  634.     $content .= "</table>";
  635.     $content .='<input type="hidden" name="disabledfields" id="disabledfields" value="'.rawurlencode(serialize($disabled_fields)).'" />'.END_LINE;
  636.     $content .='<input type="hidden" name="rub" id="rub2" value="'.$GLOBALS['links'][U_L]['user-prefs']['linkvalue'].'" />'.END_LINE;
  637.     $content .='<input type="submit" class="submitbut" value="'._t('btn','valid').'" title="'._t('btn','valid').'" name="notifyUpdate" id="notifyUpdate" />'.END_LINE;
  638.     $content .= "</form>";
  639.  
  640.     //Iphone style button
  641.     /**
  642.     $content .="<script type=\"text/javascript\">
  643.                 $(document).ready( function(){
  644.                     $('.switch').parent('td').css('padding-left', '4em');
  645.                     $('.switch input').css('display', 'none');
  646.                     $('.cb-enable').click(function(){
  647.                         var parent = $(this).parents('.switch');
  648.                         if($(':checkbox',parent).attr('disabled') != true) {
  649.                             $('.cb-disable',parent).removeClass('selected');
  650.                             $(this).addClass('selected');
  651.                             $(':checkbox',parent).attr('checked', true);
  652.                         }
  653.                     });
  654.                     $('.cb-disable').click(function(){
  655.                         var parent = $(this).parents('.switch');
  656.                         if($(':checkbox',parent).attr('disabled') != true) {
  657.                             $('.cb-enable',parent).removeClass('selected');
  658.                             $(this).addClass('selected');
  659.                             $(':checkbox',parent).attr('checked', false);
  660.                         }
  661.                     });
  662.                 });
  663.                 </script>";
  664.        */
  665.     
  666.  
  667.     return $content;
  668.   }
  669. }
  670. ?>

Documentation generated on Thu, 03 May 2012 15:03:55 +0200 by phpDocumentor 1.4.1