break; } } // end bookmarks reading // Do no run query if we show PHP code if (isset($GLOBALS['show_as_php'])) { $run_query = FALSE; $go_sql = TRUE; } // Store the query as a bookmark before executing it if bookmarklabel was given if (!empty($bkm_label) && !empty($import_text)) { require_once './libraries/bookmark.lib.php'; $bfields = array('dbase' => $db, 'user' => $cfg['Bookmark']['user'], 'query' => urlencode($import_text), 'label' => $bkm_label); // Should we replace bookmark? if (isset($bkm_replace)) { $bookmarks = PMA_listBookmarks($db, $cfg['Bookmark']); foreach ($bookmarks as $key => $val) { if ($val == $bkm_label) { PMA_deleteBookmarks($db, $cfg['Bookmark'], $key); } } } PMA_addBookmarks($bfields, $cfg['Bookmark'], isset($bkm_all_users)); $bookmark_created = TRUE; } // end store bookmarks // We can not read all at once, otherwise we can run out of memory $memory_limit = trim(@ini_get('memory_limit')); // 2 MB as default if (empty($memory_limit)) { $memory_limit = 2 * 1024 * 1024;
/** * prints bookmark fieldset * * @usedby PMA_sqlQueryForm() * @uses PMA_listBookmarks() * @uses $GLOBALS['db'] * @uses $GLOBALS['pmaThemeImage'] * @uses $GLOBALS['cfg']['Bookmark'] * @uses $GLOBALS['cfg']['ReplaceHelpImg'] * @uses $GLOBALS['strBookmarkQuery'] * @uses $GLOBALS['strBookmarkView'] * @uses $GLOBALS['strDelete'] * @uses $GLOBALS['strDocu'] * @uses $GLOBALS['strGo'] * @uses $GLOBALS['strSubmit'] * @uses $GLOBALS['strVar'] * @uses count() * @uses htmlspecialchars() */ function PMA_sqlQueryFormBookmark() { $bookmark_list = PMA_listBookmarks(isset($GLOBALS['db']) ? $GLOBALS['db'] : '', $GLOBALS['cfg']['Bookmark']); if (!$bookmark_list || count($bookmark_list) < 1) { return; } echo '<fieldset id="bookmarkoptions">'; echo '<legend>'; echo $GLOBALS['strBookmarkQuery'] . '</legend>' . "\n"; echo '<div class="formelement">'; echo '<select name="id_bookmark">' . "\n"; echo '<option value=""></option>' . "\n"; foreach ($bookmark_list as $key => $value) { echo '<option value="' . htmlspecialchars($key) . '">' . htmlspecialchars($value) . '</option>' . "\n"; } // is required for correct display with styles/line height echo '</select> ' . "\n"; echo '</div>' . "\n"; echo '<div class="formelement">' . "\n"; echo $GLOBALS['strVar']; if ($GLOBALS['cfg']['ReplaceHelpImg']) { echo ' <a href="./Documentation.html#faqbookmark"' . ' target="documentation">' . '<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_help.png"' . ' border="0" width="11" height="11" align="middle"' . ' alt="' . $GLOBALS['strDocu'] . '" /></a> '; } else { echo ' (<a href="./Documentation.html#faqbookmark"' . ' target="documentation">' . $GLOBALS['strDocu'] . '</a>): '; } echo '<input type="text" name="bookmark_variable" class="textfield"' . ' size="10" />' . "\n"; echo '</div>' . "\n"; echo '<div class="formelement">' . "\n"; echo '<input type="radio" name="action_bookmark" value="0"' . ' id="radio_bookmark_exe" checked="checked" />' . '<label for="radio_bookmark_exe">' . $GLOBALS['strSubmit'] . '</label>' . "\n"; echo '<input type="radio" name="action_bookmark" value="1"' . ' id="radio_bookmark_view" />' . '<label for="radio_bookmark_view">' . $GLOBALS['strBookmarkView'] . '</label>' . "\n"; echo '<input type="radio" name="action_bookmark" value="2"' . ' id="radio_bookmark_del" />' . '<label for="radio_bookmark_del">' . $GLOBALS['strDelete'] . '</label>' . "\n"; echo '</div>' . "\n"; echo '<div class="clearfloat"></div>' . "\n"; echo '</fieldset>' . "\n"; echo '<fieldset id="bookmarkoptionsfooter" class="tblFooters">' . "\n"; echo '<input type="submit" name="SQL" value="' . $GLOBALS['strGo'] . '" />'; echo '<div class="clearfloat"></div>' . "\n"; echo '</fieldset>' . "\n"; }
} echo '>' . $temp_charset . '</option>' . "\n"; } echo ' </select><br />' . "\n" . ' '; } elseif (PMA_MYSQL_INT_VERSION >= 40100) { echo $strCharsetOfFile . "\n"; echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET, 'charset_of_file', NULL, 'utf8', FALSE); } // end if (recoding) echo ' </td>' . "\n"; echo ' <td align="right"><input type="submit" name="SQL" value="' . $strGo . '" /></td>' . "\n"; echo ' </tr>' . "\n"; } // Bookmark Support if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) { if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) { echo ' <tr><td colspan="2"><img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td></tr>' . "\n"; echo ' <tr><td colspan="2" class="tblHeaders"> <i>' . $strOr . '</i></td></tr>' . "\n"; echo ' <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td colspan="2">' . "\n"; echo ' <b>' . $strBookmarkQuery . ':</b> ' . "\n"; echo ' <select name="id_bookmark">' . "\n"; echo ' <option value=""></option>' . "\n"; foreach ($bookmark_list as $key => $value) { echo ' <option value="' . htmlspecialchars($key) . '">' . htmlspecialchars($value) . '</option>' . "\n"; } echo ' </select>' . "\n"; echo ' </td></tr><tr bgcolor="' . $cfg['BgcolorOne'] . '"><td colspan="2">'; echo ' ' . $strVar . ' '; if ($cfg['ReplaceHelpImg']) { echo '<a href="./Documentation.html#faqbookmark" target="documentation">' . '<img src="' . $pmaThemeImage . 'b_help.png" border="0" width="11" height="11" align="middle" alt="' . $strDocu . '" /></a>'; } else {