PageRenderTime 45ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/themes/hicms/gbook.php

https://github.com/kikaendeavor/wordpress
PHP | 40 lines | 34 code | 3 blank | 3 comment | 4 complexity | 4e70224918e45c24150f1ab9a98aa18f MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /*
  3. Template Name: Guestbook
  4. */
  5. ?>
  6. <?php get_header(); ?>
  7. <div id="roll"><div title="回到顶部" id="roll_top"></div><div title="查看评论" id="ct"></div><div title="转到底部" id="fall"></div></div>
  8. <div id="content">
  9. <div class="main"><?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  10. <div class="left">
  11. <div class="post_date"><span class="date_m"><?php echo date('M',get_the_time('U'));?></span><span class="date_d"><?php the_time('d') ?></span><span class="date_y"><?php the_time('Y') ?></span></div>
  12. <div class="article">
  13. <h2 style="color:#f00">灌水先锋队</h2><?php if (get_option('swt_type') == 'Display') { ?>
  14. <div class="v_comment"><ul>
  15. <?php
  16. $counts = $wpdb->get_results("SELECT COUNT(comment_ID) AS cnt, comment_author, comment_author_url, comment_author_email FROM (SELECT * FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->posts.ID=$wpdb->comments.comment_post_ID) WHERE comment_date > date_sub( NOW(), INTERVAL 3 MONTH ) AND user_id='0' AND comment_author_email != '' AND post_password='' AND comment_approved='1' AND comment_type='') AS tempcmt GROUP BY comment_author_email ORDER BY cnt DESC LIMIT 56");
  17. foreach ($counts as $count) {
  18. $a = get_bloginfo('wpurl') . '/avatar/' . md5(strtolower($count->comment_author_email)) . '.jpg';
  19. $c_url = $count->comment_author_url;
  20. $mostactive .= '<li class="mostactive">' . '<a href="'. $c_url . '" title="' . $count->comment_author . ' (留下'. $count->cnt . '个脚印)" target="_blank" rel="external nofollow"><img src="' . $a . '" alt="' . $count->comment_author . ' (留下'. $count->cnt . '个脚印)" class="avatar" /></a></li>';
  21. }
  22. echo $mostactive;
  23. ?></ul>
  24. </div>
  25. <?php { echo ''; } ?>
  26. <?php } else { include(TEMPLATEPATH . '/gbook2.php'); } ?>
  27. <div class="clear"></div>
  28. <p class="articles_all">欢迎大家多多灌水有访必回</p>
  29. </div></div>
  30. <div class="articles">
  31. <?php comments_template(); ?>
  32. </div>
  33. <?php endwhile; else: ?>
  34. <?php endif; ?>
  35. </div>
  36. <?php get_sidebar(); ?>
  37. <?php get_footer(); ?>