Completed
Pull Request — master (#29)
by
unknown
03:32
created

Auth/class.PendingUser.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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
    /** An instance of the Settings class */
26
    protected $settings;
27
    /** The prfiles app URL */
28
    protected $profilesUrl
29
30
    public function __construct($params)
0 ignored issues
show
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_PUBLIC, expecting ',' or ';'
Loading history...
31
    {
32
        parent::__construct($params);
33
        $this->settings = \Settings::getInstance();
34
        $this->profilesUrl = $this->settings->getGlobalSetting('profiles_url', 'https://profiles.burningflipside.com/');
35
    }
36
37
    public function getHash()
38
    {
39
        return false;
40
    }
41
42
    public function getRegistrationTime()
43
    {
44
        return false;
45
    }
46
47
    /**
48
     * Is this user in the Group or a child of that group?
49
     *
50
     * @param string $name The name of the group to check if the user is in
51
     *
52
     * @return boolean True if the user is in the group, false otherwise
53
     */
54
    public function isInGroupNamed($name)
55
    {
56
        return false;
57
    }
58
59
    public function __get($propName)
60
    {
61
        if(isset($this->intData[$propName]))
62
        {
63
            return $this->intData[$propName];
64
        }
65
        return parent::__get($propName);
66
    }
67
68
    public function __set($propName, $value)
69
    {
70
        $this->intData[$propName] = $value;
71
    }
72
73
    public function __isset($propName)
74
    {
75
        return isset($this->intData[$propName]);
76
    }
77
78
    /**
79
     * Get the user's password as specified during registration
80
     *
81
     * We need the ability to obtain the user's unhashed plain text password to allow for it to be sent 
82
     * to the correct backend which will hash it
83
     *
84
     * @return boolean|string The current password
85
     */
86
    public function getPassword()
87
    {
88
        return false;
89
    }
90
91
    /**
92
     * Serialize the user data into a format usable by the json_encode method
93
     *
94
     * @return array A simple keyed array representing the user
95
     */
96
    public function jsonSerialize()
97
    {
98
        $user = array();
99
        $user['hash'] = $this->getHash();
100
        $user['mail'] = $this->mail;
101
        $user['uid'] = $this->uid;
102
        $time = $this->getRegistrationTime();
103
        if($time !== false)
104
        {
105
            $user['time'] = $time->format(\DateTime::RFC822);
106
        }
107
        $user['class'] = get_class($this);
108
        return $user; 
109
    }
110
111
    public function sendEmail()
112
    {
113
        $email_msg = new \Email\Email();
114
        $email_msg->addToAddress($this->mail);
115
        $email_msg->setTextBody('Thank you for signing up with Burning Flipside. Your registration is not complete until you goto the address below.
116
                '.$this->profilesUrl.'/finish.php?hash='.$this->getHash().'
117
                Thank you,
118
                Burning Flipside Technology Team');
119
        $email_msg->setHTMLBody('Thank you for signing up with Burning Flipside. Your registration is not complete until you follow the link below.<br/>
120
                <a href="'.$this->profilesUrl.'/finish.php?hash='.$this->getHash().'">Complete Registration</a><br/>
121
                Thank you,<br/>
122
                Burning Flipside Technology Team');
123
        $email_msg->setSubject('Burning Flipside Registration');
124
        $email_provider = \EmailProvider::getInstance();
125
        if($email_provider->sendEmail($email_msg) === false)
126
        {
127
            throw new \Exception('Unable to send email!');
128
        }
129
        return true;
130
    }
131
132
    public function delete()
133
    {
134
    }
135
}
136
/* vim: set tabstop=4 shiftwidth=4 expandtab: */
137