diff options
author | citizenz7 <citizenz7@protonmail.com> | 2017-04-20 18:50:55 +0200 |
---|---|---|
committer | citizenz7 <citizenz7@protonmail.com> | 2017-04-20 18:50:55 +0200 |
commit | 5fd9fa480f302902328b81f912dd67ce378284f8 (patch) | |
tree | 66234843ae2857fda12442e4f7577c527d48977c /Html/archives.php | |
parent | ebe731862c7c741171138b1083906f391fc35aff (diff) | |
download | freetorrent-5fd9fa480f302902328b81f912dd67ce378284f8.tar.xz freetorrent-5fd9fa480f302902328b81f912dd67ce378284f8.zip |
V.1.4.6
Diffstat (limited to '')
-rw-r--r-- | Html/archives.php | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/Html/archives.php b/Html/archives.php new file mode 100644 index 0000000..0347087 --- /dev/null +++ b/Html/archives.php @@ -0,0 +1,96 @@ +<?php +require_once('includes/config.php'); + +$pagetitle= 'Archives'; + +include_once('includes/header.php'); +?> +<body> +<div id="container"> + + <?php + include_once('includes/header-logo.php'); + include_once('includes/nav.php'); + ?> + + <div id="body"> + <div id="content"> + + <?php + include_once('includes/ariane.php'); + ?> + + <br /> + + <?php + try { + + //collect month and year data + $month = html($_GET['month']); + $year = html($_GET['year']); + + //set from and to dates + $from = date('Y-m-01 00:00:00', strtotime("$year-$month")); + $to = date('Y-m-31 23:59:59', strtotime("$year-$month")); + + + $pages = new Paginator('10','p'); + + $stmt = $db->prepare('SELECT postID FROM blog_posts_seo WHERE postDate >= :from AND postDate <= :to'); + $stmt->execute(array( + ':from' => $from, + ':to' => $to + )); + + //pass number of records to + $pages->set_total($stmt->rowCount()); + + $stmt = $db->prepare('SELECT postID, postTitle, postSlug, postAuthor, postDesc, postDate FROM blog_posts_seo WHERE postDate >= :from AND postDate <= :to ORDER BY postID DESC '.$pages->get_limit()); + $stmt->execute(array( + ':from' => $from, + ':to' => $to + )); + + echo '<h2>Archives : '.$month.'-'.$year.'</h2><br />'; + + while($row = $stmt->fetch()){ + echo '<fieldset>'; + echo '<span style="font-weight: bold; font-size: 12pt;"><a style="text-decoration: none;" href="'.html($row['postSlug']).'">'.html($row['postTitle']).'</a></span>'; + echo '<br /><span style="font-size: 10pt;">Posté le '.date_fr('l j F Y à H:i:s', strtotime(html($row['postDate']))).' par '; + echo html($row['postAuthor']).' dans '; + + $stmt2 = $db->prepare('SELECT catTitle, catSlug FROM blog_cats, blog_post_cats WHERE blog_cats.catID = blog_post_cats.catID AND blog_post_cats.postID = :postID'); + $stmt2->bindValue(':postID', $row['postID'], PDO::PARAM_INT); + $stmt2->execute(); + $catRow = $stmt2->fetchAll(PDO::FETCH_ASSOC); + + $links = array(); + foreach ($catRow as $cat) + { + $links[] = "<a href='c-".html($cat['catSlug'])."'>".html($cat['catTitle'])."</a>"; + } + echo implode(", ", $links); + echo '</span></fieldset>'; + } + echo '<br /><br />'; + + echo $pages->page_links("a-$month-$year&"); + + } catch(PDOException $e) { + echo $e->getMessage(); + } + ?> + </div> + + <?php include_once('sidebar.php'); ?> + + <div class="clear"></div> + </div> +</div> + +<div id="footer"> + <?php include_once('includes/footer.php'); ?> +</div> + +</body> +</html> |