Ejemplo n.º 1
0
/**
 * Show affected comments
 *
 * @param array affected Comment list, all comments in this list must have the same status
 * @param string Comment visibility status in this list
 * @param string ban keyword
 * @param integer The number of corresponding comments on which current user has no permission
 */
function echo_affected_comments($affected_comments, $status, $keyword, $noperms_count)
{
    global $current_User;
    $num_comments = count($affected_comments);
    if ($num_comments == 0) {
        if ($noperms_count == 0) {
            // There isn't any affected comment witch corresponding status
            printf('<p>' . T_('No %s comments match the keyword [%s].') . '</p>', '<strong>' . $status . '</strong>', htmlspecialchars($keyword));
        } else {
            // There are affected comment witch corresponding status, but current user has no permission
            printf('<p>' . T_('There are %d matching %s comments, but you have no permission to edit them.') . '</p>', $noperms_count, '<strong>' . $status . '</strong>');
        }
        return;
    }
    echo '<p>';
    if ($current_User->check_perm('blogs', 'editall', false)) {
        // current User has rights to permanently delete comments
        $checkbox_status = 'checked="checked"';
    } else {
        // current User doesn't have rights to permanently delete comments, so disable delete checkbox
        $checkbox_status = 'disabled="disabled"';
    }
    echo '<input type="checkbox" name="del' . $status . '" id="del' . $status . '_cb" value="1" ' . $checkbox_status . '/>';
    echo '<label for="del' . $status . '_cb"> ';
    echo sprintf(T_('Delete the following %s %s comments:'), $num_comments == 500 ? '500+' : $num_comments, '<strong>' . $status . '</strong>');
    echo '</label>';
    echo '</p>';
    echo '<table class="grouped" cellspacing="0">';
    echo '<thead><tr>';
    echo '<th class="firstcol">' . T_('Date') . '</th>';
    echo '<th class="center">' . T_('Auth. IP') . '</th>';
    echo '<th>' . T_('Author') . '</th>';
    echo '<th>' . T_('Auth. URL') . '</th>';
    echo '<th>' . T_('Content starts with...') . '</th>';
    echo '<th class="shrinkwrap">' . T_('Action') . '</th>';
    echo '</tr></thead>';
    $count = 0;
    foreach ($affected_comments as $Comment) {
        echo '<tr class="' . ($count % 2 == 1 ? 'odd' : 'even') . '">';
        echo '<td class="firstcol timestamp">' . mysql2localedatetime_spans($Comment->get('date')) . '</td>';
        echo '<td class="center">' . $Comment->get('author_IP') . '</td>';
        echo '<td>' . $Comment->get_author_name() . '</td>';
        echo '<td>';
        disp_url($Comment->get_author_url(), 50);
        echo '</td>';
        echo '<td>' . strmaxlen(strip_tags($Comment->get_content('raw_text')), 71) . '</td>';
        // no permission check, because affected_comments contains current user editable comments
        echo '<td class="shrinkwrap">' . action_icon(T_('Edit...'), 'edit', '?ctrl=comments&amp;action=edit&amp;comment_ID=' . $Comment->ID) . '</td>';
        echo '</tr>';
        $count++;
    }
    echo "</tbody></table>";
}
Ejemplo n.º 2
0
        stats_referer();
        ?>
"><?php 
        stats_basedomain();
        ?>
</a></td>
					<td class="center"><?php 
        stats_hit_remote_addr();
        ?>
</td>
					<td><?php 
        echo format_to_output($row_stats['blog_shortname'], 'htmlbody');
        ?>
</td>
					<td><?php 
        disp_url($row_stats['hit_uri'], 50);
        ?>
</td>
				</tr>
				<?php 
        $count++;
    }
    ?>
			</tbody>
		</table>
	<?php 
}
// Check for potentially affected comments:
$sql = 'SELECT *
			  FROM T_comments
			 WHERE comment_author LIKE ' . $DB->quote('%' . $keyword . '%') . '
Ejemplo n.º 3
0
        // TODO: new Comment( $row_stats )
        ?>
				<tr class="<?php 
        echo $count % 2 == 1 ? 'odd' : 'even';
        ?>
">
				<td class="firstcol"><?php 
        echo mysql2date(locale_datefmt() . ' ' . locale_timefmt(), $row_stats['comment_date']);
        ?>
</td>
				<td><?php 
        echo $row_stats['comment_author'];
        ?>
</a></td>
				<td><?php 
        disp_url($row_stats['comment_author_url'], 50);
        ?>
</td>
				<td><?php 
        echo $row_stats['comment_author_IP'];
        ?>
</td>
				<td><?php 
        $comment_content = strip_tags($row_stats['comment_content']);
        if (strlen($comment_content) > 70) {
            // Trail off (truncate and add '...') after 70 chars
            echo substr($comment_content, 0, 70) . "...";
        } else {
            echo $comment_content;
        }
        ?>