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

Last change on this file since 6990 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
Line 
1<?php
2//----------------------------------------------------------- include
3define('PHPWG_ROOT_PATH','./../../');
4
5include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
6
7include_once (UAM_PATH.'include/constants.php');
8include_once (UAM_PATH.'include/functions.inc.php');
9
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
17
18if (isset($_GET['key']) and isset($_GET['userid']))
19{
20
21  global $user, $lang, $conf, $errors;
22 
23  $key = $_GET['key'];
24  $userid = $_GET['userid'];
25  $redirect = false;
26 
27  $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
28  $conf_UAM = unserialize($conf['UserAdvManager']);
29
30  if (VerifyConfirmMail($key))
31  {
32    $status = true;
33   
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   
73    $template->assign(
74                        array(
75        'REDIRECT'             => $redirect,
76        'STATUS'               => $status,
77                                'CONFIRM_MAIL_MESSAGE' => $custom_text,
78                        )
79                );
80  } 
81  else
82  {
83    $status = false;
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   
90    $template->assign(
91                        array(
92        'REDIRECT'             => $redirect,
93        'STATUS'               => $status,
94                                'CONFIRM_MAIL_MESSAGE' => $custom_text,
95                        )
96                );
97  }
98}
99
100if (isset($lang['Theme: '.$user['theme']]))
101{
102  $template->assign(
103        'THEME_ABOUT',l10n('Theme: '.$user['theme'])
104  );
105}
106
107if ( isset($conf['gallery_url']) )
108{
109        $template->assign(
110                array(
111        'GALLERY_URL' =>
112                isset($page['gallery_url']) ?
113                        $page['gallery_url'] : $conf['gallery_url'],
114                )
115        );
116}
117
118$template->set_filenames(
119  array(
120        'confirm_mail'=>dirname(__FILE__).'/template/ConfirmMail.tpl',
121        )
122);
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.