$query = "DELETE FROM " . $templateTable . " WHERE `id` = " . $id . " AND `username` = '" . $user . "'"; break; default: break; } $result = PMA_queryAsControlUser($query, false); $response = PMA_Response::getInstance(); if (!$result) { $error = $GLOBALS['dbi']->getError($GLOBALS['controllink']); $response->isSuccess(false); $response->addJSON('message', $error); exit; } $response->isSuccess(true); if ('create' == $_REQUEST['templateAction']) { $response->addJSON('data', PMA_getOptionsForexport_templates($_REQUEST['exportType'])); } elseif ('load' == $_REQUEST['templateAction']) { $data = null; while ($row = $GLOBALS['dbi']->fetchAssoc($result, $GLOBALS['controllink'])) { $data = $row['template_data']; } $response->addJSON('data', $data); } $GLOBALS['dbi']->freeResult($result); exit; } /** * Gets tables information and displays top links */ require_once 'libraries/tbl_common.inc.php'; $url_query .= '&goto=tbl_export.php&back=tbl_export.php';
/** * Returns HTML for export template operations * * @param string $export_type export type - server, database, or table * * @return string HTML for export template operations */ function PMA_getHtmlForExportTemplateLoading($export_type) { $html = '<div class="exportoptions" id="export_templates">'; $html .= '<h3>' . __('Export templates:') . '</h3>'; $html .= '<div class="floatleft">'; $html .= '<form method="post" action="tbl_export.php" id="newTemplateForm"' . ' class="ajax">'; $html .= '<h4>' . __('New template:') . '</h4>'; $html .= '<input type="text" name="templateName" id="templateName" ' . 'maxlength="64"' . 'required="required" ' . 'placeholder="' . __('Template name') . '" />'; $html .= '<input type="submit" name="createTemplate" id="createTemplate" ' . 'value="' . __('Create') . '" />'; $html .= '</form>'; $html .= '</div>'; $html .= '<div class="floatleft" style="margin-left: 50px;">'; $html .= '<form method="post" action="tbl_export.php"' . ' id="existingTemplatesForm" class="ajax">'; $html .= '<h4>' . __('Existing templates:') . '</h4>'; $html .= '<label for="template">' . __('Template:') . '</label>'; $html .= '<select required="required" name="template" id="template">'; $html .= PMA_getOptionsForexport_templates($export_type); $html .= '</select>'; $html .= '<input type="submit" name="updateTemplate" ' . 'id="updateTemplate" value="' . __('Update') . '" />'; $html .= '<input type="submit" name="deleteTemplate" ' . 'id="deleteTemplate" value="' . __('Delete') . '" />'; $html .= '</form>'; $html .= '</div>'; $html .= '<div class="clearfloat"></div>'; $html .= '</div>'; return $html; }