<commit_before><?php
/**
 * Plugin loader
 *
 * @package Cotonti
 * @version 0.7.0
 * @author Neocrome, Cotonti Team
 * @copyright Copyright (c) Cotonti Team 2008-2010
 * @license BSD
 * @deprecated Deprecated since Cotonti Siena
 */

// Set the environment
define('COT_CODE', true);
define('COT_PLUG', true);
$env['z'] = 'plug';
$env['location'] = 'plugins';

// Requirements
require_once './datas/config.php';
require_once $cfg['system_dir'] . '/functions.php';

// Further environment setup
if (isset($_GET['e']))
{
	$env['ext'] = $_GET['e'];
}
elseif (isset($_GET['r']))
{
	$env['ext'] = $_GET['r'];
}
elseif (isset($_GET['o']))
{
	$env['ext'] = $_GET['o'];
}
else
{
	die();
}

require_once $cfg['system_dir'] . '/common.php';
require_once $cfg['system_dir'] . '/cotemplate.php';

cot_dieifdisabled($cfg['disable_plug']);

// Initial permission check
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('plug', $env['ext']);
cot_block($usr['auth_read']);

// Input import
$e = cot_import('e', 'G', 'ALP');
$o = cot_import('o', 'G', 'ALP');
$r = (isset($_POST['r'])) ? cot_import('r','P','ALP') : cot_import('r','G','ALP');
$c1 = cot_import('c1', 'G', 'ALP');
$c2 = cot_import('c2', 'G', 'ALP');

if (!empty($e))
{
	$extname = $e;
    $exthook = 'standalone';
    $ext_display_header = true;
    $path_skin = cot_skinfile($extname, true);
    $autoassigntags = false;
    if (!file_exists($path_skin))
    {
        $path_skin = cot_skinfile(array('plugin', $extname));
        $autoassigntags = true;
    }
}
elseif (!empty($o))
{
	$extname = $o;
    $exthook = 'popup';
    $ext_display_header = false;
    $path_skin = cot_skinfile(array('popup', $extname));
    $autoassigntags = true;
}
elseif (!empty($r))
{
	$extname = $r;
    $exthook = 'ajax';
    $ext_display_header = false;
    $path_skin = '';
    $autoassigntags = false;
}
else
{
	cot_die();
}

// Plugin requirements autoloading
$req_files = array();
$req_files[] = cot_langfile($extname, 'plug');
$req_files[] = cot_incfile($extname, 'resources', true);
$req_files[] = cot_incfile($extname, 'functions', true);

foreach ($req_files as $req_file)
{
	if (file_exists($req_file))
	{
		require_once $req_file;
	}
}

// Display

if (!empty($path_skin))
{
	$t_plug = new XTemplate($path_skin);
	$t = $t_plug;
}

$empty = true;

if (is_array($cot_plugins[$exthook]))
{
	foreach ($cot_plugins[$exthook] as $k)
	{
		if ($k['pl_code'] == $extname)
		{
			$out['subtitle'] = $k['pl_title'];
			include $k['pl_file'];
			$empty = false;
		}
	}
}

if ($empty)
{
	$env['status'] = '404 Not Found';
	cot_redirect(cot_url('message', 'msg=907', '', true));
}

$out['subtitle'] = empty($out['subtitle']) ? $L['plu_title'] : $out['subtitle'];
$sys['sublocation'] = $out['subtitle'];

if ($ext_display_header)
{
	require_once $cfg['system_dir'] . '/header.php';
}

$t = $t_plug;

