Completed
Push — master ( 4a8418...a8d532 )
by mains
03:04
created
error-pages/410.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,4 +66,4 @@
 block discarded – undo
66 66
 		</article>
67 67
 	</div>
68 68
 </div>
69
-<?php include(realpath(__DIR__ . '/..') . '/templates/footer.php');?>
70 69
\ No newline at end of file
70
+<?php include(realpath(__DIR__ . '/..') . '/templates/footer.php'); ?>
71 71
\ No newline at end of file
Please login to merge, or discard this patch.
index.php 3 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 	}
50 50
 	if(!isset($posts[0]))
51 51
 	{
52
-		error_log('Fehler: ' . print_r($posts, true) . print_r($posts['recent'], true) . print_r($posts['posts'], true));
52
+		error_log('Fehler: ' . print_r($posts, TRUE) . print_r($posts['recent'], TRUE) . print_r($posts['posts'], TRUE));
53 53
 		$title = $view->getTitle();
54 54
 		$description = $view->getMetaDescription();
55 55
 	}
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 				</article>
105 105
 			
106 106
 				<aside class="topSidebar col-sm-4 sidebar-outer">
107
-					<div class="fixed<?php if(!$view->isDetailedView) echo(' hide-mobile');?>">
107
+					<div class="fixed<?php if(!$view->isDetailedView) echo(' hide-mobile'); ?>">
108 108
 						<article>
109 109
 							<div>
110 110
 								<h2>Position / Hashtag</h2>
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 									if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) { ?>
142 142
 									<h2>Comment on Jodel</h2>
143 143
 									<form method="POST">				
144
-											<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']);?>" />
144
+											<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']); ?>" />
145 145
 											<textarea id="message" name="message" placeholder="Send a comment on a Jodel to all students within 10km" required></textarea> 
146 146
 										<br />
147 147
 										<input type="submit" value="SEND" /> 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 					</div>
204 204
 				</aside>
205 205
 			</div>
206
-			<?php include 'templates/nav-bottom.php';?>
206
+			<?php include 'templates/nav-bottom.php'; ?>
207 207
 		</div>
208 208
 		<?php
209 209
 			$includeEmojiAndAjax = TRUE;
Please login to merge, or discard this patch.
Braces   +21 added lines, -6 removed lines patch added patch discarded remove patch
@@ -96,7 +96,9 @@  discard block
 block discarded – undo
96 96
 							} ?>
97 97
 					</content>
98 98
 					
