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

Last change on this file since 8165 was 7277, checked in by Eric, 14 years ago

Bug 1935 fixed : Fatal error on ConfirmMail page when Extended Description plugin is not used
Bug 1936 fixed : Bad home link in ConfirmMail page when gallery URL is not set
Small CSS improvement (thx to Gotcha)

  • Property svn:eol-style set to LF
File size: 3.0 KB
RevLine 
[3742]1<?php
2//----------------------------------------------------------- include
3define('PHPWG_ROOT_PATH','./../../');
[5633]4
[3742]5include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
[7277]6include_once( PHPWG_ROOT_PATH.'include/functions_mail.inc.php' );
[5633]7
[5181]8include_once (UAM_PATH.'include/constants.php');
9include_once (UAM_PATH.'include/functions.inc.php');
[3742]10
[5633]11$title= l10n('confirm_mail_page_title');
12$page['body_id'] = 'theAboutPage';
13include(PHPWG_ROOT_PATH.'include/page_header.php');
14
15@include(PHPWG_ROOT_PATH.'template/'.$user['template'].
16  '/theme/'.$user['theme'].'/themeconf.inc.php');
17
[6354]18
[6785]19if (isset($_GET['key']) and isset($_GET['userid']))
[3742]20{
21
[6785]22  global $user, $lang, $conf, $errors;
[5181]23 
[6785]24  $key = $_GET['key'];
25  $userid = $_GET['userid'];
26  $redirect = false;
27 
[5181]28  $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
[6785]29  $conf_UAM = unserialize($conf['UserAdvManager']);
[5181]30
[6785]31  if (VerifyConfirmMail($key))
[5181]32  {
[5633]33    $status = true;
34   
[6785]35    log_user($userid, false);
36
37/* We have to get the user's language in database */
38    $query = '
39SELECT '.USER_INFOS_TABLE.'.language
40FROM '.USER_INFOS_TABLE.','.USER_CONFIRM_MAIL_TABLE.'
41WHERE (('.USER_INFOS_TABLE.'.user_id ='.$userid.') AND ('.USER_INFOS_TABLE.'.user_id = '.USER_CONFIRM_MAIL_TABLE.'.user_id))
42;';
43    $data = pwg_db_fetch_assoc(pwg_query($query));
44
45/* Check if user is already registered (profile changing) - If not (new registration), language is set to current gallery language */
46    if (empty($data))
47    {
48/* And switch gallery to this language before using personalized and multilangual contents */
49      $language = pwg_get_session_var('lang_switch', $user['language']);
50      switch_lang_to($language);
51    }
52    else
53    {
54/* And switch gallery to this language before using personalized and multilangual contents */
55      switch_lang_to($data['language']);
56      load_language('plugin.lang', UAM_PATH);
57    }
58
59    if (function_exists('get_user_language_desc'))
60    {
61      $custom_text = get_user_language_desc($conf_UAM_ConfirmMail[5]);
62    }
63    else $custom_text = l10n($conf_UAM_ConfirmMail[5]);
64
[7277]65    $redirect = true;
[6785]66   
[3858]67    $template->assign(
68                        array(
[6785]69        'REDIRECT'             => $redirect,
[5633]70        'STATUS'               => $status,
[6785]71                                'CONFIRM_MAIL_MESSAGE' => $custom_text,
[3858]72                        )
73                );
[5181]74  } 
75  else
[5633]76  {
77    $status = false;
[7277]78    $redirect = false;
[6785]79    if (function_exists('get_user_language_desc'))
80    {
81      $custom_text = get_user_language_desc($conf_UAM_ConfirmMail[6]);
82    }
83    else $custom_text = l10n($conf_UAM_ConfirmMail[6]);
84   
[3858]85    $template->assign(
86                        array(
[6785]87        'REDIRECT'             => $redirect,
[7277]88        'GALLERY_URL'          => make_index_url(),
[5633]89        'STATUS'               => $status,
[6785]90                                'CONFIRM_MAIL_MESSAGE' => $custom_text,
[3858]91                        )
[5181]92                );
93  }
[3742]94}
95
[5056]96if (isset($lang['Theme: '.$user['theme']]))
[3742]97{
98  $template->assign(
[3858]99        'THEME_ABOUT',l10n('Theme: '.$user['theme'])
100  );
[3742]101}
102
[5633]103$template->set_filenames(
104  array(
105        'confirm_mail'=>dirname(__FILE__).'/template/ConfirmMail.tpl',
106        )
107);
[3742]108
109$template->pparse('confirm_mail');
110include(PHPWG_ROOT_PATH.'include/page_tail.php');
111?>
Note: See TracBrowser for help on using the repository browser.