Completed
Push — master ( bb7cb4...4a054a )
by mains
02:45
created
template/nav-bottom.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,17 +2,17 @@
 block discarded – undo
2 2
 	<div class="col-xs-12">
3 3
 		<div class="row">
4 4
 			<div class="col-xs-3">
5
-				<a <?php if($view->view == 'combo')echo 'class="active"';?> href="<?php echo $view->changeView('combo')->toUrl();?>"><i class="fa fa-clock-o fa-3x"></i></a>
5
+				<a <?php if($view->view == 'combo')echo 'class="active"'; ?> href="<?php echo $view->changeView('combo')->toUrl(); ?>"><i class="fa fa-clock-o fa-3x"></i></a>
6 6
 			</div>
7 7
 			<div class="col-xs-3">
8
-				<a <?php if($view->view == 'discussed') echo 'class="active"';?> href="<?php echo $view->changeView('discussed')->toUrl();?>"><i class="fa fa-commenting-o fa-3x"></i></a>
8
+				<a <?php if($view->view == 'discussed') echo 'class="active"'; ?> href="<?php echo $view->changeView('discussed')->toUrl(); ?>"><i class="fa fa-commenting-o fa-3x"></i></a>
9 9
 			</div>
10 10
 			<div class="col-xs-3">
11
-				<a <?php if($view->view == 'popular') echo 'class="active"';?> href="<?php echo $view->changeView('popular')->toUrl();?>"><i class="fa fa-angle-up fa-3x"></i></a>
11
+				<a <?php if($view->view == 'popular') echo 'class="active"'; ?> href="<?php echo $view->changeView('popular')->toUrl(); ?>"><i class="fa fa-angle-up fa-3x"></i></a>
12 12
 			</div>
13 13
 			<div class="col-xs-3">
14 14
 				<nav>
15
-					<a href="<?php echo $baseUrl;?>about-us.php">about us</a>
15
+					<a href="<?php echo $baseUrl; ?>about-us.php">about us</a>
16 16
 				</nav>
17 17
 			</div>
18 18
 		</div>
Please login to merge, or discard this 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 <?php if($view->view == 'combo')echo 'class="active"';?> href="<?php echo $view->changeView('combo')->toUrl();?>"><i class="fa fa-clock-o fa-3x"></i></a>
5
+				<a <?php if($view->view == 'combo')
6
+{
7
+	echo 'class="active"';
8
+}
9
+?> href="<?php echo $view->changeView('combo')->toUrl();?>"><i class="fa fa-clock-o fa-3x"></i></a>
6 10
 			</div>
7 11
 			<div class="col-xs-3">
8
-				<a <?php if($view->view == 'discussed') echo 'class="active"';?> href="<?php echo $view->changeView('discussed')->toUrl();?>"><i class="fa fa-commenting-o fa-3x"></i></a>
12
+				<a <?php if($view->view == 'discussed')
13
+{
14
+	echo 'class="active"';
15
+}
16
+?> href="<?php echo $view->changeView('discussed')->toUrl();?>"><i class="fa fa-commenting-o fa-3x"></i></a>
9 17
 			</div>
10 18
 			<div class="col-xs-3">
11
-				<a <?php if($view->view == 'popular') echo 'class="active"';?> href="<?php echo $view->changeView('popular')->toUrl();?>"><i class="fa fa-angle-up fa-3x"></i></a>
19
+				<a <?php if($view->view == 'popular')
20
+{
21
+	echo 'class="active"';
22
+}
23
+?> href="<?php echo $view->changeView('popular')->toUrl();?>"><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/View.php 1 patch
Indentation   +221 added lines, -221 removed lines patch added patch discarded remove patch
@@ -2,107 +2,107 @@  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;
9
+	public $postId;
10
+	public $isDetailedView;
11
+	public $baseUrl;
12 12
 
13 13
 	public $lastPostId = '';
14 14
 
