Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
butschster committed Oct 22, 2014
1 parent 92b42f7 commit f5132cc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
16 changes: 9 additions & 7 deletions cms/modules/kodicms/classes/kodicms/controller/api/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,26 @@ public function before()
public function post_save()
{
$settings = $this->param('setting', array(), TRUE);

$filter = Filter::factory($settings)
->rule('site.allow_html_title', FALSE, Config::NO);
->rule('site.allow_html_title', FALSE, Config::NO);

$validation = Validation::factory(array());
Observer::notify( 'validation_settings', $validation, $filter );
Observer::notify('validation_settings', $validation, $filter);

$filter->run();
$validation = $validation->copy($filter->data());

if( ! $validation->check() )
if (!$validation->check())
{
throw new API_Validation_Exception($validation->errors('validation'));

}

$settings = $validation->data();

Config::set_from_array($settings);

Observer::notify('save_settings', $settings );
Observer::notify('save_settings', $settings);
Kohana::$log->add(Log::INFO, ':user change Settings')->write();
$this->message('Settings has been saved!');
}
Expand Down
4 changes: 2 additions & 2 deletions cms/modules/kodicms/classes/kodicms/http/exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function get_response()
// Lets log the Exception, Just in case it's important!
Kohana_Exception::log($this);

if ( Config::get('site', 'debug') == Config::YES)
if (Config::get('site', 'debug') == Config::YES)
{
// Show the normal Kohana error page.
return parent::get_response();
Expand Down Expand Up @@ -49,7 +49,7 @@ public function get_response()
->status($this->getCode())
->body($request);
}
catch ( Exception $e )
catch (Exception $e)
{
return parent::get_response();
}
Expand Down
14 changes: 12 additions & 2 deletions cms/plugins/hybrid/classes/controller/hybrid/field.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,17 @@ private function _add($ds)
Messages::errors($e->errors('validation'));
$this->go_back();
}

if( ! $field_id )
catch (Kohana_Exception $e)
{
Messages::errors($e->getMessage());
$this->go_back();
}

if (!$field_id)
{
$this->go_back();
}

Session::instance()->delete('post_data');

if ( $this->request->post('save_and_create') !== NULL )
Expand Down Expand Up @@ -177,6 +182,11 @@ private function _edit($field)
Messages::errors($e->errors('validation'));
$this->go_back();
}
catch (Kohana_Exception $e)
{
Messages::errors($e->getMessage());
$this->go_back();
}

Session::instance()->delete('post_data');

Expand Down

0 comments on commit f5132cc

Please sign in to comment.