bootsrap inprogress
[Anonymous-Twitter-Board.git] / class / board-functions.php
blobcbc60feb50f695423c974e44257430e9df33bfe8
1 <?php
2 include_once("class/database-connection.php");
3 include_once("../class/database-connection.php");
4 include_once("class/twitter-connection.php");
5 include_once("../class/twitter-connection.php");
6 class BoardFunctions{
8 public static $die_state = array();
9 public static $comment_error = false;
11 function __construct(){}
13 public static function buildAudioGimick($song = 0){
14 $track_list = scandir (__DIR__ . "/../audio", FilesystemIterator::SKIP_DOTS);
15 asort($track_list);
16 $track_list = array_slice($track_list, 4);//remove non-audio and dots
17 $track = 'audio/' . $track_list[$song];
19 echo '
20 <audio controls autoplay preload="none" class="top-widget">
21 <source src="' . $track . '" type="audio/mpeg">
22 Your browser does not support the audio tag.
23 </audio>
26 $post_properties = parse_ini_file("settings/postproperties.ini");
27 $id = "";
28 if($song == 0){
29 $id = "kind-of-a-huge-deal-komrad";
30 echo "
31 <style>#kind-of-a-huge-deal-komrad{
32 font-size: 120px;
33 text-align:center;
34 margin:0% 7%;
35 color:BLUE;
36 position:absolute;}</style>
39 echo '<h1 id="' . $id . '">ХОРОШО <br/>POSTER NUMBER: ' . $post_properties["TotalPosts"] .'<br/>
40 <br/>Спасибо!</h1>';
42 else if ($song == 1){
43 echo"
44 <style>#a-huge-deal-komrad{
45 font-size: 130px;
46 text-align:center;
47 margin:0% 7%;
48 color:purple;
49 position:absolute;
50 }</style>
52 $id = "a-huge-deal-komrad";
53 echo '<h1 id="' . $id . '">ХОРОШО<br/> POSTER NUMBER: ' . $post_properties["TotalPosts"] .'<br/><br/>HIBIKI LIVED, SO WILL YOU!</h1>';
55 else if($song == 2){
56 $id = "fucking-huge-deal-komrad";
57 echo"
58 <style>#fucking-huge-deal-komrad{
59 font-size: 200px;
60 text-align:center;
61 margin:0% -5%;
62 color:red;
63 position:absolute;
64 }</style>
66 echo '<h1 id="' . $id . '">CONGRAGULATIONS KOMRAD NUMBER:' . $post_properties["TotalPosts"] .' <br/> KOMRAD.
67 YOU MADE A VERY GREAT POST ON THIS VERY GOOD SITE UNFORTUNATLY WE HAVE NO FOOD TO GIVE SINCE WE KILLED ALL THE UKRAINIAN FARMERS.
68 MANY THANKS AND HAVE A NICE DAY SORRY FOR THE EAR RAPE!!!!!!!!!!!!!</h1>';
70 else{
71 $r = rand(0,255);
72 $g = rand(0,255);
73 $b = rand(0,255);
74 $added_properties = "color:rgb($r,g,$b)";
75 $id = "its-a-deal-komrad";
76 echo "<style>#its-a-deal-komrad{
77 font-size: 100px;
78 text-align:center;
79 margin:0% 14%;
80 color:rgb($r,$g,$b);
81 position:absolute;
82 }</style>";
83 echo "<h1 id='$id' style='color:rgb($r,g,$b)'>ХОРОШО<br/> POSTER NUMBER:". $post_properties["TotalPosts"] . " </h1>";
86 echo'
87 <script>
88 //https://html.com/tags/blink/
89 var blink_speed = 700; var t = setInterval(function () { var ele = document.getElementById("'. $id .'"); ele.style.visibility = (ele.style.visibility == "hidden" ? "" : "hidden"); }, blink_speed);
90 </script>
95 public static function buildNavBar(){
96 echo' <nav class="navbar navbar-expand-sm bg-secondary">
97 <ul class="navbar-nav">
98 <li class="nav-item">
99 <a class="nav-link text-success" href="/">Home</a>
100 </li>
101 <li class="nav-item">
102 <a class="nav-link text-success" href="/view-queue">To Be Posted</a>
103 </li>
104 <li class="nav-item">
105 <a class="nav-link text-success" href="https://twitter.com/Qazoku">@Qazoku</a>
106 </li>
107 </ul>
108 </nav>';
112 public static function buildQueueForm(){
115 echo'<div class="card w-75 mx-5 my-0">
116 <div class="card-header">
117 <button class="btn btn-link" data-toggle="collapse" data-target="#comment-fields" aria-expanded="true" aria-controls="comment-fields">Comment</button>
118 </div>
119 <div id="comment-fields" class="collapse px-5 pt-2 pb-5">
120 <form action="add-to-queue.php" enctype="multipart/form-data" method="POST" target="_self" id="submit-form">
121 <br />
122 <textarea id="Comment" name="comment" rows="10" cols="60" placeholder = "Comment Text Here"></textarea>
123 <p id="CharacterCount" class="lead"></p>
125 <input name="MAX_FILE_SIZE" type="hidden" value="5242880" />
126 <div class="dropdown">
127 <button class="btn dropdown-toggle" type="button" id="file-container" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Add Image</button>
128 <div class="dropdown-menu pt-3" aria-labelledby="file-container">
129 <input name="file1" type="file" id="f1" class="dropdown-item form-control-file"/>
130 <input name="file2" type="file" id="f2" class="dropdown-item form-control-file"/>
131 <input name="file3" type="file" id="f3" class="dropdown-item form-control-file"/>
132 <input name="file4" type="file" id="f4" class="dropdown-item form-control-file"/>
133 </div>
134 </div>
135 <hr />
136 <div id="errorMsg" class="alert alert-warning" role="alert">Input a comment and/or file</div>
137 <input id="submit-button" class="btn btn-secondary form-control" type="submit" disabled="1"/></form>
138 </div>
139 </div>
143 public static function buildPassForm(){
144 echo"<form action='' method='POST'>
145 <input name='name'><br/>
146 <input name='pass' type='password'><br/>
147 <input type='submit' id='authorization-input' value='Authorize'><br/>
148 <label>Stay Logged In: <input type='checkbox' name='persistent-login'></label><br/></form>";
153 public static function retrieveTwitterTimeline($connection_tw, $connection_db){
154 $timeline_tweets = $connection_tw->retrieveTimeline();
155 StandardFunctions::recursiveEchoJson($combined_database_arr,0);
157 echo sizeof($timeline_tweets) . "<pre>";
158 if(sizeof($timeline_tweets) != 0){
159 $connection_db->addTimelineTweetsToDatabase($timeline_tweets);
161 echo "Done</pre>";
165 public static function checkSubmissionValid($tweet_comment="", $file_string="",$database_con){
166 $COMMENT_MAX = 280;
167 BoardFunctions::$comment_error = 0;
168 $tweet_comment = trim($tweet_comment);
169 $banned = $database_con->getPostDetails("Banned", "IPAddress", $_SERVER['HTTP_X_REAL_IP'])[0]["BanComment"];
170 $banned = str_replace(" ", "_", $banned);
171 if($banned != null){
172 BoardFunctions::$comment_error = "-5 $banned";
174 else if(mb_strlen($tweet_comment) > $COMMENT_MAX){
175 BoardFunctions::$comment_error = "-3 Comment-too-long";
177 else if(mb_strlen($tweet_comment) == 0){
178 BoardFunctions::$comment_error = "-4 No Comment";
180 else if(preg_match("/VERIFY: /", $tweet_comment) == 0){
181 $filters = JSON_Decode(file_get_contents("settings/verify-levels.json"), true);
182 if($filters["Image-Block"] == 1 && !($file_string == "" || $file_string == NULL))
183 BoardFunctions::$comment_error = "-2 Images_disabled";
184 else if($filters["URL-Block"] == 1 && (preg_match("/http/", $tweet_comment) == 1 || preg_match("/\.com/", $tweet_comment) == 1))
185 BoardFunctions::$comment_error = "-2 URLs_disabled";
186 else if($filters["At-Block"] == 1 && preg_match("/@/", $tweet_comment) == 1)
187 BoardFunctions::$comment_error = "-2 @_links_disabled";
188 else if($filters["Filter-Text-Active"] == 1){
189 foreach($filters["Filter-Text"] as $filter){
190 if(preg_match("/$filter/", $tweet_comment) == 1) {
191 BoardFunctions::$comment_error = "-2 Remove_$filter";
196 return $tweet_comment;
199 public static function uploadAndVerify($files){
200 $FILE_MAX = 5242880;
201 $file_arr = array();
202 $file_string = "";
203 $first = true;
204 for($file = 0; $file < 4; $file++){
205 //empty check
206 if($files[$file] == "") {
207 //echo "file " . (string)$file .", Empty<br/>";
208 BoardFunctions::$die_state[$file] = 5;
209 continue;
212 $file_components = explode("=", ($files[$file]));
213 $file_name = urldecode($file_components[0]);
214 $file_data = $file_components[1];
215 $upload_location = "images/" . $file_name;
217 //duplicate check
218 if(file_exists($upload_location)) {
219 //echo "file " . (string)$file .", Duplicate ($upload_location)<br/>";
220 BoardFunctions::$die_state[$file] = 6;
221 continue;
224 $dir_file = fopen($upload_location, "w");
225 fwrite($dir_file, base64_decode($file_data));
226 fclose($dir_file);
227 $file_size = filesize ($upload_location);//https://softwareengineering.stackexchange.com/questions/288670/know-file-size-with-a-base64-string
229 //over filesize check
230 if($file_size >= $FILE_MAX){
231 //echo "file" . (string)$file ." Over filesize limit-Server $file_size<br/>";
232 BoardFunctions::$die_state[$file] = 1;
233 unlink($upload_location);
234 continue;
237 if($first){
238 $file_string .= rawurlencode($upload_location);
239 $first = false;
241 else{
242 $file_string .= "," . rawurlencode($upload_location);
245 BoardFunctions::$die_state[$file] = 0;
247 return $file_string;
250 public static function displayTabularDatabase($table_name, $ordering_param, $display_images = false){
251 echo "<br/>Displaying All entries(lower number means posted sooner): <br/>";
252 $statement = $this->connection->prepare("Select * from $table_name ORDER BY :param DESC;");
253 $statement->bindParam(":param", $ordering_param);
254 $statement->execute();
255 $result_arr = $statement->fetchAll();
256 if(sizeof($result_arr) !== 0){
257 foreach($result_arr[0] as $key=>$head){
258 if(is_numeric ($key)) unset($result_arr[0][$key]);
261 echo "<table border='1' class='table table-striped'><tr> <thead class='table-dark'><tr>";
262 foreach($result_arr[0] as $key=>$head_item)
263 echo "<th>$key</th>";
264 echo "</thead></tr><tbody>";
266 for($row = sizeof($result_arr) - 1; $row >= 0 ; $row--){
267 echo"<tr>";
268 $tupple = $result_arr[$row];
269 $column = 0;
270 foreach($tupple as $key=>$col){
271 if(is_numeric ($key)) unset($result_arr[0][$key]);
272 else {
273 if($column == 2 && $display_images){
274 $img_arr = explode(",", $col);
275 foreach($img_arr as $img){
276 $img = urldecode($img);
277 $img_ext = pathinfo($img, PATHINFO_EXTENSION);
278 if(strcmp($img_ext, "png") == 0 || strcmp($img_ext, "jpg") == 0|| strcmp($img_ext, "gif") == 0)
279 echo "<td>" . $this->createImageNode($img) . "</td>";
280 else
281 echo "<td>" . $this->createVideoNode($img) . "</td>";
285 else{
286 if($key == "PostNo") echo "<td>$col - $row</td>";
287 else echo "<td>$col</td>";
289 $column++;
292 echo"</tr>";
294 echo "</tbody></table><hr/>";
296 else echo '<table border="1"><hr/><th>No Entries</th><tr></table>';
300 public static function displayTabularJoin($table_name, $join_with, $ordering_param, $skip_col, $display_images = false, $database_con, $ordering = "ASC"){
301 echo "<h3>Displaying All Combined Entries(lower number means posted sooner): </h3>";
302 $result_arr = $database_con->getAllSubmissionDetails($table_name, $join_with, $ordering_param,$ordering);
304 if(sizeof($result_arr) !== 0){
305 foreach($result_arr[0] as $key=>$head){
306 if(is_numeric ($key)) unset($result_arr[0][$key]);
309 echo "<table border='1' class='table table-striped'><tr> <thead class='table-dark'>";
310 foreach($result_arr[0] as $key=>$head_item){
311 if($column++ == $skip_col) continue;
312 echo "<th>$key</th>";
314 echo "</tr> </thead><tbody>";
318 for($row = sizeof($result_arr) - 1; $row >= 0 ; $row--){
319 echo"<tr>";
320 $tupple = $result_arr[$row];
321 $column = 0;
322 foreach($tupple as $key=>$col){
323 //fail checks
324 if(is_numeric ($key)) {
325 unset($result_arr[0][$key]);
326 continue;
328 else if($column == $skip_col){
329 $column++;
330 continue;
332 //pass chekcs
333 echo "<td>";
334 if($key=="Unverified"){
335 echo "<strong>";
336 if($col == "1") echo "Withheld"; //is unverified
337 else if ($col == "-1") echo "Banned"; //banned
338 else if($col == "187") echo "Duplicate"; //is not unverified
339 else if($col == "170") echo "No Contents"; //is not unverified
340 else if($col == "0") echo "Verified"; //is not unverified
341 else echo $col;
342 echo "</strong>";
344 else if($key == "PostNo") echo "$col - $row";
345 else if($key == "ImageURL" && $display_images){
346 $img_arr = explode(",", $col);
347 foreach($img_arr as $img){
348 $img = urldecode($img);
349 $img_ext = pathinfo($img, PATHINFO_EXTENSION);
350 if(strcmp($img_ext, "png") == 0 || strcmp($img_ext, "jpg") == 0|| strcmp($img_ext, "gif") == 0)
351 echo BoardFunctions::createImageNode($img);
352 else if(strcmp($img_ext, "mp4") == 0)
353 echo BoardFunctions::createVideoNode($img);
354 else {};
357 else echo "$col";
358 $column++;
359 echo "</td>";
361 echo"</tr>";
363 echo "</tbody></table><hr/>";
365 else echo '<table border="1"><hr/><th>No Entries</th><tr></table>';
369 public static function displayVerificationForm($display_images = false, $database_con, $ordering = "DESC"){
370 echo "<h3>Displaying All Data(lower number means posted sooner): </h3>";
371 $result_arr = $database_con->getVerificationDetails($ordering);
372 if(sizeof($result_arr) !== 0){
373 echo "<form method='POST' action='proccess-mod.php'><table border='1' class='table table-striped'><thead class='table-dark'><tr>";
374 echo "<th>Item Selected</th>";
375 foreach($result_arr[0] as $key=>$head_item){
376 if(!is_numeric ($key)) echo "<th>$key</th>";
378 echo "</thead></tr></tbody>";
379 for($row = 0; $row <= sizeof($result_arr) - 1 ; $row++){
380 if($result_arr[$row][0] != null){
381 $result_arr[$row]["PostID"] = $result_arr[$row][0];
383 if($result_arr[$row][6] != null){
384 $result_arr[$row]["IPAddress"] = $result_arr[$row][6];
386 echo"<tr>";
387 echo "<td><input type='checkbox' name='chk". $result_arr[$row]["PostID"] ."' /></td>";
389 $tupple = $result_arr[$row];
390 $column = 0;
391 foreach($tupple as $key=>$col){
392 //fail checks
393 if(is_numeric ($key)) {
394 unset($result_arr[0][$key]);
395 continue;
397 //pass chekcs
398 echo "<td>";
399 if($key=="Unverified"){
400 echo "<strong>";
401 if($col == "1") echo "Withheld"; //is unverified
402 else if($col == "187") echo "Duplicate"; //is not unverified
403 else if($col == "170") echo "No Contents"; //is not unverified
404 else if($col == "0") echo "Verified"; //is not unverified
405 else if($result_arr[$row]["RepliesTo"] == "") echo "Posted";
406 else if($result_arr[$row]["RepliesTo"] != "") echo "Replied";
407 else echo $col;
408 if ($col == "") $col = "-";
409 echo "</strong>";
410 if($col == "1" || $col == "0") echo ": <input placeholder='$col' name='unv". $result_arr[$row]["PostID"] ."' class=''/>";
412 else if($key == "PostID") echo ($row+1) . " - $col";
413 else if($key == "ImageURL" && $display_images){
414 $img_arr = explode(",", $col);
415 if($img_arr[0] == "") echo "<strong>None</strong>";
416 foreach($img_arr as $img){
417 $img = urldecode($img);
418 $img_ext = pathinfo($img, PATHINFO_EXTENSION);
419 if(strcmp($img_ext, "png") == 0 || strcmp($img_ext, "jpg") == 0|| strcmp($img_ext, "gif") == 0)
420 echo BoardFunctions::createImageNode($img);
421 else if(strcmp($img_ext, "mp4") == 0)
422 echo BoardFunctions::createVideoNode($img);
423 else {};
427 else if($key == "BanComment"){
428 if( $result_arr[$row]["IPAddress"] != "")
429 echo "<textarea name='ban" . $result_arr[$row]["PostID"] . "' class=''>$col</textarea> ";
430 else echo "-";
432 else if($key == "IPAddress"){
433 if($col != "") echo "<input hidden name='ipd" . $result_arr[$row]["PostID"]. "' value='$col' />$col";
434 else echo "-";
436 else if($key == "RepliesTo" && $col == "") echo "-";
437 else if($key == "BanComment" && $col == "") echo "-";
438 else echo "$col";
439 $column++;
440 echo "</td>";
442 echo"</tr>";
444 echo "</table><br/>";
445 echo "<input type='submit' value='Delete Entries' name='delete-button'>";
446 echo "<input type='submit' value='Toggle IP Ban' name='ban-button'>";
447 echo "<input type='submit' value='Set Unverifed' name='verify-button'>";
448 echo "<input type='submit' value='Send Entries' name='send-button'>";
449 echo "</form>";
450 echo "<hr/>";
451 echo "<h2>Verification Blocks</h2>";
452 echo "<form method='POST' action='proccess-mod.php'>";
453 //read from text file settings and place into inputs
454 $settings_file = JSON_Decode(file_get_contents($database_con->path_prefix . "settings/verify-levels.json"), true);
455 if($settings_file["Image-Block"] == 0){
456 echo "<label><input type='checkbox' name='blockimg'>Block Images</label><br/>";
458 else{
459 echo "<label><input type='checkbox' name='blockimg' checked>Block Images</label><br/>";
461 if($settings_file["URL-Block"] == 0){
462 echo "<label><input type='checkbox' name='blockurl'>Block URLS</label><br/>";
464 else{
465 echo "<label><input type='checkbox' name='blockurl' checked>Block URLS</label><br/>";
467 if($settings_file["At-Block"] == 0){
468 echo "<label><input type='checkbox' name='blockat'>Block @ Links</label><br/>";
470 else{
471 echo "<label><input type='checkbox' name='blockat' checked>Block @ Links</label><br/>";
473 if($settings_file["Filter-Text-Active"] == 0){
474 echo "<label><input type='checkbox' name='blocktext' id='blocktext'>Block Filtered Text</label><br/>";
475 if(sizeof($settings_file["Filter-Text"]) == 0){
476 echo "<span style='display:none' class='filters'>Item 1: <input type='text' name='filter1' '>
477 <a style='text-decoration:none' id='plus' class='fa fa-plus-circle' href='javascript:void(0)'></a ></span><br/>";
479 else{
480 echo "<span style='display:none;margin:10px;' class='filters'>";
481 foreach($settings_file["Filter-Text"] as $index=>$filter){
482 $filter_number = $index + 1;
483 echo "Item $filter_number: <input type='text' name='filter$filter_number' value='$filter'>";
484 if($index == 0){
485 echo "<a style='text-decoration:none' id='plus' class='fa fa-plus-circle' href='javascript:void(0)'></a >";
487 echo "<br/>";
489 echo"</span>";
492 else{
493 echo "<label><input type='checkbox' name='blocktext' id='blocktext' checked>Block Filtered Text</label><br/>";
494 echo "<span style='display:block;margin:10px;' class='filters'>";
495 foreach($settings_file["Filter-Text"] as $index=>$filter){
496 $filter_number = $index + 1;
497 echo "Item $filter_number: <input type='text' name='filter$filter_number' value='$filter'>";
498 if($index == 0){
499 echo "<a style='text-decoration:none' id='plus' class='fa fa-plus-circle' href='javascript:void(0)'></a >";
501 echo "<br/>";
503 echo"</span>";
505 //script to handel new filters
506 echo "
507 <script>
508 var blocktext_node=document.getElementById('blocktext');
509 blocktext_node.addEventListener('click', function(){
510 var filters = document.getElementsByClassName('filters');
511 if(blocktext_node.checked == false){
512 var len = filters.length;
513 console.log(filters);
514 for(var filter = 0; filter < len ; filter++){
515 filters[filter].style.display = 'none';
518 else{
519 var len = filters.length;
520 console.log(filters);
521 for(var filter = 0; filter < len ; filter++){
522 filters[filter].style.display = 'block';
526 var plus = document.getElementById('plus');
527 plus.addEventListener('click',function(){
528 var filters = document.getElementsByClassName('filters');
529 var new_span = document.createElement('SPAN');
530 new_span.innerHTML='Item ' + (filters[filters.length-1].getElementsByTagName('INPUT').length + 1) + ': <input type=\'text\' name=\'filter' + (filters[filters.length-1].getElementsByTagName('INPUT').length + 1) + '\'></span><br/>';
531 filters[filters.length-1].appendChild(new_span);
533 </script>
535 echo "<br/><input type='submit' value='Set Verification Levels' name='levels-button'>";
536 echo "</form>";
538 else echo '</tbody><table border="1"><hr/><th>No Entries</th><tr></table>';
542 public static function logIntoAuthorizedSpace($post_fields, $client_ip, &$session_fields, $database_con){
543 if($post_fields["logout"] !== null){
544 $database_con->updatePost("Authorized", "LoggedInIP", $client_ip,
545 array("LoggedInIP" => null));
546 $session_fields["mod"] = "Good Samaritan";
547 return true;
549 else{
550 $name_fail = false;
551 $pass_fail = false;
553 $persistent_lookup = $database_con->getPostDetails("Authorized",
554 "LoggedInIP", $client_ip);
555 if(sizeof($persistent_lookup) > 0 ){
556 $session_fields["mod"] = "pervert";
557 header("Location: ");
559 else{
560 $user_lookup = $database_con->getPostDetails("Authorized", "ModName", $post_fields["name"]);
561 if(sizeof($user_lookup) == 0) $name_false = true;
562 else{
563 $password_hashed = hash("SHA512", $post_fields["pass"]);
564 if(strcasecmp($password_hashed, $user_lookup[0]["ModSha512"]) == 0){
565 if($post_fields["persistent-login"])
566 $database_con->updatePost("Authorized", "ModName", $post_fields["name"],
567 array("LoggedInIP" => $client_ip));
568 else
569 $database_con->updatePost("Authorized", "ModName", $post_fields["name"],
570 array("LoggedInIP" => null));
572 $session_fields["mod"] = "pervert";
573 header("Location: ");
575 else $pass_fail = true;
578 return false;
582 public static function createMediaNodeFromRaw($img_path_unprocessed){
583 $img_arr = explode(",", $img_path_unprocessed);
584 foreach($img_arr as $img){
585 $img = urldecode($img);
586 $img_ext = pathinfo($img, PATHINFO_EXTENSION);
587 if(strcmp($img_ext, "png") == 0 || strcmp($img_ext, "jpg") == 0|| strcmp($img_ext, "gif") == 0)
588 echo "<td>" . BoardFunctions::createImageNode($img) . "</td>";
589 else
590 echo "<td>" . BoardFunctions::createVideoNode($img) . "</td>";
595 public static function createImageNode($img_path){
596 //return "<img src='$img_path' width='50%'/>";
597 return "<a href='$img_path'><img src='$img_path' class='img-fluid' style=''/></a>";
599 public static function createVideoNode($vid_path){
600 //return "<video src='$vid_path' autoplay='true' loop='true' width='50%'/>"
601 return "<a href='$vid_path'><video src='$vid_path' autoplay='true' loop='true' class='img-fluid' /></a>";
603 public static function buildAllThreads($build_type, $display_type, $database_con){
604 $threads = $database_con->getThreads();
605 $thread_counter = 0;
606 $row_size = 4;
607 $list_add = "";
608 if($build_type == "native"){
609 if($display_type == "list"){
610 foreach($threads as $thread){
611 $post_id = $thread[0];
612 echo "<div class='container px-0 my-4 border' PostNo='" . $post_id ."'>";
613 //details
614 echo "<div class='border p-2 bg-light'>
615 <div class='col'>
616 <div class='row'>
617 <span>PostNo: " . $post_id ."</span>
618 <span class=''>
619 </div>
620 <div class='row'>
621 <a href='/?thread=" . $post_id . "' class='px-4 py-0'>
622 Open
623 </a>
624 </span>
625 <span class=''>
626 <a href='https://twitter.com/Qazoku/status/". $post_id ."'>
627 Twitter
628 </a>
629 </span>
630 </div>
631 </div>
632 </div>";
633 //contents;
634 echo "
635 <div class='row px-1 py-0'>
636 <div class='col-8 p-4'><blockquote>" . $thread["PostText"] ."</blockquote></div>
637 <div class='col-4'>";
638 if($thread["ImageURL"] !== null)
639 BoardFunctions::createMediaNodeFromRaw($thread["ImageURL"]);
640 else echo "<img/>";
641 echo "</div>
642 </div>";
643 echo "</div>";
644 //if($thread_counter % $row_size == $row_size - 1) echo "</ul>";
647 else{
648 foreach($threads as $thread){
649 $post_id = $thread[0];
650 echo "<div class='d-flex flex-wrap border w-25 m-4' PostNo='" . $post_id ."'>";
651 //details
652 echo "<div class='border px-0 py-2 col-12 bg-light' style='height:5rem'>
653 <div class='col'>
654 <div class='row'>
655 <div class='col-1'></div>
656 <span class='col-10'>PostNo: " . $post_id ."</span>
658 <div class='col-1'></div>
659 </div>
660 <div class='row'>
661 <div class='col-1'></div>
662 <span class='col-3'>
663 <a href='/?thread=" . $post_id . "' class='px-4 py-0'>
664 Open
665 </a>
666 </span>
667 <div class='col-1'></div>
668 <span class='col-3'>
669 <a href='https://twitter.com/Qazoku/status/". $post_id ."'>
670 Twitter
671 </a>
672 </span>
673 </div>
674 </div>
675 </div>";
676 //contents;
677 echo "
678 <div class='px-1 py-0'>
679 <div class='row p-4'><blockquote>" . $thread["PostText"] ."</blockquote></div>
680 <div class='row col-12' style=''>";
681 if($thread["ImageURL"] !== null)
682 BoardFunctions::createMediaNodeFromRaw($thread["ImageURL"]);
683 else echo "<img/>";
684 echo "</div>
685 </div>";
686 echo "</div>";
687 //if($thread_counter % $row_size == $row_size - 1) echo "</ul>";
693 else{
694 require_once("class/twitter-connection.php");
696 $twitter_connection = new TwitterConnection();
698 if($display_type == "list" || true){
699 foreach($threads as $thread){
700 $post_id = $thread[0];
702 //if($thread_counter % $row_size == 0) echo"<ul class='row-container" . $list_add ."'>";
703 echo "<div class='container w-50 border p-0 m-4' PostNo='" . $post_id ."'>";
704 //details
705 echo "<div class='border m-0 bg-light'>
706 <div class='col'>
707 <div class='row'>
708 <span>PostNo: " . $post_id ."</span>
709 <span class=''>
710 </div>
711 <div class='row'>
712 <a href='/?thread=" . $post_id . "' class='px-4 py-0'>
713 Open
714 </a>
715 </span>
716 <span class=''>
717 <a href='https://twitter.com/Qazoku/status/". $post_id ."'>
718 Twitter
719 </a>
720 </span>
721 </div>
722 </div>
723 </div>";
724 //contents;
725 echo "<div class='row'>
726 <div class='col-1'></div>
727 <div class='col-10 px-0 py-0'>";
728 echo $twitter_connection->getEmbededTweet($post_id)["html"];
729 echo "</div>
730 <div class='col-1'></div>
731 </div></div>
733 </div>";
734 //if($thread_counter % $row_size == $row_size - 1) echo "</ul>";
739 else{}
743 public static function uploadMedia($filename,$url){
744 echo("<br/>" . $filename . " " . $url . "<br/>");
745 $file_binary = file_get_contents($url);
746 fopen($filename, "w");
747 file_put_contents($filename, $file_binary);