diff options
Diffstat (limited to '')
-rw-r--r-- | Html/index.php | 176 |
1 files changed, 176 insertions, 0 deletions
diff --git a/Html/index.php b/Html/index.php new file mode 100644 index 0000000..92c81ce --- /dev/null +++ b/Html/index.php @@ -0,0 +1,176 @@ +<?php +require_once('includes/config.php'); + +$pagetitle= 'Bienvenue sur '.SITENAMELONG.' !'; + +// Stats : bbclone +define("_BBC_PAGE_NAME", $pagetitle); +define("_BBCLONE_DIR", "bbclone/"); +define("COUNTER", _BBCLONE_DIR."mark_page.php"); +if (is_readable(COUNTER)) include_once(COUNTER); + +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"> + +<div class="edito"> + <?php + // On affiche l'Edito + echo $EDITO; + ?> +</div> + +<div class="edito"> +<p style="text-align: center; font-size: 16px;">Tutoriel : <a href="https://www.citizenz.info/le-reseau-social-mastodon-pour-les-nuls">Le réseau social Mastodon pour les Nuls</a></p> +</div> + +<div> + <h2>Les derniers torrents</h2> +</div> + +<?php + try { + // Préparation de la pagination + $pages = new Paginator('8','p'); + $stmt = $db->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 '<fieldset>'; + echo '<div style="margin-top: 10px;">'; + echo '<span style="font-size: 17px; font-weight: bold; padding: 5px 0 0 10px;"><a style="text-decoration: none; color: black;" href="'.html($row['postSlug']).'">'.html($row['postTitle']).'</a></span><br />'; + sscanf($row['postDate'], "%4s-%2s-%2s %2s:%2s:%2s", $annee, $mois, $jour, $heure, $minute, $seconde); + echo '<span style="font-size: 11px; padding: 5px 0 0 10px;">'; + echo '<img src="images/Calendar-icon.png" style="vertical-align: bottom; margin-top: 5px;" alt="Date" /> '.$jour.'-'.$mois.'-'.$annee.' <img src="images/meta-separator.png" style="margin-left: 4px; margin-right: 4px;" alt="" /> <img src="images/user.png" style="vertical-align: bottom;" alt="Auteur" /> '; + echo '<span style="text-decoration: none; color: black;">'.html($row['postAuthor']).'</span>'; + + $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 ' <img src="images/meta-separator.png" style="margin-left: 4px; margin-right: 4px;" alt="" /> '; + + $max = 120; + $chaine = implode(", ", $links); + if (strlen($chaine) >= $max) { + $chaine = substr($chaine, 0, $max); + $espace = strrpos($chaine, ", "); + $chaine = substr($chaine, 0, $espace).' ...'; + } + + echo '<img src="images/Folder-icon.png" style="vertical-align: bottom;" alt="Catégories" /> <span style="color:black;">'.html($chaine).'</span>'; + echo '<img src="images/meta-separator.png" style="margin-left: 4px; margin-right: 4px;" alt="" /> <img src="images/Communicate-icon.png" style="vertical-align: bottom;" alt="Commentaires" /> <a style="text-decoration: none; color: black;" href="'.SITEURL.'/'.html($row['postSlug']).'#disqus_thread">#</a> '; + echo '<img src="images/meta-separator.png" style="margin-left: 4px; margin-right: 4px;" alt="" /> <img src="images/File-icon.png" style="vertical-align: bottom;" alt="Licence" /> '; + + $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 '<img src="images/meta-separator.png" style="margin-left: 4px; margin-right: 4px;" alt="" />'; + echo '<img src="images/read.png" style="vertical-align: bottom;" alt="Lectures" /> Lu : '.html($row['postViews']).' fois'; + + echo '</span>'; + echo '<br />'; + + echo '</div>'; + + if (!empty($row['postImage']) && file_exists($REP_IMAGES_TORRENTS.$row['postImage'])) { + echo '<img src="'.$WEB_IMAGES_TORRENTS.html($row['postImage']).'" alt="'.html($row['postTitle']).'" style="float: left; margin-right: 15px; margin-top: 20px; border: 1px solid #C0C0C0; padding: 6px; max-width: 100px; max-height: 100px;" />'; + } + else { + echo '<img src="images/noimage.png" alt="Image" style="float: left; margin-right: 10px; margin-top: 20px; max-width: 150px; max-height: 150px;" />'; + } + + $max = 500; + $chaine = $row['postDesc']; + if (strlen($chaine) >= $max) { + $chaine = substr($chaine, 0, $max); + $espace = strrpos($chaine, " "); + $chaine = substr($chaine, 0, $espace).' ...'; + } + + echo '<p style="text-align: justify;">'.nl2br(bbcode(html($chaine))).'</p>'; + echo '<p style="text-align: right;"><a style="text-decoration: none;" href="'.html($row['postSlug']).'"> <input type="button" class="button" value="Lire la suite ..." /></a></p>'; + echo '</fieldset>'; + } + + } + + catch(PDOException $e) { + echo $e->getMessage(); + } + + echo '<div style="text-align: center;">'; + echo $pages->page_links(); + echo '</div>'; + ?> + +</div> + + <?php include_once('sidebar.php'); ?> + + <div class="clear"></div> + </div> +</div> + +<div id="footer"> + <?php + include_once('includes/footer.php'); + ?> +</div> + + <script type="text/javascript"> + /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ + var disqus_shortname = '<?php echo SITEDISQUS; ?>'; // required: replace example with your forum shortname + + /* * * DON'T EDIT BELOW THIS LINE * * */ + (function () { + var s = document.createElement('script'); s.async = true; + s.type = 'text/javascript'; + s.src = '//' + disqus_shortname + '.disqus.com/count.js'; + (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); + }()); + </script> + +</body> +</html> |