eZ Publish  [4.0]
ezforgotpassword.php
Go to the documentation of this file.
00001 <?php
00002 //
00003 // Definition of eZForgotPassword class
00004 //
00005 // Created on: <17-Мар-2003 11:40:49 sp>
00006 //
00007 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00008 // SOFTWARE NAME: eZ Publish
00009 // SOFTWARE RELEASE: 4.0.x
00010 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS
00011 // SOFTWARE LICENSE: GNU General Public License v2.0
00012 // NOTICE: >
00013 //   This program is free software; you can redistribute it and/or
00014 //   modify it under the terms of version 2.0  of the GNU General
00015 //   Public License as published by the Free Software Foundation.
00016 //
00017 //   This program is distributed in the hope that it will be useful,
00018 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 //   GNU General Public License for more details.
00021 //
00022 //   You should have received a copy of version 2.0 of the GNU General
00023 //   Public License along with this program; if not, write to the Free
00024 //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00025 //   MA 02110-1301, USA.
00026 //
00027 //
00028 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00029 //
00030 
00031 /*! \file ezforgotpassword.php
00032 */
00033 
00034 /*!
00035   \class eZForgotPassword ezforgotpassword.php
00036   \ingroup eZDatatype
00037   \brief The class eZForgotPassword does
00038 
00039 */
00040 
00041 //include_once( 'kernel/classes/ezpersistentobject.php' );
00042 
00043 class eZForgotPassword extends eZPersistentObject
00044 {
00045     /*!
00046      Constructor
00047     */
00048     function eZForgotPassword( $row = array() )
00049     {
00050         $this->eZPersistentObject( $row );
00051     }
00052 
00053     static function definition()
00054     {
00055         return array( "fields" => array( "id" => array( 'name' => 'ID',
00056                                                         'datatype' => 'integer',
00057                                                         'default' => 0,
00058                                                         'required' => true ),
00059                                          "user_id" => array( 'name' => "UserID",
00060                                                              'datatype' => 'integer',
00061                                                              'default' => 0,
00062                                                              'required' => true,
00063                                                              'foreign_class' => 'eZUser',
00064                                                              'foreign_attribute' => 'contentobject_id',
00065                                                              'multiplicity' => '0..*' ),
00066                                          "hash_key" => array( 'name' => "HashKey",
00067                                                               'datatype' => 'string',
00068                                                               'default' => '',
00069                                                               'required' => true ),
00070                                          "time" => array( 'name' => "Time",
00071                                                           'datatype' => 'integer',
00072                                                           'default' => 0,
00073                                                           'required' => true ) ),
00074                       "keys" => array( "id" ),
00075                       "increment_key" => "id",
00076                       "sort" => array( "id" => "asc" ),
00077                       "class_name" => "eZForgotPassword",
00078                       "name" => "ezforgot_password" );
00079     }
00080 
00081     static function createNew( $userID, $hashKey, $time)
00082     {
00083         return new eZForgotPassword( array( "user_id" => $userID,
00084                                             "hash_key" => $hashKey,
00085                                             "time" => $time ) );
00086     }
00087 
00088     static function fetchByKey( $hashKey )
00089     {
00090         return eZPersistentObject::fetchObject( eZForgotPassword::definition(),
00091                                                 null,
00092                                                 array( "hash_key" => $hashKey ),
00093                                                 true );
00094     }
00095 
00096     /*!
00097      \static
00098      Removes all password reminders in the database.
00099     */
00100     static function cleanup()
00101     {
00102         $db = eZDB::instance();
00103         $db->query( "DELETE FROM ezforgot_password" );
00104     }
00105 
00106     /*!
00107      Remove forgot password entries belonging to user \a $userID
00108     */
00109     static function removeByUserID( $userID )
00110     {
00111         eZPersistentObject::removeObject( eZForgotPassword::definition(),
00112                                           array( 'user_id' => $userID ) );
00113     }
00114 }
00115 
00116 ?>