-
Notifications
You must be signed in to change notification settings - Fork 5
/
tag.php
67 lines (51 loc) · 1.5 KB
/
tag.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/**
* Shows posts by tag
*
* @author Brian Moon <[email protected]>
* @copyright 1997-Present Brian Moon
* @package Wordcraft
* @license http://wordcraft.googlecode.com/files/license.txt
* @link http://wordcraft.googlecode.com/
*
*/
include_once "./include/common.php";
include_once "./include/database.php";
include_once "./include/output.php";
include_once "./include/format.php";
$display = 10;
if(isset($_GET["s"])){
$start = (int)$_GET["s"];
} else {
$start = 0;
}
$tag = (isset($_GET["tag"])) ? trim((string)$_GET["tag"]) : "";
if(empty($tag)){
wc_output("notfound");
return;
}
list($WCDATA["posts"], $total_posts) = wc_db_get_post_list($start, $display, true, "", $tag);
if($total_posts<1){
wc_output("notfound");
return;
}
foreach($WCDATA["posts"] as &$post){
wc_format_post($post);
}
unset($post);
$WCDATA["title"] = "Posts tagged with `".htmlspecialchars($tag, ENT_COMPAT, "UTF-8")."` - ".$WC["default_title"];
$WCDATA["description"] = "Posts tagged with `".htmlspecialchars($tag, ENT_COMPAT, "UTF-8")."`. ".$WC["default_description"];
$WCDATA["feed_url"] = wc_get_url("feed", array("rss", $tag, ""));
if($total_posts > $start + $display) {
$s = $start + $display;
$WCDATA["older_url"] = wc_get_url("tag", array($tag))."&s=$s";
}
if(($start > 0)){
$WCDATA["newer_url"] = wc_get_url("tag", array($tag));
$s = $start - $display;
if($s>0){
$WCDATA["newer_url"].="&s=$s";
}
}
wc_output("post_list", $WCDATA);
?>