<commit_before><?php
/**
* $Id: index.php,v 1.20 2005-12-12 14:10:50 b33blebr0x Exp $
*
* The main admin backend index file
*
* @author       <NAME> <<EMAIL>>
* @author       <NAME> <<EMAIL>>
* @author       <NAME> <<EMAIL>>
* @author       <NAME> <<EMAIL>>
* @since        2002-09-16
* @copyright    (c) 2001-2005 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.
*/

require_once('../inc/functions.php');
require_once('../inc/init.php');
define('IS_VALID_PHPMYFAQ_ADMIN', null);
PMF_Init::cleanRequest();

// Just for security reasons - thanks to Johannes for the hint
$_SERVER['PHP_SELF'] = strtr(rawurlencode($_SERVER['PHP_SELF']),array( "%2F"=>"/", "%257E"=>"%7E"));
$_SERVER['HTTP_USER_AGENT'] = urlencode($_SERVER['HTTP_USER_AGENT']);

define('PMF_ROOT_DIR', dirname(dirname(__FILE__)));


// Read configuration, include classes and functions
require_once (PMF_ROOT_DIR."/inc/data.php");
require_once (PMF_ROOT_DIR."/inc/db.php");
define("SQLPREFIX", $DB["prefix"]);
$db = db::db_select($DB["type"]);
$db->connect($DB["server"], $DB["user"], $DB["password"], $DB["db"]);
require_once (PMF_ROOT_DIR."/inc/config.php");
require_once (PMF_ROOT_DIR."/inc/constants.php");
require_once (PMF_ROOT_DIR."/inc/category.php");
require_once (PMF_ROOT_DIR."/inc/linkverifier.php");
require_once (PMF_ROOT_DIR."/inc/PMF_User/CurrentUser.php");

// Get language (default: english)
if (isset($PMF_CONF["detection"]) && isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) {
    if (@is_file(PMF_ROOT_DIR."/lang/language_".substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2).".php")) {
        require_once(PMF_ROOT_DIR."/lang/language_".substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2).".php");
        $LANGCODE = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2);
        @setcookie(PMF_ROOT_DIR."/lang", $LANGCODE, time()+3600);
    }
} elseif (!isset($PMF_CONF["detection"])) {
    require_once(PMF_ROOT_DIR."/lang/".$PMF_CONF["language"]);
    $LANGCODE = $PMF_LANG["metaLanguage"];
}
if (isset($LANGCODE)) {
    require_once(PMF_ROOT_DIR."/lang/language_".$LANGCODE.".php");
} else {
    require_once (PMF_ROOT_DIR."/lang/language_en.php");
    $LANGCODE = "en";
}

// use mbstring extension if available
$valid_mb_strings = array('ja', 'en');
if (function_exists('mb_language') && in_array($PMF_LANG['metaLanguage'], $valid_mb_strings)) {
    mb_language($PMF_LANG['metaLanguage']);
    mb_internal_encoding($PMF_LANG['metaCharset']);
}

// authenticate current user
session_start();
unset($auth);
if (isset($_REQUEST['faqpassword']) and isset($_REQUEST['faqusername'])) {
    // login with username and password
    $user = new PMF_CurrentUser();
    if ($user->login($db->escape_string($_REQUEST['faqusername']), $_REQUEST['faqpassword'])) {
        $auth = true;
    } else {
        unset($user);
    }
} else {
    // authenticate with session information
    $ip_check = $PMF_CONF['ipcheck'] == 'TRUE' ? true : false;
    $user = PMF_CurrentUser::getFromSession($ip_check);
    if ($user) {
        $auth = true;
    }
}
// get user rights
$permission = array();
if (isset($auth)) {
    foreach ($user->perm->getAllRights() as $right_id) {
        $right = $user->perm->getRightData($right_id);
        $permission[$right['name']] = false;
    }
    foreach ($user->perm->getAllUserRights($user->getUserId()) as $right_id) {
        $right = $user->perm->getRightData($right_id);
        $permission[$right['name']] = true;
    }
}<commit_msg>gave the session a name: PMF_SID<commit_after><?php
/**
* $Id: index.php,v 1.21 2005-12-12 14:44:56 b33blebr0x Exp $
*
* The main admin backend index file
*
* @author       <NAME> <<EMAIL>>
* @author       <NAME> <<EMAIL>>
* @author       <NAME> <<EMAIL>>
* @author       <NAME> <<EMAIL>>
* @since        2002-09-16
* @copyright    (c) 2001-2005 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.
*/

