3 require('includes/header.php');
4 update_activity('history');
7 if ( ! ctype_digit($_GET['p']) ||
$_GET['p'] < 2)
10 $page_title = 'Your latest post history';
14 $current_page = $_GET['p'];
15 $page_title = 'Your post history, page #' . number_format($current_page);
18 $items_per_page = ITEMS_PER_PAGE
;
19 $start_listing_at = $items_per_page * ($current_page - 1);
23 $stmt = $link->prepare('SELECT id, time, replies, visits, headline FROM topics WHERE author = ? ORDER BY id DESC LIMIT ?, ?');
24 $stmt->bind_param('sii', $_SESSION['UID'], $start_listing_at, $items_per_page);
26 $stmt->bind_result($topic_id, $topic_time, $topic_replies, $topic_visits, $topic_headline);
28 $topics = new table();
36 $topics->define_columns($columns, 'Headline');
37 $topics->add_td_class('Headline', 'topic_headline');
43 '<a href="/topic/' . $topic_id . '">' . htmlspecialchars($topic_headline) . '</a>',
44 replies($topic_id, $topic_replies),
45 format_number($topic_visits),
46 '<span class="help" title="' . format_date($topic_time) . '">' . calculate_age($topic_time) . '</span>'
49 $topics->row($values);
52 $num_topics_fetched = $topics->num_rows_fetched
;
53 echo $topics->output('topics');
57 $stmt = $link->prepare('SELECT replies.id, replies.parent_id, replies.time, replies.body, topics.headline, topics.time FROM replies INNER JOIN topics ON replies.parent_id = topics.id WHERE replies.author = ? ORDER BY id DESC LIMIT ?, ?');
58 $stmt->bind_param('sii', $_SESSION['UID'], $start_listing_at, $items_per_page);
60 $stmt->bind_result($reply_id, $parent_id, $reply_time, $reply_body, $topic_headline, $topic_time);
62 $replies = new table();
69 $replies->define_columns($columns, 'Topic');
70 $replies->add_td_class('Topic', 'topic_headline');
71 $replies->add_td_class('Reply snippet', 'reply_body_snippet');
77 '<a href="/topic/' . $parent_id . '#reply_' . $reply_id . '">' . snippet($reply_body) . '</a>',
78 '<a href="/topic/' . $parent_id . '">' . htmlspecialchars($topic_headline) . '</a> <span class="help unimportant" title="' . format_date($topic_time) . '">(' . calculate_age($topic_time) . ' old)</span>',
79 '<span class="help" title="' . format_date($reply_time) . '">' . calculate_age($reply_time) . '</span>'
82 $replies->row($values);
85 $num_replies_fetched = $replies->num_rows_fetched
;
86 echo $replies->output('replies');
88 page_navigation('history', $current_page, $num_replies_fetched);
90 require('includes/footer.php');