您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

moduserprefs.sh 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. +-----------------------------------------------------------------------+
  5. | bin/moduserprefs.sh |
  6. | |
  7. | This file is part of the Roundcube Webmail client |
  8. | Copyright (C) 2012-2015, The Roundcube Dev Team |
  9. | |
  10. | Licensed under the GNU General Public License version 3 or |
  11. | any later version with exceptions for skins & plugins. |
  12. | See the README file for a full license statement. |
  13. | |
  14. | PURPOSE: |
  15. | Bulk-change settings stored in user preferences |
  16. +-----------------------------------------------------------------------+
  17. | Author: Thomas Bruederli <roundcube@gmail.com> |
  18. +-----------------------------------------------------------------------+
  19. */
  20. define('INSTALL_PATH', realpath(__DIR__ . '/..') . '/' );
  21. require_once INSTALL_PATH.'program/include/clisetup.php';
  22. function print_usage()
  23. {
  24. print "Usage: moduserprefs.sh [options] pref-name [pref-value]\n";
  25. print "Options:\n";
  26. print " --user=user-id User ID in local database\n";
  27. print " --config=path Location of additional configuration file\n";
  28. print " --delete Unset the given preference\n";
  29. print " --type=type Pref-value type: int, bool, string\n";
  30. }
  31. // get arguments
  32. $args = rcube_utils::get_opt(array(
  33. 'u' => 'user',
  34. 'd' => 'delete:bool',
  35. 't' => 'type',
  36. 'c' => 'config',
  37. ));
  38. if ($_SERVER['argv'][1] == 'help') {
  39. print_usage();
  40. exit;
  41. }
  42. else if (empty($args[0]) || (empty($args[1]) && empty($args['delete']))) {
  43. print "Missing required parameters.\n";
  44. print_usage();
  45. exit;
  46. }
  47. $pref_name = trim($args[0]);
  48. $pref_value = $args['delete'] ? null : trim($args[1]);
  49. if ($pref_value === null) {
  50. $args['type'] = null;
  51. }
  52. if ($args['config']) {
  53. $rcube = rcube::get_instance();
  54. $rcube->config->load_from_file($args['config']);
  55. }
  56. rcmail_utils::mod_pref($pref_name, $pref_value, $args['user'], $args['type']);
  57. ?>