| 1 |
<?php |
<?php |
| 2 |
// $Id: $ |
// $Id: bookimport.module,v 1.3 2006/01/27 06:45:17 puregin Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 186 |
|
|
| 187 |
} |
} |
| 188 |
$form['#method'] = 'post'; |
$form['#method'] = 'post'; |
| 189 |
$form['#action'] = 'import/book'; |
$form['#action'] = url('import/book'); |
| 190 |
$form['#attributes'] = array("enctype" => "multipart/form-data"); |
$form['#attributes'] = array("enctype" => "multipart/form-data"); |
| 191 |
$output = drupal_get_form('bookimport_page_xml', $form); |
$output = drupal_get_form('bookimport_page_xml', $form); |
| 192 |
|
|
| 206 |
*/ |
*/ |
| 207 |
function bookimport_importxml() { |
function bookimport_importxml() { |
| 208 |
define('DEBUG', 0); |
define('DEBUG', 0); |
| 209 |
|
|
| 210 |
|
$edit = $_POST['edit']; |
| 211 |
|
$op = _bookimport_form_radio2text(); |
| 212 |
|
|
| 213 |
if (DEBUG > 0) { |
if (DEBUG > 0) { |
| 214 |
print "<pre>"; |
print "<pre>"; |
| 215 |
print "Op = $op<br />"; |
print "Op = $op<br />"; |
| 216 |
} |
} |
| 217 |
|
|
|
$edit = $_POST['edit']; |
|
|
$op = _bookimport_form_radio2text(); |
|
|
|
|
|
|
|
|
|
|
| 218 |
$fileh = file_check_upload('xml_upload'); |
$fileh = file_check_upload('xml_upload'); |
| 219 |
$xmlfile = $fileh->filepath; |
$xmlfile = $fileh->filepath; |
|
|
|
|
// global hash provides mapping from old nid to new |
|
|
$new_nid = array(); |
|
|
$parent_of = array(); |
|
| 220 |
|
|
| 221 |
// Create the XML parser |
// Create the XML parser |
| 222 |
if (!$xml = xml_parser_create()) { |
if (!$xml = xml_parser_create()) { |
| 254 |
// Clean up |
// Clean up |
| 255 |
xml_parser_free($xml); |
xml_parser_free($xml); |
| 256 |
|
|
| 257 |
make_links($parent_of, $new_nid); |
make_links(); |
| 258 |
|
|
| 259 |
if (DEBUG > 1) { |
if (DEBUG > 1) { |
| 260 |
print "</pre>"; |
print "</pre>"; |