From 5fd9fa480f302902328b81f912dd67ce378284f8 Mon Sep 17 00:00:00 2001 From: citizenz7 Date: Thu, 20 Apr 2017 18:50:55 +0200 Subject: V.1.4.6 --- Html/viewpost.php | 415 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 415 insertions(+) create mode 100644 Html/viewpost.php (limited to 'Html/viewpost.php') diff --git a/Html/viewpost.php b/Html/viewpost.php new file mode 100644 index 0000000..ff56033 --- /dev/null +++ b/Html/viewpost.php @@ -0,0 +1,415 @@ +prepare('SELECT postID,postHash,postTitle,postSlug,postAuthor,postLink,postDesc,postCont,postTaille,postDate,postTorrent,postImage FROM blog_posts_seo WHERE postSlug = :postSlug'); +$stmt->bindValue(':postSlug', $id, PDO::PARAM_STR); +$stmt->execute(); +$row = $stmt->fetch(); + +//Si le torrent est à supprimer ... +if(isset($_GET['deltorr'])) { + + $deltorr = (int) $_GET['deltorr']; + + if(isset($_SESSION['username']) && isset($_SESSION['userid'])) { + + if(($row['postAuthor'] == $_SESSION['username']) || ($_SESSION['userid'] == 1)) { + + // 1 - on supprime le fichier .torrent dans le répertoire /torrents + $stmt4 = $db->prepare('SELECT postID,postTorrent FROM blog_posts_seo WHERE postID = :postID') ; + $stmt4->bindValue(':postID', $deltorr, PDO::PARAM_INT); + $stmt4->execute(); + $efface = $stmt4->fetch(); + + $file = $REP_TORRENTS.$efface['postTorrent']; + if (file_exists($file)) { + unlink($file); + } + + // 2 - on supprime le torrent dans la base blog_posts_seo + $stmt = $db->prepare('DELETE FROM blog_posts_seo WHERE postID = :postID') ; + $stmt->bindValue(':postID', $deltorr, PDO::PARAM_INT); + $stmt->execute(); + + // 3 - on supprime sa référence de catégorie + $stmt1 = $db->prepare('DELETE FROM blog_post_cats WHERE postID = :postID'); + $stmt1->bindValue(':postID', $deltorr, PDO::PARAM_INT); + $stmt1->execute(); + + // 4 - on supprime sa référence de licence + $stmt2 = $db->prepare('DELETE FROM blog_post_licences WHERE postID_BPL = :postID_BPL'); + $stmt2->bindValue(':postID_BPL', $deltorr, PDO::PARAM_INT); + $stmt2->execute(); + + /* + // 5 - on supprime ses commentaires s'ils existent + $stmt22 = $db->prepare('SELECT cid_torrent FROM blog_posts_comments WHERE cid_torrent = :cid_torrent'); + $stmt22->bindValue(':cid_torrent', $deltorr, PDO::PARAM_INT); + $stmt22->execute(); + $commentaire = $stmt22->fetch(); + + if(!empty($commentaire)) { + $stmtsupcomm = $db->prepare('DELETE FROM blog_posts_comments WHERE cid_torrent = :cid_torrent'); + $stmtsupcomm->bindValue(':cid_torrent', $deltorr, PDO::PARAM_INT); + $stmtsupcomm->execute(); + } + */ + + // 6 - enfin, on supprime le torrent du tracker en mettant le champ "flag" à "1" dans l'enregistrement correspondant de la table xbt_files + $stmt3 = $db->prepare('UPDATE xbt_files SET flags = :flags WHERE fid = :fid') ; + $stmt3->bindValue(':flags', '1', PDO::PARAM_INT); + $stmt3->bindValue(':fid', $deltorr, PDO::PARAM_INT); + $stmt3->execute(); + + header('Location: torrents.php?action=supprime'); + //exit; + + } + + else { + // Alors comme ça vous n'avez pas le droit de supprimer ce torrent ?!! + header('Location: '. SITEURL); + exit(); + } + + } + +}//fin de if isset $_GET['deltorr'] + +/* +$id = html($_GET['id']); + +$stmt = $db->prepare('SELECT postID,postHash,postTitle,postSlug,postAuthor,postLink,postDesc,postCont,postTaille,postDate,postTorrent,postImage FROM blog_posts_seo WHERE postSlug = :postSlug'); +$stmt->bindValue(':postSlug', $id, PDO::PARAM_STR); +$stmt->execute(); +$row = $stmt->fetch(); +*/ + +//Si le post n'existe pas on redirige l'utilisateur +if($row['postID'] == ''){ + header('Location: ./'); + exit(); +} + +$pagetitle = html($row['postTitle']); + +//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'); +?> + + +
+ + + +
+
+ + + +
+ +
+ + '.html($row['postTitle']).''; + + /* + if(isset($_SESSION['username']) && isset($_SESSION['userid'])) { + if(($row['postAuthor'] == $_SESSION['username']) || ($_SESSION['userid'] == 1)) { + echo ''; + ?> + + '; + echo 'Télécharger :  Download
'; + echo '› Posté le : '.date_fr('d-m-Y à H:i:s', strtotime($row['postDate'])).'
'; + echo '› Par : '.html($row['postAuthor']).'
'; + echo '› 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 ORDER BY catTitle ASC'); + $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 implode(", ", $links); + + echo '
'; + + echo '› Lien web du média : URL
'; + echo '› Taille : '.makesize($row['postTaille']).'
'; + + $filetorrent = $REP_TORRENTS.html($row['postTorrent']); + + //On décode le fichier torrent... + //$fd = fopen($_FILES["torrent"]["tmp_name"], "rb"); + //$length=filesize($_FILES["torrent"]["tmp_name"]); + $fd = fopen($filetorrent, "rb"); + $length = filesize($filetorrent); + + if ($length) { + $alltorrent = fread($fd, $length); + } + $array = BDecode($alltorrent); + $hash = sha1(BEncode($array["info"])); + fclose($fd); + + if (isset($array["info"]) && $array["info"]) { + $upfile=$array["info"]; + } + else { + $upfile = 0; + } + + if (isset($upfile["length"])) { + $size = (float)($upfile["length"]); + } + else if (isset($upfile["files"])) { + //Pour les torrents multifichiers (Lupin - Xbtit - Btiteam - 2005) + $size=0; + foreach ($upfile["files"] as $file) { + $size+=(float)($file["length"]); + } + } + else { + $size = "0"; + } + + $ffile=fopen($filetorrent,"rb"); + $content=fread($ffile,filesize($filetorrent)); + fclose($ffile); + + $content=BDecode($content); + $numfiles=0; + + if (isset($content["info"]) && $content["info"]) { + $thefile=$content["info"]; + if (isset($thefile["length"])) { + $dfiles[$numfiles]["filename"]=$thefile["name"]; + $dfiles[$numfiles]["size"]=makesize($thefile["length"]); + $numfiles++; + } + + elseif (isset($thefile["files"])) { + foreach($thefile["files"] as $singlefile) { + $dfiles[$numfiles]["filename"]=implode("/",$singlefile["path"]); + $dfiles[$numfiles]["size"]=makesize($singlefile["length"]); + $numfiles++; + } + } + + else { + // Impossible ... mais bon ... + } + + } + + //echo '› Nb de fichiers : '.$numfiles.'
'; + + + $stmt3 = $db->prepare('SELECT * FROM blog_posts_seo,xbt_files WHERE blog_posts_seo.postID = :postID AND xbt_files.fid = blog_posts_seo.postID'); + $stmt3->bindValue(':postID', $row['postID'], PDO::PARAM_INT); + $stmt3->execute(); + $xbt = $stmt3->fetch(); + + //echo '› Hash : '.bin2hex($xbt['info_hash']).'
'; + + echo '› Trafic : '; + echo 'S : '.$xbt['seeders'].' | '; + echo 'L : '.$xbt['leechers'].' | '; + + // on met à jour le nb de vues de l'article + $stmt33 = $db->query('UPDATE blog_posts_seo SET postViews = postViews+1 WHERE postID = '.$row['postID']); + + // on affiche le nombre de vue de l'article + $stmt333 = $db->prepare('SELECT postViews FROM blog_posts_seo WHERE postID = :postID'); + $stmt333->execute(array(':postID' => $row['postID'])); + $views = $stmt333->fetch(); + + echo 'T : '.$xbt['completed'].'
'; + + echo '› Lu : '.$views['postViews'].' fois
'; + echo '› Licence(s) : '; + + $stmt3 = $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'); + $stmt3->execute(array(':postID_BPL' => $row['postID'])); + $licenceRow = $stmt3->fetchALL(PDO::FETCH_ASSOC); + $liclist = array(); + foreach($licenceRow as $lic) { + $liclist[] = $lic['licenceTitle']; + } + echo implode(", ", $liclist); + + if(isset($_SESSION['username']) && isset($_SESSION['userid'])) { + if(($row['postAuthor'] == $_SESSION['username']) || ($_SESSION['userid'] == 1)) { + echo '

'; + echo ''; + ?> + + '; + + echo '
'; + + + //echo '
'; + echo '

'; + if (!empty($row['postImage']) && file_exists($REP_IMAGES_TORRENTS.$row['postImage'])) { + echo ''.html($row['postTitle']).''; + } + else { + echo 'Image'; + } + echo '

'.nl2br(bbcode($row['postDesc'])).'

'; + echo '

'.nl2br(bbcode($row['postCont'])).'

'; + + echo '
'; + + if (isset($content['info']) && $content['info']) { + $thefile=$content['info']; + + /* + if (isset($thefile['length'])) { + $nbfilestorr = $thefile['name']; + } + + elseif (isset($thefile['files'])) { + foreach($thefile['files'] as $singlefile) { + $nbfilestorr = html(implode('/',$singlefile['path'])); + } + } + + else { + // rien + } + */ + + } + + + echo ''; + + if($numfiles == 1) { + echo ''; + } + else { + echo ''; + } + + if (isset($thefile['files'])) { + echo ''; + foreach($content['info']['files'] as $multiplefiles) { + echo ''; + } + } + else { + echo ''; + echo ''; + } + echo '
Nb de fichier du torrent : '.$numfiles.'
Nb de fichiers du torrent : '.$numfiles.'
Fichiers du torrent :
'.implode('/',$multiplefiles['path']).'
Fichier du torrent :
'.html($thefile['name']).'
'; + + echo '
'; + echo '

'; + ?> + +
+ + +
+ + + +
Social Network Mastodon + + + +
+ + +
+ + +
+ + + +
+ + + + + +
+
+ + +
+ +
+ + +
+ + + +
+ + + +
+
+
+ + + + + -- cgit v1.2.1