diff --git a/_config.php b/_config.php
index 9a086f8..359365f 100644
--- a/_config.php
+++ b/_config.php
@@ -42,12 +42,36 @@ $combo_backup_folder = [
];
$combo_start_page = [
- 'setting' => __('Settings'),
'modules_plugin' => __('Plugins'),
'modules_theme' => __('Themes'),
'pack' => __('Import/Export')
];
+# -- Set settings --
+if (!empty($_POST['save'])) {
+ try {
+ if (empty($_POST['translater_write_po'])
+ && empty($_POST['translater_write_langphp'])) {
+ throw new Exception('You must choose one file format at least');
+ }
+ foreach($translater->getDefaultSettings() as $k => $v) {
+ $translater->set($k, (isset($_POST['translater_' . $k]) ? $_POST['translater_' . $k] : ''));
+ }
+ foreach($translater->proposal->getTools() AS $k => $v) {
+ $v->save();
+ }
+ dcPage::addSuccessNotice(
+ __('Configuration has been successfully updated.')
+ );
+ http::redirect(
+ $list->getURL('module=translater&conf=1&redir=' .
+ $list->getRedir())
+ );
+ } catch (Exception $e) {
+ $core->error->add(sprintf($errors[$action], $e->getMessage()));
+ }
+}
+
# -- Display form --
echo '
diff --git a/index.php b/index.php
index ecda5f3..1f9adda 100644
--- a/index.php
+++ b/index.php
@@ -23,30 +23,6 @@ dcPage::checkSuper();
$translater = new dcTranslater($core);
-$combo_start_page = [
- 'setting' => __('Settings'),
- 'modules_plugin' => __('Plugins'),
- 'modules_theme' => __('Themes'),
- 'pack' => __('Import/Export')
-];
-
-$combo_backup_limit = [
- 5 => 5,
- 10 => 10,
- 15 => 15,
- 20 => 20,
- 40 => 40,
- 60 => 60
-];
-
-$combo_backup_folder = [
- 'module' => __('locales folders of each module'),
- 'plugin' => __('plugins folder root'),
- 'public' => __('public folder root'),
- 'cache' => __('cache folder of Dotclear'),
- 'translater' =>__('locales folder of translater')
-];
-
$succes = [
'save_setting' => __('Configuration successfully updated'),
'update_lang' => __('Translation successfully updated'),
@@ -306,30 +282,6 @@ switch ($action) {
}
break;
- /**
- * Save settings
- */
- case 'save_setting':
- try {
- if (empty($_POST['translater_write_po'])
- && empty($_POST['translater_write_langphp'])) {
- throw new Exception('You must choose one file format at least');
- }
-
- foreach($translater->getDefaultSettings() as $k => $v) {
- $translater->set($k,(isset($_POST['translater_' . $k]) ? $_POST['translater_' . $k] : ''));
- }
-
- foreach($translater->proposal->getTools() AS $k => $v) {
- $v->save();
- }
-
- http::redirect($p_url . '&part=setting&msg=' . $action);
- } catch (Exception $e) {
- $core->error->add(sprintf($errors[$action], $e->getMessage()));
- }
- break;
-
/**
* Modules / Unknow / None
*/
@@ -423,14 +375,6 @@ switch ($part) {
case 'pack':
$title = '' . __('Import/Export') . '';
break;
-
- /**
- * Settings
- */
- case 'setting':
- default:
- $title = '' . __('Settings') . '';
- break;
}
#
@@ -1118,105 +1062,6 @@ switch ($part) {
';
break;
-
- /**
- * Settings
- */
- case 'setting':
- default:
- echo '
- ';
- break;
}
dcPage::helpBlock('translater');