<commit_before><?php
/**
 * This file is part of the PHPLucidFrame library.
 *
 * This file performs the file upload process and file delete process of AsynFileUploader
 *
 * @package     PHPLucidFrame\Core
 * @since       PHPLucidFrame v 1.3.0
 * @copyright   Copyright (c), PHPLucidFrame.
 * @author      <NAME>. <<EMAIL>>
 * @link        http://phplucidframe.github.io
 * @license     http://www.opensource.org/licenses/mit-license.php MIT License
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE
 */

chdir('../');
require_once('bootstrap.php');

### FILE DELETE HANDLER ###
if (count($_POST) && isset($_POST['action']) && $_POST['action'] === 'delete' && count($_FILES) === 0) {
    $post = _post($_POST);
    # unlink the physical files
    if ($post['value']) {
        $dir = base64_decode($post['dir']);
        $file = $dir . $post['value'];
        if (is_file($file) && file_exists($file)) {
            unlink($file);
        }
        # delete the thumbnail images related to the deleted file (if any)
        if (isset($post['dimensions']) && is_array($post['dimensions']) && count($post['dimensions'])) {
            foreach ($post['dimensions'] as $d) {
                $thumbFile = $dir . $d . _DS_ . $post['value'];
                if (is_file($thumbFile) && file_exists($thumbFile)) {
                    unlink($thumbFile);
                }
            }
        }
        # invoke custom delete hook (if any)
        if ($post['onDelete'] && function_exists($post['onDelete'])) {
            call_user_func($post['onDelete'], $post['id']);
        }<commit_msg>Fix asynchronous file uploader for not bootstrapping<commit_after><?php
/**
 * This file is part of the PHPLucidFrame library.
 *
 * This file performs the file upload process and file delete process of AsynFileUploader
 *
 * @package     PHPLucidFrame\Core
 * @since       PHPLucidFrame v 1.3.0
 * @copyright   Copyright (c), PHPLucidFrame.
 * @author      <NAME>. <<EMAIL>>
 * @link        http://phplucidframe.github.io
 * @license     http://www.opensource.org/licenses/mit-license.php MIT License
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE
 */

chdir('../');
$_GET['bootstrap'] = true;
require_once('bootstrap.php');

### FILE DELETE HANDLER ###
if (count($_POST) && isset($_POST['action']) && $_POST['action'] === 'delete' && count($_FILES) === 0) {
    $post = _post($_POST);
    # unlink the physical files
    if ($post['value']) {
        $dir = base64_decode($post['dir']);
        $file = $dir . $post['value'];
        if (is_file($file) && file_exists($file)) {
            unlink($file);
        }
        # delete the thumbnail images related to the deleted file (if any)
        if (isset($post['dimensions']) && is_array($post['dimensions']) && count($post['dimensions'])) {
            foreach ($post['dimensions'] as $d) {
                $thumbFile = $dir . $d . _DS_ . $post['value'];
                if (is_file($thumbFile) && file_exists($thumbFile)) {
                    unlink($thumbFile);
                }
            }
        }
        # invoke custom delete hook (if any)
        if ($post['onDelete'] && function_exists($post['onDelete'])) {
            call_user_func($post['onDelete'], $post['id']);
        }
{'fraction_non_alphanumeric': 0.16260404280618312, 'fraction_numerical': 0.0035671819262782403, 'mean_word_length': 2.6339092872570196, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '784149', 'n_tokens_mistral': 1007, 'n_tokens_neox': 979, 'n_words': 266}