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

Source for file tpl_user.php

Documentation is available at tpl_user.php

  1. <?php
  2. /**
  3.  * @package linea21.core
  4.  * @subpackage public
  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. <?php
  12. include_once(themePath('../user/display.php'));
  13. include_once(themePath('../lib/input_helpers.php'));
  14.  
  15. //////////////////////////////////////////
  16. ///// déconnexion utilisateur authentifié
  17. //////////////////////////////////////////
  18.  
  19. if(ActiveItemKey($GLOBALS['activeitem']== 'logout'{
  20.   header("Location: ".$_SERVER['HTTP_REFERER']);
  21. }
  22.  
  23.  
  24. SetHTMLTitle(_t('user','section'))// set HTML title
  25.  
  26. //////////////////////////////////////////
  27. /////affichage formulaire Password
  28. //////////////////////////////////////////
  29.  
  30. if(ActiveItemKey($GLOBALS['activeitem']== 'forgot-password'{
  31.   setBreadcrumb(array(ucfirst(_t('user''forgot_pass')) => false));
  32.   SetHTMLTitle(ucfirst(_t('user''forgot_pass')))// set HTML title
  33.   echo '<h2>'.ucfirst(_t('user''forgot_pass')).'</h2>';
  34.  
  35.   if(isset($_REQUEST['token'])) {
  36.     $r=$GLOBALS['sql_object']->DBSelect(SQL_get_UserInfoPK($_REQUEST['token']));
  37.  
  38.     if($r != 0{
  39.       $user_email=$r[0]['profile_email'];
  40.       $user_login=$r[0]['user_login'];
  41.       $user_id=$r[0]['user_id'];
  42.  
  43.       include_once('../class/class.user.php');
  44.       $user new user;
  45.       $new_pass $user->GetNewPassword();
  46.       $res $user->UpdateUserPassword($user_id$new_pass$GLOBALS['sql_object']);
  47.       if($res{
  48.         $user->resetPasskey($user_id$GLOBALS['sql_object']);
  49.         $todo_mail='change_pass';
  50.         include_once(themePath('../user/mail_actions.php'));
  51.         include_once('../mail/template.php');
  52.         echo '<div class="info">'._t('user''new_password_confirmation').'</div>';
  53.       }
  54.     else {
  55.       ReloadIndex('public');
  56.     }
  57.   else {
  58.     echo forgotPass();
  59.   }
  60. }
  61.  
  62. //////////////////////////////////////////
  63. /////affichage profil utilisateur
  64. //////////////////////////////////////////
  65.  
  66. if(ActiveItemKey($GLOBALS['activeitem']== 'user-profile'{
  67.   setBreadcrumb(array(ucfirst(_t('user''profile')) => false));
  68.   /** préparation des variables
  69.    *     $id -> default -1
  70.    **/
  71.  
  72.   if(isset($_REQUEST['id'])) $id=$_REQUEST['id']else $id=-1;
  73.  
  74.   /** Détail d'un utilisateur
  75.    */
  76.   if(isset($_REQUEST['id'])) {
  77.     // set HTML Title
  78.     $result=$GLOBALS['sql_object']->DBSelect(SQL_getUserLogin($id));
  79.     SetHTMLTitle(formatText($result[0]['user_login']'2HTML'));
  80.     DisplayInfoUser($id);
  81.   }
  82. }
  83.  
  84. //////////////////////////////////////////
  85. /////affichage formulaire inscription utilisateur
  86. //////////////////////////////////////////
  87.  
  88. if(ActiveItemKey($GLOBALS['activeitem']== 'user-registration'{
  89.  
  90.  
  91.   if(isset($_POST['valid']|| isset($_POST['valid_x'])) {
  92.     $fired true;
  93.  
  94.     include_once('../class/class.user.php');
  95.     $user_objectnew user;
  96.  
  97.     $data_table_user[0$u_login $_POST['login'];
  98.     $data_table_user[1$u_mail $_POST['email'];
  99.     $data_table_user[2'N'// Affichage public de l'email (par défaut Non)
  100.     $data_table_user[3$_POST['firstname'];
  101.     $data_table_user[4$_POST['lastname'];
  102.     $data_table_user[5$u_password $user_object -> GetNewPassword();
  103.     $data_table_right=$user_object->InitUserRight('SIMPLE_USER');
  104.     $result=$user_object->CheckDataIntegrity($data_table_user$GLOBALS['sql_object']);
  105.  
  106.     if($result===true{
  107.       /** include envoi de mail */
  108.       $todo_mail='add_user';
  109.       include_once(themePath('../user/mail_actions.php'));
  110.       include_once(themePath('../mail/template.php'));
  111.  
  112.       /** end mail */
  113.  
  114.       $result=$user_object->AddUser($data_table_user$data_table_right$GLOBALS['sql_object']);
  115.       if(is_numeric($result)) $msg='<p class="confirm">'._t('user','confirm_public').'</p>'.END_LINE;
  116.     }
  117.  
  118.   }
  119.  
  120.   SetHTMLTitle(_t('divers','user_inscription'));
  121.   echo '<h1>'._t('divers','user_inscription').'</h1>'.END_LINE;
  122.   echo '<div class="sub-title">';
  123.   echo _t('user','h1_public_comment_insc');
  124.   echo '</div>';
  125.   if(isset($result&& !is_numeric($result)) {
  126.     echo '<p class="error">'.END_LINE;
  127.     echo $result.END_LINE;
  128.     echo '</p>'.END_LINE;
  129.   else {
  130.     if(isset($msg)) echo $msg;
  131.   }
  132.  
  133.   if(!isset($result|| (isset($result&& !is_numeric($result))) echo AuthForm('SUBSCRIBE');
  134.  
  135. }
  136.  
  137. //////////////////////////////////////////
  138. /////affichage prefs utilisateurs
  139. //////////////////////////////////////////
  140.  
  141. if(ActiveItemKey($GLOBALS['activeitem']== 'user-prefs'{
  142.   setBreadcrumb(array(ucfirst(_t('divers''myprofile')) => false));
  143.   SetHTMLTitle(_t('divers','auth')' / '._t('user','p_mod'));
  144.  
  145.   if(isset($_REQUEST['login'])) {
  146.     $auth_value=AuthenthificationProcess($_POST['login']$_POST['password']'PUBLIC');
  147.     if($auth_value === trueheader("Location: ".$_POST['referer']);
  148.   }
  149.  
  150.   if(isset($_COOKIE['linea21']['id'])) {
  151.     $content ='<h1>'._t('user','p_mod')' - ' .$_COOKIE['linea21']['login']'</h1>'.END_LINE;
  152.     $content.='<div class="sub-title">';
  153.     $content.=_t('user','h1_public_comment');
  154.     $content.='</div>';
  155.  
  156.     echo $content;
  157.     // confirmation message on changes
  158.     if(isset($_REQUEST['notifyUpdate'])) {
  159.         ChangeNotifySettings($_COOKIE['linea21']['id']);
  160.     }
  161.     if(isset($_REQUEST['current_email'])) {
  162.       ModifyProfile();
  163.     else {
  164.       DisplayFormProfileUser($_COOKIE['linea21']['id']);
  165.       
  166.       echo '<h1>'._t('user','preferences').'</h1>'.END_LINE;
  167.       DisplayWorkgroupsSettings($_COOKIE['linea21']['id']);
  168.       
  169.     }
  170.   else {
  171.     echo '<h1>'._t('divers','auth').'</h1>'.END_LINE;
  172.     echo '<div class="sub-title">';
  173.     echo _t('user','h1_public_comment_auth');
  174.     echo '</div>';
  175.  
  176.     if(isset($auth_value)) {
  177.       echo '<p class="error">'.END_LINE;
  178.       echo $auth_value.END_LINE;
  179.       echo '</p>'.END_LINE;
  180.     }
  181.     echo '<div id="cookieEnabled"></div>';
  182.     echo '<script type="text/javascript">cookieAlert("#cookieEnabled", "'._t('alert''cookie_disabled').'");</script>';
  183.     echo AuthForm('LOGON');
  184.   }
  185.  
  186. }
  187.  
  188. ?>

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