//then create CVS file //CSV header $csv = implode(';', $header) . "\n"; //CSV content if (sizeof($formDatas)) { foreach ($formDatas as $formData) { $count = 0; foreach ($header as $fieldID => $head) { $csv .= $count ? ';' : ''; if (!$fileFields[$fieldID]) { $csv .= '"' . cleanvalue($formData[$fieldID]) . '"'; } else { if ($formData[$fieldID]) { $csv .= '"' . $filesPath . cleanvalue($formData[$fieldID]) . '"'; } else { $csv .= '""'; } } $count++; } $csv .= "\n"; } } //Then send CSV file header("Cache-Control: public"); //This is needed to avoid bug with IE in HTTPS header("Pragma:"); //This is needed to avoid bug with IE in HTTPS header('Content-type: text/csv; charset=' . APPLICATION_DEFAULT_ENCODING); header("Content-Disposition: attachment; filename=export_" . sensitiveIO::sanitizeAsciiString($form->getAttribute('name')) . "_" . date('Ymd') . ".csv"); echo $csv;
$item->setDebug(false); //check mandatory fields if (!$_POST["name"]) { $cms_message .= $cms_language->getMessage(MESSAGE_FORM_ERROR_MANDATORY_FIELDS); } else { $item->setAttribute('name', $_POST["name"]); } //check for copy-pasted code if (!$item->checkFormCode($_POST["source_" . $item->getID()])) { $cms_message .= $cms_language->getMessage(MESSAGE_FORM_ERROR_COPY_PASTED_CODE, false, MOD_CMS_FORMS_CODENAME); } $public = $_POST["public"] > -1 ? true : false; $item->setAttribute('public', $public); $item->setAttribute("responses", (int) $_POST["responses"]); // If new item set current user as media owner if ($item->getAttribute('ownerID') <= 0) { $item->setAttribute('ownerID', $cms_user->getUserID()); } // Validate XHTML source $domdocument = new CMS_DOMDocument(); try { $domdocument->loadXML("<dummy>" . $_POST["source_" . $item->getID()] . "</dummy>"); } catch (DOMException $e) { $cms_message .= $cms_language->getMessage(MESSAGE_ACTION_ERROR_INVALID_XHTML, false, MOD_CMS_FORMS_CODENAME) . " : " . $e->getMessage(); } if (!$cms_message) { //check inputs tags (sometimes, IE remove type="text" ...) //then save source $item->setAttribute('source', $item->checkInputs($_POST["source_" . $item->getID()])); } // Categories