Completed
Branch master (a5e97c)
by mains
02:22
created
index.php 1 patch
Braces   +37 added lines, -27 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@  discard block
 block discarded – undo
21 21
 		{
22 22
 			$accessToken = $row["access_token"];
23 23
 		}
24
-	}
25
-	else
24
+	} else
26 25
 	{
27 26
 		echo "Error: 0 results";
28 27
 	}
@@ -38,8 +37,7 @@  discard block
 block discarded – undo
38 37
 		if(json_decode($result->body, true)['status'] == 'ZERO_RESULTS')
39 38
 		{
40 39
 			$newPostionStatus = "0 results";
41
-		}
42
-		else
40
+		} else
43 41
 		{
44 42
 			$location = new Location();
45 43
 			$location->setLat(json_decode($result->body, true)['results']['0']['geometry']['location']['lat']);
@@ -56,8 +54,7 @@  discard block
 block discarded – undo
56 54
 	if(isset($_GET['vote']) && isset($_GET['postID'])) {
57 55
 		if($_GET['vote'] == "up") {
58 56
 			$accountCreator = new Upvote();
59
-		}
60
-		else if($_GET['vote'] == "down") {
57
+		} else if($_GET['vote'] == "down") {
61 58
 			$accountCreator = new Downvote();
62 59
 		}
63 60
 		$accountCreator->setAccessToken($accessToken);
@@ -113,7 +110,10 @@  discard block
 block discarded – undo
113 110
 			<a href="index.php">
114 111
 				<h1>
115 112
 					Jodel WebClient
116
-					<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) echo '<i class="fa fa-refresh fa-1x"></i>';?>
113
+					<?php if(!isset($_GET['postID']) && !isset($_GET['getPostDetails'])) {
114
+	echo '<i class="fa fa-refresh fa-1x"></i>';
115
+}
116
+?>
117 117
 				</h1>					
118 118
 			</a>
119 119
 			<div class="clear"></div>
@@ -151,8 +151,9 @@  discard block
 block discarded – undo
151 151
 										array_push($posts, $child);
152 152
 									}
153 153
 									$loops = $data['child_count'] + 1;
154
+								} else {
155
+									$loops = 1;
154 156
 								}
155
-								else $loops = 1;
156 157
 								$showCommentIcon = FALSE;
157 158
 							}
158 159
 							//Get Posts
@@ -161,15 +162,13 @@  discard block
 block discarded – undo
161 162
 								{
162 163
 									$commentView = true;
163 164
 									$url = "/v2/posts/location/discussed/";
164
-								}
165
-								else
165
+								} else
166 166
 								{
167 167
 									if(isset($_GET['upVoteView']))
168 168
 									{
169 169
 										$upVoteView = true;
170 170
 										$url = "/v2/posts/location/popular/";
171
-									}
172
-									else
171
+									} else
173 172
 									{
174 173
 										$timeView = true;
175 174
 										$url = "/v2/posts";
@@ -202,26 +201,22 @@  discard block
 block discarded – undo
202 201
 							$timediff_inMonth = (string)$timediff->format('%m');
203 202
 							if($timediff_inMonth!=0) {
204 203
 									$timediff = $timediff_inMonth . "m";
205
-							}
206
-							else
204
+							} else
207 205
 							{
208 206
 								if($timediff_inDays!=0)
209 207
 								{
210 208
 									$timediff = $timediff_inDays . "d";
211
-								}
212
-								else
209
+								} else
213 210
 								{
214 211
 									if($timediff_inHours!=0)
215 212
 									{
216 213
 										$timediff = $timediff_inHours . "h";
217
-									}
218
-									else
214
+									} else
219 215
 									{
220 216
 										if($timediff_inMinutes!=0)
221 217
 										{
222 218
 											$timediff = $timediff_inMinutes . "m";
223
-										}
224
-										else
219
+										} else
225 220
 										{
226 221
 											$timediff = $timediff_inSeconds . "s";
227 222
 										}
@@ -235,8 +230,7 @@  discard block
 block discarded – undo
235 230
 								<?php 
236 231
 								if(isset($posts[$i]["image_url"])) {
237 232
 									echo '<img src="' . $posts[$i]["image_url"] . '">';
238
-								}
239
-								else {
233
+								} else {
240 234
 									echo nl2br($posts[$i]["message"]);
241 235
 								}
242 236
 								?>
@@ -268,7 +262,9 @@  discard block
 block discarded – undo
268 262
 													<i class="fa fa-commenting-o"></i>
