|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* PendingUser class |
|
4
|
|
|
* |
|
5
|
|
|
* This file describes the PendingUser classes |
|
6
|
|
|
* |
|
7
|
|
|
* PHP version 5 and 7 |
|
8
|
|
|
* |
|
9
|
|
|
* @author Patrick Boyd / [email protected] |
|
10
|
|
|
* @copyright Copyright (c) 2015, Austin Artistic Reconstruction |
|
11
|
|
|
* @license http://www.apache.org/licenses/ Apache 2.0 License |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
namespace Auth; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* A class to abstract access to PendingUsers (users that have not completed registration) regardless of the Authentication type used. |
|
18
|
|
|
* |
|
19
|
|
|
* This class is the primary method to access pending user information. |
|
20
|
|
|
*/ |
|
21
|
|
|
class PendingUser extends User |
|
22
|
|
|
{ |
|
23
|
|
|
protected $intData = array(); |
|
24
|
|
|
|
|
25
|
|
|
public function getHash() |
|
26
|
|
|
{ |
|
27
|
|
|
return false; |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
public function getRegistrationTime() |
|
31
|
|
|
{ |
|
32
|
|
|
return false; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Is this user in the Group or a child of that group? |
|
37
|
|
|
* |
|
38
|
|
|
* @param string $name The name of the group to check if the user is in |
|
39
|
|
|
* |
|
40
|
|
|
* @return boolean True if the user is in the group, false otherwise |
|
41
|
|
|
*/ |
|
42
|
|
|
public function isInGroupNamed($name) |
|
43
|
|
|
{ |
|
44
|
|
|
return false; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
public function __get($propName) |
|
48
|
|
|
{ |
|
49
|
|
|
if(isset($this->intData[$propName])) |
|
50
|
|
|
{ |
|
51
|
|
|
return $this->intData[$propName]; |
|
52
|
|
|
} |
|
53
|
|
|
return parent::__get($propName); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function __set($propName, $value) |
|
57
|
|
|
{ |
|
58
|
|
|
$this->intData[$propName] = $value; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function __isset($propName) |
|
62
|
|
|
{ |
|
63
|
|
|
return isset($this->intData[$propName]); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Get the user's password as specified during registration |
|
68
|
|
|
* |
|
69
|
|
|
* We need the ability to obtain the user's unhashed plain text password to allow for it to be sent |
|
70
|
|
|
* to the correct backend which will hash it |
|
71
|
|
|
* |
|
72
|
|
|
* @return boolean|string The current password |
|
73
|
|
|
*/ |
|
74
|
|
|
public function getPassword() |
|
75
|
|
|
{ |
|
76
|
|
|
return false; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* Serialize the user data into a format usable by the json_encode method |
|
81
|
|
|
* |
|
82
|
|
|
* @return array A simple keyed array representing the user |
|
83
|
|
|
*/ |
|
84
|
|
|
public function jsonSerialize() |
|
85
|
|
|
{ |
|
86
|
|
|
$user = array(); |
|
87
|
|
|
$user['hash'] = $this->getHash(); |
|
88
|
|
|
$user['mail'] = $this->mail; |
|
|
|
|
|
|
89
|
|
|
$user['uid'] = $this->uid; |
|
|
|
|
|
|
90
|
|
|
$time = $this->getRegistrationTime(); |
|
91
|
|
|
if($time !== false) |
|
92
|
|
|
{ |
|
93
|
|
|
$user['time'] = $time->format(\DateTime::RFC822); |
|
|
|
|
|
|
94
|
|
|
} |
|
95
|
|
|
$user['class'] = get_class($this); |
|
96
|
|
|
return $user; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
public function sendEmail() |
|
100
|
|
|
{ |
|
101
|
|
|
$email_msg = new \Email\Email(); |
|
102
|
|
|
$email_msg->addToAddress($this->mail); |
|
|
|
|
|
|
103
|
|
|
$email_msg->setTextBody('Thank you for signing up with Burning Flipside. Your registration is not complete until you goto the address below. |
|
104
|
|
|
https://profiles.burningflipside.com/finish.php?hash='.$this->getHash().' |
|
105
|
|
|
Thank you, |
|
106
|
|
|
Burning Flipside Technology Team'); |
|
107
|
|
|
$email_msg->setHTMLBody('Thank you for signing up with Burning Flipside. Your registration is not complete until you follow the link below.<br/> |
|
108
|
|
|
<a href="https://profiles.burningflipside.com/finish.php?hash='.$this->getHash().'">Complete Registration</a><br/> |
|
109
|
|
|
Thank you,<br/> |
|
110
|
|
|
Burning Flipside Technology Team'); |
|
111
|
|
|
$email_msg->setSubject('Burning Flipside Registration'); |
|
112
|
|
|
$email_provider = \EmailProvider::getInstance(); |
|
113
|
|
|
if($email_provider->sendEmail($email_msg) === false) |
|
114
|
|
|
{ |
|
115
|
|
|
throw new \Exception('Unable to send email!'); |
|
116
|
|
|
} |
|
117
|
|
|
return true; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
public function delete() |
|
121
|
|
|
{ |
|
122
|
|
|
} |
|
123
|
|
|
} |
|
124
|
|
|
/* vim: set tabstop=4 shiftwidth=4 expandtab: */ |
|
125
|
|
|
|
Since your code implements the magic setter
_set, this function will be called for any write access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.