public function __prepareIndex()
 {
     header('content-type: text/plain');
     $this->_fields = @$_REQUEST['fields'];
     $importManager = new ImportManager($this->_Parent);
     $this->_importers = $importManager->listAll();
     // Import now?
     foreach ($this->_importers as $importer) {
         $importer = (object) $importer;
         if (isset($_GET[$importer->handle])) {
             $this->_fields['importer'] = $importer->handle;
             $this->_fields['source'] = $_GET[$importer->handle];
             $this->_importer = $importManager->create($this->_fields['importer']);
             $this->__actionIndex();
             return;
         }
     }
     if ($this->_fields['importer']) {
         $this->_importer = $importManager->create($this->_fields['importer']);
     }
 }
 public function __prepareIndex()
 {
     $manager = new ImportManager();
     $this->_importers = $manager->listAll();
 }
Ejemplo n.º 3
0
if (@ini_get('session.save_handler') == 'user') {
    @ini_set('session.save_handler', 'files');
}
@session_start();
// Add slashes, as long as they aren't already being added.
if (function_exists('get_magic_quotes_gpc') && @get_magic_quotes_gpc() != 0) {
    $_POST = stripslashes_recursive($_POST);
}
$config = new Configurator();
$config->lang_dir = BASEDIR . '/Languages';
try {
    $lng = new Lang();
    $lng->loadLang($config->lang_dir);
} catch (Exception $e) {
    ImportException::exception_handler($e);
}
$template = new Template($lng);
global $import;
$importer = new Importer($config, $lng, $template);
$response = new HttpResponse(new ResponseHeader());
$template->setResponse($response);
$import = new ImportManager($config, $importer, $template, new Cookie(), $response);
try {
    $import->process();
} catch (Exception $e) {
    // Debug, remember to remove before PR
    echo '<br>' . $e->getMessage() . '<br>';
    echo $e->getFile() . '<br>';
    echo $e->getLine() . '<br>';
    // If an error is not catched, it means it's fatal and the script should die.
}