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
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

56 rindas
2.2 KiB

  1. <?php
  2. /**
  3. * upload.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__ . "/../config.php");
  24. require_once(__DIR__ . "/helper.php");
  25. require_once(__DIR__ . '/../../../init.php');
  26. require_once(__DIR__ . "/../../../server/includes/core/class.webappauthentication.php"); // for checking the session
  27. use contactimporter\Helper;
  28. // disable error printing - otherwise json communication might break...
  29. ini_set('display_errors', '0');
  30. // check session
  31. // otherwise a DOS attack might be possible
  32. if (!WebAppAuthentication::getUserName() || WebAppAuthentication::getUserName() == "") {
  33. Helper::respondJSON(array('success' => false, 'error' => dgettext("plugin_contactimporter", "Not authenticated!")));
  34. die();
  35. }
  36. if (is_readable($_FILES['vcfdata']['tmp_name'])) {
  37. $dstPath = PLUGIN_CONTACTIMPORTER_TMP_UPLOAD;
  38. $dstPath .= $_FILES['vcfdata']['name'] . Helper::randomstring();
  39. $result = move_uploaded_file($_FILES['vcfdata']['tmp_name'], $dstPath);
  40. if ($result) {
  41. Helper::respondJSON(array('success' => true, 'vcf_file' => $dstPath));
  42. } else {
  43. Helper::respondJSON(array('success' => false, 'error' => dgettext("plugin_contactimporter", "File could not be moved to TMP path! Check plugin config and folder permissions!")));
  44. }
  45. } else {
  46. Helper::respondJSON(array('success' => false, 'error' => dgettext("plugin_contactimporter", "File could not be read by server, upload error!")));
  47. }