269 263
 													<?php if(array_key_exists("child_count", $posts[$i])) {
270 264
 																echo $posts[$i]["child_count"];
271
-															} else echo "0";
265
+															} else {
266
+																echo "0";
267
+															}
272 268
 													?>
273 269
 													</a>
274 270
 											</span>
@@ -298,9 +294,18 @@  discard block
 block discarded – undo
298 294
 				</p>
299 295
 				<?php } ?>
300 296
 				<nav id="sortJodelBy">
301
-					<a href="index.php" <?php if(isset($timeView)) echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a>
302
-					<a href="index.php?commentView=true" <?php if(isset($commentView)) echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a>
303
-					<a href="index.php?upVoteView=true" <?php if(isset($upVoteView)) echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a>
297
+					<a href="index.php" <?php if(isset($timeView)) {
298
+	echo 'class="active"';
299
+}
300
+?>><i class="fa fa-clock-o fa-3x"></i></a>
301
+					<a href="index.php?commentView=true" <?php if(isset($commentView)) {
302
+	echo 'class="active"';
303
+}
304
+?>><i class="fa fa-commenting-o fa-3x"></i></a>
305
+					<a href="index.php?upVoteView=true" <?php if(isset($upVoteView)) {
306
+	echo 'class="active"';
307
+}
308
+?>><i class="fa fa-angle-up fa-3x"></i></a>
304 309
 				</nav>
305 310
 			</div>
306 311
 			
@@ -308,7 +313,12 @@  discard block
 block discarded – undo
308 313
 				<article>
309 314
 					<h3>Position</h3>
310 315
 					<form method="get">
311
-						<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; else echo $posts[0]["location"]["name"]; ?>" required>
316
+						<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) {
317
+	echo $newPositionStatus;
318
+} else {
319
+	echo $posts[0]["location"]["name"];
320
+}
321
+?>" required>
312 322
 
313 323
 						<input type="submit" value="Set Location" /> 
314 324
 					</form>
Please login to merge, or discard this patch.
get-posts-ajax.php 1 patch
Braces   +10 added lines, -15 removed lines patch added patch discarded remove patch
@@ -51,15 +51,13 @@  discard block
 block discarded – undo
51 51
 	{
52 52
 		$commentView = true;
53 53
 		$url = "/posts/location/discussed/";
54
-	}
55
-	else
54
+	} else
56 55
 	{
57 56
 		if(isset($_GET['upVoteView']))
58 57
 		{
59 58
 			$upVoteView = true;
60 59
 			$url = "/posts/location/popular/";
61
-		}
62
-		else
60
+		} else
63 61
 		{
64 62
 			$timeView = true;
65 63
 			$url = "/v2/posts";
@@ -96,26 +94,22 @@  discard block
 block discarded – undo
96 94
 							$timediff_inMonth = (string)$timediff->format('%m');
97 95
 							if($timediff_inMonth!=0) {
98 96
 									$timediff = $timediff_inMonth . "m";
99
-							}
100
-							else
97
+							} else
101 98
 							{
102 99
 								if($timediff_inDays!=0)
103 100
 								{
104 101
 									$timediff = $timediff_inDays . "d";
105
-								}
106
-								else
102
+								} else
107 103
 								{
108 104
 									if($timediff_inHours!=0)
109 105
 									{
110 106
 										$timediff = $timediff_inHours . "h";
111
-									}
112
-									else
107
+									} else
113 108
 									{
114 109
 										if($timediff_inMinutes!=0)
115 110
 										{
116 111
 											$timediff = $timediff_inMinutes . "m";
117
-										}
118
-										else
112
+										} else
119 113
 										{
120 114
 											$timediff = $timediff_inSeconds . "s";
121 115
 										}
@@ -129,8 +123,7 @@  discard block
 block discarded – undo
129 123
 						<?php 
130 124
 						if(isset($posts[$i]["image_url"])) {
131 125
 							echo '<img src="' . $posts[$i]["image_url"] . '">';
132
-						}
133
-						else {
126
+						} else {
134 127
 							echo nl2br($posts[$i]["message"]);
135 128
 						}
136 129
 						?>
@@ -162,7 +155,9 @@  discard block
 block discarded – undo
162 155
 											<i class="fa fa-commenting-o"></i>
163 156
 											<?php if(array_key_exists("child_count", $posts[$i])) {
164 157
 														echo $posts[$i]["child_count"];
165
-													} else echo "0";
158
+													} else {
159
+														echo "0";
160
+													}
166 161
 											?>
167 162
 											</a>
168 163
 									</span>
Please login to merge, or discard this patch.
php/DatabaseConnect.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,6 +40,6 @@
 block discarded – undo
