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

/footer.php

http://github.com/taylorchu/goolog
PHP | 86 lines | 76 code | 7 blank | 3 comment | 7 complexity | d6a91bb8a73bc7d836e50393fa2c863c MD5 | raw file
  1. <?php
  2. if(!isset($out))
  3. {
  4. exit;
  5. }
  6. if(in_array($out['self'], array('index', 'view', 'search')))
  7. {
  8. //link
  9. $out['sidebar'] .= '<b>' .(isAdmin()? '<a href="add.php/link"><i class="icon-plus"></i></a>' : '').$lang['link']. '</b>
  10. <ul>';
  11. $links = listEntry('link');
  12. if($links)
  13. {
  14. foreach($links as $link)
  15. {
  16. $linkEntry = readEntry('link', $link);
  17. $out['sidebar'] .= '<li>' .manageLink($link). '<a href="' .$linkEntry['url']. '">' .$linkEntry['name']. '</a></li>';
  18. }
  19. }
  20. else
  21. {
  22. $out['sidebar'] .= '<li>' .$lang['none']. '</li>';
  23. }
  24. $out['sidebar'] .= '</ul>';
  25. //category
  26. $out['sidebar'] .= '<b>' .(isAdmin()? '<a href="add.php/category"><i class="icon-plus"></i></a>' : '').$lang['category']. '</b>
  27. <ul>';
  28. $categories = listEntry('category');
  29. if($categories)
  30. {
  31. foreach($categories as $category)
  32. {
  33. $categoryEntry = readEntry('category', $category);
  34. $out['sidebar'] .= '<li>' .manageCategory($category). '<a href="view.php/category/' .$category. '">' .$categoryEntry['name']. ' (' .count($categoryEntry['post']). ')</a></li>';
  35. }
  36. }
  37. else
  38. {
  39. $out['sidebar'] .= '<li>' .$lang['none']. '</li>';
  40. }
  41. $out['sidebar'] .= '</ul>';
  42. //archive
  43. $archives = array();
  44. foreach(listEntry('post') as $post)
  45. {
  46. $year = substr($post, 0, 4);
  47. if(isset($archives[$year]))
  48. {
  49. $archives[$year]++;
  50. }
  51. else
  52. {
  53. $archives[$year] = 1;
  54. }
  55. }
  56. $out['sidebar'] .= '<b>' .$lang['archive']. '</b>
  57. <ul>';
  58. if($archives)
  59. {
  60. foreach($archives as $year => $count)
  61. {
  62. $out['sidebar'] .= '<li><a href="view.php/archive/' .$year. '">' .$year. ' (' .$count. ')</a></li>';
  63. }
  64. }
  65. else
  66. {
  67. $out['sidebar'] .= '<li>' .$lang['none']. '</li>';
  68. }
  69. $out['sidebar'] .= '</ul>';
  70. }
  71. if($out['self'] === 'feed')
  72. {
  73. require 'theme/' .$config['theme']. '/feed.tpl.php';
  74. }
  75. else
  76. {
  77. require 'theme/' .$config['theme']. '/main.tpl.php';
  78. }
  79. ?>