示例#1
0
 /**
  * Template function: display comment's author's IP
  *
  * @param string String to display before IP, if IP exists
  * @param string String to display after IP, if IP exists
  * @param boolean|string Type of url
  *                TRUE|'filter' - create an url to filter by IP
  *                'antispam' - to antispam page with filtered by the IP
  *                FALSE - display IP as plain text without link
  * @param boolean TRUE to display a link to antispam ip page
  */
 function author_ip($before = '', $after = '', $IP_link_to = false, $display_antispam_link = false)
 {
     if (!empty($this->author_IP)) {
         global $Plugins, $CommentList;
         $author_IP = $this->author_IP;
         if ($IP_link_to === 'antispam') {
             // Add link to antispam page
             $author_IP = implode(', ', get_linked_ip_list(array($author_IP)));
         } elseif ($IP_link_to === 'filter' || $IP_link_to) {
             // Add link to filter by IP
             $filter_IP_url = regenerate_url('filter,ctrl,comments,cmnt_fullview_comments', 'cmnt_fullview_author_IP=' . $author_IP . '&ctrl=comments');
             $author_IP = '<a href="' . $filter_IP_url . '">' . $author_IP . '</a>';
         }
         echo $before;
         // Filter the IP by plugins for display, allowing e.g. the DNSBL plugin to add a link that displays info about the IP:
         echo $Plugins->get_trigger_event('FilterIpAddress', array('format' => 'htmlbody', 'data' => $author_IP), 'data');
         if ($display_antispam_link) {
             // Display a link to antispam ip page
             $antispam_icon = get_icon('lightning', 'imgtag', array('title' => T_('Go to edit this IP address in antispam control panel')));
             echo ' ' . implode(', ', get_linked_ip_list(array($this->author_IP), NULL, $antispam_icon));
         }
         echo $after;
     }
 }
        $ItemCache =& get_ItemCache();
        $Item =& $ItemCache->get_by_ID($params['post_id']);
        echo sprintf(T_('Message sent from your post: %s.'), '<a href="' . $Item->get_permanent_url('', '', '&') . '"' . emailskin_style('.a') . '>' . $Item->get('title') . '</a>');
    } else {
        // From contact form
        echo sprintf(T_('Message sent through the contact form on %s.'), '<b>' . $Blog->get('shortname') . '</b>');
    }
    echo '</p>';
}
// show sender name
echo '<p' . emailskin_style('.p') . '>' . sprintf(T_('%s (%s) has sent you this message:'), '<b>' . $params['sender_name'] . '</b>', '<a href="mailto:' . $params['sender_address'] . '"' . emailskin_style('.a') . '>' . $params['sender_address'] . '</a>') . '</p>';
echo '<div class="email_ugc"' . emailskin_style('div.email_ugc') . '>' . "\n";
echo '<p' . emailskin_style('.p') . '>' . nl2br(htmlentities($params['message'], ENT_COMPAT, $evo_charset)) . '</p>';
echo "</div>\n";
// show sender IP address
$ip_list = implode(', ', get_linked_ip_list(NULL, $recipient_User));
echo '<p' . emailskin_style('.p') . '>' . sprintf(T_('This message was typed by a user connecting from this IP address: %s.'), $ip_list) . '</p>';
// show sender email address
echo '<p' . emailskin_style('.p') . '>' . sprintf(T_('By replying, your email will go directly to %s.'), '<a href="mailto:' . $params['sender_address'] . '"' . emailskin_style('.a') . '>' . $params['sender_address'] . '</a>') . '</p>';
if (!empty($recipient_User)) {
    // Member:
    global $Settings;
    if ($Settings->get('emails_msgform') == 'userset') {
        // user can allow/deny to receive emails
        $edit_preferences_url = NULL;
        if (!empty($Blog)) {
            // go to blog
            $edit_preferences_url = $Blog->get('userprefsurl', array('glue' => '&'));
        } elseif ($recipient_User->check_perm('admin', 'restricted')) {
            // go to admin
            $edit_preferences_url = $admin_url . '?ctrl=user&user_tab=userprefs&user_ID=' . $recipient_User->ID;
示例#3
0
$Comment = $params['Comment'];
$Blog = $params['Blog'];
$Item = $params['Item'];
$recipient_User =& $params['recipient_User'];
$author_name = empty($params['author_ID']) ? $params['author_name'] : get_user_colored_login_link($params['author_name'], array('use_style' => true));
if ($params['notify_type'] == 'meta_comment') {
    // Meta comment
    $info_text = T_('%s posted a new meta comment on %s in %s.');
} else {
    // Normal comment
    $info_text = T_('%s posted a new comment on %s in %s.');
}
$notify_message = '<p' . emailskin_style('.p') . '>' . sprintf($info_text, '<b>' . $author_name . '</b>', '<b>' . get_link_tag($Item->get_permanent_url('', '', '&'), $Item->get('title'), '.a') . '</b>', '<b>' . $Blog->get('shortname') . '</b>') . "</p>\n";
if ($params['notify_full']) {
    // Long format notification:
    $ip_list = implode(', ', get_linked_ip_list(array($Comment->author_IP), $recipient_User));
    $user_domain = gethostbyaddr($Comment->author_IP);
    if ($user_domain != $Comment->author_IP) {
        // Add host name after author IP address
        $ip_list .= ', ' . $user_domain;
    }
    switch ($Comment->type) {
        case 'trackback':
            $notify_message .= '<p' . emailskin_style('.p') . '>' . T_('Trackback IP') . ': ' . $ip_list . "</p>\n";
            $notify_message .= '<p' . emailskin_style('.p') . '>' . T_('Url') . ': ' . get_link_tag($Comment->author_url, '', '.a') . "</p>\n";
            break;
        default:
            if (!$Comment->get_author_User()) {
                // Comment from visitor:
                $notify_message .= '<p' . emailskin_style('.p') . '>' . T_('Commenter IP') . ': ' . $ip_list . "</p>\n";
                $notify_message .= '<p' . emailskin_style('.p') . '>' . T_('Email') . ': ' . $Comment->author_email . "</p>\n";
示例#4
0
/**
 * Get comment author IP
 *
 * @param object Comment
 * @return string Comment author IP OR '---' if user has no permission to moderate this comment
 */
function get_author_ip($Comment, $param_prefix = '')
{
    global $current_User;
    if ($current_User->check_perm('comment!CURSTATUS', 'moderate', false, $Comment)) {
        if (empty($Comment->author_IP)) {
            return '';
        } else {
            $antispam_icon = get_icon('lightning', 'imgtag', array('title' => T_('Go to edit this IP address in antispam control panel')));
            $antispam_link = ' ' . implode(', ', get_linked_ip_list(array($Comment->author_IP), NULL, $antispam_icon));
            $filter_IP_url = regenerate_url('filter', $param_prefix . 'author_IP=' . $Comment->get('author_IP'));
            $country = $Comment->get_ip_country(' ');
            return '<a href="' . $filter_IP_url . '">' . $Comment->get('author_IP') . '</a>' . $antispam_link . $country;
        }
    } else {
        return '<span class="dimmed">---</span>';
    }
}