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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
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>
|