Completed
Pull Request — newinternal (#285)
by Simon
07:17 queued 04:17
created
includes/Tasks/PublicInterfacePageBase.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -10,21 +10,21 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
includes/DataObject.php 1 patch
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -23,124 +23,124 @@
 block discarded – undo
23 23
  */
24 24
 abstract class DataObject
25 25
 {
26
-    /** @var int ID of the object */
27
-    protected $id = null;
28
-    /** @var int update version for optimistic locking */
29
-    protected $updateversion = 0;
30
-    /**
31
-     * @var PdoDatabase
32
-     */
33
-    protected $dbObject;
34
-
35
-    /**
36
-     * Retrieves a data object by it's row ID.
37
-     *
38
-     * @param int         $id
39
-     * @param PdoDatabase $database
40
-     *
41
-     * @return DataObject|false
42
-     */
43
-    public static function getById($id, PdoDatabase $database)
44
-    {
45
-        $array = explode('\\', get_called_class());
46
-        $realClassName = strtolower(end($array));
47
-
48
-        $statement = $database->prepare("SELECT * FROM {$realClassName} WHERE id = :id LIMIT 1;");
49
-        $statement->bindValue(":id", $id);
50
-
51
-        $statement->execute();
52
-
53
-        $resultObject = $statement->fetchObject(get_called_class());
54
-
55
-        if ($resultObject != false) {
56
-            $resultObject->setDatabase($database);
57
-        }
58
-
59
-        return $resultObject;
60
-    }
61
-
62
-    public function setDatabase(PdoDatabase $db)
63
-    {
64
-        $this->dbObject = $db;
65
-    }
66
-
67
-    /**
68
-     * Gets the database associated with this data object.
69
-     * @return PdoDatabase
70
-     */
71
-    public function getDatabase()
72
-    {
73
-        return $this->dbObject;
74
-    }
75
-
76
-    /**
77
-     * Saves a data object to the database, either updating or inserting a record.
78
-     *
79
-     * @return void
80
-     */
81
-    abstract public function save();
82
-
83
-    /**
84
-     * Retrieves the ID attribute
85
-     */
86
-    public function getId()
87
-    {
88
-        return (int)$this->id;
89
-    }
90
-
91
-    /**
92
-     * Deletes the object from the database
93
-     */
94
-    public function delete()
95
-    {
96
-        if ($this->id === null) {
97
-            // wtf?
98
-            return;
99
-        }
100
-
101
-        $array = explode('\\', get_called_class());
102
-        $realClassName = strtolower(end($array));
103
-
104
-        $deleteQuery = "DELETE FROM {$realClassName} WHERE id = :id AND updateversion = :updateversion LIMIT 1;";
105
-        $statement = $this->dbObject->prepare($deleteQuery);
106
-
107
-        $statement->bindValue(":id", $this->id);
108
-        $statement->bindValue(":updateversion", $this->updateversion);
109
-        $statement->execute();
110
-
111
-        if ($statement->rowCount() !== 1) {
112
-            throw new OptimisticLockFailedException();
113
-        }
114
-
115
-        $this->id = null;
116
-    }
117
-
118
-    /**
119
-     * @return int
120
-     */
121
-    public function getUpdateVersion()
122
-    {
123
-        return $this->updateversion;
124
-    }
125
-
126
-    /**
127
-     * Sets the update version.
128
-     *
129
-     * You should never call this to change the value of the update version. You should only call it when passing user
130
-     * input through.
131
-     *
132
-     * @param int $updateVersion
133
-     */
134
-    public function setUpdateVersion($updateVersion)
135
-    {
136
-        $this->updateversion = $updateVersion;
137
-    }
138
-
139
-    /**
140
-     * @return bool
141
-     */
142
-    public function isNew()
143
-    {
144
-        return $this->id === null;
145
-    }
26
+	/** @var int ID of the object */
27
+	protected $id = null;
28
+	/** @var int update version for optimistic locking */
29
+	protected $updateversion = 0;
30
+	/**
31
+	 * @var PdoDatabase
32
+	 */
33
+	protected $dbObject;
34
+
35
+	/**
36
+	 * Retrieves a data object by it's row ID.
37
+	 *
38
+	 * @param int         $id
39
+	 * @param PdoDatabase $database
40
+	 *
41
+	 * @return DataObject|false
42
+	 */
43
+	public static function getById($id, PdoDatabase $database)
44
+	{
45
+		$array = explode('\\', get_called_class());
46
+		$realClassName = strtolower(end($array));
47
+
48
+		$statement = $database->prepare("SELECT * FROM {$realClassName} WHERE id = :id LIMIT 1;");
49
+		$statement->bindValue(":id", $id);
50
+
51
+		$statement->execute();
52
+
53
+		$resultObject = $statement->fetchObject(get_called_class());
54
+
55
+		if ($resultObject != false) {
56
+			$resultObject->setDatabase($database);
57
+		}
58
+
59
+		return $resultObject;
60
+	}
61
+
62
+	public function setDatabase(PdoDatabase $db)
63
+	{
64
+		$this->dbObject = $db;
65
+	}
66
+
67
+	/**
68
+	 * Gets the database associated with this data object.
69
+	 * @return PdoDatabase
70
+	 */
71
+	public function getDatabase()
72
+	{
73
+		return $this->dbObject;
74
+	}
75
+
76
+	/**
77
+	 * Saves a data object to the database, either updating or inserting a record.
78
+	 *
79
+	 * @return void
80
+	 */
81
+	abstract public function save();
82
+
83
+	/**
84
+	 * Retrieves the ID attribute
85
+	 */
86
+	public function getId()
87
+	{
88
+		return (int)$this->id;
89
+	}
90
+
91
+	/**
92
+	 * Deletes the object from the database
93
+	 */
94
+	public function delete()
95
+	{
96
+		if ($this->id === null) {
97
+			// wtf?
98
+			return;
99
+		}
100
+
101
+		$array = explode('\\', get_called_class());
102
+		$realClassName = strtolower(end($array));
103
+
104
+		$deleteQuery = "DELETE FROM {$realClassName} WHERE id = :id AND updateversion = :updateversion LIMIT 1;";
105
+		$statement = $this->dbObject->prepare($deleteQuery);
106
+
107
+		$statement->bindValue(":id", $this->id);
108
+		$statement->bindValue(":updateversion", $this->updateversion);
109
+		$statement->execute();
110
+
111
+		if ($statement->rowCount() !== 1) {
112
+			throw new OptimisticLockFailedException();
113
+		}
114
+
115
+		$this->id = null;
116
+	}
117
+
118
+	/**
119
+	 * @return int
120
+	 */
121
+	public function getUpdateVersion()
122
+	{
123
+		return $this->updateversion;
124
+	}
125
+
126
+	/**
127
+	 * Sets the update version.
128
+	 *
129
+	 * You should never call this to change the value of the update version. You should only call it when passing user
130
+	 * input through.
131
+	 *
132
+	 * @param int $updateVersion
133
+	 */
134
+	public function setUpdateVersion($updateVersion)
135
+	{
136
+		$this->updateversion = $updateVersion;
137
+	}
138
+
139
+	/**
140
+	 * @return bool
141
+	 */
142
+	public function isNew()
143
+	{
144
+		return $this->id === null;
145
+	}
146 146
 }
Please login to merge, or discard this patch.
includes/Offline.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -15,55 +15,55 @@
 block discarded – undo
15 15
  */
16 16
 class Offline
17 17
 {
18
-    /**
19
-     * Determines if the tool is offline
20
-     * @return bool
21
-     */
22
-    public static function isOffline()
23
-    {
24
-        global $dontUseDb;
18
+	/**
19
+	 * Determines if the tool is offline
20
+	 * @return bool
21
+	 */
22
+	public static function isOffline()
23
+	{
24
+		global $dontUseDb;
25 25
 
26
-        return (bool)$dontUseDb;
27
-    }
26
+		return (bool)$dontUseDb;
27
+	}
28 28
 
29
-    /**
30
-     * Gets the offline message
31
-     *
32
-     * @param bool $external
33
-     * @param null $message
34
-     *
35
-     * @return string
36
-     */
37
-    public static function getOfflineMessage($external, $message = null)
38
-    {
39
-        global $dontUseDbCulprit, $dontUseDbReason, $baseurl;
29
+	/**
30
+	 * Gets the offline message
31
+	 *
32
+	 * @param bool $external
33
+	 * @param null $message
34
+	 *
35
+	 * @return string
36
+	 */
37
+	public static function getOfflineMessage($external, $message = null)
38
+	{
39
+		global $dontUseDbCulprit, $dontUseDbReason, $baseurl;
40 40
 
41
-        $smarty = new Smarty();
42
-        $smarty->assign("baseurl", $baseurl);
43
-        $smarty->assign("toolversion", Environment::getToolVersion());
41
+		$smarty = new Smarty();
42
+		$smarty->assign("baseurl", $baseurl);
43
+		$smarty->assign("toolversion", Environment::getToolVersion());
44 44
 
45
-        if (!headers_sent()) {
46
-            header("HTTP/1.1 503 Service Unavailable");
47
-        }
45
+		if (!headers_sent()) {
46
+			header("HTTP/1.1 503 Service Unavailable");
47
+		}
48 48
 
49
-        if ($external) {
50
-            return $smarty->fetch("offline/external.tpl");
51
-        }
52
-        else {
53
-            $hideCulprit = true;
49
+		if ($external) {
50
+			return $smarty->fetch("offline/external.tpl");
51
+		}
52
+		else {
53
+			$hideCulprit = true;
54 54
 
55
-            // Use the provided message if possible
56
-            if ($message === null) {
57
-                $hideCulprit = false;
58
-                $message = $dontUseDbReason;
59
-            }
55
+			// Use the provided message if possible
56
+			if ($message === null) {
57
+				$hideCulprit = false;
58
+				$message = $dontUseDbReason;
59
+			}
60 60
 
61
-            $smarty->assign("hideCulprit", $hideCulprit);
62
-            $smarty->assign("dontUseDbCulprit", $dontUseDbCulprit);
63
-            $smarty->assign("dontUseDbReason", $message);
64
-            $smarty->assign("alerts", array());
61
+			$smarty->assign("hideCulprit", $hideCulprit);
62
+			$smarty->assign("dontUseDbCulprit", $dontUseDbCulprit);
63
+			$smarty->assign("dontUseDbReason", $message);
64
+			$smarty->assign("alerts", array());
65 65
 
66
-            return $smarty->fetch("offline/internal.tpl");
67
-        }
68
-    }
66
+			return $smarty->fetch("offline/internal.tpl");
67
+		}
68
+	}
69 69
 }
Please login to merge, or discard this patch.
includes/Pages/PageSearch.php 2 patches
Indentation   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -19,157 +19,157 @@
 block discarded – undo
19 19
 
20 20
 class PageSearch extends InternalPageBase
21 21
 {
22
-    /**
23
-     * Main function for this page, when no specific actions are called.
24
-     */
25
-    protected function main()
26
-    {
27
-        $this->setHtmlTitle('Search');
28
-
29
-        // Dual-mode page
30
-        if (WebRequest::wasPosted()) {
31
-            $this->validateCSRFToken();
32
-
33
-            $searchType = WebRequest::postString('type');
34
-            $searchTerm = WebRequest::postString('term');
35
-
36
-            $validationError = "";
37
-            if (!$this->validateSearchParameters($searchType, $searchTerm, $validationError)) {
38
-                SessionAlert::error($validationError, "Search error");
39
-                $this->redirect("search");
40
-
41
-                return;
42
-            }
43
-
44
-            $results = array();
45
-
46
-            switch ($searchType) {
47
-                case 'name':
48
-                    $results = $this->getNameSearchResults($searchTerm);
49
-                    break;
50
-                case 'email':
51
-                    $results = $this->getEmailSearchResults($searchTerm);
52
-                    break;
53
-                case 'ip':
54
-                    $results = $this->getIpSearchResults($searchTerm);
55
-                    break;
56
-            }
57
-
58
-            // deal with results
59
-            $this->assign('requests', $results);
60
-            $this->assign('term', $searchTerm);
61
-            $this->assign('target', $searchType);
62
-
63
-            $userIds = array_map(
64
-                function(Request $entry) {
65
-                    return $entry->getReserved();
66
-                },
67
-                $results);
68
-            $userList = User::getUsernames($userIds, $this->getDatabase());
69
-            $this->assign('userlist', $userList);
70
-
71
-            $this->assignCSRFToken();
72
-            $this->setTemplate('search/searchResult.tpl');
73
-        }
74
-        else {
75
-            $this->assignCSRFToken();
76
-            $this->setTemplate('search/searchForm.tpl');
77
-        }
78
-    }
79
-
80
-    /**
81
-     * Gets search results by name
82
-     *
83
-     * @param string $searchTerm
84
-     *
85
-     * @returns Request[]
86
-     */
87
-    private function getNameSearchResults($searchTerm)
88
-    {
89
-        $padded = '%' . $searchTerm . '%';
90
-
91
-        return RequestSearchHelper::get($this->getDatabase())
92
-            ->byName($padded)
93
-            ->excludingPurgedData($this->getSiteConfiguration())
94
-            ->fetch();
95
-    }
96
-
97
-    /**
98
-     * Gets search results by email
99
-     *
100
-     * @param string $searchTerm
101
-     *
102
-     * @return Request[]
103
-     * @throws ApplicationLogicException
104
-     */
105
-    private function getEmailSearchResults($searchTerm)
106
-    {
107
-        if ($searchTerm === "@") {
108
-            throw new ApplicationLogicException('The search term "@" is not valid for email address searches!');
109
-        }
110
-
111
-        $padded = '%' . $searchTerm . '%';
112
-
113
-        return RequestSearchHelper::get($this->getDatabase())
114
-            ->byEmailAddress($padded)
115
-            ->excludingPurgedData($this->getSiteConfiguration())
116
-            ->fetch();
117
-    }
118
-
119
-    /**
120
-     * Gets search results by IP address or XFF IP address
121
-     *
122
-     * @param string $searchTerm
123
-     *
124
-     * @returns Request[]
125
-     */
126
-    private function getIpSearchResults($searchTerm)
127
-    {
128
-        return RequestSearchHelper::get($this->getDatabase())
129
-            ->byIp($searchTerm)
130
-            ->excludingPurgedData($this->getSiteConfiguration())
131
-            ->fetch();
132
-    }
133
-
134
-    /**
135
-     * Sets up the security for this page. If certain actions have different permissions, this should be reflected in
136
-     * the return value from this function.
137
-     *
138
-     * If this page even supports actions, you will need to check the route
139
-     *
140
-     * @return SecurityConfiguration
141
-     * @category Security-Critical
142
-     */
143
-    protected function getSecurityConfiguration()
144
-    {
145
-        return $this->getSecurityManager()->configure()->asInternalPage();
146
-    }
147
-
148
-    /**
149
-     * @param string $searchType
150
-     * @param string $searchTerm
151
-     *
152
-     * @param string $errorMessage
153
-     *
154
-     * @return bool true if parameters are valid
155
-     * @throws ApplicationLogicException
156
-     */
157
-    protected function validateSearchParameters($searchType, $searchTerm, &$errorMessage)
158
-    {
159
-        if (!in_array($searchType, array('name', 'email', 'ip'))) {
160
-            $errorMessage = 'Unknown search type';
161
-
162
-            return false;
163
-        }
164
-
165
-        if ($searchTerm === '%' || $searchTerm === '' || $searchTerm === null) {
166
-            $errorMessage = 'No search term specified entered';
167
-
168
-            return false;
169
-        }
170
-
171
-        $errorMessage = "";
172
-
173
-        return true;
174
-    }
22
+	/**
23
+	 * Main function for this page, when no specific actions are called.
24
+	 */
25
+	protected function main()
26
+	{
27
+		$this->setHtmlTitle('Search');
28
+
29
+		// Dual-mode page
30
+		if (WebRequest::wasPosted()) {
31
+			$this->validateCSRFToken();
32
+
33
+			$searchType = WebRequest::postString('type');
34
+			$searchTerm = WebRequest::postString('term');
35
+
36
+			$validationError = "";
37
+			if (!$this->validateSearchParameters($searchType, $searchTerm, $validationError)) {
38
+				SessionAlert::error($validationError, "Search error");
39
+				$this->redirect("search");
40
+
41
+				return;
42
+			}
43
+
44
+			$results = array();
45
+
46
+			switch ($searchType) {
47
+				case 'name':
48
+					$results = $this->getNameSearchResults($searchTerm);
49
+					break;
50
+				case 'email':
51
+					$results = $this->getEmailSearchResults($searchTerm);
52
+					break;
53
+				case 'ip':
54
+					$results = $this->getIpSearchResults($searchTerm);
55
+					break;
56
+			}
57
+
58
+			// deal with results
59
+			$this->assign('requests', $results);
60
+			$this->assign('term', $searchTerm);
61
+			$this->assign('target', $searchType);
62
+
63
+			$userIds = array_map(
64
+				function(Request $entry) {
65
+					return $entry->getReserved();
66
+				},
67
+				$results);
68
+			$userList = User::getUsernames($userIds, $this->getDatabase());
69
+			$this->assign('userlist', $userList);
70
+
71
+			$this->assignCSRFToken();
72
+			$this->setTemplate('search/searchResult.tpl');
73
+		}
74
+		else {
75
+			$this->assignCSRFToken();
76
+			$this->setTemplate('search/searchForm.tpl');
77
+		}
78
+	}
79
+
80
+	/**
81
+	 * Gets search results by name
82
+	 *
83
+	 * @param string $searchTerm
84
+	 *
85
+	 * @returns Request[]
86
+	 */
87
+	private function getNameSearchResults($searchTerm)
88
+	{
89
+		$padded = '%' . $searchTerm . '%';
90
+
91
+		return RequestSearchHelper::get($this->getDatabase())
92
+			->byName($padded)
93
+			->excludingPurgedData($this->getSiteConfiguration())
94
+			->fetch();
95
+	}
96
+
97
+	/**
98
+	 * Gets search results by email
99
+	 *
100
+	 * @param string $searchTerm
101
+	 *
102
+	 * @return Request[]
103
+	 * @throws ApplicationLogicException
104
+	 */
105
+	private function getEmailSearchResults($searchTerm)
106
+	{
107
+		if ($searchTerm === "@") {
108
+			throw new ApplicationLogicException('The search term "@" is not valid for email address searches!');
109
+		}
110
+
111
+		$padded = '%' . $searchTerm . '%';
112
+
113
+		return RequestSearchHelper::get($this->getDatabase())
114
+			->byEmailAddress($padded)
115
+			->excludingPurgedData($this->getSiteConfiguration())
116
+			->fetch();
117
+	}
118
+
119
+	/**
120
+	 * Gets search results by IP address or XFF IP address
121
+	 *
122
+	 * @param string $searchTerm
123
+	 *
124
+	 * @returns Request[]
125
+	 */
126
+	private function getIpSearchResults($searchTerm)
127
+	{
128
+		return RequestSearchHelper::get($this->getDatabase())
129
+			->byIp($searchTerm)
130
+			->excludingPurgedData($this->getSiteConfiguration())
131
+			->fetch();
132
+	}
133
+
134
+	/**
135
+	 * Sets up the security for this page. If certain actions have different permissions, this should be reflected in
136
+	 * the return value from this function.
137
+	 *
138
+	 * If this page even supports actions, you will need to check the route
139
+	 *
140
+	 * @return SecurityConfiguration
141
+	 * @category Security-Critical
142
+	 */
143
+	protected function getSecurityConfiguration()
144
+	{
145
+		return $this->getSecurityManager()->configure()->asInternalPage();
146
+	}
147
+
148
+	/**
149
+	 * @param string $searchType
150
+	 * @param string $searchTerm
151
+	 *
152
+	 * @param string $errorMessage
153
+	 *
154
+	 * @return bool true if parameters are valid
155
+	 * @throws ApplicationLogicException
156
+	 */
157
+	protected function validateSearchParameters($searchType, $searchTerm, &$errorMessage)
158
+	{
159
+		if (!in_array($searchType, array('name', 'email', 'ip'))) {
160
+			$errorMessage = 'Unknown search type';
161
+
162
+			return false;
163
+		}
164
+
165
+		if ($searchTerm === '%' || $searchTerm === '' || $searchTerm === null) {
166
+			$errorMessage = 'No search term specified entered';
167
+
168
+			return false;
169
+		}
170
+
171
+		$errorMessage = "";
172
+
173
+		return true;
174
+	}
175 175
 }
176 176
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      */
87 87
     private function getNameSearchResults($searchTerm)
88 88
     {
89
-        $padded = '%' . $searchTerm . '%';
89
+        $padded = '%'.$searchTerm.'%';
90 90
 
91 91
         return RequestSearchHelper::get($this->getDatabase())
92 92
             ->byName($padded)
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             throw new ApplicationLogicException('The search term "@" is not valid for email address searches!');
109 109
         }
110 110
 
111
-        $padded = '%' . $searchTerm . '%';
111
+        $padded = '%'.$searchTerm.'%';
112 112
 
113 113
         return RequestSearchHelper::get($this->getDatabase())
114 114
             ->byEmailAddress($padded)
Please login to merge, or discard this patch.
includes/Pages/PageTeam.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -13,45 +13,45 @@
 block discarded – undo
13 13
 
14 14
 class PageTeam extends InternalPageBase
15 15
 {
16
-    /**
17
-     * Main function for this page, when no specific actions are called.
18
-     * @return void
19
-     */
20
-    protected function main()
21
-    {
22
-        $path = $this->getSiteConfiguration()->getFilePath() . '/team.json';
23
-        $json = file_get_contents($path);
24
-
25
-        $teamData = json_decode($json, true);
26
-
27
-        $active = array();
28
-        $inactive = array();
29
-
30
-        foreach ($teamData as $name => $item) {
31
-            if (count($item['Role']) == 0) {
32
-                $inactive[$name] = $item;
33
-            }
34
-            else {
35
-                $active[$name] = $item;
36
-            }
37
-        }
38
-
39
-        $this->assign('developer', $active);
40
-        $this->assign('inactiveDeveloper', $inactive);
41
-        $this->setTemplate('team/team.tpl');
42
-    }
43
-
44
-    /**
45
-     * Sets up the security for this page. If certain actions have different permissions, this should be reflected in
46
-     * the return value from this function.
47
-     *
48
-     * If this page even supports actions, you will need to check the route
49
-     *
50
-     * @return SecurityConfiguration
51
-     * @category Security-Critical
52
-     */
53
-    protected function getSecurityConfiguration()
54
-    {
55
-        return $this->getSecurityManager()->configure()->asPublicPage();
56
-    }
16
+	/**
17
+	 * Main function for this page, when no specific actions are called.
18
+	 * @return void
19
+	 */
20
+	protected function main()
21
+	{
22
+		$path = $this->getSiteConfiguration()->getFilePath() . '/team.json';
23
+		$json = file_get_contents($path);
24
+
25
+		$teamData = json_decode($json, true);
26
+
27
+		$active = array();
28
+		$inactive = array();
29
+
30
+		foreach ($teamData as $name => $item) {
31
+			if (count($item['Role']) == 0) {
32
+				$inactive[$name] = $item;
33
+			}
34
+			else {
35
+				$active[$name] = $item;
36
+			}
37
+		}
38
+
39
+		$this->assign('developer', $active);
40
+		$this->assign('inactiveDeveloper', $inactive);
41
+		$this->setTemplate('team/team.tpl');
42
+	}
43
+
44
+	/**
45
+	 * Sets up the security for this page. If certain actions have different permissions, this should be reflected in
46
+	 * the return value from this function.
47
+	 *
48
+	 * If this page even supports actions, you will need to check the route
49
+	 *
50
+	 * @return SecurityConfiguration
51
+	 * @category Security-Critical
52
+	 */
53
+	protected function getSecurityConfiguration()
54
+	{
55
+		return $this->getSecurityManager()->configure()->asPublicPage();
56
+	}
57 57
 }
58 58
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
      */
20 20
     protected function main()
21 21
     {
22
-        $path = $this->getSiteConfiguration()->getFilePath() . '/team.json';
22
+        $path = $this->getSiteConfiguration()->getFilePath().'/team.json';
23 23
         $json = file_get_contents($path);
24 24
 
25 25
         $teamData = json_decode($json, true);
Please login to merge, or discard this patch.
includes/Pages/Statistics/StatsTopCreators.php 1 patch
Indentation   +37 added lines, -37 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,29 +121,29 @@  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
 
145
-    public function getSecurityConfiguration()
146
-    {
147
-        return $this->getSecurityManager()->configure()->asPublicPage();
148
-    }
145
+	public function getSecurityConfiguration()
146
+	{
147
+		return $this->getSecurityManager()->configure()->asPublicPage();
148
+	}
149 149
 }
150 150
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Pages/Statistics/StatsFastCloses.php 1 patch
Indentation   +16 added lines, -16 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,16 +42,16 @@  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
-    }
52
-
53
-    public function getSecurityConfiguration()
54
-    {
55
-        return $this->getSecurityManager()->configure()->asInternalPage();
56
-    }
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
+
53
+	public function getSecurityConfiguration()
54
+	{
55
+		return $this->getSecurityManager()->configure()->asInternalPage();
56
+	}
57 57
 }
