Example #1
0
                                    //build path to custom reset password email file
                                } else {
                                    $reset_password_email_file = $cmtx_path . 'includes/emails/' . cmtx_setting('language_frontend') . '/admin/reset_password.txt';
                                    //build path to reset password email file
                                }
                                $body = file_get_contents($reset_password_email_file);
                                //get the file's contents
                                $admin_link = cmtx_url_encode_spaces(cmtx_setting('commentics_url') . cmtx_setting('admin_folder')) . '/';
                                //build admin panel link
                                //convert email variables with actual variables
                                $body = str_ireplace('[username]', $username, $body);
                                $body = str_ireplace('[password]', $password, $body);
                                $body = str_ireplace('[admin link]', $admin_link, $body);
                                $body = str_ireplace('[signature]', cmtx_setting('signature'), $body);
                                //send email
                                cmtx_email($email, null, cmtx_setting('admin_reset_password_subject'), $body, cmtx_setting('admin_reset_password_from_email'), cmtx_setting('admin_reset_password_from_name'), cmtx_setting('admin_reset_password_reply_to'));
                                $password = md5($password);
                                $password = cmtx_sanitize($password);
                                cmtx_db_query("UPDATE `" . $cmtx_mysql_table_prefix . "admins` SET `password` = '{$password}' WHERE `email` = '{$email}'");
                                echo '<span class="positive">' . CMTX_RESET_SENT . '</span>';
                            }
                        } else {
                            echo '<span class="negative">' . CMTX_RESET_ADDR . '</span>';
                        }
                    }
                }
                ?>
	</div>
	<div style="text-align:center; margin-top:10px;">
	<span class="login_link"><a href="index.php" title="<?php 
                echo CMTX_RESET_LOGIN;
    if (isset($_POST['submit'])) {
        cmtx_check_csrf_form_key();
        if (file_exists($cmtx_path . 'includes/emails/' . cmtx_setting('language_frontend') . '/admin/custom/email_test.txt')) {
            $admin_email_test_email_file = $cmtx_path . 'includes/emails/' . cmtx_setting('language_frontend') . '/admin/custom/email_test.txt';
            //build path to custom admin email test email file
        } else {
            $admin_email_test_email_file = $cmtx_path . 'includes/emails/' . cmtx_setting('language_frontend') . '/admin/email_test.txt';
            //build path to admin email test email file
        }
        $body = file_get_contents($admin_email_test_email_file);
        //get the file's contents
        $admin_link = cmtx_url_encode_spaces(cmtx_setting('commentics_url') . cmtx_setting('admin_folder')) . "/";
        //build admin panel link
        $body = str_ireplace('[admin link]', $admin_link, $body);
        $body = str_ireplace('[signature]', cmtx_setting('signature'), $body);
        cmtx_email($email, null, cmtx_setting('admin_email_test_subject'), $body, cmtx_setting('admin_email_test_from_email'), cmtx_setting('admin_email_test_from_name'), cmtx_setting('admin_email_test_reply_to'));
        ?>
<div class="success"><?php 
        echo CMTX_MSG_EMAIL_SENT;
        ?>
</div>
<div style="clear: left;"></div>
<?php 
    }
}
?>

<p />

