mirror of
https://github.com/vrana/adminer.git
synced 2025-08-14 02:23:59 +02:00
Send e-mail by Ctrl+Enter (Editor)
This commit is contained in:
@@ -278,13 +278,15 @@ ORDER BY ORDINAL_POSITION", null, "") as $row) { //! requires MySQL 5
|
||||
function selectEmailPrint($emailFields, $columns) {
|
||||
if ($emailFields) {
|
||||
print_fieldset("email", lang('E-mail'), $_POST["email_append"]);
|
||||
echo "<div onkeydown=\"eventStop(event); return bodyKeydown(event, 'email');\">\n";
|
||||
echo "<p>" . lang('From') . ": <input name='email_from' value='" . h($_POST ? $_POST["email_from"] : $_COOKIE["adminer_email"]) . "'>\n";
|
||||
echo lang('Subject') . ": <input name='email_subject' value='" . h($_POST["email_subject"]) . "'>\n";
|
||||
echo "<p><textarea name='email_message' rows='15' cols='75'>" . h($_POST["email_message"] . ($_POST["email_append"] ? '{$' . "$_POST[email_addition]}" : "")) . "</textarea><br>\n"; //! Ctrl+Enter for this.form.email
|
||||
echo html_select("email_addition", $columns, $_POST["email_addition"]) . "<input type='submit' name='email_append' value='" . lang('Insert') . "'>\n"; //! JavaScript
|
||||
echo "<p><textarea name='email_message' rows='15' cols='75'>" . h($_POST["email_message"] . ($_POST["email_append"] ? '{$' . "$_POST[email_addition]}" : "")) . "</textarea>\n"; //! Ctrl+Enter for this.form.email
|
||||
echo "<p onkeydown=\"eventStop(event); return bodyKeydown(event, 'email_append');\">" . html_select("email_addition", $columns, $_POST["email_addition"]) . "<input type='submit' name='email_append' value='" . lang('Insert') . "'>\n"; //! JavaScript
|
||||
echo "<p>" . lang('Attachments') . ": <input type='file' name='email_files[]' onchange=\"this.onchange = function () { }; var el = this.cloneNode(true); el.value = ''; this.parentNode.appendChild(el);\">";
|
||||
echo "<p>" . (count($emailFields) == 1 ? '<input type="hidden" name="email_field" value="' . h(key($emailFields)) . '">' : html_select("email_field", $emailFields));
|
||||
echo "<input type='submit' name='email' value='" . lang('Send') . "' onclick=\"return this.form['delete'].onclick();\">\n";
|
||||
echo "</div>\n";
|
||||
echo "</div></fieldset>\n";
|
||||
}
|
||||
}
|
||||
|
@@ -16,12 +16,12 @@ function email_header($header) {
|
||||
* @param array
|
||||
* @return bool
|
||||
*/
|
||||
function send_mail($email, $subject, $message, $from = "", $files = array("error" => array())) {
|
||||
function send_mail($email, $subject, $message, $from = "", $files = array()) {
|
||||
$eol = (strncasecmp(PHP_OS, "win", 3) ? "\n" : "\r\n"); // PHP_EOL available since PHP 4.3.10 and 5.0.2
|
||||
$message = str_replace("\n", $eol, wordwrap(str_replace("\r", "", "$message\n")));
|
||||
$boundary = uniqid("boundary");
|
||||
$attachments = "";
|
||||
foreach ($files["error"] as $key => $val) {
|
||||
foreach ((array) $files["error"] as $key => $val) {
|
||||
if (!$val) {
|
||||
$attachments .= "--$boundary$eol"
|
||||
. "Content-Type: " . str_replace("\n", "", $files["type"][$key]) . $eol
|
||||
|
Reference in New Issue
Block a user