40 40
 			 ) DEFAULT CHARSET=utf8";
41 41
   if(!$db->query($query))
42 42
   {
43
-    throw new Exception($db->error($mysqli));
43
+	throw new Exception($db->error($mysqli));
44 44
   }
45 45
 
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(): string
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(): string
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(): string
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(): string
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(): string
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(): string
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(): string
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(): string
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(): string
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(): string
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.
php/Requests/GetKarma.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -3,18 +3,18 @@
 block discarded – undo
3 3
 
4 4
 class GetKarma extends AbstractRequest {
5 5
 		
6
-    function getApiEndPoint()
7
-    {
8
-        return '/v2/users/karma';
9
-    }
10
-    function getPayload()
11
-    {
12
-        return array(
13
-        );
14
-    }
15
-    function getMethod()
16
-    {
17
-        return 'GET';
18
-    }
6
+	function getApiEndPoint()
7
+	{
8
+		return '/v2/users/karma';
9
+	}
10
+	function getPayload()
11
+	{
12
+		return array(
13
+		);
14
+	}
15
+	function getMethod()
16
+	{
17
+		return 'GET';
18
+	}
19 19
 }
20 20
 
Please login to merge, or discard this patch.
php/Requests/SetLocation.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -3,37 +3,37 @@
 block discarded – undo
3 3
 
4 4
 class SetLocation extends AbstractRequest {
5 5
 		 /**
6
-     * @var Location
7
-     */
8
-    public $location;
9
-    /**
10
-     * @return Location
11
-     */
12
-    public function getLocation(): Location
13
-    {
14
-        return $this->location;
15
-    }
16
-    /**
17
-     * @param Location $location
18
-     */
19
-    public function setLocation(Location $location)
20
-    {
21
-        $this->location = $location;
22
-    }
6
+		  * @var Location
7
+		  */
8
+	public $location;
9
+	/**
10
+	 * @return Location
11
+	 */
12
+	public function getLocation(): Location
13
+	{
14
+		return $this->location;
15
+	}
16
+	/**
17
+	 * @param Location $location
18
+	 */
19
+	public function setLocation(Location $location)
20
+	{
21
+		$this->location = $location;
22
+	}
23 23
 		
24
-    function getApiEndPoint()
25
-    {
26
-        return '/v2/users/location';
27
-    }
28
-    function getPayload()
29
-    {
30
-        return array(
24
+	function getApiEndPoint()
25
+	{
26
+		return '/v2/users/location';
27
+	}
28
+	function getPayload()
29
+	{
30
+		return array(
31 31
 					"location" => $this->getLocation()->toArray(),
32
-        );
33
-    }
34
-    function getMethod()
35
-    {
36
-        return 'PUT';
37
-    }
32
+		);
33
+	}
34
+	function getMethod()
35
+	{
36
+		return 'PUT';
37
+	}
38 38
 }
39 39
 
