From cbc3f1db69ce4fe4848646a74ab75a6434affb6e Mon Sep 17 00:00:00 2001 From: Adam Zammit Date: Mon, 25 Sep 2017 10:45:58 +1000 Subject: [PATCH] Missing update sample added --- admin/updatesample.php | 140 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 admin/updatesample.php diff --git a/admin/updatesample.php b/admin/updatesample.php new file mode 100644 index 00000000..cbc5341d --- /dev/null +++ b/admin/updatesample.php @@ -0,0 +1,140 @@ + " . T_("Go back") . ""; + + $import_id = intval($_POST['import_id']); + + $tmpfname = tempnam(TEMPORARY_DIRECTORY, "FOO"); + move_uploaded_file($_FILES['file']['tmp_name'],$tmpfname); + + $valid = verify_file($tmpfname,$import_id); + + if ($valid) + { //verified so upload + if (update_file($tmpfname,$import_id)) + { + print "

" . T_("Successfully updated sample") . " 

$description

"; + } + else + { + print "

" . T_("Error importing file. Please try again") . "

"; + } + } + else + print "

" . T_("Error:") . " $error

" . T_("Please check imported file matches column count and names from original sample file, go back in your browser and fix the problem") . "

"; + + + xhtml_foot($js_foot); + +} +else +{ + //need to supply file to upload + $subtitle = T_("Select file to upload"); + xhtml_head(T_("Add to existing sample") .":",true,$css,$js_head,false,false,false,$subtitle); + echo " " . T_("Go back") . ""; + + $ua = $_SERVER['HTTP_USER_AGENT']; + if (preg_match('/Firefox/i', $ua)) $csv= "text/csv"; else $csv= ".csv"; + //print "ua=" . $_SERVER['HTTP_USER_AGENT']; + ?> + +
+
+ + + + +
+ + +
+ ..." type="file" accept="" /> +
+
+ + +
+ +
+ + +
+
+ + +
+ +
+ +
+
+ +
+
+ +