Completed
Pull Request — newinternal-bugfixing (#286)
by Simon
17:18 queued 07:20
created
includes/Pages/Statistics/StatsTopCreators.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -13,12 +13,12 @@  discard block
 block discarded – undo
13 13
 
14 14
 class StatsTopCreators extends InternalPageBase
15 15
 {
16
-    public function main()
17
-    {
18
-        $this->setHtmlTitle('Top Creators :: Statistics');
16
+	public function main()
17
+	{
18
+		$this->setHtmlTitle('Top Creators :: Statistics');
19 19
 
20
-        // Retrieve all-time stats
21
-        $queryAllTime = <<<SQL
20
+		// Retrieve all-time stats
21
+		$queryAllTime = <<<SQL
22 22
 SELECT
23 23
 	/* StatsTopCreators::execute()/queryAllTime */
24 24
     COUNT(*) count,
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 ORDER BY COUNT(*) DESC;
36 36
 SQL;
37 37
 
38
-        // Retrieve all-time stats for active users only
39
-        $queryAllTimeActive = <<<SQL
38
+		// Retrieve all-time stats for active users only
39
+		$queryAllTimeActive = <<<SQL
40 40
 SELECT
41 41
 	/* StatsTopCreators::execute()/queryAllTimeActive */
42 42
     COUNT(*) count,
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 ORDER BY COUNT(*) DESC;
54 54
 SQL;
55 55
 
56
-        // Retrieve today's stats (so far)
57
-        $queryToday = <<<SQL
56
+		// Retrieve today's stats (so far)
57
+		$queryToday = <<<SQL
58 58
 SELECT
59 59
 	/* StatsTopCreators::execute()/top5out */
60 60
     COUNT(*) count,
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 ORDER BY COUNT(*) DESC;
71 71
 SQL;
72 72
 
73
-        // Retrieve Yesterday's stats
74
-        $queryYesterday = <<<SQL
73
+		// Retrieve Yesterday's stats
74
+		$queryYesterday = <<<SQL
75 75
 SELECT
76 76
 	/* StatsTopCreators::execute()/top5yout */
77 77
     COUNT(*) count,
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 ORDER BY COUNT(*) DESC;
88 88
 SQL;
89 89
 
90
-        // Retrieve last 7 days
91
-        $queryLast7Days = <<<SQL
90
+		// Retrieve last 7 days
91
+		$queryLast7Days = <<<SQL
92 92
 SELECT
93 93
 	/* StatsTopCreators::execute()/top5wout */
94 94
     COUNT(*) count,
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 ORDER BY COUNT(*) DESC;
105 105
 SQL;
106 106
 
107
-        // Retrieve last month's stats
108
-        $queryLast28Days = <<<SQL
107
+		// Retrieve last month's stats
108
+		$queryLast28Days = <<<SQL
109 109
 SELECT
110 110
 	/* StatsTopCreators::execute()/top5mout */
111 111
     COUNT(*) count,
@@ -121,24 +121,24 @@  discard block
 block discarded – undo
121 121
 ORDER BY COUNT(*) DESC;
122 122
 SQL;
123 123
 
124
-        // Put it all together
125
-        $queries = array(
126
-            'queryAllTime'       => $queryAllTime,
127
-            'queryAllTimeActive' => $queryAllTimeActive,
128
-            'queryToday'         => $queryToday,
129
-            'queryYesterday'     => $queryYesterday,
130
-            'queryLast7Days'     => $queryLast7Days,
131
-            'queryLast28Days'    => $queryLast28Days,
132
-        );
124
+		// Put it all together
125
+		$queries = array(
126
+			'queryAllTime'       => $queryAllTime,
127
+			'queryAllTimeActive' => $queryAllTimeActive,
128
+			'queryToday'         => $queryToday,
129
+			'queryYesterday'     => $queryYesterday,
130
+			'queryLast7Days'     => $queryLast7Days,
131
+			'queryLast28Days'    => $queryLast28Days,
132
+		);
133 133
 
134
-        $database = $this->getDatabase();
135
-        foreach ($queries as $name => $sql) {
136
-            $statement = $database->query($sql);
137
-            $data = $statement->fetchAll(PDO::FETCH_ASSOC);
138
-            $this->assign($name, $data);
139
-        }
134
+		$database = $this->getDatabase();
135
+		foreach ($queries as $name => $sql) {
136
+			$statement = $database->query($sql);
137
+			$data = $statement->fetchAll(PDO::FETCH_ASSOC);
138
+			$this->assign($name, $data);
139
+		}
140 140
 
141
-        $this->assign('statsPageTitle', 'Top Account Creators');
142
-        $this->setTemplate('statistics/top-creators.tpl');
143
-    }
141
+		$this->assign('statsPageTitle', 'Top Account Creators');
142
+		$this->setTemplate('statistics/top-creators.tpl');
143
+	}
144 144
 }
Please login to merge, or discard this patch.
includes/Pages/Statistics/StatsInactiveUsers.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -17,31 +17,31 @@
 block discarded – undo
17 17
 
18 18
 class StatsInactiveUsers extends InternalPageBase
19 19
 {
20
-    public function main()
21
-    {
22
-        $this->setHtmlTitle('Inactive Users :: Statistics');
23
-
24
-        $date = new DateTime();
25
-        $date->modify("-45 days");
26
-
27
-        $inactiveUsers = UserSearchHelper::get($this->getDatabase())
28
-            ->byStatus('Active')
29
-            ->lastActiveBefore($date)
30
-            ->getRoleMap($roleMap)
31
-            ->fetch();
32
-
33
-        $this->assign('inactiveUsers', $inactiveUsers);
34
-        $this->assign('roles', $roleMap);
35
-        $this->assign('canSuspend',
36
-            $this->barrierTest('suspend', User::getCurrent($this->getDatabase()), PageUserManagement::class));
37
-
38
-        $immuneUsers = $this->getDatabase()
39
-            ->query("SELECT user FROM userrole WHERE role IN ('toolRoot', 'checkuser') GROUP BY user;")
40
-            ->fetchAll(PDO::FETCH_COLUMN);
20
+	public function main()
21
+	{
22
+		$this->setHtmlTitle('Inactive Users :: Statistics');
23
+
24
+		$date = new DateTime();
25
+		$date->modify("-45 days");
26
+
27
+		$inactiveUsers = UserSearchHelper::get($this->getDatabase())
28
+			->byStatus('Active')
29
+			->lastActiveBefore($date)
30
+			->getRoleMap($roleMap)
31
+			->fetch();
32
+
33
+		$this->assign('inactiveUsers', $inactiveUsers);
34
+		$this->assign('roles', $roleMap);
35
+		$this->assign('canSuspend',
36
+			$this->barrierTest('suspend', User::getCurrent($this->getDatabase()), PageUserManagement::class));
37
+
38
+		$immuneUsers = $this->getDatabase()
39
+			->query("SELECT user FROM userrole WHERE role IN ('toolRoot', 'checkuser') GROUP BY user;")
40
+			->fetchAll(PDO::FETCH_COLUMN);
41 41
         
42
-        $this->assign('immune', array_fill_keys($immuneUsers, true));
42
+		$this->assign('immune', array_fill_keys($immuneUsers, true));
43 43
 
44
-        $this->setTemplate('statistics/inactive-users.tpl');
45
-        $this->assign('statsPageTitle', 'Inactive tool users');
46
-    }
44
+		$this->setTemplate('statistics/inactive-users.tpl');
45
+		$this->assign('statsPageTitle', 'Inactive tool users');
46
+	}
47 47
 }
Please login to merge, or discard this patch.
includes/Pages/Statistics/StatsMonthlyStats.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
 
14 14
 class StatsMonthlyStats extends InternalPageBase
15 15
 {
16
-    public function main()
17
-    {
18
-        $this->setHtmlTitle('Monthly Stats :: Statistics');
16
+	public function main()
17
+	{
18
+		$this->setHtmlTitle('Monthly Stats :: Statistics');
19 19
 
20
-        $query = <<<SQL
20
+		$query = <<<SQL
21 21
 SELECT
22 22
     COUNT(DISTINCT id) AS closed,
23 23
     YEAR(timestamp) AS year,
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
 ORDER BY YEAR(timestamp) , MONTH(timestamp) ASC;
29 29
 SQL;
30 30
 
31
-        $database = $this->getDatabase();
32
-        $statement = $database->query($query);
33
-        $data = $statement->fetchAll(PDO::FETCH_ASSOC);
31
+		$database = $this->getDatabase();
32
+		$statement = $database->query($query);
33
+		$data = $statement->fetchAll(PDO::FETCH_ASSOC);
34 34
 
35
-        $this->assign('dataTable', $data);
36
-        $this->assign('statsPageTitle', 'Monthly Statistics');
37
-        $this->setTemplate('statistics/monthly-stats.tpl');
38
-    }
35
+		$this->assign('dataTable', $data);
36
+		$this->assign('statsPageTitle', 'Monthly Statistics');
37
+		$this->setTemplate('statistics/monthly-stats.tpl');
38
+	}
39 39
 }
Please login to merge, or discard this patch.
includes/Pages/Statistics/StatsFastCloses.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
 
14 14
 class StatsFastCloses extends InternalPageBase
15 15
 {
16
-    public function main()
17
-    {
18
-        $this->setHtmlTitle('Fast Closes :: Statistics');
16
+	public function main()
17
+	{
18
+		$this->setHtmlTitle('Fast Closes :: Statistics');
19 19
 
20
-        $query = <<<SQL
20
+		$query = <<<SQL
21 21
 SELECT
22 22
   log_closed.objectid AS request,
23 23
   user.username AS user,
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 ORDER BY TIMEDIFF(log_closed.timestamp, log_reserved.timestamp) ASC
43 43
 ;
44 44
 SQL;
45
-        $database = $this->getDatabase();
46
-        $statement = $database->query($query);
47
-        $data = $statement->fetchAll(PDO::FETCH_ASSOC);
48
-        $this->assign('dataTable', $data);
49
-        $this->assign('statsPageTitle', 'Requests closed less than 30 seconds after reservation in the past 3 months');
50
-        $this->setTemplate('statistics/fast-closes.tpl');
51
-    }
45
+		$database = $this->getDatabase();
46
+		$statement = $database->query($query);
47
+		$data = $statement->fetchAll(PDO::FETCH_ASSOC);
48
+		$this->assign('dataTable', $data);
49
+		$this->assign('statsPageTitle', 'Requests closed less than 30 seconds after reservation in the past 3 months');
50
+		$this->setTemplate('statistics/fast-closes.tpl');
51
+	}
52 52
 }
Please login to merge, or discard this patch.
includes/Pages/Statistics/StatsMain.php 1 patch
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -12,99 +12,99 @@
 block discarded – undo
12 12
 
13 13
 class StatsMain extends InternalPageBase
14 14
 {
15
-    public function main()
16
-    {
17
-        $this->setHtmlTitle('Statistics');
18
-
19
-        $this->assign('statsPageTitle', 'Account Creation Statistics');
20
-
21
-        $statsPages = array(
22
-            'fastCloses'       => 'Requests closed less than 30 seconds after reservation in the past 3 months',
23
-            'inactiveUsers'    => 'Inactive tool users',
24
-            'monthlyStats'     => 'Monthly Statistics',
25
-            'reservedRequests' => 'All currently reserved requests',
26
-            'templateStats'    => 'Template Stats',
27
-            'topCreators'      => 'Top Account Creators',
28
-            'users'            => 'Account Creation Tool users',
29
-        );
30
-
31
-        $this->generateSmallStatsTable();
32
-
33
-        $this->assign('statsPages', $statsPages);
34
-
35
-        $graphList = array('day', '2day', '4day', 'week', '2week', 'month', '3month');
36
-        $this->assign('graphList', $graphList);
37
-
38
-        $this->setTemplate('statistics/main.tpl');
39
-    }
40
-
41
-    /**
42
-     * Gets the relevant statistics from the database for the small statistics table
43
-     */
44
-    private function generateSmallStatsTable()
45
-    {
46
-        $database = $this->getDatabase();
47
-        $requestsQuery = <<<'SQL'
15
+	public function main()
16
+	{
17
+		$this->setHtmlTitle('Statistics');
18
+
19
+		$this->assign('statsPageTitle', 'Account Creation Statistics');
20
+
21
+		$statsPages = array(
22
+			'fastCloses'       => 'Requests closed less than 30 seconds after reservation in the past 3 months',
23
+			'inactiveUsers'    => 'Inactive tool users',
24
+			'monthlyStats'     => 'Monthly Statistics',
25
+			'reservedRequests' => 'All currently reserved requests',
26
+			'templateStats'    => 'Template Stats',
27
+			'topCreators'      => 'Top Account Creators',
28
+			'users'            => 'Account Creation Tool users',
29
+		);
30
+
31
+		$this->generateSmallStatsTable();
32
+
33
+		$this->assign('statsPages', $statsPages);
34
+
35
+		$graphList = array('day', '2day', '4day', 'week', '2week', 'month', '3month');
36
+		$this->assign('graphList', $graphList);
37
+
38
+		$this->setTemplate('statistics/main.tpl');
39
+	}
40
+
41
+	/**
42
+	 * Gets the relevant statistics from the database for the small statistics table
43
+	 */
44
+	private function generateSmallStatsTable()
45
+	{
46
+		$database = $this->getDatabase();
47
+		$requestsQuery = <<<'SQL'
48 48
 SELECT COUNT(*) FROM request WHERE status = :status AND emailconfirm = 'Confirmed';
49 49
 SQL;
50
-        $requestsStatement = $database->prepare($requestsQuery);
50
+		$requestsStatement = $database->prepare($requestsQuery);
51 51
 
52
-        $requestStates = $this->getSiteConfiguration()->getRequestStates();
52
+		$requestStates = $this->getSiteConfiguration()->getRequestStates();
53 53
 
54
-        $requestStateData = array();
54
+		$requestStateData = array();
55 55
 
56
-        foreach ($requestStates as $statusName => $data) {
57
-            $requestsStatement->execute(array(':status' => $statusName));
58
-            $requestCount = $requestsStatement->fetchColumn();
59
-            $requestsStatement->closeCursor();
60
-            $headerText = $data['header'];
61
-            $requestStateData[$headerText] = $requestCount;
62
-        }
56
+		foreach ($requestStates as $statusName => $data) {
57
+			$requestsStatement->execute(array(':status' => $statusName));
58
+			$requestCount = $requestsStatement->fetchColumn();
59
+			$requestsStatement->closeCursor();
60
+			$headerText = $data['header'];
61
+			$requestStateData[$headerText] = $requestCount;
62
+		}
63 63
 
64
-        $this->assign('requestCountData', $requestStateData);
64
+		$this->assign('requestCountData', $requestStateData);
65 65
 
66
-        // Unconfirmed requests
67
-        $unconfirmedStatement = $database->query(<<<SQL
66
+		// Unconfirmed requests
67
+		$unconfirmedStatement = $database->query(<<<SQL
68 68
 SELECT COUNT(*) FROM request WHERE emailconfirm != 'Confirmed' AND emailconfirm != '';
69 69
 SQL
70
-        );
71
-        $unconfirmed = $unconfirmedStatement->fetchColumn();
72
-        $unconfirmedStatement->closeCursor();
73
-        $this->assign('statsUnconfirmed', $unconfirmed);
74
-
75
-        $userStatusStatement = $database->prepare('SELECT COUNT(*) FROM user WHERE status = :status;');
76
-
77
-        // Admin users
78
-        $userStatusStatement->execute(array(':status' => 'Admin'));
79
-        $adminUsers = $userStatusStatement->fetchColumn();
80
-        $userStatusStatement->closeCursor();
81
-        $this->assign('statsAdminUsers', $adminUsers);
82
-
83
-        // Users
84
-        $userStatusStatement->execute(array(':status' => 'User'));
85
-        $users = $userStatusStatement->fetchColumn();
86
-        $userStatusStatement->closeCursor();
87
-        $this->assign('statsUsers', $users);
88
-
89
-        // Suspended users
90
-        $userStatusStatement->execute(array(':status' => 'Suspended'));
91
-        $suspendedUsers = $userStatusStatement->fetchColumn();
92
-        $userStatusStatement->closeCursor();
93
-        $this->assign('statsSuspendedUsers', $suspendedUsers);
94
-
95
-        // New users
96
-        $userStatusStatement->execute(array(':status' => 'New'));
97
-        $newUsers = $userStatusStatement->fetchColumn();
98
-        $userStatusStatement->closeCursor();
99
-        $this->assign('statsNewUsers', $newUsers);
100
-
101
-        // Most comments on a request
102
-        $mostCommentsStatement = $database->query(<<<SQL
70
+		);
71
+		$unconfirmed = $unconfirmedStatement->fetchColumn();
72
+		$unconfirmedStatement->closeCursor();
73
+		$this->assign('statsUnconfirmed', $unconfirmed);
74
+
75
+		$userStatusStatement = $database->prepare('SELECT COUNT(*) FROM user WHERE status = :status;');
76
+
77
+		// Admin users
78
+		$userStatusStatement->execute(array(':status' => 'Admin'));
79
+		$adminUsers = $userStatusStatement->fetchColumn();
80
+		$userStatusStatement->closeCursor();
81
+		$this->assign('statsAdminUsers', $adminUsers);
82
+
83
+		// Users
84
+		$userStatusStatement->execute(array(':status' => 'User'));
85
+		$users = $userStatusStatement->fetchColumn();
86
+		$userStatusStatement->closeCursor();
87
+		$this->assign('statsUsers', $users);
88
+
89
+		// Suspended users
90
+		$userStatusStatement->execute(array(':status' => 'Suspended'));
91
+		$suspendedUsers = $userStatusStatement->fetchColumn();
92
+		$userStatusStatement->closeCursor();
93
+		$this->assign('statsSuspendedUsers', $suspendedUsers);
94
+
95
+		// New users
96
+		$userStatusStatement->execute(array(':status' => 'New'));
97
+		$newUsers = $userStatusStatement->fetchColumn();
98
+		$userStatusStatement->closeCursor();
99
+		$this->assign('statsNewUsers', $newUsers);
100
+
101
+		// Most comments on a request
102
+		$mostCommentsStatement = $database->query(<<<SQL
103 103
 SELECT request FROM comment GROUP BY request ORDER BY COUNT(*) DESC LIMIT 1;
104 104
 SQL
105
-        );
106
-        $mostComments = $mostCommentsStatement->fetchColumn();
107
-        $mostCommentsStatement->closeCursor();
108
-        $this->assign('mostComments', $mostComments);
109
-    }
105
+		);
106
+		$mostComments = $mostCommentsStatement->fetchColumn();
107
+		$mostCommentsStatement->closeCursor();
108
+		$this->assign('mostComments', $mostComments);
109
+	}
110 110
 }
Please login to merge, or discard this patch.
includes/Pages/Statistics/StatsTemplateStats.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
 
14 14
 class StatsTemplateStats extends InternalPageBase
15 15
 {
16
-    public function main()
17
-    {
18
-        $this->setHtmlTitle('Template Stats :: Statistics');
16
+	public function main()
17
+	{
18
+		$this->setHtmlTitle('Template Stats :: Statistics');
19 19
 
20
-        $query = <<<SQL
20
+		$query = <<<SQL
21 21
 SELECT
22 22
     t.id AS templateid,
23 23
     t.usercode AS usercode,
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
         GROUP BY welcome_template
46 46
     ) u2 ON u2.allid = t.id;
47 47
 SQL;
48
-        $database = $this->getDatabase();
49
-        $statement = $database->query($query);
50
-        $data = $statement->fetchAll(PDO::FETCH_ASSOC);
51
-        $this->assign('dataTable', $data);
52
-        $this->assign('statsPageTitle', 'Template Stats');
53
-        $this->setTemplate('statistics/welcome-template-usage.tpl');
54
-    }
48
+		$database = $this->getDatabase();
49
+		$statement = $database->query($query);
50
+		$data = $statement->fetchAll(PDO::FETCH_ASSOC);
51
+		$this->assign('dataTable', $data);
52
+		$this->assign('statsPageTitle', 'Template Stats');
53
+		$this->setTemplate('statistics/welcome-template-usage.tpl');
54
+	}
55 55
 }