if ($autoassigntags)
{
	$plugin_title = (empty($plugin_title)) ? $L['plu_title'] : $plugin_title;

	if ($cfg['homebreadcrumb'])
	{
		$bhome = $R['plug_code_homebreadcrumb'];
	}
	else
	{
		$bhome = '';
	}

	if (empty($o))
	{
		$t->assign(array(
			'PLUGIN_TITLE' => cot_rc('plug_code_title', array('url' => cot_url('plug', "e=$e"))),
			'PLUGIN_SUBTITLE' => $plugin_subtitle,<commit_msg>Plugin display fix<commit_after><?php
/**
 * Plugin loader
 *
 * @package Cotonti
 * @version 0.7.0
 * @author Neocrome, Cotonti Team
 * @copyright Copyright (c) Cotonti Team 2008-2010
 * @license BSD
 * @deprecated Deprecated since Cotonti Siena
 */

// Set the environment
define('COT_CODE', true);
define('COT_PLUG', true);
$env['z'] = 'plug';
$env['location'] = 'plugins';

// Requirements
require_once './datas/config.php';
require_once $cfg['system_dir'] . '/functions.php';

// Further environment setup
if (isset($_GET['e']))
{
	$env['ext'] = $_GET['e'];
}
elseif (isset($_GET['r']))
{
	$env['ext'] = $_GET['r'];
}
elseif (isset($_GET['o']))
{
	$env['ext'] = $_GET['o'];
}
else
{
	die();
}

require_once $cfg['system_dir'] . '/common.php';
require_once $cfg['system_dir'] . '/cotemplate.php';

cot_dieifdisabled($cfg['disable_plug']);

// Initial permission check
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('plug', $env['ext']);
cot_block($usr['auth_read']);

// Input import
$e = cot_import('e', 'G', 'ALP');
$o = cot_import('o', 'G', 'ALP');
$r = (isset($_POST['r'])) ? cot_import('r','P','ALP') : cot_import('r','G','ALP');
$c1 = cot_import('c1', 'G', 'ALP');
$c2 = cot_import('c2', 'G', 'ALP');

if (!empty($e))
{
	$extname = $e;
    $exthook = 'standalone';
    $ext_display_header = true;
    $path_skin = cot_skinfile($extname, true);
    $autoassigntags = false;
    if (!file_exists($path_skin))
    {
        $path_skin = cot_skinfile(array('plugin', $extname));
        $autoassigntags = true;
    }
}
elseif (!empty($o))
{
	$extname = $o;
    $exthook = 'popup';
    $ext_display_header = false;
    $path_skin = cot_skinfile(array('popup', $extname));
    $autoassigntags = true;
}
elseif (!empty($r))
{
	$extname = $r;
    $exthook = 'ajax';
    $ext_display_header = false;
    $path_skin = '';
    $autoassigntags = false;
}
else
{
	cot_die();
}

// Plugin requirements autoloading
$req_files = array();
$req_files[] = cot_langfile($extname, 'plug');
$req_files[] = cot_incfile($extname, 'resources', true);
$req_files[] = cot_incfile($extname, 'functions', true);

foreach ($req_files as $req_file)
{
	if (file_exists($req_file))
	{
		require_once $req_file;
	}
}

// Display

if (!empty($path_skin))
{
	$t = new XTemplate($path_skin);
}

$empty = true;

if (is_array($cot_plugins[$exthook]))
{
	foreach ($cot_plugins[$exthook] as $k)
	{
		if ($k['pl_code'] == $extname)
		{
			$out['subtitle'] = $k['pl_title'];
			include $k['pl_file'];
			$empty = false;
		}
	}
}

if ($empty)
{
	$env['status'] = '404 Not Found';
	cot_redirect(cot_url('message', 'msg=907', '', true));
}

$out['subtitle'] = empty($out['subtitle']) ? $L['plu_title'] : $out['subtitle'];
$sys['sublocation'] = $out['subtitle'];

if ($ext_display_header)
{
	$t_plug = $t;
	require_once $cfg['system_dir'] . '/header.php';
	$t = $t_plug;
}

if ($autoassigntags)
{
	$plugin_title = (empty($plugin_title)) ? $L['plu_title'] : $plugin_title;

	if ($cfg['homebreadcrumb'])
	{
		$bhome = $R['plug_code_homebreadcrumb'];
	}
	else
	{
		$bhome = '';
	}

	if (empty($o))
	{
		$t->assign(array(
			'PLUGIN_TITLE' => cot_rc('plug_code_title', array('url' => cot_url('plug', "e=$e"))),
			'PLUGIN_SUBTITLE' => $plugin_subtitle,
{'fraction_non_alphanumeric': 0.22898640296662545, 'fraction_numerical': 0.0064894932014833125, 'mean_word_length': 4.857918552036199, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '3412015', 'n_tokens_mistral': 2683, 'n_tokens_neox': 2594, 'n_words': 471}