Cheetah
profile_activate.php
Go to the documentation of this file.
1 <?php
2 
8 require_once( 'inc/header.inc.php' );
9 require_once( CH_DIRECTORY_PATH_INC . 'design.inc.php' );
10 require_once( CH_DIRECTORY_PATH_INC . 'profiles.inc.php' );
11 require_once( CH_DIRECTORY_PATH_INC . 'utils.inc.php' );
12 require_once( CH_DIRECTORY_PATH_CLASSES . 'ChWsbEmailTemplates.php' );
13 
14 // --------------- page variables
15 
16 $_page['name_index'] = 40;
17 
18 $ID = ch_get('ConfID');
19 $ConfCode = ch_get('ConfCode');
20 
21 if (!$ID && !$ConfCode)
22  exit;
23 
24 $logged['member'] = member_auth(0, false);
25 
26 $_page['header'] = _t("_Email confirmation");
27 $_page['header_text'] = _t("_Email confirmation Ex");
28 
29 // --------------- page components
30 
31 $_ni = $_page['name_index'];
33 
34 // --------------- [END] page components
35 
36 PageCode();
37 
38 // --------------- page components functions
39 
43 function PageCompPageMainCode($iID, $sConfCode)
44 {
45  global $site;
46 
47  $ID = (int)$iID;
48  $ConfCode = clear_xss($sConfCode);
50 
51  if (!$p_arr) {
52  $_page['header'] = _t("_Error");
53  $_page['header_text'] = _t("_Profile Not found");
54  return MsgBox(_t('_Profile Not found Ex'));
55  }
56 
57  $aCode = array(
58  'message_status' => '',
59  'message_info' => '',
60  'ch_if:form' => array(
61  'condition' => false,
62  'content' => array(
63  'form' => ''
64  )
65  ),
66  'ch_if:next' => array(
67  'condtion' => false,
68  'content' => array(
69  'next_url' => '',
70  )
71  )
72  );
73 
74  if ($p_arr['Status'] == 'Unconfirmed') {
75  $ConfCodeReal = base64_encode( base64_encode( crypt( $p_arr['Email'], CRYPT_EXT_DES ? "secret_co" : "se" ) ) );
76  if (strcmp($ConfCode, $ConfCodeReal) !== 0) {
77  $aForm = array(
78  'form_attrs' => array (
79  'action' => CH_WSB_URL_ROOT . 'profile_activate.php',
80  'method' => 'post',
81  'name' => 'form_change_status'
82  ),
83 
84  'inputs' => array(
85  'conf_id' => array (
86  'type' => 'hidden',
87  'name' => 'ConfID',
88  'value' => $ID,
89  ),
90  'conf_code' => array (
91  'type' => 'text',
92  'name' => 'ConfCode',
93  'value' => '',
94  'caption' => _t("_Confirmation code")
95  ),
96  'submit' => array (
97  'type' => 'submit',
98  'name' => 'submit',
99  'value' => _t("_Submit"),
100  ),
101  ),
102  );
104  $aCode['message_status'] = _t("_Profile activation failed");
105  $aCode['message_info'] = _t("_EMAIL_CONF_FAILED_EX");
106  $aCode['ch_if:form']['condition'] = true;
107  $aCode['ch_if:form']['content']['form'] = $oForm->getCode();
108  } else {
109  $aCode['ch_if:next']['condition'] = true;
110  $aCode['ch_if:next']['content']['next_url'] = CH_WSB_URL_ROOT . 'member.php';
111 
112  $send_act_mail = FALSE;
113  if (getParam('autoApproval_ifJoin') == 'on' && !(getParam('sys_dnsbl_enable') && 'approval' == getParam('sys_dnsbl_behaviour') && ch_is_ip_dns_blacklisted('', 'join'))) {
114  $status = 'Active';
115  $send_act_mail = TRUE;
116  $aCode['message_info'] = _t( "_PROFILE_CONFIRM" );
117  } else {
118  $status = 'Approval';
119  $aCode['message_info'] = _t("_EMAIL_CONF_SUCCEEDED", $site['title']);
120  }
121 
122  $update = ch_admin_profile_change_status($ID, $status, $send_act_mail);
123 
124  // Promotional membership
125  if (getParam('enable_promotion_membership') == 'on') {
126  $memership_days = getParam('promotion_membership_days');
127  setMembership( $p_arr['ID'], MEMBERSHIP_ID_PROMOTION, $memership_days, true );
128  }
129 
130  // check couple profile;
131  if ($p_arr['Couple']) {
132  $update = ch_admin_profile_change_status($p_arr['Couple'], $status);
133 
134  //Promotional membership
135  if (getParam('enable_promotion_membership') == 'on') {
136  $memership_days = getParam('promotion_membership_days');
137  setMembership( $p_arr['Couple'], MEMBERSHIP_ID_PROMOTION, $memership_days, true );
138  }
139  }
140  if (getParam('newusernotify')) {
141  $oEmailTemplates = new ChWsbEmailTemplates();
142  $aTemplate = $oEmailTemplates->getTemplate('t_UserConfirmed', $p_arr['ID']);
143 
144  sendMail($site['email_notify'], $aTemplate['Subject'], $aTemplate['Body'], $p_arr['ID']);
145  }
146  }
147  } else
148  $aCode['message_info'] = _t('_ALREADY_ACTIVATED');
149  return $GLOBALS['oSysTemplate']->parseHtmlByName('profile_activate.html', $aCode);
150 }
ChTemplFormView
Definition: ChTemplFormView.php:11
TRUE
URI MungeSecretKey $secret_key</pre >< p > If the output is TRUE
Definition: URI.MungeSecretKey.txt:17
MsgBox
MsgBox($sText, $iTimer=0)
Definition: design.inc.php:175
ChWsbEmailTemplates
Definition: ChWsbEmailTemplates.php:11
ch_get
ch_get($sName)
Definition: utils.inc.php:1664
sendMail
sendMail( $sRecipientEmail, $sMailSubject, $sMailBody, $iRecipientID=0, $aPlus=array(), $sEmailFlag='html', $isDisableAlert=false, $bForceSend=false)
Definition: utils.inc.php:461
setMembership
setMembership($iMemberId, $iMembershipId, $iDays=0, $bStartsNow=false, $sTransactionId='', $isSendMail=true)
Definition: membership_levels.inc.php:561
ch_admin_profile_change_status
ch_admin_profile_change_status($mixedIds, $sStatus, $bSendActMail=FALSE)
Definition: admin.inc.php:436
php
PageCompPageMainCode
PageCompPageMainCode($iID, $sConfCode)
Definition: profile_activate.php:43
$ConfCode
$ConfCode
Definition: profile_activate.php:19
$_page_cont
$_page_cont[$_ni]['page_main_code']
Definition: profile_activate.php:32
$oForm
$oForm
Definition: host_tools.php:42
exit
exit
Definition: cart.php:21
getParam
getParam($sParamName, $bUseCache=true)
Definition: db.inc.php:130
$site
$site['ver']
Definition: version.inc.php:8
$_page
$_page['name_index']
Definition: profile_activate.php:16
global
if(!defined("GLOBAL_MODULE")) define("GLOBAL_MODULE" global
Definition: header.inc.php:25
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition: languages.inc.php:509
PageCode
PageCode($oTemplate=null)
Definition: design.inc.php:91
member_auth
member_auth($member=0, $error_handle=true, $bAjx=false)
Definition: admin.inc.php:262
$logged
$logged['member']
Definition: profile_activate.php:24
getProfileInfo
getProfileInfo($iProfileID=0, $checkActiveStatus=false, $forceCache=false)
Definition: profiles.inc.php:249
$aForm
$aForm
Definition: forgot.php:43
$p_arr
$p_arr
Definition: profile.php:68
$_ni
$_ni
Definition: profile_activate.php:31
MEMBERSHIP_ID_PROMOTION
const MEMBERSHIP_ID_PROMOTION
Definition: membership_levels.inc.php:50
$ID
$ID
Definition: profile_activate.php:18
ch_is_ip_dns_blacklisted
ch_is_ip_dns_blacklisted($sCurIP='', $sType='')
Definition: utils.inc.php:995
$GLOBALS
$GLOBALS['iAdminPage']
Definition: advanced_settings.php:10
clear_xss
clear_xss($val)
Definition: utils.inc.php:700