Completed
Pull Request — rbac (#446)
by Simon
04:22
created
includes/DataObjects/WelcomeTemplate.php 1 patch
Indentation   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -19,167 +19,167 @@
 block discarded – undo
19 19
  */
20 20
 class WelcomeTemplate extends DataObject
21 21
 {
22
-    /** @var string */
23
-    private $usercode;
24
-    /** @var string */
25
-    private $botcode;
26
-    private $usageCache;
27
-    private $deleted = 0;
28
-
29
-    /**
30
-     * Summary of getAll
31
-     *
32
-     * @param PdoDatabase $database
33
-     *
34
-     * @return WelcomeTemplate[]
35
-     */
36
-    public static function getAll(PdoDatabase $database)
37
-    {
38
-        $statement = $database->prepare("SELECT * FROM welcometemplate WHERE deleted = 0;");
39
-
40
-        $statement->execute();
41
-
42
-        $result = array();
43
-        /** @var WelcomeTemplate $v */
44
-        foreach ($statement->fetchAll(PDO::FETCH_CLASS, self::class) as $v) {
45
-            $v->setDatabase($database);
46
-            $result[] = $v;
47
-        }
48
-
49
-        return $result;
50
-    }
51
-
52
-    /**
53
-     * @throws Exception
54
-     */
55
-    public function save()
56
-    {
57
-        if ($this->isNew()) {
58
-            // insert
59
-            $statement = $this->dbObject->prepare(<<<SQL
22
+	/** @var string */
23
+	private $usercode;
24
+	/** @var string */
25
+	private $botcode;
26
+	private $usageCache;
27
+	private $deleted = 0;
28
+
29
+	/**
30
+	 * Summary of getAll
31
+	 *
32
+	 * @param PdoDatabase $database
33
+	 *
34
+	 * @return WelcomeTemplate[]
35
+	 */
36
+	public static function getAll(PdoDatabase $database)
37
+	{
38
+		$statement = $database->prepare("SELECT * FROM welcometemplate WHERE deleted = 0;");
39
+
40
+		$statement->execute();
41
+
42
+		$result = array();
43
+		/** @var WelcomeTemplate $v */
44
+		foreach ($statement->fetchAll(PDO::FETCH_CLASS, self::class) as $v) {
45
+			$v->setDatabase($database);
46
+			$result[] = $v;
47
+		}
48
+
49
+		return $result;
50
+	}
51
+
52
+	/**
53
+	 * @throws Exception
54
+	 */
55
+	public function save()
56
+	{
57
+		if ($this->isNew()) {
58
+			// insert
59
+			$statement = $this->dbObject->prepare(<<<SQL
60 60
 INSERT INTO welcometemplate (usercode, botcode) VALUES (:usercode, :botcode);
61 61
 SQL
62
-            );
63
-            $statement->bindValue(":usercode", $this->usercode);
64
-            $statement->bindValue(":botcode", $this->botcode);
65
-
66
-            if ($statement->execute()) {
67
-                $this->id = (int)$this->dbObject->lastInsertId();
68
-            }
69
-            else {
70
-                throw new Exception($statement->errorInfo());
71
-            }
72
-        }
73
-        else {
74
-            // update
75
-            $statement = $this->dbObject->prepare(<<<SQL
62
+			);
63
+			$statement->bindValue(":usercode", $this->usercode);
64
+			$statement->bindValue(":botcode", $this->botcode);
65
+
66
+			if ($statement->execute()) {
67
+				$this->id = (int)$this->dbObject->lastInsertId();
68
+			}
69
+			else {
70
+				throw new Exception($statement->errorInfo());
71
+			}
72
+		}
73
+		else {
74
+			// update
75
+			$statement = $this->dbObject->prepare(<<<SQL
76 76
 UPDATE `welcometemplate`
77 77
 SET usercode = :usercode, botcode = :botcode, updateversion = updateversion + 1
78 78
 WHERE id = :id AND updateversion = :updateversion
79 79
 LIMIT 1;
80 80
 SQL
81
-            );
82
-
83
-            $statement->bindValue(':id', $this->id);
84
-            $statement->bindValue(':updateversion', $this->updateversion);
85
-
86
-            $statement->bindValue(':usercode', $this->usercode);
87
-            $statement->bindValue(':botcode', $this->botcode);
88
-
89
-            if (!$statement->execute()) {
90
-                throw new Exception($statement->errorInfo());
91
-            }
92
-
93
-            if ($statement->rowCount() !== 1) {
94
-                throw new OptimisticLockFailedException();
95
-            }
96
-
97
-            $this->updateversion++;
98
-        }
99
-    }
100
-
101
-    /**
102
-     * @return string
103
-     */
104
-    public function getUserCode()
105
-    {
106
-        return $this->usercode;
107
-    }
108
-
109
-    /**
110
-     * @param string $usercode
111
-     */
112
-    public function setUserCode($usercode)
113
-    {
114
-        $this->usercode = $usercode;
115
-    }
116
-
117
-    /**
118
-     * @return string
119
-     */
120
-    public function getBotCode()
121
-    {
122
-        return $this->botcode;
123
-    }
124
-
125
-    /**
126
-     * @param string $botcode
127
-     */
128
-    public function setBotCode($botcode)
129
-    {
130
-        $this->botcode = $botcode;
131
-    }
132
-
133
-    /**
134
-     * @return User[]
135
-     */
136
-    public function getUsersUsingTemplate()
137
-    {
138
-        if ($this->usageCache === null) {
139
-            $statement = $this->dbObject->prepare("SELECT * FROM user WHERE welcome_template = :id;");
140
-
141
-            $statement->execute(array(":id" => $this->id));
142
-
143
-            $result = array();
144
-            /** @var WelcomeTemplate $v */
145
-            foreach ($statement->fetchAll(PDO::FETCH_CLASS, User::class) as $v) {
146
-                $v->setDatabase($this->dbObject);
147
-                $result[] = $v;
148
-            }
149
-
150
-            $this->usageCache = $result;
151
-        }
152
-
153
-        return $this->usageCache;
154
-    }
155
-
156
-    /**
157
-     * Deletes the object from the database
158
-     */
159
-    public function delete()
160
-    {
161
-        if ($this->id === null) {
162
-            // wtf?
163
-            return;
164
-        }
165
-
166
-        $deleteQuery = "UPDATE welcometemplate SET deleted = 1 WHERE id = :id AND updateversion = :updateversion;";
167
-        $statement = $this->dbObject->prepare($deleteQuery);
168
-
169
-        $statement->bindValue(":id", $this->id);
170
-        $statement->bindValue(":updateversion", $this->updateversion);
171
-        $statement->execute();
172
-
173
-        if ($statement->rowCount() !== 1) {
174
-            throw new OptimisticLockFailedException();
175
-        }
176
-    }
177
-
178
-    /**
179
-     * @return bool
180
-     */
181
-    public function isDeleted()
182
-    {
183
-        return ((int)$this->deleted) === 1;
184
-    }
81
+			);
82
+
83
+			$statement->bindValue(':id', $this->id);
84
+			$statement->bindValue(':updateversion', $this->updateversion);
85
+
86
+			$statement->bindValue(':usercode', $this->usercode);
87
+			$statement->bindValue(':botcode', $this->botcode);
88
+
89
+			if (!$statement->execute()) {
90
+				throw new Exception($statement->errorInfo());
91
+			}
92
+
93
+			if ($statement->rowCount() !== 1) {
94
+				throw new OptimisticLockFailedException();
95
+			}
96
+
97
+			$this->updateversion++;
98
+		}
99
+	}
100
+
101
+	/**
102
+	 * @return string
103
+	 */
104
+	public function getUserCode()
105
+	{
106
+		return $this->usercode;
107
+	}
108
+
109
+	/**
110
+	 * @param string $usercode
111
+	 */
112
+	public function setUserCode($usercode)
113
+	{
114
+		$this->usercode = $usercode;
115
+	}
116
+
117
+	/**
118
+	 * @return string
119
+	 */
120
+	public function getBotCode()
121
+	{
122
+		return $this->botcode;
123
+	}
124
+
125
+	/**
126
+	 * @param string $botcode
127
+	 */
128
+	public function setBotCode($botcode)
129
+	{
130
+		$this->botcode = $botcode;
131
+	}
132
+
133
+	/**
134
+	 * @return User[]
135
+	 */
136
+	public function getUsersUsingTemplate()
137
+	{
138
+		if ($this->usageCache === null) {
139
+			$statement = $this->dbObject->prepare("SELECT * FROM user WHERE welcome_template = :id;");
140
+
141
+			$statement->execute(array(":id" => $this->id));
142
+
143
+			$result = array();
144
+			/** @var WelcomeTemplate $v */
145
+			foreach ($statement->fetchAll(PDO::FETCH_CLASS, User::class) as $v) {
146
+				$v->setDatabase($this->dbObject);
147
+				$result[] = $v;
148
+			}
149
+
150
+			$this->usageCache = $result;
151
+		}
152
+
153
+		return $this->usageCache;
154
+	}
155
+
156
+	/**
157
+	 * Deletes the object from the database
158
+	 */
159
+	public function delete()
160
+	{
161
+		if ($this->id === null) {
162
+			// wtf?
163
+			return;
164
+		}
165
+
166
+		$deleteQuery = "UPDATE welcometemplate SET deleted = 1 WHERE id = :id AND updateversion = :updateversion;";
167
+		$statement = $this->dbObject->prepare($deleteQuery);
168
+
169
+		$statement->bindValue(":id", $this->id);
170
+		$statement->bindValue(":updateversion", $this->updateversion);
171
+		$statement->execute();
172
+
173
+		if ($statement->rowCount() !== 1) {
174
+			throw new OptimisticLockFailedException();
175
+		}
176
+	}
177
+
178
+	/**
179
+	 * @return bool
180
+	 */
181
+	public function isDeleted()
182
+	{
183
+		return ((int)$this->deleted) === 1;
184
+	}
185 185
 }
Please login to merge, or discard this patch.
includes/Session.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -17,25 +17,25 @@
 block discarded – undo
17 17
  */
18 18
 class Session
19 19
 {
20
-    public static function start()
21
-    {
22
-        ini_set('session.cookie_httponly', 1);
20
+	public static function start()
21
+	{
22
+		ini_set('session.cookie_httponly', 1);
23 23
 
24
-        if (WebRequest::isHttps()) {
25
-            ini_set('session.cookie_secure', 1);
26
-        }
24
+		if (WebRequest::isHttps()) {
25
+			ini_set('session.cookie_secure', 1);
26
+		}
27 27
 
28
-        session_start();
29
-    }
28
+		session_start();
29
+	}
30 30
 
31
-    public static function destroy()
32
-    {
33
-        session_destroy();
34
-    }
31
+	public static function destroy()
32
+	{
33
+		session_destroy();
34
+	}
35 35
 
36
-    public static function restart()
37
-    {
38
-        self::destroy();
39
-        self::start();
40
-    }
36
+	public static function restart()
37
+	{
38
+		self::destroy();
39
+		self::start();
40
+	}
41 41
 }
Please login to merge, or discard this patch.
includes/SessionAlert.php 1 patch
Indentation   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -21,141 +21,141 @@
 block discarded – undo
21 21
  */
22 22
 class SessionAlert
23 23
 {
24
-    private $message;
25
-    private $title;
26
-    private $type;
27
-    private $closable;
28
-    private $block;
29
-
30
-    /**
31
-     * @param string $message
32
-     * @param string $title
33
-     * @param string $type
34
-     * @param bool   $closable
35
-     * @param bool   $block
36
-     */
37
-    public function __construct($message, $title, $type = "alert-info", $closable = true, $block = true)
38
-    {
39
-        $this->message = $message;
40
-        $this->title = $title;
41
-        $this->type = $type;
42
-        $this->closable = $closable;
43
-        $this->block = $block;
44
-    }
45
-
46
-    /**
47
-     * Shows a quick one-liner message
48
-     *
49
-     * @param string $message
50
-     * @param string $type
51
-     */
52
-    public static function quick($message, $type = "alert-info")
53
-    {
54
-        self::append(new SessionAlert($message, "", $type, true, false));
55
-    }
56
-
57
-    /**
58
-     * @param SessionAlert $alert
59
-     */
60
-    public static function append(SessionAlert $alert)
61
-    {
62
-        $data = WebRequest::getSessionAlertData();
63
-        $data[] = serialize($alert);
64
-        WebRequest::setSessionAlertData($data);
65
-    }
66
-
67
-    /**
68
-     * Shows a quick one-liner success message
69
-     *
70
-     * @param string $message
71
-     */
72
-    public static function success($message)
73
-    {
74
-        self::append(new SessionAlert($message, "", "alert-success", true, true));
75
-    }
76
-
77
-    /**
78
-     * Shows a quick one-liner warning message
79
-     *
80
-     * @param string $message
81
-     * @param string $title
82
-     */
83
-    public static function warning($message, $title = "Warning!")
84
-    {
85
-        self::append(new SessionAlert($message, $title, "alert-warning", true, true));
86
-    }
87
-
88
-    /**
89
-     * Shows a quick one-liner error message
90
-     *
91
-     * @param string $message
92
-     * @param string $title
93
-     */
94
-    public static function error($message, $title = "Error!")
95
-    {
96
-        self::append(new SessionAlert($message, $title, "alert-error", true, true));
97
-    }
98
-
99
-    /**
100
-     * Retrieves the alerts which have been saved to the session
101
-     * @return array
102
-     */
103
-    public static function getAlerts()
104
-    {
105
-        $alertData = array();
106
-
107
-        foreach (WebRequest::getSessionAlertData() as $a) {
108
-            $alertData[] = unserialize($a);
109
-        }
110
-
111
-        return $alertData;
112
-    }
113
-
114
-    /**
115
-     * Clears the alerts from the session
116
-     */
117
-    public static function clearAlerts()
118
-    {
119
-        WebRequest::clearSessionAlertData();
120
-    }
121
-
122
-    /**
123
-     * @return boolean
124
-     */
125
-    public function isBlock()
126
-    {
127
-        return $this->block;
128
-    }
129
-
130
-    /**
131
-     * @return boolean
132
-     */
133
-    public function isClosable()
134
-    {
135
-        return $this->closable;
136
-    }
137
-
138
-    /**
139
-     * @return string
140
-     */
141
-    public function getType()
142
-    {
143
-        return $this->type;
144
-    }
145
-
146
-    /**
147
-     * @return string
148
-     */
149
-    public function getTitle()
150
-    {
151
-        return $this->title;
152
-    }
153
-
154
-    /**
155
-     * @return string
156
-     */
157
-    public function getMessage()
158
-    {
159
-        return $this->message;
160
-    }
24
+	private $message;
25
+	private $title;
26
+	private $type;
27
+	private $closable;
28
+	private $block;
29
+
30
+	/**
31
+	 * @param string $message
32
+	 * @param string $title
33
+	 * @param string $type
34
+	 * @param bool   $closable
35
+	 * @param bool   $block
36
+	 */
37
+	public function __construct($message, $title, $type = "alert-info", $closable = true, $block = true)
38
+	{
39
+		$this->message = $message;
40
+		$this->title = $title;
41
+		$this->type = $type;
42
+		$this->closable = $closable;
43
+		$this->block = $block;
44
+	}
45
+
46
+	/**
47
+	 * Shows a quick one-liner message
48
+	 *
49
+	 * @param string $message
50
+	 * @param string $type
51
+	 */
52
+	public static function quick($message, $type = "alert-info")
53
+	{
54
+		self::append(new SessionAlert($message, "", $type, true, false));
55
+	}
56
+
57
+	/**
58
+	 * @param SessionAlert $alert
59
+	 */
60
+	public static function append(SessionAlert $alert)
61
+	{
62
+		$data = WebRequest::getSessionAlertData();
63
+		$data[] = serialize($alert);
64
+		WebRequest::setSessionAlertData($data);
65
+	}
66
+
67
+	/**
68
+	 * Shows a quick one-liner success message
69
+	 *
70
+	 * @param string $message
71
+	 */
72
+	public static function success($message)
73
+	{
74
+		self::append(new SessionAlert($message, "", "alert-success", true, true));
75
+	}
76
+
77
+	/**
78
+	 * Shows a quick one-liner warning message
79
+	 *
80
+	 * @param string $message
81
+	 * @param string $title
82
+	 */
83
+	public static function warning($message, $title = "Warning!")
84
+	{
85
+		self::append(new SessionAlert($message, $title, "alert-warning", true, true));
86
+	}
87
+
88
+	/**
89
+	 * Shows a quick one-liner error message
90
+	 *
91
+	 * @param string $message
92
+	 * @param string $title
93
+	 */
94
+	public static function error($message, $title = "Error!")
95
+	{
96
+		self::append(new SessionAlert($message, $title, "alert-error", true, true));
97
+	}
98
+
99
+	/**
100
+	 * Retrieves the alerts which have been saved to the session
101
+	 * @return array
102
+	 */
103
+	public static function getAlerts()
104
+	{
105
+		$alertData = array();
106
+
107
+		foreach (WebRequest::getSessionAlertData() as $a) {
108
+			$alertData[] = unserialize($a);
109
+		}
110
+
111
+		return $alertData;
112
+	}
113
+
114
+	/**
115
+	 * Clears the alerts from the session
116
+	 */
117
+	public static function clearAlerts()
118
+	{
119
+		WebRequest::clearSessionAlertData();
120
+	}
121
+
122
+	/**
123
+	 * @return boolean
124
+	 */
125
+	public function isBlock()
126
+	{
127
+		return $this->block;
128
+	}
129
+
130
+	/**
131
+	 * @return boolean
132
+	 */
133
+	public function isClosable()
134
+	{
135
+		return $this->closable;
136
+	}
137
+
138
+	/**
139
+	 * @return string
140
+	 */
141
+	public function getType()
142
+	{
143
+		return $this->type;
144
+	}
145
+
146
+	/**
147
+	 * @return string
148
+	 */
149
+	public function getTitle()
150
+	{
151
+		return $this->title;
152
+	}
153
+
154
+	/**
155
+	 * @return string
156
+	 */
157
+	public function getMessage()
158
+	{
159
+		return $this->message;
160
+	}
161 161
 }
Please login to merge, or discard this patch.
includes/API/IApiAction.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -17,17 +17,17 @@
 block discarded – undo
17 17
  */
18 18
 interface IApiAction extends IRoutedTask
19 19
 {
20
-    /**
21
-     * Method that runs API action
22
-     *
23
-     * @param DOMElement $apiDocument
24
-     *
25
-     * @return DOMElement The modified API document
26
-     */
27
-    public function executeApiAction(DOMElement $apiDocument);
20
+	/**
21
+	 * Method that runs API action
22
+	 *
23
+	 * @param DOMElement $apiDocument
24
+	 *
25
+	 * @return DOMElement The modified API document
26
+	 */
27
+	public function executeApiAction(DOMElement $apiDocument);
28 28
 
29
-    /**
30
-     * @return string the XML, or false if an error occurred.
31
-     */
32
-    public function runApiPage();
29
+	/**
30
+	 * @return string the XML, or false if an error occurred.
31
+	 */
32
+	public function runApiPage();
33 33
 }
Please login to merge, or discard this patch.
includes/API/Actions/HelpAction.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -18,34 +18,34 @@
 block discarded – undo
18 18
  */
19 19
 class HelpAction extends ApiPageBase implements IApiAction
20 20
 {
21
-    public function executeApiAction(DOMElement $apiDocument)
22
-    {
23
-        $helpElement = $this->getHelpElement();
24
-        $apiDocument->appendChild($helpElement);
25
-
26
-        return $apiDocument;
27
-    }
28
-
29
-    /**
30
-     * Gets the help information
31
-     * @return DOMElement
32
-     */
33
-    protected function getHelpElement()
34
-    {
35
-        $helpInfo = "Help info goes here!";
36
-
37
-        $help = $this->document->createElement("help");
38
-        $helptext = $this->document->createElement("info", $helpInfo);
39
-        $helpactions = $this->document->createElement("actions");
40
-
41
-        foreach (ApiRequestRouter::getActionList() as $action) {
42
-            $actionElement = $this->document->createElement("action", $action);
43
-            $helpactions->appendChild($actionElement);
44
-        }
45
-
46
-        $help->appendChild($helptext);
47
-        $help->appendChild($helpactions);
48
-
49
-        return $help;
50
-    }
21
+	public function executeApiAction(DOMElement $apiDocument)
22
+	{
23
+		$helpElement = $this->getHelpElement();
24
+		$apiDocument->appendChild($helpElement);
25
+
26
+		return $apiDocument;
27
+	}
28
+
29
+	/**
30
+	 * Gets the help information
31
+	 * @return DOMElement
32
+	 */
33
+	protected function getHelpElement()
34
+	{
35
+		$helpInfo = "Help info goes here!";
36
+
37
+		$help = $this->document->createElement("help");
38
+		$helptext = $this->document->createElement("info", $helpInfo);
39
+		$helpactions = $this->document->createElement("actions");
40
+
41
+		foreach (ApiRequestRouter::getActionList() as $action) {
42
+			$actionElement = $this->document->createElement("action", $action);
43
+			$helpactions->appendChild($actionElement);
44
+		}
45
+
46
+		$help->appendChild($helptext);
47
+		$help->appendChild($helpactions);
48
+
49
+		return $help;
50
+	}
51 51
 }
Please login to merge, or discard this patch.
includes/API/Actions/StatusAction.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -17,67 +17,67 @@
 block discarded – undo
17 17
  */
18 18
 class StatusAction extends ApiPageBase implements IApiAction
19 19
 {
20
-    public function executeApiAction(DOMElement $apiDocument)
21
-    {
22
-        $statusElement = $this->document->createElement("status");
23
-        $apiDocument->appendChild($statusElement);
20
+	public function executeApiAction(DOMElement $apiDocument)
21
+	{
22
+		$statusElement = $this->document->createElement("status");
23
+		$apiDocument->appendChild($statusElement);
24 24
 
25
-        $query = $this->getDatabase()->prepare(<<<SQL
25
+		$query = $this->getDatabase()->prepare(<<<SQL
26 26
             SELECT /* Api/StatusAction */ COUNT(*) AS count
27 27
             FROM request
28 28
             WHERE
29 29
                 status = :pstatus
30 30
                 AND emailconfirm = 'Confirmed';
31 31
 SQL
32
-        );
32
+		);
33 33
 
34
-        $availableRequestStates = $this->getSiteConfiguration()->getRequestStates();
34
+		$availableRequestStates = $this->getSiteConfiguration()->getRequestStates();
35 35
 
36
-        foreach ($availableRequestStates as $key => $value) {
37
-            $query->bindValue(":pstatus", $key);
38
-            $query->execute();
39
-            $sus = $query->fetchColumn();
40
-            $statusElement->setAttribute($value['api'], $sus);
41
-            $query->closeCursor();
42
-        }
36
+		foreach ($availableRequestStates as $key => $value) {
37
+			$query->bindValue(":pstatus", $key);
38
+			$query->execute();
39
+			$sus = $query->fetchColumn();
40
+			$statusElement->setAttribute($value['api'], $sus);
41
+			$query->closeCursor();
42
+		}
43 43
 
44
-        $query = $this->getDatabase()->prepare(<<<SQL
44
+		$query = $this->getDatabase()->prepare(<<<SQL
45 45
             SELECT /* Api/StatusAction */ COUNT(*) AS count
46 46
             FROM ban
47 47
             WHERE
48 48
                 (duration > UNIX_TIMESTAMP() OR duration = -1)
49 49
                 AND active = 1;
50 50
 SQL
51
-        );
51
+		);
52 52
 
53
-        $query->execute();
54
-        $sus = $query->fetchColumn();
55
-        $statusElement->setAttribute("bans", $sus);
56
-        $query->closeCursor();
53
+		$query->execute();
54
+		$sus = $query->fetchColumn();
55
+		$statusElement->setAttribute("bans", $sus);
56
+		$query->closeCursor();
57 57
 
58
-        $query = $this->getDatabase()->prepare(<<<SQL
58
+		$query = $this->getDatabase()->prepare(<<<SQL
59 59
 SELECT /* Api/StatusAction */ COUNT(*) AS count
60 60
 FROM user WHERE status = :ulevel;
61 61
 SQL
62
-        );
63
-        $query->bindValue(":ulevel", "Admin");
64
-        $query->execute();
65
-        $sus = $query->fetchColumn();
66
-        $statusElement->setAttribute("useradmin", $sus);
67
-        $query->closeCursor();
62
+		);
63
+		$query->bindValue(":ulevel", "Admin");
64
+		$query->execute();
65
+		$sus = $query->fetchColumn();
66
+		$statusElement->setAttribute("useradmin", $sus);
67
+		$query->closeCursor();
68 68
 
69
-        $query->bindValue(":ulevel", "User");
70
-        $query->execute();
71
-        $sus = $query->fetchColumn();
72
-        $statusElement->setAttribute("user", $sus);
73
-        $query->closeCursor();
69
+		$query->bindValue(":ulevel", "User");
70
+		$query->execute();
71
+		$sus = $query->fetchColumn();
72
+		$statusElement->setAttribute("user", $sus);
73
+		$query->closeCursor();
74 74
 
75
-        $query->bindValue(":ulevel", "New");
76
-        $query->execute();
77
-        $sus = $query->fetchColumn();
78
-        $statusElement->setAttribute("usernew", $sus);
79
-        $query->closeCursor();
75
+		$query->bindValue(":ulevel", "New");
76
+		$query->execute();
77
+		$sus = $query->fetchColumn();
78
+		$statusElement->setAttribute("usernew", $sus);
79
+		$query->closeCursor();
80 80
 
81
-        return $apiDocument;
82
-    }
81
+		return $apiDocument;
82
+	}
83 83
 }
Please login to merge, or discard this patch.
includes/API/Actions/StatsAction.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -19,55 +19,55 @@
 block discarded – undo
19 19
  */
20 20
 class StatsAction extends ApiPageBase implements IApiAction
21 21
 {
22
-    /**
23
-     * The target user
24
-     * @var User $user
25
-     */
26
-    private $user;
22
+	/**
23
+	 * The target user
24
+	 * @var User $user
25
+	 */
26
+	private $user;
27 27
 
28
-    /**
29
-     * Summary of execute
30
-     *
31
-     * @param \DOMElement $apiDocument
32
-     *
33
-     * @return \DOMElement
34
-     * @throws ApiException
35
-     * @throws \Exception
36
-     */
37
-    public function executeApiAction(\DOMElement $apiDocument)
38
-    {
39
-        $username = WebRequest::getString('user');
40
-        $wikiusername = WebRequest::getString('wikiuser');
28
+	/**
29
+	 * Summary of execute
30
+	 *
31
+	 * @param \DOMElement $apiDocument
32
+	 *
33
+	 * @return \DOMElement
34
+	 * @throws ApiException
35
+	 * @throws \Exception
36
+	 */
37
+	public function executeApiAction(\DOMElement $apiDocument)
38
+	{
39
+		$username = WebRequest::getString('user');
40
+		$wikiusername = WebRequest::getString('wikiuser');
41 41
 
42
-        if ($username === null && $wikiusername === null) {
43
-            throw new ApiException("Please specify a username using either user or wikiuser parameters.");
44
-        }
42
+		if ($username === null && $wikiusername === null) {
43
+			throw new ApiException("Please specify a username using either user or wikiuser parameters.");
44
+		}
45 45
 
46
-        $userElement = $this->document->createElement("user");
47
-        $apiDocument->appendChild($userElement);
46
+		$userElement = $this->document->createElement("user");
47
+		$apiDocument->appendChild($userElement);
48 48
 
49
-        if ($username !== null) {
50
-            $user = User::getByUsername($username, $this->getDatabase());
51
-        }
52
-        else {
53
-            $user = User::getByOnWikiUsername($wikiusername, $this->getDatabase());
54
-        }
49
+		if ($username !== null) {
50
+			$user = User::getByUsername($username, $this->getDatabase());
51
+		}
52
+		else {
53
+			$user = User::getByOnWikiUsername($wikiusername, $this->getDatabase());
54
+		}
55 55
 
56
-        if ($user === false) {
57
-            $userElement->setAttribute("missing", "true");
56
+		if ($user === false) {
57
+			$userElement->setAttribute("missing", "true");
58 58
 
59
-            return $apiDocument;
60
-        }
59
+			return $apiDocument;
60
+		}
61 61
 
62
-        $this->user = $user;
62
+		$this->user = $user;
63 63
 
64
-        $userElement->setAttribute("username", $this->user->getUsername());
65
-        $userElement->setAttribute("status", $this->user->getStatus());
66
-        $userElement->setAttribute("lastactive", $this->user->getLastActive());
67
-        $userElement->setAttribute("welcome_template", $this->user->getWelcomeTemplate());
68
-        $userElement->setAttribute("onwikiname", $this->user->getOnWikiName());
69
-        $userElement->setAttribute("oauth", $this->user->isOAuthLinked() ? "true" : "false");
64
+		$userElement->setAttribute("username", $this->user->getUsername());
65
+		$userElement->setAttribute("status", $this->user->getStatus());
66
+		$userElement->setAttribute("lastactive", $this->user->getLastActive());
67
+		$userElement->setAttribute("welcome_template", $this->user->getWelcomeTemplate());
68
+		$userElement->setAttribute("onwikiname", $this->user->getOnWikiName());
69
+		$userElement->setAttribute("oauth", $this->user->isOAuthLinked() ? "true" : "false");
70 70
 
71
-        return $apiDocument;
72
-    }
71
+		return $apiDocument;
72
+	}
73 73
 }
Please login to merge, or discard this patch.
includes/API/Actions/MonitorAction.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -23,65 +23,65 @@
 block discarded – undo
23 23
  */
24 24
 class MonitorAction extends ApiPageBase implements IApiAction
25 25
 {
26
-    /**
27
-     * @param DOMElement $apiDocument
28
-     *
29
-     * @return DOMElement
30
-     */
31
-    public function executeApiAction(DOMElement $apiDocument)
32
-    {
33
-        $now = new DateTime();
26
+	/**
27
+	 * @param DOMElement $apiDocument
28
+	 *
29
+	 * @return DOMElement
30
+	 */
31
+	public function executeApiAction(DOMElement $apiDocument)
32
+	{
33
+		$now = new DateTime();
34 34
 
35
-        $old = $this->getOldest();
36
-        $oldest = new DateTime($old);
35
+		$old = $this->getOldest();
36
+		$oldest = new DateTime($old);
37 37
 
38
-        $new = $this->getNewest();
39
-        $newest = new DateTime($new);
38
+		$new = $this->getNewest();
39
+		$newest = new DateTime($new);
40 40
 
41
-        $monitoringElement = $this->document->createElement("data");
42
-        $monitoringElement->setAttribute("date", $now->format('c'));
43
-        $monitoringElement->setAttribute("oldest", $old === null ? null : $oldest->format('c'));
44
-        $monitoringElement->setAttribute("newest", $new === null ? null : $newest->format('c'));
45
-        $apiDocument->appendChild($monitoringElement);
41
+		$monitoringElement = $this->document->createElement("data");
42
+		$monitoringElement->setAttribute("date", $now->format('c'));
43
+		$monitoringElement->setAttribute("oldest", $old === null ? null : $oldest->format('c'));
44
+		$monitoringElement->setAttribute("newest", $new === null ? null : $newest->format('c'));
45
+		$apiDocument->appendChild($monitoringElement);
46 46
 
47
-        return $apiDocument;
48
-    }
47
+		return $apiDocument;
48
+	}
49 49
 
50
-    /**
51
-     * @return string|null
52
-     */
53
-    private function getOldest()
54
-    {
55
-        $statement = $this->getDatabase()
56
-            ->prepare("SELECT min(date) FROM request WHERE email != :email AND ip != :ip;");
57
-        $successful = $statement->execute(array(
58
-            ':email' => $this->getSiteConfiguration()->getDataClearEmail(),
59
-            ':ip'    => $this->getSiteConfiguration()->getDataClearIp(),
60
-        ));
50
+	/**
51
+	 * @return string|null
52
+	 */
53
+	private function getOldest()
54
+	{
55
+		$statement = $this->getDatabase()
56
+			->prepare("SELECT min(date) FROM request WHERE email != :email AND ip != :ip;");
57
+		$successful = $statement->execute(array(
58
+			':email' => $this->getSiteConfiguration()->getDataClearEmail(),
59
+			':ip'    => $this->getSiteConfiguration()->getDataClearIp(),
60
+		));
61 61
 
62
-        if (!$successful) {
63
-            return null;
64
-        }
62
+		if (!$successful) {
63
+			return null;
64
+		}
65 65
 
66
-        $result = $statement->fetchColumn();
66
+		$result = $statement->fetchColumn();
67 67
 
68
-        return $result;
69
-    }
68
+		return $result;
69
+	}
70 70
 
71
-    /**
72
-     * @return string
73
-     */
74
-    private function getNewest()
75
-    {
76
-        $statement = $this->getDatabase()
77
-            ->prepare("SELECT max(date) FROM request WHERE email != :email AND ip != :ip;");
78
-        $statement->execute(array(
79
-            ':email' => $this->getSiteConfiguration()->getDataClearEmail(),
80
-            ':ip'    => $this->getSiteConfiguration()->getDataClearIp(),
81
-        ));
71
+	/**
72
+	 * @return string
73
+	 */
74
+	private function getNewest()
75
+	{
76
+		$statement = $this->getDatabase()
77
+			->prepare("SELECT max(date) FROM request WHERE email != :email AND ip != :ip;");
78
+		$statement->execute(array(
79
+			':email' => $this->getSiteConfiguration()->getDataClearEmail(),
80
+			':ip'    => $this->getSiteConfiguration()->getDataClearIp(),
81
+		));
82 82
 
83
-        $result = $statement->fetchColumn(0);
83
+		$result = $statement->fetchColumn(0);
84 84
 
85
-        return $result;
86
-    }
85
+		return $result;
86
+	}
87 87
 }
Please login to merge, or discard this patch.
includes/API/Actions/UnknownAction.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,15 +16,15 @@
 block discarded – undo
16 16
  */
17 17
 class UnknownAction extends HelpAction implements IApiAction
18 18
 {
19
-    public function executeApiAction(DOMElement $apiDocument)
20
-    {
21
-        $errorText = "Unknown API action specified.";
22
-        $errorNode = $this->document->createElement("error", $errorText);
23
-        $apiDocument->appendChild($errorNode);
19
+	public function executeApiAction(DOMElement $apiDocument)
20
+	{
21
+		$errorText = "Unknown API action specified.";
22
+		$errorNode = $this->document->createElement("error", $errorText);
23
+		$apiDocument->appendChild($errorNode);
24 24
 
25
-        $helpElement = $this->getHelpElement();
26
-        $apiDocument->appendChild($helpElement);
25
+		$helpElement = $this->getHelpElement();
26
+		$apiDocument->appendChild($helpElement);
27 27
 
28
-        return $apiDocument;
29
-    }
28
+		return $apiDocument;
29
+	}
30 30
 }
Please login to merge, or discard this patch.