source: extensions/UserAdvManager/trunk/ConfirmMail.php @ 18238

Last change on this file since 18238 was 17987, checked in by flop25, 12 years ago

one correction

  • Property svn:eol-style set to LF
File size: 4.5 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    log_user($userid, false);
42    if (isset($conf_UAM[1]) and $conf_UAM[1] == 'local')
43    {
44      validation_mail($userid);
45    }
46// We have to get the user's language in database
47// ----------------------------------------------
48    $query = '
49SELECT language
50FROM '.USER_INFOS_TABLE.'
51WHERE '.USER_INFOS_TABLE.'.user_id ='.$userid.'
52;';
53    $data = pwg_db_fetch_assoc(pwg_query($query));
54
55// Check if user is already registered (profile changing) - If not (new registration), language is set to current gallery language
56// -------------------------------------------------------------------------------------------------------------------------------
57    if (empty($data))
58    {
59// And switch gallery to this language before using personalized and multilangual contents
60// ---------------------------------------------------------------------------------------
61      $language = pwg_get_session_var('lang_switch', $user['language']);
62      switch_lang_to($language);
63    }
64    else
65    {
66// And switch gallery to this language before using personalized and multilangual contents
67// ---------------------------------------------------------------------------------------
68      switch_lang_to($data['language']);
69      load_language('plugin.lang', UAM_PATH);
70    }
71
72    if (isset($conf_UAM_ConfirmMail[5]) and $conf_UAM_ConfirmMail[5] <> '')
73    {
74      // Management of Extension flags ([username], [mygallery], [myurl])
75      // ----------------------------------------------------------------
76      $patterns[] = '#\[username\]#i';
77      $replacements[] = $result['username'];
78      $patterns[] = '#\[mygallery\]#i';
79      $replacements[] = $conf['gallery_title'];
80      $patterns[] = '#\[myurl\]#i';
81      $replacements[] = get_gallery_home_url();
82
83      if (function_exists('get_user_language_desc'))
84      {
85        $custom_text = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail[5]));
86      }
87      else $custom_text = l10n(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail[5]));
88    }
89   
90    $redirect = true;
91  } 
92  else
93  {
94    $status = false;
95    $redirect = false;
96   
97    if (isset($conf_UAM_ConfirmMail[6]) and $conf_UAM_ConfirmMail[6] <> '')
98    {
99      // Management of Extension flags ([username], [mygallery], [myurl])
100      // ----------------------------------------------------------------
101      $patterns[] = '#\[username\]#i';
102      $replacements[] = $result['username'];
103      $patterns[] = '#\[mygallery\]#i';
104      $replacements[] = $conf['gallery_title'];
105      $patterns[] = '#\[myurl\]#i';
106      $replacements[] = get_gallery_home_url();
107   
108      if (function_exists('get_user_language_desc'))
109      {
110        $custom_text = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail[6]));
111      }
112      else $custom_text = l10n(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail[6]));
113    }
114  }
115
116  $Path_UAM = UAM_PATH; // Path to be used in template to reach the icons
117
118  $template->assign(
119    array(
120      'UAM_PATH'             => $Path_UAM,
121      'REDIRECT'             => $redirect,
122      'STATUS'               => $status,
123                                'CONFIRM_MAIL_MESSAGE' => $custom_text,
124    )
125  );
126}
127
128if (isset($lang['Theme: '.$user['theme']]))
129{
130  $template->assign(
131        'THEME_ABOUT',l10n('Theme: '.$user['theme'])
132  );
133}
134
135$template->set_filenames(
136  array(
137        'confirm_mail'=>dirname(__FILE__).'/template/ConfirmMail.tpl',
138        )
139);
140
141$template->pparse('confirm_mail');
142include(PHPWG_ROOT_PATH.'include/page_tail.php');
143?>
Note: See TracBrowser for help on using the repository browser.