/php/component/uploader.class.php
https://bitbucket.org/chamilo/chamilo-ext-repo-photobucket-dev/ · PHP · 56 lines · 48 code · 8 blank · 0 comment · 3 complexity · e70ce8427447071ce0381f0d2eb588c3 MD5 · raw file
- <?php
- namespace common\extensions\external_repository_manager\implementation\photobucket;
-
- use common\libraries\Application;
- use common\libraries\Translation;
- use common\libraries\Request;
- use common\libraries\Redirect;
- use common\libraries\Path;
-
- use common\extensions\external_repository_manager\ExternalRepositoryManager;
-
- require_once dirname(__FILE__) . '/../forms/photobucket_external_repository_manager_form.class.php';
-
- class PhotobucketExternalRepositoryManagerUploaderComponent extends PhotobucketExternalRepositoryManager
- {
-
- function run()
- {
- $form = new PhotobucketExternalRepositoryManagerForm(PhotobucketExternalRepositoryManagerForm :: TYPE_CREATE, $this->get_url(), $this);
-
- if ($form->validate())
- {
- $id = $form->upload_photo();
-
- if ($id)
- {
- $parameters = $this->get_parameters();
- $parameters[ExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_MANAGER_ACTION] = ExternalRepositoryManager :: ACTION_VIEW_EXTERNAL_REPOSITORY;
- $parameters[ExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_ID] = $id;
-
- if ($this->is_stand_alone())
- {
- Redirect :: web_link(Path :: get(WEB_PATH) . 'common/launcher/index.php', $parameters);
- }
- else
- {
- Redirect :: web_link(Path :: get(WEB_PATH) . 'index.php', $parameters);
- }
- }
- else
- {
- Request :: set_get(Application :: PARAM_ERROR_MESSAGE, Translation :: get('PhotobucketUploadProblem'));
- $this->display_header();
- $form->display();
- $this->display_footer();
- }
- }
- else
- {
- $this->display_header();
- $form->display();
- $this->display_footer();
- }
- }
- }
- ?>