Please login to merge, or discard this patch.
includes/Pages/Statistics/StatsInactiveUsers.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -14,25 +14,25 @@
 block discarded – undo
14 14
 
15 15
 class StatsInactiveUsers extends InternalPageBase
16 16
 {
17
-    public function main()
18
-    {
19
-        $this->setHtmlTitle('Inactive Users :: Statistics');
17
+	public function main()
18
+	{
19
+		$this->setHtmlTitle('Inactive Users :: Statistics');
20 20
 
21
-        $showImmune = false;
22
-        if (WebRequest::getBoolean('showimmune')) {
23
-            $showImmune = true;
24
-        }
21
+		$showImmune = false;
22
+		if (WebRequest::getBoolean('showimmune')) {
23
+			$showImmune = true;
24
+		}
25 25
 
26
-        $this->assign('showImmune', $showImmune);
27
-        $inactiveUsers = User::getAllInactive($this->getDatabase());
28
-        $this->assign('inactiveUsers', $inactiveUsers);
26
+		$this->assign('showImmune', $showImmune);
27
+		$inactiveUsers = User::getAllInactive($this->getDatabase());
28
+		$this->assign('inactiveUsers', $inactiveUsers);
29 29
 
30
-        $this->setTemplate('statistics/inactive-users.tpl');
31
-        $this->assign('statsPageTitle', 'Inactive tool users');
32
-    }
30
+		$this->setTemplate('statistics/inactive-users.tpl');
31
+		$this->assign('statsPageTitle', 'Inactive tool users');
32
+	}
33 33
 
34
-    public function getSecurityConfiguration()
35
-    {
36
-        return $this->getSecurityManager()->configure()->asInternalPage();
37
-    }
34
+	public function getSecurityConfiguration()
35
+	{
36
+		return $this->getSecurityManager()->configure()->asInternalPage();
37
+	}
38 38
 }
