Example #1
0
 public function __construct($sourceId)
 {
     parent::__construct();
     $this->source = SourceWebFolder::createType(Source::getById($sourceId));
     if (!$this->source->hasRow()) {
         redirect(url('controlpanel.source'));
     }
     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()) {
             $updateDns = false;
             // Update DNS if the subdomain has changed
             if ($this->source->subdomain != trim(strtolower($this->input('subdomain')))) {
                 $updateDns = true;
             }
             $this->subdomain = $this->source->subdomain;
             $this->source->name = $this->input('name');
             $this->source->type = $this->input('type');
             $this->source->setSubdomain($this->input('subdomain'));
             $this->source->require_ssl = $this->input('require_ssl');
             $this->source->default_parameters = $this->input('default_parameters');
             $this->source->error_image_url = $this->input('error_image_url');
             $this->source->error_image_parameters = $this->input('error_image_parameters');
             $this->source->missing_image_url = $this->input('missing_image_url');
             $this->source->missing_image_parameters = $this->input('missing_image_parameters');
             $this->source->organisation_id = $this->currentUser->getActiveOrganisation();
             $this->source->setBaseUrl($this->input('base_url'));
             $this->edit($updateDns);
         }
     }
 }
Example #2
0
 public function __construct($sourceId)
 {
     parent::__construct();
     $this->source = SourceFtp::createType(Source::getById($sourceId));
     if (!$this->source->hasRow()) {
         redirect(url('controlpanel.source'));
     }
     if ($this->isPostBack()) {
         // TODO: add correct validation for subdomain + s3
         $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()) {
             $updateDns = false;
             // Update DNS if the subdomain has changed
             if ($this->source->subdomain != trim(strtolower($this->input('subdomain')))) {
                 $updateDns = true;
             }
             $this->subdomain = $this->source->subdomain;
             $this->source->name = $this->input('name');
             $this->source->type = $this->input('type');
             $this->source->setSubdomain($this->input('subdomain'));
             $this->source->require_ssl = $this->input('require_ssl');
             $this->source->default_parameters = $this->input('default_parameters');
             $this->source->error_image_url = $this->input('error_image_url');
             $this->source->error_image_parameters = $this->input('error_image_parameters');
             $this->source->missing_image_url = $this->input('missing_image_url');
             $this->source->missing_image_parameters = $this->input('missing_image_parameters');
             $this->source->organisation_id = $this->currentUser->getActiveOrganisation();
             $this->source->setConnectType($this->input('connect_type'));
             $this->source->setHost($this->input('host'));
             $this->source->setPort($this->input('port'));
             $this->source->setUsername($this->input('username'));
             $this->source->setPassword($this->input('password'));
             $this->source->setStartDirectory($this->input('start_directory'));
             $this->edit($updateDns);
         }
     }
 }
Example #3
0
 public function __construct($sourceId)
 {
     parent::__construct();
     $this->source = SourceAmazonS3::createType(Source::getById($sourceId));
     if (!$this->source->hasRow()) {
         redirect(url('controlpanel.source'));
     }
     if ($this->isPostBack()) {
         // TODO: add correct validation for subdomain + s3
         $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()) {
             $updateDns = false;
             // Update DNS if the subdomain has changed
             if ($this->source->subdomain != trim(strtolower($this->input('subdomain')))) {
                 $updateDns = true;
             }
             $this->subdomain = $this->source->subdomain;
             $this->source->name = $this->input('name');
             $this->source->type = $this->input('type');
             $this->source->setSubdomain($this->input('subdomain'));
             $this->source->require_ssl = $this->input('require_ssl');
             $this->source->default_parameters = $this->input('default_parameters');
             $this->source->error_image_url = $this->input('error_image_url');
             $this->source->error_image_parameters = $this->input('error_image_parameters');
             $this->source->missing_image_url = $this->input('missing_image_url');
             $this->source->missing_image_parameters = $this->input('missing_image_parameters');
             $this->source->organisation_id = $this->currentUser->getActiveOrganisation();
             $this->source->setKey($this->input('access_key'));
             $this->source->setSecret($this->input('secret_key'));
             $this->source->setBucket($this->input('s3_bucket'));
             $this->source->setPrefix($this->input('prefix'));
             $this->edit($updateDns);
         }
     }
 }
Example #4
0
 public function __construct($sourceId)
 {
     parent::__construct();
     $this->source = SourceDropbox::createType(Source::getById($sourceId));
     if (!$this->source->hasRow()) {
         redirect(url('controlpanel.source'));
     }
     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()) {
             $updateDns = false;
             // Update DNS if the subdomain has changed
             if ($this->source->subdomain != trim(strtolower($this->input('subdomain')))) {
                 $updateDns = true;
             }
             $this->source->name = $this->input('name');
             $this->source->type = $this->input('type');
             $this->source->setSubdomain($this->input('subdomain'));
             $this->source->require_ssl = $this->input('require_ssl');
             $this->source->default_parameters = $this->input('default_parameters');
             $this->source->error_image_url = $this->input('error_image_url');
             $this->source->error_image_parameters = $this->input('error_image_parameters');
             $this->source->missing_image_url = $this->input('missing_image_url');
             $this->source->missing_image_parameters = $this->input('missing_image_parameters');
             $this->source->organisation_id = $this->currentUser->getActiveOrganisation();
             $this->source->setAccessToken($this->input('access_token'));
             $this->source->setClientIdentifier($this->input('client_identifier'));
             $this->source->setStartDirectory($this->input('start_directory'));
             $this->edit($updateDns);
         }
     }
 }