The contact importer and exporter plugin for the Kopano WebApp. See here for more details: https://community.zarafa.com/pg/plugins/project/20393/developer/h44z/webapp-contact-importer
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.

93 lines
2.8KB

  1. <?php
  2. /**
  3. * plugin.contactimporter.php, Kopano Webapp contact to vcf im/exporter
  4. *
  5. * Author: Christoph Haas <christoph.h@sprinternet.at>
  6. * Copyright (C) 2012-2018 Christoph Haas
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with this library; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. *
  22. */
  23. require_once(__DIR__ . "/download.php");
  24. /**
  25. * contactimporter Plugin
  26. *
  27. * With this plugin you can import a vcf file to your zarafa addressbook
  28. *
  29. */
  30. class Plugincontactimporter extends Plugin
  31. {
  32. /**
  33. * Constructor
  34. */
  35. function __construct()
  36. {
  37. }
  38. /**
  39. * Function initializes the Plugin and registers all hooks
  40. *
  41. * @return void
  42. */
  43. function init()
  44. {
  45. $this->registerHook('server.core.settings.init.before');
  46. $this->registerHook('server.index.load.custom');
  47. }
  48. /**
  49. * Function is executed when a hook is triggered by the PluginManager
  50. *
  51. * @param string $eventID the id of the triggered hook
  52. * @param mixed $data object(s) related to the hook
  53. * @return void
  54. */
  55. function execute($eventID, &$data)
  56. {
  57. switch ($eventID) {
  58. case 'server.core.settings.init.before' :
  59. $this->injectPluginSettings($data);
  60. break;
  61. case 'server.index.load.custom':
  62. if ($data['name'] == 'download_vcf') {
  63. DownloadHandler::doDownload();
  64. }
  65. break;
  66. }
  67. }
  68. /**
  69. * Called when the core Settings class is initialized and ready to accept sysadmin default
  70. * settings.
  71. * @param [] $data Reference to the data of the triggered hook
  72. */
  73. function injectPluginSettings(&$data)
  74. {
  75. $data['settingsObj']->addSysAdminDefaults(Array(
  76. 'zarafa' => Array(
  77. 'v1' => Array(
  78. 'plugins' => Array(
  79. 'contactimporter' => Array(
  80. 'enable' => PLUGIN_CONTACTIMPORTER_USER_DEFAULT_ENABLE,
  81. 'default_addressbook' => PLUGIN_CONTACTIMPORTER_DEFAULT
  82. )
  83. )
  84. )
  85. )
  86. ));
  87. }
  88. }