<commit_before><?php

use \CodeDay\Clear\Models;
use \CodeDay\Clear\Services;

ClassLoader::addDirectories(array(

	app_path().'/Commands',
	app_path().'/Controllers',
	app_path().'/Models',
	app_path().'/database/seeds',

));

Log::useFiles(storage_path().'/logs/laravel.log');

App::error(function(Exception $exception, $code)
{
	Log::error($exception);
});

App::down(function()
{
	return Response::make("Be right back!", 503);
});

// Set up Bugsnag
if (\Config::get('app.debug')) {
    \Bugsnag::setReleaseStage('development');
} else {
    \Bugsnag::setReleaseStage('release');
}

// XSS, CSRF, etc protection
\App::after(function($request, $response)
{
    $csp = "default-src 'self'; script-src 'unsafe-eval' 'unsafe-inline' 'self' https://*.googleapis.com https://cdnjs.cloudflare.com"
         . " https://*.gstatic.com; object-src 'self'; style-src 'self' 'unsafe-inline'"
         . " https://*.googleapis.com https://*.gstatic.com; img-src *; media-src *; frame-src 'self';"
         . " font-src 'self' https://*.googleapis.com https://*.gstatic.com; connect-src *";

    if (\Request::server("HTTP_HOST") === 'clear.codeday.org') {
        $response->headers->set('Strict-Transport-Security', '2,592,000');
    }

    $response->headers->set('X-Frame-Options', 'deny');
    $response->headers->set('Frame-Options', 'deny');
    $response->headers->set('X-XSS-Protection', '1; mode=block');
    $response->headers->set('X-Content-Type-Options', 'nosniff');
    $response->headers->set('Content-Security-Policy', $csp);
    $response->headers->set('X-Content-Security-Policy', $csp);
    $response->headers->set('X-WebKit-CSP', $csp);
});


$include_all_directories = ['events', 'filters'];
foreach ($include_all_directories as $directory) {
    foreach (glob(implode(DIRECTORY_SEPARATOR, [dirname(__DIR__), $directory, "*.php"])) as $filename) {
        include_once($filename);
    }<commit_msg>Fix CSP to allow jquery<commit_after><?php

use \CodeDay\Clear\Models;
use \CodeDay\Clear\Services;

ClassLoader::addDirectories(array(

	app_path().'/Commands',
	app_path().'/Controllers',
	app_path().'/Models',
	app_path().'/database/seeds',

));

Log::useFiles(storage_path().'/logs/laravel.log');

App::error(function(Exception $exception, $code)
{
	Log::error($exception);
});

App::down(function()
{
	return Response::make("Be right back!", 503);
});

// Set up Bugsnag
if (\Config::get('app.debug')) {
    \Bugsnag::setReleaseStage('development');
} else {
    \Bugsnag::setReleaseStage('release');
}

// XSS, CSRF, etc protection
\App::after(function($request, $response)
{
    $csp = "default-src 'self'; script-src 'unsafe-eval' 'unsafe-inline' 'self' https://*.googleapis.com https://cdnjs.cloudflare.com"
         . " http://code.jquery.com https://code.jquery.com https://*.gstatic.com; object-src 'self'; style-src 'self' 'unsafe-inline'"
         . " https://*.googleapis.com https://*.gstatic.com; img-src *; media-src *; frame-src 'self';"
         . " font-src 'self' https://*.googleapis.com https://*.gstatic.com; connect-src *";

    if (\Request::server("HTTP_HOST") === 'clear.codeday.org') {
        $response->headers->set('Strict-Transport-Security', '2,592,000');
    }

    $response->headers->set('X-Frame-Options', 'deny');
    $response->headers->set('Frame-Options', 'deny');
    $response->headers->set('X-XSS-Protection', '1; mode=block');
    $response->headers->set('X-Content-Type-Options', 'nosniff');
    $response->headers->set('Content-Security-Policy', $csp);
    $response->headers->set('X-Content-Security-Policy', $csp);
    $response->headers->set('X-WebKit-CSP', $csp);
});


$include_all_directories = ['events', 'filters'];
foreach ($include_all_directories as $directory) {
    foreach (glob(implode(DIRECTORY_SEPARATOR, [dirname(__DIR__), $directory, "*.php"])) as $filename) {
        include_once($filename);
    }
{'fraction_non_alphanumeric': 0.2207892700541656, 'fraction_numerical': 0.005674490585504256, 'mean_word_length': 4.408647140864714, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, 'https://': 15, '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': '4697887', 'n_tokens_mistral': 1361, 'n_tokens_neox': 1308, 'n_words': 198}