| 1 | <?php |
| 2 | /* |
| 3 | +--------------------------------------------------------------------+ |
| 4 | | Copyright CiviCRM LLC. All rights reserved. | |
| 5 | | | |
| 6 | | Use of this source code is governed by the AGPL license with some | |
| 7 | | permitted exceptions and without any warranty. For full license | |
| 8 | | and copyright information, see https://civicrm.org/licensing | |
| 9 | +--------------------------------------------------------------------+ |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * |
| 14 | * @package CRM |
| 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
| 16 | */ |
| 17 | function run() { |
| 18 | session_start(); |
| 19 | |
| 20 | if (!array_key_exists('file', $_GET) || |
| 21 | empty($_GET['file']) |
| 22 | ) { |
| 23 | echo "Please send an input file to import<p>"; |
| 24 | exit(); |
| 25 | } |
| 26 | |
| 27 | require_once '../../civicrm.config.php'; |
| 28 | require_once 'CRM/Core/Config.php'; |
| 29 | $config = CRM_Core_Config::singleton(); |
| 30 | |
| 31 | // this does not return on failure |
| 32 | CRM_Utils_System::authenticateScript(TRUE); |
| 33 | if (!CRM_Core_Permission::check('administer CiviCRM')) { |
| 34 | CRM_Utils_System::authenticateAbort("User does not have required permission (administer CiviCRM).\n", TRUE); |
| 35 | } |
| 36 | |
| 37 | require_once 'CRM/Utils/Migrate/Import.php'; |
| 38 | $import = new CRM_Utils_Migrate_Import(); |
| 39 | |
| 40 | $import->run($_GET['file']); |
| 41 | |
| 42 | echo "Import Done!"; |
| 43 | } |
| 44 | |
| 45 | run(); |