<?php 
printf(CMTX_DESC_SETTINGS_EMAIL_TEST, $email);
Example #3
0
        $comment_query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "comments` WHERE `id` = '{$id}'");
        $comment_result = cmtx_db_fetch_assoc($comment_query);
        $page_id = $comment_result['page_id'];
        $page_query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "pages` WHERE `id` = '{$page_id}'");
        $page_result = cmtx_db_fetch_assoc($page_query);
        $page_reference = cmtx_decode($page_result['reference']);
        $page_url = cmtx_decode($page_result['url']);
        $comment_url = cmtx_decode(cmtx_get_permalink($id, $page_result['url']));
        //get the permalink of the comment
        $poster = cmtx_decode($comment_result['name']);
        $comment = cmtx_prepare_comment_for_email($comment_result['comment'], false);
        $admin_link = cmtx_url_encode_spaces(cmtx_setting('commentics_url') . cmtx_setting('admin_folder')) . '/';
        //build admin panel link
        //convert email variables with actual variables
        $body = str_ireplace('[page reference]', $page_reference, $body);
        $body = str_ireplace('[page url]', $page_url, $body);
        $body = str_ireplace('[comment url]', $comment_url, $body);
        $body = str_ireplace('[poster]', $poster, $body);
        $body = str_ireplace('[comment]', $comment, $body);
        $body = str_ireplace('[admin link]', $admin_link, $body);
        $body = str_ireplace('[signature]', cmtx_setting('signature'), $body);
        //select administrators from database
        $admins = cmtx_db_query("SELECT `email` FROM `" . $cmtx_mysql_table_prefix . "admins` WHERE `receive_email_new_flag` = '1' AND `is_enabled` = '1'");
        while ($admin = cmtx_db_fetch_assoc($admins)) {
            //while there are administrators
            $email = $admin['email'];
            //get administrator email address
            cmtx_email($email, null, cmtx_setting('admin_new_flag_subject'), $body, cmtx_setting('admin_new_flag_from_email'), cmtx_setting('admin_new_flag_from_name'), cmtx_setting('admin_new_flag_reply_to'));
        }
    }
}
Example #4
0
function cmtx_notify_admin_new_comment_okay($poster, $comment, $comment_id)
{
    //notify admin of new comment
    global $cmtx_mysql_table_prefix, $cmtx_is_admin, $cmtx_path;
    //globalise variables
    if (file_exists($cmtx_path . 'includes/emails/' . cmtx_setting('language_frontend') . '/admin/custom/new_comment_okay.txt')) {
        $admin_new_comment_okay_email_file = $cmtx_path . 'includes/emails/' . cmtx_setting('language_frontend') . '/admin/custom/new_comment_okay.txt';
        //build path to custom admin new comment okay email file
    } else {
        $admin_new_comment_okay_email_file = $cmtx_path . 'includes/emails/' . cmtx_setting('language_frontend') . '/admin/new_comment_okay.txt';
        //build path to admin new comment okay email file
    }
    $body = file_get_contents($admin_new_comment_okay_email_file);
    //get the file's contents
    $page_reference = cmtx_decode(cmtx_get_page_reference());
    //get the reference of the current page
    $page_url = cmtx_decode(cmtx_get_page_url());
    //get the URL of the current page
    $comment_url = cmtx_decode(cmtx_get_permalink($comment_id, cmtx_get_page_url()));
    //get the permalink of the comment
    $poster = cmtx_prepare_name_for_email($poster);
    //prepare name for email
    $comment = cmtx_prepare_comment_for_email($comment);
    //prepare comment for email
    $admin_link = cmtx_url_encode_spaces(cmtx_setting('commentics_url') . cmtx_setting('admin_folder')) . '/';
    //build admin panel link
    //convert email variables with actual variables
    $body = str_ireplace('[page reference]', $page_reference, $body);
    $body = str_ireplace('[page url]', $page_url, $body);
    $body = str_ireplace('[comment url]', $comment_url, $body);
    $body = str_ireplace('[poster]', $poster, $body);
    $body = str_ireplace('[comment]', $comment, $body);
    $body = str_ireplace('[admin link]', $admin_link, $body);
    $body = str_ireplace('[signature]', cmtx_setting('signature'), $body);
    //select administrators from database
    $admins = cmtx_db_query("SELECT `email` FROM `" . $cmtx_mysql_table_prefix . "admins` WHERE `receive_email_new_comment_okay` = '1' AND `is_enabled` = '1'");
    while ($admin = cmtx_db_fetch_assoc($admins)) {
        //while there are administrators
        $email = $admin['email'];
        //get administrator email address
        if ($cmtx_is_admin && cmtx_is_admin_email($email)) {
        } else {
            //if not detected admin who submitted
            cmtx_email($email, null, cmtx_setting('admin_new_comment_okay_subject'), $body, cmtx_setting('admin_new_comment_okay_from_email'), cmtx_setting('admin_new_comment_okay_from_name'), cmtx_setting('admin_new_comment_okay_reply_to'));
        }
    }
}
Example #5
0
function cmtx_notify_subscribers_admin($poster, $comment, $page_id, $comment_id)
{
    //notify subscribers of admin comment
    global $cmtx_mysql_table_prefix, $cmtx_parent_emails;
    //globalise variables
    $page_id = cmtx_sanitize($page_id);
    $comment_id = cmtx_sanitize($comment_id);
    //select confirmed subscribers from database
    $subscribers = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "subscribers` WHERE `page_id` = '{$page_id}' AND `is_confirmed` = '1'");
    $page_query = cmtx_db_query("SELECT * FROM `" . $cmtx_mysql_table_prefix . "pages` WHERE `id` = '{$page_id}'");
    $page_result = cmtx_db_fetch_assoc($page_query);
    $page_reference = cmtx_decode($page_result['reference']);
    $page_url = cmtx_decode($page_result['url']);
    $comment_url = cmtx_decode(cmtx_get_permalink($comment_id, $page_result['url']));
    //get the permalink of the comment
    if (file_exists('../includes/emails/' . cmtx_setting('language_frontend') . '/user/custom/subscriber_notification_admin.txt')) {
        $subscriber_notification_admin_email_file = '../includes/emails/' . cmtx_setting('language_frontend') . '/user/custom/subscriber_notification_admin.txt';
        //build path to custom subscriber notification admin email file
    } else {
        $subscriber_notification_admin_email_file = '../includes/emails/' . cmtx_setting('language_frontend') . '/user/subscriber_notification_admin.txt';
        //build path to subscriber notification admin email file
    }
    $poster = cmtx_prepare_name_for_email($poster);
    //prepare name for email
    $comment = cmtx_prepare_comment_for_email($comment);
    //prepare comment for email
    $count = 0;
    //count how many emails are sent
    while ($subscriber = cmtx_db_fetch_assoc($subscribers)) {
        //while there are subscribers
        if (!in_array($subscriber['email'], $cmtx_parent_emails)) {
            $body = file_get_contents($subscriber_notification_admin_email_file);
            //get the file's contents
            $email = $subscriber['email'];
            $name = cmtx_prepare_name_for_email($subscriber['name']);
            //prepare name for email
            $token = $subscriber['token'];
            $subscription_link = cmtx_url_encode_spaces(cmtx_setting('commentics_url')) . 'subscribers.php' . '?id=' . $token;
            //build subscription link
            //convert email variables with actual variables
            $body = str_ireplace('[name]', $name, $body);
            $body = str_ireplace('[page reference]', $page_reference, $body);
            $body = str_ireplace('[page url]', $page_url, $body);
            $body = str_ireplace('[comment url]', $comment_url, $body);
            $body = str_ireplace('[poster]', $poster, $body);
            $body = str_ireplace('[comment]', $comment, $body);
            $body = str_ireplace('[signature]', cmtx_setting('signature'), $body);
            $body = str_ireplace('[subscription link]', $subscription_link, $body);
            //send email
            cmtx_email($email, $name, cmtx_setting('subscriber_notification_admin_subject'), $body, cmtx_setting('subscriber_notification_admin_from_email'), cmtx_setting('subscriber_notification_admin_from_name'), cmtx_setting('subscriber_notification_admin_reply_to'));
            $count++;
            //increment email counter
        }
    }
    cmtx_db_query("UPDATE `" . $cmtx_mysql_table_prefix . "comments` SET `is_sent` = '1' WHERE `id` = '{$comment_id}'");
    //mark comment as sent
    cmtx_db_query("UPDATE `" . $cmtx_mysql_table_prefix . "comments` SET `sent_to` = `sent_to` + '{$count}' WHERE `id` = '{$comment_id}'");
    //set how many were sent (if any)
}