<commit_before><?php
/*************************************************************************
This file is part of SourceBans++

SourceBans++ (c) 2014-2019 by SourceBans++ Dev Team

The SourceBans++ Web panel is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

You should have received a copy of the license along with this
work.  If not, see <http://creativecommons.org/licenses/by-nc-sa/3.0/>.

This program is based off work covered by the following copyright(s):
SourceBans 1.4.11
Copyright © 2007-2014 SourceBans Team - Part of GameConnect
Licensed under CC-BY-NC-SA 3.0
Page: <http://www.sourcebans.net/> - <http://www.gameconnect.net/>
*************************************************************************/

require_once("init.php");

if (!isset($_GET['id']) || !isset($_GET['type'])) {
    die('No id or type parameter.');
}
if (strcasecmp($_GET['type'], "B") != 0 && strcasecmp($_GET['type'], "S") != 0) {
    die('Bad type');
}
$id   = (int) $_GET['id'];
$demo = $GLOBALS['db']->GetRow("SELECT filename, origname FROM `" . DB_PREFIX . "_demos` WHERE demtype=? AND demid=?;", array(
    $_GET['type'],
    $id
));
//Official Fix: https://code.google.com/p/sourcebans/source/detail?r=165
if (!$demo) {
    die('Demo not found.');
}
$demo['filename'] = basename($demo['filename']);
if (!in_array($demo['filename'], scandir(SB_DEMOS)) || !file_exists(SB_DEMOS . "/" . $demo['filename'])) {
    die('File not found.');
}
<commit_msg>Cleanup getdemo<commit_after><?php
/*************************************************************************
This file is part of SourceBans++

SourceBans++ (c) 2014-2019 by SourceBans++ Dev Team

The SourceBans++ Web panel is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

You should have received a copy of the license along with this
work.  If not, see <http://creativecommons.org/licenses/by-nc-sa/3.0/>.

This program is based off work covered by the following copyright(s):
SourceBans 1.4.11
Copyright © 2007-2014 SourceBans Team - Part of GameConnect
Licensed under CC-BY-NC-SA 3.0
Page: <http://www.sourcebans.net/> - <http://www.gameconnect.net/>
*************************************************************************/

require_once("init.php");

if (!isset($_GET['id']) || !isset($_GET['type'])) {
    die('No id or type parameter.');
}
if (strcasecmp($_GET['type'], "B") != 0 && strcasecmp($_GET['type'], "S") != 0) {
    die('Bad type');
}
$id   = (int) $_GET['id'];
$demo = $GLOBALS['db']->GetRow(
    "SELECT filename, origname FROM `" . DB_PREFIX . "_demos` WHERE demtype=? AND demid=?;",
    array($_GET['type'], $id)
);
//Official Fix: https://code.google.com/p/sourcebans/source/detail?r=165
if (!$demo) {
    die('Demo not found.');
}
$demo['filename'] = basename($demo['filename']);
if (!in_array($demo['filename'], scandir(SB_DEMOS)) || !file_exists(SB_DEMOS . "/" . $demo['filename'])) {
    die('File not found.');
}

{'fraction_non_alphanumeric': 0.27181208053691275, 'fraction_numerical': 0.02080536912751678, 'mean_word_length': 5.083673469387755, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, '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': '1949505', 'n_tokens_mistral': 1003, 'n_tokens_neox': 942, 'n_words': 253}