15
-    function __construct($baseUrl, $country, $city, $hashtag = '#all', $view = 'time', $postId = '')
16
-    {
17
-        $this->baseUrl = $baseUrl;
18
-        $this->country = $country;
19
-        $this->city = $city;
20
-        $this->hashtag = $hashtag;
21
-        $this->view = $view;
22
-        $this->postId = $postId;
23
-
24
-        if($postId == '')
25
-        {
26
-            $this->isDetailedView = FALSE;
27
-        }
28
-        else
29
-        {
30
-            $this->isDetailedView = TRUE;
31
-        }
32
-    }
15
+	function __construct($baseUrl, $country, $city, $hashtag = '#all', $view = 'time', $postId = '')
16
+	{
17
+		$this->baseUrl = $baseUrl;
18
+		$this->country = $country;
19
+		$this->city = $city;
20
+		$this->hashtag = $hashtag;
21
+		$this->view = $view;
22
+		$this->postId = $postId;
23
+
24
+		if($postId == '')
25
+		{
26
+			$this->isDetailedView = FALSE;
27
+		}
28
+		else
29
+		{
30
+			$this->isDetailedView = TRUE;
31
+		}
32
+	}
33 33
 	/**
34 34
 	 * Compute HTML Code
35 35
 	 */
36 36
  	function jodelToHtml($post)
