Beispiel #1
0
        $smarty->assign('wordpressUrls', $_SESSION['tiki_importer_wordpress_urls']);
        unset($_SESSION['tiki_importer_wordpress_urls']);
    }
} else {
    if (!empty($_FILES['importFile'])) {
        // third step: start the importing process
        if ($_FILES['importFile']['error'] === UPLOAD_ERR_OK) {
            try {
                $importer->import($_FILES['importFile']['tmp_name']);
            } catch (Exception $e) {
                $smarty->assign('msg', $e->getMessage());
                $smarty->display('error.tpl');
                die;
            }
        } else {
            $msg = TikiImporter::displayPhpUploadError($_FILES['importFile']['error']);
            $smarty->assign('msg', $msg);
            $smarty->display('error.tpl');
            die;
        }
        die;
    } else {
        if (!empty($_POST['importerClassName'])) {
            // second step: display import options for the software previously chosen
            if (!class_exists($importerClassName)) {
                $smarty->assign('msg', tra("Invalid software name"));
                $smarty->display("error.tpl");
                die;
            }
            try {
                $importer->checkRequirements();
 public function testDisplayPhpUploadError()
 {
     $this->assertNull(TikiImporter::displayPhpUploadError(-1), 'Should return null if invalid code passed as param');
     $this->assertEquals('No file was uploaded.', TikiImporter::displayPhpUploadError(4));
 }