}
            ?>
</strong><br />							
							
						</td><?php 
        } else {
            ?>
						<td colspan=2></td>
						<?php 
        }
        ?>
						<td class="manage-column column-author"><?php 
        if ($comment->id != NULL) {
            ?>
<div id="submitted-on"><?php 
            echo sk_avatar($comment->id, 40);
            echo $comment->alias . " | " . sprintf("<a href='http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s' target='_BLANK'>%s</a>", $comment->ip, $comment->ip) . " <br> " . $comment->date . " <br> ";
            if ($comment->email != "") {
                echo $comment->email;
            } else {
                _e('No e-mail registry', 'sk');
            }
            ?>
</div><div><p><img src='../wp-content/plugins/schreikasten/img/<?php 
            $img = 'ham.png';
            if ($comment->status == SK_SPAM) {
                $img = 'spam.png';
            }
            if ($comment->status == SK_BLACK) {
                $img = 'black.png';
            }
/**
* Format a comment to be displayed in the shoutbox
*
* @access public
* @param objetc comment The comment
* @param sending Is this the comment we are sending?
*/
function sk_format_comment($comment, $sending = false, $rand = false, $hide = false)
{
    global $current_user;
    if (!$rand) {
        $rand = mt_rand(111111, 999999);
    }
    $answer = "";
    $for = "";
    $av_size = 32;
    get_currentuserinfo();
    //check if this user can administrate
    $sk_canmannage = false;
    if (current_user_can(SK_CAP)) {
        $sk_canmannage = true;
    }
    $options = get_option('sk_options');
    //If we can reply a message, create the reply system
    if (sk_canReply()) {
        $for = " ";
        if (!$sending) {
            if ($comment->email != "") {
                $for .= "<a href='#sk_top' onclick='javascript:for_set{$rand}(" . $comment->id . ", \"" . $comment->alias . "\");'> " . __("[reply]", "sk") . "</a>";
            } else {
                $for .= "<span class='sk-for'>" . __("[no sender]", "sk") . "</span>";
            }
        }
    }
    //The classes for coloring the comments (used only if we are sending this comment)
    $class = "sk-userdata-user";
    $divClass = 'sk-comment';
    if ($comment && $comment->status == SK_SPAM) {
        $divClass .= '-spam';
        $class .= "-spam";
    }
    if ($comment && $comment->status == SK_MOOT) {
        $divClass .= '-moot';
        $class .= "-moot";
    }
    $mannage = "";
    //If the user can mannage, set the mannage system inside the comment
    if ($sk_canmannage) {
        $class = "sk-userdata-admin";
        if ($comment->status == SK_SPAM) {
            $class .= "-spam";
        }
        if ($comment->status == SK_MOOT) {
            $class .= "-moot";
        }
        $av_size = 41;
        $id = $comment->id;
        $edit = "<a href='" . htmlspecialchars(admin_url("edit-comments.php?page=skmanage&paged=1&mode=edit&id={$id}")) . "'>" . __('[edit]', 'sk') . "</a>";
        $mannage .= "<br/><a style='cursor: pointer;' onclick='sk_confirm_action(\"delete\", {$rand}, {$id}, sk_semaphore{$rand});'>" . __('Delete', 'sk') . "</a> | ";
        if ($comment->user_id != 0) {
            $mannage .= "<a style='cursor: pointer;' onclick='sk_confirm_action(\"set_black\", {$rand}, {$id}, sk_semaphore{$rand});'>" . __('Reject', 'sk') . "</a> | ";
        }
        $mannage .= "<a style='cursor: pointer;' onclick='sk_confirm_action(\"set_spam\", {$rand}, {$id}, sk_semaphore{$rand});'>" . __('Spam', 'sk') . "</a><br/>";
        if ($sending) {
            $mannage = "<br/>";
            $edit = "[ " . __('Sending', 'sk') . " ]";
        }
    }
    $avatar = "";
    $item = "";
    //Get the avatar using the specific size
    if ($options['avatar']) {
        $avatar = sk_avatar($comment->id, $av_size);
    }
    $comment_text = sk_format_text($comment->text);
    $comment_text = str_replace("<p>", "", $comment_text);
    $comment_text = str_replace("</p>", "", $comment_text);
    //If we have to hide this comment it's because this is the
    //section that would display the message while we ask if it's spam.
    //Then we have to set the comment part as the section that would have
    //the message and the alias.
    $th_alias_id = $th_text_id = "";
    if ($hide) {
        $th_alias_id = " id='th_sk_alias{$rand}'";
        $th_text_id = " id='th_sk_text{$rand}'";
    }
    //Create the comment text
    $item .= "<div style='min-height: " . $av_size . "px;' class='{$class}'>" . $avatar . "<strong{$th_alias_id}>" . $comment->alias . "</strong>\r\n\t\t\t<br/><div class='sk-little'>(" . $comment->date . "){$mannage}</div>\r\n\t\t</div>\r\n\t\t<div class='sk-widgettext'>\r\n\t\t\t<div class='skwidget-comment'{$th_text_id}>" . $comment_text . "</div>\r\n\t\t\t<div class='skwidget-edit'>{$for} {$edit}</div>\r\n\t\t\t<div style='clear: both;'></div>\r\n\t\t</div>";
    if ($options['layout'] == SK_LAYOUT_QA) {
        if ($replies = sk_format_replies($comment->id, $sk_canmannage, $rand)) {
            $item .= $replies;
        }
    }
    //if we show avatars, use the images
    $id = $comment->id;
    $user_id = $comment->user_id;
    //Set the comment owner type
    $usertype = 'sk-user-user';
    if ($user_id > 0) {
        $comment_user = get_userdata($user_id);
        $capabilities = $comment_user->wp_capabilities;
        //->administrator;
        if (isset($capabilities['author']) && $capabilities['author'] == 1) {
            $usertype = 'sk-user-author';
        }
        if (isset($capabilities['editor']) && $capabilities['editor'] == 1) {
            $usertype = 'sk-user-editor';
        }
        if (isset($capabilities['administrator']) && $capabilities['administrator'] == 1) {
            $usertype = 'sk-user-admin';
        }
    }
    $sk_id = "id='sk-{$rand}-{$id}'";
    $class = "class='{$divClass} {$usertype}'";
    if ($hide) {
        $class = "class='throbber-img-off' style='visibility: hidden;'";
        $sk_id = "id='throbber-img{$rand}'";
    }
    if ($options['avatar']) {
        $answer .= "\n<div {$class} {$sk_id}><a name='sk-comment-id{$id}'></a>\r\n\t\t{$item}\r\n\t\t</div>";
    } else {
        //else, it's a list item
        $answer .= "\n<li {$class} {$sk_id}><a name='sk-comment-id{$id}'></a>\r\n\t\t\t\t{$item}\r\n\t\t\t\t</li>";
    }
    return $answer;
}
Exemple #3
0
												</span><?php } ?>
														<?php if($data->status==SK_MOOT || $data->status==SK_HAM) { ?><span> | <a href="<?php echo add_query_arg( array('paged'=>$page, 'mode_x' => 'set_spam_x', 'id' => $data->id, 'tid' => $tid ) );?>" class="edit" onclick="javascript:check=confirm( '<?php printf($status_message, $act_message, $spam_message); ?>');if(check==false) return false;"><?php _e('Spam', 'sk'); ?></a>
															</span><?php } ?>
																	<span class='tracking'> | <a href="<?php echo add_query_arg( array( 'mode' => 'tracking', 'tid' => $data->id) ); ?>" class="tracking"><?php _e('Tracking', 'sk') ?></a></span><?php
																					if($select==SK_BLACK) { ?>
																						<?php if($block_id=sk_is_blacklisted($data->user_id)) { ?><span> | <a href="<?php echo add_query_arg( array('paged'=>$page, 'mode_x' => 'unlock_x', 'id' => $block_id, 'tid' => $tid) ); ?>" class="edit" onclick="javascript:check=confirm( '<?php _e("Are you sure you want to unlock this PC?",'sk')?>');if(check==false) return false;"><?php _e('Unlock PC', 'sk') ?></a></span><?php } else { ?>
																							<span> | <a href="<?php echo add_query_arg( array('paged'=>$page, 'mode_x' => 'lock_x', 'id' => $data->id, 'tid' => $tid) ); ?>" class="edit" onclick="javascript:check=confirm( '<?php _e("Are you sure you want to lock this PC?",'sk')?>');if(check==false) return false;"><?php _e('Lock PC', 'sk') ?></a></span>
																									<?php } 
																					} ?>
																							</div>
						</td>
				</tr><?
				foreach($comments as $comment) { ?>
				<tr id='comment-<?php echo $comment->id; ?>'>
					<td class="column-author"> <?php 
						echo sk_avatar($comment->id, 32);
						echo "<strong>{$comment->alias}</strong>"; ?>
								<br /><?php 
									if($comment->email!="")
										echo $comment->email;
									else
										_e('No e-mail registry', 'sk');
									if($comment->user_id>0) { 
										echo "<br/>";
										printf(" (".__('registered user', 'sk').")");
									}
									printf("<br><a href='http://ws.arin.net/cgi-bin/whois.pl?queryinput=%s' target='_BLANK'>%s</a>", $comment->ip, $comment->ip); ?>
								</td>
							<td class="comment column-comment"><div id="submitted-on"><?php echo $comment->date; ?></div><p><img src='../wp-content/plugins/schreikasten/img/<?php $img='ham.png'; if($comment->status==SK_SPAM) $img='spam.png'; if($comment->status==SK_BLACK) $img='black.png'; if($comment->status==SK_MOOT) $img='moot.png'; echo $img; ?>'> <?php echo $comment->text; ?></p><?php
							$act_message="";
							$spam_message=strtolower( _n('Spam', 'Spam', 1, 'sk') );