37
-    {   //ToDO
38
-        //Replace # with link
39
-        //preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text);
40
-
41
-        //Time to time difference
42
-        $now = new DateTime();
43
-        $d = new DateTime($post['created_at']);
44
-        $timediff = $now->diff($d);
45
-
46
-        $timediff_inSeconds = (string)$timediff->format('%s');
47
-        $timediff_inMinutes = (string)$timediff->format('%i');
48
-        $timediff_inHours = (string)$timediff->format('%h');
49
-        $timediff_inDays = (string)$timediff->format('%d');
50
-        $timediff_inMonth = (string)$timediff->format('%m');
51
-
52
-        if($timediff_inMonth!=0)
53
-        {
54
-                $timediff = $timediff_inMonth . "m";
55
-        }
56
-        else
57
-        {
58
-            if($timediff_inDays!=0)
59
-            {
60
-                $timediff = $timediff_inDays . "d";
61
-            }
62
-            else
63
-            {
64
-                if($timediff_inHours!=0)
65
-                {
66
-                    $timediff = $timediff_inHours . "h";
67
-                }
68
-                else
69
-                {
70
-                    if($timediff_inMinutes!=0)
71
-                    {
72
-                        $timediff = $timediff_inMinutes . "m";
73
-                    }
74
-                    else
75
-                    {
76
-                        $timediff = $timediff_inSeconds . "s";
77
-                    }
78
-                }
79
-            }
80
-        }
81
-
82
-
83
-        ?>
37
+	{   //ToDO
38
+		//Replace # with link
39
+		//preg_replace('~(\#)([^\s!,. /()"\'?]+)~', '<a href="tag/$2">#$2</a>', $text);
40
+
41
+		//Time to time difference
42
+		$now = new DateTime();
43
+		$d = new DateTime($post['created_at']);
44
+		$timediff = $now->diff($d);
45
+
46
+		$timediff_inSeconds = (string)$timediff->format('%s');
47
+		$timediff_inMinutes = (string)$timediff->format('%i');
48
+		$timediff_inHours = (string)$timediff->format('%h');
49
+		$timediff_inDays = (string)$timediff->format('%d');
50
+		$timediff_inMonth = (string)$timediff->format('%m');
51
+
52
+		if($timediff_inMonth!=0)
53
+		{
54
+				$timediff = $timediff_inMonth . "m";
55
+		}
56
+		else
57
+		{
58
+			if($timediff_inDays!=0)
59
+			{
60
+				$timediff = $timediff_inDays . "d";
61
+			}
62
+			else
63
+			{
64
+				if($timediff_inHours!=0)
65
+				{
66
+					$timediff = $timediff_inHours . "h";
67
+				}
68
+				else
69
+				{
70
+					if($timediff_inMinutes!=0)
71
+					{
72
+						$timediff = $timediff_inMinutes . "m";
73
+					}
74
+					else
75
+					{
76
+						$timediff = $timediff_inSeconds . "s";
77
+					}
78
+				}
79
+			}
80
+		}
81
+
82
+
83
+		?>
84 84
         <article id ="postId-<?php echo $post['post_id']; ?>" class="jodel" style="background-color: #<?php echo $post['color'];?>;">
85 85
             <content>
86 86
                 <?php 
87
-                if(isset($post['image_url']))
88
-                {
89
-                    $regexRest = '/[^\w$ .!?-]+/u';
90
-
91
-                    echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">';
92
-                }
93
-                else {
94
-                    echo str_replace('  ', ' &nbsp;', nl2br(htmlspecialchars($post['message'])));
95
-                }
96
-                ?>
87
+				if(isset($post['image_url']))
88
+				{
89
+					$regexRest = '/[^\w$ .!?-]+/u';
90
+
91
+					echo '<img src="' . $post['image_url'] . '" alt="' . htmlspecialchars(preg_replace($regexRest, '', $post['message'])) . '">';
92
+				}
93
+				else {
94
+					echo str_replace('  ', ' &nbsp;', nl2br(htmlspecialchars($post['message'])));
95
+				}
96
+				?>
97 97
             </content>
98 98
             <aside>
99 99
                 <?php
100
-                    if($this->isDetailedView)
101
-                    {?>
100
+					if($this->isDetailedView)
101
+					{?>
102 102
                         <a href="index.php?vote=up&getPostDetails=true&postId=<?php echo $post['post_id'];?>&postId_parent=<?php echo htmlspecialchars($_GET['postId']);?>" rel="nofollow">
103 103
               <?php }
104
-                    else
105
-                    {?>
104
+					else
105
+					{?>
106 106
                         <a href="index.php?vote=up&postId=<?php echo $post['post_id'];?>" rel="nofollow">
107 107
               <?php } ?>
108 108
                             <i class="fa fa-angle-up fa-3x"></i>
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
                             <br />
111 111
                         <?php echo $post["vote_count"];?><br />
112 112
                 <?php
113
-                    if($this->isDetailedView)
114
-                    {?>
113
+					if($this->isDetailedView)
114
+					{?>
115 115
                         <a href="index.php?vote=down&getPostDetails=true&postId=<?php echo $post['post_id'];?>&postId_parent=<?php echo htmlspecialchars($_GET['postId']);?>" rel="nofollow">
116 116
               <?php }
117
-                    else
118
-                    {?>
117
+					else
118
+					{?>
119 119
                         <a href="index.php?vote=down&postId=<?php echo $post['post_id'];?>" rel="nofollow">
120 120
               <?php } ?>
121 121
                             <i class="fa fa-angle-down fa-3x"></i>
@@ -138,39 +138,39 @@  discard block
 block discarded – undo
138 138
                                 <a href="index.php?getPostDetails=true&view=<?php echo $this->view;?>&postId=<?php echo $post["post_id"];?>">
139 139
                                     <i class="fa fa-commenting-o"></i>
140 140
                                     <?php if(array_key_exists("child_count", $post)) {
141
-                                                echo $post["child_count"];
142
-                                            } else echo "0";
143
-                                    ?>
141
+												echo $post["child_count"];
142
+											} else echo "0";
143
+									?>
144 144
                                     </a>
145 145
                             </span>
146 146
                             <?php } ?>
147 147
                         </td>
148 148
                         <td class="distance">
149 149
                             <?php
150
-                                if($this->isDetailedView)
151
-                                {
152
-                                    if(isset($post["parent_creator"]) && $post["parent_creator"] == 1)
153
-                                    {
154
-                                        ?>
150
+								if($this->isDetailedView)
151
+								{
152
+									if(isset($post["parent_creator"]) && $post["parent_creator"] == 1)
153
+									{
154
+										?>
155 155
                                         <span data-tooltip="Author">
156 156
                                             <i class="fa fa-user-o"></i> OJ |
157 157
                                         </span>
158 158
                                         <?php 
159
-                                    }
160
-                                    else
161
-                                    {
162
-                                        //Is not parent Jodel in detailed View
163
-                                        if(!array_key_exists('child_count', $post) && array_key_exists('parent_creator', $post))
164
-                                        {
165
-                                            ?>
159
+									}
160
+									else
161
+									{
162
+										//Is not parent Jodel in detailed View
163
+										if(!array_key_exists('child_count', $post) && array_key_exists('parent_creator', $post))
164
+										{
165
+											?>
166 166
                                             <span data-tooltip="Author">
167 167
                                                 <i class="fa fa-user-o"></i> #<?php echo $post["user_handle"];?> |
168 168
                                             </span>
169 169
                                             <?php
170
-                                        }
171
-                                    }
172
-                                }
173
-                                ?>
170
+										}
171
+									}
172
+								}
173
+								?>
174 174
 
175 175
                             <span class="tip" data-tooltip="Distance">
176 176
                                 <i class="fa fa-map-marker"></i>
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
             </footer>
184 184
         </article>
185 185
     <?php
186
-    }
186
+	}
187 187
 
188 188
 
189 189
 	/**
@@ -254,120 +254,120 @@  discard block
 block discarded – undo
254 254
 		
255 255
 	}
256 256
 
257
-    function toUrl()
258
-    {
259
-        $url = $this->baseUrl . 'index.php?country=DE' .
260
-                            '&city=' . $this->city .
261
-                            '&hashtag=' . urlencode($this->hashtag) . 
262
-                            '&view=' . $this->view;
263
-        if($this->postId != '')
264
-        {
265
-            $url .= '&postId=' . $this->postId . 
266
-                    '&getPostDetails=TRUE';
267
-        }
268
-
269
-        return $url;
270
-    }
271
-
272
-    function changeView($view)
273
-    {
274
-        $tempView = clone $this;
275
-        $tempView->view = $view;
276
-        return $tempView;
277
-    }
257
+	function toUrl()
258
+	{
259
+		$url = $this->baseUrl . 'index.php?country=DE' .
260
+							'&city=' . $this->city .
261
+							'&hashtag=' . urlencode($this->hashtag) . 
262
+							'&view=' . $this->view;
263
+		if($this->postId != '')
264
+		{
265
+			$url .= '&postId=' . $this->postId . 
266
+					'&getPostDetails=TRUE';
267
+		}
268
+
269
+		return $url;
270
+	}
271
+
272
+	function changeView($view)
273
+	{
274
+		$tempView = clone $this;
275
+		$tempView->view = $view;
276
+		return $tempView;
277
+	}
278 278
 
279 279
 	function getPosts($jodelAccount)
280 280
 	{
281
-        if($this->hashtag != '#all' && $this->hashtag != '' && $this->hashtag != NULL)
282
-        {
283
-            $accountCreator = new GetChannel();
284
-            $accountCreator->view = $this->view;
285
-            $accountCreator->setAccessToken($jodelAccount->accessToken);
286
-            $accountCreator->channel = $this->hashtag;
287
-            $accountCreator->lastPostId = $this->lastPostId;
288
-            $data = $accountCreator->execute();
289
-        }
290
-        else
291
-        {
292
-            if($this->lastPostId == '' && $this->view == 'combo')
293
-            {
294
-                $url = "/v3/posts/location/combo";
295
-            }
296
-            else
297
-            {
298
-                if($this->view == 'discussed')
299
-                {
300
-                    $url = "/v2/posts/location/discussed/";
301
-                }
302
-                else
303
-                {
304
-                    if($this->view == 'popular')
305
-                    {
306
-                        $url = "/v2/posts/location/popular/";
307
-                    }
308
-                    else
309
-                    {
310
-                        $url = "/v2/posts/location/";
311
-                    }
312
-                }
313
-            }
314
-
315
-            $accountCreator = new GetPosts();
316
-            $accountCreator->setLastPostId($this->lastPostId);
317
-            $accountCreator->setAccessToken($jodelAccount->accessToken);
318
-            $accountCreator->setUrl($url);
319
-            $accountCreator->version = 'v3';
320
-
321
-            $config = parse_ini_file('config/config.ini.php');
322
-            $location = new Location();
323
-            $location->setLat($config['default_lat']);
324
-            $location->setLng($config['default_lng']);
325
-            $location->setCityName($config['default_location']);
326
-            $accountCreator->location = $location;
327
-            $data = $accountCreator->execute();
328
-        }
329
-    	if(array_key_exists('recent', $data))
330
-        {
331
-            return $data['recent'];
332
-        }
333
-        else if(array_key_exists('posts', $data))
334
-        {
335
-            return $data['posts'];
336
-        }
337
-        else
338
-        {
339
-            error_log('Fehler View getPosts ');
340
-            error_log(print_r($data, true));
341
-
342
-            $notFound[0] = array(
343
-                "post_id" => "0",
344
-                "discovered_by" => 0,
345
-                "message" => "Not 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" => "FFBA00",
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
-        }
281
+		if($this->hashtag != '#all' && $this->hashtag != '' && $this->hashtag != NULL)
282
+		{
283
+			$accountCreator = new GetChannel();
284
+			$accountCreator->view = $this->view;
285
+			$accountCreator->setAccessToken($jodelAccount->accessToken);
286
+			$accountCreator->channel = $this->hashtag;
287
+			$accountCreator->lastPostId = $this->lastPostId;
288
+			$data = $accountCreator->execute();
289
+		}
290
+		else
291
+		{
292
+			if($this->lastPostId == '' && $this->view == 'combo')
293
+			{
294
+				$url = "/v3/posts/location/combo";
295
+			}
296
+			else
297
+			{
298
+				if($this->view == 'discussed')
299
+				{
300
+					$url = "/v2/posts/location/discussed/";
301
+				}
302
+				else
303
+				{
304
+					if($this->view == 'popular')
305
+					{
306
+						$url = "/v2/posts/location/popular/";
307
+					}
308
+					else
309
+					{
310
+						$url = "/v2/posts/location/";
311
+					}
312
+				}
313
+			}
314
+
315
+			$accountCreator = new GetPosts();
316
+			$accountCreator->setLastPostId($this->lastPostId);
317
+			$accountCreator->setAccessToken($jodelAccount->accessToken);
318
+			$accountCreator->setUrl($url);
319
+			$accountCreator->version = 'v3';
320
+
321
+			$config = parse_ini_file('config/config.ini.php');
322
+			$location = new Location();
323
+			$location->setLat($config['default_lat']);
324
+			$location->setLng($config['default_lng']);
325
+			$location->setCityName($config['default_location']);
326
+			$accountCreator->location = $location;
327
+			$data = $accountCreator->execute();
328
+		}
329
+		if(array_key_exists('recent', $data))
330
+		{
331
+			return $data['recent'];
332
+		}
333
+		else if(array_key_exists('posts', $data))
334
+		{
335
+			return $data['posts'];
336
+		}
337
+		else
338
+		{
339
+			error_log('Fehler View getPosts ');
340
+			error_log(print_r($data, true));
341
+
342
+			$notFound[0] = array(
343
+				"post_id" => "0",
344
+				"discovered_by" => 0,
345
+				"message" => "Not 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" => "FFBA00",
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 372
 	}
373 373
 }
374 374
\ No newline at end of file
Please login to merge, or discard this patch.