header.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <?php
  2. /*
  3. FusionPBX
  4. Version: MPL 1.1
  5. The contents of this file are subject to the Mozilla Public License Version
  6. 1.1 (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.mozilla.org/MPL/
  9. Software distributed under the License is distributed on an "AS IS" basis,
  10. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. for the specific language governing rights and limitations under the
  12. License.
  13. The Original Code is FusionPBX
  14. The Initial Developer of the Original Code is
  15. Mark J Crane <[email protected]>
  16. Portions created by the Initial Developer are Copyright (C) 2008-2020
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <[email protected]>
  20. */
  21. //includes files
  22. require_once __DIR__ . "/require.php";
  23. //if reloadxml then run the command
  24. if (permission_exists('dialplan_edit') && isset($_SESSION["reload_xml"])) {
  25. if (!empty($_SESSION["reload_xml"])) {
  26. if (isset($_SESSION['apply_settings']) && $_SESSION['apply_settings'] == "true") {
  27. //show the apply settings prompt
  28. }
  29. else {
  30. //create the event socket connection
  31. $esl = event_socket::create();
  32. //reload the access control list this also runs reloadxml
  33. $response = event_socket::api('reloadxml');
  34. $_SESSION["reload_xml"] = '';
  35. unset($_SESSION["reload_xml"]);
  36. usleep(500);
  37. //clear the apply settings reminder
  38. $_SESSION["reload_xml"] = false;
  39. }
  40. }
  41. }
  42. //set the template base directory path
  43. $template_base_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
  44. //check if the template exists if it is missing then use the default
  45. if (!file_exists($template_base_path.'/'.$_SESSION['domain']['template']['name'].'/template.php')) {
  46. $_SESSION['domain']['template']['name'] = 'default';
  47. }
  48. //start the output buffer
  49. include $template_base_path.'/'.$_SESSION['domain']['template']['name'].'/config.php';
  50. //start the output buffer
  51. ob_start();
  52. // get the content
  53. if (isset($_GET["c"])) {
  54. $content = $_GET["c"]; //link
  55. }
  56. else {
  57. $content = '';
  58. }
  59. //get the parent id
  60. $sql = "select menu_item_parent_uuid from v_menu_items ";
  61. $sql .= "where menu_uuid = :menu_uuid ";
  62. $sql .= "and menu_item_link = :menu_item_link ";
  63. $parameters['menu_uuid'] = $_SESSION['domain']['menu']['uuid'];
  64. $parameters['menu_item_link'] = $_SERVER["SCRIPT_NAME"];
  65. $database = new database;
  66. $_SESSION["menu_item_parent_uuid"] = $database->select($sql, $parameters, 'column');
  67. unset($sql, $parameters);
  68. //get the content
  69. if (file_exists($_SERVER["PROJECT_ROOT"]."/app/content/app_config.php")) {
  70. $sql = "select * from v_rss ";
  71. $sql .= "where domain_uuid = :domain_uuid ";
  72. $sql .= "and rss_category = 'content' ";
  73. $sql .= "and rss_link = :content ";
  74. $sql .= "and ( ";
  75. $sql .= "length(rss_del_date) = 0 ";
  76. $sql .= "or rss_del_date is null ";
  77. $sql .= ") ";
  78. $sql .= "order by rss_order asc ";
  79. $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
  80. $parameters['content'] = empty($content) ? $_SERVER["PHP_SELF"] : $content;
  81. $database = new database;
  82. $content_result = $database->select($sql, $parameters, 'all');
  83. if (is_array($content_result) && @sizeof($content_result) != 0) {
  84. foreach($content_result as $content_row) {
  85. $template_rss_sub_category = $content_row['rss_sub_category'];
  86. if (empty($content_row['rss_group'])) {
  87. //content is public
  88. $content_from_db = &$content_row['rss_description'];
  89. if (!empty($content_row['rss_title'])) {
  90. $page["title"] = $content_row['rss_title'];
  91. }
  92. }
  93. else {
  94. if (if_group($content_row[rss_group])) { //viewable only to designated group
  95. $content_from_db = &$content_row[rss_description];
  96. if (!empty($content_row['rss_title'])) {
  97. $page["title"] = $content_row['rss_title'];
  98. }
  99. }
  100. }
  101. }
  102. }
  103. unset($sql, $parameters, $content_result, $content_row);
  104. }
  105. //button css class and styles
  106. $button_icon_class = '';
  107. $button_icon_style = 'padding: 3px;';
  108. $button_label_class = 'button-label';
  109. $button_label_style = 'padding-left: 5px; padding-right: 3px;';
  110. $button_icons = (!empty($_SESSION['theme']['button_icons']['text'])) ? $button_icons = $_SESSION['theme']['button_icons']['text'] : '';
  111. switch ($button_icons) {
  112. case 'auto':
  113. $button_label_class .= ' hide-md-dn';
  114. break;
  115. case 'only':
  116. $button_label_style .= ' display: none;';
  117. break;
  118. case 'never':
  119. $button_icon_class .= ' display: none;';
  120. break;
  121. case 'always':
  122. break;
  123. }
  124. //start the output buffer
  125. ob_start();
  126. //for translate tool (if available)
  127. if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/translate/translate_header.php")) {
  128. require_once("app/translate/translate_header.php");
  129. }
  130. ?>