Les derniers torrents
query('SELECT postHash FROM blog_posts_seo');
// On passe le nb d'enregistrements à $pages
$pages->set_total($stmt->rowCount());
$stmt = $db->query('SELECT postID,postHash,postTitle,postAuthor,postSlug,postDesc,postDate,postImage,postViews FROM blog_posts_seo ORDER BY postDate DESC '.$pages->get_limit());
while($row = $stmt->fetch()) {
echo '
';
echo '';
echo '
'.html($row['postTitle']).' ';
sscanf($row['postDate'], "%4s-%2s-%2s %2s:%2s:%2s", $annee, $mois, $jour, $heure, $minute, $seconde);
echo '
';
echo ' '.$jour.'-'.$mois.'-'.$annee.' ';
echo ''.html($row['postAuthor']).' ';
$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[] = $cat['catTitle'];
}
echo ' ';
$max = 120;
$chaine = implode(", ", $links);
if (strlen($chaine) >= $max) {
$chaine = substr($chaine, 0, $max);
$espace = strrpos($chaine, ", ");
$chaine = substr($chaine, 0, $espace).' ...';
}
echo ' '.html($chaine).' ';
echo ' # ';
echo ' ';
$stmt4 = $db->prepare('
SELECT licenceID,licenceTitle FROM blog_licences, blog_post_licences
WHERE blog_licences.licenceID = blog_post_licences.licenceID_BPL AND blog_post_licences.postID_BPL = :postID_BPL
ORDER BY licenceTitle ASC');
$stmt4->bindValue(':postID_BPL', $row['postID'], PDO::PARAM_INT);
$stmt4->execute();
$licenceRow = $stmt4->fetchALL(PDO::FETCH_ASSOC);
$liclist = array();
foreach($licenceRow as $lic) {
$liclist[] = $lic['licenceTitle'];
}
$max = 30;
$chaine = implode(", ", $liclist);
if (strlen($chaine) >= $max) {
$chaine = substr($chaine, 0, $max);
$espace = strrpos($chaine, ", ");
$chaine = substr($chaine, 0, $espace).' [...] ';
}
echo html($chaine);
echo ' ';
echo ' Lu : '.html($row['postViews']).' fois';
echo ' ';
echo '
';
echo '
';
if (!empty($row['postImage']) && file_exists($REP_IMAGES_TORRENTS.$row['postImage'])) {
echo ' ';
}
else {
echo ' ';
}
$max = 500;
$chaine = $row['postDesc'];
if (strlen($chaine) >= $max) {
$chaine = substr($chaine, 0, $max);
$espace = strrpos($chaine, " ");
$chaine = substr($chaine, 0, $espace).' ...';
}
echo ''.nl2br(bbcode(html($chaine))).'
';
echo '
';
echo ' ';
}
}
catch(PDOException $e) {
echo $e->getMessage();
}
echo '
';
echo $pages->page_links();
echo '
';
?>