Exemplo n.º 1
0
<?php

require_once '../../kernel/begin.php';
$lang->setModule('accueil', 'index');
tpl_begin();
$req = $bdd->query('SELECT categorie_nom, news_id, news_titre, news_categorie, news_auteur, news_contenu, membre_login, DATE_FORMAT(news_creation, "%d/%m/%Y à %Hh%i") AS news_creation, news_modification 
FROM ' . TABLE_NEWS . ' LEFT JOIN ' . TABLE_MEMBERS . ' ON membre_id = news_auteur LEFT JOIN ' . TABLE_NEWS_CATS . ' ON categorie_id = news_categorie ORDER BY news_id DESC');
while ($data = $bdd->fetch($req)) {
    ?>
<h1><?php 
    echo htmlentities($data['news_titre']);
    ?>
</h1>
<p style="font-size: 0.9em; color: rgb(83, 88, 106); margin-left: 20px; padding-left: 25px; font-weight: bold; background: url('<?php 
    echo DESIGN;
    ?>
img/infos_news.png') no-repeat scroll 0% 0% transparent; border-bottom: 1px solid rgb(230, 230, 250);">
<?php 
    echo translate('by_at_in', htmlentities($data['membre_login']), $data['news_creation'], htmlentities($data['categorie_nom']));
    ?>
</p>

<div id="newsContenu">
	<?php 
    echo XTCode_decode($data['news_contenu']);
    ?>
</div>
<?php 
}
tpl_end();
Exemplo n.º 2
0
if (!isset($_GET['id']) || empty($_GET['id'])) {
    $error = new Error();
    $error->add_error(translate('inexistant_news'), ERROR_GLOBAL, __FILE__, __LINE__, ROOTU . 'modules/news/index.php');
} else {
    $_GET['id'] = (int) $_GET['id'];
    $newsVerif = $bdd->count_sql(TABLE_NEWS, 'WHERE news_id = ?', $_GET['id']);
    if ($newsVerif == 0) {
        $error = new Error();
        $error->add_error(translate('inexistant_news'), ERROR_GLOBAL, __FILE__, __LINE__, ROOTU . 'modules/news/index.php');
    } else {
        $req = $bdd->query('SELECT categorie_nom, news_id, news_titre, news_categorie, news_auteur, news_contenu, membre_login, DATE_FORMAT(news_creation, "%d/%m/%Y à %Hh%i") AS news_creation, news_modification 
FROM ' . TABLE_NEWS . ' LEFT JOIN ' . TABLE_MEMBERS . ' ON membre_id = news_auteur LEFT JOIN ' . TABLE_NEWS_CATS . ' ON categorie_id = news_categorie WHERE news_id = ? ORDER BY news_id DESC', $_GET['id']);
        while ($data = $bdd->fetch($req)) {
            $data['news_titre'] = htmlspecialchars(stripslashes($data['news_titre']));
            $data['categorie_nom'] = htmlspecialchars(stripslashes($data['categorie_nom']));
            $data['news_contenu'] = stripslashes(XTCode_decode($data['news_contenu']));
            $breadcrumb->add(translate('list_news'), 'modules/news/index.php');
            $breadcrumb->add($data['news_titre']);
            tpl_begin();
            ?>
			<h1><?php 
            echo $data['news_titre'];
            ?>
</h1>
			<p style="font-size: 0.9em; color: rgb(83, 88, 106); margin-left: 20px; padding-left: 25px; font-weight: bold; background: url('<?php 
            echo DESIGN;
            ?>
img/infos_news.png') no-repeat scroll 0% 0% transparent; border-bottom: 1px solid rgb(230, 230, 250);">
				<?php 
            echo translate('by_at_in', $data['membre_login'], $data['news_creation'], $data['categorie_nom']);
            ?>
 private function getComs()
 {
     global $bdd;
     //On récupère l'ID de l'objet parcouru et les informations importantes
     $module_id = $this->datas['id_principal'];
     //Si ID original, on bloque.
     if ($module_id == -1) {
         return false;
     }
     $debut = $this->datas['debut'];
     $limit = $this->datas['limit'];
     //On prépare la pagination
     $nb_coms = $this->getNbreComs($module_id);
     $nb_pages = ceil($nb_coms / self::NB_COMS_PAGE);
     if (isset($_GET['page_commentaires'])) {
         $page_actuelle = intval($_GET['page_commentaires']);
         if ($page_actuelle > $nb_pages) {
             $page_actuelle = $nb_pages;
         }
     } else {
         $page_actuelle = 1;
     }
     $entree = ($page_actuelle - 1) * self::NB_COMS_PAGE;
     $pagination = $this->pagination($nb_pages, $page_actuelle);
     //On stocke la pagination.
     $this->datas['pagination'] = $pagination;
     //On vérifie l'existence du commentaire.
     if ($nb_coms == 0) {
         $this->datas['no_com'] = true;
         return true;
     }
     $this->datas['nb_commentaires'] = $nb_coms;
     //On lance la requête
     $sql = $bdd->query('SELECT `commentaire_id`, `module_id`, m.`membre_login`, m.`membre_avatar`, m.`membre_biographie`, m.`membre_citation`, 
     m.`membre_email` AS `site_web`, `commentaire_auteur`, `commentaire_contenu`, `commentaire_date` FROM ' . $this->table . ' AS p 
     LEFT JOIN ' . TABLE_MEMBERS . ' AS m ON m.membre_id = p.commentaire_auteur WHERE `module_id` = ? ORDER BY `commentaire_date` DESC LIMIT ' . intval($entree) . ',' . intval($limit) . '', $module_id);
     $datas = array();
     while ($data = $bdd->fetch($sql)) {
         //On parse l'ensemble des données.
         $data['avatarOnOff'] = est_en_ligne($data['membre_login']) ? 'avatarcommentaire_auteurOn' : 'avatarcommentaire_auteurOff';
         $data['pseudo'] = htmlspecialchars($data['membre_login']);
         $data['pseudo_url'] = url_transform($data['membre_login']);
         $data['commentaire_contenu'] = XTCode_decode($data['commentaire_contenu']);
         $data['commentaire_date'] = date_avancee($data['commentaire_date']);
         $data['avatar'] = htmlspecialchars($data['membre_avatar']);
         $data['citation'] = htmlspecialchars(stripslashes($data['membre_citation']));
         $data['signature'] = XTCode_decode($data['membre_biographie']);
         $data['site_web'] = explode(";", $data['site_web']);
         $data['nbDeSites'] = count($data['site_web']);
         $data['site_web'] = $data['site_web'][array_rand($data['site_web'])];
         $data['site_web'] = htmlspecialchars(stripslashes($data['site_web']));
         if (empty($data['site_web'])) {
             unset($data['site_web']);
         }
         $datas[] = $data;
     }
     //On stocke les données
     $this->commentaires = $datas;
     return true;
 }
        ?>
</p>
<p>Inscrit <?php 
        echo date_avancee($data['membre_register']);
        ?>
</p>
<p>Dernière connexion <?php 
        echo date_avancee($data['membre_last_up']);
        ?>
</p>
<p>Citation : <?php 
        echo htmlentities($data['membre_citation']);
        ?>
</p>
<p>Biographie : <?php 
        echo XTCode_decode($data['membre_biographie']);
        ?>
</p>
<?php 
        break;
    case 'modifier':
        $form = new Form(translate('edit_profile'), 'post');
        $form->add_fieldset();
        $form->add_input('login', 'login', translate('login_form'), 'text', 'disabled')->setValue(htmlentities($data['membre_login']));
        $form->add_input('email', 'email', translate('email_form'))->setValue(htmlentities($data['membre_email']));
        $form->add_input('citation', 'citation', translate('citation_form'))->setValue(htmlentities($data['membre_citation']));
        $form->add_textarea('biographie', 'biographie', translate('biographie_form'))->setValue($data['membre_biographie']);
        $form->add_button();
        $fh = new FormHandle($form);
        $fh->handle();
        if ($fh->okay()) {