Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

subscriptionlogin.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: subscriptionlogin.php 7764 2001-10-10 19:46:42Z fh $
5 //
6 // Created on: <23-Oct-2000 17:53:46 bf>
7 //
8 // This source file is part of Exponential Basic, publishing software.
9 //
10 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
11 //
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
25 //
26
27 // include_once( "ezbulkmail/classes/ezbulkmailsubscriptionaddress.php" );
28 // include_once( "ezbulkmail/classes/ezbulkmailforgot.php" );
29 // include_once( "ezmail/classes/ezmail.php" );
30 // include_once( "ezuser/classes/ezuser.php" );
31 // include_once( "classes/eztemplate.php" );
32
33 // check hash from mail, validate the correct email address...
34 $Language = $ini->variable( "eZBulkMailMain", "Language" );
35 $TemplateDir = $ini->variable( "eZBulkMailMain", "TemplateDir" );
36 $languageIni = new eZINI( "kernel/ezbulkmail/user/intl/" . $Language . "/subscriptionlogin.php.ini", false );
37
38 if( isset( $Hash ) )
39 {
40 $change = new eZBulkMailForgot();
41
42 if ( $change->check( $Hash ) )
43 {
44 $change->get( $change->check( $Hash ) );
45 $subscriptionaddress = new eZBulkMailSubscriptionAddress();
46 $subscriptionaddress->setEMail( $change->mail() );
47 $subscriptionaddress->setEncryptetPassword( $change->password() );
48 $subscriptionaddress->store();
49
50 // Cleanup
51 $session->setVariable( "BulkMailAddress", $change->mail() );
52 $change->delete();
53 eZHTTPTool::header( "Location: /bulkmail/subscriptionlist/" );
54 exit();
55 }
56 }
57
58 if( isset( $Ok ) )
59 {
60 if( $Action == "login" )
61 {
62 // check if password and email is correct.. if so, let the user continue..
63 if( eZBulkMailSubscriptionAddress::validate( $Email, $Password ) )
64 {
65 $session->setVariable( "BulkMailAddress", $Email );
66 eZHTTPTool::header( "Location: /bulkmail/subscriptionlist/" );
67 exit();
68 }
69 }
70 else if( $Action == "create" )
71 {
72 // TODO:check if address allready exists!!
73 $subscriptionaddress = new eZBulkMailSubscriptionAddress();
74 if( $subscriptionaddress->setEMail( $Email ) && $Password != "" && $Password == $Password2 ) // check if passwords are alike and that we have a valid email address...
75 {
76 $headersInfo = getallheaders();
77 // send an email to the new address asking to confirm it..
78 $subjectText = ( $languageIni->variable( "strings", "subject_text" ) . " " . $headersInfo["Host"] );
79 $bodyText = $languageIni->variable( "strings", "body_text" );
80
81 $forgot = new eZBulkMailForgot();
82 $forgot->get( $Email );
83 $forgot->setMail( $Email );
84 $forgot->setPassword( $Password );
85 $forgot->store();
86
87 $mailTemplate = new eZTemplate( "kernel/ezbulkmail/user/" . $ini->variable( "eZBulkMailMain", "TemplateDir" ),
88 "kernel/ezbulkmail/user/intl", $Language, "subscriptionmail.php" );
89 $mailTemplate->setAllStrings();
90 $mailTemplate->set_file( "subscription_mail_tpl", "subscriptionmail.tpl" );
91
92 $mailpassword = new eZMail();
93 $mailpassword->setTo( $Email );
94 $mailpassword->setSubject( $subjectText );
95
96 $mailTemplate->set_var( "activation_link", "http://" . $headersInfo["Host"] . "/bulkmail/confirmsubscription/" . $forgot->Hash() );
97 $mailTemplate->set_var( "host", "http://" . $headersInfo["Host"] );
98 $mailpassword->setBody( $mailTemplate->parse( "dummy", "subscription_mail_tpl" ) );
99 $mailpassword->setFrom( $GlobalSiteIni->variable( "eZBulkMailMain", "BulkmailSenderAddress" ) );
100 $mailpassword->send();
101
102 eZHTTPTool::header( "Location: /bulkmail/successfull/" );
103 exit();
104 }
105 else // we have some sort of error... find out what it is, and present it to the user..
106 {
107 $New = "new";
108 if( $subscriptionaddress->setEMail( $Email) == false )
109 $error = "emailerror";
110 else if( $Password == "" )
111 $error = "zeropassword";
112 else
113 $error = "unlikepasswords";
114 }
115
116 // send confirmation mail to that address
117 }
118 }
119
120 $t = new eZTemplate( "kernel/ezbulkmail/user/" . $ini->variable( "eZBulkMailMain", "TemplateDir" ),
121 "kernel/ezbulkmail/user/intl", $Language, "subscriptionlogin.php" );
122
123 $t->set_file( array(
124 "subscription_login_tpl" => "subscriptionlogin.tpl"
125 ) );
126
127 $t->setAllStrings();
128 $t->set_var( "site_style", $SiteDesign );
129
130 $t->set_block( "subscription_login_tpl", "second_password_tpl", "second_password" );
131 $t->set_block( "subscription_login_tpl", "new_tpl", "new" );
132 $t->set_block( "subscription_login_tpl", "login_tpl", "login" );
133 $t->set_block( "subscription_login_tpl", "error_message_tpl", "error_message" );
134 $t->set_var( "error_message" );
135 $t->set_var( "new", "" );
136 $t->set_var( "login", "" );
137 $t->set_var( "second_password", "" );
138 $t->set_var( "action_value", "login" );
139
140 if( isset( $New ) )
141 {
142 $t->parse( "second_password", "second_password_tpl" );
143 $t->set_var( "action_value", "create" );
144 $t->parse( "login", "login_tpl" );
145 }
146 else
147 {
148 $t->parse( "new", "new_tpl" );
149 }
150
151 if( isset( $error ) ) // parse the errors
152 {
153 if( $error == "emailerror" )
154 {
155 $t->set_var( "error_message", $languageIni->variable( "strings", "email_error" ) );
156 }
157 if( $error == "zeropassword")
158 {
159 $t->set_var( "error_message", $languageIni->variable( "strings", "zero_password_error" ) );
160 }
161 else
162 {
163 $t->set_var( $languageIni->variable( "strings", "unlike_passwords" ) );
164 }
165 $t->parse( "error_message", "error_message_tpl" );
166 }
167
168 $t->pparse( "output", "subscription_login_tpl" );
169
170 ?>
$session
$session
Definition: admin/articlelist.php:44
$Password
$Password
Definition: admin/seti.php:21
$Email
$Email
Definition: admin/useredit.php:414
eZBulkMailForgot
Definition: ezbulkmailforgot.php:57
eZBulkMailSubscriptionAddress
Definition: ezbulkmailsubscriptionaddress.php:40
eZBulkMailSubscriptionAddress\validate
static validate( $email, $password)
Definition: ezbulkmailsubscriptionaddress.php:345
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZINI
Reads and writes .ini style configuration files.
eZMail
Definition: ezmail.php:57
eZTemplate
Definition: eztemplate.php:107
$ini
$ini
Definition: classes/admin/linklist.php:64
$Action
$Action
Definition: companysearch.php:80
$error
$error
Definition: ezarticle/admin/categoryedit.php:51
$GlobalSiteIni
$GlobalSiteIni
Definition: ezarticle/xmlrpc/xmlrpcserver.php:33
$SiteDesign
$SiteDesign
Definition: ezbulkmail/user/datasupplier.php:31
exit
exit
Definition: folder.php:81
$headersInfo
$headersInfo
Definition: forgot.php:32
$t
if(isset( $Hash)) if(isset( $Ok)) $t
Definition: subscriptionlogin.php:120
$languageIni
$languageIni
Definition: subscriptionlogin.php:36
$TemplateDir
$TemplateDir
Definition: subscriptionlogin.php:35
$Language
$Language
Definition: subscriptionlogin.php:34
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.