PageRenderTime 28ms CodeModel.GetById 23ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

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