Completed
Push — master ( dcff3a...45769d )
by mains
05:05 queued 02:03
created
php/jodel-web.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	$expiration_date;
27 27
 	$deviceUid;
28 28
 	
29
-	if ($result->num_rows > 0)
29
+	if($result->num_rows > 0)
30 30
 	{
31 31
 			// output data of each row
32 32
 			while($row = $result->fetch_assoc()) {
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
 	if($expiration_date <= time()) {
45 45
 		$accountCreator = new CreateUser();
46
-		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
46
+		$accountCreator->setAccessToken($access_token); //$accountData->getAccessToken());
47 47
 		$accountCreator->setDeviceUid($deviceUid);
48 48
 		$accountCreator->setLocation($location);
49 49
 		$data = $accountCreator->execute();
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 								WHERE device_uid='" . $device_uid . "'");
64 64
 
65 65
 		$success = TRUE;
66
-		if($result === false){
66
+		if($result === false) {
67 67
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
68 68
 				$success = FALSE;
69 69
 		}	
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
 	$result = $db->query("INSERT INTO accounts (access_token, refresh_token, token_type,
103 103
 					expires_in, expiration_date, distinct_id, device_uid)
104 104
 					VALUES ('" . $access_token . "','" . $refresh_token . "','" . $token_type .
105
-					"','" .  $expires_in . "','" . $expiration_date . "','" . $distinct_id .
105
+					"','" . $expires_in . "','" . $expiration_date . "','" . $distinct_id .
106 106
 					"','" . $device_uid . "') ");
107 107
 
108 108
 	$success = TRUE;
109
-	if($result === false){
109
+	if($result === false) {
110 110
 			$error = db_error();
111 111
 			echo $error;
112 112
 			echo "Adding account failed: (" . $result->errno . ") " . $result->error;
Please login to merge, or discard this patch.
Braces   +15 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@  discard block
 block discarded – undo
18 18
 
19 19
 $lastPostId = "";
20 20
 
21
-function isTokenFresh(Location $location) {
21
+function isTokenFresh(Location $location)
22
+{
22 23
 	$db = new DatabaseConnect();  
23 24
 	$result = $db->query("SELECT * FROM accounts WHERE id='1'");
24 25
 	
@@ -29,7 +30,8 @@  discard block
 block discarded – undo
29 30
 	if ($result->num_rows > 0)
30 31
 	{
31 32
 			// output data of each row
32
-			while($row = $result->fetch_assoc()) {
33
+			while($row = $result->fetch_assoc())
34
+			{
33 35
 					//$access_token = $row["access_token"];
34 36
 					$expiration_date = $row["expiration_date"];
35 37
 					$deviceUid = $row["device_uid"];
@@ -41,7 +43,8 @@  discard block
 block discarded – undo
41 43
 			echo "0 results";
42 44
 	}
43 45
 
44
-	if($expiration_date <= time()) {
46
+	if($expiration_date <= time())
47
+	{
45 48
 		$accountCreator = new CreateUser();
46 49
 		$accountCreator->setAccessToken($access_token);//$accountData->getAccessToken());
47 50
 		$accountCreator->setDeviceUid($deviceUid);
@@ -63,7 +66,8 @@  discard block
 block discarded – undo
63 66
 								WHERE device_uid='" . $device_uid . "'");
64 67
 
65 68
 		$success = TRUE;
66
-		if($result === false){
69
+		if($result === false)
70
+		{
67 71
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
68 72
 				$success = FALSE;
69 73
 		}	
@@ -85,7 +89,8 @@  discard block
 block discarded – undo
85 89
 	return $data["karma"];
86 90
 }
87 91
 
88
-function registerAccount(Location $location) {
92
+function registerAccount(Location $location)
93
+{
89 94
 	$accountCreator = new CreateUser();
90 95
 	$accountCreator->setLocation($location);
91 96
 	$data = $accountCreator->execute();
@@ -106,7 +111,8 @@  discard block
 block discarded – undo
106 111
 					"','" . $device_uid . "') ");
107 112
 
108 113
 	$success = TRUE;
109
-	if($result === false){
114
+	if($result === false)
115
+	{
110 116
 			$error = db_error();
111 117
 			echo $error;
112 118
 			echo "Adding account failed: (" . $result->errno . ") " . $result->error;
@@ -117,7 +123,7 @@  discard block
 block discarded – undo
117 123
 }
118 124
 
119 125
 function getPosts($lastPostId, $accessToken, $url)
120
-{	
126
+{
121 127
 	$accountCreator = new GetPosts();
122 128
 	$accountCreator->setLastPostId($lastPostId);
123 129
 	$accountCreator->setAccessToken($accessToken);
@@ -127,7 +133,8 @@  discard block
 block discarded – undo
127 133
 	return $data;
128 134
 }
129 135
 
130
-function createAccount() {
136
+function createAccount()
137
+{
131 138
 	$location = new Location();
132 139
 	$location->setLat(50.690399);
133 140
 	$location->setLng(10.918175);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 								WHERE device_uid='" . $device_uid . "'");
64 64
 
65 65
 		$success = TRUE;
66
-		if($result === false){
66
+		if($result === FALSE){
67 67
 				echo "Adding account failed: (" . $db->errno . ") " . $db->error;
68 68
 				$success = FALSE;
69 69
 		}	
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 					"','" . $device_uid . "') ");
107 107
 
108 108
 	$success = TRUE;
109
-	if($result === false){
109
+	if($result === FALSE){
110 110
 			$error = db_error();
111 111
 			echo $error;
112 112
 			echo "Adding account failed: (" . $result->errno . ") " . $result->error;
Please login to merge, or discard this patch.
php/AccountData.php 1 patch
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -2,94 +2,94 @@
 block discarded – undo
2 2
 
3 3
 class AccountData
4 4
 {
5
-    /**
6
-     * @var string
7
-     */
8
-    public $accessToken;
9
-    /**
10
-     * @var string
11
-     */
12
-    public $expirationDate;
13
-    /**
14
-     * @var string
15
-     */
16
-    public $refreshToken;
17
-    /**
18
-     * @var string
19
-     */
20
-    public $distinctId;
21
-    /**
22
-     * @var string
23
-     */
24
-    public $deviceUid;
25
-    /**
26
-     * @return string
27
-     */
28
-    public function getAccessToken()
29
-    {
30
-        return $this->accessToken;
31
-    }
32
-    /**
33
-     * @param string $accessToken
34
-     */
35
-    public function setAccessToken(string $accessToken)
36
-    {
37
-        $this->accessToken = $accessToken;
38
-    }
39
-    /**
40
-     * @return string
41
-     */
42
-    public function getExpirationDate()
43
-    {
44
-        return $this->expirationDate;
45
-    }
46
-    /**
47
-     * @param string $expirationDate
48
-     */
49
-    public function setExpirationDate(string $expirationDate)
50
-    {
51
-        $this->expirationDate = $expirationDate;
52
-    }
53
-    /**
54
-     * @return string
55
-     */
56
-    public function getRefreshToken()
57
-    {
58
-        return $this->refreshToken;
59
-    }
60
-    /**
61
-     * @param string $refreshToken
62
-     */
63
-    public function setRefreshToken(string $refreshToken)
64
-    {
65
-        $this->refreshToken = $refreshToken;
66
-    }
67
-    /**
68
-     * @return string
69
-     */
70
-    public function getDistinctId()
71
-    {
72
-        return $this->distinctId;
73
-    }
74
-    /**
75
-     * @param string $distinctId
76
-     */
77
-    public function setDistinctId(string $distinctId)
78
-    {
79
-        $this->distinctId = $distinctId;
80
-    }
81
-    /**
82
-     * @return string
83
-     */
84
-    public function getDeviceUid()
85
-    {
86
-        return $this->deviceUid;
87
-    }
88
-    /**
89
-     * @param string $deviceUid
90
-     */
91
-    public function setDeviceUid(string $deviceUid)
92
-    {
93
-        $this->deviceUid = $deviceUid;
94
-    }
5
+	/**
6
+	 * @var string
7
+	 */
8
+	public $accessToken;
9
+	/**
10
+	 * @var string
11
+	 */
12
+	public $expirationDate;
13
+	/**
14
+	 * @var string
15
+	 */
16
+	public $refreshToken;
17
+	/**
18
+	 * @var string
19
+	 */
20
+	public $distinctId;
21
+	/**
22
+	 * @var string
23
+	 */
24
+	public $deviceUid;
25
+	/**
26
+	 * @return string
27
+	 */
28
+	public function getAccessToken()
29
+	{
30
+		return $this->accessToken;
31
+	}
32
+	/**
33
+	 * @param string $accessToken
34
+	 */
35
+	public function setAccessToken(string $accessToken)
36
+	{
37
+		$this->accessToken = $accessToken;
38
+	}
39
+	/**
40
+	 * @return string
41
+	 */
42
+	public function getExpirationDate()
43
+	{
44
+		return $this->expirationDate;
45
+	}
46
+	/**
47
+	 * @param string $expirationDate
48
+	 */
49
+	public function setExpirationDate(string $expirationDate)
50
+	{
51
+		$this->expirationDate = $expirationDate;
52
+	}
53
+	/**
54
+	 * @return string
55
+	 */
56
+	public function getRefreshToken()
57
+	{
58
+		return $this->refreshToken;
59
+	}
60
+	/**
61
+	 * @param string $refreshToken
62
+	 */
63
+	public function setRefreshToken(string $refreshToken)
64
+	{
65
+		$this->refreshToken = $refreshToken;
66
+	}
67
+	/**
68
+	 * @return string
69
+	 */
70
+	public function getDistinctId()
71
+	{
72
+		return $this->distinctId;
73
+	}
74
+	/**
75
+	 * @param string $distinctId
76
+	 */
77
+	public function setDistinctId(string $distinctId)
78
+	{
79
+		$this->distinctId = $distinctId;
80
+	}
81
+	/**
82
+	 * @return string
83
+	 */
84
+	public function getDeviceUid()
85
+	{
86
+		return $this->deviceUid;
87
+	}
88
+	/**
89
+	 * @param string $deviceUid
90
+	 */
91
+	public function setDeviceUid(string $deviceUid)
92
+	{
93
+		$this->deviceUid = $deviceUid;
94
+	}
95 95
 }
Please login to merge, or discard this patch.
get-posts-ajax.php 2 patches
Braces   +31 added lines, -14 removed lines patch added patch discarded remove patch
@@ -17,18 +17,22 @@  discard block
 block discarded – undo
17 17
 require_once 'php/Requests/libary/Requests.php';
18 18
 Requests::register_autoloader();
19 19
 
20
-function getPosts($lastPostId, $url) {
20
+function getPosts($lastPostId, $url)
21
+{
21 22
 	$db = new DatabaseConnect();
22
-	if ($db->connect_errno) {
23
+	if ($db->connect_errno)
24
+	{
23 25
 		echo 'Sorry, die Verbindung zu unserem superfetten endgeilen 
24 26
 					Server ist hops gegangen. Wegen '. $db -> connect_error;
25 27
 	}
26 28
 	
27 29
 	$result = $db->query("SELECT * FROM accounts WHERE id='1'");
28 30
 	
29
-	if ($result->num_rows > 0) {
31
+	if ($result->num_rows > 0)
32
+	{
30 33
 		// output data of each row
31
-		while($row = $result->fetch_assoc()) {
34
+		while($row = $result->fetch_assoc())
35
+		{
32 36
 			$access_token = $row["access_token"];
33 37
 		}
34 38
 	}
@@ -49,7 +53,8 @@  discard block
 block discarded – undo
49 53
 
50 54
 	if(isset($_GET['view']))
51 55
 	{
52
-		switch ($_GET['view']) {
56
+		switch ($_GET['view'])
57
+		{
53 58
 			case 'comment':
54 59
 				$view = 'comment';
55 60
 				break;
@@ -84,7 +89,8 @@  discard block
 block discarded – undo
84 89
 		}
85 90
 	}
86 91
 
87
-	if(isset($_GET['lastPostId'])) {
92
+	if(isset($_GET['lastPostId']))
93
+	{
88 94
 	
89 95
 		$lastPostId = htmlspecialchars($_GET['lastPostId']);
90 96
 		
@@ -94,9 +100,11 @@  discard block
 block discarded – undo
94 100
 		?>
95 101
 		<div class="nextPosts">
96 102
 		<?php
97
-		for($i = 0; $i<$loops; $i++) {
103
+		for($i = 0; $i<$loops; $i++)
104
+		{
98 105
 		
99
-			if(isset($posts[$i])) {
106
+			if(isset($posts[$i]))
107
+			{
100 108
 				$lastPostId = $posts[$i]['post_id'];
101 109
 
102 110
 				
@@ -112,7 +120,8 @@  discard block
 block discarded – undo
112 120
 							$timediff_inHours = (string)$timediff->format('%h');
113 121
 							$timediff_inDays = (string)$timediff->format('%d');
114 122
 							$timediff_inMonth = (string)$timediff->format('%m');
115
-							if($timediff_inMonth!=0) {
123
+							if($timediff_inMonth!=0)
124
+							{
116 125
 									$timediff = $timediff_inMonth . "m";
117 126
 							}
118 127
 							else
@@ -145,10 +154,12 @@  discard block
 block discarded – undo
145 154
 				<article class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;">
146 155
 					<content>
147 156
 						<?php 
148
-						if(isset($posts[$i]["image_url"])) {
157
+						if(isset($posts[$i]["image_url"]))
158
+						{
149 159
 							echo '<img src="' . $posts[$i]["image_url"] . '">';
150 160
 						}
151
-						else {
161
+						else
162
+						{
152 163
 							echo str_replace('  ', ' &nbsp;', nl2br(htmlspecialchars($posts[$i]["message"])));
153 164
 						}
154 165
 						?>
@@ -174,13 +185,19 @@  discard block
 block discarded – undo
174 185
 									</span> 
175 186
 								</td>
176 187
 								<td class="comments">
177
-									<?php if($showCommentIcon) {?>
188
+									<?php if($showCommentIcon)
189
+{
190
+?>
178 191
 									<span data-tooltip="Comments">
179 192
 										<a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $posts[$i]["post_id"];?>">
180 193
 											<i class="fa fa-commenting-o"></i>
181
-											<?php if(array_key_exists("child_count", $posts[$i])) {
194
+											<?php if(array_key_exists("child_count", $posts[$i]))
195
+{
182 196
 														echo $posts[$i]["child_count"];
183
-													} else echo "0";
197
+													}
198
+													else {
199
+														echo "0";
200
+													}
184 201
 											?>
185 202
 											</a>
186 203
 									</span>
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -19,14 +19,14 @@  discard block
 block discarded – undo
19 19
 
20 20
 function getPosts($lastPostId, $url) {
21 21
 	$db = new DatabaseConnect();
22
-	if ($db->connect_errno) {
22
+	if($db->connect_errno) {
23 23
 		echo 'Sorry, die Verbindung zu unserem superfetten endgeilen 
24 24
 					Server ist hops gegangen. Wegen '. $db -> connect_error;
25 25
 	}
26 26
 	
27 27
 	$result = $db->query("SELECT * FROM accounts WHERE id='1'");
28 28
 	
29
-	if ($result->num_rows > 0) {
29
+	if($result->num_rows > 0) {
30 30
 		// output data of each row
31 31
 		while($row = $result->fetch_assoc()) {
32 32
 			$access_token = $row["access_token"];
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 	if(isset($_GET['view']))
51 51
 	{
52
-		switch ($_GET['view']) {
52
+		switch($_GET['view']) {
53 53
 			case 'comment':
54 54
 				$view = 'comment';
55 55
 				break;
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
 		$view = 'time';
69 69
 	}
70 70
 
71
-	if($view=='comment')
71
+	if($view == 'comment')
72 72
 	{
73 73
 		$url = "/v2/posts/location/discussed/";
74 74
 	}
75 75
 	else
76 76
 	{
77
-		if($view=='upVote')
77
+		if($view == 'upVote')
78 78
 		{
79 79
 			$url = "/v2/posts/location/popular/";
80 80
 		}
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		?>
95 95
 		<div class="nextPosts">
96 96
 		<?php
97
-		for($i = 0; $i<$loops; $i++) {
97
+		for($i = 0; $i < $loops; $i++) {
98 98
 		
99 99
 			if(isset($posts[$i])) {
100 100
 				$lastPostId = $posts[$i]['post_id'];
@@ -112,24 +112,24 @@  discard block
 block discarded – undo
112 112
 							$timediff_inHours = (string)$timediff->format('%h');
113 113
 							$timediff_inDays = (string)$timediff->format('%d');
114 114
 							$timediff_inMonth = (string)$timediff->format('%m');
115
-							if($timediff_inMonth!=0) {
115
+							if($timediff_inMonth != 0) {
116 116
 									$timediff = $timediff_inMonth . "m";
117 117
 							}
118 118
 							else
119 119
 							{
120
-								if($timediff_inDays!=0)
120
+								if($timediff_inDays != 0)
121 121
 								{
122 122
 									$timediff = $timediff_inDays . "d";
123 123
 								}
124 124
 								else
125 125
 								{
126
-									if($timediff_inHours!=0)
126
+									if($timediff_inHours != 0)
127 127
 									{
128 128
 										$timediff = $timediff_inHours . "h";
129 129
 									}
130 130
 									else
131 131
 									{
132
-										if($timediff_inMinutes!=0)
132
+										if($timediff_inMinutes != 0)
133 133
 										{
134 134
 											$timediff = $timediff_inMinutes . "m";
135 135
 										}
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 							}
143 143
 						?>
144 144
 
145
-				<article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;">
145
+				<article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"]; ?>;">
146 146
 					<content>
147 147
 						<?php 
148 148
 						if(isset($posts[$i]["image_url"])) {
@@ -154,12 +154,12 @@  discard block
 block discarded – undo
154 154
 						?>
155 155
 					</content>
156 156
 					<aside>
157
-						<a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"];?>">
157
+						<a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"]; ?>">
158 158
 							<i class="fa fa-angle-up fa-3x"></i>
159 159
 						</a>	
160 160
 							<br />
161
-						<?php echo $posts[$i]["vote_count"];?><br />
162
-						<a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"];?>">
161
+						<?php echo $posts[$i]["vote_count"]; ?><br />
162
+						<a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"]; ?>">
163 163
 							<i class="fa fa-angle-down fa-3x"></i>
164 164
 						</a>
165 165
 					</aside>
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
 								<td class="time">
171 171
 									<span data-tooltip="Time">
172 172
 										<i class="fa fa-clock-o"></i>
173
-										<?php echo $timediff;?>
173
+										<?php echo $timediff; ?>
174 174
 									</span> 
175 175
 								</td>
176 176
 								<td class="comments">
177 177
 									<?php if($showCommentIcon) {?>
178 178
 									<span data-tooltip="Comments">
179
-										<a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $posts[$i]["post_id"];?>">
179
+										<a href="index.php?getPostDetails=true&view=<?php echo $view; ?>&postID=<?php echo $posts[$i]["post_id"]; ?>">
180 180
 											<i class="fa fa-commenting-o"></i>
181 181
 											<?php if(array_key_exists("child_count", $posts[$i])) {
182 182
 														echo $posts[$i]["child_count"];
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 								<td class="distance">
190 190
 									<span data-tooltip="Distance">
191 191
 										<i class="fa fa-map-marker"></i>
192
-										<?php echo $posts[$i]["distance"];?> km
192
+										<?php echo $posts[$i]["distance"]; ?> km
193 193
 									</span>
194 194
 								</td>
195 195
 							</tr>
Please login to merge, or discard this patch.
index.php 3 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	$accessToken;
15 15
 	$newPositionStatus;
16 16
 	
17
-	if ($result->num_rows > 0)
17
+	if($result->num_rows > 0)
18 18
 	{
19 19
 		// output data of each row
20 20
 		while($row = $result->fetch_assoc())
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		if(isset($_POST['color']))
80 80
 		{
81 81
 			$color = $_POST['color'];
82
-			switch ($color) {
82
+			switch($color) {
83 83
 				case '8ABDB0':
84 84
 					$color = '8ABDB0';
85 85
 					break;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 							//Set View
175 175
 							if(isset($_GET['view']))
176 176
 							{
177
-								switch ($_GET['view']) {
177
+								switch($_GET['view']) {
178 178
 									case 'comment':
179 179
 										$view = 'comment';
180 180
 										break;
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
 							//Get Posts
214 214
 							else
215 215
 							{
216
-								if($view=='comment')
216
+								if($view == 'comment')
217 217
 								{
218 218
 									$url = "/v2/posts/location/discussed/";
219 219
 								}
220 220
 								else
221 221
 								{
222
-									if($view=='upVote')
222
+									if($view == 'upVote')
223 223
 									{
224 224
 										$url = "/v2/posts/location/popular/";
225 225
 									}
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 							}
236 236
 							
237 237
 
238
-							for($i = 0; $i<$loops; $i++) {
238
+							for($i = 0; $i < $loops; $i++) {
239 239
 							
240 240
 							if(isset($posts[$i])) {
241 241
 							$lastPostId = $posts[$i]['post_id'];
@@ -253,24 +253,24 @@  discard block
 block discarded – undo
253 253
 							$timediff_inHours = (string)$timediff->format('%h');
254 254
 							$timediff_inDays = (string)$timediff->format('%d');
255 255
 							$timediff_inMonth = (string)$timediff->format('%m');
256
-							if($timediff_inMonth!=0) {
256
+							if($timediff_inMonth != 0) {
257 257
 									$timediff = $timediff_inMonth . "m";
258 258
 							}
259 259
 							else
260 260
 							{
261
-								if($timediff_inDays!=0)
261
+								if($timediff_inDays != 0)
262 262
 								{
263 263
 									$timediff = $timediff_inDays . "d";
264 264
 								}
265 265
 								else
266 266
 								{
267
-									if($timediff_inHours!=0)
267
+									if($timediff_inHours != 0)
268 268
 									{
269 269
 										$timediff = $timediff_inHours . "h";
270 270
 									}
271 271
 									else
272 272
 									{
273
-										if($timediff_inMinutes!=0)
273
+										if($timediff_inMinutes != 0)
274 274
 										{
275 275
 											$timediff = $timediff_inMinutes . "m";
276 276
 										}
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 							}
284 284
 						?>
285 285
 						
286
-						<article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;">
286
+						<article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"]; ?>;">
287 287
 							<content>
288 288
 								<?php 
289 289
 								if(isset($posts[$i]["image_url"])) {
@@ -295,12 +295,12 @@  discard block
 block discarded – undo
295 295
 								?>
296 296
 							</content>
297 297
 							<aside>
298
-								<a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"];?>">
298
+								<a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"]; ?>">
299 299
 									<i class="fa fa-angle-up fa-3x"></i>
300 300
 								</a>	
301 301
 									<br />
302
-								<?php echo $posts[$i]["vote_count"];?><br />
303
-								<a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"];?>">
302
+								<?php echo $posts[$i]["vote_count"]; ?><br />
303
+								<a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"]; ?>">
304 304
 									<i class="fa fa-angle-down fa-3x"></i>
305 305
 								</a>
306 306
 							</aside>
@@ -311,13 +311,13 @@  discard block
 block discarded – undo
311 311
 										<td class="time">
312 312
 											<span data-tooltip="Time">
313 313
 												<i class="fa fa-clock-o"></i>
314
-												<?php echo $timediff;?>
314
+												<?php echo $timediff; ?>
315 315
 											</span> 
316 316
 										</td>
317 317
 										<td class="comments">
318 318
 											<?php if($showCommentIcon) {?>
319 319
 											<span data-tooltip="Comments">
320
-												<a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $posts[$i]["post_id"];?>">
320
+												<a href="index.php?getPostDetails=true&view=<?php echo $view; ?>&postID=<?php echo $posts[$i]["post_id"]; ?>">
321 321
 													<i class="fa fa-commenting-o"></i>
322 322
 													<?php if(array_key_exists("child_count", $posts[$i])) {
323 323
 																echo $posts[$i]["child_count"];
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 										<td class="distance">
331 331
 											<span data-tooltip="Distance">
332 332
 												<i class="fa fa-map-marker"></i>
333
-												<?php echo $posts[$i]["distance"];?> km
333
+												<?php echo $posts[$i]["distance"]; ?> km
334 334
 											</span>
335 335
 										</td>
336 336
 									</tr>
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 								<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?>
378 378
 								<h2>Comment on Jodel</h2>
379 379
 								<form method="POST">				
380
-										<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" />
380
+										<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']); ?>" />
381 381
 										<textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> 
382 382
 									<br />
383 383
 									<input type="submit" value="SEND" /> 
@@ -414,13 +414,13 @@  discard block
 block discarded – undo
414 414
 				<div class="col-sm-12">
415 415
 					<div class="row">
416 416
 						<div class="col-sm-3">
417
-							<a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a>
417
+							<a href="index.php" <?php if($view == 'time') echo 'class="active"'; ?>><i class="fa fa-clock-o fa-3x"></i></a>
418 418
 						</div>
419 419
 						<div class="col-sm-3">
420
-							<a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a>
420
+							<a href="index.php?view=comment" <?php if($view == 'comment') echo 'class="active"'; ?>><i class="fa fa-commenting-o fa-3x"></i></a>
421 421
 						</div>
422 422
 						<div class="col-sm-3">
423
-							<a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a>
423
+							<a href="index.php?view=upVote" <?php if($view == 'upVote') echo 'class="active"'; ?>><i class="fa fa-angle-up fa-3x"></i></a>
424 424
 						</div>
425 425
 						<div class="col-sm-3">
426 426
 							<nav>
Please login to merge, or discard this patch.
Braces   +73 added lines, -26 removed lines patch added patch discarded remove patch
@@ -32,7 +32,8 @@  discard block
 block discarded – undo
32 32
 	//createAccount();
33 33
 	
34 34
 	//Set Location
35
-	if(isset($_GET['city'])) {
35
+	if(isset($_GET['city']))
36
+	{
36 37
 		$url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w';
37 38
 		$result = Requests::post($url);
38 39
 		if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST')
@@ -76,11 +77,14 @@  discard block
 block discarded – undo
76 77
 	}
77 78
 	
78 79
 	//Vote
79
-	if(isset($_GET['vote']) && isset($_GET['postID'])) {
80
-		if($_GET['vote'] == "up") {
80
+	if(isset($_GET['vote']) && isset($_GET['postID']))
81
+	{
82
+		if($_GET['vote'] == "up")
83
+		{
81 84
 			$accountCreator = new Upvote();
82 85
 		}
83
-		else if($_GET['vote'] == "down") {
86
+		else if($_GET['vote'] == "down")
87
+		{
84 88
 			$accountCreator = new Downvote();
85 89
 		}
86 90
 		$accountCreator->setAccessToken($accessToken);
@@ -92,7 +96,8 @@  discard block
 block discarded – undo
92 96
 	
93 97
 	
94 98
 	//SendJodel
95
-	if(isset($_POST['message'])) {
99
+	if(isset($_POST['message']))
100
+	{
96 101
 		$accountCreator = new SendJodel();
97 102
 
98 103
 		if(isset($_POST['ancestor']))
@@ -103,7 +108,8 @@  discard block
 block discarded – undo
103 108
 		if(isset($_POST['color']))
104 109
 		{
105 110
 			$color = $_POST['color'];
106
-			switch ($color) {
111
+			switch ($color)
112
+			{
107 113
 				case '8ABDB0':
108 114
 					$color = '8ABDB0';
109 115
 					break;
@@ -198,7 +204,8 @@  discard block
 block discarded – undo
198 204
 							//Set View
199 205
 							if(isset($_GET['view']))
200 206
 							{
201
-								switch ($_GET['view']) {
207
+								switch ($_GET['view'])
208
+								{
202 209
 									case 'comment':
203 210
 										$view = 'comment';
204 211
 										break;
@@ -225,13 +232,17 @@  discard block
 block discarded – undo
225 232
 								$data = $accountCreator->execute();
226 233
 								
227 234
 								$posts[0] = $data;
228
-								if(isset($data['children'])) {
229
-									foreach($data['children'] as $child) {
235
+								if(isset($data['children']))
236
+								{
237
+									foreach($data['children'] as $child)
238
+									{
230 239
 										array_push($posts, $child);
231 240
 									}
232 241
 									$loops = $data['child_count'] + 1;
233 242
 								}
234
-								else $loops = 1;
243
+								else {
244
+									$loops = 1;
245
+								}
235 246
 								$showCommentIcon = FALSE;
236 247
 							}
237 248
 							//Get Posts
@@ -259,9 +270,11 @@  discard block
 block discarded – undo
259 270
 							}
260 271
 							
261 272
 
262
-							for($i = 0; $i<$loops; $i++) {
273
+							for($i = 0; $i<$loops; $i++)
274
+							{
263 275
 							
264
-							if(isset($posts[$i])) {
276
+							if(isset($posts[$i]))
277
+							{
265 278
 							$lastPostId = $posts[$i]['post_id'];
266 279
 
267 280
 							
@@ -277,7 +290,8 @@  discard block
 block discarded – undo
277 290
 							$timediff_inHours = (string)$timediff->format('%h');
278 291
 							$timediff_inDays = (string)$timediff->format('%d');
279 292
 							$timediff_inMonth = (string)$timediff->format('%m');
280
-							if($timediff_inMonth!=0) {
293
+							if($timediff_inMonth!=0)
294
+							{
281 295
 									$timediff = $timediff_inMonth . "m";
282 296
 							}
283 297
 							else
@@ -310,10 +324,12 @@  discard block
 block discarded – undo
310 324
 						<article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;">
311 325
 							<content>
312 326
 								<?php 
313
-								if(isset($posts[$i]["image_url"])) {
327
+								if(isset($posts[$i]["image_url"]))
328
+								{
314 329
 									echo '<img src="' . $posts[$i]["image_url"] . '">';
315 330
 								}
316
-								else {
331
+								else
332
+								{
317 333
 									echo str_replace('  ', ' &nbsp;', nl2br(htmlspecialchars($posts[$i]["message"])));
318 334
 								}
319 335
 								?>
@@ -339,13 +355,19 @@  discard block
 block discarded – undo
339 355
 											</span> 
340 356
 										</td>
341 357
 										<td class="comments">
342
-											<?php if($showCommentIcon) {?>
358
+											<?php if($showCommentIcon)
359
+{
360
+?>
343 361
 											<span data-tooltip="Comments">
344 362
 												<a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $posts[$i]["post_id"];?>">
345 363
 													<i class="fa fa-commenting-o"></i>
346
-													<?php if(array_key_exists("child_count", $posts[$i])) {
364
+													<?php if(array_key_exists("child_count", $posts[$i]))
365
+{
347 366
 																echo $posts[$i]["child_count"];
348
-															} else echo "0";
367
+															}
368
+															else {
369
+																echo "0";
370
+															}
349 371
 													?>
350 372
 													</a>
351 373
 											</span>
@@ -369,7 +391,9 @@  discard block
 block discarded – undo
369 391
 
370 392
 					</content>
371 393
 					
372
-					<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?>
394
+					<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails']))
395
+{
396
+?>
373 397
 						<p id="loading">
374 398
 							Loading…
375 399
 						</p>
@@ -382,7 +406,11 @@  discard block
 block discarded – undo
382 406
 							<div>
383 407
 								<h2>Position</h2>
384 408
 								<form method="get">
385
-									<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required>
409
+									<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus))
410
+{
411
+	echo $newPositionStatus;
412
+}
413
+?>" required>
386 414
 
387 415
 									<input type="submit" value="Set Location" /> 
388 416
 								</form>
@@ -398,7 +426,9 @@  discard block
 block discarded – undo
398 426
 
399 427
 						<article>
400 428
 							<div>
401
-								<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails'])) { ?>
429
+								<?php if(isset($_GET['postID']) && isset($_GET['getPostDetails']))
430
+{
431
+?>
402 432
 								<h2>Comment on Jodel</h2>
403 433
 								<form method="POST">				
404 434
 										<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postID']);?>" />
@@ -406,7 +436,10 @@  discard block
 block discarded – undo
406 436
 									<br />
407 437
 									<input type="submit" value="SEND" /> 
408 438
 								</form>
409
-									<?php } else { ?>
439
+									<?php }
440
+else
441
+{
442
+?>
410 443
 								<h2>New Jodel</h2>
411 444
 								<form method="POST">
412 445
 									<textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> 
@@ -438,13 +471,25 @@  discard block
 block discarded – undo
438 471
 				<div class="col-sm-12">
439 472
 					<div class="row">
440 473
 						<div class="col-sm-3">
441
-							<a href="index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a>
474
+							<a href="index.php" <?php if($view=='time')
475
+{
476
+	echo 'class="active"';
477
+}
478
+?>><i class="fa fa-clock-o fa-3x"></i></a>
442 479
 						</div>
443 480
 						<div class="col-sm-3">
444
-							<a href="index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a>
481
+							<a href="index.php?view=comment" <?php if($view=='comment')
482
+{
483
+	echo 'class="active"';
484
+}
485
+?>><i class="fa fa-commenting-o fa-3x"></i></a>
445 486
 						</div>
446 487
 						<div class="col-sm-3">
447
-							<a href="index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a>
488
+							<a href="index.php?view=upVote" <?php if($view=='upVote')
489
+{
490
+	echo 'class="active"';
491
+}
492
+?>><i class="fa fa-angle-up fa-3x"></i></a>
448 493
 						</div>
449 494
 						<div class="col-sm-3">
450 495
 							<nav>
@@ -476,7 +521,9 @@  discard block
 block discarded – undo
476 521
 			}
477 522
 
478 523
 
479
-			<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) { ?>
524
+			<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails']))
525
+{
526
+?>
480 527
 			$(document).ready(function() {
481 528
 				var win = $(window);
482 529
 				var lastPostId = "<?php echo $lastPostId; ?>";
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,15 +35,15 @@  discard block
 block discarded – undo
35 35
 	if(isset($_GET['city'])) {
36 36
 		$url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w';
37 37
 		$result = Requests::post($url);
38
-		if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS' || json_decode($result->body, true)['status'] == 'INVALID_REQUEST')
38
+		if(json_decode($result->body, TRUE)['status'] == 'ZERO_RESULTS' || json_decode($result->body, TRUE)['status'] == 'INVALID_REQUEST')
39 39
 		{
40 40
 			$newPositionStatus = "0 results";
41 41
 		}
42 42
 		else
43 43
 		{
44
-			$name = json_decode($result->body, true)['results']['0']['address_components']['0']['long_name'];
45
-			$lat = json_decode($result->body, true)['results']['0']['geometry']['location']['lat'];
46
-			$lng = json_decode($result->body, true)['results']['0']['geometry']['location']['lng'];
44
+			$name = json_decode($result->body, TRUE)['results']['0']['address_components']['0']['long_name'];
45
+			$lat = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lat'];
46
+			$lng = json_decode($result->body, TRUE)['results']['0']['geometry']['location']['lng'];
47 47
 
48 48
 			$location = new Location();
49 49
 			$location->setLat($lat);
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 							lng='" . $lng . "'
64 64
 						WHERE id='1'");
65 65
 
66
-				if($result === false)
66
+				if($result === FALSE)
67 67
 				{
68 68
 						echo "Updating location failed: (" . $db->errno . ") " . $db->error;
69 69
 				}
Please login to merge, or discard this patch.