index.php 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <?php
  2. include 'common.php';
  3. include 'header.php';
  4. include 'menu.php';
  5. $stat = \Widget\Stat::alloc();
  6. ?>
  7. <div class="main">
  8. <div class="container typecho-dashboard">
  9. <?php include 'page-title.php'; ?>
  10. <div class="row typecho-page-main">
  11. <div class="col-mb-12 welcome-board" role="main">
  12. <p><?php _e('目前有 <em>%s</em> 篇文章, 并有 <em>%s</em> 条关于你的评论在 <em>%s</em> 个分类中.',
  13. $stat->myPublishedPostsNum, $stat->myPublishedCommentsNum, $stat->categoriesNum); ?>
  14. <br><?php _e('点击下面的链接快速开始:'); ?></p>
  15. <ul id="start-link" class="clearfix">
  16. <?php if ($user->pass('contributor', true)): ?>
  17. <li><a href="<?php $options->adminUrl('write-post.php'); ?>"><?php _e('撰写新文章'); ?></a></li>
  18. <?php if ($user->pass('editor', true) && 'on' == $request->get('__typecho_all_comments') && $stat->waitingCommentsNum > 0): ?>
  19. <li>
  20. <a href="<?php $options->adminUrl('manage-comments.php?status=waiting'); ?>"><?php _e('待审核的评论'); ?></a>
  21. <span class="balloon"><?php $stat->waitingCommentsNum(); ?></span>
  22. </li>
  23. <?php elseif ($stat->myWaitingCommentsNum > 0): ?>
  24. <li>
  25. <a href="<?php $options->adminUrl('manage-comments.php?status=waiting'); ?>"><?php _e('待审核评论'); ?></a>
  26. <span class="balloon"><?php $stat->myWaitingCommentsNum(); ?></span>
  27. </li>
  28. <?php endif; ?>
  29. <?php if ($user->pass('editor', true) && 'on' == $request->get('__typecho_all_comments') && $stat->spamCommentsNum > 0): ?>
  30. <li>
  31. <a href="<?php $options->adminUrl('manage-comments.php?status=spam'); ?>"><?php _e('垃圾评论'); ?></a>
  32. <span class="balloon"><?php $stat->spamCommentsNum(); ?></span>
  33. </li>
  34. <?php elseif ($stat->mySpamCommentsNum > 0): ?>
  35. <li>
  36. <a href="<?php $options->adminUrl('manage-comments.php?status=spam'); ?>"><?php _e('垃圾评论'); ?></a>
  37. <span class="balloon"><?php $stat->mySpamCommentsNum(); ?></span>
  38. </li>
  39. <?php endif; ?>
  40. <?php if ($user->pass('administrator', true)): ?>
  41. <li><a href="<?php $options->adminUrl('themes.php'); ?>"><?php _e('更换外观'); ?></a></li>
  42. <li><a href="<?php $options->adminUrl('plugins.php'); ?>"><?php _e('插件管理'); ?></a></li>
  43. <li><a href="<?php $options->adminUrl('options-general.php'); ?>"><?php _e('系统设置'); ?></a>
  44. </li>
  45. <?php endif; ?>
  46. <?php endif; ?>
  47. <!--<li><a href="<?php $options->adminUrl('profile.php'); ?>"><?php _e('更新我的资料'); ?></a></li>-->
  48. </ul>
  49. </div>
  50. <div class="col-mb-12 col-tb-4" role="complementary">
  51. <section class="latest-link">
  52. <h3><?php _e('最近发布的文章'); ?></h3>
  53. <?php \Widget\Contents\Post\Recent::alloc('pageSize=10')->to($posts); ?>
  54. <ul>
  55. <?php if ($posts->have()): ?>
  56. <?php while ($posts->next()): ?>
  57. <li>
  58. <span><?php $posts->date('n.j'); ?></span>
  59. <a href="<?php $posts->permalink(); ?>" class="title"><?php $posts->title(); ?></a>
  60. </li>
  61. <?php endwhile; ?>
  62. <?php else: ?>
  63. <li><em><?php _e('暂时没有文章'); ?></em></li>
  64. <?php endif; ?>
  65. </ul>
  66. </section>
  67. </div>
  68. <div class="col-mb-12 col-tb-4" role="complementary">
  69. <section class="latest-link">
  70. <h3><?php _e('最近得到的回复'); ?></h3>
  71. <ul>
  72. <?php \Widget\Comments\Recent::alloc('pageSize=10')->to($comments); ?>
  73. <?php if ($comments->have()): ?>
  74. <?php while ($comments->next()): ?>
  75. <li>
  76. <span><?php $comments->date('n.j'); ?></span>
  77. <a href="<?php $comments->permalink(); ?>"
  78. class="title"><?php $comments->author(false); ?></a>:
  79. <?php $comments->excerpt(35, '...'); ?>
  80. </li>
  81. <?php endwhile; ?>
  82. <?php else: ?>
  83. <li><?php _e('暂时没有回复'); ?></li>
  84. <?php endif; ?>
  85. </ul>
  86. </section>
  87. </div>
  88. <div class="col-mb-12 col-tb-4" role="complementary">
  89. <section class="latest-link">
  90. <h3><?php _e('官方最新日志'); ?></h3>
  91. <div id="typecho-message">
  92. <ul>
  93. <li><?php _e('读取中...'); ?></li>
  94. </ul>
  95. </div>
  96. </section>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. <?php
  102. include 'copyright.php';
  103. include 'common-js.php';
  104. ?>
  105. <script>
  106. $(document).ready(function () {
  107. var ul = $('#typecho-message ul'), cache = window.sessionStorage,
  108. html = cache ? cache.getItem('feed') : '',
  109. update = cache ? cache.getItem('update') : '';
  110. if (!!html) {
  111. ul.html(html);
  112. } else {
  113. html = '';
  114. $.get('<?php $options->index('/action/ajax?do=feed'); ?>', function (o) {
  115. for (var i = 0; i < o.length; i++) {
  116. var item = o[i];
  117. html += '<li><span>' + item.date + '</span> <a href="' + item.link + '" target="_blank">' + item.title
  118. + '</a></li>';
  119. }
  120. ul.html(html);
  121. cache.setItem('feed', html);
  122. }, 'json');
  123. }
  124. function applyUpdate(update) {
  125. if (update.available) {
  126. $('<div class="update-check message error"><p>'
  127. + '<?php _e('您当前使用的版本是 %s'); ?>'.replace('%s', update.current) + '<br />'
  128. + '<strong><a href="' + update.link + '" target="_blank">'
  129. + '<?php _e('官方最新版本是 %s'); ?>'.replace('%s', update.latest) + '</a></strong></p></div>')
  130. .insertAfter('.typecho-page-title').effect('highlight');
  131. }
  132. }
  133. if (!!update) {
  134. applyUpdate($.parseJSON(update));
  135. } else {
  136. $.get('<?php $options->index('/action/ajax?do=checkVersion'); ?>', function (o, status, resp) {
  137. applyUpdate(o);
  138. cache.setItem('update', resp.responseText);
  139. }, 'json');
  140. }
  141. });
  142. </script>
  143. <?php include 'footer.php'; ?>