示例#1
0
function email_form_submission($form)
{
    if (!defined('PHP_EOL')) {
        define('PHP_EOL', '\\r\\n');
    }
    $form_email = array_key_exists('Email', $_REQUEST) && !empty($_REQUEST['Email']) ? cleanup_email($_REQUEST['Email']) : '';
    $to = $form['email']['to'];
    $subject = $form['subject'];
    $message = get_email_body($subject, $form['heading'], $form['fields'], $form['resources']);
    $headers = get_email_headers($to, $form_email);
    $sent = @mail($to, $subject, $message, $headers);
    if (!$sent) {
        die(get_form_error_response($form['resources']['failed_to_send_email']));
    }
    $success_data = array('redirect' => $form['success_redirect']);
    echo get_form_response(true, $success_data);
}
if (file_exists($xerte_toolkits_site->users_file_area_full . $_POST['file_path'] . "lockfile.txt")) {
    /*
     *  Code to delete the lock file
     */
    $lock_file_data = file_get_contents($xerte_toolkits_site->users_file_area_full . $temp_array[0] . "-" . $temp_array[1] . "-" . $temp_array[2] . "/lockfile.txt");
    $temp = explode("*", $lock_file_data);
    $lock_file_creator = $temp[0];
    $template_id = explode("-", $_POST['file_path']);
    $row_template_name = db_query_one("Select template_name from {$xerte_toolkits_site->database_table_prefix}templatedetails WHERE template_id = ?", array($template_id[0]));
    $user_list = $temp[1];
    $users = explode(" ", $user_list);
    /*
     * Email users in the lock file
     */
    for ($x = 0; $x != count($users) - 1; $x++) {
        mail($users[$x] . "@" . $xerte_toolkits_site->email_add_to_username, "File available - \"" . str_replace("_", " ", $row_template_name['template_name']) . "\"", "Hello, <br><br> You've requested to be informed when the file \"" . str_replace("_", " ", $row_template_name['template_name']) . "\" becomes available for editing. The file was made available at " . date("h:i a") . " on " . date("l, jS F") . " <br><br> Please note that multiple requests may have been made, and as such you may not be the only person to have receive one of these notifications. As such the file may well be locked by somebody else.<br><br> Please log into the site at <a href=\"" . $xerte_toolkits_site->site_url . "\">" . $xerte_toolkits_site->site_url . "</a>. <br><br> Thank you, <br><br> the Xerte Online toolkits team", get_email_headers());
    }
    unlink($xerte_toolkits_site->users_file_area_full . $_POST['file_path'] . "lockfile.txt");
}
/*
 * Code to check to see if we should warn on a publish
 */
