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.     include_once('../class/class.user.php');
  93.     $user_objectnew user;
  94.  
  95.     $data_table_user[0]=$_POST['login'];
  96.     $data_table_user[1]=$_POST['email'];
  97.     $data_table_user[2]='N'// Affichage public de l'email ( par défaut Non
  98.     $data_table_user[3$user_object -> GetNewPassword();
  99.     $data_table_right=$user_object->InitUserRight('SIMPLE_USER');
  100.     $result=$user_object->CheckDataIntegrity($data_table_user$GLOBALS['sql_object']);
  101.  
  102.     if($result===true{
  103.       /** include envoi de mail */
  104.       $todo_mail='add_user';
  105.       include_once(themePath('../user/mail_actions.php'));
  106.       include_once(themePath('../mail/template.php'));
  107.  
  108.       /** end mail */
  109.  
  110.       $result=$user_object->AddUser($data_table_user$data_table_right$GLOBALS['sql_object']);
  111.       if(is_numeric($result)) $msg='<p class="confirm">'._t('user','confirm_public').'</p>'.END_LINE;
  112.     }
  113.  
  114.   }
  115.  
  116.   SetHTMLTitle(_t('divers','user_inscription'));
  117.   echo '<h1>'._t('divers','user_inscription').'</h1>'.END_LINE;
  118.   echo '<div class="h1_comment" id="h1_user_insc">';
  119.   echo _t('user','h1_public_comment_insc');
  120.   echo '</div>';
  121.   if(isset($result&& !is_numeric($result)) {
  122.     echo '<p class="error">'.END_LINE;
  123.     echo $result.END_LINE;
  124.     echo '</p>'.END_LINE;
  125.   else {
  126.     if(isset($msg)) echo $msg;
  127.   }
  128.  
  129.   echo AuthForm('SUBSCRIBE');
  130.  
  131. }
  132.  
  133. //////////////////////////////////////////
  134. /////affichage prefs utilisateurs
  135. //////////////////////////////////////////
  136.  
  137. if(ActiveItemKey($GLOBALS['activeitem']== 'user-prefs'{
  138.   setBreadcrumb(array(ucfirst(_t('divers''myprofile')) => false));
  139.   SetHTMLTitle(_t('divers','auth')' / '._t('user','p_mod'));
  140.  
  141.   if(isset($_REQUEST['login'])) {
  142.     $auth_value=AuthenthificationProcess($_POST['login']$_POST['password']'PUBLIC');
  143.     if($auth_value === trueheader("Location: ".$_POST['referer']);
  144.   }
  145.  
  146.   if(isset($_COOKIE['linea21']['id'])) {
  147.     $content ='<h1>'._t('user','p_mod')' - ' .$_COOKIE['linea21']['login']'</h1>'.END_LINE;
  148.     $content.='<div class="h1_comment" id="h1_user">';
  149.     $content.=_t('user','h1_public_comment');
  150.     $content.='</div>';
  151.  
  152.     echo $content;
  153.  
  154.     if(isset($_REQUEST['current_email'])) {
  155.       ModifyProfile();
  156.     else {
  157.       DisplayFormProfileUser($_COOKIE['linea21']['id']);
  158.     }
  159.   else {
  160.     echo '<h1>'._t('divers','auth').'</h1>'.END_LINE;
  161.     echo '<div class="h1_comment" id="h1_user_auth">';
  162.     echo _t('user','h1_public_comment_auth');
  163.     echo '</div>';
  164.  
  165.     if(isset($auth_value)) {
  166.       echo '<p class="error">'.END_LINE;
  167.       echo $auth_value.END_LINE;
  168.       echo '</p>'.END_LINE;
  169.     }
  170.     echo '<div id="cookieEnabled"></div>';
  171.     echo '<script type="text/javascript">cookieAlert("#cookieEnabled", "'._t('alert''cookie_disabled').'");</script>';
  172.     echo AuthForm('LOGON');
  173.   }
  174.  
  175. }
  176. ?>

Documentation generated on Fri, 01 Apr 2011 09:35:15 +0200 by phpDocumentor 1.4.1