Fork of FusionPBX but with LDAP kinda working
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

149 lines
4.7 KiB

2 years ago
  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 <markjcrane@fusionpbx.com>
  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 <markjcrane@fusionpbx.com>
  20. */
  21. //includes
  22. include "root.php";
  23. require_once "resources/require.php";
  24. //if reloadxml then run the command
  25. if (permission_exists('dialplan_edit') && isset($_SESSION["reload_xml"])) {
  26. if (strlen($_SESSION["reload_xml"]) > 0) {
  27. if ($_SESSION['apply_settings'] == "true") {
  28. //show the apply settings prompt
  29. }
  30. else {
  31. //create the event socket connection
  32. $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
  33. //reload the access control list this also runs reloadxml
  34. $response = event_socket_request($fp, 'api reloadxml');
  35. $_SESSION["reload_xml"] = '';
  36. unset($_SESSION["reload_xml"]);
  37. usleep(500);
  38. //clear the apply settings reminder
  39. $_SESSION["reload_xml"] = false;
  40. }
  41. }
  42. }
  43. //set the template base directory path
  44. $template_base_path = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
  45. //check if the template exists if it is missing then use the default
  46. if (!file_exists($template_base_path.'/'.$_SESSION['domain']['template']['name'].'/template.php')) {
  47. $_SESSION['domain']['template']['name'] = 'default';
  48. }
  49. //start the output buffer
  50. include $template_base_path.'/'.$_SESSION['domain']['template']['name'].'/config.php';
  51. //start the output buffer
  52. ob_start();
  53. // get the content
  54. if (isset($_GET["c"])) {
  55. $content = $_GET["c"]; //link
  56. }
  57. else {
  58. $content = '';
  59. }
  60. //get the parent id
  61. $sql = "select menu_item_parent_uuid from v_menu_items ";
  62. $sql .= "where menu_uuid = :menu_uuid ";
  63. $sql .= "and menu_item_link = :menu_item_link ";
  64. $parameters['menu_uuid'] = $_SESSION['domain']['menu']['uuid'];
  65. $parameters['menu_item_link'] = $_SERVER["SCRIPT_NAME"];
  66. $database = new database;
  67. $_SESSION["menu_item_parent_uuid"] = $database->select($sql, $parameters, 'column');
  68. unset($sql, $parameters);
  69. //get the content
  70. if (file_exists($_SERVER["PROJECT_ROOT"]."/app/content/app_config.php")) {
  71. $sql = "select * from v_rss ";
  72. $sql .= "where domain_uuid = :domain_uuid ";
  73. $sql .= "and rss_category = 'content' ";
  74. $sql .= "and rss_link = :content ";
  75. $sql .= "and ( ";
  76. $sql .= "length(rss_del_date) = 0 ";
  77. $sql .= "or rss_del_date is null ";
  78. $sql .= ") ";
  79. $sql .= "order by rss_order asc ";
  80. $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
  81. $parameters['content'] = strlen($content) == 0 ? $_SERVER["PHP_SELF"] : $content;
  82. $database = new database;
  83. $content_result = $database->select($sql, $parameters, 'all');
  84. if (is_array($content_result) && @sizeof($content_result) != 0) {
  85. foreach($content_result as $content_row) {
  86. $template_rss_sub_category = $content_row['rss_sub_category'];
  87. if (strlen($content_row['rss_group']) == 0) {
  88. //content is public
  89. $content_from_db = &$content_row['rss_description'];
  90. if (strlen($content_row['rss_title']) > 0) {
  91. $page["title"] = $content_row['rss_title'];
  92. }
  93. }
  94. else {
  95. if (if_group($content_row[rss_group])) { //viewable only to designated group
  96. $content_from_db = &$content_row[rss_description];
  97. if (strlen($content_row['rss_title']) > 0) {
  98. $page["title"] = $content_row['rss_title'];
  99. }
  100. }
  101. }
  102. }
  103. }
  104. unset($sql, $parameters, $content_result, $content_row);
  105. }
  106. //button css class and styles
  107. $button_icon_class = '';
  108. $button_icon_style = 'padding: 3px;';
  109. $button_label_class = 'button-label';
  110. $button_label_style = 'padding-left: 5px; padding-right: 3px;';
  111. $button_icons = $_SESSION['theme']['button_icons']['text'];
  112. switch ($button_icons) {
  113. case 'auto':
  114. $button_label_class .= ' hide-md-dn';
  115. break;
  116. case 'only':
  117. $button_label_style .= ' display: none;';
  118. break;
  119. case 'never':
  120. $button_icon_class .= ' display: none;';
  121. break;
  122. case 'always':
  123. break;
  124. }
  125. //start the output buffer
  126. ob_start();
  127. //for translate tool (if available)
  128. if (file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/translate")) {
  129. require_once("app/translate/translate_header.php");
  130. }
  131. ?>