if (is_user_an_editor($temp_array[0], $_SESSION['toolkits_logon_id'])) {
    $prefix = $xerte_toolkits_site->users_file_area_full . $temp_array[0] . "-" . $temp_array[1] . "-" . $temp_array[2];
    $preview_file = $prefix . '/preview.xml';
    $data_file = $prefix . '/data.xml';
    if (file_exists($preview_file) && file_exists($data_file)) {
        $preview_xml = file_get_contents($preview_file);
        $data_xml = file_get_contents($data_file);
        if ($data_xml != $preview_xml) {
            echo TEMPLATE_CLOSE_QUESTION . "~*~" . $xerte_toolkits_site->users_file_area_full . $temp_array[0] . "-" . $temp_array[1] . "-" . $temp_array[2] . "~*~" . $temp_array[0];
/**
 * 
 * Function email message
 * This function is used to send an error email meesage
 * @param string $user_name = username the error relates to
 * @param string $type = user / Admin / system
 * @param string $level = how serious the problem is, or whether it is a sucess
 * @param string $subject = The title of the error problem (a preci effectively)
 * @param string $content = The error message in full.
 * @version 1.0
 * @author Patrick Lockley
 */
function email_message($user_name, $type, $level, $subject, $content)
{
    global $xerte_toolkits_site;
    $email_subject = $user_name . " " . $type . " " . $level . " " . $subject;
    $email_content = date("G:i:s-d/m/Y") . "\n" . $content;
    mail($xerte_toolkits_site->email_error_list, $email_subject, $email_content, get_email_headers());
}
示例#4
0
        $p = new SiteParse();
        # Don't set a max value when doing the email, as we don't need to worry
        # about the display
        $p->max_value_length = null;

        list($email, $is_text) = get_email_addr();
        $bibid = valid_bibid($_REQUEST['bibid']);

        $record = $p->get_record($bibid);
        array_walk_recursive($record, "html_entity_decode_ref");
        
        $record["info_keys"] = $p->email_detail_keys;

        $contents = get_detail_text($record, $is_text);

        $headers = get_email_headers($p);
        $subject = get_subject($p, $is_text, $record);

        mail($email, $subject, $contents, $headers);

        $sm = get_smarty();
        $sm->assign("bibid", $bibid);

        if ($is_text) {
            $sm->display("responses/text_success.html");
        } else {
            $sm->display("responses/email_success.html");
        }

    } catch (Exception $e) {
        $sm = get_smarty();
</title>

<link href="../website_code/styles/frontpage.css" media="screen" type="text/css" rel="stylesheet" />

</head>

<body>

    <div class="topbar">
        <img src="website_code/images/logo.png" style="margin-left:10px; float:left" />
        <img src="website_code/images/apereoLogo.png" style="margin-right:10px; float:right" />
    </div>
    <div class="mainbody"><?php 
if (isset($_POST['name'])) {
    echo "<p>" . FEEDBACK_RESPONSE . "</p></div></body></html>";
    mail($xerte_toolkits_site->feedback_list, FEEDBACK_EMAIL_TITLE, FEEDBACK_GIVER . $_POST['name'] . "<br>" . FEEDBACK_MESSAGE_INTRO . "<br>" . $_POST['feedback'], get_email_headers());
    echo "<div class=\"title\"><p>" . FEEDBACK_PAGE_TITLE . "</p></div><div style=\"width:45%; float:left; position:relative; margin-right:20px;\">" . FEEDBACK_DESCRIPTION . "</div><div style=\"width:50%; float:left; position:relative;\">";
    echo "<form action=\"\" method=\"post\">Name<textarea name=\"name\" style=\"width:100%;\" rows=\"1\"></textarea>" . FEEDBACK_TEXTAREA . "<textarea name=\"feedback\" style=\"width:100%;\" rows=\"25\"></textarea><input type=\"submit\" value=\"" . FEEDBACK_BUTTON . "\"></form>";
} else {
    /**
     *	Else display the page
     */
    echo "<div class=\"title\"><p>Welcome to Xerte Online Toolkits Feedback page</p></div><div style=\"width:45%; float:left; position:relative; margin-right:20px;\">Please leave your feedback here. All feedback is anonymous, unless you would like a response, and if you do, please leave your name opposite and some contact details in the box below.</div><div style=\"width:50%; float:left; position:relative;\">";
    echo "<form action=\"\" method=\"post\">Name<textarea name=\"name\" style=\"width:100%;\" rows=\"1\"></textarea>Feedback<textarea name=\"feedback\" style=\"width:100%;\" rows=\"25\"></textarea><input type=\"submit\" value=\"Send Feedback\"></form>";
    echo "</div></div></body></html>";
}
?>
    </div>
</body>
</html>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * 
 * peer view page, sends the email back to the 
 *
 * @author Patrick Lockley
 * @version 1.0
 * @package
 */
require_once "../../../config.php";
_load_language_file("/website_code/php/peer/peer_review.inc");
if (empty($_POST['template_id'])) {
    die("invalid form submission");
}
$query_for_file_name = "select template_name from {$xerte_toolkits_site->database_table_prefix}templatedetails where template_id =?";
$row_template_name = db_query_one($query_for_file_name, array($_POST['template_id']));
$headers = get_email_headers();
if (isset($_POST['retouremail'])) {
    $subject = PEER_REVIEW_FEEDBACK . " - \"" . str_replace("_", " ", $row_template_name['template_name']) . "\"";
    $message = PEER_REVIEW_EMAIL_GREETING . " <br><br> " . PEER_REVIEW_EMAIL_INTRO . "<br><br><br>" . $_POST['feedback'] . "<br><br><br>" . PEER_REVIEW_EMAIL_YOURS . "<br><br>" . PEER_REVIEW_EMAIL_SIGNATURE;
    if (mail($_POST['retouremail'], $subject, $message, $headers)) {
        echo "<b>" . PEER_REVIEW_USER_FEEDBACK . "</b>";
    } else {
        echo "<b>" . PEER_REVIEW_PROBLEM . ".</b>";
    }
}
示例#7
0
/**
 * Save mail callback
 * Accepts an email received from a client during the DATA command.
 * This email is processed, the recipient host is verified, the body is
 * decoded, then saved to the database.
 * This is an example save mail function.
 * Of course, yours can be better! Eg. add buffered writes, place email on message queue, encryption, etc
 *
 * @param string $email
 * @param        $rcpt_to
 * @param        $helo
 * @param        $helo_ip
 *
 * @return array, with the following elements array($hash, $recipient)
 * where the $hash is a unique id for this email.
 */
function my_save_email($email, $rcpt_to, $helo, $helo_ip)
{
    global $GM_ERROR;
    $mimemail = null;
    $hash = '';
    $email .= "\r\n";
    list($to, $from, $subject) = get_email_headers($email, array('To', 'From', 'Subject'));
    $rcpt_to = extract_rcpt_email($rcpt_to);
    $from = extract_email($from);
    list($mail_user, $mail_host) = explode('@', $rcpt_to);
    if (is_host_allowed($mail_host)) {
        $db = get_db_link();
        if ($db === false) {
            // could not get a db connection
            $GM_ERROR = 'could not get a db connection';
            return array(false, false);
        }
        $to = $mail_user . '@' . GM_PRIMARY_MAIL_HOST;
        // change it to the primary host
        if (GSMTP_VERIFY_USERS) {
            // Here we can verify that the recipient is actually in the database.
            // Note that guerrillamail.com does not do this - you can send email
            // to a non-existing email address, and set to this email later.
            // just an example:
            if (array_pop(explode('@', $to)) !== 'sharklasers.com') {
                // check the user against our user database
                $user = array_shift(explode('@', $to));
                $sql = "SELECT * FROM `gm2_address` WHERE `address_email`=" . $db->quote($user . '@guerrillamailblock.com') . " ";
                $stmt = $db->query($sql);
                if ($stmt->rowCount() == 0) {
                    $GM_ERROR = 'could not verify user';
                    return false;
                    // no such address
                }
            }
        }
        $hash = md5($to . $from . $subject . microtime());
        // add 'received' headers
        $add_head = '';
        $add_head .= "Delivered-To: " . $to . "\r\n";
        $add_head .= "Received: from " . $helo . " (" . $helo . "  [" . $helo_ip . "])\r\n";
        $add_head .= "\tby " . GSMTP_HOST_NAME . " with SMTP id " . $hash . "@" . GSMTP_HOST_NAME . ";\r\n";
        $add_head .= "\t" . gmdate('r') . "\r\n";
        $email = $add_head . $email;
        $body = 'gzencode';
        $charset = '';
        $has_attach = '';
        $content_type = '';
        $email = gzcompress($email, 6);
        $redis = getRedis();
        if (is_object($redis)) {
            // send it of to Redis
            try {
                if ($redis->setex($hash, 3600, $email) === true) {
                    $body = 'redis';
                    $email = '';
                    //log_line("saved to redis $hash $to");
                } else {
                    log_line("save failed");
                }
            } catch (\RedisException $e) {
                log_line("redis exeption" . var_dump($e, true));
            }
        } else {
            log_line("no redis for you\n");
        }
        $sql = "INSERT INTO " . GM_MAIL_TABLE . " (\n                `date`,\n                `to`,\n                `from`,\n                `subject`,\n                `body`,\n                `charset`,\n                `mail`,\n                `spam_score`,\n                `hash`,\n                `content_type`,\n                `recipient`,\n                `has_attach`,\n                `ip_addr`\n            )\n            VALUES (\n                '" . gmdate('Y-m-d H:i:s') . "',\n                " . $db->quote($to) . ",\n                " . $db->quote($from) . ",\n                " . $db->quote($subject) . ",\n                " . $db->quote($body) . ",\n                " . $db->quote($charset) . ",\n                " . $db->quote($email) . ",\n                0 " . ",\n                " . $db->quote($hash) . ",\n                " . $db->quote($content_type) . ",\n                " . $db->quote($to) . ",\n                " . $db->quote($has_attach) . ",\n                " . $db->quote($helo_ip) . "\n            ) ";
        try {
            $db->query($sql);
            $id = $db->lastInsertId();
            if ($id) {
                $sql = "UPDATE\n                            gm2_setting\n                       SET\n                            `setting_value` = `setting_value`+1\n                       WHERE\n                            `setting_name`='received_emails'\n                            LIMIT 1";
                $db->query($sql);
            }
        } catch (\PDOException $e) {
            $GM_ERROR = 'save error ' . $e->getMessage();
            log_line('Failed to save email From:' . $from . ' To:' . $to . ' ' . $e->getMessage() . ' ' . $sql, 1);
        }
    } else {
        $GM_ERROR = " -{$mail_host}- not in allowed hosts:" . $mail_host . " ";
    }
    return array($hash, $to);
}
示例#8
0
</title>

<link href="../website_code/styles/frontpage.css" media="screen" type="text/css" rel="stylesheet" />

</head>

<body>

    <div class="topbar">
        <img src="../website_code/images/xerteLogo.jpg" style="margin-left:10px; float:left" />
        <img src="../website_code/images/UofNLogo.jpg" style="margin-right:10px; float:right" />
    </div>
    <div class="mainbody"><?php 
if (isset($_POST['name'])) {
    echo "<p>" . FEEDBACK_RESPONSE . "</p></div></body></html>";
    mail($xerte_toolkits_site->feedback_list, FEEDBACK_EMAIL_TITLE, FEEDBACK_GIVER . mysql_real_escape_string($_POST['name']) . "<br>" . FEEDBACK_MESSAGE_INTRO . "<br>" . mysql_real_escape_string($_POST['feedback']), get_email_headers());
    echo "<div class=\"title\"><p>" . FEEDBACK_PAGE_TITLE . "</p></div><div style=\"width:45%; float:left; position:relative; margin-right:20px;\">" . FEEDBACK_DESCRIPTION . "</div><div style=\"width:50%; float:left; position:relative;\">";
    echo "<form action=\"\" method=\"post\">Name<textarea name=\"name\" style=\"width:100%;\" rows=\"1\"></textarea>" . FEEDBACK_TEXTAREA . "<textarea name=\"feedback\" style=\"width:100%;\" rows=\"25\"></textarea><input type=\"submit\" value=\"" . FEEDBACK_BUTTON . "\"></form>";
} else {
    /**
     *	Else display the page
     */
    echo "<div class=\"title\"><p>Welcome to Xerte Online Toolkits Feedback page</p></div><div style=\"width:45%; float:left; position:relative; margin-right:20px;\">Please leave your feedback here. All feedback is anonymous, unless you would like a response, and if you do, please leave your name opposite and some contact details in the box below.</div><div style=\"width:50%; float:left; position:relative;\">";
    echo "<form action=\"\" method=\"post\">Name<textarea name=\"name\" style=\"width:100%;\" rows=\"1\"></textarea>Feedback<textarea name=\"feedback\" style=\"width:100%;\" rows=\"25\"></textarea><input type=\"submit\" value=\"Send Feedback\"></form>";
    echo "</div></div></body></html>";
}
?>
    </div>
</body>
</html>