/**
  * Generate module
  */
 protected function compile()
 {
     // Create files
     if (\Input::post('FORM_SUBMIT') == 'tl_entity_import') {
         $objModel = EntityImportConfigModel::findByPk($this->objDc->id);
         if ($objModel === null) {
             return;
         }
         if (class_exists($objModel->importerClass)) {
             // use a particular importer (e.g. NewsImporter)
             \Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_entity_import_config']['importerInfo'], $objModel->importerClass));
             $importer = new $objModel->importerClass($objModel);
         } else {
             \Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_entity_import_config']['importerInfo'], 'Importer'));
             $importer = new Importer($objModel);
         }
         if ($importer->run(\Input::post('dry-run'))) {
             // Confirm and reload
             $strMessage = $GLOBALS['TL_LANG']['tl_entity_import_config']['confirm'];
             if (\Input::post('dry-run')) {
                 $strMessage = $GLOBALS['TL_LANG']['tl_entity_import_config']['confirmDry'];
             }
             \Message::addConfirmation($strMessage);
             \Controller::reload();
         }
     }
     $this->Template->base = \Environment::get('base');
     $this->Template->href = \Controller::getReferer(true);
     $this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']);
     $this->Template->action = ampersand(\Environment::get('request'));
     $this->Template->selectAll = $GLOBALS['TL_LANG']['MSC']['selectAll'];
     $this->Template->button = $GLOBALS['TL_LANG']['MSC']['backBT'];
     $this->Template->message = \Message::generate();
     $this->Template->submit = specialchars($GLOBALS['TL_LANG']['tl_entity_import_config']['import'][0]);
     $this->Template->dryRun = specialchars($GLOBALS['TL_LANG']['tl_entity_import_config']['dryRun'][0]);
     $this->Template->headline = sprintf($GLOBALS['TL_LANG']['tl_entity_import_config']['headline'], \Input::get('id'));
     $this->Template->explain = $GLOBALS['TL_LANG']['tl_entity_import_config']['make'][1];
     $this->Template->label = $GLOBALS['TL_LANG']['tl_entity_import_config']['label'];
 }
Exemplo n.º 2
0
    global $ekos_host, $ekos_db, $ekos_user, $ekos_pwd, $user_maclabel;
    $conn_pg = pg_connect("host='{$ekos_host}' dbname={$ekos_db} user={$ekos_user} password={$ekos_pwd}") or die("error on connection to {$ekos_db}");
    if ($user_maclabel) {
        pg_query($conn_pg, "set ac_session_maclabel = '" . $user_maclabel . "';") or die('<error>unable to set session maclabel</error>');
        pg_query($conn_pg, $sql) or die("<error>unable to run query: {$sql}</error>");
    }
}
if ($user_group['name'] !== $admin_group) {
    error(0);
    exit;
}
$method = $_GET['method'];
if ($method == 'import') {
    if ($_FILES['file']['error'] == UPLOAD_ERR_OK) {
        if (move_uploaded_file($_FILES['file']['tmp_name'], dirname(__FILE__) . "/data/dump.xml")) {
            if (Importer::run(dirname(__FILE__) . "/data/dump.xml")) {
                Importer::log("import", $_FILES['file']['name'], $_FILES['file']['size']);
                header('Location: index.php?success=1');
            } else {
                error(1);
            }
        } else {
            error(2);
        }
    } else {
        error(3);
    }
} elseif ($method == 'extract') {
    if ($_FILES['file']['error'] == UPLOAD_ERR_OK) {
        if (in_array($_FILES['file']['type'], array('application/zip', 'application/x-zip-compressed', 'multipart/x-zip', 'application/x-compressed'))) {
            if (move_uploaded_file($_FILES['file']['tmp_name'], dirname(__FILE__) . "/data/data.zip")) {
Exemplo n.º 3
0
    }
    define('IMPORTER_LIST', implode(',', $importerList));
    return true;
}
try {
    checkPhpVersion();
    if (file_exists(__DIR__ . '/config.php')) {
        require_once __DIR__ . '/config.php';
    }
    while (!defined('WP_PATH')) {
        getWpPath();
    }
    while (!defined('PBOOST_PATH')) {
        getPhpBoostPath();
    }
    while (!defined('IMPORTER_LIST')) {
        getImporterList();
    }
    // Récupération de la configuration par défaut
    $defaultConfig = (require_once __DIR__ . '/config-default.php');
    foreach ($defaultConfig as $key => $value) {
        if (!defined($key)) {
            define($key, $value);
        }
    }
    Importer::run($io, WP_PATH, PBOOST_PATH, explode(',', IMPORTER_LIST));
    return true;
} catch (Exception $e) {
    $io->writeln($e->getMessage());
    return false;
}
Exemplo n.º 4
0
<?php

//Import
if (isset($_GET['q']) && $_GET['q'] == 'import') {
    include_once 'classes/Importer.php';
    $imp = new Importer();
    $imp->run();
    exit(0);
}
//Test if LODSPeaKr is configured
if (!file_exists('settings.inc.php')) {
    echo 'Need to configure lodspeakr first. Please run "install.sh". Alternatively, you can <a href="import">import an existing application</a>';
    exit(0);
}
include_once 'common.inc.php';
//Debug output
$conf['logfile'] = null;
if ($conf['debug']) {
    include_once 'classes/Logging.php';
    if (isset($_GET['q']) && $_GET['q'] == 'logs') {
        Logging::init();
        exit(0);
    } else {
        $conf['logfile'] = Logging::createLogFile($_GET['q']);
        //error_reporting(E_ALL);
    }
} else {
    error_reporting(E_ERROR);
}
include_once 'classes/HTTPStatus.php';
include_once 'classes/Utils.php';