private function validateForm()
{
// Is the form submitted?
if ($this->frm->isSubmitted()) {
// Cleanup the submitted fields, ignore fields that were added by hackers
$this->frm->cleanupFields();
// XML provided?
if ($this->frm->getField('wordpress')->isFilled()) {
$this->frm->getField('wordpress')->isAllowedExtension(array('xml'), BL::err('XMLFilesOnly'));
} else {
// No file
$this->frm->getField('wordpress')->addError(BL::err('FieldIsRequired'));
}
// No errors?
if ($this->frm->isCorrect()) {
// Move the file
$this->frm->getField('wordpress')->moveFile(FRONTEND_FILES_PATH . '/wordpress.xml');
// Process the XML
$this->processXML();
// Remove the file
$this->filesystem->remove(FRONTEND_FILES_PATH . '/wordpress.xml');
// Everything is saved, so redirect to the overview
$this->redirect(BackendModel::createURLForAction('index') . '&report=imported');
}
}
}