<commit_before><?php
/**
* $Id: savequestion.php,v 1.20 2006-06-17 13:02:44 matteo Exp $
*
* @author           <NAME> <<EMAIL>>
* @author           <NAME> <<EMAIL>>
* @author           <NAME> <<EMAIL>>
* @since            2002-09-17
* @copyright        (c) 2001-2006 phpMyFAQ Team
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*/

if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']));
    exit();
}

$captcha = new PMF_Captcha($db, $sids, $pmf->language, $_SERVER['HTTP_USER_AGENT'], $_SERVER['REMOTE_ADDR']);

if (    isset($_POST['username']) && $_POST['username'] != ''
     && isset($_POST['usermail']) && checkEmail($_POST['usermail'])
     && isset($_POST['content']) && $_POST['content'] != ''
     && IPCheck($_SERVER['REMOTE_ADDR'])
     && checkBannedWord(htmlspecialchars(strip_tags($_POST['content'])))
     && checkCaptchaCode() ) {
    if (isset($_POST['try_search'])) {
        $suchbegriff = strip_tags($_POST['content']);
        $printResult = searchEngine($suchbegriff, $numr);
        echo $numr;
    } else {
        $numr = 0;
    }

    $usermail = $IDN->encode($_POST['usermail']);
    $username = strip_tags($_POST['username']);
    $selected_category = intval($_POST['rubrik']);
    $content = strip_tags($_POST['content']);

    if ($numr == 0) {
        $cat = new PMF_Category();
        $categories = $cat->getAllCategories();

        list($user, $host) = explode("@", $usermail);
        if (checkEmail($usermail)) {
            $content = $db->escape_string($content);
            $datum   = date("YmdHis");
            if (isset($PMF_CONF['enablevisibility'])) {
                $visibility = 'N';
            } else {
                $visibility = 'Y';
            }

            $query = "INSERT INTO ".SQLPREFIX."faqquestions (id, ask_username, ask_usermail, ask_rubrik, ask_content, ask_date, is_visible) VALUES (".$db->nextID(SQLPREFIX."faqquestions", "id").", '".$db->escape_string($username)."', '".$db->escape_string($usermail)."', ".$selected_category.", '".$content."', '".$datum."', '".$visibility."')";
            $result = $db->query($query);

            $questionMail = "User: ".$username.", mailto:".$usermail."\n"
                            .$PMF_LANG["msgCategory"].":  ".$categories[$selected_category]["name"]."\n\n"
                            .wordwrap(stripslashes($content), 72);
            $headers = '';
            $result = $db->query("SELECT ".SQLPREFIX."faquserdata.email FROM ".SQLPREFIX."faquserdata INNER JOIN ".SQLPREFIX."faqcategories ON ".SQLPREFIX."faqcategories.user_id = ".SQLPREFIX."faquserdata.user_id WHERE ".SQLPREFIX."faqcategories.id = ".$selected_category);
            while ($row = $db->fetch_object($result)) {<commit_msg>Fix: (trivial) 2 blank spaces instead of 1 before the question cat name<commit_after><?php
/**
* $Id: savequestion.php,v 1.21 2006-06-17 13:12:24 matteo Exp $
*
* @author           <NAME> <<EMAIL>>
* @author           <NAME> <<EMAIL>>
* @author           <NAME> <<EMAIL>>
* @since            2002-09-17
* @copyright        (c) 2001-2006 phpMyFAQ Team
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*/

if (!defined('IS_VALID_PHPMYFAQ')) {
    header('Location: http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']));
    exit();
}

$captcha = new PMF_Captcha($db, $sids, $pmf->language, $_SERVER['HTTP_USER_AGENT'], $_SERVER['REMOTE_ADDR']);

if (    isset($_POST['username']) && $_POST['username'] != ''
     && isset($_POST['usermail']) && checkEmail($_POST['usermail'])
     && isset($_POST['content']) && $_POST['content'] != ''
     && IPCheck($_SERVER['REMOTE_ADDR'])
     && checkBannedWord(htmlspecialchars(strip_tags($_POST['content'])))
     && checkCaptchaCode() ) {
    if (isset($_POST['try_search'])) {
        $suchbegriff = strip_tags($_POST['content']);
        $printResult = searchEngine($suchbegriff, $numr);
        echo $numr;
    } else {
        $numr = 0;
    }

    $usermail = $IDN->encode($_POST['usermail']);
    $username = strip_tags($_POST['username']);
    $selected_category = intval($_POST['rubrik']);
    $content = strip_tags($_POST['content']);

    if ($numr == 0) {
        $cat = new PMF_Category();
        $categories = $cat->getAllCategories();

        list($user, $host) = explode("@", $usermail);
        if (checkEmail($usermail)) {
            $content = $db->escape_string($content);
            $datum   = date("YmdHis");
            if (isset($PMF_CONF['enablevisibility'])) {
                $visibility = 'N';
            } else {
                $visibility = 'Y';
            }

            $query = "INSERT INTO ".SQLPREFIX."faqquestions (id, ask_username, ask_usermail, ask_rubrik, ask_content, ask_date, is_visible) VALUES (".$db->nextID(SQLPREFIX."faqquestions", "id").", '".$db->escape_string($username)."', '".$db->escape_string($usermail)."', ".$selected_category.", '".$content."', '".$datum."', '".$visibility."')";
            $result = $db->query($query);

            $questionMail = "User: ".$username.", mailto:".$usermail."\n"
                            .$PMF_LANG["msgCategory"].": ".$categories[$selected_category]["name"]."\n\n"
                            .wordwrap(stripslashes($content), 72);
            $headers = '';
            $result = $db->query("SELECT ".SQLPREFIX."faquserdata.email FROM ".SQLPREFIX."faquserdata INNER JOIN ".SQLPREFIX."faqcategories ON ".SQLPREFIX."faqcategories.user_id = ".SQLPREFIX."faquserdata.user_id WHERE ".SQLPREFIX."faqcategories.id = ".$selected_category);
            while ($row = $db->fetch_object($result)) {
{'fraction_non_alphanumeric': 0.18351597468745176, 'fraction_numerical': 0.012347584503781447, 'mean_word_length': 3.1538461538461537, 'pattern_counts': {'":': 2, '<': 23, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6312200', 'n_tokens_mistral': 2094, 'n_tokens_neox': 1982, 'n_words': 436}