require_once('../inc/functions.php');
require_once('../inc/init.php');
define('IS_VALID_PHPMYFAQ_ADMIN', null);
PMF_Init::cleanRequest();

// Just for security reasons - thanks to Johannes for the hint
$_SERVER['PHP_SELF'] = strtr(rawurlencode($_SERVER['PHP_SELF']),array( "%2F"=>"/", "%257E"=>"%7E"));
$_SERVER['HTTP_USER_AGENT'] = urlencode($_SERVER['HTTP_USER_AGENT']);

define('PMF_ROOT_DIR', dirname(dirname(__FILE__)));


// Read configuration, include classes and functions
require_once (PMF_ROOT_DIR."/inc/data.php");
require_once (PMF_ROOT_DIR."/inc/db.php");
define("SQLPREFIX", $DB["prefix"]);
$db = db::db_select($DB["type"]);
$db->connect($DB["server"], $DB["user"], $DB["password"], $DB["db"]);
require_once (PMF_ROOT_DIR."/inc/config.php");
require_once (PMF_ROOT_DIR."/inc/constants.php");
require_once (PMF_ROOT_DIR."/inc/category.php");
require_once (PMF_ROOT_DIR."/inc/linkverifier.php");
require_once (PMF_ROOT_DIR."/inc/PMF_User/CurrentUser.php");

// Get language (default: english)
if (isset($PMF_CONF["detection"]) && isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) {
    if (@is_file(PMF_ROOT_DIR."/lang/language_".substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2).".php")) {
        require_once(PMF_ROOT_DIR."/lang/language_".substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2).".php");
        $LANGCODE = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, 2);
        @setcookie(PMF_ROOT_DIR."/lang", $LANGCODE, time()+3600);
    }
} elseif (!isset($PMF_CONF["detection"])) {
    require_once(PMF_ROOT_DIR."/lang/".$PMF_CONF["language"]);
    $LANGCODE = $PMF_LANG["metaLanguage"];
}
if (isset($LANGCODE)) {
    require_once(PMF_ROOT_DIR."/lang/language_".$LANGCODE.".php");
} else {
    require_once (PMF_ROOT_DIR."/lang/language_en.php");
    $LANGCODE = "en";
}

// use mbstring extension if available
$valid_mb_strings = array('ja', 'en');
if (function_exists('mb_language') && in_array($PMF_LANG['metaLanguage'], $valid_mb_strings)) {
    mb_language($PMF_LANG['metaLanguage']);
    mb_internal_encoding($PMF_LANG['metaCharset']);
}

// authenticate current user
session_name('PMF_SID');
session_start();
unset($auth);
if (isset($_REQUEST['faqpassword']) and isset($_REQUEST['faqusername'])) {
    // login with username and password
    $user = new PMF_CurrentUser();
    if ($user->login($db->escape_string($_REQUEST['faqusername']), $_REQUEST['faqpassword'])) {
        $auth = true;
    } else {
        unset($user);
    }
} else {
    // authenticate with session information
    $ip_check = $PMF_CONF['ipcheck'] == 'TRUE' ? true : false;
    $user = PMF_CurrentUser::getFromSession($ip_check);
    if ($user) {
        $auth = true;
    }
}
// get user rights
$permission = array();
if (isset($auth)) {
    foreach ($user->perm->getAllRights() as $right_id) {
        $right = $user->perm->getRightData($right_id);
        $permission[$right['name']] = false;
    }
    foreach ($user->perm->getAllUserRights($user->getUserId()) as $right_id) {
        $right = $user->perm->getRightData($right_id);
        $permission[$right['name']] = true;
    }
}
{'fraction_non_alphanumeric': 0.18380462724935734, 'fraction_numerical': 0.013624678663239074, 'mean_word_length': 4.683710737764792, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 55, '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': '2453467', 'n_tokens_mistral': 2743, 'n_tokens_neox': 2657, 'n_words': 542}