Please login to merge, or discard this patch.
php/Requests/CreateUser.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -1,66 +1,66 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class CreateUser extends AbstractRequest {
4
-    /**
5
-     * @var Location
6
-     */
7
-    public $location;
8
-    public $deviceUid;
9
-    /**
10
-     * @return Location
11
-     */
12
-    public function getLocation(): Location
13
-    {
14
-        return $this->location;
15
-    }
16
-    /**
17
-     * @param Location $location
18
-     */
19
-    public function setLocation(Location $location)
20
-    {
21
-        $this->location = $location;
22
-    }
23
-    public function getDeviceUid()
24
-    {
4
+	/**
5
+	 * @var Location
6
+	 */
7
+	public $location;
8
+	public $deviceUid;
9
+	/**
10
+	 * @return Location
11
+	 */
12
+	public function getLocation(): Location
13
+	{
14
+		return $this->location;
15
+	}
16
+	/**
17
+	 * @param Location $location
18
+	 */
19
+	public function setLocation(Location $location)
20
+	{
21
+		$this->location = $location;
22
+	}
23
+	public function getDeviceUid()
24
+	{
25 25
 		return $this->deviceUid;
26 26
 	}
27 27
 	public function setDeviceUid($deviceUid)
28
-    {
28
+	{
29 29
 			$this->deviceUid = $deviceUid;
30 30
 	}
31
-    public function generateDeviceUid()
32
-    {
33
-        return $this->random_str(64, 'abcdef0123456789');
34
-    }
35
-    function random_str($length, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
36
-    {
37
-        $str = '';
38
-        $max = mb_strlen($keyspace, '8bit') - 1;
39
-        for ($i = 0; $i < $length; ++$i) {
40
-            $str .= $keyspace[random_int(0, $max)];
41
-        }
42
-        return $str;
43
-    }
44
-    function getApiEndPoint()
45
-    {
46
-        return '/v2/users';
47
-    }
48
-    function getPayload()
49
-    {
31
+	public function generateDeviceUid()
32
+	{
33
+		return $this->random_str(64, 'abcdef0123456789');
34
+	}
35
+	function random_str($length, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
36
+	{
37
+		$str = '';
38
+		$max = mb_strlen($keyspace, '8bit') - 1;
39
+		for ($i = 0; $i < $length; ++$i) {
40
+			$str .= $keyspace[random_int(0, $max)];
41
+		}
42
+		return $str;
43
+	}
44
+	function getApiEndPoint()
45
+	{
46
+		return '/v2/users';
47
+	}
48
+	function getPayload()
49
+	{
50 50
 			if(!isset($this->deviceUid))
51 51
 			{
52 52
 				$this->setDeviceUid($this->generateDeviceUid());
53 53
 			}
54 54
 			echo $this->getDeviceUid();
55
-            echo "<br>";
55
+			echo "<br>";
56 56
 			return array(
57 57
 					"location" => $this->getLocation()->toArray(),
58 58
 					"client_id" => self::CLIENTID,
59 59
 					"device_uid" => $this->getDeviceUid(),
60 60
 			);
61
-    }
62
-    function getMethod()
63
-    {
64
-        return 'POST';
65
-    }
61
+	}
62
+	function getMethod()
63
+	{
64
+		return 'POST';
65
+	}
66 66
 }
Please login to merge, or discard this patch.
php/Requests/GetPosts.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -5,20 +5,20 @@  discard block
 block discarded – undo
5 5
 {
6 6
 	public $lastPostId;
7 7
 
8
-    public $url;
8
+	public $url;
9 9
         
10
-    function setUrl ($url)
11
-    {
12
-            $this->url = $url;
13
-    }
10
+	function setUrl ($url)
11
+	{
12
+			$this->url = $url;
13
+	}
14 14
     
15
-    function getUrl ()
16
-    {
17
-        return $this->url;
18
-    }
15
+	function getUrl ()
16
+	{
17
+		return $this->url;
18
+	}
19 19
 		
20
-    function setLastPostId ($lastPostId)
21
-    {
20
+	function setLastPostId ($lastPostId)
21
+	{
22 22
 			$this->lastPostId = $lastPostId;
23 23
 	}
24 24
 	
@@ -27,22 +27,22 @@  discard block
 block discarded – undo
27 27
 		return $this->lastPostId;
28 28
 	}
29 29
     
30
-    function getApiEndPoint()
31
-    {
32
-        $apiEndPoint = $this->getUrl();
33
-        //echo $GLOBALS['lastPostId'];
34
-        if ($this->getLastPostId() != "") {
30
+	function getApiEndPoint()
31
+	{
32
+		$apiEndPoint = $this->getUrl();
33
+		//echo $GLOBALS['lastPostId'];
34
+		if ($this->getLastPostId() != "") {
35 35
 			$apiEndPoint = $this->getUrl() . '/location/?after=' . $this->getLastPostId();
36 36
 		}
37
-        return $apiEndPoint;
38
-    }
39
-    function getPayload()
40
-    {
41
-        return array(
42
-        );
43
-    }
44
-    function getMethod()
45
-    {
46
-        return 'GET';
47
-    }
37
+		return $apiEndPoint;
38
+	}
39
+	function getPayload()
40
+	{
41
+		return array(
42
+		);
43
+	}
44
+	function getMethod()
45
+	{
46
+		return 'GET';
47
+	}
48 48
 }
Please login to merge, or discard this patch.
php/Requests/Upvote.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -3,19 +3,19 @@
 block discarded – undo
3 3
 
4 4
 class Upvote extends AbstractRequest {
5 5
 		
6
-    function getApiEndPoint()
7
-    {
8
-        return '/v2/posts/' . $_GET['postID'] . '/upvote';
9
-    }
10
-    function getPayload()
11
-    {
12
-        return array(
6
+	function getApiEndPoint()
7
+	{
8
+		return '/v2/posts/' . $_GET['postID'] . '/upvote';
9
+	}
10
+	function getPayload()
11
+	{
12
+		return array(
13 13
 					"reason_code" => -1,
14
-        );
15
-    }
16
-    function getMethod()
17
-    {
18
-        return 'PUT';
19
-    }
14
+		);
15
+	}
16
+	function getMethod()
17
+	{
18
+		return 'PUT';
19
+	}
20 20
 }
21 21
 
Please login to merge, or discard this patch.