コード例 #1
0
ファイル: AddFtp.php プロジェクト: Monori/imgservice
 public function __construct()
 {
     parent::__construct();
     if ($this->isPostBack()) {
         // TODO: add correct validation for subdomain + s3
         // TODO: add ip to ip pool
         $this->post->type->addValidation(new ValidateInputNotNullOrEmpty());
         $this->post->name->addValidation(new ValidateInputNotNullOrEmpty());
         $this->post->subdomain->addValidation(new ValidateInputNotNullOrEmpty());
         $this->post->connect_type->addValidation(new ValidateInputNotNullOrEmpty());
         $this->post->host->addValidation(new ValidateInputNotNullOrEmpty());
         if (!$this->hasErrors()) {
             $source = new SourceFtp();
             $source->name = $this->input('name');
             $source->type = $this->input('type');
             $source->setSubdomain($this->input('subdomain'));
             $source->require_ssl = $this->input('require_ssl');
             $source->default_parameters = $this->input('default_parameters');
             $source->error_image_url = $this->input('error_image_url');
             $source->error_image_parameters = $this->input('error_image_parameters');
             $source->missing_image_url = $this->input('missing_image_url');
             $source->missing_image_parameters = $this->input('missing_image_parameters');
             $source->organisation_id = $this->currentUser->getActiveOrganisation();
             $source->setConnectType($this->input('connect_type'));
             $source->setHost($this->input('host'));
             $source->setPort($this->input('port'));
             $source->setUsername($this->input('username'));
             $source->setPassword($this->input('password'));
             $source->setStartDirectory($this->input('start_directory'));
             $this->save($source);
         }
     }
 }
コード例 #2
0
ファイル: AddAmazonS3.php プロジェクト: Monori/imgservice
 public function __construct()
 {
     parent::__construct();
     if ($this->isPostBack()) {
         // TODO: add correct validation for subdomain + s3
         // TODO: add ip to ip pool
         $this->post->type->addValidation(new ValidateInputNotNullOrEmpty());
         $this->post->name->addValidation(new ValidateInputNotNullOrEmpty());
         $this->post->subdomain->addValidation(new ValidateInputNotNullOrEmpty());
         $this->post->access_key->addValidation(new ValidateInputNotNullOrEmpty());
         $this->post->secret_key->addValidation(new ValidateInputNotNullOrEmpty());
         $this->post->s3_bucket->addValidation(new ValidateInputNotNullOrEmpty());
         if (!$this->hasErrors()) {
             $source = new SourceAmazonS3();
             $source->name = $this->input('name');
             $source->type = $this->input('type');
             $source->setSubdomain($this->input('subdomain'));
             $source->require_ssl = $this->input('require_ssl');
             $source->default_parameters = $this->input('default_parameters');
             $source->error_image_url = $this->input('error_image_url');
             $source->error_image_parameters = $this->input('error_image_parameters');
             $source->missing_image_url = $this->input('missing_image_url');
             $source->missing_image_parameters = $this->input('missing_image_parameters');
             $source->organisation_id = $this->currentUser->getActiveOrganisation();
             $source->setKey($this->input('access_key'));
             $source->setSecret($this->input('secret_key'));
             $source->setBucket($this->input('s3_bucket'));
             $source->setPrefix($this->input('prefix'));
             $this->save($source);
         }
     }
 }
コード例 #3
0
ファイル: AddWebFolder.php プロジェクト: Monori/imgservice
 public function __construct()
 {
     parent::__construct();
     if ($this->isPostBack()) {
         $this->post->type->addValidation(new ValidateInputNotNullOrEmpty());
         $this->post->name->addValidation(new ValidateInputNotNullOrEmpty());
         $this->post->subdomain->addValidation(new ValidateInputNotNullOrEmpty());
         $this->post->base_url->addValidation([new ValidateInputNotNullOrEmpty(), new ValidateInputUri()]);
         if (!$this->hasErrors()) {
             $source = new SourceWebFolder();
             $source->name = $this->input('name');
             $source->type = $this->input('type');
             $source->setSubdomain($this->input('subdomain'));
             $source->require_ssl = $this->input('require_ssl');
             $source->default_parameters = $this->input('default_parameters');
             $source->error_image_url = $this->input('error_image_url');
             $source->error_image_parameters = $this->input('error_image_parameters');
             $source->missing_image_url = $this->input('missing_image_url');
             $source->missing_image_parameters = $this->input('missing_image_parameters');
             $source->organisation_id = $this->currentUser->getActiveOrganisation();
             $source->setBaseUrl($this->input('base_url'));
             $this->save($source);
         }
     }
 }
コード例 #4
0
ファイル: AddDropbox.php プロジェクト: Monori/imgservice
 public function __construct()
 {
     parent::__construct();
     if ($this->isPostBack()) {
         $this->post->type->addValidation(new ValidateInputNotNullOrEmpty());
         $this->post->name->addValidation(new ValidateInputNotNullOrEmpty());
         $this->post->subdomain->addValidation(new ValidateInputNotNullOrEmpty());
         $this->post->access_token->addValidation([new ValidateInputNotNullOrEmpty()]);
         $this->post->client_identifier->addValidation([new ValidateInputNotNullOrEmpty()]);
         if (!$this->hasErrors()) {
             $source = new SourceDropbox();
             $source->name = $this->input('name');
             $source->type = $this->input('type');
             $source->setSubdomain($this->input('subdomain'));
             $source->require_ssl = $this->input('require_ssl');
             $source->default_parameters = $this->input('default_parameters');
             $source->error_image_url = $this->input('error_image_url');
             $source->error_image_parameters = $this->input('error_image_parameters');
             $source->missing_image_url = $this->input('missing_image_url');
             $source->missing_image_parameters = $this->input('missing_image_parameters');
             $source->organisation_id = $this->currentUser->getActiveOrganisation();
             $source->setAccessToken($this->input('access_token'));
             $source->setClientIdentifier($this->input('client_identifier'));
             $source->setStartDirectory($this->input('start_directory'));
             $this->save($source);
         }
     }
 }