| @@ 97-204 (lines=108) @@ | ||
| 94 | ?> |
|
| 95 | <div class="nextPosts"> |
|
| 96 | <?php |
|
| 97 | for($i = 0; $i<$loops; $i++) { |
|
| 98 | ||
| 99 | if(isset($posts[$i])) { |
|
| 100 | $lastPostId = $posts[$i]['post_id']; |
|
| 101 | ||
| 102 | ||
| 103 | $now = new DateTime(); |
|
| 104 | $d = new DateTime($posts[$i]["created_at"]); |
|
| 105 | ||
| 106 | ||
| 107 | //Time to time difference |
|
| 108 | $timediff = $now->diff($d); |
|
| 109 | ||
| 110 | $timediff_inSeconds = (string)$timediff->format('%s'); |
|
| 111 | $timediff_inMinutes = (string)$timediff->format('%i'); |
|
| 112 | $timediff_inHours = (string)$timediff->format('%h'); |
|
| 113 | $timediff_inDays = (string)$timediff->format('%d'); |
|
| 114 | $timediff_inMonth = (string)$timediff->format('%m'); |
|
| 115 | if($timediff_inMonth!=0) { |
|
| 116 | $timediff = $timediff_inMonth . "m"; |
|
| 117 | } |
|
| 118 | else |
|
| 119 | { |
|
| 120 | if($timediff_inDays!=0) |
|
| 121 | { |
|
| 122 | $timediff = $timediff_inDays . "d"; |
|
| 123 | } |
|
| 124 | else |
|
| 125 | { |
|
| 126 | if($timediff_inHours!=0) |
|
| 127 | { |
|
| 128 | $timediff = $timediff_inHours . "h"; |
|
| 129 | } |
|
| 130 | else |
|
| 131 | { |
|
| 132 | if($timediff_inMinutes!=0) |
|
| 133 | { |
|
| 134 | $timediff = $timediff_inMinutes . "m"; |
|
| 135 | } |
|
| 136 | else |
|
| 137 | { |
|
| 138 | $timediff = $timediff_inSeconds . "s"; |
|
| 139 | } |
|
| 140 | } |
|
| 141 | } |
|
| 142 | } |
|
| 143 | ?> |
|
| 144 | ||
| 145 | <article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;"> |
|
| 146 | <content> |
|
| 147 | <?php |
|
| 148 | if(isset($posts[$i]["image_url"])) { |
|
| 149 | echo '<img src="' . $posts[$i]["image_url"] . '">'; |
|
| 150 | } |
|
| 151 | else { |
|
| 152 | echo str_replace(' ', ' ', nl2br(htmlspecialchars($posts[$i]["message"]))); |
|
| 153 | } |
|
| 154 | ?> |
|
| 155 | </content> |
|
| 156 | <aside> |
|
| 157 | <a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
| 158 | <i class="fa fa-angle-up fa-3x"></i> |
|
| 159 | </a> |
|
| 160 | <br /> |
|
| 161 | <?php echo $posts[$i]["vote_count"];?><br /> |
|
| 162 | <a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
| 163 | <i class="fa fa-angle-down fa-3x"></i> |
|
| 164 | </a> |
|
| 165 | </aside> |
|
| 166 | ||
| 167 | <footer> |
|
| 168 | <table> |
|
| 169 | <tr> |
|
| 170 | <td class="time"> |
|
| 171 | <span data-tooltip="Time"> |
|
| 172 | <i class="fa fa-clock-o"></i> |
|
| 173 | <?php echo $timediff;?> |
|
| 174 | </span> |
|
| 175 | </td> |
|
| 176 | <td class="comments"> |
|
| 177 | <?php if($showCommentIcon) {?> |
|
| 178 | <span data-tooltip="Comments"> |
|
| 179 | <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
| 180 | <i class="fa fa-commenting-o"></i> |
|
| 181 | <?php if(array_key_exists("child_count", $posts[$i])) { |
|
| 182 | echo $posts[$i]["child_count"]; |
|
| 183 | } else echo "0"; |
|
| 184 | ?> |
|
| 185 | </a> |
|
| 186 | </span> |
|
| 187 | <?php } ?> |
|
| 188 | </td> |
|
| 189 | <td class="distance"> |
|
| 190 | <span data-tooltip="Distance"> |
|
| 191 | <i class="fa fa-map-marker"></i> |
|
| 192 | <?php echo $posts[$i]["distance"];?> km |
|
| 193 | </span> |
|
| 194 | </td> |
|
| 195 | </tr> |
|
| 196 | </table> |
|
| 197 | </footer> |
|
| 198 | </article> |
|
| 199 | ||
| 200 | ||
| 201 | ||
| 202 | <?php |
|
| 203 | } |
|
| 204 | } |
|
| 205 | ?> |
|
| 206 | </div> |
|
| 207 | <div class="lastPostId"> |
|
| @@ 206-312 (lines=107) @@ | ||
| 203 | } |
|
| 204 | ||
| 205 | ||
| 206 | for($i = 0; $i<$loops; $i++) { |
|
| 207 | ||
| 208 | if(isset($posts[$i])) { |
|
| 209 | $lastPostId = $posts[$i]['post_id']; |
|
| 210 | ||
| 211 | ||
| 212 | $now = new DateTime(); |
|
| 213 | $d = new DateTime($posts[$i]["created_at"]); |
|
| 214 | ||
| 215 | ||
| 216 | //Time to time difference |
|
| 217 | $timediff = $now->diff($d); |
|
| 218 | ||
| 219 | $timediff_inSeconds = (string)$timediff->format('%s'); |
|
| 220 | $timediff_inMinutes = (string)$timediff->format('%i'); |
|
| 221 | $timediff_inHours = (string)$timediff->format('%h'); |
|
| 222 | $timediff_inDays = (string)$timediff->format('%d'); |
|
| 223 | $timediff_inMonth = (string)$timediff->format('%m'); |
|
| 224 | if($timediff_inMonth!=0) { |
|
| 225 | $timediff = $timediff_inMonth . "m"; |
|
| 226 | } |
|
| 227 | else |
|
| 228 | { |
|
| 229 | if($timediff_inDays!=0) |
|
| 230 | { |
|
| 231 | $timediff = $timediff_inDays . "d"; |
|
| 232 | } |
|
| 233 | else |
|
| 234 | { |
|
| 235 | if($timediff_inHours!=0) |
|
| 236 | { |
|
| 237 | $timediff = $timediff_inHours . "h"; |
|
| 238 | } |
|
| 239 | else |
|
| 240 | { |
|
| 241 | if($timediff_inMinutes!=0) |
|
| 242 | { |
|
| 243 | $timediff = $timediff_inMinutes . "m"; |
|
| 244 | } |
|
| 245 | else |
|
| 246 | { |
|
| 247 | $timediff = $timediff_inSeconds . "s"; |
|
| 248 | } |
|
| 249 | } |
|
| 250 | } |
|
| 251 | } |
|
| 252 | ?> |
|
| 253 | ||
| 254 | <article id ="postId-<?php echo $posts[$i]["post_id"]; ?>" class="jodel" style="background-color: #<?php echo $posts[$i]["color"];?>;"> |
|
| 255 | <content> |
|
| 256 | <?php |
|
| 257 | if(isset($posts[$i]["image_url"])) { |
|
| 258 | echo '<img src="' . $posts[$i]["image_url"] . '">'; |
|
| 259 | } |
|
| 260 | else { |
|
| 261 | echo str_replace(' ', ' ', nl2br(htmlspecialchars($posts[$i]["message"]))); |
|
| 262 | } |
|
| 263 | ?> |
|
| 264 | </content> |
|
| 265 | <aside> |
|
| 266 | <a href="index.php?vote=up&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
| 267 | <i class="fa fa-angle-up fa-3x"></i> |
|
| 268 | </a> |
|
| 269 | <br /> |
|
| 270 | <?php echo $posts[$i]["vote_count"];?><br /> |
|
| 271 | <a href="index.php?vote=down&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
| 272 | <i class="fa fa-angle-down fa-3x"></i> |
|
| 273 | </a> |
|
| 274 | </aside> |
|
| 275 | ||
| 276 | <footer> |
|
| 277 | <table> |
|
| 278 | <tr> |
|
| 279 | <td class="time"> |
|
| 280 | <span data-tooltip="Time"> |
|
| 281 | <i class="fa fa-clock-o"></i> |
|
| 282 | <?php echo $timediff;?> |
|
| 283 | </span> |
|
| 284 | </td> |
|
| 285 | <td class="comments"> |
|
| 286 | <?php if($showCommentIcon) {?> |
|
| 287 | <span data-tooltip="Comments"> |
|
| 288 | <a href="index.php?getPostDetails=true&view=<?php echo $view;?>&postID=<?php echo $posts[$i]["post_id"];?>"> |
|
| 289 | <i class="fa fa-commenting-o"></i> |
|
| 290 | <?php if(array_key_exists("child_count", $posts[$i])) { |
|
| 291 | echo $posts[$i]["child_count"]; |
|
| 292 | } else echo "0"; |
|
| 293 | ?> |
|
| 294 | </a> |
|
| 295 | </span> |
|
| 296 | <?php } ?> |
|
| 297 | </td> |
|
| 298 | <td class="distance"> |
|
| 299 | <span data-tooltip="Distance"> |
|
| 300 | <i class="fa fa-map-marker"></i> |
|
| 301 | <?php echo $posts[$i]["distance"];?> km |
|
| 302 | </span> |
|
| 303 | </td> |
|
| 304 | </tr> |
|
| 305 | </table> |
|
| 306 | </footer> |
|
| 307 | </article> |
|
| 308 | ||
| 309 | ||
| 310 | ||
| 311 | <?php } |
|
| 312 | } ?> |
|
| 313 | ||
| 314 | </content> |
|
| 315 | ||