Please login to merge, or discard this patch.
includes/Pages/Statistics/StatsUsers.php 2 patches
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -19,52 +19,52 @@  discard block
 block discarded – undo
19 19
 
20 20
 class StatsUsers extends InternalPageBase
21 21
 {
22
-    public function main()
23
-    {
24
-        $this->setHtmlTitle('Users :: Statistics');
25
-
26
-        $database = $this->getDatabase();
27
-
28
-        $lists = array(
29
-            "Admin"      => User::getAllWithStatus("Admin", $database),
30
-            "User"       => User::getAllWithStatus("User", $database),
31
-            "CheckUsers" => User::getAllCheckusers($database),
32
-        );
33
-
34
-        $this->assign("lists", $lists);
35
-
36
-        $this->assign('statsPageTitle', 'Account Creation Tool users');
37
-        $this->setTemplate("statistics/users.tpl");
38
-    }
39
-
40
-    public function getSecurityConfiguration()
41
-    {
42
-        return $this->getSecurityManager()->configure()->asPublicPage();
43
-    }
44
-
45
-    /**
46
-     * Entry point for the detail action.
47
-     *
48
-     * @throws ApplicationLogicException
49
-     */
50
-    protected function detail()
51
-    {
52
-        $userId = WebRequest::getInt('user');
53
-        if ($userId === null) {
54
-            throw new ApplicationLogicException("User not found");
55
-        }
56
-
57
-        $database = $this->getDatabase();
58
-
59
-        $user = User::getById($userId, $database);
60
-        if ($user == false) {
61
-            throw new ApplicationLogicException('User not found');
62
-        }
63
-
64
-        $safeUsername = htmlentities($user->getUsername(), ENT_COMPAT, 'UTF-8');
65
-        $this->setHtmlTitle($safeUsername . ' :: Users :: Statistics');
66
-
67
-        $activitySummary = $database->prepare(<<<SQL
22
+	public function main()
23
+	{
24
+		$this->setHtmlTitle('Users :: Statistics');
25
+
26
+		$database = $this->getDatabase();
27
+
28
+		$lists = array(
29
+			"Admin"      => User::getAllWithStatus("Admin", $database),
30
+			"User"       => User::getAllWithStatus("User", $database),
31
+			"CheckUsers" => User::getAllCheckusers($database),
32
+		);
33
+
34
+		$this->assign("lists", $lists);
35
+
36
+		$this->assign('statsPageTitle', 'Account Creation Tool users');
37
+		$this->setTemplate("statistics/users.tpl");
38
+	}
39
+
40
+	public function getSecurityConfiguration()
41
+	{
42
+		return $this->getSecurityManager()->configure()->asPublicPage();
43
+	}
44
+
45
+	/**
46
+	 * Entry point for the detail action.
47
+	 *
48
+	 * @throws ApplicationLogicException
49
+	 */
50
+	protected function detail()
51
+	{
52
+		$userId = WebRequest::getInt('user');
53
+		if ($userId === null) {
54
+			throw new ApplicationLogicException("User not found");
55
+		}
56
+
57
+		$database = $this->getDatabase();
58
+
59
+		$user = User::getById($userId, $database);
60
+		if ($user == false) {
61
+			throw new ApplicationLogicException('User not found');
62
+		}
63
+
64
+		$safeUsername = htmlentities($user->getUsername(), ENT_COMPAT, 'UTF-8');
65
+		$this->setHtmlTitle($safeUsername . ' :: Users :: Statistics');
66
+
67
+		$activitySummary = $database->prepare(<<<SQL
68 68
 SELECT COALESCE(closes.mail_desc, log.action) AS action, COUNT(*) AS count
69 69
 FROM log
70 70
 INNER JOIN user ON log.user = user.id
@@ -72,14 +72,14 @@  discard block
 block discarded – undo
72 72
 WHERE user.username = :username
73 73
 GROUP BY action;
74 74
 SQL
75
-        );
76
-        $activitySummary->execute(array(":username" => $user->getUsername()));
77
-        $activitySummaryData = $activitySummary->fetchAll(PDO::FETCH_ASSOC);
75
+		);
76
+		$activitySummary->execute(array(":username" => $user->getUsername()));
77
+		$activitySummaryData = $activitySummary->fetchAll(PDO::FETCH_ASSOC);
78 78
 
79
-        $this->assign("user", $user);
80
-        $this->assign("activity", $activitySummaryData);
79
+		$this->assign("user", $user);
80
+		$this->assign("activity", $activitySummaryData);
81 81
 
82
-        $usersCreatedQuery = $database->prepare(<<<SQL
82
+		$usersCreatedQuery = $database->prepare(<<<SQL
83 83
 SELECT log.timestamp time, request.name name, request.id id
84 84
 FROM log
85 85
 INNER JOIN request ON (request.id = log.objectid AND log.objecttype = 'Request')
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
     AND (emailtemplate.oncreated = '1' OR log.action = 'Closed custom-y')
91 91
 ORDER BY log.timestamp;
92 92
 SQL
93
-        );
94
-        $usersCreatedQuery->execute(array(":username" => $user->getUsername()));
95
-        $usersCreated = $usersCreatedQuery->fetchAll(PDO::FETCH_ASSOC);
96
-        $this->assign("created", $usersCreated);
93
+		);
94
+		$usersCreatedQuery->execute(array(":username" => $user->getUsername()));
95
+		$usersCreated = $usersCreatedQuery->fetchAll(PDO::FETCH_ASSOC);
96
+		$this->assign("created", $usersCreated);
97 97
 
98
-        $usersNotCreatedQuery = $database->prepare(<<<SQL
98
+		$usersNotCreatedQuery = $database->prepare(<<<SQL
99 99
 SELECT log.timestamp time, request.name name, request.id id
100 100
 FROM log
101 101
 JOIN request ON request.id = log.objectid AND log.objecttype = 'Request'
@@ -106,29 +106,29 @@  discard block
 block discarded – undo
106 106
     AND (emailtemplate.oncreated = '0' OR log.action = 'Closed custom-n' OR log.action = 'Closed 0')
107 107
 ORDER BY log.timestamp;
108 108
 SQL
109
-        );
110
-        $usersNotCreatedQuery->execute(array(":username" => $user->getUsername()));
111
-        $usersNotCreated = $usersNotCreatedQuery->fetchAll(PDO::FETCH_ASSOC);
112
-        $this->assign("notcreated", $usersNotCreated);
113
-
114
-        /** @var Log[] $logs */
115
-        $logs = LogSearchHelper::get($database)
116
-            ->byObjectType('User')
117
-            ->byObjectId($user->getId())
118
-            ->getRecordCount($logCount)
119
-            ->fetch();
120
-
121
-        if ($logCount === 0) {
122
-            $this->assign('accountlog', array());
123
-        }
124
-        else {
125
-            list($users, $logData) = LogHelper::prepareLogsForTemplate($logs, $database, $this->getSiteConfiguration());
126
-
127
-            $this->assign("accountlog", $logData);
128
-            $this->assign("users", $users);
129
-        }
130
-
131
-        $this->assign('statsPageTitle', 'Account Creation Tool users');
132
-        $this->setTemplate("statistics/userdetail.tpl");
133
-    }
109
+		);
110
+		$usersNotCreatedQuery->execute(array(":username" => $user->getUsername()));
111
+		$usersNotCreated = $usersNotCreatedQuery->fetchAll(PDO::FETCH_ASSOC);
112
+		$this->assign("notcreated", $usersNotCreated);
113
+
114
+		/** @var Log[] $logs */
115
+		$logs = LogSearchHelper::get($database)
116
+			->byObjectType('User')
117
+			->byObjectId($user->getId())
118
+			->getRecordCount($logCount)
119
+			->fetch();
120
+
121
+		if ($logCount === 0) {
122
+			$this->assign('accountlog', array());
123
+		}
124
+		else {
125
+			list($users, $logData) = LogHelper::prepareLogsForTemplate($logs, $database, $this->getSiteConfiguration());
126
+
127
+			$this->assign("accountlog", $logData);
128
+			$this->assign("users", $users);
129
+		}
130
+
131
+		$this->assign('statsPageTitle', 'Account Creation Tool users');
132
+		$this->setTemplate("statistics/userdetail.tpl");
133
+	}
134 134
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
         }
63 63
 
64 64
         $safeUsername = htmlentities($user->getUsername(), ENT_COMPAT, 'UTF-8');
65
-        $this->setHtmlTitle($safeUsername . ' :: Users :: Statistics');
65
+        $this->setHtmlTitle($safeUsername.' :: Users :: Statistics');
66 66
 
67 67
         $activitySummary = $database->prepare(<<<SQL
68 68
 SELECT COALESCE(closes.mail_desc, log.action) AS action, COUNT(*) AS count
Please login to merge, or discard this patch.