app_defaults.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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-2019
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <[email protected]>
  20. */
  21. //process this only one time
  22. if ($domains_processed == 1) {
  23. //update any users set to legacy languages
  24. $language = new text;
  25. foreach ($language->legacy_map as $language_code => $legacy_code) {
  26. if (strlen($legacy_code) == 5) {
  27. continue;
  28. }
  29. $sql = "update v_user_settings set user_setting_value = :language_code ";
  30. $sql .= "where user_setting_value = :legacy_code ";
  31. $sql .= "and user_setting_name = 'code' ";
  32. $sql .= "and user_setting_subcategory = 'language' ";
  33. $sql .= "and user_setting_category = 'domain'";
  34. $parameters['language_code'] = $language_code;
  35. $parameters['legacy_code'] = $legacy_code;
  36. $database->execute($sql, $parameters);
  37. unset($sql, $parameters);
  38. }
  39. //migrate old user_settings
  40. $sql = "update v_user_settings ";
  41. $sql .= "set user_setting_value = '#fafafa' ";
  42. $sql .= "where user_setting_subcategory = 'message_default_color' ";
  43. $sql .= "and user_setting_value = '#ccffcc' ";
  44. $database->execute($sql, null);
  45. unset($sql);
  46. $sql = "update v_user_settings ";
  47. $sql .= "set user_setting_value = '#666' ";
  48. $sql .= "where user_setting_subcategory = 'message_default_background_color' ";
  49. $sql .= "and user_setting_value = '#004200' ";
  50. $database->execute($sql, null);
  51. unset($sql);
  52. }
  53. ?>