@@ -10,21 +10,21 @@ |
||
10 | 10 | |
11 | 11 | abstract class PublicInterfacePageBase extends PageBase |
12 | 12 | { |
13 | - /** |
|
14 | - * PublicInterfaceInternalPageBase constructor. |
|
15 | - */ |
|
16 | - public function __construct() |
|
17 | - { |
|
18 | - $this->template = 'publicbase.tpl'; |
|
19 | - } |
|
13 | + /** |
|
14 | + * PublicInterfaceInternalPageBase constructor. |
|
15 | + */ |
|
16 | + public function __construct() |
|
17 | + { |
|
18 | + $this->template = 'publicbase.tpl'; |
|
19 | + } |
|
20 | 20 | |
21 | - final public function execute() |
|
22 | - { |
|
23 | - parent::execute(); |
|
24 | - } |
|
21 | + final public function execute() |
|
22 | + { |
|
23 | + parent::execute(); |
|
24 | + } |
|
25 | 25 | |
26 | - final public function finalisePage() |
|
27 | - { |
|
28 | - parent::finalisePage(); |
|
29 | - } |
|
26 | + final public function finalisePage() |
|
27 | + { |
|
28 | + parent::finalisePage(); |
|
29 | + } |
|
30 | 30 | } |
31 | 31 | \ No newline at end of file |
@@ -12,21 +12,21 @@ |
||
12 | 12 | |
13 | 13 | interface IRoutedTask extends ITask |
14 | 14 | { |
15 | - /** |
|
16 | - * Sets the route the request will take. Only should be called from the request router. |
|
17 | - * |
|
18 | - * @param $routeName string |
|
19 | - * |
|
20 | - * @return void |
|
21 | - * |
|
22 | - * @throws Exception |
|
23 | - * @category Security-Critical |
|
24 | - */ |
|
25 | - public function setRoute($routeName); |
|
15 | + /** |
|
16 | + * Sets the route the request will take. Only should be called from the request router. |
|
17 | + * |
|
18 | + * @param $routeName string |
|
19 | + * |
|
20 | + * @return void |
|
21 | + * |
|
22 | + * @throws Exception |
|
23 | + * @category Security-Critical |
|
24 | + */ |
|
25 | + public function setRoute($routeName); |
|
26 | 26 | |
27 | - /** |
|
28 | - * Gets the name of the route that has been passed from the request router. |
|
29 | - * @return string |
|
30 | - */ |
|
31 | - public function getRouteName(); |
|
27 | + /** |
|
28 | + * Gets the name of the route that has been passed from the request router. |
|
29 | + * @return string |
|
30 | + */ |
|
31 | + public function getRouteName(); |
|
32 | 32 | } |
33 | 33 | \ No newline at end of file |
@@ -10,8 +10,8 @@ |
||
10 | 10 | |
11 | 11 | class RegexConstants |
12 | 12 | { |
13 | - const IPV6_CIDR = '(?:/(?:12[0-8]|1[01][0-9]|[0-9]{1,2}))?'; |
|
14 | - const IPV4_CIDR = '(?:/(?:32|3[01]|[0-2]?[0-9]))?'; |
|
15 | - const IPV4 = '(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'; |
|
16 | - const IPV6 = '(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))'; |
|
13 | + const IPV6_CIDR = '(?:/(?:12[0-8]|1[01][0-9]|[0-9]{1,2}))?'; |
|
14 | + const IPV4_CIDR = '(?:/(?:32|3[01]|[0-2]?[0-9]))?'; |
|
15 | + const IPV4 = '(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'; |
|
16 | + const IPV6 = '(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))'; |
|
17 | 17 | } |
18 | 18 | \ No newline at end of file |
@@ -21,22 +21,22 @@ |
||
21 | 21 | */ |
22 | 22 | abstract class ReadableException extends Exception |
23 | 23 | { |
24 | - use TemplateOutput; |
|
24 | + use TemplateOutput; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Returns a readable HTML error message that's displayable to the user using templates. |
|
28 | - * @return string |
|
29 | - */ |
|
30 | - abstract public function getReadableError(); |
|
26 | + /** |
|
27 | + * Returns a readable HTML error message that's displayable to the user using templates. |
|
28 | + * @return string |
|
29 | + */ |
|
30 | + abstract public function getReadableError(); |
|
31 | 31 | |
32 | - /** |
|
33 | - * @return SiteConfiguration |
|
34 | - */ |
|
35 | - protected function getSiteConfiguration() |
|
36 | - { |
|
37 | - // Uck. However, we have encountered an exception. |
|
38 | - global $siteConfiguration; |
|
32 | + /** |
|
33 | + * @return SiteConfiguration |
|
34 | + */ |
|
35 | + protected function getSiteConfiguration() |
|
36 | + { |
|
37 | + // Uck. However, we have encountered an exception. |
|
38 | + global $siteConfiguration; |
|
39 | 39 | |
40 | - return $siteConfiguration; |
|
41 | - } |
|
40 | + return $siteConfiguration; |
|
41 | + } |
|
42 | 42 | } |
43 | 43 | \ No newline at end of file |
@@ -21,13 +21,13 @@ |
||
21 | 21 | */ |
22 | 22 | class EnvironmentException extends Exception |
23 | 23 | { |
24 | - /** |
|
25 | - * EnvironmentException constructor. |
|
26 | - * |
|
27 | - * @param string $friendlyMessage |
|
28 | - */ |
|
29 | - public function __construct($friendlyMessage) |
|
30 | - { |
|
31 | - parent::__construct($friendlyMessage); |
|
32 | - } |
|
24 | + /** |
|
25 | + * EnvironmentException constructor. |
|
26 | + * |
|
27 | + * @param string $friendlyMessage |
|
28 | + */ |
|
29 | + public function __construct($friendlyMessage) |
|
30 | + { |
|
31 | + parent::__construct($friendlyMessage); |
|
32 | + } |
|
33 | 33 | } |
34 | 34 | \ No newline at end of file |
@@ -18,101 +18,101 @@ |
||
18 | 18 | */ |
19 | 19 | class AntiSpoofCache extends DataObject |
20 | 20 | { |
21 | - /** @var string */ |
|
22 | - protected $username; |
|
23 | - /** @var string */ |
|
24 | - protected $data; |
|
25 | - /** @var string */ |
|
26 | - protected $timestamp; |
|
27 | - |
|
28 | - /** |
|
29 | - * @param string $username |
|
30 | - * @param PdoDatabase $database |
|
31 | - * |
|
32 | - * @return AntiSpoofCache|false |
|
33 | - */ |
|
34 | - public static function getByUsername($username, PdoDatabase $database) |
|
35 | - { |
|
36 | - $statement = $database->prepare(<<<SQL |
|
21 | + /** @var string */ |
|
22 | + protected $username; |
|
23 | + /** @var string */ |
|
24 | + protected $data; |
|
25 | + /** @var string */ |
|
26 | + protected $timestamp; |
|
27 | + |
|
28 | + /** |
|
29 | + * @param string $username |
|
30 | + * @param PdoDatabase $database |
|
31 | + * |
|
32 | + * @return AntiSpoofCache|false |
|
33 | + */ |
|
34 | + public static function getByUsername($username, PdoDatabase $database) |
|
35 | + { |
|
36 | + $statement = $database->prepare(<<<SQL |
|
37 | 37 | SELECT * |
38 | 38 | FROM antispoofcache |
39 | 39 | WHERE username = :id AND timestamp > date_sub(now(), INTERVAL 3 HOUR) |
40 | 40 | LIMIT 1 |
41 | 41 | SQL |
42 | - ); |
|
43 | - $statement->bindValue(":id", $username); |
|
44 | - |
|
45 | - $statement->execute(); |
|
46 | - |
|
47 | - $resultObject = $statement->fetchObject(get_called_class()); |
|
48 | - |
|
49 | - if ($resultObject != false) { |
|
50 | - $resultObject->setDatabase($database); |
|
51 | - } |
|
52 | - |
|
53 | - return $resultObject; |
|
54 | - } |
|
55 | - |
|
56 | - /** |
|
57 | - * @return string |
|
58 | - */ |
|
59 | - public function getUsername() |
|
60 | - { |
|
61 | - return $this->username; |
|
62 | - } |
|
63 | - |
|
64 | - /** |
|
65 | - * @param string $username |
|
66 | - */ |
|
67 | - public function setUsername($username) |
|
68 | - { |
|
69 | - $this->username = $username; |
|
70 | - } |
|
71 | - |
|
72 | - /** |
|
73 | - * @return string |
|
74 | - */ |
|
75 | - public function getData() |
|
76 | - { |
|
77 | - return $this->data; |
|
78 | - } |
|
79 | - |
|
80 | - /** |
|
81 | - * @param string $data |
|
82 | - */ |
|
83 | - public function setData($data) |
|
84 | - { |
|
85 | - $this->data = $data; |
|
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * @return DateTimeImmutable |
|
90 | - */ |
|
91 | - public function getTimestamp() |
|
92 | - { |
|
93 | - return new DateTimeImmutable($this->timestamp); |
|
94 | - } |
|
95 | - |
|
96 | - /** |
|
97 | - * @throws Exception |
|
98 | - */ |
|
99 | - public function save() |
|
100 | - { |
|
101 | - if ($this->isNew()) { |
|
102 | - // insert |
|
103 | - // clear old data first |
|
104 | - $this->dbObject->exec("DELETE FROM antispoofcache WHERE timestamp < date_sub(now(), INTERVAL 3 HOUR);"); |
|
105 | - |
|
106 | - $statement = $this->dbObject->prepare("INSERT INTO antispoofcache (username, data) VALUES (:username, :data);"); |
|
107 | - $statement->bindValue(":username", $this->username); |
|
108 | - $statement->bindValue(":data", $this->data); |
|
109 | - |
|
110 | - if ($statement->execute()) { |
|
111 | - $this->id = (int)$this->dbObject->lastInsertId(); |
|
112 | - } |
|
113 | - else { |
|
114 | - throw new Exception($statement->errorInfo()); |
|
115 | - } |
|
116 | - } |
|
117 | - } |
|
42 | + ); |
|
43 | + $statement->bindValue(":id", $username); |
|
44 | + |
|
45 | + $statement->execute(); |
|
46 | + |
|
47 | + $resultObject = $statement->fetchObject(get_called_class()); |
|
48 | + |
|
49 | + if ($resultObject != false) { |
|
50 | + $resultObject->setDatabase($database); |
|
51 | + } |
|
52 | + |
|
53 | + return $resultObject; |
|
54 | + } |
|
55 | + |
|
56 | + /** |
|
57 | + * @return string |
|
58 | + */ |
|
59 | + public function getUsername() |
|
60 | + { |
|
61 | + return $this->username; |
|
62 | + } |
|
63 | + |
|
64 | + /** |
|
65 | + * @param string $username |
|
66 | + */ |
|
67 | + public function setUsername($username) |
|
68 | + { |
|
69 | + $this->username = $username; |
|
70 | + } |
|
71 | + |
|
72 | + /** |
|
73 | + * @return string |
|
74 | + */ |
|
75 | + public function getData() |
|
76 | + { |
|
77 | + return $this->data; |
|
78 | + } |
|
79 | + |
|
80 | + /** |
|
81 | + * @param string $data |
|
82 | + */ |
|
83 | + public function setData($data) |
|
84 | + { |
|
85 | + $this->data = $data; |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * @return DateTimeImmutable |
|
90 | + */ |
|
91 | + public function getTimestamp() |
|
92 | + { |
|
93 | + return new DateTimeImmutable($this->timestamp); |
|
94 | + } |
|
95 | + |
|
96 | + /** |
|
97 | + * @throws Exception |
|
98 | + */ |
|
99 | + public function save() |
|
100 | + { |
|
101 | + if ($this->isNew()) { |
|
102 | + // insert |
|
103 | + // clear old data first |
|
104 | + $this->dbObject->exec("DELETE FROM antispoofcache WHERE timestamp < date_sub(now(), INTERVAL 3 HOUR);"); |
|
105 | + |
|
106 | + $statement = $this->dbObject->prepare("INSERT INTO antispoofcache (username, data) VALUES (:username, :data);"); |
|
107 | + $statement->bindValue(":username", $this->username); |
|
108 | + $statement->bindValue(":data", $this->data); |
|
109 | + |
|
110 | + if ($statement->execute()) { |
|
111 | + $this->id = (int)$this->dbObject->lastInsertId(); |
|
112 | + } |
|
113 | + else { |
|
114 | + throw new Exception($statement->errorInfo()); |
|
115 | + } |
|
116 | + } |
|
117 | + } |
|
118 | 118 | } |
@@ -10,19 +10,19 @@ |
||
10 | 10 | |
11 | 11 | class PageRegisterStandard extends PageRegisterBase |
12 | 12 | { |
13 | - /** |
|
14 | - * @return string |
|
15 | - */ |
|
16 | - protected function getRegistrationTemplate() |
|
17 | - { |
|
18 | - return "registration/register.tpl"; |
|
19 | - } |
|
13 | + /** |
|
14 | + * @return string |
|
15 | + */ |
|
16 | + protected function getRegistrationTemplate() |
|
17 | + { |
|
18 | + return "registration/register.tpl"; |
|
19 | + } |
|
20 | 20 | |
21 | - /** |
|
22 | - * @return string |
|
23 | - */ |
|
24 | - protected function getDefaultRole() |
|
25 | - { |
|
26 | - return 'user'; |
|
27 | - } |
|
21 | + /** |
|
22 | + * @return string |
|
23 | + */ |
|
24 | + protected function getDefaultRole() |
|
25 | + { |
|
26 | + return 'user'; |
|
27 | + } |
|
28 | 28 | } |
@@ -15,37 +15,37 @@ |
||
15 | 15 | |
16 | 16 | class PageSiteNotice extends InternalPageBase |
17 | 17 | { |
18 | - /** |
|
19 | - * Main function for this page, when no specific actions are called. |
|
20 | - * @return void |
|
21 | - */ |
|
22 | - protected function main() |
|
23 | - { |
|
24 | - $this->setHtmlTitle('Site Notice'); |
|
25 | - |
|
26 | - $database = $this->getDatabase(); |
|
27 | - |
|
28 | - /** @var SiteNotice $siteNoticeMessage */ |
|
29 | - $siteNoticeMessage = SiteNotice::getById(1, $database); |
|
30 | - |
|
31 | - // Dual-mode |
|
32 | - if (WebRequest::wasPosted()) { |
|
33 | - $this->validateCSRFToken(); |
|
34 | - |
|
35 | - $siteNoticeMessage->setContent(WebRequest::postString('mailtext')); |
|
36 | - $siteNoticeMessage->setUpdateVersion(WebRequest::postInt('updateversion')); |
|
37 | - $siteNoticeMessage->save(); |
|
38 | - |
|
39 | - Logger::siteNoticeEdited($database, $siteNoticeMessage); |
|
40 | - $this->getNotificationHelper()->siteNoticeEdited(); |
|
41 | - |
|
42 | - $this->redirect(); |
|
43 | - } |
|
44 | - else { |
|
45 | - $this->assignCSRFToken(); |
|
46 | - |
|
47 | - $this->setTemplate('site-notice/edit-form.tpl'); |
|
48 | - $this->assign('message', $siteNoticeMessage); |
|
49 | - } |
|
50 | - } |
|
18 | + /** |
|
19 | + * Main function for this page, when no specific actions are called. |
|
20 | + * @return void |
|
21 | + */ |
|
22 | + protected function main() |
|
23 | + { |
|
24 | + $this->setHtmlTitle('Site Notice'); |
|
25 | + |
|
26 | + $database = $this->getDatabase(); |
|
27 | + |
|
28 | + /** @var SiteNotice $siteNoticeMessage */ |
|
29 | + $siteNoticeMessage = SiteNotice::getById(1, $database); |
|
30 | + |
|
31 | + // Dual-mode |
|
32 | + if (WebRequest::wasPosted()) { |
|
33 | + $this->validateCSRFToken(); |
|
34 | + |
|
35 | + $siteNoticeMessage->setContent(WebRequest::postString('mailtext')); |
|
36 | + $siteNoticeMessage->setUpdateVersion(WebRequest::postInt('updateversion')); |
|
37 | + $siteNoticeMessage->save(); |
|
38 | + |
|
39 | + Logger::siteNoticeEdited($database, $siteNoticeMessage); |
|
40 | + $this->getNotificationHelper()->siteNoticeEdited(); |
|
41 | + |
|
42 | + $this->redirect(); |
|
43 | + } |
|
44 | + else { |
|
45 | + $this->assignCSRFToken(); |
|
46 | + |
|
47 | + $this->setTemplate('site-notice/edit-form.tpl'); |
|
48 | + $this->assign('message', $siteNoticeMessage); |
|
49 | + } |
|
50 | + } |
|
51 | 51 | } |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | |
14 | 14 | class StatsReservedRequests extends InternalPageBase |
15 | 15 | { |
16 | - public function main() |
|
17 | - { |
|
18 | - $this->setHtmlTitle('Reserved Requests :: Statistics'); |
|
16 | + public function main() |
|
17 | + { |
|
18 | + $this->setHtmlTitle('Reserved Requests :: Statistics'); |
|
19 | 19 | |
20 | - $query = <<<sql |
|
20 | + $query = <<<sql |
|
21 | 21 | SELECT |
22 | 22 | p.id AS requestid, |
23 | 23 | p.name AS name, |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | WHERE reserved != 0; |
30 | 30 | sql; |
31 | 31 | |
32 | - $database = $this->getDatabase(); |
|
33 | - $statement = $database->query($query); |
|
34 | - $data = $statement->fetchAll(PDO::FETCH_ASSOC); |
|
35 | - $this->assign('dataTable', $data); |
|
36 | - $this->assign('statsPageTitle', 'All currently reserved requests'); |
|
37 | - $this->setTemplate('statistics/reserved-requests.tpl'); |
|
38 | - } |
|
32 | + $database = $this->getDatabase(); |
|
33 | + $statement = $database->query($query); |
|
34 | + $data = $statement->fetchAll(PDO::FETCH_ASSOC); |
|
35 | + $this->assign('dataTable', $data); |
|
36 | + $this->assign('statsPageTitle', 'All currently reserved requests'); |
|
37 | + $this->setTemplate('statistics/reserved-requests.tpl'); |
|
38 | + } |
|
39 | 39 | } |