Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezbulkmailforgot.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezbulkmailforgot.php 9818 2003-05-16 13:15:58Z br $
5 //
6 // Created on: <20-Apr-2001 13:32:11 fh>
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
29
50 // include_once( "classes/ezdb.php" );
51 // include_once( "ezuser/classes/ezuser.php" );
52 // include_once( "ezuser/classes/ezusergroup.php" );
53 // include_once( "ezaddress/classes/ezaddress.php" );
54 // include_once( "ezsession/classes/ezsession.php" );
55
56 class eZBulkMailForgot
57 {
64 function __construct( $id=-1 )
65 {
66 $this->IsConnected = false;
67 if ( $id != -1 )
68 {
69 $this->ID = $id;
70 $this->get( $this->ID );
71 }
72 }
73
77 function store()
78 {
79 $db =& eZDB::globalDatabase();
80 $db->begin();
81
82 $this->Hash = md5( microTime() );
83 $password = $db->escapeString( $this->Password );
84
85 if ( !isset( $this->ID ) )
86 {
87 $db->lock( "eZBulkMail_Forgot" );
88 $nextID = $db->nextID( "eZBulkMail_Forgot", "ID" );
89
90 $result = $db->query( "INSERT INTO eZBulkMail_Forgot
91 ( ID, Mail, Password, Hash )
92 VALUES
93 ( '$nextID',
94 '$this->Mail',
95 '$password',
96 '$this->Hash' )
97 " );
98 $this->ID = $nextID;
99 $db->unlock();
100 }
101 else
102 {
103 $db->query( "UPDATE eZBulkMail_Forgot SET
104 Mail='$this->Mail',
105 Password='$password',
106 Hash='$this->Hash'
107 WHERE ID='$this->ID'" );
108 }
109
110 if ( $result == false )
111 $db->rollback( );
112 else
113 $db->commit();
114 }
115
120 function delete()
121 {
122 $db =& eZDB::globalDatabase();
123
124 if ( isset( $this->ID ) )
125 {
126 $db->begin();
127 $result = $db->query( "DELETE FROM eZBulkMail_Forgot WHERE ID='$this->ID'" );
128 if ( $result == false )
129 $db->rollback( );
130 else
131 $db->commit();
132 }
133 }
134
140 function get( $id=-1 )
141 {
142 $db =& eZDB::globalDatabase();
143
144 $ret = false;
145 if ( $id != "" )
146 {
147 $db->array_query( $forgot_array, "SELECT * FROM eZBulkMail_Forgot WHERE ID='$id'" );
148 if ( count( $forgot_array ) > 1 )
149 {
150 die( "Error: User's with the same ID was found in the database. This shouldn't happen." );
151 }
152 else if( count( $forgot_array ) == 1 )
153 {
154 $this->ID = $forgot_array[0][$db->fieldName( "ID" )];
155 $this->Mail = $forgot_array[0][$db->fieldName( "Mail" )];
156 $this->Password = $forgot_array[0][$db->fieldName( "Password" )];
157 $this->Time = $forgot_array[0][$db->fieldName( "Time" )];
158 $ret = true;
159 }
160 }
161 return $ret;
162 }
163
168 public static function getByEmail( $email )
169 {
170 $db =& eZDB::globalDatabase();
171 $email = addslashes( $email );
172 $db->array_query( $forgot_array, "SELECT ID FROM eZBulkMail_Forgot WHERE Mail='$email'" );
173
174 $return_value = false;
175 if( count( $forgot_array ) > 1 )
176 {
177 die( "Error: Subscription addresses with the same ID was found in the database. This shouldn't happen." );
178 }
179 else if( count( $forgot_array ) == 1 )
180 {
181 $id = $forgot_array[0][$db->fieldName( "ID" )];
182 $return_value = new eZBulkMailForgot( $id );
183 }
184 else
185 {
186 $is_valid = new eZBulkMailForgot();
187 $is_valid->setMail( $email );
188 $return_value = $is_valid;
189 }
190 return $return_value;
191 }
192
193
198 function check( $hash )
199 {
200 $db =& eZDB::globalDatabase();
201 $ret = false;
202 $hash = $db->escapeString( $hash );
203 $db->array_query( $forgot_array, "SELECT ID FROM eZBulkMail_Forgot WHERE Hash='$hash'" );
204
205 if ( count( $forgot_array ) == 1 )
206 {
207 $ret = $forgot_array[0][$db->fieldName( "ID" )];
208 }
209 return $ret;
210 }
211
215 function id()
216 {
217 return $this->ID;
218 }
219
223 function mail( )
224 {
225 return $this->Mail;
226 }
227
231 function setMail( $value )
232 {
233 $this->Mail = $value;
234 }
235
239 function setPassword( $value )
240 {
241 $this->Password = $value;
242 }
243
247 function password()
248 {
249 return $this->Password;
250 }
251
255 function hash()
256 {
257 return $this->Hash;
258 }
259
260 var $Mail;
261 var $Password;
262 var $ID;
263 var $Hash;
264 var $Time;
265
267 var $Database;
268
270 var $State_;
272 var $IsConnected;
273 }
274
275 ?>
eZBulkMailForgot
Definition: ezbulkmailforgot.php:57
eZBulkMailForgot\$Database
$Database
Variable for keeping the database connection.
Definition: ezbulkmailforgot.php:267
eZBulkMailForgot\store
store()
Definition: ezbulkmailforgot.php:77
eZBulkMailForgot\password
password()
Definition: ezbulkmailforgot.php:247
eZBulkMailForgot\$Hash
$Hash
Definition: ezbulkmailforgot.php:263
eZBulkMailForgot\hash
hash()
Definition: ezbulkmailforgot.php:255
eZBulkMailForgot\__construct
__construct( $id=-1)
Definition: ezbulkmailforgot.php:64
eZBulkMailForgot\setPassword
setPassword( $value)
Definition: ezbulkmailforgot.php:239
eZBulkMailForgot\$Time
$Time
Definition: ezbulkmailforgot.php:264
eZBulkMailForgot\getByEmail
static getByEmail( $email)
Definition: ezbulkmailforgot.php:168
eZBulkMailForgot\id
id()
Definition: ezbulkmailforgot.php:215
eZBulkMailForgot\$Password
$Password
Definition: ezbulkmailforgot.php:261
eZBulkMailForgot\mail
mail()
Definition: ezbulkmailforgot.php:223
eZBulkMailForgot\setMail
setMail( $value)
Definition: ezbulkmailforgot.php:231
eZBulkMailForgot\$State_
$State_
Indicates the state of the object. In regard to database information.
Definition: ezbulkmailforgot.php:270
eZBulkMailForgot\$ID
$ID
Definition: ezbulkmailforgot.php:262
eZBulkMailForgot\check
check( $hash)
Definition: ezbulkmailforgot.php:198
eZBulkMailForgot\$Mail
$Mail
Definition: ezbulkmailforgot.php:260
eZBulkMailForgot\$IsConnected
$IsConnected
Is true if the object has database connection, false if not.
Definition: ezbulkmailforgot.php:272
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
$result
$result
Definition: companysearch.php:94
$id
$id
Definition: companytypelist.php:193
$db
$db
Definition: ezarticle/user/authorlist.php:53
$ret
$ret
Definition: ezsitemanager/admin/filelist.php:88
Password
</td ></tr >< tr >< td style="color:<?= isset( $error['password1'] ) ?> Password
Definition: step1.php:146
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.