1 | <?php |
---|
2 | //----------------------------------------------------------- include |
---|
3 | define('PHPWG_ROOT_PATH','./../../'); |
---|
4 | |
---|
5 | include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); |
---|
6 | include_once( PHPWG_ROOT_PATH.'include/functions_mail.inc.php' ); |
---|
7 | |
---|
8 | include_once (UAM_PATH.'include/constants.php'); |
---|
9 | include_once (UAM_PATH.'include/functions.inc.php'); |
---|
10 | |
---|
11 | $title= l10n('UAM_confirm_mail_page_title'); |
---|
12 | $page['body_id'] = 'theAboutPage'; |
---|
13 | include(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 | |
---|
19 | if (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 = ' |
---|
32 | SELECT '.USERS_TABLE.'.username |
---|
33 | FROM '.USERS_TABLE.' |
---|
34 | WHERE ('.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 | $query = ' |
---|
46 | SELECT '.USER_INFOS_TABLE.'.language |
---|
47 | FROM '.USER_INFOS_TABLE.','.USER_CONFIRM_MAIL_TABLE.' |
---|
48 | WHERE (('.USER_INFOS_TABLE.'.user_id ='.$userid.') AND ('.USER_INFOS_TABLE.'.user_id = '.USER_CONFIRM_MAIL_TABLE.'.user_id)) |
---|
49 | ;'; |
---|
50 | $data = pwg_db_fetch_assoc(pwg_query($query)); |
---|
51 | |
---|
52 | /* Check if user is already registered (profile changing) - If not (new registration), language is set to current gallery language */ |
---|
53 | if (empty($data)) |
---|
54 | { |
---|
55 | /* And switch gallery to this language before using personalized and multilangual contents */ |
---|
56 | $language = pwg_get_session_var('lang_switch', $user['language']); |
---|
57 | switch_lang_to($language); |
---|
58 | } |
---|
59 | else |
---|
60 | { |
---|
61 | /* And switch gallery to this language before using personalized and multilangual contents */ |
---|
62 | switch_lang_to($data['language']); |
---|
63 | load_language('plugin.lang', UAM_PATH); |
---|
64 | } |
---|
65 | |
---|
66 | if (isset($conf_UAM_ConfirmMail[5]) and $conf_UAM_ConfirmMail[5] <> '') |
---|
67 | { |
---|
68 | // Management of Extension flags ([username], [mygallery], [myurl]) |
---|
69 | $patterns[] = '#\[username\]#i'; |
---|
70 | $replacements[] = $result['username']; |
---|
71 | $patterns[] = '#\[mygallery\]#i'; |
---|
72 | $replacements[] = $conf['gallery_title']; |
---|
73 | $patterns[] = '#\[myurl\]#i'; |
---|
74 | $replacements[] = $conf['gallery_url']; |
---|
75 | |
---|
76 | if (function_exists('get_user_language_desc')) |
---|
77 | { |
---|
78 | $custom_text = get_user_language_desc(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail[5])); |
---|
79 | } |
---|
80 | else $custom_text = l10n(preg_replace($patterns, $replacements, $conf_UAM_ConfirmMail[5])); |
---|
81 | } |
---|
82 | |
---|
83 | $redirect = true; |
---|
84 | |
---|
85 | $template->assign( |
---|
86 | array( |
---|
87 | 'REDIRECT' => $redirect, |
---|
88 | 'STATUS' => $status, |
---|
89 | 'CONFIRM_MAIL_MESSAGE' => $custom_text, |
---|
90 | ) |
---|
91 | ); |
---|
92 | } |
---|
93 | else |
---|
94 | { |
---|
95 | $status = false; |
---|
96 | $redirect = false; |
---|
97 | |
---|
98 | if (isset($conf_UAM_ConfirmMail[6]) and $conf_UAM_ConfirmMail[6] <> '') |
---|
99 | { |
---|
100 | // Management of Extension flags ([username], [mygallery], [myurl]) |
---|
101 | $patterns[] = '#\[username\]#i'; |
---|
102 | $replacements[] = $result['username']; |
---|
103 | $patterns[] = '#\[mygallery\]#i'; |
---|
104 | $replacements[] = $conf['gallery_title']; |
---|
105 | $patterns[] = '#\[myurl\]#i'; |
---|
106 | $replacements[] = $conf['gallery_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 | $template->assign( |
---|
116 | array( |
---|
117 | 'REDIRECT' => $redirect, |
---|
118 | 'GALLERY_URL' => make_index_url(), |
---|
119 | 'STATUS' => $status, |
---|
120 | 'CONFIRM_MAIL_MESSAGE' => $custom_text, |
---|
121 | ) |
---|
122 | ); |
---|
123 | } |
---|
124 | } |
---|
125 | |
---|
126 | if (isset($lang['Theme: '.$user['theme']])) |
---|
127 | { |
---|
128 | $template->assign( |
---|
129 | 'THEME_ABOUT',l10n('Theme: '.$user['theme']) |
---|
130 | ); |
---|
131 | } |
---|
132 | |
---|
133 | $template->set_filenames( |
---|
134 | array( |
---|
135 | 'confirm_mail'=>dirname(__FILE__).'/template/ConfirmMail.tpl', |
---|
136 | ) |
---|
137 | ); |
---|
138 | |
---|
139 | $template->pparse('confirm_mail'); |
---|
140 | include(PHPWG_ROOT_PATH.'include/page_tail.php'); |
---|
141 | ?> |
---|