Example #1
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 #2
0
     } else {
         echo $cmtx_average_rating . '/5 (' . cmtx_number_of_ratings() . ')</span>';
     }
 }
 echo '</div>';
 /* *** Pagination (Top) *** */
 echo '<div class="cmtx_pagination_block_top">';
 if (cmtx_setting('enabled_pagination') && cmtx_setting('show_pagination_top') && $cmtx_total_pages > 1) {
     cmtx_paginate($cmtx_current_page, cmtx_setting('range_of_pages'), $cmtx_total_pages);
 }
 echo '</div>';
 /* *** Social *** */
 echo '<div class="cmtx_social_block">';
 if (cmtx_setting('show_social')) {
     $cmtx_social_url = cmtx_url_encode_spaces(cmtx_get_page_url());
     $cmtx_social_title = cmtx_url_encode_spaces(cmtx_get_page_reference());
     $cmtx_social_url = str_ireplace('&amp;', '%26', $cmtx_social_url);
     //convert &amp; to %26
     $cmtx_social_title = str_ireplace('&amp;', '%26', $cmtx_social_title);
     //convert &amp; to %26
     $cmtx_social_attribute = '';
     //initialize variable
     if (cmtx_setting('social_new_window')) {
         $cmtx_social_attribute = ' target="_blank"';
     }
     echo '<div class="cmtx_social_images">';
     if (cmtx_setting('show_social_facebook')) {
         echo '<a href="http://www.facebook.com/sharer.php?u=' . $cmtx_social_url . '&amp;t=' . $cmtx_social_title . '" rel="nofollow"' . $cmtx_social_attribute . '><img src="' . cmtx_commentics_url() . 'images/social/facebook.png" class="cmtx_social_image" title="Facebook" alt="Facebook"/></a>';
     }
     if (cmtx_setting('show_social_delicious')) {
         echo '<a href="http://delicious.com/post?url=' . $cmtx_social_url . '&amp;title=' . $cmtx_social_title . '" rel="nofollow"' . $cmtx_social_attribute . '><img src="' . cmtx_commentics_url() . 'images/social/delicious.png" class="cmtx_social_image" title="del.icio.us" alt="del.icio.us"/></a>';