%PDF- %PDF-
Direktori : /home/alliance/domains/sedl.alnetis.fr/public_html/ |
Current File : /home/alliance/domains/sedl.alnetis.fr/public_html/a-forum.php |
<?php include_once("inc/config.php"); include_once("inc/functions.php"); include_once("inc/session.php"); include_once("inc/init.php"); include_once("inc/phpmailer/class.phpmailer.php"); verif_co(); if(isset($_POST['post']) && $_POST['post'] == 1) { $erreur = $db->verif($_POST['titrepost'], "Le titre"); if($erreur == "ok") $erreur = $db->verif($_POST['textepost'], "La publication"); //Photos if($_FILES['photopost']['name']!=""){ $extensions_ok = array('jpg', 'jpeg', 'png', 'gif'); $typeimages_ok = array(1,2,3); if(!$getimagesize = getimagesize($_FILES['photopost']['tmp_name'])) { $erreur2= $trad->t("The file is not a valid image"); } // on vérifie le type de l'image if( (!in_array( get_extension($_FILES['photopost']['name']), $extensions_ok )) or (!in_array($getimagesize[2], $typeimages_ok ))) { foreach($extensions_ok as $text) { $extensions_string .= $text.', '; } $erreur= $trad->t('Please select a file with this type ').substr($extensions_string, 0, -2).' !'; } } if($erreur == "ok") { if ($_FILES['photopost']['name'] != "" && $_FILES['photopost']['error'] != UPLOAD_ERR_NO_FILE) { require_once 'inc/class.upload.php'; $handle = new upload($_FILES['photopost'], 'fr_FR'); if ($handle->uploaded) { $handle->file_safe_name = true; $handle->image_resize = true; $handle->image_x = 900; $handle->image_ratio_y = true; $handle->image_ratio_no_zoom_in = true; $handle->jpeg_quality = 80; $handle->file_max_size = '20971520'; $handle->allowed = array('image/jpeg', 'image/png'); $handle->process('uploads/'); if ($handle->processed) { // OK $photo = $handle->file_dst_name_body.".".$handle->file_dst_name_ext; //Nouvelle Thumb $handle->file_new_name_body = "thumb_".$handle->file_dst_name_body; $handle->image_resize = true; $handle->image_x = 700; $handle->image_y = 400; $handle->image_ratio_crop = true; $handle->jpeg_quality = 80; $handle->process('uploads/thumb/'); $handle->clean(); } else { //erreur sur la photo $error .= $handle->error."<br />"; } } } $next_id = $db->next_id("forum_post"); $values = array( "id" => $next_id, "user" => $_SESSION['id'], "date" => time(), "lastmod" => time(), "lien" => $_POST['lienpost'], "photo" => $photo, "titre" => $_POST['titrepost'], "texte" => $_POST['textepost'] ); $db->insert("forum_post", $values); $message='Un nouveau message a été ajouté au forum.<br/><br/><a href="http://sedl.alnetis.fr/admin/forum.php">'.$_POST['titrepost'].'</a>'; $header = get_temp("templates/newsletter/header_page.php", $url_site); $footer = get_temp("templates/newsletter/header_page.php", $url_site); $message=$header.$message.$footer; $subject="=?UTF-8?B?".base64_encode(stripslashes("Nouveau sujet sur le forum"))."?="; $headers= "From: \"SEDL\" <".$email_contact.">\n"; $headers.='Content-type: text/html; charset=utf-8'; $mail = new PHPMailer(); $mail->CharSet = 'UTF-8'; $mail->From = "sedl@octomail.info"; $mail->FromName = "SEDL"; $mail->addReplyTo($email_contact); $mail->Subject =$subject; $mail->MsgHTML($message); $mail->IsSMTP(); // telling the class to use SMTP $mail->SMTPDebug = 0; // enables SMTP debug information (for testing) $mail->SMTPAuth = true; // enable SMTP authentication $mail->Host = "smtp.octomail.info"; // sets the SMTP server $mail->Port = 587; // set the SMTP port for the GMAIL server $mail->Username = "sedl@octomail.info"; // SMTP account username $mail->Password = "2UFvaB1eqj5QeQv8"; $mail->MsgHTML($message); $mail->AddAddress($email_contact); $mail->Send(); $mail->ClearAddresses(); } else { $err = true; } } //affichage du html include("theme/html.php"); //affichage des metas include("theme/meta.php"); echo "\n<title>".lang('forum')." - ".$info_titresite."</title>\n"; //affichage du header if(estadmin()) include("theme/header_admin.php"); else include("theme/header_redacteur.php"); if($err) { echo "<p class=\"erreurbloc\">".$erreur."</p>"; } if($yes) { echo "<p class=\"infobloc\">Opération effectuée</p>"; } ?> <div class="blanc padding2 mt10 forumcreatepost"> <form action="" method="post" enctype="multipart/form-data" class="forumform"> <div class="flexcontent"> <label for="titrepost"><?=lang('titreforum');?></label> <div class="champexpand"><input type="text" name="titrepost" id="titrepost" placeholder="<?=lang('titreforumdesc');?>" /></div> </div> <textarea class="mt10 autoheight" name="textepost" size="1" placeholder="<?=lang('messforumdesc');?>"></textarea> <div id="forumphoto" class="flexcontent mt10"> <label for="photopost"><?=lang('photoforum');?></label> <div class="champexpand"><input type="file" name="photopost" id="photopost" /></div> </div> <div id="forumlien" class="flexcontent mt10"> <label for="lienpost"><?=lang('linkforum');?></label> <div class="champexpand"><input type="text" name="lienpost" id="lienpost" placeholder="<?=lang('linkforumdesc');?>" /></div> </div> <div class="flexcontent submit mt10"> <input type="hidden" name="post" value="1" /> <button type="submit" class="bouton"><?=lang('addforum');?></button> <i class="fas fa-circle-notch fa-spin postchargement"></i> <div class="attachments"> <i class="fas fa-camera" id="forumphotobutton"></i> <i class="fas fa-link" id="forumlienbutton"></i> </div> </div> </form> </div> <section id="forumposts"> <?php // if(!isset($_GET['page'])) { // $_GET['page'] = 1; // } // $limit = $_GET['page']*2; $liste_posts = $fo->liste_posts(); if(!$liste_posts) { ?> <div class="infobloc" role="alert"> <?=lang('noresults');?>test </div> <?php } else { echo "ok"; foreach($liste_posts as $key => $post) { ?> <article id="post-<?=$post['id']?>" class="blanc mt10 forumpost"> <div class="forumpostcontent padding2"> <div class="forumposthead flexcontent"> <div class="forumpostheadinfos flexcontent"> <img src="<?=$post['flag']?>" class="forumpostflag" alt="<?=$post['nompart']?>" /> <div class="forumpostinfos"> <?php if(true): //if($post['usertype'] == 2): ?> <div class="forumpostinfosuser"><?=$post['nompart']?></div> <?php else: ?> <div class="forumpostinfosuser"><a href="<?=$post['urlpart']?>"><?=$post['nompart']?></a></div> <?php endif; ?> <div class="forumpostinfosdate"> <?php if($post['user'] == $_SESSION['id'] || estadmin()):?> <a class="forumaction deletepost" data-post="<?=$post['id']?>"><i class="fas fa-times"></i> <?=lang('supprimer');?></a> <?php endif; ?> <span class="forumpostdate"><?=$post['dateformat']?></span> </div> </div> </div> <div class="forumpostalert"><i class="far fa-bell"></i></div> </div> <div class="forumpostmessage mt10"> <?php if($post['photo'] != null): ?> <a href="uploads/<?=$post['photo']?>" class="fancy"><img src="uploads/thumb/thumb_<?=$post['photo']?>" alt="<?=$post['titre']?>" /></a> <?php endif; ?> <h1 class="forumposttitre"><?=$post['titre']?></h1> <?php if($post['lien'] != null): ?> <div class="forumlink"><a href="<?=$post['lien']?>" target="__blank" rel="nofollow"><i class="fas fa-link"></i> <?=substr2($post['lien'], 70)?></a></div> <?php endif; ?> <div class="forumposttext"><p><?=nl2br($post['texte'])?></p></div> </div> </div> <div class="forumcomments padding2"> <ul id="commentaires-<?=$post['id']?>" class="listecomments"> <?php //LISTE DES COMMENTAIRES $liste_comments = $fo->liste_comments($post['id']); if($liste_comments) { ?> <?php foreach($liste_comments as $key2 => $comment) { ?> <li id="comment-<?=$comment['id']?>" data-nb="<?=$key2?>" class="comments flexcontent"> <img src="<?=$comment['flag']?>" class="forumpostflag" alt="<?=$comment['nompart']?>" /> <div class="commentcontent"> <div class="comment"> <?php if(true): //if($post['usertype'] == 2): ?> <span class="commentuser"><?=$comment['nompart']?></span> <?php else: ?> <a href="<?=$comment['urlpart']?>" class="commentuser"><?=$comment['nompart']?></a> <?php endif; ?> <?=$comment['texte']?></div> <div class="actions"> <a class="forumaction reponsecomment" data-comment="<?=$comment['id']?>" data-post="<?=$post['id']?>" data-nomrep="<?=$comment['nompart']?>"><i class="far fa-comment"></i> <?=lang('repondre');?></a> <?php if($comment['user'] == $_SESSION['id'] || estadmin()):?> <a class="forumaction deletecomment" data-comment="<?=$comment['id']?>" data-post="<?=$post['id']?>"><i class="fas fa-times"></i> <?=lang('supprimer');?></a> <?php endif; ?> <span class="commentdate"><?=$comment['dateformat']?></span> </div> </div> </li> <ul id="responses-<?=$comment['id']?>" class="listecomments listeresponses"> <?php // LISTE DES REPONSES $liste_reponses = $fo->liste_comments($post['id'], $comment['id']); if($liste_reponses) { ?> <?php foreach($liste_reponses as $key3 => $reponse) { ?> <li id="comment-<?=$reponse['id']?>" data-nb="<?=$key3?>" class="comments flexcontent"> <img src="<?=$reponse['flag']?>" class="forumpostflag" alt="<?=$reponse['nompart']?>" /> <div class="commentcontent"> <div class="comment"> <?php if(true): //if($post['usertype'] == 2): ?> <span class="commentuser"><?=$reponse['nompart']?></span> <?php else: ?> <a href="<?=$reponse['urlpart']?>" class="commentuser"><?=$reponse['nompart']?></a> <?php endif; ?> <?=$reponse['texte']?></div> <div class="actions"> <a class="forumaction reponsecomment" data-comment="<?=$comment['id']?>" data-post="<?=$post['id']?>" data-nomrep="<?=$reponse['nompart']?>"><i class="far fa-comment"></i> <?=lang('repondre');?></a> <?php if($reponse['user'] == $_SESSION['id'] || estadmin()):?> <a class="forumaction deletecomment" data-comment="<?=$reponse['id']?>" data-post="<?=$post['id']?>"><i class="fas fa-times"></i> <?=lang('supprimer');?></a> <?php endif; ?> <span class="commentdate"><?=$reponse['dateformat']?></span> </div> </div> </li> <?php } ?> <?php } ?> </ul> <?php } ?> <?php } ?> </ul> <form action="" method="post" class="forumform commentform"> <div class="forumrespondto"><?=lang('respondto');?> <strong class="nomrep">x</strong> <a class="forumaction annulerreponse" data-post="<?=$post['id']?>"><i class="fas fa-times"></i> <?=lang('annuler');?></a></div> <input type="hidden" name="post" class="reponsepost" value="<?=$post['id']?>" /> <input type="hidden" name="parent" class="reponseparent" /> <div class="dataresponse"></div> <textarea class="autoheight textecomment" name="textecomment" size="1" placeholder="<?=lang('commentforum');?>"></textarea> </form> </div> </article> <?php } ?> <?php } ?> <input type="hidden" class="confirmtext" value="<?=lang('confirm');?>" /> </section> <script type="text/javascript" src="js/libs/jquery.visible.min.js"></script> <script type="text/javascript" src="js/forum.js"></script> <? //affichage du footer include("theme/footer.php"); ?>