Page.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. require_once($path["entity"] . "Lang.php");
  3. /**
  4. * Page superclass.
  5. *
  6. * Every visitable page type must inherit from this one.
  7. */
  8. abstract class Page{
  9. /**
  10. * Database connection.
  11. */
  12. public $db;
  13. /**
  14. * View associated with the page.
  15. */
  16. public $view;
  17. /**
  18. * Language the page will be served on (lowercase, two-letter
  19. * language code).
  20. */
  21. public $lang;
  22. /**
  23. * List of available {@see Lang}uages (lowercase, two-letter language code).
  24. */
  25. public $available_langs = [];
  26. /**
  27. * Title of the page, in the defined language.
  28. */
  29. public $title;
  30. /**
  31. * Site name.
  32. */
  33. public $name;
  34. /**
  35. * Page description, in the defined language.
  36. */
  37. public $description;
  38. /**
  39. * Path to the site favicon.
  40. */
  41. public $favicon;
  42. /**
  43. * Path to the page icon or main image.
  44. */
  45. public $icon;
  46. /**
  47. * Canonical URL.
  48. */
  49. public $canonical;
  50. /**
  51. * Author URL.
  52. */
  53. public $author;
  54. /**
  55. * Constructor.
  56. *
  57. * @param MySQL_connection $db Connection to the database.
  58. * @param string $lang Lowercase, two-letter language code.
  59. */
  60. public function __construct($db, $lang){
  61. global $static;
  62. global $base_url;
  63. $this->db = $db;
  64. $this->lang = $lang;
  65. $s_lang =
  66. "SELECT code AS id " .
  67. "FROM lang " .
  68. "WHERE active = 1; ";
  69. $q_lang = mysqli_query($db, $s_lang);
  70. while($r_lang = mysqli_fetch_array($q_lang)){
  71. array_push($this->available_langs, new Lang($db, $r_lang["id"]));
  72. }
  73. $this->favicon = $static["layout"] . "logo/logo.svg";
  74. $this->icon = $static["layout"] . "logo/logo.svg";
  75. $this->name = text($this, "USER_NAME");
  76. $this->author = $base_url;
  77. $this->name = text($this, "USER_NAME");
  78. }
  79. }
  80. ?>