admin import uses now msg functions

main
Philip Häusler 11 years ago
parent 7df8b967f3
commit ec4f173a61

@ -30,7 +30,7 @@ function admin_import() {
fclose($test_handle); fclose($test_handle);
unlink('../import/tmp'); unlink('../import/tmp');
} else { } else {
$msg = error("Webserver has no write-permission on import directory.", true); error("Webserver has no write-permission on import directory.");
} }
if (isset ($_REQUEST['submit'])) { if (isset ($_REQUEST['submit'])) {
@ -40,7 +40,7 @@ function admin_import() {
if (!$fp) { if (!$fp) {
$ok = false; $ok = false;
$msg = error("File 'https://$PentabarfXMLhost/$PentabarfXMLpath" . $_REQUEST["url"] . "' not readable!" . "[$errstr ($errno)]", true); error("File 'https://$PentabarfXMLhost/$PentabarfXMLpath" . $_REQUEST["url"] . "' not readable!" . "[$errstr ($errno)]");
} else { } else {
$fileOut = fopen($import_file, "w"); $fileOut = fopen($import_file, "w");
$head = 'GET /' . $PentabarfXMLpath . $_REQUEST["url"] . ' HTTP/1.1' . "\r\n" . $head = 'GET /' . $PentabarfXMLpath . $_REQUEST["url"] . ' HTTP/1.1' . "\r\n" .
@ -86,7 +86,7 @@ function admin_import() {
} }
fclose($fileOut); fclose($fileOut);
fclose($fp); fclose($fp);
$msg .= success("Es wurden $Zeilen Zeilen eingelesen.", true); success("Es wurden $Zeilen Zeilen eingelesen.");
} }
} }
elseif (isset ($_FILES['xcal_file']) && ($_FILES['xcal_file']['error'] == 0)) { elseif (isset ($_FILES['xcal_file']) && ($_FILES['xcal_file']['error'] == 0)) {
@ -94,16 +94,16 @@ function admin_import() {
libxml_use_internal_errors(true); libxml_use_internal_errors(true);
if (simplexml_load_file($import_file) === false) { if (simplexml_load_file($import_file) === false) {
$ok = false; $ok = false;
$msg = error("No valid xml/xcal file provided.", true); error("No valid xml/xcal file provided.");
unlink($import_file); unlink($import_file);
} }
} else { } else {
$ok = false; $ok = false;
$msg = error("File upload went wrong.", true); error("File upload went wrong.");
} }
} else { } else {
$ok = false; $ok = false;
$msg = error("Please provide some data.", true); error("Please provide some data.");
} }
} }
@ -112,7 +112,7 @@ function admin_import() {
else else
$html .= template_render('../templates/admin_import_input.html', array ( $html .= template_render('../templates/admin_import_input.html', array (
'link' => page_link_to('admin_import'), 'link' => page_link_to('admin_import'),
'msg' => $msg, 'msg' => msg(),
'url' => "https://$PentabarfXMLhost/$PentabarfXMLpath" 'url' => "https://$PentabarfXMLhost/$PentabarfXMLpath"
)); ));
break; break;

Loading…
Cancel
Save