/** * Prints Html For Display Import options : Format * * @param ImportPlugin[] $import_list import list * * @return string */ function PMA_getHtmlForImportOptionsFormat($import_list) { $html = ' <div class="importoptions">'; $html .= ' <h3>' . __('Format:') . '</h3>'; $html .= PMA_pluginGetChoice('Import', 'format', $import_list); $html .= ' <div id="import_notification"></div>'; $html .= ' </div>'; $html .= ' <div class="importoptions" id="format_specific_opts">'; $html .= ' <h3>' . __('Format-specific options:') . '</h3>'; $html .= ' <p class="no_js_msg" id="scroll_to_options_msg">' . 'Scroll down to fill in the options for the selected format ' . 'and ignore the options for other formats.</p>'; $html .= PMA_pluginGetOptions('Import', $import_list); $html .= ' </div>'; $html .= ' <div class="clearfloat"></div>'; // Encoding setting form appended by Y.Kawada if (function_exists('PMA_Kanji_encodingForm')) { $html .= ' <div class="importoptions" id="kanji_encoding">'; $html .= ' <h3>' . __('Encoding Conversion:') . '</h3>'; $html .= PMA_Kanji_encodingForm(); $html .= ' </div>'; } $html .= "\n"; return $html; }
/** * return HTML for the sql query boxes * * @param boolean|string $query query to display in the textarea * or true to display last executed * @param boolean|string $display_tab sql|files|history|full|false * what part to display * false if not inside querywindow * @param string $delimiter delimiter * * @return string * * @usedby server_sql.php * @usedby db_sql.php * @usedby tbl_sql.php * @usedby tbl_structure.php * @usedby tbl_tracking.php */ function PMA_getHtmlForSqlQueryForm($query = true, $display_tab = false, $delimiter = ';') { $html = ''; if (!$display_tab) { $display_tab = 'full'; } // query to show if (true === $query) { $query = $GLOBALS['sql_query']; } // set enctype to multipart for file uploads if ($GLOBALS['is_upload']) { $enctype = ' enctype="multipart/form-data"'; } else { $enctype = ''; } $table = ''; $db = ''; if (!mb_strlen($GLOBALS['db'])) { // prepare for server related $goto = empty($GLOBALS['goto']) ? 'server_sql.php' : $GLOBALS['goto']; } elseif (!mb_strlen($GLOBALS['table'])) { // prepare for db related $db = $GLOBALS['db']; $goto = empty($GLOBALS['goto']) ? 'db_sql.php' : $GLOBALS['goto']; } else { $table = $GLOBALS['table']; $db = $GLOBALS['db']; $goto = empty($GLOBALS['goto']) ? 'tbl_sql.php' : $GLOBALS['goto']; } // start output $html .= '<form method="post" action="import.php" ' . $enctype; $html .= ' class="ajax lock-page"'; $html .= ' id="sqlqueryform" name="sqlform">' . "\n"; $html .= '<input type="hidden" name="is_js_confirmed" value="0" />' . "\n" . PMA_URL_getHiddenInputs($db, $table) . "\n" . '<input type="hidden" name="pos" value="0" />' . "\n" . '<input type="hidden" name="goto" value="' . htmlspecialchars($goto) . '" />' . "\n" . '<input type="hidden" name="message_to_show" value="' . __('Your SQL query has been executed successfully.') . '" />' . "\n" . '<input type="hidden" name="prev_sql_query" value="' . htmlspecialchars($query) . '" />' . "\n"; // display querybox if ($display_tab === 'full' || $display_tab === 'sql') { $html .= PMA_getHtmlForSqlQueryFormInsert($query, $delimiter); } // display uploads if ($display_tab === 'files' && $GLOBALS['is_upload']) { $html .= PMA_getHtmlForSqlQueryFormUpload(); } // Bookmark Support if ($display_tab === 'full' || $display_tab === 'history') { $cfgBookmark = PMA_Bookmark_getParams(); if ($cfgBookmark) { $html .= PMA_getHtmlForSqlQueryFormBookmark(); } } // Encoding setting form appended by Y.Kawada if (function_exists('PMA_Kanji_encodingForm')) { $html .= PMA_Kanji_encodingForm(); } $html .= '</form>' . "\n"; // print an empty div, which will be later filled with // the sql query results by ajax $html .= '<div id="sqlqueryresults"></div>'; return $html; }
/** * Prints Html For Export Options Format-specific options * * @param ExportPlugin[] $export_list Export List * * @return string */ function PMA_getHtmlForExportOptionsFormat($export_list) { $html = '<div class="exportoptions" id="format_specific_opts">'; $html .= '<h3>' . __('Format-specific options:') . '</h3>'; $html .= '<p class="no_js_msg" id="scroll_to_options_msg">'; $html .= __('Scroll down to fill in the options for the selected format ' . 'and ignore the options for other formats.'); $html .= '</p>'; $html .= PMA_pluginGetOptions('Export', $export_list); $html .= '</div>'; if (function_exists('PMA_Kanji_encodingForm')) { // Encoding setting form appended by Y.Kawada // Japanese encoding setting $html .= '<div class="exportoptions" id="kanji_encoding">'; $html .= '<h3>' . __('Encoding Conversion:') . '</h3>'; $html .= PMA_Kanji_encodingForm(); $html .= '</div>'; } $html .= '<div class="exportoptions" id="submit">'; $html .= PMA_Util::getExternalBug(__('SQL compatibility mode'), 'mysql', '50027', '14515'); global $cfg; if ($cfg['ExecTimeLimit'] > 0) { $html .= '<input type="submit" value="' . __('Go') . '" id="buttonGo" onclick="check_time_out(' . $cfg['ExecTimeLimit'] . ')"/>'; } else { // if the time limit set is zero, then time out won't occur // So no need to check for time out. $html .= '<input type="submit" value="' . __('Go') . '" id="buttonGo" />'; } $html .= '</div>'; return $html; }
/** * Test for PMA_getHtmlForSqlQueryForm * * @return void */ public function testPMAGetHtmlForSqlQueryForm() { //Call the test function $GLOBALS['is_upload'] = true; $query = "select * from PMA"; $html = PMA_getHtmlForSqlQueryForm($query); //validate 1: query $this->assertContains(htmlspecialchars($query), $html); //validate 2: $enctype $enctype = ' enctype="multipart/form-data"'; $this->assertContains($enctype, $html); //validate 3: sqlqueryform $this->assertContains('id="sqlqueryform" name="sqlform">', $html); //validate 4: $db, $table $table = $GLOBALS['table']; $db = $GLOBALS['db']; $this->assertContains(PMA_URL_getHiddenInputs($db, $table), $html); //validate 5: $goto $goto = empty($GLOBALS['goto']) ? 'tbl_sql.php' : $GLOBALS['goto']; $this->assertContains(htmlspecialchars($goto), $html); //validate 6: PMA_Kanji_encodingForm $this->assertContains(PMA_Kanji_encodingForm(), $html); }
/** * Test for PMA_Kanji_encodingForm * * @return void * @test */ public function testEncodingForm() { $actual = PMA_Kanji_encodingForm(); $this->assertContains('<input type="radio" name="knjenc"', $actual); $this->assertContains('type="radio" name="knjenc"', $actual); $this->assertContains('<input type="radio" name="knjenc" value="EUC-JP" id="kj-euc" />', $actual); $this->assertContains('<input type="radio" name="knjenc" value="SJIS" id="kj-sjis" />', $actual); $this->assertContains('<input type="checkbox" name="xkana" value="kana" id="kj-kana" />', $actual); }
/** * Prints Html For Export Options Format * * @param String $export_list Export List * * @return string */ function PMA_getHtmlForExportOptionsFormat($export_list) { $html = '<div class="exportoptions" id="format">'; $html .= '<h3>' . __('Format:') . '</h3>'; $html .= PMA_pluginGetChoice('Export', 'what', $export_list, 'format'); $html .= '</div>'; $html .= '<div class="exportoptions" id="format_specific_opts">'; $html .= '<h3>' . __('Format-specific options:') . '</h3>'; $html .= '<p class="no_js_msg" id="scroll_to_options_msg">'; $html .= __('Scroll down to fill in the options for the selected format ' . 'and ignore the options for other formats.'); $html .= '</p>'; $html .= PMA_pluginGetOptions('Export', $export_list); $html .= '</div>'; if (function_exists('PMA_Kanji_encodingForm')) { // Encoding setting form appended by Y.Kawada // Japanese encoding setting $html .= '<div class="exportoptions" id="kanji_encoding">'; $html .= '<h3>' . __('Encoding Conversion:') . '</h3>'; $html .= PMA_Kanji_encodingForm(); $html .= '</div>'; } $html .= '<div class="exportoptions" id="submit">'; $html .= PMA_Util::getExternalBug(__('SQL compatibility mode'), 'mysql', '50027', '14515'); $html .= '<input type="submit" value="' . __('Go') . '" id="buttonGo" />'; $html .= '</div>'; return $html; }