source: extensions/UserAdvManager/branches/2.40/ConfirmMail.php @ 14371

Last change on this file since 14371 was 14371, checked in by Eric, 12 years ago

Bug 2572 fixed - Adding a local home icon on ConfirmMail, rejected and del_account pages
Bug 2620 fixed - Display of ConfirmMail, rejected and del_account pages have been improved

Merged from trunk to branch 2.4

  • Property svn:eol-style set to LF
File size: 4.7 KB
Line 
1<?php
2//----------------------------------------------------------- include
3define('PHPWG_ROOT_PATH','./../../');
4
5include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
6include_once( PHPWG_ROOT_PATH.'include/functions_mail.inc.php' );
7
8include_once (UAM_PATH.'include/constants.php');
9include_once (UAM_PATH.'include/functions.inc.php');
10
11$title= l10n('UAM_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
18
19if (isset($_GET['key']) and isset($_GET['userid']))
20{
21
22  global $user, $lang, $conf, $errors;
23 
24  $key = $_GET['key'];
25  $userid = $_GET['userid'];
26  $redirect = false;
27 
28  $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']);
29  $conf_UAM = unserialize($conf['UserAdvManager']);
30
31  $query = '
32SELECT '.USERS_TABLE.'.username
33FROM '.USERS_TABLE.'
34WHERE ('.USERS_TABLE.'.id ='.$userid.')
35;';
36  $result = pwg_db_fetch_assoc(pwg_query($query));
37
38  if (VerifyConfirmMail($key))
39  {
40    $status = true;
41   
42    log_user($userid, false);
43
44// We have to get the user's language in database
45// ----------------------------------------------
46    $query = '
47SELECT language
48FROM '.USER_INFOS_TABLE.'
49WHERE '.USER_INFOS_TABLE.'.user_id ='.$userid.'
50;';
51    $data = pwg_db_fetch_assoc(pwg_query($query));
52
53// Check if user is already registered (profile changing) - If not (new registration), language is set to current gallery language
54// -------------------------------------------------------------------------------------------------------------------------------
55    if (empty($data))
56    {
57// And switch gallery to this language before using personalized and multilangual contents
58// ---------------------------------------------------------------------------------------
59      $language = pwg_get_session_var('lang_switch', $user['language']);
60      switch_lang_to($language);
61    }
62    else
63    {
64// And switch gallery to this language before using personalized and multilangual contents
65// ---------------------------------------------------------------------------------------
66      switch_lang_to($data['language']);
67      load_language('plugin.lang', UAM_PATH);
68    }
69
70    if (isset($conf_UAM_ConfirmMail[5]) and $conf_UAM_ConfirmMail[5] <> '')
71    {
72      // Management of Extension flags ([username], [mygallery], [myurl])
73      // ----------------------------------------------------------------
74      $patterns[] = '#\[username\]#i';
75      $replacements[] = $result['username'];
76      $patterns[] = '#\[mygallery\]#i';
77      $replacements[] = $conf['gallery_title'];
78      $patterns[] = '#\[myurl\]#i';
79      $replacements[] = $conf['gallery_url'];
80   
81      if (function_exists('get_user_language_desc'))
82      {
83        $custom_text = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail[5]));
84      }
85      else $custom_text = l10n(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail[5]));
86    }
87   
88    $redirect = true;
89    $Path_UAM = UAM_PATH; // Path to be used in template to reach the icons
90   
91    $template->assign(
92                        array(
93        'UAM_PATH'             => $Path_UAM,
94        'REDIRECT'             => $redirect,
95        'STATUS'               => $status,
96                                'CONFIRM_MAIL_MESSAGE' => $custom_text,
97                        )
98                );
99  } 
100  else
101  {
102    $status = false;
103    $redirect = false;
104   
105    if (isset($conf_UAM_ConfirmMail[6]) and $conf_UAM_ConfirmMail[6] <> '')
106    {
107      // Management of Extension flags ([username], [mygallery], [myurl])
108      // ----------------------------------------------------------------
109      $patterns[] = '#\[username\]#i';
110      $replacements[] = $result['username'];
111      $patterns[] = '#\[mygallery\]#i';
112      $replacements[] = $conf['gallery_title'];
113      $patterns[] = '#\[myurl\]#i';
114      $replacements[] = $conf['gallery_url'];
115   
116      if (function_exists('get_user_language_desc'))
117      {
118        $custom_text = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail[6]));
119      }
120      else $custom_text = l10n(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail[6]));
121    }
122   
123    $template->assign(
124                        array(
125        'REDIRECT'             => $redirect,
126        'GALLERY_URL'          => make_index_url(),
127        'STATUS'               => $status,
128                                'CONFIRM_MAIL_MESSAGE' => $custom_text,
129                        )
130                );
131  }
132}
133
134if (isset($lang['Theme: '.$user['theme']]))
135{
136  $template->assign(
137        'THEME_ABOUT',l10n('Theme: '.$user['theme'])
138  );
139}
140
141$template->set_filenames(
142  array(
143        'confirm_mail'=>dirname(__FILE__).'/template/ConfirmMail.tpl',
144        )
145);
146
147$template->pparse('confirm_mail');
148include(PHPWG_ROOT_PATH.'include/page_tail.php');
149?>
Note: See TracBrowser for help on using the repository browser.