Please login to merge, or discard this patch.
includes/Pages/Statistics/StatsReservedRequests.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
includes/Pages/RequestAction/PageBreakReservation.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -19,79 +19,79 @@
 block discarded – undo
19 19
 
20 20
 class PageBreakReservation extends RequestActionBase
21 21
 {
22
-    protected function main()
23
-    {
24
-        $this->checkPosted();
25
-        $database = $this->getDatabase();
26
-        $request = $this->getRequest($database);
22
+	protected function main()
23
+	{
24
+		$this->checkPosted();
25
+		$database = $this->getDatabase();
26
+		$request = $this->getRequest($database);
27 27
 
28
-        if ($request->getReserved() === null) {
29
-            throw new ApplicationLogicException('Request is not reserved!');
30
-        }
28
+		if ($request->getReserved() === null) {
29
+			throw new ApplicationLogicException('Request is not reserved!');
30
+		}
31 31
 
32
-        $currentUser = User::getCurrent($database);
32
+		$currentUser = User::getCurrent($database);
33 33
 
34
-        if ($currentUser->getId() === $request->getReserved()) {
35
-            $this->doUnreserve($request, $database);
36
-        }
37
-        else {
38
-            // not the same user!
39
-            if ($this->barrierTest('force', $currentUser)) {
40
-                $this->doBreakReserve($request, $database);
41
-            }
42
-            else {
43
-                throw new AccessDeniedException($this->getSecurityManager());
44
-            }
45
-        }
46
-    }
34
+		if ($currentUser->getId() === $request->getReserved()) {
35
+			$this->doUnreserve($request, $database);
36
+		}
37
+		else {
38
+			// not the same user!
39
+			if ($this->barrierTest('force', $currentUser)) {
40
+				$this->doBreakReserve($request, $database);
41
+			}
42
+			else {
43
+				throw new AccessDeniedException($this->getSecurityManager());
44
+			}
45
+		}
46
+	}
47 47
 
48
-    /**
49
-     * @param Request     $request
50
-     * @param PdoDatabase $database
51
-     *
52
-     * @throws Exception
53
-     */
54
-    protected function doUnreserve(Request $request, PdoDatabase $database)
55
-    {
56
-        // same user! we allow people to unreserve their own stuff
57
-        $request->setReserved(null);
58
-        $request->setUpdateVersion(WebRequest::postInt('updateversion'));
59
-        $request->save();
48
+	/**
49
+	 * @param Request     $request
50
+	 * @param PdoDatabase $database
51
+	 *
52
+	 * @throws Exception
53
+	 */
54
+	protected function doUnreserve(Request $request, PdoDatabase $database)
55
+	{
56
+		// same user! we allow people to unreserve their own stuff
57
+		$request->setReserved(null);
58
+		$request->setUpdateVersion(WebRequest::postInt('updateversion'));
59
+		$request->save();
60 60
 
61
-        Logger::unreserve($database, $request);
62
-        $this->getNotificationHelper()->requestUnreserved($request);
61
+		Logger::unreserve($database, $request);
62
+		$this->getNotificationHelper()->requestUnreserved($request);
63 63
 
64
-        // Redirect home!
65
-        $this->redirect();
66
-    }
64
+		// Redirect home!
65
+		$this->redirect();
66
+	}
67 67
 
68
-    /**
69
-     * @param Request     $request
70
-     * @param PdoDatabase $database
71
-     *
72
-     * @throws Exception
73
-     */
74
-    protected function doBreakReserve(Request $request, PdoDatabase $database)
75
-    {
76
-        if (!WebRequest::postBoolean("confirm")) {
77
-            $this->assignCSRFToken();
68
+	/**
69
+	 * @param Request     $request
70
+	 * @param PdoDatabase $database
71
+	 *
72
+	 * @throws Exception
73
+	 */
74
+	protected function doBreakReserve(Request $request, PdoDatabase $database)
75
+	{
76
+		if (!WebRequest::postBoolean("confirm")) {
77
+			$this->assignCSRFToken();
78 78
 
79
-            $this->assign("request", $request->getId());
80
-            $this->assign("reservedUser", User::getById($request->getReserved(), $database));
81
-            $this->assign("updateversion", WebRequest::postInt('updateversion'));
79
+			$this->assign("request", $request->getId());
80
+			$this->assign("reservedUser", User::getById($request->getReserved(), $database));
81
+			$this->assign("updateversion", WebRequest::postInt('updateversion'));
82 82
 
83
-            $this->setTemplate("confirmations/breakreserve.tpl");
84
-        }
85
-        else {
86
-            $request->setReserved(null);
87
-            $request->setUpdateVersion(WebRequest::postInt('updateversion'));
88
-            $request->save();
83
+			$this->setTemplate("confirmations/breakreserve.tpl");
84
+		}
85
+		else {
86
+			$request->setReserved(null);
87
+			$request->setUpdateVersion(WebRequest::postInt('updateversion'));
88
+			$request->save();
89 89
 
90
-            Logger::breakReserve($database, $request);
91
-            $this->getNotificationHelper()->requestReserveBroken($request);
90
+			Logger::breakReserve($database, $request);
91
+			$this->getNotificationHelper()->requestReserveBroken($request);
92 92
 
93
-            // Redirect home!
94
-            $this->redirect();
95
-        }
96
-    }
93
+			// Redirect home!
94
+			$this->redirect();
95
+		}
96
+	}
97 97
 }
