<commit_before><?php

namespace Backend\Modules\Agenda\Actions;

/*
 * This file is part of Fork CMS.
 *
 * For the full copyright and license information, please view the license
 * file that was distributed with this source code.
 */

use Backend\Core\Engine\Base\Action as BackendBaseAction;
use Backend\Core\Engine\Model as BackendModel;
use Backend\Modules\Agenda\Engine\Model as BackendAgendaModel;

/**
 * This action is used to perform mass actions on item media (delete, ...)
 *
 * @author <NAME> <<EMAIL>>
 */
class MassAction extends BackendBaseAction
{
    /**
     * Execute the action
     */
    public function execute()
    {
        parent::execute();

        // action to execute
        $action = SpoonFilter::getGetValue('action', array('deleteImages', 'deleteFiles', 'deleteVideos'), 'delete');

        if (!isset($_GET['id'])) {
            $this->redirect(BackendModel::createURLForAction('index') . '&error=no-selection');
        } // at least one id
        else {
            // redefine id's
            $aIds = (array)$_GET['id'];
            $agendaID = (int)$_GET['agenda_id'];

            // delete media
            if ($action == 'deleteImages') {
                BackendAgendaModel::deleteImage($aIds);
            } else {
                if ($action == 'deleteFiles') {
                    BackendAgendaModel::deleteFile($aIds);
                } else {
                    if ($action == 'deleteVideos') {
                        BackendAgendaModel::deleteVideo($aIds);
                    }
                }
            }
        }

        $this->redirect(BackendModel::createURLForAction('media') . '&agenda_id=' . $agendaID . '&report=deleted');
    }
}<commit_msg>Refactor spoonfilter and statements<commit_after><?php

namespace Backend\Modules\Agenda\Actions;

/*
 * This file is part of Fork CMS.
 *
 * For the full copyright and license information, please view the license
 * file that was distributed with this source code.
 */

use Backend\Core\Engine\Base\Action as BackendBaseAction;
use Backend\Core\Engine\Model as BackendModel;
use Backend\Modules\Agenda\Engine\Model as BackendAgendaModel;

/**
 * This action is used to perform mass actions on item media (delete, ...)
 *
 * @author <NAME> <<EMAIL>>
 */
class MassAction extends BackendBaseAction
{
    /**
     * Execute the action
     */
    public function execute()
    {
        parent::execute();

        // action to execute
        $action = \SpoonFilter::getGetValue('action', array('deleteImages', 'deleteFiles', 'deleteVideos'), 'delete');

        if (!isset($_GET['id'])) {
            $this->redirect(BackendModel::createURLForAction('index') . '&error=no-selection');
        } // at least one id
        else {
            // redefine id's
            $aIds = (array)$_GET['id'];
            $agendaID = (int)$_GET['agenda_id'];

            // delete media
            if ($action == 'deleteImages') {
                BackendAgendaModel::deleteImage($aIds);
            } 
            if ($action == 'deleteFiles') {
                BackendAgendaModel::deleteFile($aIds);
            } 
            if ($action == 'deleteVideos') {
                BackendAgendaModel::deleteVideo($aIds);
            }
        }

        $this->redirect(BackendModel::createURLForAction('media') . '&agenda_id=' . $agendaID . '&report=deleted');
    }
}
{'fraction_non_alphanumeric': 0.13513513513513514, 'fraction_numerical': 0.0, 'mean_word_length': 2.2604065827686353, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '2396089', 'n_tokens_mistral': 956, 'n_tokens_neox': 935, 'n_words': 223}