Beispiel #1
0
?>

</form>

<div class="deleting-post">
<?php 
if (!$post->is_deleted()) {
    ?>
  <br />
  <?php 
    if ($post_parent) {
        ?>
    Votes will be transferred to the following parent post.
    If this is incorrect, reparent this post before deleting it.<br />
  <?php 
        if (CONFIG::can_see_post(User::$current, $post_parent)) {
            ?>
    <ul id="post-list-posts"> <?php 
            echo print_preview($post_parent, array('hide_directlink' => true));
            ?>
 </ul>
  <?php 
        } else {
            ?>
    (parent post hidden due to access restrictions)
  <?php 
        }
        ?>

  <?php 
    } else {
Beispiel #2
0
 function can_be_seen_by(&$user = null, $options = array())
 {
     if (empty($options['show_deleted']) && $this->status == 'deleted') {
         return;
     }
     return CONFIG::can_see_post($user, $this);
 }
Beispiel #3
0
  <?php 
//unset($posts)
?>
</div>

<div style="margin-bottom: 1em;  float: left; clear: both;">
  <h4><a href="/post?tags=user%3A<?php 
echo $user->name;
?>
">Uploads</a></h4>
  <?php 
//$posts = array_map(function($x){if (CONFIG::can_see_post(User::$current, $x)) return $x;}, (array)$user->recent_uploaded_posts());
?>
  <?php 
render_partial("post/posts", array('posts' => array_map(function ($x) {
    if (CONFIG::can_see_post(User::$current, $x)) {
        return $x;
    }
}, (array) $user->recent_uploaded_posts())));
?>
    
</div>

<?php 
do_content_for("footer");
?>
    <li><a href="/user">List</a></li>
<?php 
if (User::is('>=40')) {
    ?>
    <li><a href="/user/block?id=<?php 
function print_preview($post, $options = array())
{
    $is_post = is_a($post, 'Post') ? true : false;
    if ($is_post && !CONFIG::can_see_post(User::$current, $post)) {
        return "";
    }
    $image_class = "preview";
    !isset($options['url_params']) && ($options['url_params'] = null);
    $image_id = isset($options['image_id']) ? 'id="' . $options['image_id'] . '"' : null;
    $image_title = $is_post ? h("Rating: " . $post->pretty_rating() . " Score: " . $post->score . " Tags: " . h($post->tags . " User: "******"' . $options['onclick'] . '"' : null;
    $link_onmouseover = isset($options['onmouseover']) ? ' onmouseover="' . $options['onmouseover'] . '"' : null;
    $link_onmouseout = isset($options['onmouseout']) ? ' onmouseout="' . $options['onmouseout'] . '"' : null;
    if (isset($options['display']) && $options['display'] == 'block') {
        # Show the thumbnail at its actual resolution, and crop it with northern orientation
        # to a smaller size.
        list($width, $height) = $post->raw_preview_dimensions();
        $block_size = array(200, 200);
        $visible_width = min(array($block_size[0], $width));
        $crop_left = ($width - $visible_width) / 2;
    } elseif (isset($options['display']) && $options['display'] == 'large') {
        list($width, $height) = $post->raw_preview_dimensions();
        $block_size = array($width, $height);
        $crop_left = 0;
    } else {
        # Scale it down to a smaller size.  This is exactly one half the actual size, to improve
        # resizing quality.
        list($width, $height) = $post->preview_dimensions();
        $block_size = array(150, 150);
        $crop_left = 0;
    }
    $image = '<img src="' . $post->preview_url . '" style="margin-left: ' . $crop_left * -1 . 'px;" alt="' . $image_title . '" class="' . $image_class . '" title="' . $image_title . '" ' . $image_id . ' width="' . $width . '" height="' . $height . '">';
    if ($is_post) {
        $plid = '<span class="plid">#pl http://' . CONFIG::server_host . '/post/show/' . $post->id . '</span>';
        $target_url = '/post/show/' . $post->id . '/' . $post->tag_title() . $options['url_params'];
    } else {
        $plid = "";
        $target_url = $post->url;
    }
    $link_class = "thumb";
    !$is_post && ($link_class .= " no-browser-link");
    $link = '<a class="' . $link_class . '" href="' . $target_url . '" ' . $link_onclick . $link_onmouseover . $link_onmouseout . '>' . $image . $plid . '</a>';
    $div = '<div class="inner" style="width: ' . $block_size[0] . 'px; height: ' . $block_size[1] . 'px;">' . $link . '</div>';
    if ($post->use_jpeg(User::$current) && empty($options['disable_jpeg_direct_links'])) {
        $dl_width = $post->jpeg_width;
        $dl_height = $post->jpeg_height;
        $dl_url = $post->jpeg_url;
    } else {
        $dl_width = $post->width;
        $dl_height = $post->height;
        $dl_url = $post->file_url;
    }
    $directlink_info = '
  <span class="directlink-info">
    <img class="directlink-icon directlink-icon-large" src="/images/ddl_large.gif" alt="">
    <img class="directlink-icon directlink-icon-small" src="/images/ddl.gif" alt="">
    <img class="parent-display" src="/images/post-star-parent.gif" alt="">
    <img class="child-display" src="/images/post-star-child.gif" alt="">
     <img class="flagged-display" src="/images/post-star-flagged.gif" alt="">
    <img class="pending-display" src="/images/post-star-pending.gif" alt="">
  </span>
  ';
    $li_class = "";
    $ddl_class = "directlink";
    $ddl_class .= $post->width > 1500 || $post->height > 1500 ? " largeimg" : " smallimg";
    if (!empty($options['similarity'])) {
        $icon = '<img src="' . $post->service_icon() . '" alt="' . $post->service() . '" class="service-icon" id="source">';
        $ddl_class .= " similar similar-directlink";
        is_numeric($options['similarity']) && $options['similarity'] >= 90 && ($li_class .= " similar-match");
        is_string($options['similarity']) && $options['similarity'] == 'Original' && ($li_class .= " similar-original");
        $directlink_info = '<span class="similar-text">' . $icon . '</span>' . $directlink_info;
    }
    if (!empty($options['hide_directlink'])) {
        $directlink = "";
    } else {
        $directlink_res = '<span class="directlink-res">' . $dl_width . ' x ' . $dl_height . '</span>';
        $directlink = '<a class="' . $ddl_class . '" href="' . $dl_url . '">' . $directlink_info . $directlink_res . '</a>';
    }
    if ($is_post) {
        # Hide regular posts by default.  They'll be unhidden by the scripts once the
        # blacklists are loaded.  Don't do this for ExternalPost, which don't support
        # blacklists.
        !empty($options['blacklisting']) && ($li_class .= " javascript-hide");
        $li_class .= " creator-id-" . $post->user_id;
    }
    $post->is_flagged() && ($li_class .= " flagged");
    $post->has_children && ($li_class .= " has-children");
    $post->parent_id && ($li_class .= " has-parent");
    $post->is_pending() && ($li_class .= " pending");
    # We need to specify a width on the <li>, since IE7 won't figure it out on its own.
    $item = '<li style="width: ' . ($block_size[0] + 10) . 'px;" id="p' . $post->id . '" class="' . $li_class . '">' . $div . $directlink . '</li>';
    return $item;
}