Completed
Pull Request — newinternal (#285)
by Simon
07:17 queued 04:17
created
includes/Helpers/Interfaces/IBlacklistHelper.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@
 block discarded – undo
10 10
 
11 11
 interface IBlacklistHelper
12 12
 {
13
-    /**
14
-     * Returns a value indicating whether the provided username is blacklisted by the on-wiki title blacklist
15
-     *
16
-     * @param string $username
17
-     *
18
-     * @return bool
19
-     */
20
-    public function isBlacklisted($username);
13
+	/**
14
+	 * Returns a value indicating whether the provided username is blacklisted by the on-wiki title blacklist
15
+	 *
16
+	 * @param string $username
17
+	 *
18
+	 * @return bool
19
+	 */
20
+	public function isBlacklisted($username);
21 21
 }
22 22
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Helpers/Interfaces/ITypeAheadHelper.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,16 +10,16 @@
 block discarded – undo
10 10
 
11 11
 interface ITypeAheadHelper
12 12
 {
13
-    /**
14
-     * @param string   $class     CSS class to apply this typeahead to.
15
-     * @param callable $generator Generator function taking no arguments to return an array of strings.
16
-     *
17
-     * @return void
18
-     */
19
-    public function defineTypeAheadSource($class, callable $generator);
13
+	/**
14
+	 * @param string   $class     CSS class to apply this typeahead to.
15
+	 * @param callable $generator Generator function taking no arguments to return an array of strings.
16
+	 *
17
+	 * @return void
18
+	 */
19
+	public function defineTypeAheadSource($class, callable $generator);
20 20
 
21
-    /**
22
-     * @return string HTML fragment containing a JS block for typeaheads.
23
-     */
24
-    public function getTypeAheadScriptBlock();
21
+	/**
22
+	 * @return string HTML fragment containing a JS block for typeaheads.
23
+	 */
24
+	public function getTypeAheadScriptBlock();
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Helpers/Interfaces/IOAuthHelper.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -15,39 +15,39 @@
 block discarded – undo
15 15
 
16 16
 interface IOAuthHelper
17 17
 {
18
-    /**
19
-     * @return stdClass
20
-     *
21
-     * @throws Exception
22
-     * @throws CurlException
23
-     */
24
-    public function getRequestToken();
18
+	/**
19
+	 * @return stdClass
20
+	 *
21
+	 * @throws Exception
22
+	 * @throws CurlException
23
+	 */
24
+	public function getRequestToken();
25 25
 
26
-    /**
27
-     * @param string $requestToken
28
-     *
29
-     * @return string
30
-     */
31
-    public function getAuthoriseUrl($requestToken);
26
+	/**
27
+	 * @param string $requestToken
28
+	 *
29
+	 * @return string
30
+	 */
31
+	public function getAuthoriseUrl($requestToken);
32 32
 
33
-    /**
34
-     * @param string $oauthRequestToken
35
-     * @param string $oauthRequestSecret
36
-     * @param string $oauthVerifier
37
-     *
38
-     * @return stdClass
39
-     * @throws CurlException
40
-     * @throws Exception
41
-     */
42
-    public function callbackCompleted($oauthRequestToken, $oauthRequestSecret, $oauthVerifier);
33
+	/**
34
+	 * @param string $oauthRequestToken
35
+	 * @param string $oauthRequestSecret
36
+	 * @param string $oauthVerifier
37
+	 *
38
+	 * @return stdClass
39
+	 * @throws CurlException
40
+	 * @throws Exception
41
+	 */
42
+	public function callbackCompleted($oauthRequestToken, $oauthRequestSecret, $oauthVerifier);
43 43
 
44
-    /**
45
-     * @param string $oauthAccessToken
46
-     * @param string $oauthAccessSecret
47
-     *
48
-     * @return JWT
49
-     * @throws CurlException
50
-     * @throws Exception
51
-     */
52
-    public function getIdentityTicket($oauthAccessToken, $oauthAccessSecret);
44
+	/**
45
+	 * @param string $oauthAccessToken
46
+	 * @param string $oauthAccessSecret
47
+	 *
48
+	 * @return JWT
49
+	 * @throws CurlException
50
+	 * @throws Exception
51
+	 */
52
+	public function getIdentityTicket($oauthAccessToken, $oauthAccessSecret);
53 53
 }
54 54
\ No newline at end of file
Please login to merge, or discard this patch.
includes/WebStart.php 1 patch
Indentation   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -29,223 +29,223 @@
 block discarded – undo
29 29
  */
30 30
 class WebStart extends ApplicationBase
31 31
 {
32
-    /**
33
-     * @var IRequestRouter $requestRouter The request router to use. Note that different entry points have different
34
-     *                                    routers and hence different URL mappings
35
-     */
36
-    private $requestRouter;
37
-    /**
38
-     * @var bool $isPublic Determines whether to use public interface objects or internal interface objects
39
-     */
40
-    private $isPublic = false;
41
-
42
-    /**
43
-     * WebStart constructor.
44
-     *
45
-     * @param SiteConfiguration $configuration The site configuration
46
-     * @param IRequestRouter    $router        The request router to use
47
-     */
48
-    public function __construct(SiteConfiguration $configuration, IRequestRouter $router)
49
-    {
50
-        parent::__construct($configuration);
51
-
52
-        $this->requestRouter = $router;
53
-    }
54
-
55
-    /**
56
-     * @param ITask             $page
57
-     * @param SiteConfiguration $siteConfiguration
58
-     * @param PdoDatabase       $database
59
-     * @param PdoDatabase       $notificationsDatabase
60
-     *
61
-     * @return void
62
-     */
63
-    protected function setupHelpers(
64
-        ITask $page,
65
-        SiteConfiguration $siteConfiguration,
66
-        PdoDatabase $database,
67
-        PdoDatabase $notificationsDatabase = null
68
-    ) {
69
-        parent::setupHelpers($page, $siteConfiguration, $database, $notificationsDatabase);
70
-
71
-        if ($page instanceof PageBase) {
72
-            $page->setTokenManager(new TokenManager());
73
-
74
-            if ($page instanceof InternalPageBase) {
75
-                $page->setTypeAheadHelper(new TypeAheadHelper());
76
-
77
-                $identificationVerifier = new IdentificationVerifier($page->getHttpHelper(), $siteConfiguration,
78
-                    $database);
79
-                $page->setIdentificationVerifier($identificationVerifier);
80
-
81
-                $page->setSecurityManager(new SecurityManager($identificationVerifier,
82
-                    $siteConfiguration->getForceIdentification()));
83
-
84
-                if ($siteConfiguration->getTitleBlacklistEnabled()) {
85
-                    $page->setBlacklistHelper(new FakeBlacklistHelper());
86
-                }
87
-                else {
88
-                    $page->setBlacklistHelper(new BlacklistHelper($page->getHttpHelper(),
89
-                        $siteConfiguration->getMediawikiWebServiceEndpoint()));
90
-                }
91
-            }
92
-        }
93
-    }
94
-
95
-    /**
96
-     * Application entry point.
97
-     *
98
-     * Sets up the environment and runs the application, performing any global cleanup operations when done.
99
-     */
100
-    public function run()
101
-    {
102
-        try {
103
-            if ($this->setupEnvironment()) {
104
-                $this->main();
105
-            }
106
-        }
107
-        catch (EnvironmentException $ex) {
108
-            ob_end_clean();
109
-            print Offline::getOfflineMessage($this->isPublic(), $ex->getMessage());
110
-        }
111
-        catch (ReadableException $ex) {
112
-            ob_end_clean();
113
-            print $ex->getReadableError();
114
-        }
115
-        finally {
116
-            $this->cleanupEnvironment();
117
-        }
118
-    }
119
-
120
-    /**
121
-     * Environment setup
122
-     *
123
-     * This method initialises the tool environment. If the tool cannot be initialised correctly, it will return false
124
-     * and shut down prematurely.
125
-     *
126
-     * @return bool
127
-     * @throws EnvironmentException
128
-     */
129
-    protected function setupEnvironment()
130
-    {
131
-        // initialise global exception handler
132
-        set_exception_handler(array(ExceptionHandler::class, 'exceptionHandler'));
133
-        set_error_handler(array(ExceptionHandler::class, 'errorHandler'), E_RECOVERABLE_ERROR);
134
-
135
-        // start output buffering if necessary
136
-        if (ob_get_level() === 0) {
137
-            ob_start();
138
-        }
139
-
140
-        // initialise super-global providers
141
-        WebRequest::setGlobalStateProvider(new GlobalStateProvider());
142
-
143
-        if (Offline::isOffline()) {
144
-            print Offline::getOfflineMessage($this->isPublic());
145
-            ob_end_flush();
146
-
147
-            return false;
148
-        }
149
-
150
-        // Call parent setup
151
-        if (!parent::setupEnvironment()) {
152
-            return false;
153
-        }
154
-
155
-        // Start up sessions
156
-        Session::start();
157
-
158
-        // Check the user is allowed to be logged in still. This must be before we call any user-loading functions and
159
-        // get the current user cached.
160
-        // I'm not sure if this function call being here is particularly a good thing, but it's part of starting up a
161
-        // session I suppose.
162
-        $this->checkForceLogout();
163
-
164
-        // environment initialised!
165
-        return true;
166
-    }
167
-
168
-    /**
169
-     * Main application logic
170
-     */
171
-    protected function main()
172
-    {
173
-        // Get the right route for the request
174
-        $page = $this->requestRouter->route();
175
-
176
-        $siteConfiguration = $this->getConfiguration();
177
-        $database = PdoDatabase::getDatabaseConnection('acc');
178
-
179
-        if ($siteConfiguration->getIrcNotificationsEnabled()) {
180
-            $notificationsDatabase = PdoDatabase::getDatabaseConnection('notifications');
181
-        }
182
-        else {
183
-            // @todo federated table here?
184
-            $notificationsDatabase = $database;
185
-        }
186
-
187
-        $this->setupHelpers($page, $siteConfiguration, $database, $notificationsDatabase);
188
-
189
-        /* @todo Remove this global statement! It's here for User.php, which does far more than it should. */
190
-        global $oauthHelper;
191
-        $oauthHelper = $page->getOAuthHelper();
192
-
193
-        /* @todo Remove this global statement! It's here for Request.php, which does far more than it should. */
194
-        global $globalXffTrustProvider;
195
-        $globalXffTrustProvider = $page->getXffTrustProvider();
196
-
197
-        // run the route code for the request.
198
-        $page->execute();
199
-    }
200
-
201
-    /**
202
-     * Any cleanup tasks should go here
203
-     *
204
-     * Note that we need to be very careful here, as exceptions may have been thrown and handled.
205
-     * This should *only* be for cleaning up, no logic should go here.
206
-     */
207
-    protected function cleanupEnvironment()
208
-    {
209
-        // Clean up anything we splurged after sending the page.
210
-        if (ob_get_level() > 0) {
211
-            for ($i = ob_get_level(); $i > 0; $i--) {
212
-                ob_end_clean();
213
-            }
214
-        }
215
-    }
216
-
217
-    private function checkForceLogout()
218
-    {
219
-        $database = PdoDatabase::getDatabaseConnection('acc');
220
-
221
-        $sessionUserId = WebRequest::getSessionUserId();
222
-        iF ($sessionUserId === null) {
223
-            return;
224
-        }
225
-
226
-        // Note, User::getCurrent() caches it's result, which we *really* don't want to trigger.
227
-        $currentUser = User::getById($sessionUserId, $database);
228
-
229
-        if ($currentUser === false) {
230
-            // Umm... this user has a session cookie with a userId set, but no user exists...
231
-            Session::restart();
232
-        }
233
-
234
-        if ($currentUser->getForceLogout()) {
235
-            Session::restart();
236
-
237
-            $currentUser->setForceLogout(false);
238
-            $currentUser->save();
239
-        }
240
-    }
241
-
242
-    public function isPublic()
243
-    {
244
-        return $this->isPublic;
245
-    }
246
-
247
-    public function setPublic($isPublic)
248
-    {
249
-        $this->isPublic = $isPublic;
250
-    }
32
+	/**
33
+	 * @var IRequestRouter $requestRouter The request router to use. Note that different entry points have different
34
+	 *                                    routers and hence different URL mappings
35
+	 */
36
+	private $requestRouter;
37
+	/**
38
+	 * @var bool $isPublic Determines whether to use public interface objects or internal interface objects
39
+	 */
40
+	private $isPublic = false;
41
+
42
+	/**
43
+	 * WebStart constructor.
44
+	 *
45
+	 * @param SiteConfiguration $configuration The site configuration
46
+	 * @param IRequestRouter    $router        The request router to use
47
+	 */
48
+	public function __construct(SiteConfiguration $configuration, IRequestRouter $router)
49
+	{
50
+		parent::__construct($configuration);
51
+
52
+		$this->requestRouter = $router;
53
+	}
54
+
55
+	/**
56
+	 * @param ITask             $page
57
+	 * @param SiteConfiguration $siteConfiguration
58
+	 * @param PdoDatabase       $database
59
+	 * @param PdoDatabase       $notificationsDatabase
60
+	 *
61
+	 * @return void
62
+	 */
63
+	protected function setupHelpers(
64
+		ITask $page,
65
+		SiteConfiguration $siteConfiguration,
66
+		PdoDatabase $database,
67
+		PdoDatabase $notificationsDatabase = null
68
+	) {
69
+		parent::setupHelpers($page, $siteConfiguration, $database, $notificationsDatabase);
70
+
71
+		if ($page instanceof PageBase) {
72
+			$page->setTokenManager(new TokenManager());
73
+
74
+			if ($page instanceof InternalPageBase) {
75
+				$page->setTypeAheadHelper(new TypeAheadHelper());
76
+
77
+				$identificationVerifier = new IdentificationVerifier($page->getHttpHelper(), $siteConfiguration,
78
+					$database);
79
+				$page->setIdentificationVerifier($identificationVerifier);
80
+
81
+				$page->setSecurityManager(new SecurityManager($identificationVerifier,
82
+					$siteConfiguration->getForceIdentification()));
83
+
84
+				if ($siteConfiguration->getTitleBlacklistEnabled()) {
85
+					$page->setBlacklistHelper(new FakeBlacklistHelper());
86
+				}
87
+				else {
88
+					$page->setBlacklistHelper(new BlacklistHelper($page->getHttpHelper(),
89
+						$siteConfiguration->getMediawikiWebServiceEndpoint()));
90
+				}
91
+			}
92
+		}
93
+	}
94
+
95
+	/**
96
+	 * Application entry point.
97
+	 *
98
+	 * Sets up the environment and runs the application, performing any global cleanup operations when done.
99
+	 */
100
+	public function run()
101
+	{
102
+		try {
103
+			if ($this->setupEnvironment()) {
104
+				$this->main();
105
+			}
106
+		}
107
+		catch (EnvironmentException $ex) {
108
+			ob_end_clean();
109
+			print Offline::getOfflineMessage($this->isPublic(), $ex->getMessage());
110
+		}
111
+		catch (ReadableException $ex) {
112
+			ob_end_clean();
113
+			print $ex->getReadableError();
114
+		}
115
+		finally {
116
+			$this->cleanupEnvironment();
117
+		}
118
+	}
119
+
120
+	/**
121
+	 * Environment setup
122
+	 *
123
+	 * This method initialises the tool environment. If the tool cannot be initialised correctly, it will return false
124
+	 * and shut down prematurely.
125
+	 *
126
+	 * @return bool
127
+	 * @throws EnvironmentException
128
+	 */
129
+	protected function setupEnvironment()
130
+	{
131
+		// initialise global exception handler
132
+		set_exception_handler(array(ExceptionHandler::class, 'exceptionHandler'));
133
+		set_error_handler(array(ExceptionHandler::class, 'errorHandler'), E_RECOVERABLE_ERROR);
134
+
135
+		// start output buffering if necessary
136
+		if (ob_get_level() === 0) {
137
+			ob_start();
138
+		}
139
+
140
+		// initialise super-global providers
141
+		WebRequest::setGlobalStateProvider(new GlobalStateProvider());
142
+
143
+		if (Offline::isOffline()) {
144
+			print Offline::getOfflineMessage($this->isPublic());
145
+			ob_end_flush();
146
+
147
+			return false;
148
+		}
149
+
150
+		// Call parent setup
151
+		if (!parent::setupEnvironment()) {
152
+			return false;
153
+		}
154
+
155
+		// Start up sessions
156
+		Session::start();
157
+
158
+		// Check the user is allowed to be logged in still. This must be before we call any user-loading functions and
159
+		// get the current user cached.
160
+		// I'm not sure if this function call being here is particularly a good thing, but it's part of starting up a
161
+		// session I suppose.
162
+		$this->checkForceLogout();
163
+
164
+		// environment initialised!
165
+		return true;
166
+	}
167
+
168
+	/**
169
+	 * Main application logic
170
+	 */
171
+	protected function main()
172
+	{
173
+		// Get the right route for the request
174
+		$page = $this->requestRouter->route();
175
+
176
+		$siteConfiguration = $this->getConfiguration();
177
+		$database = PdoDatabase::getDatabaseConnection('acc');
178
+
179
+		if ($siteConfiguration->getIrcNotificationsEnabled()) {
180
+			$notificationsDatabase = PdoDatabase::getDatabaseConnection('notifications');
181
+		}
182
+		else {
183
+			// @todo federated table here?
184
+			$notificationsDatabase = $database;
185
+		}
186
+
187
+		$this->setupHelpers($page, $siteConfiguration, $database, $notificationsDatabase);
188
+
189
+		/* @todo Remove this global statement! It's here for User.php, which does far more than it should. */
190
+		global $oauthHelper;
191
+		$oauthHelper = $page->getOAuthHelper();
192
+
193
+		/* @todo Remove this global statement! It's here for Request.php, which does far more than it should. */
194
+		global $globalXffTrustProvider;
195
+		$globalXffTrustProvider = $page->getXffTrustProvider();
196
+
197
+		// run the route code for the request.
198
+		$page->execute();
199
+	}
200
+
201
+	/**
202
+	 * Any cleanup tasks should go here
203
+	 *
204
+	 * Note that we need to be very careful here, as exceptions may have been thrown and handled.
205
+	 * This should *only* be for cleaning up, no logic should go here.
206
+	 */
207
+	protected function cleanupEnvironment()
208
+	{
209
+		// Clean up anything we splurged after sending the page.
210
+		if (ob_get_level() > 0) {
211
+			for ($i = ob_get_level(); $i > 0; $i--) {
212
+				ob_end_clean();
213
+			}
214
+		}
215
+	}
216
+
217
+	private function checkForceLogout()
218
+	{
219
+		$database = PdoDatabase::getDatabaseConnection('acc');
220
+
221
+		$sessionUserId = WebRequest::getSessionUserId();
222
+		iF ($sessionUserId === null) {
223
+			return;
224
+		}
225
+
226
+		// Note, User::getCurrent() caches it's result, which we *really* don't want to trigger.
227
+		$currentUser = User::getById($sessionUserId, $database);
228
+
229
+		if ($currentUser === false) {
230
+			// Umm... this user has a session cookie with a userId set, but no user exists...
231
+			Session::restart();
232
+		}
233
+
234
+		if ($currentUser->getForceLogout()) {
235
+			Session::restart();
236
+
237
+			$currentUser->setForceLogout(false);
238
+			$currentUser->save();
239
+		}
240
+	}
241
+
242
+	public function isPublic()
243
+	{
244
+		return $this->isPublic;
245
+	}
246
+
247
+	public function setPublic($isPublic)
248
+	{
249
+		$this->isPublic = $isPublic;
250
+	}
251 251
 }
Please login to merge, or discard this patch.
includes/DataObjects/RDnsCache.php 1 patch
Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -19,110 +19,110 @@
 block discarded – undo
19 19
  */
20 20
 class RDnsCache extends DataObject
21 21
 {
22
-    private $address;
23
-    private $data;
24
-    private $creation;
25
-
26
-    /**
27
-     * @param string      $address
28
-     * @param PdoDatabase $database
29
-     *
30
-     * @return RDnsCache|false
31
-     */
32
-    public static function getByAddress($address, PdoDatabase $database)
33
-    {
34
-        // @todo add cache invalidation (timestamp?)
35
-        $statement = $database->prepare("SELECT * FROM rdnscache WHERE address = :id LIMIT 1;");
36
-        $statement->bindValue(":id", $address);
37
-
38
-        $statement->execute();
39
-
40
-        $resultObject = $statement->fetchObject(get_called_class());
41
-
42
-        if ($resultObject != false) {
43
-            $resultObject->setDatabase($database);
44
-        }
45
-
46
-        return $resultObject;
47
-    }
48
-
49
-    public function save()
50
-    {
51
-        if ($this->isNew()) {
52
-            // insert
53
-            $statement = $this->dbObject->prepare(<<<SQL
22
+	private $address;
23
+	private $data;
24
+	private $creation;
25
+
26
+	/**
27
+	 * @param string      $address
28
+	 * @param PdoDatabase $database
29
+	 *
30
+	 * @return RDnsCache|false
31
+	 */
32
+	public static function getByAddress($address, PdoDatabase $database)
33
+	{
34
+		// @todo add cache invalidation (timestamp?)
35
+		$statement = $database->prepare("SELECT * FROM rdnscache WHERE address = :id LIMIT 1;");
36
+		$statement->bindValue(":id", $address);
37
+
38
+		$statement->execute();
39
+
40
+		$resultObject = $statement->fetchObject(get_called_class());
41
+
42
+		if ($resultObject != false) {
43
+			$resultObject->setDatabase($database);
44
+		}
45
+
46
+		return $resultObject;
47
+	}
48
+
49
+	public function save()
50
+	{
51
+		if ($this->isNew()) {
52
+			// insert
53
+			$statement = $this->dbObject->prepare(<<<SQL
54 54
 INSERT INTO `rdnscache` (address, data) VALUES (:address, :data);
55 55
 SQL
56
-            );
57
-            $statement->bindValue(":address", $this->address);
58
-            $statement->bindValue(":data", $this->data);
59
-
60
-            if ($statement->execute()) {
61
-                $this->id = (int)$this->dbObject->lastInsertId();
62
-            }
63
-            else {
64
-                throw new Exception($statement->errorInfo());
65
-            }
66
-        }
67
-        else {
68
-            // update
69
-            $statement = $this->dbObject->prepare(<<<SQL
56
+			);
57
+			$statement->bindValue(":address", $this->address);
58
+			$statement->bindValue(":data", $this->data);
59
+
60
+			if ($statement->execute()) {
61
+				$this->id = (int)$this->dbObject->lastInsertId();
62
+			}
63
+			else {
64
+				throw new Exception($statement->errorInfo());
65
+			}
66
+		}
67
+		else {
68
+			// update
69
+			$statement = $this->dbObject->prepare(<<<SQL
70 70
 UPDATE `rdnscache`
71 71
 SET address = :address, data = :data, updateversion = updateversion + 1
72 72
 WHERE id = :id AND updateversion = :updateversion
73 73
 LIMIT 1;
74 74
 SQL
75
-            );
76
-
77
-            $statement->bindValue(':id', $this->id);
78
-            $statement->bindValue(':updateversion', $this->updateversion);
79
-
80
-            $statement->bindValue(':address', $this->address);
81
-            $statement->bindValue(':data', $this->data);
82
-
83
-            if (!$statement->execute()) {
84
-                throw new Exception($statement->errorInfo());
85
-            }
86
-
87
-            if ($statement->rowCount() !== 1) {
88
-                throw new OptimisticLockFailedException();
89
-            }
90
-
91
-            $this->updateversion++;
92
-        }
93
-    }
94
-
95
-    public function getAddress()
96
-    {
97
-        return $this->address;
98
-    }
99
-
100
-    /**
101
-     * @param string $address
102
-     */
103
-    public function setAddress($address)
104
-    {
105
-        $this->address = $address;
106
-    }
107
-
108
-    /**
109
-     * @return string
110
-     */
111
-    public function getData()
112
-    {
113
-        return unserialize($this->data);
114
-    }
115
-
116
-    public function setData($data)
117
-    {
118
-        $this->data = serialize($data);
119
-    }
120
-
121
-    /**
122
-     * @return DateTimeImmutable
123
-     */
124
-    public function getCreation()
125
-    {
126
-        return new DateTimeImmutable($this->creation);
127
-    }
75
+			);
76
+
77
+			$statement->bindValue(':id', $this->id);
78
+			$statement->bindValue(':updateversion', $this->updateversion);
79
+
80
+			$statement->bindValue(':address', $this->address);
81
+			$statement->bindValue(':data', $this->data);
82
+
83
+			if (!$statement->execute()) {
84
+				throw new Exception($statement->errorInfo());
85
+			}
86
+
87
+			if ($statement->rowCount() !== 1) {
88
+				throw new OptimisticLockFailedException();
89
+			}
90
+
91
+			$this->updateversion++;
92
+		}
93
+	}
94
+
95
+	public function getAddress()
96
+	{
97
+		return $this->address;
98
+	}
99
+
100
+	/**
101
+	 * @param string $address
102
+	 */
103
+	public function setAddress($address)
104
+	{
105
+		$this->address = $address;
106
+	}
107
+
108
+	/**
109
+	 * @return string
110
+	 */
111
+	public function getData()
112
+	{
113
+		return unserialize($this->data);
114
+	}
115
+
116
+	public function setData($data)
117
+	{
118
+		$this->data = serialize($data);
119
+	}
120
+
121
+	/**
122
+	 * @return DateTimeImmutable
123
+	 */
124
+	public function getCreation()
125
+	{
126
+		return new DateTimeImmutable($this->creation);
127
+	}
128 128
 }
Please login to merge, or discard this patch.
includes/DataObjects/Notification.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -22,73 +22,73 @@
 block discarded – undo
22 22
  */
23 23
 class Notification extends DataObject
24 24
 {
25
-    private $date;
26
-    private $type;
27
-    private $text;
25
+	private $date;
26
+	private $type;
27
+	private $text;
28 28
 
29
-    public function delete()
30
-    {
31
-        throw new Exception("You shouldn't be doing this...");
32
-    }
29
+	public function delete()
30
+	{
31
+		throw new Exception("You shouldn't be doing this...");
32
+	}
33 33
 
34
-    public function save()
35
-    {
36
-        if ($this->isNew()) {
37
-            // insert
38
-            $statement = $this->dbObject->prepare("INSERT INTO notification ( type, text ) VALUES ( :type, :text );");
39
-            $statement->bindValue(":type", $this->type);
40
-            $statement->bindValue(":text", $this->text);
34
+	public function save()
35
+	{
36
+		if ($this->isNew()) {
37
+			// insert
38
+			$statement = $this->dbObject->prepare("INSERT INTO notification ( type, text ) VALUES ( :type, :text );");
39
+			$statement->bindValue(":type", $this->type);
40
+			$statement->bindValue(":text", $this->text);
41 41
 
42
-            if ($statement->execute()) {
43
-                $this->id = (int)$this->dbObject->lastInsertId();
44
-            }
45
-            else {
46
-                throw new Exception($statement->errorInfo());
47
-            }
48
-        }
49
-        else {
50
-            throw new Exception("You shouldn't be doing this...");
51
-        }
52
-    }
42
+			if ($statement->execute()) {
43
+				$this->id = (int)$this->dbObject->lastInsertId();
44
+			}
45
+			else {
46
+				throw new Exception($statement->errorInfo());
47
+			}
48
+		}
49
+		else {
50
+			throw new Exception("You shouldn't be doing this...");
51
+		}
52
+	}
53 53
 
54
-    public function getDate()
55
-    {
56
-        return new DateTimeImmutable($this->date);
57
-    }
54
+	public function getDate()
55
+	{
56
+		return new DateTimeImmutable($this->date);
57
+	}
58 58
 
59
-    /**
60
-     * @return int
61
-     */
62
-    public function getType()
63
-    {
64
-        return $this->type;
65
-    }
59
+	/**
60
+	 * @return int
61
+	 */
62
+	public function getType()
63
+	{
64
+		return $this->type;
65
+	}
66 66
 
67
-    /**
68
-     * @return string
69
-     */
70
-    public function getText()
71
-    {
72
-        return $this->text;
73
-    }
67
+	/**
68
+	 * @return string
69
+	 */
70
+	public function getText()
71
+	{
72
+		return $this->text;
73
+	}
74 74
 
75
-    /**
76
-     * Summary of setType
77
-     *
78
-     * @param int $type
79
-     */
80
-    public function setType($type)
81
-    {
82
-        $this->type = $type;
83
-    }
75
+	/**
76
+	 * Summary of setType
77
+	 *
78
+	 * @param int $type
79
+	 */
80
+	public function setType($type)
81
+	{
82
+		$this->type = $type;
83
+	}
84 84
 
85
-    /**
86
-     * Summary of setText
87
-     *
88
-     * @param string $text
89
-     */
90
-    public function setText($text)
91
-    {
92
-        $this->text = $text;
93
-    }
85
+	/**
86
+	 * Summary of setText
87
+	 *
88
+	 * @param string $text
89
+	 */
90
+	public function setText($text)
91
+	{
92
+		$this->text = $text;
93
+	}
94 94
 }
Please login to merge, or discard this patch.
includes/DataObjects/Ban.php 1 patch
Indentation   +239 added lines, -239 removed lines patch added patch discarded remove patch
@@ -19,268 +19,268 @@
 block discarded – undo
19 19
  */
20 20
 class Ban extends DataObject
21 21
 {
22
-    private $type;
23
-    private $target;
24
-    private $user;
25
-    private $reason;
26
-    private $date;
27
-    private $duration;
28
-    private $active;
29
-
30
-    /**
31
-     * Gets all active bans, filtered by the optional target.
32
-     *
33
-     * @param string|null $target
34
-     * @param PdoDatabase $database
35
-     *
36
-     * @return Ban[]
37
-     */
38
-    public static function getActiveBans($target, PdoDatabase $database)
39
-    {
40
-        if ($target !== null) {
41
-            $query = <<<SQL
22
+	private $type;
23
+	private $target;
24
+	private $user;
25
+	private $reason;
26
+	private $date;
27
+	private $duration;
28
+	private $active;
29
+
30
+	/**
31
+	 * Gets all active bans, filtered by the optional target.
32
+	 *
33
+	 * @param string|null $target
34
+	 * @param PdoDatabase $database
35
+	 *
36
+	 * @return Ban[]
37
+	 */
38
+	public static function getActiveBans($target, PdoDatabase $database)
39
+	{
40
+		if ($target !== null) {
41
+			$query = <<<SQL
42 42
 SELECT * FROM ban WHERE target = :target AND (duration > UNIX_TIMESTAMP() OR duration = -1) AND active = 1;
43 43
 SQL;
44
-            $statement = $database->prepare($query);
45
-            $statement->bindValue(":target", $target);
46
-        }
47
-        else {
48
-            $query = "SELECT * FROM ban WHERE (duration > UNIX_TIMESTAMP() OR duration = -1) AND active = 1;";
49
-            $statement = $database->prepare($query);
50
-        }
51
-
52
-        $statement->execute();
53
-
54
-        $result = array();
55
-
56
-        /** @var Ban $v */
57
-        foreach ($statement->fetchAll(PDO::FETCH_CLASS, get_called_class()) as $v) {
58
-            $v->setDatabase($database);
59
-            $result[] = $v;
60
-        }
61
-
62
-        return $result;
63
-    }
64
-
65
-    /**
66
-     * Gets a ban by it's ID if it's currently active.
67
-     *
68
-     * @param     integer $id
69
-     * @param PdoDatabase $database
70
-     *
71
-     * @return Ban
72
-     */
73
-    public static function getActiveId($id, PdoDatabase $database)
74
-    {
75
-        $statement = $database->prepare(<<<SQL
44
+			$statement = $database->prepare($query);
45
+			$statement->bindValue(":target", $target);
46
+		}
47
+		else {
48
+			$query = "SELECT * FROM ban WHERE (duration > UNIX_TIMESTAMP() OR duration = -1) AND active = 1;";
49
+			$statement = $database->prepare($query);
50
+		}
51
+
52
+		$statement->execute();
53
+
54
+		$result = array();
55
+
56
+		/** @var Ban $v */
57
+		foreach ($statement->fetchAll(PDO::FETCH_CLASS, get_called_class()) as $v) {
58
+			$v->setDatabase($database);
59
+			$result[] = $v;
60
+		}
61
+
62
+		return $result;
63
+	}
64
+
65
+	/**
66
+	 * Gets a ban by it's ID if it's currently active.
67
+	 *
68
+	 * @param     integer $id
69
+	 * @param PdoDatabase $database
70
+	 *
71
+	 * @return Ban
72
+	 */
73
+	public static function getActiveId($id, PdoDatabase $database)
74
+	{
75
+		$statement = $database->prepare(<<<SQL
76 76
 SELECT *
77 77
 FROM ban
78 78
 WHERE id = :id  AND (duration > UNIX_TIMESTAMP() OR duration = -1) AND active = 1;
79 79
 SQL
80
-        );
81
-        $statement->bindValue(":id", $id);
82
-
83
-        $statement->execute();
84
-
85
-        $resultObject = $statement->fetchObject(get_called_class());
86
-
87
-        if ($resultObject != false) {
88
-            $resultObject->setDatabase($database);
89
-        }
90
-
91
-        return $resultObject;
92
-    }
93
-
94
-    /**
95
-     * Get all active bans for a target and type.
96
-     *
97
-     * @param string      $target
98
-     * @param string      $type
99
-     * @param PdoDatabase $database
100
-     *
101
-     * @return Ban
102
-     */
103
-    public static function getBanByTarget($target, $type, PdoDatabase $database)
104
-    {
105
-        $query = <<<SQL
80
+		);
81
+		$statement->bindValue(":id", $id);
82
+
83
+		$statement->execute();
84
+
85
+		$resultObject = $statement->fetchObject(get_called_class());
86
+
87
+		if ($resultObject != false) {
88
+			$resultObject->setDatabase($database);
89
+		}
90
+
91
+		return $resultObject;
92
+	}
93
+
94
+	/**
95
+	 * Get all active bans for a target and type.
96
+	 *
97
+	 * @param string      $target
98
+	 * @param string      $type
99
+	 * @param PdoDatabase $database
100
+	 *
101
+	 * @return Ban
102
+	 */
103
+	public static function getBanByTarget($target, $type, PdoDatabase $database)
104
+	{
105
+		$query = <<<SQL
106 106
 SELECT * FROM ban
107 107
 WHERE type = :type
108 108
 	AND target = :target
109 109
 	AND (duration > UNIX_TIMESTAMP() OR duration = -1)
110 110
 	AND active = 1;
111 111
 SQL;
112
-        $statement = $database->prepare($query);
113
-        $statement->bindValue(":target", $target);
114
-        $statement->bindValue(":type", $type);
112
+		$statement = $database->prepare($query);
113
+		$statement->bindValue(":target", $target);
114
+		$statement->bindValue(":type", $type);
115 115
 
116
-        $statement->execute();
116
+		$statement->execute();
117 117
 
118
-        $resultObject = $statement->fetchObject(get_called_class());
118
+		$resultObject = $statement->fetchObject(get_called_class());
119 119
 
120
-        if ($resultObject != false) {
121
-            $resultObject->setDatabase($database);
122
-        }
120
+		if ($resultObject != false) {
121
+			$resultObject->setDatabase($database);
122
+		}
123 123
 
124
-        return $resultObject;
125
-    }
124
+		return $resultObject;
125
+	}
126 126
 
127
-    /**
128
-     * @throws Exception
129
-     */
130
-    public function save()
131
-    {
132
-        if ($this->isNew()) {
133
-            // insert
134
-            $statement = $this->dbObject->prepare(<<<SQL
127
+	/**
128
+	 * @throws Exception
129
+	 */
130
+	public function save()
131
+	{
132
+		if ($this->isNew()) {
133
+			// insert
134
+			$statement = $this->dbObject->prepare(<<<SQL
135 135
 INSERT INTO `ban` (type, target, user, reason, date, duration, active)
136 136
 VALUES (:type, :target, :user, :reason, CURRENT_TIMESTAMP(), :duration, :active);
137 137
 SQL
138
-            );
139
-            $statement->bindValue(":type", $this->type);
140
-            $statement->bindValue(":target", $this->target);
141
-            $statement->bindValue(":user", $this->user);
142
-            $statement->bindValue(":reason", $this->reason);
143
-            $statement->bindValue(":duration", $this->duration);
144
-            $statement->bindValue(":active", $this->active);
145
-
146
-            if ($statement->execute()) {
147
-                $this->id = (int)$this->dbObject->lastInsertId();
148
-            }
149
-            else {
150
-                throw new Exception($statement->errorInfo());
151
-            }
152
-        }
153
-        else {
154
-            // update
155
-            $statement = $this->dbObject->prepare(<<<SQL
138
+			);
139
+			$statement->bindValue(":type", $this->type);
140
+			$statement->bindValue(":target", $this->target);
141
+			$statement->bindValue(":user", $this->user);
142
+			$statement->bindValue(":reason", $this->reason);
143
+			$statement->bindValue(":duration", $this->duration);
144
+			$statement->bindValue(":active", $this->active);
145
+
146
+			if ($statement->execute()) {
147
+				$this->id = (int)$this->dbObject->lastInsertId();
148
+			}
149
+			else {
150
+				throw new Exception($statement->errorInfo());
151
+			}
152
+		}
153
+		else {
154
+			// update
155
+			$statement = $this->dbObject->prepare(<<<SQL
156 156
 UPDATE `ban`
157 157
 SET duration = :duration, active = :active, user = :user, updateversion = updateversion + 1
158 158
 WHERE id = :id AND updateversion = :updateversion
159 159
 LIMIT 1;
160 160
 SQL
161
-            );
162
-            $statement->bindValue(':id', $this->id);
163
-            $statement->bindValue(':updateversion', $this->updateversion);
164
-
165
-            $statement->bindValue(':duration', $this->duration);
166
-            $statement->bindValue(':active', $this->active);
167
-            $statement->bindValue(':user', $this->user);
168
-
169
-            if (!$statement->execute()) {
170
-                throw new Exception($statement->errorInfo());
171
-            }
172
-
173
-            if ($statement->rowCount() !== 1) {
174
-                throw new OptimisticLockFailedException();
175
-            }
176
-
177
-            $this->updateversion++;
178
-        }
179
-    }
180
-
181
-    /**
182
-     * @return string
183
-     */
184
-    public function getType()
185
-    {
186
-        return $this->type;
187
-    }
188
-
189
-    /**
190
-     * @param string $type
191
-     */
192
-    public function setType($type)
193
-    {
194
-        $this->type = $type;
195
-    }
196
-
197
-    /**
198
-     * @return string
199
-     */
200
-    public function getTarget()
201
-    {
202
-        return $this->target;
203
-    }
204
-
205
-    /**
206
-     * @param string $target
207
-     */
208
-    public function setTarget($target)
209
-    {
210
-        $this->target = $target;
211
-    }
212
-
213
-    /**
214
-     * @return string
215
-     */
216
-    public function getReason()
217
-    {
218
-        return $this->reason;
219
-    }
220
-
221
-    /**
222
-     * @param string $reason
223
-     */
224
-    public function setReason($reason)
225
-    {
226
-        $this->reason = $reason;
227
-    }
228
-
229
-    /**
230
-     * @return mixed
231
-     */
232
-    public function getDate()
233
-    {
234
-        return $this->date;
235
-    }
236
-
237
-    /**
238
-     * @return mixed
239
-     */
240
-    public function getDuration()
241
-    {
242
-        return $this->duration;
243
-    }
244
-
245
-    /**
246
-     * @param mixed $duration
247
-     */
248
-    public function setDuration($duration)
249
-    {
250
-        $this->duration = $duration;
251
-    }
252
-
253
-    /**
254
-     * @return bool
255
-     */
256
-    public function isActive()
257
-    {
258
-        return $this->active == 1;
259
-    }
260
-
261
-    /**
262
-     * @param bool $active
263
-     */
264
-    public function setActive($active)
265
-    {
266
-        $this->active = $active ? 1 : 0;
267
-    }
268
-
269
-    /**
270
-     * @return int
271
-     */
272
-    public function getUser()
273
-    {
274
-        return $this->user;
275
-    }
276
-
277
-    /**
278
-     * @param int $user UserID of user who is setting the ban
279
-     *
280
-     * @throws Exception
281
-     */
282
-    public function setUser($user)
283
-    {
284
-        $this->user = $user;
285
-    }
161
+			);
162
+			$statement->bindValue(':id', $this->id);
163
+			$statement->bindValue(':updateversion', $this->updateversion);
164
+
165
+			$statement->bindValue(':duration', $this->duration);
166
+			$statement->bindValue(':active', $this->active);
167
+			$statement->bindValue(':user', $this->user);
168
+
169
+			if (!$statement->execute()) {
170
+				throw new Exception($statement->errorInfo());
171
+			}
172
+
173
+			if ($statement->rowCount() !== 1) {
174
+				throw new OptimisticLockFailedException();
175
+			}
176
+
177
+			$this->updateversion++;
178
+		}
179
+	}
180
+
181
+	/**
182
+	 * @return string
183
+	 */
184
+	public function getType()
185
+	{
186
+		return $this->type;
187
+	}
188
+
189
+	/**
190
+	 * @param string $type
191
+	 */
192
+	public function setType($type)
193
+	{
194
+		$this->type = $type;
195
+	}
196
+
197
+	/**
198
+	 * @return string
199
+	 */
200
+	public function getTarget()
201
+	{
202
+		return $this->target;
203
+	}
204
+
205
+	/**
206
+	 * @param string $target
207
+	 */
208
+	public function setTarget($target)
209
+	{
210
+		$this->target = $target;
211
+	}
212
+
213
+	/**
214
+	 * @return string
215
+	 */
216
+	public function getReason()
217
+	{
218
+		return $this->reason;
219
+	}
220
+
221
+	/**
222
+	 * @param string $reason
223
+	 */
224
+	public function setReason($reason)
225
+	{
226
+		$this->reason = $reason;
227
+	}
228
+
229
+	/**
230
+	 * @return mixed
231
+	 */
232
+	public function getDate()
233
+	{
234
+		return $this->date;
235
+	}
236
+
237
+	/**
238
+	 * @return mixed
239
+	 */
240
+	public function getDuration()
241
+	{
242
+		return $this->duration;
243
+	}
244
+
245
+	/**
246
+	 * @param mixed $duration
247
+	 */
248
+	public function setDuration($duration)
249
+	{
250
+		$this->duration = $duration;
251
+	}
252
+
253
+	/**
254
+	 * @return bool
255
+	 */
256
+	public function isActive()
257
+	{
258
+		return $this->active == 1;
259
+	}
260
+
261
+	/**
262
+	 * @param bool $active
263
+	 */
264
+	public function setActive($active)
265
+	{
266
+		$this->active = $active ? 1 : 0;
267
+	}
268
+
269
+	/**
270
+	 * @return int
271
+	 */
272
+	public function getUser()
273
+	{
274
+		return $this->user;
275
+	}
276
+
277
+	/**
278
+	 * @param int $user UserID of user who is setting the ban
279
+	 *
280
+	 * @throws Exception
281
+	 */
282
+	public function setUser($user)
283
+	{
284
+		$this->user = $user;
285
+	}
286 286
 }
Please login to merge, or discard this patch.
includes/DataObjects/SiteNotice.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -20,75 +20,75 @@
 block discarded – undo
20 20
  */
21 21
 class SiteNotice extends DataObject
22 22
 {
23
-    /** @var string */
24
-    private $content;
23
+	/** @var string */
24
+	private $content;
25 25
 
26
-    /**
27
-     * Get a message.
28
-     *
29
-     * @param PdoDatabase $database
30
-     *
31
-     * @return string The content for display
32
-     */
33
-    public static function get(PdoDatabase $database)
34
-    {
35
-        /** @var SiteNotice $message */
36
-        $message = self::getById(1, $database);
26
+	/**
27
+	 * Get a message.
28
+	 *
29
+	 * @param PdoDatabase $database
30
+	 *
31
+	 * @return string The content for display
32
+	 */
33
+	public static function get(PdoDatabase $database)
34
+	{
35
+		/** @var SiteNotice $message */
36
+		$message = self::getById(1, $database);
37 37
 
38
-        return $message->getContent();
39
-    }
38
+		return $message->getContent();
39
+	}
40 40
 
41
-    /**
42
-     * Saves the object
43
-     * @throws Exception
44
-     */
45
-    public function save()
46
-    {
47
-        if ($this->isNew()) {
48
-            // insert
49
-            throw new Exception('Not allowed to create new site notice object');
50
-        }
51
-        else {
52
-            // update
53
-            $statement = $this->dbObject->prepare(<<<SQL
41
+	/**
42
+	 * Saves the object
43
+	 * @throws Exception
44
+	 */
45
+	public function save()
46
+	{
47
+		if ($this->isNew()) {
48
+			// insert
49
+			throw new Exception('Not allowed to create new site notice object');
50
+		}
51
+		else {
52
+			// update
53
+			$statement = $this->dbObject->prepare(<<<SQL
54 54
 UPDATE sitenotice
55 55
 SET content = :content, updateversion = updateversion + 1
56 56
 WHERE updateversion = :updateversion
57 57
 LIMIT 1;
58 58
 SQL
59
-            );
60
-            $statement->bindValue(':updateversion', $this->updateversion);
59
+			);
60
+			$statement->bindValue(':updateversion', $this->updateversion);
61 61
 
62
-            $statement->bindValue(':content', $this->content);
62
+			$statement->bindValue(':content', $this->content);
63 63
 
64
-            if (!$statement->execute()) {
65
-                throw new Exception($statement->errorInfo());
66
-            }
64
+			if (!$statement->execute()) {
65
+				throw new Exception($statement->errorInfo());
66
+			}
67 67
 
68
-            if ($statement->rowCount() !== 1) {
69
-                throw new OptimisticLockFailedException();
70
-            }
68
+			if ($statement->rowCount() !== 1) {
69
+				throw new OptimisticLockFailedException();
70
+			}
71 71
 
72
-            $this->updateversion++;
73
-        }
74
-    }
72
+			$this->updateversion++;
73
+		}
74
+	}
75 75
 
76
-    /**
77
-     * Gets the content of the message
78
-     * @return string
79
-     */
80
-    public function getContent()
81
-    {
82
-        return $this->content;
83
-    }
76
+	/**
77
+	 * Gets the content of the message
78
+	 * @return string
79
+	 */
80
+	public function getContent()
81
+	{
82
+		return $this->content;
83
+	}
84 84
 
85
-    /**
86
-     * Sets the content of the message
87
-     *
88
-     * @param string $content
89
-     */
90
-    public function setContent($content)
91
-    {
92
-        $this->content = $content;
93
-    }
85
+	/**
86
+	 * Sets the content of the message
87
+	 *
88
+	 * @param string $content
89
+	 */
90
+	public function setContent($content)
91
+	{
92
+		$this->content = $content;
93
+	}
94 94
 }
Please login to merge, or discard this patch.
includes/DataObjects/CommunityUser.php 1 patch
Indentation   +223 added lines, -223 removed lines patch added patch discarded remove patch
@@ -16,227 +16,227 @@
 block discarded – undo
16 16
  */
17 17
 class CommunityUser extends User
18 18
 {
19
-    public function getId()
20
-    {
21
-        return -1;
22
-    }
23
-
24
-    public function save()
25
-    {
26
-        // Do nothing
27
-    }
28
-
29
-    public function authenticate($password)
30
-    {
31
-        // Impossible to log in as this user
32
-        return false;
33
-    }
34
-
35
-    #region properties
36
-
37
-    /**
38
-     * @return string
39
-     */
40
-    public function getUsername()
41
-    {
42
-        global $communityUsername;
43
-
44
-        return $communityUsername;
45
-    }
46
-
47
-    public function setUsername($username)
48
-    {
49
-    }
50
-
51
-    /**
52
-     * @return string
53
-     */
54
-    public function getEmail()
55
-    {
56
-        global $cDataClearEmail;
57
-
58
-        return $cDataClearEmail;
59
-    }
60
-
61
-    public function setEmail($email)
62
-    {
63
-    }
64
-
65
-    public function setPassword($password)
66
-    {
67
-    }
68
-
69
-    public function getStatus()
70
-    {
71
-        return "Community";
72
-    }
73
-
74
-    public function getOnWikiName()
75
-    {
76
-        return "127.0.0.1";
77
-    }
78
-
79
-    public function getStoredOnWikiName()
80
-    {
81
-        return $this->getOnWikiName();
82
-    }
83
-
84
-    public function setOnWikiName($onWikiName)
85
-    {
86
-    }
87
-
88
-    public function getWelcomeSig()
89
-    {
90
-        return null;
91
-    }
92
-
93
-    public function setWelcomeSig($welcomeSig)
94
-    {
95
-    }
96
-
97
-    public function getLastActive()
98
-    {
99
-        $now = new DateTime();
100
-
101
-        return $now->format("Y-m-d H:i:s");
102
-    }
103
-
104
-    public function getForceLogout()
105
-    {
106
-        return true;
107
-    }
108
-
109
-    public function setForceLogout($forceLogout)
110
-    {
111
-    }
112
-
113
-    /**
114
-     * @param string $status
115
-     */
116
-    public function setStatus($status)
117
-    {
118
-    }
119
-
120
-    public function getWelcomeTemplate()
121
-    {
122
-        return 0;
123
-    }
124
-
125
-    public function setWelcomeTemplate($welcomeTemplate)
126
-    {
127
-    }
128
-
129
-    public function getAbortPref()
130
-    {
131
-        return 0;
132
-    }
133
-
134
-    public function setAbortPref($abortPreference)
135
-    {
136
-    }
137
-
138
-    public function getConfirmationDiff()
139
-    {
140
-        return null;
141
-    }
142
-
143
-    public function setConfirmationDiff($confirmationDiff)
144
-    {
145
-    }
146
-
147
-    public function getEmailSig()
148
-    {
149
-        return null;
150
-    }
151
-
152
-    public function setEmailSig($emailSignature)
153
-    {
154
-    }
155
-
156
-    #endregion
157
-
158
-    #region user access checks
159
-
160
-    public function isAdmin()
161
-    {
162
-        return false;
163
-    }
164
-
165
-    public function isCheckuser()
166
-    {
167
-        return false;
168
-    }
169
-
170
-    public function isIdentified(IdentificationVerifier $iv)
171
-    {
172
-        return false;
173
-    }
174
-
175
-    public function isSuspended()
176
-    {
177
-        return false;
178
-    }
179
-
180
-    public function isNewUser()
181
-    {
182
-        return false;
183
-    }
184
-
185
-    public function isUser()
186
-    {
187
-        return false;
188
-    }
189
-
190
-    public function isDeclined()
191
-    {
192
-        return false;
193
-    }
194
-
195
-    public function isCommunityUser()
196
-    {
197
-        return true;
198
-    }
199
-
200
-    #endregion 
201
-
202
-    #region OAuth
203
-
204
-    public function getOAuthIdentity($useCached = false)
205
-    {
206
-        return null;
207
-    }
208
-
209
-    public function isOAuthLinked()
210
-    {
211
-        return false;
212
-    }
213
-
214
-    public function oauthCanUse()
215
-    {
216
-        return false;
217
-    }
218
-
219
-    public function oauthCanEdit()
220
-    {
221
-        return false;
222
-    }
223
-
224
-    public function oauthCanCreateAccount()
225
-    {
226
-        return false;
227
-    }
228
-
229
-    protected function oauthCanCheckUser()
230
-    {
231
-        return false;
232
-    }
233
-
234
-    #endregion
235
-
236
-    public function getApprovalDate()
237
-    {
238
-        $data = DateTime::createFromFormat("Y-m-d H:i:s", "1970-01-01 00:00:00");
239
-
240
-        return $data;
241
-    }
19
+	public function getId()
20
+	{
21
+		return -1;
22
+	}
23
+
24
+	public function save()
25
+	{
26
+		// Do nothing
27
+	}
28
+
29
+	public function authenticate($password)
30
+	{
31
+		// Impossible to log in as this user
32
+		return false;
33
+	}
34
+
35
+	#region properties
36
+
37
+	/**
38
+	 * @return string
39
+	 */
40
+	public function getUsername()
41
+	{
42
+		global $communityUsername;
43
+
44
+		return $communityUsername;
45
+	}
46
+
47
+	public function setUsername($username)
48
+	{
49
+	}
50
+
51
+	/**
52
+	 * @return string
53
+	 */
54
+	public function getEmail()
55
+	{
56
+		global $cDataClearEmail;
57
+
58
+		return $cDataClearEmail;
59
+	}
60
+
61
+	public function setEmail($email)
62
+	{
63
+	}
64
+
65
+	public function setPassword($password)
66
+	{
67
+	}
68
+
69
+	public function getStatus()
70
+	{
71
+		return "Community";
72
+	}
73
+
74
+	public function getOnWikiName()
75
+	{
76
+		return "127.0.0.1";
77
+	}
78
+
79
+	public function getStoredOnWikiName()
80
+	{
81
+		return $this->getOnWikiName();
82
+	}
83
+
84
+	public function setOnWikiName($onWikiName)
85
+	{
86
+	}
87
+
88
+	public function getWelcomeSig()
89
+	{
90
+		return null;
91
+	}
92
+
93
+	public function setWelcomeSig($welcomeSig)
94
+	{
95
+	}
96
+
97
+	public function getLastActive()
98
+	{
99
+		$now = new DateTime();
100
+
101
+		return $now->format("Y-m-d H:i:s");
102
+	}
103
+
104
+	public function getForceLogout()
105
+	{
106
+		return true;
107
+	}
108
+
109
+	public function setForceLogout($forceLogout)
110
+	{
111
+	}
112
+
113
+	/**
114
+	 * @param string $status
115
+	 */
116
+	public function setStatus($status)
117
+	{
118
+	}
119
+
120
+	public function getWelcomeTemplate()
121
+	{
122
+		return 0;
123
+	}
124
+
125
+	public function setWelcomeTemplate($welcomeTemplate)
126
+	{
127
+	}
128
+
129
+	public function getAbortPref()
130
+	{
131
+		return 0;
132
+	}
133
+
134
+	public function setAbortPref($abortPreference)
135
+	{
136
+	}
137
+
138
+	public function getConfirmationDiff()
139
+	{
140
+		return null;
141
+	}
142
+
143
+	public function setConfirmationDiff($confirmationDiff)
144
+	{
145
+	}
146
+
147
+	public function getEmailSig()
148
+	{
149
+		return null;
150
+	}
151
+
152
+	public function setEmailSig($emailSignature)
153
+	{
154
+	}
155
+
156
+	#endregion
157
+
158
+	#region user access checks
159
+
160
+	public function isAdmin()
161
+	{
162
+		return false;
163
+	}
164
+
165
+	public function isCheckuser()
166
+	{
167
+		return false;
168
+	}
169
+
170
+	public function isIdentified(IdentificationVerifier $iv)
171
+	{
172
+		return false;
173
+	}
174
+
175
+	public function isSuspended()
176
+	{
177
+		return false;
178
+	}
179
+
180
+	public function isNewUser()
181
+	{
182
+		return false;
183
+	}
184
+
185
+	public function isUser()
186
+	{
187
+		return false;
188
+	}
189
+
190
+	public function isDeclined()
191
+	{
192
+		return false;
193
+	}
194
+
195
+	public function isCommunityUser()
196
+	{
197
+		return true;
198
+	}
199
+
200
+	#endregion 
201
+
202
+	#region OAuth
203
+
204
+	public function getOAuthIdentity($useCached = false)
205
+	{
206
+		return null;
207
+	}
208
+
209
+	public function isOAuthLinked()
210
+	{
211
+		return false;
212
+	}
213
+
214
+	public function oauthCanUse()
215
+	{
216
+		return false;
217
+	}
218
+
219
+	public function oauthCanEdit()
220
+	{
221
+		return false;
222
+	}
223
+
224
+	public function oauthCanCreateAccount()
225
+	{
226
+		return false;
227
+	}
228
+
229
+	protected function oauthCanCheckUser()
230
+	{
231
+		return false;
232
+	}
233
+
234
+	#endregion
235
+
236
+	public function getApprovalDate()
237
+	{
238
+		$data = DateTime::createFromFormat("Y-m-d H:i:s", "1970-01-01 00:00:00");
239
+
240
+		return $data;
241
+	}
242 242
 }
Please login to merge, or discard this patch.