PageRenderTime 25ms CodeModel.GetById 18ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 1<?php
 2namespace common\extensions\external_repository_manager\implementation\photobucket;
 3
 4use common\libraries\Application;
 5use common\libraries\Translation;
 6use common\libraries\Request;
 7use common\libraries\Redirect;
 8use common\libraries\Path;
 9
10use common\extensions\external_repository_manager\ExternalRepositoryManager;
11
12require_once dirname(__FILE__) . '/../forms/photobucket_external_repository_manager_form.class.php';
13
14class PhotobucketExternalRepositoryManagerUploaderComponent extends PhotobucketExternalRepositoryManager
15{
16
17    function run()
18    {
19        $form = new PhotobucketExternalRepositoryManagerForm(PhotobucketExternalRepositoryManagerForm :: TYPE_CREATE, $this->get_url(), $this);
20        
21        if ($form->validate())
22        {
23            $id = $form->upload_photo();
24            
25            if ($id)
26            {
27                $parameters = $this->get_parameters();
28                $parameters[ExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_MANAGER_ACTION] = ExternalRepositoryManager :: ACTION_VIEW_EXTERNAL_REPOSITORY;
29                $parameters[ExternalRepositoryManager :: PARAM_EXTERNAL_REPOSITORY_ID] = $id;
30                
31                if ($this->is_stand_alone())
32                {
33                    Redirect :: web_link(Path :: get(WEB_PATH) . 'common/launcher/index.php', $parameters);
34                }
35                else
36                {
37                    Redirect :: web_link(Path :: get(WEB_PATH) . 'index.php', $parameters);
38                }
39            }
40            else
41            {
42                Request :: set_get(Application :: PARAM_ERROR_MESSAGE, Translation :: get('PhotobucketUploadProblem'));
43                $this->display_header();
44                $form->display();
45                $this->display_footer();
46            }
47        }
48        else
49        {
50            $this->display_header();
51            $form->display();
52            $this->display_footer();
53        }
54    }
55}
56?>