diff --git a/admin/setup.php b/admin/setup.php index d576741..f46fa03 100644 --- a/admin/setup.php +++ b/admin/setup.php @@ -57,6 +57,28 @@ * Actions */ +if ($action == 'set_config') { + $userNameYourlsAPI = GETPOST('username_yourls_api'); + $keyYourlsAPI = GETPOST('key_yourls_api'); + $signatureTokenYourlsAPI = GETPOST('signature_token_yourls_api'); + + if (dol_strlen($userNameYourlsAPI) > 0) { + dolibarr_set_const($db, 'TINYURL_USERNAME_YOURLS_API', $userNameYourlsAPI, 'chaine', 0, '', $conf->entity); + } + if (dol_strlen($keyYourlsAPI) > 0) { + dolibarr_set_const($db, 'TINYURL_KEY_YOURLS_API', $keyYourlsAPI, 'chaine', 0, '', $conf->entity); + } + if (dol_strlen($signatureTokenYourlsAPI) > 0) { + dolibarr_set_const($db, 'TINYURL_SIGNATURE_TOKEN_YOURLS_API', $signatureTokenYourlsAPI, 'chaine', 0, '', $conf->entity); + } + + setEventMessage('SavedConfig'); + header('Location: ' . $_SERVER['PHP_SELF']); + exit; +} + + + /* * View */ @@ -68,11 +90,43 @@ // Subheader $linkback = '' . $langs->trans('BackToModuleList') . ''; -print load_fiche_titre($title, $linkback, 'tinyurl_color@tinyurl'); +print load_fiche_titre($title, $linkback, 'title_setup'); // Configuration header $head = tinyurl_admin_prepare_head(); print dol_get_fiche_head($head, 'settings', $title, -1, 'tinyurl_color@tinyurl'); +print load_fiche_titre($langs->trans('Config'), '', ''); + +print '
'; + $db->close(); llxFooter(); diff --git a/core/triggers/index.php b/core/triggers/index.php new file mode 100644 index 0000000..17927e6 --- /dev/null +++ b/core/triggers/index.php @@ -0,0 +1,2 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see