Completed
Push — master ( 1ba5c4...027077 )
by mains
03:02
created
php/View.php 1 patch
Braces   +24 added lines, -12 removed lines patch added patch discarded remove patch
@@ -9,7 +9,8 @@  discard block
 block discarded – undo
9 9
 	 * Compute HTML Code
10 10
 	 */
11 11
  	function jodelToHtml($post, $view = 'time', $isDetailedView = FALSE)
12
-    {   //ToDO
12
+ 	{
13
+//ToDO
13 14
         //Replace # with link
14 15
         //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text);
15 16
 
@@ -65,7 +66,8 @@  discard block
 block discarded – undo
65 66
 
66 67
                     echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">';
67 68
                 }
68
-                else {
69
+                else
70
+                {
69 71
                     echo str_replace('  ', ' &nbsp;', nl2br(htmlspecialchars($post['message'])));
70 72
                 }
71 73
                 ?>
@@ -73,11 +75,13 @@  discard block
 block discarded – undo
73 75
             <aside>
74 76
                 <?php
75 77
                     if($isDetailedView)
76
-                    {?>
78
+                    {
79
+?>
77 80
                         <a href="index.php?vote=up&getPostDetails=true&postId=<?php echo $post['post_id'];?>&postId_parent=<?php echo htmlspecialchars($_GET['postId']);?>" rel="nofollow">
78 81
               <?php }
79
-                    else
80
-                    {?>
82
+else
83
+                    {
84
+?>
81 85
                         <a href="index.php?vote=up&postId=<?php echo $post['post_id'];?>" rel="nofollow">
82 86
               <?php } ?>
83 87
                             <i class="fa fa-angle-up fa-3x"></i>
@@ -86,11 +90,13 @@  discard block
 block discarded – undo
86 90
                         <?php echo $post["vote_count"];?><br />
87 91
                 <?php
88 92
                     if($isDetailedView)
89
-                    {?>
93
+                    {
94
+?>
90 95
                         <a href="index.php?vote=down&getPostDetails=true&postId=<?php echo $post['post_id'];?>&postId_parent=<?php echo htmlspecialchars($_GET['postId']);?>" rel="nofollow">
91 96
               <?php }
92
-                    else
93
-                    {?>
97
+else
98
+                    {
99
+?>
94 100
                         <a href="index.php?vote=down&postId=<?php echo $post['post_id'];?>" rel="nofollow">
95 101
               <?php } ?>
96 102
                             <i class="fa fa-angle-down fa-3x"></i>
@@ -108,13 +114,19 @@  discard block
 block discarded – undo
108 114
                             </span> 
109 115
                         </td>
110 116
                         <td class="comments">
111
-                            <?php if(!$isDetailedView) {?>
117
+                            <?php if(!$isDetailedView)
118
+{
119
+?>
112 120
                             <span data-tooltip="Comments">
113 121
                                 <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postId=<?php echo $post["post_id"];?>">
114 122
                                     <i class="fa fa-commenting-o"></i>
115
-                                    <?php if(array_key_exists("child_count", $post)) {
123
+                                    <?php if(array_key_exists("child_count", $post))
124
+{
116 125
                                                 echo $post["child_count"];
117
-                                            } else echo "0";
126
+                                            }
127
+                                            else {
128
+                                            	echo "0";
129
+                                            }
118 130
                                     ?>
119 131
                                     </a>
120 132
                             </span>
@@ -230,7 +242,7 @@  discard block
 block discarded – undo
230 242
 	}
231 243
 
232 244
 	function getPosts($lastPostId, $accessToken, $url, $version = 'v2')
233
-	{	
245
+	{
234 246
 		$accountCreator = new GetPosts();
235 247
 		$accountCreator->setLastPostId($lastPostId);
236 248
 		$accountCreator->setAccessToken($accessToken);
Please login to merge, or discard this patch.
php/jodel-web.php 1 patch
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	}
98 98
 	
99 99
 	if(configPropertyExists($config, 'karmaDeviceUid'))
100
-    {
100
+	{
101 101
     	$jodelAccountForKarma = new JodelAccount($config['karmaDeviceUid']);
102 102
     }
103 103
     else
@@ -114,7 +114,8 @@  discard block
 block discarded – undo
114 114
 	//Set View
115 115
 	if(isset($_GET['view']))
116 116
 	{
117
-		switch ($_GET['view']) {
117
+		switch ($_GET['view'])
118
+		{
118 119
 			case 'comment':
119 120
 				$view = 'comment';
120 121
 				break;
@@ -151,7 +152,7 @@  discard block
 block discarded – undo
151 152
 	{
152 153
 		$jodelAccountForKarma->votePostId($_GET['postId'], $_GET['vote']);
153 154
 		if(isset($_GET['getPostDetails']) && isset($_GET['getPostDetails']))
154
-        {
155
+		{
155 156
             header('Location: index.php?getPostDetails=true&postId=' . htmlspecialchars($_GET['postId_parent']) . '#postId-' . htmlspecialchars($_GET['postId']));
156 157
         }
157 158
         else
@@ -169,7 +170,7 @@  discard block
 block discarded – undo
169 170
 
170 171
 
171 172
 	function getPosts($lastPostId, $accessToken, $url, $version = 'v2')
172
-	{	
173
+	{
173 174
 		$accountCreator = new GetPosts();
174 175
 		$accountCreator->setLastPostId($lastPostId);
175 176
 		$accountCreator->setAccessToken($accessToken);
@@ -290,7 +291,8 @@  discard block
 block discarded – undo
290 291
 
291 292
 			$posts[0] = $data;
292 293
 
293
-			if(array_key_exists('children', $data)) {
294
+			if(array_key_exists('children', $data))
295
+			{
294 296
 				foreach($data['children'] as $key => $child)
295 297
 				{
296 298
 					
Please login to merge, or discard this patch.
vote-ajax.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 {
60 60
 	$response = array("success" => $success, "message" => $message, "captcha" => $captcha, "deviceUid" => $deviceUid);
61 61
 }
62
-else 
62
+else
63 63
 {
64 64
 	$response = array("success" => $success, "message" => $message);
65 65
 }
Please login to merge, or discard this patch.
php/JodelAccount.php 1 patch
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         if($location->getLat() == $lat && $location->getLng() == $lng && $location->getCityName() == $name)
88 88
         {
89 89
             return TRUE;
90
-        }  
90
+        }
91 91
         else
92 92
         {
93 93
             return FALSE;
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         if(substr($_GET['city'], 0, 1) === '#')
101 101
         {
102 102
             return htmlspecialchars($_GET['city']) . " " . $this->location->cityName;
103
-        }                
103
+        }
104 104
         else
105 105
         {
106 106
             $url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' . htmlspecialchars($_GET['city']) . '&key=AIzaSyCwhnja-or07012HqrhPW7prHEDuSvFT4w';
@@ -262,7 +262,8 @@  discard block
 block discarded – undo
262 262
         if(isset($_POST['color']))
263 263
         {
264 264
             $color = $_POST['color'];
265
-            switch ($color) {
265
+            switch ($color)
266
+            {
266 267
                 case '8ABDB0':
267 268
                     $color = '8ABDB0';
268 269
                     break;
@@ -355,7 +356,8 @@  discard block
 block discarded – undo
355 356
                                     expiration_date='" . $expiration_date . "'
356 357
                                 WHERE device_uid='" . $device_uid . "'");
357 358
 
358
-        if($result === false){
359
+        if($result === false)
360
+        {
359 361
                 error_log("Adding account failed: (" . $db->errno . ") " . $db->error);
360 362
         }   
361 363
     }
@@ -435,14 +437,16 @@  discard block
 block discarded – undo
435 437
         $result = $db->query("INSERT INTO votes (device_uid, postId, type)
436 438
                         VALUES ('" . $this->deviceUid . "','" . $postId . "','" . $voteType . "')");
437 439
         
438
-        if($result === false){
440
+        if($result === false)
441
+        {
439 442
                 $error = db_error();
440 443
                 echo $error;
441 444
                 echo "Adding Vote failed: (" . $result->errno . ") " . $result->error;
442 445
         }       
443 446
     }
444 447
 
445
-    function registerAccount($location) {
448
+    function registerAccount($location)
449
+    {
446 450
         $accountCreator = new CreateUser();
447 451
         $accountCreator->setLocation($location);
448 452
         $data = $accountCreator->execute();
@@ -467,7 +471,8 @@  discard block
 block discarded – undo
467 471
                         "','" . $device_uid . "','" . $name . "','" . $lat . "','" . $lng . "') ");
468 472
 
469 473
         $success = TRUE;
470
-        if($result === false){
474
+        if($result === false)
475
+        {
471 476
                 $error = db_error();
472 477
                 echo $error;
473 478
                 echo "Adding account failed: (" . $result->errno . ") " . $result->error;
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +23 added lines, -6 removed lines patch added patch discarded remove patch
@@ -75,7 +75,11 @@  discard block
 block discarded – undo
75 75
 
76 76
 					<div id="location_mobile" class="hidden-sm-up">
77 77
 						<form method="get">
78
-							<input type="text" id="city_mobile" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required>
78
+							<input type="text" id="city_mobile" name="city" placeholder="<?php if(isset($newPositionStatus))
79
+{
80
+	echo $newPositionStatus;
81
+}
82
+?>" required>
79 83
 
80 84
 							<input type="submit" id="submit_mobile" class="fa" value="&#xf0ac;" />
81 85
 						</form>
@@ -102,7 +106,9 @@  discard block
 block discarded – undo
102 106
 
103 107
 					</content>
104 108
 					
105
-					<?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?>
109
+					<?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails']))
110
+{
111
+?>
106 112
 						<p id="loading">
107 113
 							Loading…
108 114
 						</p>
@@ -115,7 +121,11 @@  discard block
 block discarded – undo
115 121
 							<div>
116 122
 								<h2>Position / Hashtag</h2>
117 123
 								<form method="get">
118
-									<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required>
124
+									<input type="text" id="city" name="city" placeholder="<?php if(isset($newPositionStatus))
125
+{
126
+	echo $newPositionStatus;
127
+}
128
+?>" required>
119 129
 									<label>try: #jhj</label><br>
120 130
 									<input type="submit" value="Set Location" /> 
121 131
 								</form>
@@ -131,7 +141,9 @@  discard block
 block discarded – undo
131 141
 
132 142
 						<article>
133 143
 							<div>
134
-								<?php if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) { ?>
144
+								<?php if(isset($_GET['postId']) && isset($_GET['getPostDetails']))
145
+{
146
+?>
135 147
 								<h2>Comment on Jodel</h2>
136 148
 								<form method="POST">				
137 149
 										<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']);?>" />
@@ -139,7 +151,10 @@  discard block
 block discarded – undo
139 151
 									<br />
140 152
 									<input type="submit" value="SEND" /> 
141 153
 								</form>
142
-									<?php } else { ?>
154
+									<?php }
155
+else
156
+{
157
+?>
143 158
 								<h2>New Jodel</h2>
144 159
 								<form method="POST">
145 160
 									<textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> 
@@ -198,7 +213,9 @@  discard block
 block discarded – undo
198 213
 				    $('html,body').animate({scrollTop: aTag.offset().top-90},'slow');
199 214
 				}
200 215
 
201
-				<?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?>
216
+				<?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails']))
217
+{
218
+?>
202 219
 
203 220
 				
204 221
 
Please login to merge, or discard this patch.
template/nav-bottom.php 1 patch
Braces   +15 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,13 +2,25 @@
 block discarded – undo
2 2
 	<div class="col-xs-12">
3 3
 		<div class="row">
4 4
 			<div class="col-xs-3">
5
-				<a href="<?php echo $baseUrl;?>index.php" <?php if($view=='time') echo 'class="active"';?>><i class="fa fa-clock-o fa-3x"></i></a>
5
+				<a href="<?php echo $baseUrl;?>index.php" <?php if($view=='time')
6
+{
7
+	echo 'class="active"';
8
+}
9
+?>><i class="fa fa-clock-o fa-3x"></i></a>
6 10
 			</div>
7 11
 			<div class="col-xs-3">
8
-				<a href="<?php echo $baseUrl;?>index.php?view=comment" <?php if($view=='comment') echo 'class="active"';?>><i class="fa fa-commenting-o fa-3x"></i></a>
12
+				<a href="<?php echo $baseUrl;?>index.php?view=comment" <?php if($view=='comment')
13
+{
14
+	echo 'class="active"';
15
+}
16
+?>><i class="fa fa-commenting-o fa-3x"></i></a>
9 17
 			</div>
10 18
 			<div class="col-xs-3">
11
-				<a href="<?php echo $baseUrl;?>index.php?view=upVote" <?php if($view=='upVote') echo 'class="active"';?>><i class="fa fa-angle-up fa-3x"></i></a>
19
+				<a href="<?php echo $baseUrl;?>index.php?view=upVote" <?php if($view=='upVote')
20
+{
21
+	echo 'class="active"';
22
+}
23
+?>><i class="fa fa-angle-up fa-3x"></i></a>
12 24
 			</div>
13 25
 			<div class="col-xs-3">
14 26
 				<nav>
Please login to merge, or discard this patch.
php/Requests/AbstractRequest.php 1 patch
Braces   +13 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 abstract class AbstractRequest
4
-{	
4
+{
5 5
     const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26';
6 6
     const APIURL = 'https://api.go-tellm.com/api';
7 7
     const SECRET = 'LDWWpuUigOnKCbCLpoNMDHCqHCWbLKPzHbnIUKIf';
@@ -20,7 +20,8 @@  discard block
 block discarded – undo
20 20
 		        
21 21
 		$this->payLoad = $this->getPayload();
22 22
 		$device_uid = '';
23
-		if(isset($this->payLoad['device_uid'])) {
23
+		if(isset($this->payLoad['device_uid']))
24
+		{
24 25
 			$device_uid = $this->payLoad['device_uid'];
25 26
 		}
26 27
 				
@@ -29,7 +30,8 @@  discard block
 block discarded – undo
29 30
         $header = $this->getSignHeaders();
30 31
         $url = $this->getFullUrl();
31 32
 
32
-        if ($this->getAccessToken()) {
33
+        if ($this->getAccessToken())
34
+        {
33 35
             $header['Authorization'] = "Bearer " . $this->getAccessToken();
34 36
         }
35 37
         //Comment out to debug the Request:
@@ -52,7 +54,8 @@  discard block
 block discarded – undo
52 54
             'proxy' => '186.103.169.165:8080',
53 55
         );*/
54 56
 
55
-        switch ($this->getMethod()) {
57
+        switch ($this->getMethod())
58
+        {
56 59
             case 'POST':
57 60
                 $result = Requests::post($url, $header, $this->payLoad);
58 61
                 break;
@@ -70,7 +73,8 @@  discard block
 block discarded – undo
70 73
                 $result = Requests::put($url, $header, $this->payLoad);
71 74
                 break;
72 75
         }
73
-        switch ($result->status_code) {
76
+        switch ($result->status_code)
77
+        {
74 78
             case 200:
75 79
                 $result = json_decode($result->body, true);
76 80
                 break;
@@ -125,10 +129,12 @@  discard block
 block discarded – undo
125 129
      */
126 130
     private function getSignHeaders()
127 131
     {
128
-			if($this->getAccessToken() == null) {
132
+			if($this->getAccessToken() == null)
133
+			{
129 134
 				$payload_accessToken = "";
130 135
 			}
131
-			else {
136
+			else
137
+			{
132 138
 				$payload_accessToken = $this->getAccessToken();
133 139
 			}
134 140
 			
Please login to merge, or discard this patch.