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.

101 lines
4.4 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-2019
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <markjcrane@fusionpbx.com>
  20. */
  21. //process this only one time
  22. if ($domains_processed == 1) {
  23. //get the background images
  24. $relative_path = PROJECT_PATH.'/themes/default/images/backgrounds';
  25. $backgrounds = opendir($_SERVER["DOCUMENT_ROOT"].'/'.$relative_path);
  26. unset($array);
  27. $x = 0;
  28. while (false !== ($file = readdir($backgrounds))) {
  29. if ($file != "." AND $file != "..") {
  30. $ext = pathinfo($file, PATHINFO_EXTENSION);
  31. if ($ext == "png" || $ext == "jpg" || $ext == "jpeg" || $ext == "gif") {
  32. $array[$x]['default_setting_category'] = 'theme';
  33. $array[$x]['default_setting_subcategory'] = 'background_image';
  34. $array[$x]['default_setting_name'] = 'array';
  35. $array[$x]['default_setting_value'] = $relative_path.'/'.$file;
  36. $array[$x]['default_setting_enabled'] = 'false';
  37. $array[$x]['default_setting_description'] = 'Set a relative path or URL within a selected compatible template.';
  38. $x++;
  39. $array[$x]['default_setting_category'] = 'theme';
  40. $array[$x]['default_setting_subcategory'] = 'login_background_image';
  41. $array[$x]['default_setting_name'] = 'array';
  42. $array[$x]['default_setting_value'] = $relative_path.'/'.$file;
  43. $array[$x]['default_setting_enabled'] = 'false';
  44. $array[$x]['default_setting_description'] = 'Set a relative path or URL within a selected compatible template.';
  45. $x++;
  46. }
  47. if ($x > 300) { break; };
  48. }
  49. }
  50. //migrate old default_settings
  51. $sql = "update v_default_settings ";
  52. $sql .= "set default_setting_value = '#fafafa' ";
  53. $sql .= "where default_setting_subcategory = 'message_default_color' ";
  54. $sql .= "and default_setting_value = '#ccffcc' ";
  55. $database = new database;
  56. $database->execute($sql);
  57. unset($sql);
  58. $sql = "update v_default_settings ";
  59. $sql .= "set default_setting_value = '#666' ";
  60. $sql .= "where default_setting_subcategory = 'message_default_background_color' ";
  61. $sql .= "and default_setting_value = '#004200' ";
  62. $database = new database;
  63. $database->execute($sql);
  64. unset($sql);
  65. $sql = "update v_default_settings ";
  66. $sql .= "set default_setting_value = 'true', default_setting_enabled = 'true' ";
  67. $sql .= "where default_setting_subcategory = 'menu_main_icons' ";
  68. $sql .= "and default_setting_value = 'false' ";
  69. $sql .= "and default_setting_enabled = 'false' ";
  70. $database = new database;
  71. $database->execute($sql);
  72. unset($sql);
  73. //replace glyphicon icon with fontawesome icon for default main menu items
  74. $queries[] = "update v_menu_items set menu_item_icon = 'fa-home' where menu_item_icon = 'glyphicon-home' ";
  75. $queries[] = "update v_menu_items set menu_item_icon = 'fa-user' where menu_item_icon = 'glyphicon-user' ";
  76. $queries[] = "update v_menu_items set menu_item_icon = 'fa-exchange-alt' where menu_item_icon = 'glyphicon-transfer' ";
  77. $queries[] = "update v_menu_items set menu_item_icon = 'fa-paper-plane' where menu_item_icon = 'glyphicon-send' ";
  78. $queries[] = "update v_menu_items set menu_item_icon = 'fa-chart-bar' where menu_item_icon = 'glyphicon-equalizer' ";
  79. $queries[] = "update v_menu_items set menu_item_icon = 'fa-cog' where menu_item_icon = 'glyphicon-cog' ";
  80. $queries[] = "update v_menu_items set menu_item_icon = 'fa-sign-out-alt' where menu_item_icon = 'glyphicon-log-out' ";
  81. $queries[] = "update v_menu_items set menu_item_icon = 'fa-sign-in-alt' where menu_item_icon = 'glyphicon-log-in' ";
  82. $queries[] = "update v_menu_items set menu_item_icon = 'fa-external-link-alt' where menu_item_icon = 'glyphicon-new-window' ";
  83. foreach ($queries as $sql) {
  84. $database = new database;
  85. $database->execute($sql);
  86. }
  87. unset($queries, $sql);
  88. }
  89. ?>