99
-					<?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails'])) { ?>
99
+					<?php if(!isset($_GET['postId']) && !isset($_GET['getPostDetails']))
100
+{
101
+?>
100 102
 						<p id="loading">
101 103
 							Loading…
102 104
 						</p>
@@ -104,12 +106,20 @@  discard block
 block discarded – undo
104 106
 				</article>
105 107
 			
106 108
 				<aside class="topSidebar col-sm-4 sidebar-outer">
107
-					<div class="fixed<?php if(!$view->isDetailedView) echo(' hide-mobile');?>">
109
+					<div class="fixed<?php if(!$view->isDetailedView)
110
+{
111
+	echo(' hide-mobile');
112
+}
113
+?>">
108 114
 						<article>
109 115
 							<div>
110 116
 								<h2>Position / Hashtag</h2>
111 117
 								<form action="index.php" method="get">
112
-									<input type="text" id="city" name="search" placeholder="<?php if(isset($newPositionStatus)) echo $newPositionStatus; ?>" required>
118
+									<input type="text" id="city" name="search" placeholder="<?php if(isset($newPositionStatus))
119
+{
120
+	echo $newPositionStatus;
121
+}
122
+?>" required>
113 123
 									<label>try: #jhj</label><br>
114 124
 									<input type="submit" value="Set Location" /> 
115 125
 								</form>
@@ -126,7 +136,7 @@  discard block
 block discarded – undo
126 136
 						<article>
127 137
 							<div>
128 138
 								<?php if(!$jodelAccountForView->isAccountVerified())
129
-								{
139
+{
130 140
 								?>
131 141
 								<h2>New Jodel</h2>
132 142
 								
@@ -138,7 +148,9 @@  discard block
 block discarded – undo
138 148
 								{
139 149
 
140 150
 
141
-									if(isset($_GET['postId']) && isset($_GET['getPostDetails'])) { ?>
151
+									if(isset($_GET['postId']) && isset($_GET['getPostDetails']))
152
+									{
153
+?>
142 154
 									<h2>Comment on Jodel</h2>
143 155
 									<form method="POST">				
144 156
 											<input type="hidden" name="ancestor" value="<?php echo htmlspecialchars($_GET['postId']);?>" />
@@ -146,7 +158,10 @@  discard block
 block discarded – undo
146 158
 										<br />
147 159
 										<input type="submit" value="SEND" /> 
148 160
 									</form>
149
-										<?php } else { ?>
161
+										<?php }
162
+else
163
+{
164
+?>
150 165
 									<h2>New Jodel</h2>
151 166
 									<form enctype="multipart/form-data" method="POST">
152 167
 										<textarea id="message" name="message" placeholder="Send a Jodel to all students within 10km" required></textarea> 
Please login to merge, or discard this patch.
php/CustomError.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -13,17 +13,17 @@
 block discarded – undo
13 13
 	public $varsToDump;
14 14
 
15 15
 	function __construct($msg = 'not Set', $varsToDump = 'not Set', $view = 'not Set', $actions = 'not Set', $accountId = 'not Set', $isVerified = 'not Set', $isTokenFresh = 'not Set', $page = 'not Set', $referrer = 'not Set')
16
-    {
17
-        $this->view = $view;
18
-        $this->actions = $actions;
19
-        $this->accountId = $accountId;
20
-        $this->isVerified = $isVerified;
21
-        $this->isTokenFresh = $isTokenFresh;
22
-        $this->page = $page;
23
-        $this->referrer = $referrer;
24
-        $this->msg = $msg;
25
-        $this->varsToDump = $varsToDump;
26
-    }
16
+	{
17
+		$this->view = $view;
18
+		$this->actions = $actions;
19
+		$this->accountId = $accountId;
20
+		$this->isVerified = $isVerified;
21
+		$this->isTokenFresh = $isTokenFresh;
22
+		$this->page = $page;
23
+		$this->referrer = $referrer;
24
+		$this->msg = $msg;
25
+		$this->varsToDump = $varsToDump;
26
+	}
27 27
 
28 28
 	function writeErrorToLog()
29 29
 	{
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 	public $varsToDump;
14 14
 
15 15
 	function __construct($msg = 'not Set', $varsToDump = 'not Set', $view = 'not Set', $actions = 'not Set', $accountId = 'not Set', $isVerified = 'not Set', $isTokenFresh = 'not Set', $page = 'not Set', $referrer = 'not Set')
16
-    {
16
+	{
17 17
         $this->view = $view;
18 18
         $this->actions = $actions;
19 19
         $this->accountId = $accountId;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 	{
30 30
 		error_log("=============================== ERROR ================================");
31 31
 		error_log("msg: " . $this->msg);
32
-		error_log("view: " . print_r($this->view, true));
32
+		error_log("view: " . print_r($this->view, TRUE));
33 33
 		error_log("actions: " . $this->actionsToString());
34 34
 		error_log("accountId: " . $this->accountId);
35 35
 		error_log("isVerified: " . $this->isVerified);
Please login to merge, or discard this patch.
php/View.php 4 patches
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,8 @@  discard block
 block discarded – undo
34 34
 	 * Compute HTML Code
35 35
 	 */
36 36
  	function jodelToHtml($post)
37
-    {   //ToDO
37
+ 	{
38
+//ToDO
38 39
         //Replace # with link
39 40
         //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text);
40 41
 
@@ -90,7 +91,8 @@  discard block
 block discarded – undo
90 91
 
91 92
                     echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">';
92 93
                 }
93
-                else {
94
+                else
95
+                {
94 96
                     echo str_replace('  ', ' &nbsp;', nl2br(htmlspecialchars($post['message'])));
95 97
                 }
96 98
                 ?>
@@ -116,15 +118,20 @@  discard block
 block discarded – undo
116 118
                                 <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s');?></span>
117 119
                             </span> 
118 120
                         </span>
119
-						<?php if(!$this->isDetailedView) {?>
121
+						<?php if(!$this->isDetailedView)
122
+{
123
+?>
120 124
                         <span class="comments">
121 125
                             <span data-tooltip="Comments">
122 126
                                 <a href="<?php echo $this->changePostId($post['post_id'])->toUrl();?>">
123 127
                                     <i class="fa fa-commenting-o"></i>
124 128
                                     <?php if(array_key_exists("child_count", $post))
125
-                                    {
129
+{
126 130
                                         echo $post["child_count"];
127
-                                    } else echo "0";
131
+                                    }
132
+                                    else {
133
+                                    	echo "0";
134
+                                    }
128 135
                                     ?>
129 136
                                 </a>
130 137
                             </span>
@@ -306,7 +313,7 @@  discard block
 block discarded – undo
306 313
             $data = $accountCreator->execute();
307 314
         }
308 315
     	if(array_key_exists('recent', $data) && array_key_exists(0, $data['recent']))
309
-        {
316
+    	{
310 317
             return $data['recent'];
311 318
         }
312 319
         else if(array_key_exists('posts', $data)&& array_key_exists(0, $data['posts']))
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -317,7 +317,7 @@
 block discarded – undo
317 317
         {
318 318
             if($this->lastPostId == '')
319 319
             {
320
-                error_log('Could not find Posts in: ' . $this->city . ' Error: ' . print_r($data, true));
320
+                error_log('Could not find Posts in: ' . $this->city . ' Error: ' . print_r($data, TRUE));
321 321
                 //error_log(print_r($data, true));
322 322
 
323 323
                 $notFound[0] = array(
Please login to merge, or discard this patch.
Indentation   +239 added lines, -239 removed lines patch added patch discarded remove patch
@@ -2,112 +2,112 @@  discard block
 block discarded – undo
2 2
 
3 3
 class View
4 4
 {
5
-    public $country;
6
-    public $city;
7
-    public $hashtag;
5
+	public $country;
6
+	public $city;
7
+	public $hashtag;
8 8
 	public $view;
9
-    public $postId;
10
-    public $isDetailedView;
11
-    public $baseUrl;
12
-    public $rights;
9
+	public $postId;
10
+	public $isDetailedView;
11
+	public $baseUrl;
12
+	public $rights;
13 13
 
14 14
 	public $lastPostId = '';
15 15
 
16
-    function __construct($baseUrl, $country, $city, $hashtag = '%23all', $view = 'time', $postId = '')
17
-    {
18
-        $this->baseUrl = $baseUrl;
19
-        $this->country = $country;
20
-        $this->city = $city;
21
-        $this->hashtag = urldecode($hashtag);
22
-        $this->view = $view;
23
-        $this->postId = $postId;
16
+	function __construct($baseUrl, $country, $city, $hashtag = '%23all', $view = 'time', $postId = '')
17
+	{
18
+		$this->baseUrl = $baseUrl;
19
+		$this->country = $country;
20
+		$this->city = $city;
21
+		$this->hashtag = urldecode($hashtag);
22
+		$this->view = $view;
23
+		$this->postId = $postId;
24 24
 
25
-        if(isUserAdmin())
26
-        {
27
-            $this->rights = 'admin';
28
-        }
29
-        else if(isUserVoter())
30
-        {
31
-            $this->rights = 'voter';
32
-        }
33
-        else
34
-        {
35
-            $this->rights = 'user';
36
-        }
25
+		if(isUserAdmin())
26
+		{
27
+			$this->rights = 'admin';
28
+		}
29
+		else if(isUserVoter())
30
+		{
31
+			$this->rights = 'voter';
32
+		}
33
+		else
34
+		{
35
+			$this->rights = 'user';
36
+		}
37 37
 
38
-        if($postId == '')
39
-        {
40
-            $this->isDetailedView = FALSE;
41
-        }
42
-        else
43
-        {
44
-            $this->isDetailedView = TRUE;
45
-        }
46
-    }
38
+		if($postId == '')
39
+		{
40
+			$this->isDetailedView = FALSE;
41
+		}
42
+		else
43
+		{
44
+			$this->isDetailedView = TRUE;
45
+		}
46
+	}
47 47
 	/**
48 48
 	 * Compute HTML Code
49 49
 	 */
50 50
  	function jodelToHtml($post)
51
-    {   //ToDO
52
-        //Replace # with link
53
-        //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text);
51
+	{   //ToDO
52
+		//Replace # with link
53
+		//preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text);
54 54
 
55
-        //Time to time difference
56
-        $now = new DateTime();
57
-        $d = new DateTime($post['created_at']);
58
-        $timediff = $now->diff($d);
55
+		//Time to time difference
56
+		$now = new DateTime();
57
+		$d = new DateTime($post['created_at']);
58
+		$timediff = $now->diff($d);
59 59
 
60
-        $timediff_inSeconds = (string)$timediff->format('%s');
61
-        $timediff_inMinutes = (string)$timediff->format('%i');
62
-        $timediff_inHours = (string)$timediff->format('%h');
63
-        $timediff_inDays = (string)$timediff->format('%d');
64
-        $timediff_inMonth = (string)$timediff->format('%m');
60
+		$timediff_inSeconds = (string)$timediff->format('%s');
61
+		$timediff_inMinutes = (string)$timediff->format('%i');
62
+		$timediff_inHours = (string)$timediff->format('%h');
63
+		$timediff_inDays = (string)$timediff->format('%d');
64
+		$timediff_inMonth = (string)$timediff->format('%m');
65 65
 
66
-        if($timediff_inMonth!=0)
67
-        {
68
-                $timediff = $timediff_inMonth . "m";
69
-        }
70
-        else
71
-        {
72
-            if($timediff_inDays!=0)
73
-            {
74
-                $timediff = $timediff_inDays . "d";
75
-            }
76
-            else
77
-            {
78
-                if($timediff_inHours!=0)
79
-                {
80
-                    $timediff = $timediff_inHours . "h";
81
-                }
82
-                else
83
-                {
84
-                    if($timediff_inMinutes!=0)
85
-                    {
86
-                        $timediff = $timediff_inMinutes . "m";
87
-                    }
88
-                    else
89
-                    {
90
-                        $timediff = $timediff_inSeconds . "s";
91
-                    }
92
-                }
93
-            }
94
-        }
66
+		if($timediff_inMonth!=0)
67
+		{
68
+				$timediff = $timediff_inMonth . "m";
69
+		}
70
+		else
71
+		{
72
+			if($timediff_inDays!=0)
73
+			{
74
+				$timediff = $timediff_inDays . "d";
75
+			}
76
+			else
77
+			{
78
+				if($timediff_inHours!=0)
79
+				{
80
+					$timediff = $timediff_inHours . "h";
81
+				}
82
+				else
83
+				{
84
+					if($timediff_inMinutes!=0)
85
+					{
86
+						$timediff = $timediff_inMinutes . "m";
87
+					}
88
+					else
89
+					{
90
+						$timediff = $timediff_inSeconds . "s";
91
+					}
92
+				}
93
+			}
94
+		}
95 95
 
96 96
 
97
-        ?>
97
+		?>
98 98
         <article id ="postId-<?php echo $post['post_id']; ?>" class="jodel" style="background-color: #<?php echo $post['color'];?>;">
99 99
             <content>
100 100
                 <?php 
101
-                if(isset($post['image_url']))
102
-                {
103
-                    $regexRest = '/[^\w$ .!?-]+/u';
101
+				if(isset($post['image_url']))
102
+				{
103
+					$regexRest = '/[^\w$ .!?-]+/u';
104 104
 
105
-                    echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">';
106
-                }
107
-                else {
108
-                    echo str_replace('  ', ' &nbsp;', nl2br(htmlspecialchars($post['message'])));
109
-                }
110
-                ?>
105
+					echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">';
106
+				}
107
+				else {
108
+					echo str_replace('  ', ' &nbsp;', nl2br(htmlspecialchars($post['message'])));
109
+				}
110
+				?>
111 111
             </content>
112 112
             <aside>                    
113 113
                 <button onclick="vote('<?php echo $post['post_id'];?>', 'up', this)">
@@ -136,10 +136,10 @@  discard block
 block discarded – undo
136 136
                                 <a href="<?php echo $this->changePostId($post['post_id'])->toUrl();?>">
137 137
                                     <i class="fa fa-commenting-o"></i>
138 138
                                     <?php if(array_key_exists("child_count", $post))
139
-                                    {
140
-                                        echo $post["child_count"];
141
-                                    } else echo "0";
142
-                                    ?>
139
+									{
140
+										echo $post["child_count"];
141
+									} else echo "0";
142
+									?>
143 143
                                 </a>
144 144
                             </span>
145 145
                             
@@ -159,30 +159,30 @@  discard block
 block discarded – undo
159 159
 						?>
160 160
                         <span class="distance">
161 161
                             <?php
162
-                                if($this->isDetailedView)
163
-                                {
164
-                                    if(isset($post['user_handle']) && $post['user_handle'] == 'OJ')
165
-                                    {
166
-                                        ?>
162
+								if($this->isDetailedView)
163
+								{
164
+									if(isset($post['user_handle']) && $post['user_handle'] == 'OJ')
165
+									{
166
+										?>
167 167
                                         <span data-tooltip="Author">
168 168
                                             <i class="fa fa-user-o"></i> OJ |
169 169
                                         </span>
170 170
                                         <?php 
171
-                                    }
172
-                                    else
173
-                                    {
174
-                                        //Is not parent Jodel in detailed View
175
-                                        if(!array_key_exists('child_count', $post))
176
-                                        {
177
-                                            ?>
171
+									}
172
+									else
173
+									{
174
+										//Is not parent Jodel in detailed View
175
+										if(!array_key_exists('child_count', $post))
176
+										{
177
+											?>
178 178
                                             <span data-tooltip="Author">
179 179
                                                 <i class="fa fa-user-o"></i> #<?php echo $post['user_handle'];?> |
180 180
                                             </span>
181 181
                                             <?php
182
-                                        }
183
-                                    }
184
-                                }
185
-                                ?>
182
+										}
183
+									}
184
+								}
185
+								?>
186 186
 
187 187
                             <span class="tip" data-tooltip="Distance">
188 188
                                 <i class="fa fa-map-marker"></i>
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             </footer>
196 196
         </article>
197 197
     <?php
198
-    }
198
+	}
199 199
 
200 200
 
201 201
 	/**
@@ -232,147 +232,147 @@  discard block
 block discarded – undo
232 232
 		return $description;
233 233
 	}
234 234
 
235
-    function toUrl($msg = '')
236
-    {
237
-        $url = $this->baseUrl . 'index.php?country=DE' .
238
-                            '&city=' . urlencode($this->city) .
239
-                            '&hashtag=' . urlencode($this->hashtag) . 
240
-                            '&view=' . $this->view;
241
-        if($this->postId != '')
242
-        {
243
-            $url .= '&postId=' . $this->postId . 
244
-                    '&getPostDetails=TRUE';
245
-        }
235
+	function toUrl($msg = '')
236
+	{
237
+		$url = $this->baseUrl . 'index.php?country=DE' .
238
+							'&city=' . urlencode($this->city) .
239
+							'&hashtag=' . urlencode($this->hashtag) . 
240
+							'&view=' . $this->view;
241
+		if($this->postId != '')
242
+		{
243
+			$url .= '&postId=' . $this->postId . 
244
+					'&getPostDetails=TRUE';
245
+		}
246 246
 
247
-        if($msg != '')
248
-        {
249
-            $url .= '&msg=' . urlencode($msg);
250
-        }
247
+		if($msg != '')
248
+		{
249
+			$url .= '&msg=' . urlencode($msg);
250
+		}
251 251
 
252
-        return $url;
253
-    }
252
+		return $url;
253
+	}
254 254
 
255
-    function changePostId($postId)
256
-    {
257
-        $tempView = clone $this;
258
-        $tempView->postId = $postId;
259
-        $tempView->isDetailedView = TRUE;
260
-        return $tempView;
261
-    }
255
+	function changePostId($postId)
256
+	{
257
+		$tempView = clone $this;
258
+		$tempView->postId = $postId;
259
+		$tempView->isDetailedView = TRUE;
260
+		return $tempView;
261
+	}
262 262
 
263
-    function back()
264
-    {
265
-        $tempView = clone $this;
266
-        $tempView->postId = '';
267
-        return $tempView;
268
-    }
263
+	function back()
264
+	{
265
+		$tempView = clone $this;
266
+		$tempView->postId = '';
267
+		return $tempView;
268
+	}
269 269
 
270
-    function changeView($view)
271
-    {
272
-        $tempView = clone $this;
273
-        $tempView->view = $view;
274
-        return $tempView;
275
-    }
270
+	function changeView($view)
271
+	{
272
+		$tempView = clone $this;
273
+		$tempView->view = $view;
274
+		return $tempView;
275
+	}
276 276
 
277 277
 	function getPosts($jodelAccount)
278 278
 	{
279
-        if($this->hashtag != '#all' && $this->hashtag != '' && $this->hashtag != NULL)
280
-        {
281
-            $accountCreator = new GetChannel();
282
-            $accountCreator->view = $this->view;
283
-            $accountCreator->setAccessToken($jodelAccount->accessToken);
284
-            $accountCreator->channel = $this->hashtag;
285
-            $accountCreator->lastPostId = $this->lastPostId;
286
-            $data = $accountCreator->execute();
287
-        }
288
-        else
289
-        {
290
-            if($this->lastPostId == '' && $this->view == 'combo')
291
-            {
292
-                $url = "/v3/posts/location/combo";
293
-            }
294
-            else
295
-            {
296
-                if($this->view == 'discussed')
297
-                {
298
-                    $url = "/v2/posts/location/discussed/";
299
-                }
300
-                else
301
-                {
302
-                    if($this->view == 'popular')
303
-                    {
304
-                        $url = "/v2/posts/location/popular/";
305
-                    }
306
-                    else
307
-                    {
308
-                        $url = "/v2/posts/location/";
309
-                    }
310
-                }
311
-            }
279
+		if($this->hashtag != '#all' && $this->hashtag != '' && $this->hashtag != NULL)
280
+		{
281
+			$accountCreator = new GetChannel();
282
+			$accountCreator->view = $this->view;
283
+			$accountCreator->setAccessToken($jodelAccount->accessToken);
284
+			$accountCreator->channel = $this->hashtag;
285
+			$accountCreator->lastPostId = $this->lastPostId;
286
+			$data = $accountCreator->execute();
287
+		}
288
+		else
289
+		{
290
+			if($this->lastPostId == '' && $this->view == 'combo')
291
+			{
292
+				$url = "/v3/posts/location/combo";
293
+			}
294
+			else
295
+			{
296
+				if($this->view == 'discussed')
297
+				{
298
+					$url = "/v2/posts/location/discussed/";
299
+				}
300
+				else
301
+				{
302
+					if($this->view == 'popular')
303
+					{
304
+						$url = "/v2/posts/location/popular/";
305
+					}
306
+					else
307
+					{
308
+						$url = "/v2/posts/location/";
309
+					}
310
+				}
311
+			}
312 312
 
313
-            $accountCreator = new GetPosts();
314
-            $accountCreator->setLastPostId($this->lastPostId);
315
-            $accountCreator->setAccessToken($jodelAccount->accessToken);
316
-            $accountCreator->setUrl($url);
317
-            $accountCreator->version = 'v3';
313
+			$accountCreator = new GetPosts();
314
+			$accountCreator->setLastPostId($this->lastPostId);
315
+			$accountCreator->setAccessToken($jodelAccount->accessToken);
316
+			$accountCreator->setUrl($url);
317
+			$accountCreator->version = 'v3';
318 318
 
319
-            $config = parse_ini_file('config/config.ini.php');
320
-            $location = new Location();
321
-            $location->setLat($config['default_lat']);
322
-            $location->setLng($config['default_lng']);
323
-            $location->setCityName($config['default_location']);
324
-            $accountCreator->location = $location;
325
-            $data = $accountCreator->execute();
326
-        }
327
-    	if(array_key_exists('recent', $data) && array_key_exists(0, $data['recent']))
328
-        {
329
-            return $data['recent'];
330
-        }
331
-        else if(array_key_exists('posts', $data)&& array_key_exists(0, $data['posts']))
332
-        {
333
-            return $data['posts'];
334
-        }
335
-        else
336
-        {
337
-            if($this->lastPostId == '')
338
-            {
339
-                error_log('Could not find Posts in: ' . $this->city . ' Error: ' . print_r($data, true));
340
-                //error_log(print_r($data, true));
319
+			$config = parse_ini_file('config/config.ini.php');
320
+			$location = new Location();
321
+			$location->setLat($config['default_lat']);
322
+			$location->setLng($config['default_lng']);
323
+			$location->setCityName($config['default_location']);
324
+			$accountCreator->location = $location;
325
+			$data = $accountCreator->execute();
326
+		}
327
+		if(array_key_exists('recent', $data) && array_key_exists(0, $data['recent']))
328
+		{
329
+			return $data['recent'];
330
+		}
331
+		else if(array_key_exists('posts', $data)&& array_key_exists(0, $data['posts']))
332
+		{
333
+			return $data['posts'];
334
+		}
335
+		else
336
+		{
337
+			if($this->lastPostId == '')
338
+			{
339
+				error_log('Could not find Posts in: ' . $this->city . ' Error: ' . print_r($data, true));
340
+				//error_log(print_r($data, true));
341 341
 
342
-                $notFound[0] = array(
343
-                    "post_id" => "0",
344
-                    "discovered_by" => 0,
345
-                    "message" => "No more Posts found",
346
-                    "created_at" => "2017-02-11T16:44:50.385Z",
347
-                    "updated_at" => "2017-02-11T16:44:50.385Z",
348
-                    "pin_count" => 0,
349
-                    "color" => "5682a3",
350
-                    "got_thanks" => FALSE,
351
-                    "post_own" => "friend",
352
-                    "discovered" => 0,
353
-                    "distance" => 9,
354
-                    "vote_count" => 0,
355
-                    "location" =>
356
-                    array("name" => "Berlin",
357
-                      "loc_coordinates" =>
358
-                      array(
359
-                        "lat" => 0,
360
-                        "lng" => 0
361
-                      ),
362
-                      "loc_accuracy" => 0,
363
-                      "country" => "",
364
-                      "city" => "",
365
-                    ),
366
-                    "tags" =>
367
-                    array(),
368
-                    "user_handle" => "0"
369
-                );
370
-                return $notFound;
371
-            }
372
-            else
373
-            {
374
-                return FALSE;
375
-            }
376
-        }
342
+				$notFound[0] = array(
343
+					"post_id" => "0",
344
+					"discovered_by" => 0,
345
+					"message" => "No more Posts found",
346
+					"created_at" => "2017-02-11T16:44:50.385Z",
347
+					"updated_at" => "2017-02-11T16:44:50.385Z",
348
+					"pin_count" => 0,
349
+					"color" => "5682a3",
350
+					"got_thanks" => FALSE,
351
+					"post_own" => "friend",
352
+					"discovered" => 0,
353
+					"distance" => 9,
354
+					"vote_count" => 0,
355
+					"location" =>
356
+					array("name" => "Berlin",
357
+					  "loc_coordinates" =>
358
+					  array(
359
+						"lat" => 0,
360
+						"lng" => 0
361
+					  ),
362
+					  "loc_accuracy" => 0,
363
+					  "country" => "",
364
+					  "city" => "",
365
+					),
366
+					"tags" =>
367
+					array(),
368
+					"user_handle" => "0"
369
+				);
370
+				return $notFound;
371
+			}
372
+			else
373
+			{
374
+				return FALSE;
375
+			}
376
+		}
377 377
 	}
378 378
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -63,25 +63,25 @@  discard block
 block discarded – undo
63 63
         $timediff_inDays = (string)$timediff->format('%d');
64 64
         $timediff_inMonth = (string)$timediff->format('%m');
65 65
 
66
-        if($timediff_inMonth!=0)
66
+        if($timediff_inMonth != 0)
67 67
         {
68 68
                 $timediff = $timediff_inMonth . "m";
69 69
         }
70 70
         else
71 71
         {
72
-            if($timediff_inDays!=0)
72
+            if($timediff_inDays != 0)
73 73
             {
74 74
                 $timediff = $timediff_inDays . "d";
75 75
             }
76 76
             else
77 77
             {
78
-                if($timediff_inHours!=0)
78
+                if($timediff_inHours != 0)
79 79
                 {
80 80
                     $timediff = $timediff_inHours . "h";
81 81
                 }
82 82
                 else
83 83
                 {
84
-                    if($timediff_inMinutes!=0)
84
+                    if($timediff_inMinutes != 0)
85 85
                     {
86 86
                         $timediff = $timediff_inMinutes . "m";
87 87
                     }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
 
97 97
         ?>
98
-        <article id ="postId-<?php echo $post['post_id']; ?>" class="jodel" style="background-color: #<?php echo $post['color'];?>;">
98
+        <article id ="postId-<?php echo $post['post_id']; ?>" class="jodel" style="background-color: #<?php echo $post['color']; ?>;">
99 99
             <content>
100 100
                 <?php 
101 101
                 if(isset($post['image_url']))
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
                 ?>
111 111
             </content>
112 112
             <aside>                    
113
-                <button onclick="vote('<?php echo $post['post_id'];?>', 'up', this)">
113
+                <button onclick="vote('<?php echo $post['post_id']; ?>', 'up', this)">
114 114
                     <i class="fa fa-angle-up fa-3x"></i>
115 115
                 </button>    
116
-                <br><span><?php echo $post["vote_count"];?></span><br>
116
+                <br><span><?php echo $post["vote_count"]; ?></span><br>
117 117
 
118
-                <button onclick="vote('<?php echo $post['post_id'];?>', 'down', this)">
118
+                <button onclick="vote('<?php echo $post['post_id']; ?>', 'down', this)">
119 119
                     <i class="fa fa-angle-down fa-3x"></i>
120 120
                 </button>
121 121
             </aside>
@@ -126,14 +126,14 @@  discard block
 block discarded – undo
126 126
                         <span class="time">
127 127
                             <span class="tip" data-tooltip="Time">
128 128
                                 <i class="fa fa-clock-o"></i>
129
-                                <?php echo $timediff;?>
130
-                                <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s');?></span>
129
+                                <?php echo $timediff; ?>
130
+                                <span class="tiptext"><?php echo $d->format('Y-m-d H:i:s'); ?></span>
131 131
                             </span> 
132 132
                         </span>
133 133
 						<?php if(!$this->isDetailedView) {?>
134 134
                         <span class="comments">
135 135
                             <span data-tooltip="Comments">
136
-                                <a href="<?php echo $this->changePostId($post['post_id'])->toUrl();?>">
136
+                                <a href="<?php echo $this->changePostId($post['post_id'])->toUrl(); ?>">
137 137
                                     <i class="fa fa-commenting-o"></i>
138 138
                                     <?php if(array_key_exists("child_count", $post))
139 139
                                     {
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
                                         {
177 177
                                             ?>
178 178
                                             <span data-tooltip="Author">
179
-                                                <i class="fa fa-user-o"></i> #<?php echo $post['user_handle'];?> |
179
+                                                <i class="fa fa-user-o"></i> #<?php echo $post['user_handle']; ?> |
180 180
                                             </span>
181 181
                                             <?php
182 182
                                         }
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 
187 187
                             <span class="tip" data-tooltip="Distance">
188 188
                                 <i class="fa fa-map-marker"></i>
189
-                                <?php echo $post['distance'];?> km
190
-                                <span class="tiptext"><?php echo $post['location']['name'];?></span>
189
+                                <?php echo $post['distance']; ?> km
190
+                                <span class="tiptext"><?php echo $post['location']['name']; ?></span>
191 191
                             </span>
192 192
                         </span>
193 193
                     
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 
227 227
 		if($post != '' && array_key_exists('message', $post) && $post['message'] != '' && $this->isDetailedView)
228 228
 		{
229
-			$description = 'On JodelBlue in ' . htmlspecialchars($this->city) .  ' with ' . htmlspecialchars($post['vote_count']) . ' Upvotes: ' . substr(htmlspecialchars($post['message']), 0, 130);
229
+			$description = 'On JodelBlue in ' . htmlspecialchars($this->city) . ' with ' . htmlspecialchars($post['vote_count']) . ' Upvotes: ' . substr(htmlspecialchars($post['message']), 0, 130);
230 230
 		}
231 231
 
232 232
 		return $description;
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
         {
329 329
             return $data['recent'];
330 330
         }
331
-        else if(array_key_exists('posts', $data)&& array_key_exists(0, $data['posts']))
331
+        else if(array_key_exists('posts', $data) && array_key_exists(0, $data['posts']))
332 332
         {
333 333
             return $data['posts'];
334 334
         }
Please login to merge, or discard this patch.
templates/captcha.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 ?>
6 6
 <div id="captchaWrapper">
7 7
 	<p>Check all images with Coons on it (Coons look like <img style="height: 1.0em; width: unset;" src="img/coon.png">).</p>
8
-	<img src="<?php echo $captcha['image_url'];?>">
8
+	<img src="<?php echo $captcha['image_url']; ?>">
9 9
 	<div class='captchaWrapper'>
10 10
 		<input id='box_0' type='checkbox'>
11 11
 		<input id='box_1' type='checkbox'>
@@ -17,5 +17,5 @@  discard block
 block discarded – undo
17 17
 		<input id='box_7' type='checkbox'>
18 18
 		<input id='box_8' type='checkbox'>
19 19
 	</div>
20
-	<button onClick="verifyAccount('<?php echo $captcha['key'];?>','<?php echo $jodelAccountForView->deviceUid?>')">Verify</button>
20
+	<button onClick="verifyAccount('<?php echo $captcha['key']; ?>','<?php echo $jodelAccountForView->deviceUid?>')">Verify</button>
21 21
 </div>
22 22
\ No newline at end of file
Please login to merge, or discard this patch.
vote-ajax.php 4 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@
 block discarded – undo
114 114
 	{
115 115
 		$response = array("success" => $success, "message" => $message, "captcha" => $captcha, "deviceUid" => $deviceUid);
116 116
 	}
117
-	else 
117
+	else
118 118
 	{
119 119
 		$response = array("success" => $success, "message" => $message);
120 120
 	}
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 
22 22
 if(!$userIsVoter && !$userIsAdmin)
23 23
 {
24
-	error_log($_SERVER['REMOTE_ADDR']  . ' used a wrong password on vote-ajax.php');
25
-	$response = array("message" => $_SERVER['REMOTE_ADDR']  . ' used a wrong password on vote-ajax.php',"success" => false);
24
+	error_log($_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php');
25
+	$response = array("message" => $_SERVER['REMOTE_ADDR'] . ' used a wrong password on vote-ajax.php', "success" => false);
26 26
 	echo json_encode($response);
27 27
 	die();
28 28
 }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 			}
142 142
 		}
143 143
 
144
-	if (isset($captcha))
144
+	if(isset($captcha))
145 145
 	{
146 146
 		$response = array("success" => $success, "message" => $message, "captcha" => $captcha, "deviceUid" => $deviceUid);
147 147
 	}
Please login to merge, or discard this patch.
Upper-Lower-Casing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 if(!$userIsVoter && !$userIsAdmin)
23 23
 {
24 24
 	error_log($_SERVER['REMOTE_ADDR']  . ' used a wrong password on vote-ajax.php');
25
-	$response = array("message" => $_SERVER['REMOTE_ADDR']  . ' used a wrong password on vote-ajax.php',"success" => false);
25
+	$response = array("message" => $_SERVER['REMOTE_ADDR']  . ' used a wrong password on vote-ajax.php',"success" => FALSE);
26 26
 	echo json_encode($response);
27 27
 	die();
28 28
 }
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 		if($remaining_votes <= 0)
40 40
 		{
41 41
 			$message = 'This voter account run out of votes. For more information please contact [email protected]';
42
-			$success = false;
42
+			$success = FALSE;
43 43
 
44 44
 			$response = array("success" => $success, "message" => $message);
45 45
 			echo json_encode($response);
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		
50 50
 
51 51
 	$message = "";
52
-	$success = true;
52
+	$success = TRUE;
53 53
 	$token = "";
54 54
 		if(isset($_POST['vote']) && isset($_POST['postId']))
55 55
 		{
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 						//$response = array("success" => $jodelAccount->verifyCaptcha());
119 119
 						//echo json_encode($response);
120 120
 						//die();
121
-					$success = false;
121
+					$success = FALSE;
122 122
 				}
123 123
 				else
124 124
 				{
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 					$result = $db->query("UPDATE users 
127 127
                                 SET remaining_votes='" . $remaining_votes . "'
128 128
                                 WHERE user_token='" . $_COOKIE['JodelVoterPassword'] . "'");
129
-					if($result === false)
129
+					if($result === FALSE)
130 130
 					{
131 131
                			error_log("Update remaining votes failed: (" . $db->errno . ") " . $db->error);
132 132
                		}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 			else
138 138
 			{
139 139
 				$message = 'There is no account available for this jodel. Please create at least one new account to vote this jodel.';
140
-				$success = false;
140
+				$success = FALSE;
141 141
 			}
142 142
 		}
143 143
 
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
 if(isset($_GET['postId']) && $_GET['vote'])
6 6
 {
7 7
 	header('Content-Type: application/json');
8
-    echo json_encode($jodelAccountForKarma->votePostId($_GET['postId'], $_GET['vote']));
9
-    die();
8
+	echo json_encode($jodelAccountForKarma->votePostId($_GET['postId'], $_GET['vote']));
9
+	die();
10 10
 }
11 11
 
12 12
 if(isset($_GET['solution']) && isset($_POST['deviceUid']))
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
                                 WHERE user_token='" . $_COOKIE['JodelVoterPassword'] . "'");
129 129
 					if($result === false)
130 130
 					{
131
-               			error_log("Update remaining votes failed: (" . $db->errno . ") " . $db->error);
132
-               		}
133
-               		$db->close();
131
+			   			error_log("Update remaining votes failed: (" . $db->errno . ") " . $db->error);
132
+			   		}
133
+			   		$db->close();
134 134
 					$jodelAccount->votePostId($_POST['postId'], $_POST['vote']);
135 135
 				}
136 136
 			}
Please login to merge, or discard this patch.
admin.php 4 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -44,17 +44,17 @@
 block discarded – undo
44 44
 {
45 45
 	//insert voter into db
46 46
 	$db = new DatabaseConnect();
47
-    $result = $db->query("INSERT INTO users (user_token, remaining_votes, device_uid, rights)
47
+	$result = $db->query("INSERT INTO users (user_token, remaining_votes, device_uid, rights)
48 48
                     VALUES ('" 	. $db->escape_string($_POST['user_token'])
49
-                    	. "','" . $db->escape_string($_POST['remaining_votes'])
50
-                    	. "','" . $db->escape_string($_POST['device_uid'])
51
-                    	. "','" . $db->escape_string($_POST['rights']) . "')");
49
+						. "','" . $db->escape_string($_POST['remaining_votes'])
50
+						. "','" . $db->escape_string($_POST['device_uid'])
51
+						. "','" . $db->escape_string($_POST['rights']) . "')");
52 52
     
53
-    if($result === false){
54
-            $error = db_error();
55
-            error_log($error);
56
-            error_log("Adding Voter failed: (" . $result->errno . ") " . $result->error);
57
-    } 
53
+	if($result === false){
54
+			$error = db_error();
55
+			error_log($error);
56
+			error_log("Adding Voter failed: (" . $result->errno . ") " . $result->error);
57
+	} 
58 58
 }
59 59
 
60 60
 //Vote
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@  discard block
 block discarded – undo
20 20
 
21 21
 if(isUserAdmin())
22 22
 {
23
-	$userIsAdmin = true;
24
-	$userIsVoter = true;
23
+	$userIsAdmin = TRUE;
24
+	$userIsVoter = TRUE;
25 25
 	$votesRemaining = 'Unlimited';
26 26
 }
27 27
 else if(isUserVoter())
28 28
 {
29
-	$userIsAdmin = false;
30
-	$userIsVoter = true;
29
+	$userIsAdmin = FALSE;
30
+	$userIsVoter = TRUE;
31 31
 
32 32
 	$result = $db->query("SELECT user_token, remaining_votes FROM users WHERE user_token = '" . $_COOKIE['JodelVoterPassword'] . "'");
33 33
 	if($result->num_rows > 0)
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                     	. "','" . $db->escape_string($_POST['device_uid'])
63 63
                     	. "','" . $db->escape_string($_POST['rights']) . "')");
64 64
     
65
-    if($result === false){
65
+    if($result === FALSE){
66 66
             $error = db_error();
67 67
             error_log($error);
68 68
             error_log("Adding Voter failed: (" . $result->errno . ") " . $result->error);
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@  discard block
 block discarded – undo
5 5
 
6 6
 if(isset($_GET['pw']))
7 7
 {
8
-	setcookie('JodelAdminPassword', $_GET['pw'], time()+60*60*24*365*10);
8
+	setcookie('JodelAdminPassword', $_GET['pw'], time() + 60 * 60 * 24 * 365 * 10);
9 9
 	error_log('admin password saved for [' . $_SERVER ['HTTP_USER_AGENT'] . ']');
10 10
 	header('Location: ' . $baseUrl . 'admin.php');
11 11
 	exit;
12 12
 }
13 13
 else if(isset($_GET['voterPw']))
14 14
 {
15
-	setcookie('JodelVoterPassword', $_GET['voterPw'], time()+60*60*24*365*10);
15
+	setcookie('JodelVoterPassword', $_GET['voterPw'], time() + 60 * 60 * 24 * 365 * 10);
16 16
 	error_log('voter password saved for [' . $_SERVER ['HTTP_USER_AGENT'] . ']');
17 17
 	header('Location: ' . $baseUrl);
18 18
 	exit;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 }
43 43
 else
44 44
 {
45
-	error_log($_SERVER['REMOTE_ADDR']  . ' used a wrong voterPw / pw on admin.php');
45
+	error_log($_SERVER['REMOTE_ADDR'] . ' used a wrong voterPw / pw on admin.php');
46 46
 	die();
47 47
 }
48 48
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                     	. "','" . $db->escape_string($_POST['device_uid'])
63 63
                     	. "','" . $db->escape_string($_POST['rights']) . "')");
64 64
     
65
-    if($result === false){
65
+    if($result === false) {
66 66
             $error = db_error();
67 67
             error_log($error);
68 68
             error_log("Adding Voter failed: (" . $result->errno . ") " . $result->error);
@@ -110,42 +110,42 @@  discard block
 block discarded – undo
110 110
 		<meta name="keywords" content="jodelblue, jodel, blue, webclient, web, client">
111 111
 		
112 112
 		<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" integrity="sha384-AysaV+vQoT3kOAXZkl02PThvDr8HYKPZhNT5h/CXfBThSRXQ6jW5DO2ekP5ViFdi" crossorigin="anonymous">
113
-				<link rel="stylesheet" href="<?php echo $baseUrl;?>css/font-awesome.min.css">
114
-		<link rel="stylesheet" href="<?php echo $baseUrl;?>style.css" type="text/css">
113
+				<link rel="stylesheet" href="<?php echo $baseUrl; ?>css/font-awesome.min.css">
114
+		<link rel="stylesheet" href="<?php echo $baseUrl; ?>style.css" type="text/css">
115 115
 		
116
-		<link rel="shortcut icon" type="image/x-icon" href="<?php echo $baseUrl;?>img/favicon/favicon.ico">
117
-		<link rel="icon" type="image/x-icon" href="<?php echo $baseUrl;?>img/favicon/favicon.ico">
118
-		<link rel="icon" type="image/gif" href="<?php echo $baseUrl;?>img/favicon/favicon.gif">
119
-		<link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon.png">
120
-		<link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon.png">
121
-		<link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-57x57.png" sizes="57x57">
122
-		<link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-60x60.png" sizes="60x60">
123
-		<link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-72x72.png" sizes="72x72">
124
-		<link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-76x76.png" sizes="76x76">
125
-		<link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-114x114.png" sizes="114x114">
126
-		<link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-120x120.png" sizes="120x120">
127
-		<link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-128x128.png" sizes="128x128">
128
-		<link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-144x144.png" sizes="144x144">
129
-		<link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-152x152.png" sizes="152x152">
130
-		<link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-180x180.png" sizes="180x180">
131
-		<link rel="apple-touch-icon" href="<?php echo $baseUrl;?>img/favicon/apple-touch-icon-precomposed.png">
132
-		<link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-16x16.png" sizes="16x16">
133
-		<link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-32x32.png" sizes="32x32">
134
-		<link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-96x96.png" sizes="96x96">
135
-		<link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-160x160.png" sizes="160x160">
136
-		<link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-192x192.png" sizes="192x192">
137
-		<link rel="icon" type="image/png" href="<?php echo $baseUrl;?>img/favicon/favicon-196x196.png" sizes="196x196">
138
-		<meta name="msapplication-TileImage" content="<?php echo $baseUrl;?>img/favicon/win8-tile-144x144.png"> 
116
+		<link rel="shortcut icon" type="image/x-icon" href="<?php echo $baseUrl; ?>img/favicon/favicon.ico">
117
+		<link rel="icon" type="image/x-icon" href="<?php echo $baseUrl; ?>img/favicon/favicon.ico">
118
+		<link rel="icon" type="image/gif" href="<?php echo $baseUrl; ?>img/favicon/favicon.gif">
119
+		<link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon.png">
120
+		<link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon.png">
121
+		<link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-57x57.png" sizes="57x57">
122
+		<link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-60x60.png" sizes="60x60">
123
+		<link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-72x72.png" sizes="72x72">
124
+		<link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-76x76.png" sizes="76x76">
125
+		<link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-114x114.png" sizes="114x114">
126
+		<link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-120x120.png" sizes="120x120">
127
+		<link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-128x128.png" sizes="128x128">
128
+		<link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-144x144.png" sizes="144x144">
129
+		<link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-152x152.png" sizes="152x152">
130
+		<link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-180x180.png" sizes="180x180">
131
+		<link rel="apple-touch-icon" href="<?php echo $baseUrl; ?>img/favicon/apple-touch-icon-precomposed.png">
132
+		<link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-16x16.png" sizes="16x16">
133
+		<link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-32x32.png" sizes="32x32">
134
+		<link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-96x96.png" sizes="96x96">
135
+		<link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-160x160.png" sizes="160x160">
136
+		<link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-192x192.png" sizes="192x192">
137
+		<link rel="icon" type="image/png" href="<?php echo $baseUrl; ?>img/favicon/favicon-196x196.png" sizes="196x196">
138
+		<meta name="msapplication-TileImage" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-144x144.png"> 
139 139
 		<meta name="msapplication-TileColor" content="#5682a3"> 
140 140
 		<meta name="msapplication-navbutton-color" content="#5682a3"> 
141 141
 		<meta name="application-name" content="JodelBlue"/> 
142 142
 		<meta name="msapplication-tooltip" content="JodelBlue"/> 
143 143
 		<meta name="apple-mobile-web-app-title" content="JodelBlue"/> 
144
-		<meta name="msapplication-square70x70logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-70x70.png"> 
145
-		<meta name="msapplication-square144x144logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-144x144.png"> 
146
-		<meta name="msapplication-square150x150logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-150x150.png"> 
147
-		<meta name="msapplication-wide310x150logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-310x150.png"> 
148
-		<meta name="msapplication-square310x310logo" content="<?php echo $baseUrl;?>img/favicon/win8-tile-310x310.png"> 
144
+		<meta name="msapplication-square70x70logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-70x70.png"> 
145
+		<meta name="msapplication-square144x144logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-144x144.png"> 
146
+		<meta name="msapplication-square150x150logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-150x150.png"> 
147
+		<meta name="msapplication-wide310x150logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-310x150.png"> 
148
+		<meta name="msapplication-square310x310logo" content="<?php echo $baseUrl; ?>img/favicon/win8-tile-310x310.png"> 
149 149
 	</head>
150 150
 	
151 151
 	<body>
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 						?>
218 218
 							<div class="row">								
219 219
 								<div class="col-12 col-sm-12">
220
-								<h2>Voting (<?php echo $votesRemaining;?> votes remaining)</h2>
220
+								<h2>Voting (<?php echo $votesRemaining; ?> votes remaining)</h2>
221 221
 									<form>
222 222
 										<div class="form-group">
223 223
 											<label for="quantityDelay">Quantity</label>
@@ -226,20 +226,20 @@  discard block
 block discarded – undo
226 226
 										<div class="form-group">
227 227
 											<label for="minDelay">Minimum delay</label>
228 228
 											<div class="input-group">
229
-												<input placeholder="min interval" class="form-control" id="minDelay" value="<?php echo $config['minInterval'];?>" type="number" name="min">
229
+												<input placeholder="min interval" class="form-control" id="minDelay" value="<?php echo $config['minInterval']; ?>" type="number" name="min">
230 230
 												<span class="input-group-addon">seconds</span>
231 231
 											</div>
232 232
 										</div>
233 233
 										<div class="form-group">
234 234
 											<label for="maxDelay">Maximum delay</label>
235 235
 											<div class="input-group">
236
-												<input placeholder="max interval" class="form-control" id="maxDelay" value="<?php echo $config['maxInterval'];?>" type="number" name="max">
236
+												<input placeholder="max interval" class="form-control" id="maxDelay" value="<?php echo $config['maxInterval']; ?>" type="number" name="max">
237 237
 												<span class="input-group-addon">seconds</span>
238 238
 											</div>
239 239
 										</div>
240 240
 										<div class="form-group">
241 241
 											<label for="postIdDelay">Post Id</label>
242
-											<input placeholder="postId" class="form-control" id="postIdDelay" value="<?php if(isset($_GET['postId'])) echo $_GET['postId'];?>" type="text" name="postId">
242
+											<input placeholder="postId" class="form-control" id="postIdDelay" value="<?php if(isset($_GET['postId'])) echo $_GET['postId']; ?>" type="text" name="postId">
243 243
 										</div>
244 244
 										<div class="row">
245 245
 											<div class="col-6 col-xs-6"><button type="button" name="vote" value="up" class="half" onclick="voteWithAjax('up');">Upvote</button></div>
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			  crossorigin="anonymous"></script>
266 266
 	    <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
267 267
 	    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
268
-	    <script src="<?php echo $baseUrl;?>js/jQueryEmoji.js"></script>
268
+	    <script src="<?php echo $baseUrl; ?>js/jQueryEmoji.js"></script>
269 269
 	    <script src="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.1.1/ekko-lightbox.min.js" integrity="sha256-1odJPEl+KoMUaA1T7QNMGSSU/r5LCKCRC6SL8P0r2gY=" crossorigin="anonymous"></script>
270 270
 
271 271
 		<script>
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 			{
310 310
 				$.ajax({
311 311
 				  type: "POST",
312
-				  url: "<?php echo $baseUrl;?>vote-ajax.php",
312
+				  url: "<?php echo $baseUrl; ?>vote-ajax.php",
313 313
 				  data: {"vote" : data["vote"],
314 314
 						 "postId" : data["id"]},
315 315
 				  success: function(result){
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 				console.log(solution);
364 364
 				$.ajax({
365 365
 				  type: "POST",
366
-				  url: "<?php echo $baseUrl;?>vote-ajax.php?solution=" + solution + "&key="+key,
366
+				  url: "<?php echo $baseUrl; ?>vote-ajax.php?solution=" + solution + "&key="+key,
367 367
 				  data: {"deviceUid" : deviceUid},
368 368
 				  success: function(result){
369 369
 					  var response = JSON.parse(result);
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -62,7 +62,8 @@  discard block
 block discarded – undo
62 62
                     	. "','" . $db->escape_string($_POST['device_uid'])
63 63
                     	. "','" . $db->escape_string($_POST['rights']) . "')");
64 64
     
65
-    if($result === false){
65
+    if($result === false)
66
+    {
66 67
             $error = db_error();
67 68
             error_log($error);
68 69
             error_log("Adding Voter failed: (" . $result->errno . ") " . $result->error);
@@ -165,7 +166,9 @@  discard block
 block discarded – undo
165 166
 			<div class="row">
166 167
 				<article class="topContent col-12 col-sm-12">
167 168
 					<content id="posts" class="adminpanel">
168
-						<?php if($userIsAdmin) { ?>
169
+						<?php if($userIsAdmin)
170
+{
171
+?>
169 172
 							<div class="row">
170 173
 								<div class="col-md-12">
171 174
 									<h2>Account management</h2>
@@ -213,7 +216,8 @@  discard block
 block discarded – undo
213 216
 						<?php
214 217
 						}
215 218
 
216
-						if($userIsVoter) {
219
+						if($userIsVoter)
220
+						{
217 221
 						?>
218 222
 							<div class="row">								
219 223
 								<div class="col-12 col-sm-12">
@@ -239,7 +243,11 @@  discard block
 block discarded – undo
239 243
 										</div>
240 244
 										<div class="form-group">
241 245
 											<label for="postIdDelay">Post Id</label>
242
-											<input placeholder="postId" class="form-control" id="postIdDelay" value="<?php if(isset($_GET['postId'])) echo $_GET['postId'];?>" type="text" name="postId">
246
+											<input placeholder="postId" class="form-control" id="postIdDelay" value="<?php if(isset($_GET['postId']))
247
+{
248
+	echo $_GET['postId'];
249
+}
250
+?>" type="text" name="postId">
243 251
 										</div>
244 252
 										<div class="row">
245 253
 											<div class="col-6 col-xs-6"><button type="button" name="vote" value="up" class="half" onclick="voteWithAjax('up');">Upvote</button></div>
Please login to merge, or discard this patch.
php/Requests/AbstractRequest.php 4 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         $header = $this->getSignHeaders();
30 30
         $url = $this->getFullUrl();
31 31
 
32
-        if ($this->getAccessToken()) {
32
+        if($this->getAccessToken()) {
33 33
             $header['Authorization'] = "Bearer " . $this->getAccessToken();
34 34
         }
35 35
         //Comment out to debug the Request:
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             'proxy' => '186.103.169.165:8080',
53 53
         );*/
54 54
 
55
-        switch ($this->getMethod()) {
55
+        switch($this->getMethod()) {
56 56
             case 'POST':
57 57
                 $result = Requests::post($url, $header, $this->payLoad);
58 58
                 break;
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
         http_response_code($result->status_code);
75 75
 
76
-        switch ($result->status_code) {
76
+        switch($result->status_code) {
77 77
             case 200:
78 78
                 $result = json_decode($result->body, true);
79 79
                 break;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
             case 502:
117 117
                 error_log('Error 502 - ' . print_r($result, true));
118 118
                 $result = json_decode($result->body, true);
119
-                header('location:'.$_SERVER['PHP_SELF']);
119
+                header('location:' . $_SERVER['PHP_SELF']);
120 120
                 break;
121 121
             case 503:
122 122
                 error_log('Error 503 - ' . print_r($result, true));
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
 
125 125
                 if(array_key_exists('error', $result) && $result['error'] == 'Service Unavailable')
126 126
                 {
127
-                    header('location:'.$_SERVER['PHP_SELF']); 
127
+                    header('location:' . $_SERVER['PHP_SELF']); 
128 128
                 }
129 129
                 break;
130 130
             default:
131
-                error_log('Error '.$result->status_code.' - unknown error');
131
+                error_log('Error ' . $result->status_code . ' - unknown error');
132 132
                 $result = json_decode($result->body, true);
133 133
         }
134 134
 
Please login to merge, or discard this patch.
Indentation   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -2,21 +2,21 @@  discard block
 block discarded – undo
2 2
 
3 3
 abstract class AbstractRequest
4 4
 {	
5
-    const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26';
6
-    const APIURL = 'https://api.go-tellm.com/api';
7
-    const SECRET = 'cYjTAwjdJyiuXAyrMhkCDiVZhshhLhotNotLiPVu';
8
-    const USERAGENT = 'Jodel/4.35.6 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )';
9
-    const CLIENT_TYPE = 'android_4.35.6';
5
+	const CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26';
6
+	const APIURL = 'https://api.go-tellm.com/api';
7
+	const SECRET = 'cYjTAwjdJyiuXAyrMhkCDiVZhshhLhotNotLiPVu';
8
+	const USERAGENT = 'Jodel/4.35.6 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )';
9
+	const CLIENT_TYPE = 'android_4.35.6';
10 10
     
11
-    private $accessToken = null;
12
-    private $payLoad;
13
-    public $expects = '';
14
-    public $version = 'v2';
15
-    public $hasPayload = FALSE;
11
+	private $accessToken = null;
12
+	private $payLoad;
13
+	public $expects = '';
14
+	public $version = 'v2';
15
+	public $hasPayload = FALSE;
16 16
 
17
-    public function execute()
18
-    {
19
-        $result = new \stdClass();
17
+	public function execute()
18
+	{
19
+		$result = new \stdClass();
20 20
 		        
21 21
 		$this->payLoad = $this->getPayload();
22 22
 		$device_uid = '';
@@ -25,16 +25,16 @@  discard block
 block discarded – undo
25 25
 		}
26 26
 				
27 27
 				
28
-        $this->payLoad = json_encode($this->payLoad);
29
-        $header = $this->getSignHeaders();
30
-        $url = $this->getFullUrl();
28
+		$this->payLoad = json_encode($this->payLoad);
29
+		$header = $this->getSignHeaders();
30
+		$url = $this->getFullUrl();
31 31
 
32
-        if ($this->getAccessToken()) {
33
-            $header['Authorization'] = "Bearer " . $this->getAccessToken();
34
-        }
35
-        //Comment out to debug the Request:
32
+		if ($this->getAccessToken()) {
33
+			$header['Authorization'] = "Bearer " . $this->getAccessToken();
34
+		}
35
+		//Comment out to debug the Request:
36 36
 
37
-        /*
37
+		/*
38 38
         printf("URL: ");
39 39
         var_dump($url);
40 40
         echo "<br />";
@@ -45,112 +45,112 @@  discard block
 block discarded – undo
45 45
         var_dump($this->payLoad);
46 46
         echo "<br />";
47 47
         */
48
-        /*
48
+		/*
49 49
         $options = array(
50 50
             'timeout' => 100,
51 51
             'connect_timeout' => 100,
52 52
             'proxy' => '186.103.169.165:8080',
53 53
         );*/
54 54
 
55
-        switch ($this->getMethod()) {
56
-            case 'POST':
57
-                $result = Requests::post($url, $header, $this->payLoad);
58
-                break;
59
-            case 'GET':
60
-                if($this->hasPayload)
61
-                {
62
-                    $result = Requests::get($url, $header, $this->payLoad);
63
-                }
64
-                else
65
-                {
66
-                    $result = Requests::get($url, $header);
67
-                }
68
-                break;
69
-            case 'PUT':
70
-                $result = Requests::put($url, $header, $this->payLoad);
71
-                break;
72
-        }
55
+		switch ($this->getMethod()) {
56
+			case 'POST':
57
+				$result = Requests::post($url, $header, $this->payLoad);
58
+				break;
59
+			case 'GET':
60
+				if($this->hasPayload)
61
+				{
62
+					$result = Requests::get($url, $header, $this->payLoad);
63
+				}
64
+				else
65
+				{
66
+					$result = Requests::get($url, $header);
67
+				}
68
+				break;
69
+			case 'PUT':
70
+				$result = Requests::put($url, $header, $this->payLoad);
71
+				break;
72
+		}
73 73
 
74
-        http_response_code($result->status_code);
74
+		http_response_code($result->status_code);
75 75
 
76
-        switch ($result->status_code) {
77
-            case 200:
78
-                $result = json_decode($result->body, true);
79
-                break;
80
-            case 204:
81
-                $result = 'Success';
82
-                http_response_code(200);
83
-                break;
84
-            case 400:
85
-                $result = json_decode($result->body, true);
86
-                error_log('Error 400 - ' . print_r($result, true));
87
-                break;
88
-            case 401:
89
-                $result = json_decode($result->body, true);
76
+		switch ($result->status_code) {
77
+			case 200:
78
+				$result = json_decode($result->body, true);
79
+				break;
80
+			case 204:
81
+				$result = 'Success';
82
+				http_response_code(200);
83
+				break;
84
+			case 400:
85
+				$result = json_decode($result->body, true);
86
+				error_log('Error 400 - ' . print_r($result, true));
87
+				break;
88
+			case 401:
89
+				$result = json_decode($result->body, true);
90 90
 
91
-                if(array_key_exists('error', $result) && $result['error'] == 'length')
92
-                {
91
+				if(array_key_exists('error', $result) && $result['error'] == 'length')
92
+				{
93 93
 
94
-                }
95
-                else
96
-                {
97
-                    error_log('Error 401 - ' . print_r($result, true));
98
-                }
99
-                break;
100
-            case 404:
101
-                error_log('Error 404 - ' . print_r($result, true));
102
-                $result = json_decode($result->body, true);
103
-                break;
94
+				}
95
+				else
96
+				{
97
+					error_log('Error 401 - ' . print_r($result, true));
98
+				}
99
+				break;
100
+			case 404:
101
+				error_log('Error 404 - ' . print_r($result, true));
102
+				$result = json_decode($result->body, true);
103
+				break;
104 104
 			case 477:
105
-                $result = json_decode($result->body, true);
106
-                error_log('Error 477 - ' . print_r($result, true));
107
-                break;
108
-            case 429:
109
-                error_log('Error 429 - Too Many Requests' . print_r(json_decode($result->body, true), true));
110
-            	exit("Error 429: Too Many Requests");
111
-            	break;
112
-            case 403:
113
-                error_log('Error 403 - Access denied:' . print_r(json_decode($result->body, true), true));
114
-                $result = json_decode($result->body, true);
115
-                break;
116
-            case 502:
117
-                error_log('Error 502 - ' . print_r($result, true));
118
-                $result = json_decode($result->body, true);
119
-                header('location:'.$_SERVER['PHP_SELF']);
120
-                break;
121
-            case 503:
122
-                error_log('Error 503 - ' . print_r($result, true));
123
-                $result = json_decode($result->body, true);
105
+				$result = json_decode($result->body, true);
106
+				error_log('Error 477 - ' . print_r($result, true));
107
+				break;
108
+			case 429:
109
+				error_log('Error 429 - Too Many Requests' . print_r(json_decode($result->body, true), true));
110
+				exit("Error 429: Too Many Requests");
111
+				break;
112
+			case 403:
113
+				error_log('Error 403 - Access denied:' . print_r(json_decode($result->body, true), true));
114
+				$result = json_decode($result->body, true);
115
+				break;
116
+			case 502:
117
+				error_log('Error 502 - ' . print_r($result, true));
118
+				$result = json_decode($result->body, true);
119
+				header('location:'.$_SERVER['PHP_SELF']);
120
+				break;
121
+			case 503:
122
+				error_log('Error 503 - ' . print_r($result, true));
123
+				$result = json_decode($result->body, true);
124 124
 
125
-                if(array_key_exists('error', $result) && $result['error'] == 'Service Unavailable')
126
-                {
127
-                    header('location:'.$_SERVER['PHP_SELF']); 
128
-                }
129
-                break;
130
-            default:
131
-                error_log('Error '.$result->status_code.' - unknown error');
132
-                $result = json_decode($result->body, true);
133
-        }
125
+				if(array_key_exists('error', $result) && $result['error'] == 'Service Unavailable')
126
+				{
127
+					header('location:'.$_SERVER['PHP_SELF']); 
128
+				}
129
+				break;
130
+			default:
131
+				error_log('Error '.$result->status_code.' - unknown error');
132
+				$result = json_decode($result->body, true);
133
+		}
134 134
 
135
-        //important for account refresh
136
-        if($device_uid != '')
137
-        {
135
+		//important for account refresh
136
+		if($device_uid != '')
137
+		{
138 138
 			$result[0] = $result;
139 139
 			$result[1] = $device_uid;
140
-        }
140
+		}
141 141
 
142 142
         
143
-        /* var_dump($result); */
143
+		/* var_dump($result); */
144 144
         
145
-        return $result;
146
-    }
147
-    abstract function getPayload();
148
-    /**
149
-     * Gets Sign headers
150
-     * @return array headers
151
-     */
152
-    private function getSignHeaders()
153
-    {
145
+		return $result;
146
+	}
147
+	abstract function getPayload();
148
+	/**
149
+	 * Gets Sign headers
150
+	 * @return array headers
151
+	 */
152
+	private function getSignHeaders()
153
+	{
154 154
 			if($this->getAccessToken() == null) {
155 155
 				$payload_accessToken = "";
156 156
 			}
@@ -159,54 +159,54 @@  discard block
 block discarded – undo
159 159
 			}
160 160
 			
161 161
 			
162
-        $headers = array(
163
-            "Connection" => "keep-alive",
164
-            "Accept-Encoding" => "gzip",
165
-            "Content-Type" => "application/json; charset=UTF-8",
166
-            "User-Agent" => self::USERAGENT
167
-        );
168
-        $timestamp = new DateTime();
169
-        $timestamp = $timestamp->format(DateTime::ATOM);
170
-        $timestamp = substr($timestamp, 0, -6);
171
-        $timestamp .= "Z";
172
-        $urlParts = parse_url($this->getFullUrl());
173
-        $url2 = "";
174
-        $req = [$this->getMethod(),
175
-            $urlParts['host'],
176
-            "443",
177
-            $urlParts['path'],
178
-            $payload_accessToken,
179
-            $timestamp,
180
-            $url2,
181
-            $this->payLoad];
182
-        $reqString = implode("%", $req);
183
-        $secret = self::SECRET;
184
-        $signature = hash_hmac('sha1', $reqString, $secret);
185
-        $signature = strtoupper($signature);
186
-        $headers['X-Authorization'] = 'HMAC ' . $signature;
187
-        $headers['X-Client-Type'] = self::CLIENT_TYPE;
188
-        $headers['X-Timestamp'] = $timestamp;
189
-        $headers['X-Api-Version'] = '0.2';
190
-        return $headers;
191
-    }
192
-    private function getFullUrl()
193
-    {
194
-        return self::APIURL . $this->getApiEndPoint();
195
-    }
196
-    abstract function getApiEndPoint();
197
-    abstract function getMethod();
198
-    /**
199
-     * @return string
200
-     */
201
-    private function getAccessToken()
202
-    {
203
-        return $this->accessToken;
204
-    }
205
-    /**
206
-     * @param string $accessToken
207
-     */
208
-    public function setAccessToken($accessToken)
209
-    {
210
-        $this->accessToken = $accessToken;
211
-    }
162
+		$headers = array(
163
+			"Connection" => "keep-alive",
164
+			"Accept-Encoding" => "gzip",
165
+			"Content-Type" => "application/json; charset=UTF-8",
166
+			"User-Agent" => self::USERAGENT
167
+		);
168
+		$timestamp = new DateTime();
169
+		$timestamp = $timestamp->format(DateTime::ATOM);
170
+		$timestamp = substr($timestamp, 0, -6);
171
+		$timestamp .= "Z";
172
+		$urlParts = parse_url($this->getFullUrl());
173
+		$url2 = "";
174
+		$req = [$this->getMethod(),
175
+			$urlParts['host'],
176
+			"443",
177
+			$urlParts['path'],
178
+			$payload_accessToken,
179
+			$timestamp,
180
+			$url2,
181
+			$this->payLoad];
182
+		$reqString = implode("%", $req);
183
+		$secret = self::SECRET;
184
+		$signature = hash_hmac('sha1', $reqString, $secret);
185
+		$signature = strtoupper($signature);
186
+		$headers['X-Authorization'] = 'HMAC ' . $signature;
187
+		$headers['X-Client-Type'] = self::CLIENT_TYPE;
188
+		$headers['X-Timestamp'] = $timestamp;
189
+		$headers['X-Api-Version'] = '0.2';
190
+		return $headers;
191
+	}
192
+	private function getFullUrl()
193
+	{
194
+		return self::APIURL . $this->getApiEndPoint();
195
+	}
196
+	abstract function getApiEndPoint();
197
+	abstract function getMethod();
198
+	/**
199
+	 * @return string
200
+	 */
201
+	private function getAccessToken()
202
+	{
203
+		return $this->accessToken;
204
+	}
205
+	/**
206
+	 * @param string $accessToken
207
+	 */
208
+	public function setAccessToken($accessToken)
209
+	{
210
+		$this->accessToken = $accessToken;
211
+	}
212 212
 }
Please login to merge, or discard this 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 = 'cYjTAwjdJyiuXAyrMhkCDiVZhshhLhotNotLiPVu';
@@ -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;
@@ -73,7 +76,8 @@  discard block
 block discarded – undo
73 76
 
74 77
         http_response_code($result->status_code);
75 78
 
76
-        switch ($result->status_code) {
79
+        switch ($result->status_code)
80
+        {
77 81
             case 200:
78 82
                 $result = json_decode($result->body, true);
79 83
                 break;
@@ -151,10 +155,12 @@  discard block
 block discarded – undo
151 155
      */
152 156
     private function getSignHeaders()
153 157
     {
154
-			if($this->getAccessToken() == null) {
158
+			if($this->getAccessToken() == null)
159
+			{
155 160
 				$payload_accessToken = "";
156 161
 			}
157
-			else {
162
+			else
163
+			{
158 164
 				$payload_accessToken = $this->getAccessToken();
159 165
 			}
160 166
 			
Please login to merge, or discard this patch.
Upper-Lower-Casing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
     const USERAGENT = 'Jodel/4.35.6 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )';
9 9
     const CLIENT_TYPE = 'android_4.35.6';
10 10
     
11
-    private $accessToken = null;
11
+    private $accessToken = NULL;
12 12
     private $payLoad;
13 13
     public $expects = '';
14 14
     public $version = 'v2';
@@ -75,18 +75,18 @@  discard block
 block discarded – undo
75 75
 
76 76
         switch ($result->status_code) {
77 77
             case 200:
78
-                $result = json_decode($result->body, true);
78
+                $result = json_decode($result->body, TRUE);
79 79
                 break;
80 80
             case 204:
81 81
                 $result = 'Success';
82 82
                 http_response_code(200);
83 83
                 break;
84 84
             case 400:
85
-                $result = json_decode($result->body, true);
86
-                error_log('Error 400 - ' . print_r($result, true));
85
+                $result = json_decode($result->body, TRUE);
86
+                error_log('Error 400 - ' . print_r($result, TRUE));
87 87
                 break;
88 88
             case 401:
89
-                $result = json_decode($result->body, true);
89
+                $result = json_decode($result->body, TRUE);
90 90
 
91 91
                 if(array_key_exists('error', $result) && $result['error'] == 'length')
92 92
                 {
@@ -94,33 +94,33 @@  discard block
 block discarded – undo
94 94
                 }
95 95
                 else
96 96
                 {
97
-                    error_log('Error 401 - ' . print_r($result, true));
97
+                    error_log('Error 401 - ' . print_r($result, TRUE));
98 98
                 }
99 99
                 break;
100 100
             case 404:
101
-                error_log('Error 404 - ' . print_r($result, true));
102
-                $result = json_decode($result->body, true);
101
+                error_log('Error 404 - ' . print_r($result, TRUE));
102
+                $result = json_decode($result->body, TRUE);
103 103
                 break;
104 104
 			case 477:
105
-                $result = json_decode($result->body, true);
106
-                error_log('Error 477 - ' . print_r($result, true));
105
+                $result = json_decode($result->body, TRUE);
106
+                error_log('Error 477 - ' . print_r($result, TRUE));
107 107
                 break;
108 108
             case 429:
109
-                error_log('Error 429 - Too Many Requests' . print_r(json_decode($result->body, true), true));
109
+                error_log('Error 429 - Too Many Requests' . print_r(json_decode($result->body, TRUE), TRUE));
110 110
             	exit("Error 429: Too Many Requests");
111 111
             	break;
112 112
             case 403:
113
-                error_log('Error 403 - Access denied:' . print_r(json_decode($result->body, true), true));
114
-                $result = json_decode($result->body, true);
113
+                error_log('Error 403 - Access denied:' . print_r(json_decode($result->body, TRUE), TRUE));
114
+                $result = json_decode($result->body, TRUE);
115 115
                 break;
116 116
             case 502:
117
-                error_log('Error 502 - ' . print_r($result, true));
118
-                $result = json_decode($result->body, true);
117
+                error_log('Error 502 - ' . print_r($result, TRUE));
118
+                $result = json_decode($result->body, TRUE);
119 119
                 header('location:'.$_SERVER['PHP_SELF']);
120 120
                 break;
121 121
             case 503:
122
-                error_log('Error 503 - ' . print_r($result, true));
123
-                $result = json_decode($result->body, true);
122
+                error_log('Error 503 - ' . print_r($result, TRUE));
123
+                $result = json_decode($result->body, TRUE);
124 124
 
125 125
                 if(array_key_exists('error', $result) && $result['error'] == 'Service Unavailable')
126 126
                 {
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
                 break;
130 130
             default:
131 131
                 error_log('Error '.$result->status_code.' - unknown error');
132
-                $result = json_decode($result->body, true);
132
+                $result = json_decode($result->body, TRUE);
133 133
         }
134 134
 
135 135
         //important for account refresh
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      */
152 152
     private function getSignHeaders()
153 153
     {
154
-			if($this->getAccessToken() == null) {
154
+			if($this->getAccessToken() == NULL) {
155 155
 				$payload_accessToken = "";
156 156
 			}
157 157
 			else {
Please login to merge, or discard this patch.
php/DatabaseConnect.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@
 block discarded – undo
17 17
 {
18 18
 	error_log('ER_TOO_MANY_USER_CONNECTIONS');
19 19
 	sleep(1);
20
-	header('location: '.$_SERVER['PHP_SELF']);
20
+	header('location: ' . $_SERVER['PHP_SELF']);
21 21
 }
22 22
 
23
-if ($db->connect_errno)
23
+if($db->connect_errno)
24 24
 {
25 25
 	error_log('Sorry, die Verbindung zu unserem 
26 26
         Server ist hops gegangen. Wegen '. $db -> connect_error);
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,9 +13,12 @@
 block discarded – undo
13 13
 }
14 14
 $db = new DatabaseConnect();
15 15
 
16
-if($db->connect_errno == 1203)  // 1203 == ER_TOO_MANY_USER_CONNECTIONS (mysqld_error.h)
16
+if($db->connect_errno == 1203)
17
+{
18
+	// 1203 == ER_TOO_MANY_USER_CONNECTIONS (mysqld_error.h)
17 19
 {
18 20
 	error_log('ER_TOO_MANY_USER_CONNECTIONS');
21
+}
19 22
 	sleep(1);
20 23
 	header('location: '.$_SERVER['PHP_SELF']);
21 24
 }
Please login to merge, or discard this patch.