contact_settings.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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-2024
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <[email protected]>
  20. Luis Daniel Lucio Quiroz <[email protected]>
  21. */
  22. //includes files
  23. require_once dirname(__DIR__, 2) . "/resources/require.php";
  24. require_once "resources/check_auth.php";
  25. //check permissions
  26. if (permission_exists('contact_setting_view')) {
  27. //access granted
  28. }
  29. else {
  30. echo "access denied";
  31. exit;
  32. }
  33. //set from session variables
  34. $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
  35. //get the list
  36. $sql = "select * from v_contact_settings ";
  37. $sql .= "where domain_uuid = :domain_uuid ";
  38. $sql .= "and contact_uuid = :contact_uuid ";
  39. $sql .= "order by ";
  40. $sql .= "contact_setting_category asc ";
  41. $sql .= ", contact_setting_subcategory asc ";
  42. $sql .= ", contact_setting_order asc ";
  43. $parameters['domain_uuid'] = $domain_uuid;
  44. $parameters['contact_uuid'] = $contact_uuid ?? '';
  45. $database = new database;
  46. $contact_settings = $database->select($sql, $parameters, 'all');
  47. unset($sql, $parameters);
  48. //show if exists
  49. if (!empty($contact_settings)) {
  50. //show the content
  51. echo "<div class='action_bar sub shrink'>\n";
  52. echo " <div class='heading'><b>".$text['label-contact_settings']."</b></div>\n";
  53. echo " <div style='clear: both;'></div>\n";
  54. echo "</div>\n";
  55. echo "<div class='card'>\n";
  56. echo "<table class='list'>\n";
  57. echo "<tr class='list-header'>\n";
  58. if (permission_exists('contact_setting_delete')) {
  59. echo " <th class='checkbox'>\n";
  60. echo " <input type='checkbox' id='checkbox_all_settings' name='checkbox_all' onclick=\"edit_all_toggle('settings');\" ".($contact_settings ?: "style='visibility: hidden;'").">\n";
  61. echo " </th>\n";
  62. }
  63. echo "<th class='pct-15'>".$text['label-contact_setting_category']."</th>";
  64. echo "<th>".$text['label-contact_setting_subcategory']."</th>";
  65. echo "<th>".$text['label-contact_setting_type']."</th>";
  66. echo "<th>".$text['label-contact_setting_value']."</th>";
  67. echo "<th class='center'>".$text['label-enabled']."</th>";
  68. echo "<th class='hide-md-dn'>".$text['label-description']."</th>";
  69. if (permission_exists('contact_setting_edit') && $list_row_edit_button == 'true') {
  70. echo " <td class='action-button'>&nbsp;</td>\n";
  71. }
  72. echo "</tr>\n";
  73. if (!empty($contact_settings)) {
  74. $x = 0;
  75. foreach ($contact_settings as $row) {
  76. if (permission_exists('contact_setting_edit')) {
  77. $list_row_url = "contact_setting_edit.php?contact_uuid=".urlencode($contact_uuid)."&id=".urlencode($row['contact_setting_uuid']);
  78. }
  79. echo "<tr class='list-row' href='".$list_row_url."'>\n";
  80. if (permission_exists('contact_setting_delete')) {
  81. echo " <td class='checkbox'>\n";
  82. echo " <input type='checkbox' name='contact_settings[$x][checked]' id='checkbox_".$x."' class='chk_delete checkbox_settings' value='true' onclick=\"edit_delete_action('settings');\">\n";
  83. echo " <input type='hidden' name='contact_settings[$x][uuid]' value='".escape($row['contact_setting_uuid'])."' />\n";
  84. echo " </td>\n";
  85. }
  86. echo " <td>".escape($row['contact_setting_category'])."&nbsp;</td>\n";
  87. echo " <td><a href='".$list_row_url."'>".escape($row['contact_setting_subcategory'])."</a></td>\n";
  88. echo " <td>".escape($row['contact_setting_name'])."&nbsp;</td>\n";
  89. echo " <td>\n";
  90. $category = escape($row['contact_setting_category']);
  91. $subcategory = escape($row['contact_setting_subcategory']);
  92. $name = escape($row['contact_setting_name']);
  93. if ($category == "callingcard" && $subcategory == "username" && $name == "var" ) {
  94. echo " ********\n";
  95. }
  96. else if ($category == "callingcard" && $subcategory == "password" && $name == "var" ) {
  97. echo " ********\n";
  98. }
  99. else {
  100. echo escape($row['contact_setting_value']);
  101. }
  102. echo " </td>\n";
  103. echo " <td class='center'>".$text['label-'.escape($row['contact_setting_enabled'])]."&nbsp;</td>\n";
  104. echo " <td class='description overflow hide-md-dn'>".$row['contact_setting_description']."&nbsp;</td>\n";
  105. if (permission_exists('contact_setting_edit') && $list_row_edit_button == 'true') {
  106. echo " <td class='action-button'>\n";
  107. echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
  108. echo " </td>\n";
  109. }
  110. echo "</tr>\n";
  111. $x++;
  112. }
  113. unset($contact_settings);
  114. }
  115. echo "</table>";
  116. echo "</div>\n";
  117. echo "<br />\n";
  118. }
  119. ?>