source: trunk/profile_activate.php

Last change on this file was 2, checked in by george, 14 years ago
  • Přidáno: Trunk revize 13719.
File size: 5.1 KB
Line 
1<?php
2
3/***************************************************************************
4* Dolphin Smart Community Builder
5* -----------------
6* begin : Mon Mar 23 2006
7* copyright : (C) 2006 BoonEx Group
8* website : http://www.boonex.com/
9* This file is part of Dolphin - Smart Community Builder
10*
11* Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License.
12* http://creativecommons.org/licenses/by/3.0/
13*
14* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16* See the Creative Commons Attribution 3.0 License for more details.
17* You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin,
18* see license.txt file; if not, write to marketing@boonex.com
19***************************************************************************/
20
21require_once( 'inc/header.inc.php' );
22require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
23require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' );
24require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
25require_once( BX_DIRECTORY_PATH_CLASSES . 'BxDolEmailTemplates.php' );
26
27// --------------- page variables
28
29$_page['name_index'] = 40;
30$_page['css_name'] = 'profile_activate.css';
31
32$ID = (int)$_GET['ConfID'];
33$ConfCode = $_GET['ConfCode'];
34
35if ( !$ID && !$ConfCode )
36 exit;
37
38$logged['member'] = member_auth( 0, false );
39
40$_page['header'] = _t("_Email confirmation");
41$_page['header_text'] = _t("_Email confirmation Ex");
42
43
44// --------------- page components
45
46$_ni = $_page['name_index'];
47$_page_cont[$_ni]['page_main_code'] = PageCompPageMainCode();
48
49// --------------- [END] page components
50
51PageCode();
52
53// --------------- page components functions
54
55/**
56 * page code function
57 */
58function PageCompPageMainCode()
59{
60 global $ID;
61 global $ConfCode;
62 global $site;
63 $newusernotify = getParam('newusernotify');
64
65 $autoApproval_ifJoin = isAutoApproval('join');
66
67 $p_arr = getProfileInfo( $ID );
68
69 if ( !$p_arr )
70 {
71 $_page['header'] = _t("_Error");
72 $_page['header_text'] = _t("_Profile Not found");
73 $ret = "<table width=\"100%\" cellpadding=4 cellspacing=4><td align=center class=text2>";
74 $ret .= _t('_Profile Not found Ex');
75 $ret.= "</td></table>";
76 return $ret;
77 }
78
79 ob_start();
80
81 echo "<table width=\"100%\" cellpadding=4 cellspacing=4><td align=center class=text2>";
82
83 if ( $p_arr['Status'] == 'Unconfirmed' )
84 {
85 $ConfCodeReal = base64_encode( base64_encode( crypt( $p_arr[Email], CRYPT_EXT_DES ? "secret_co" : "se" ) ) );
86 if ( strcmp( $ConfCode, $ConfCodeReal ) != 0 )
87 {
88?>
89<b><?=_t("_Profile activation failed")?></b><br /><br />
90<?=_t("_EMAIL_CONF_FAILED_EX")?><br />
91<center><form action="<? echo $_SERVER[PHP_SELF]; ?>" method=get>
92<input type=hidden name="ConfID" value="<? echo $ID; ?>">
93<table class=text>
94 <td><b><?=_t("_Confirmation code")?>:</b> </td>
95 <td><input class=no name="ConfCode"></td>
96 <td>&nbsp;</td>
97 <td><input class=no type="submit" value=" <?=_t("_Submit")?> "></td>
98</table>
99</form></center>
100<?
101 }
102 else
103 {
104 if ( $autoApproval_ifJoin )
105 {
106 $status = 'Active';
107 $rEmailTemplate = new BxDolEmailTemplates();
108 $aTemplate = $rEmailTemplate -> getTemplate( 't_Activation' ) ;
109
110 sendMail( $p_arr['Email'], $aTemplate['Subject'], $aTemplate['Body'], $p_arr['ID'] );
111 }
112 else {
113 $status = 'Approval';
114 }
115
116 $update = db_res( "UPDATE `Profiles` SET `Status` = '$status' WHERE `ID` = '$ID';" );
117 createUserDataFile( $ID );
118 reparseObjTags( 'profile', $ID );
119
120 // Promotional membership
121 if ( getParam('enable_promotion_membership') == 'on' )
122 {
123 $memership_days = getParam('promotion_membership_days');
124 setMembership( $p_arr['ID'], MEMBERSHIP_ID_PROMOTION, $memership_days, true );
125 }
126
127 // check couple profile;
128 if($p_arr['Couple']) {
129 $update = db_res( "UPDATE `Profiles` SET `Status` = '$status' WHERE `ID` = '{$p_arr['Couple']}';" );
130 createUserDataFile($p_arr['Couple']);
131 reparseObjTags('profile', $p_arr['Couple']);
132
133 //Promotional membership
134 if ( getParam('enable_promotion_membership') == 'on' )
135 {
136 $memership_days = getParam('promotion_membership_days');
137 setMembership( $p_arr['Couple'], MEMBERSHIP_ID_PROMOTION, $memership_days, true );
138 }
139 }
140
141?>
142<?php
143if ( $autoApproval_ifJoin )
144{
145 echo _t( "_PROFILE_CONFIRM" );
146}
147else
148{
149 echo _t("_EMAIL_CONF_SUCCEEDED", $site['title']);
150}
151?>
152<br /><br />
153<center><a href="member.php"><b><?=_t("_Continue")?> &gt;&gt;</b></a></center>
154<?
155 if ( $newusernotify )
156 {
157 $message =
158"New user {$p_arr['NickName']} with email {$p_arr['Email']} has been confirmed,
159his/her ID is {$p_arr['ID']}.
160--
161{$site['title']} mail delivery system
162<Auto-generated e-mail, please, do not reply>
163";
164
165 $subject = "New user confirmed";
166
167 sendMail( $site['email_notify'], $subject, $message );
168 }
169 }
170 }
171 else
172 echo _t('_ALREADY_ACTIVATED');
173
174 echo "</td></table>";
175
176 $ret = ob_get_contents();
177 ob_end_clean();
178
179 return $ret;
180}
181
182?>
Note: See TracBrowser for help on using the repository browser.