Please login to merge, or discard this patch.
includes/Pages/RequestAction/PageComment.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -15,51 +15,51 @@
 block discarded – undo
15 15
 
16 16
 class PageComment extends RequestActionBase
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->checkPosted();
25
-        $database = $this->getDatabase();
26
-        $request = $this->getRequest($database);
18
+	/**
19
+	 * Main function for this page, when no specific actions are called.
20
+	 * @return void
21
+	 */
22
+	protected function main()
23
+	{
24
+		$this->checkPosted();
25
+		$database = $this->getDatabase();
26
+		$request = $this->getRequest($database);
27 27
 
28
-        $commentText = WebRequest::postString('comment');
29
-        if ($commentText === false || $commentText == '') {
30
-            $this->redirect('viewRequest', null, array('id' => $request->getId()));
28
+		$commentText = WebRequest::postString('comment');
29
+		if ($commentText === false || $commentText == '') {
30
+			$this->redirect('viewRequest', null, array('id' => $request->getId()));
31 31
 
32
-            return;
33
-        }
32
+			return;
33
+		}
34 34
 
35
-        //Look for and detect IPv4/IPv6 addresses in comment text, and warn the commenter.
36
-        $ipv4Regex = '/\b' . RegexConstants::IPV4 . '\b/';
37
-        $ipv6Regex = '/\b' . RegexConstants::IPV6 . '\b/';
35
+		//Look for and detect IPv4/IPv6 addresses in comment text, and warn the commenter.
36
+		$ipv4Regex = '/\b' . RegexConstants::IPV4 . '\b/';
37
+		$ipv6Regex = '/\b' . RegexConstants::IPV6 . '\b/';
38 38
 
39
-        $overridePolicy = WebRequest::postBoolean('privpol-check-override');
39
+		$overridePolicy = WebRequest::postBoolean('privpol-check-override');
40 40
 
41
-        if ((preg_match($ipv4Regex, $commentText) || preg_match($ipv6Regex, $commentText)) && !$overridePolicy) {
42
-            $this->assignCSRFToken();
43
-            $this->assign("request", $request);
44
-            $this->assign("comment", $commentText);
45
-            $this->setTemplate("privpol-warning.tpl");
41
+		if ((preg_match($ipv4Regex, $commentText) || preg_match($ipv6Regex, $commentText)) && !$overridePolicy) {
42
+			$this->assignCSRFToken();
43
+			$this->assign("request", $request);
44
+			$this->assign("comment", $commentText);
45
+			$this->setTemplate("privpol-warning.tpl");
46 46
 
47
-            return;
48
-        }
47
+			return;
48
+		}
49 49
 
50
-        $visibility = WebRequest::postBoolean('adminOnly') ? 'admin' : 'user';
50
+		$visibility = WebRequest::postBoolean('adminOnly') ? 'admin' : 'user';
51 51
 
52
-        $comment = new Comment();
53
-        $comment->setDatabase($database);
52
+		$comment = new Comment();
53
+		$comment->setDatabase($database);
54 54
 
55
-        $comment->setRequest($request->getId());
56
-        $comment->setVisibility($visibility);
57
-        $comment->setUser(User::getCurrent($database)->getId());
58
-        $comment->setComment($commentText);
55
+		$comment->setRequest($request->getId());
56
+		$comment->setVisibility($visibility);
57
+		$comment->setUser(User::getCurrent($database)->getId());
58
+		$comment->setComment($commentText);
59 59
 
60
-        $comment->save();
60
+		$comment->save();
61 61
 
62
-        $this->getNotificationHelper()->commentCreated($comment, $request);
63
-        $this->redirect('viewRequest', null, array('id' => $request->getId()));
64
-    }
62
+		$this->getNotificationHelper()->commentCreated($comment, $request);
63
+		$this->redirect('viewRequest', null, array('id' => $request->getId()));
64
+	}
65 65
 }
Please login to merge, or discard this patch.