<commit_before><?php

namespace App\Controleur;

/**
 * Description of News
 *
 * @author fzed51
 */
class News extends Controleur {

    private $page = "<html> <head><titre>News - {titre}</titre></head> <body> <h1>News</h1> {content} </body> </html>";

    public function index() {
        $news = Db::getAllTable('news');
        $content = "<a href=\"" . Routeur::getUrl('home') . "\">Home</a>" . PHP_EOL;
        foreach ($news as $new) {
            $content .= "<h2>{$new->titre}</h2>" . PHP_EOL;
            $content .= "<p>{$new->text}</p><hr/>" . PHP_EOL;
        }
        $content .= "<a href=\"" . Routeur::getUrl('News.Create') . "\">+</a>" . PHP_EOL;
        $page = str_replace(
            '{content}', $content, str_replace(
                '{titre}', 'tout', $this->page)
        );
        echo $page;
    }

    function get_Create() {
        ?>
        <h1>Nouvelle news?</h1>
        <a href="<?= Routeur::getUrl('News.index') ?>">&Lt;</a>
        <a href="<?= Routeur::getUrl('home') ?>">Home</a>
        <form action="<?= Routeur::getUrl('News.Create'); ?>" method="POST">
            <input type="hidden" name="_METHODE" value="POST" />
            <div>
                <label>
                    Titre
                    <input type="text" name="data[titre]" value=""/>
                </label>
            </div>
            <div>
                <textarea name="data[text]"></textarea>
            </div>
            <div>
                <button type="submit">Ajouter</button>
            </div>
        </form>
        <?php
    }

    function post_Create() {
        DB::insertInTable('NEWS', \App\Requete::input('data'));
        $this->index();
    }

    function get_Read($id) {

    }<commit_msg>:up: correction de PB suite aux alias<commit_after><?php

namespace App\Controleur;

/**
 * Description of News
 *
 * @author fzed51
 */
class News extends Controleur {

    private $page = "<html> <head><titre>News - {titre}</titre></head> <body> <h1>News</h1> {content} </body> </html>";

    public function index() {
        $news = \Db::getAllTable('news');
        $content = "<a href=\"" . \Routeur::getUrl('home') . "\">Home</a>" . PHP_EOL;
        foreach ($news as $new) {
            $content .= "<h2>{$new->titre}</h2>" . PHP_EOL;
            $content .= "<p>{$new->text}</p><hr/>" . PHP_EOL;
        }
        $content .= "<a href=\"" . \Routeur::getUrl('News.Create') . "\">+</a>" . PHP_EOL;
        $page = str_replace(
            '{content}', $content, str_replace(
                '{titre}', 'tout', $this->page)
        );
        echo $page;
    }

    function get_Create() {
        ?>
        <h1>Nouvelle news?</h1>
        <a href="<?= Routeur::getUrl('News.index') ?>">&Lt;</a>
        <a href="<?= Routeur::getUrl('home') ?>">Home</a>
        <form action="<?= Routeur::getUrl('News.Create'); ?>" method="POST">
            <input type="hidden" name="_METHODE" value="POST" />
            <div>
                <label>
                    Titre
                    <input type="text" name="data[titre]" value=""/>
                </label>
            </div>
            <div>
                <textarea name="data[text]"></textarea>
            </div>
            <div>
                <button type="submit">Ajouter</button>
            </div>
        </form>
        <?php
    }

    function post_Create() {
        \DB::insertInTable('NEWS', \Requete::input('data'));
        $this->index();
    }

    function get_Read($id) {

    }
{'fraction_non_alphanumeric': 0.2093089663049686, 'fraction_numerical': 0.004568817818389492, 'mean_word_length': 1.8295638126009692, 'pattern_counts': {'":': 0, '<': 95, '<?xml version=': 0, '>': 101, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5902945', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1136, 'n_words': 216}