<commit_before><?php

session_start();

include __DIR__ . '/../cms-config.php';

include __DIR__ . '/../include/pdo_db_functions.inc.php';
include __DIR__ . '/../include/general_functions.inc.php';

/* Überprüfen ob Login erfolgt ist, ggf. Anmeldemöglichkeit bieten */
if (is_logged_in()) {
    
    $pdo = getPdoConnection();
    
    $title   = filter_input(INPUT_POST, 'title');
    $message = filter_input(INPUT_POST, 'message');
    $visible = filter_input(INPUT_POST, 'visible');
    
    $sql = 'INSERT INTO `news` (`title`, `message`, `visible`)'
        . " VALUES (:title, :message, :visible)";
    
    if (DB_DRIVER == 'sqlite') {
        $datetime = strftime('%Y-%m-%d %H:%M', time());
        $trash = 'false';
        
        $sql = 'INSERT INTO `news` (`title`, `message`, `created_at`, `visible`, `trash`)'
            . " VALUES (:title, :message, :created_at, :visible, :trash)";
    }
// var_dump($sql, $input_parameters);die;
    try {
        $stmt = $pdo->prepare($sql);
        
        $stmt->bindParam(':title', $title);
        $stmt->bindParam(':message', $message);
        $stmt->bindParam(':visible', $visible);
        
        if (DB_DRIVER == 'sqlite') {
            $stmt->bindParam(':created_at', $datetime);
            $stmt->bindParam(':trash', $trash);
        }
        
        $stmt->execute();
    } catch (PDOException $ex) {
        <commit_msg>update, clean the code<commit_after><?php

session_start();

include __DIR__ . '/../cms-config.php';

include __DIR__ . '/../include/pdo_db_functions.inc.php';
include __DIR__ . '/../include/general_functions.inc.php';

/* Überprüfen ob Login erfolgt ist, ggf. Anmeldemöglichkeit bieten */
if (is_logged_in()) {
    
    $pdo = getPdoConnection();
    
    $title   = filter_input(INPUT_POST, 'title');
    $message = filter_input(INPUT_POST, 'message');
    $visible = filter_input(INPUT_POST, 'visible');
    
    $sql = 'INSERT INTO `news` (`title`, `message`, `visible`)'
        . " VALUES (:title, :message, :visible)";
    
    if (DB_DRIVER == 'sqlite') {
        $datetime = strftime('%Y-%m-%d %H:%M', time());
        $trash = 'false';
        
        $sql = 'INSERT INTO `news` (`title`, `message`, `created_at`, `visible`, `trash`)'
            . " VALUES (:title, :message, :created_at, :visible, :trash)";
    }

    try {
        $stmt = $pdo->prepare($sql);
        
        $stmt->bindParam(':title', $title);
        $stmt->bindParam(':message', $message);
        $stmt->bindParam(':visible', $visible);
        
        if (DB_DRIVER == 'sqlite') {
            $stmt->bindParam(':created_at', $datetime);
            $stmt->bindParam(':trash', $trash);
        }
        
        $stmt->execute();
    } catch (PDOException $ex) {
        
{'fraction_non_alphanumeric': 0.19186046511627908, 'fraction_numerical': 0.0, 'mean_word_length': 2.556847545219638, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '3264694', 'n_tokens_mistral': 945, 'n_tokens_neox': 921, 'n_words': 179}