Footer.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. require_once($path["entity"] . "Lang.php");
  3. require_once($path["entity"] . "Social.php");
  4. /**
  5. * Page footer.
  6. *
  7. * Used to display the footer in every page.
  8. */
  9. class Footer{
  10. /**
  11. * Array of {@see Social} to display social network links.
  12. */
  13. public $social = [];
  14. /**
  15. * Array of {@see Lang} the page can be served on.
  16. */
  17. public $lang = [];
  18. /**
  19. * Constructor.
  20. *
  21. * Searches the database and populates the social and lang arrays.
  22. *
  23. * @param MySQL_connection $db Connection to the database.
  24. * @param string $lang Lowercase, two-letter language code.
  25. */
  26. public function __construct($db, $lang){
  27. $s_social =
  28. "SELECT id " .
  29. "FROM social " .
  30. "WHERE visible = 1; ";
  31. $q_social = mysqli_query($db, $s_social);
  32. while($r_social = mysqli_fetch_array($q_social)){
  33. array_push($this->social, new Social($db, $lang, $r_social["id"]));
  34. }
  35. $s_lang =
  36. "SELECT code AS id " .
  37. "FROM lang " .
  38. "WHERE active = 1; ";
  39. $q_lang = mysqli_query($db, $s_lang);
  40. while($r_lang = mysqli_fetch_array($q_lang)){
  41. array_push($this->lang, new Lang($db, $r_lang["id"]));
  42. }
  43. }
  44. }
  45. ?>