<commit_before><?php
namespace Chamilo\Core\Repository\Implementation\Youtube\Component;

use Chamilo\Core\Repository\Implementation\Youtube\Form\ExternalObjectForm;
use Chamilo\Core\Repository\Implementation\Youtube\Manager;
use Chamilo\Libraries\File\Redirect;
use Chamilo\Libraries\Architecture\Exceptions\NotAllowedException;
use Chamilo\Libraries\Platform\Session\Session;
use Chamilo\Libraries\Architecture\Interfaces\DelegateComponent;
use Chamilo\Libraries\Architecture\Application\Application;
use Chamilo\Libraries\Platform\Translation;
use Chamilo\Libraries\Platform\Session\Request;

class UploaderComponent extends Manager implements DelegateComponent
{

    public function run()
    {
        if (! $this->get_external_repository()->get_user_setting(Session :: get_user_id(), 'session_token'))
        {
            throw new NotAllowedException();
        }
        else
        {
            $form = new ExternalObjectForm(ExternalObjectForm :: TYPE_CREATE, $this->get_url(), $this);

            if ($form->validate())
            {
                $id = $form->upload_video();
                if ($id)
                {
                    $parameters = $this->get_parameters();
                    $parameters[Manager :: PARAM_ACTION] = Manager :: ACTION_BROWSE_EXTERNAL_REPOSITORY;
                    $parameters[Manager :: PARAM_EXTERNAL_REPOSITORY_ID] = $id;
                    $parameters[Manager :: PARAM_FEED_TYPE] = Manager :: FEED_TYPE_MYVIDEOS;

                    $redirect = new Redirect($parameters);
                    $redirect->toUrl();
                }
                else
                {
                    Request :: set_get(
                        Application :: PARAM_ERROR_MESSAGE,
                        Translation :: get('SlideshareUploadProblem'));
<commit_msg>youtube<commit_after><?php
namespace Chamilo\Core\Repository\Implementation\Youtube\Component;

use Chamilo\Core\Repository\Implementation\Youtube\Form\ExternalObjectForm;
use Chamilo\Core\Repository\Implementation\Youtube\Manager;
use Chamilo\Libraries\File\Redirect;
use Chamilo\Libraries\Architecture\Exceptions\NotAllowedException;
use Chamilo\Libraries\Platform\Session\Session;
use Chamilo\Libraries\Architecture\Interfaces\DelegateComponent;
use Chamilo\Libraries\Architecture\Application\Application;
use Chamilo\Libraries\Platform\Translation;
use Chamilo\Libraries\Platform\Session\Request;

class UploaderComponent extends Manager implements DelegateComponent
{

    public function run()
    {
        if (! $this->get_external_repository()->get_user_setting(Session :: get_user_id(), 'session_token'))
        {
            throw new NotAllowedException();
        }
        else
        {
            $form = new ExternalObjectForm(ExternalObjectForm :: TYPE_CREATE, $this->get_url(), $this);

            if ($form->validate())
            {
                $id = $form->upload_video();

                if ($id)
                {
                    $parameters = $this->get_parameters();
                    $parameters[Manager :: PARAM_ACTION] = Manager :: ACTION_BROWSE_EXTERNAL_REPOSITORY;
                    $parameters[Manager :: PARAM_EXTERNAL_REPOSITORY_ID] = $id;
                    $parameters[Manager :: PARAM_FEED_TYPE] = Manager :: FEED_TYPE_MYVIDEOS;

                    $redirect = new Redirect($parameters);
                    var_dump($redirect);
                    $redirect->toUrl();
                }
                else
                {
                    Request :: set_get(Application :: PARAM_ERROR_MESSAGE, Translation :: get('YoutubeUploadProblem'));

{'fraction_non_alphanumeric': 0.10226644555002765, 'fraction_numerical': 0.0, 'mean_word_length': 2.4664750957854404, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '2147559', 'n_tokens_mistral': 994, 'n_tokens_neox': 946, 'n_words': 148}