source: extensions/NBC_UserAdvManager/trunk/ConfirmMail.php @ 6822

Last change on this file since 6822 was 6785, checked in by Eric, 14 years ago
  • Bug 1693 fixed - Multi-languages are available for ConfirmMail customization (using Extended Description plugin)
  • Bug 1810 partially fixed - Auto login is not performed after visitors have validated their registration but the "home" button changes his link to redirect to identification page when the redirection option is set. Note: The redirection to profile.php doesn't work because I was unable to use the log_user() function on ConfirmMail page. This feature is still under investigation to perform the best way.
  • Property svn:eol-style set to LF
File size: 3.2 KB
RevLine 
[3742]1<?php
2//----------------------------------------------------------- include
3define('PHPWG_ROOT_PATH','./../../');
[5633]4
[3742]5include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
[5633]6
[5181]7include_once (UAM_PATH.'include/constants.php');
8include_once (UAM_PATH.'include/functions.inc.php');
[3742]9
[5633]10$title= l10n('confirm_mail_page_title');
11$page['body_id'] = 'theAboutPage';
12include(PHPWG_ROOT_PATH.'include/page_header.php');
13
14@include(PHPWG_ROOT_PATH.'template/'.$user['template'].
15  '/theme/'.$user['theme'].'/themeconf.inc.php');
16
[6354]17
[6785]18if (isset($_GET['key']) and isset($_GET['userid']))
[3742]19{
20
[6785]21  global $user, $lang, $conf, $errors;
[5181]22 
[6785]23  $key = $_GET['key'];
24  $userid = $_GET['userid'];
25  $redirect = false;
26 
[5181]27  $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
[6785]28  $conf_UAM = unserialize($conf['UserAdvManager']);
[5181]29
[6785]30  if (VerifyConfirmMail($key))
[5181]31  {
[5633]32    $status = true;
33   
[6785]34    log_user($userid, false);
35
36/* We have to get the user's language in database */
37    $query = '
38SELECT '.USER_INFOS_TABLE.'.language
39FROM '.USER_INFOS_TABLE.','.USER_CONFIRM_MAIL_TABLE.'
40WHERE (('.USER_INFOS_TABLE.'.user_id ='.$userid.') AND ('.USER_INFOS_TABLE.'.user_id = '.USER_CONFIRM_MAIL_TABLE.'.user_id))
41;';
42    $data = pwg_db_fetch_assoc(pwg_query($query));
43
44/* Check if user is already registered (profile changing) - If not (new registration), language is set to current gallery language */
45    if (empty($data))
46    {
47/* And switch gallery to this language before using personalized and multilangual contents */
48      $language = pwg_get_session_var('lang_switch', $user['language']);
49      switch_lang_to($language);
50    }
51    else
52    {
53/* And switch gallery to this language before using personalized and multilangual contents */
54      switch_lang_to($data['language']);
55      load_language('plugin.lang', UAM_PATH);
56    }
57
58    if (function_exists('get_user_language_desc'))
59    {
60      $custom_text = get_user_language_desc($conf_UAM_ConfirmMail[5]);
61    }
62    else $custom_text = l10n($conf_UAM_ConfirmMail[5]);
63
64    if (isset($conf_UAM[21]) and $conf_UAM[21] == 'true')
65    {
66      $user_idsOK = array();
67      if (!check_consult($userid, $user_idsOK))
68      {
69        $redirect = true;
70      }
71    }
72   
[3858]73    $template->assign(
74                        array(
[6785]75        'REDIRECT'             => $redirect,
[5633]76        'STATUS'               => $status,
[6785]77                                'CONFIRM_MAIL_MESSAGE' => $custom_text,
[3858]78                        )
79                );
[5181]80  } 
81  else
[5633]82  {
83    $status = false;
[6785]84    if (function_exists('get_user_language_desc'))
85    {
86      $custom_text = get_user_language_desc($conf_UAM_ConfirmMail[6]);
87    }
88    else $custom_text = l10n($conf_UAM_ConfirmMail[6]);
89   
[3858]90    $template->assign(
91                        array(
[6785]92        'REDIRECT'             => $redirect,
[5633]93        'STATUS'               => $status,
[6785]94                                'CONFIRM_MAIL_MESSAGE' => $custom_text,
[3858]95                        )
[5181]96                );
97  }
[3742]98}
99
[5056]100if (isset($lang['Theme: '.$user['theme']]))
[3742]101{
102  $template->assign(
[3858]103        'THEME_ABOUT',l10n('Theme: '.$user['theme'])
104  );
[3742]105}
106
107if ( isset($conf['gallery_url']) )
[6785]108{
[3742]109        $template->assign(
[3858]110                array(
111        'GALLERY_URL' =>
112                isset($page['gallery_url']) ?
113                        $page['gallery_url'] : $conf['gallery_url'],
114                )
115        );
[3742]116}
117
[5633]118$template->set_filenames(
119  array(
120        'confirm_mail'=>dirname(__FILE__).'/template/ConfirmMail.tpl',
121        )
122);
[3742]123
124$template->pparse('confirm_mail');
125include(PHPWG_ROOT_PATH.'include/page_tail.php');
126?>
Note: See TracBrowser for help on using the repository browser.