<commit_before><?php
/*
 * jQuery File Upload Plugin PHP Example 5.7
 * https://github.com/blueimp/jQuery-File-Upload
 *
 * Copyright 2010, <NAME>
 * https://blueimp.net
 *
 * Licensed under the MIT license:
 * http://www.opensource.org/licenses/MIT
 */

error_reporting(E_ALL | E_STRICT);

// Make sure Silex' session is instantiated
require_once __DIR__.'/../../../vendor/autoload.php';
require_once __DIR__.'/../../bootstrap.php';

// session_start();

// Don't do anything if we're not logged in..
if (!isset($_SESSION['_sf2_attributes']['user']['id'])) {
    echo "Not logged in.";
    die();
}

// Make sure the folder exists.
makeDir(__DIR__.'/../../../files/'.date('Y-m'));

require('upload.class.php');

$upload_handler = new UploadHandler(array(
    'upload_dir' => dirname(dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])))).'/files/'.date('Y-m')."/",
    'upload_url' => '/files/'.date('Y-m')."/",
    'accept_file_types' => '/\.(gif|jpe?g|png|zip|tgz|txt|md|docx?|pdf|xlsx?|pptx?)$/i'
));
<commit_msg>Make sure session is started. Fixes #89.<commit_after><?php
/*
 * jQuery File Upload Plugin PHP Example 5.7
 * https://github.com/blueimp/jQuery-File-Upload
 *
 * Copyright 2010, <NAME>
 * https://blueimp.net
 *
 * Licensed under the MIT license:
 * http://www.opensource.org/licenses/MIT
 */

error_reporting(E_ALL | E_STRICT);

// Make sure Silex' session is instantiated
require_once __DIR__.'/../../../vendor/autoload.php';
require_once __DIR__.'/../../bootstrap.php';

session_start();

// Don't do anything if we're not logged in..
if (!isset($_SESSION['_sf2_attributes']['user']['id'])) {
    echo "Not logged in.";
    die();
}

// Make sure the folder exists.
makeDir(__DIR__.'/../../../files/'.date('Y-m'));

require('upload.class.php');

$upload_handler = new UploadHandler(array(
    'upload_dir' => dirname(dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])))).'/files/'.date('Y-m')."/",
    'upload_url' => '/files/'.date('Y-m')."/",
    'accept_file_types' => '/\.(gif|jpe?g|png|zip|tgz|txt|md|docx?|pdf|xlsx?|pptx?)$/i'
));

{'fraction_non_alphanumeric': 0.2266990291262136, 'fraction_numerical': 0.007766990291262136, 'mean_word_length': 3.907142857142857, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 4, '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': '6410030', 'n_tokens_mistral': 762, 'n_tokens_neox': 730, 'n_words': 132}