Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
6b7eb9df | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 5 | | | |
6b7eb9df TO |
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 | | |
6a488035 | 9 | +--------------------------------------------------------------------+ |
d25dd0ee | 10 | */ |
6a488035 TO |
11 | |
12 | /** | |
13 | * | |
14 | * @package CRM | |
ca5cec67 | 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
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); | |
202e2654 TO |
33 | if (!CRM_Core_Permission::check('administer CiviCRM')) { |
34 | CRM_Utils_System::authenticateAbort("User does not have required permission (administer CiviCRM).\n", TRUE); | |
35 | } | |
6a488035 TO |
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(); |