From 15e78ba07098a4f3461960d2cc87b19493ee341f Mon Sep 17 00:00:00 2001 From: m Date: Tue, 17 Apr 2018 00:06:46 +0200 Subject: [PATCH] Better handle undefined config values https://framagit.org/framasoft/framadate/issues/322 --- app/inc/config.template.php | 111 ------------------------------------ app/inc/smarty.php | 2 +- tpl/admin/config.tpl | 12 +++- 3 files changed, 12 insertions(+), 113 deletions(-) delete mode 100644 app/inc/config.template.php diff --git a/app/inc/config.template.php b/app/inc/config.template.php deleted file mode 100644 index cbb20f1..0000000 --- a/app/inc/config.template.php +++ /dev/null @@ -1,111 +0,0 @@ -'; - -// Application name -const NOMAPPLICATION = ''; - -// Database administrator email -const ADRESSEMAILADMIN = ''; - -// Email for automatic responses (you should set it to "no-reply") -const ADRESSEMAILREPONSEAUTO = ''; - -// Database user -const DB_USER= ''; - -// Database password -const DB_PASSWORD = ''; - -// Database server name, leave empty to use a socket -const DB_CONNECTION_STRING = 'mysql:host=;dbname=;port='; - -// Name of the table that stores migration script already executed -const MIGRATION_TABLE = 'framadate_migration'; - -// Table name prefix -const TABLENAME_PREFIX = 'fd_'; - -// Default Language -const DEFAULT_LANGUAGE = 'fr'; - -// List of supported languages, fake constant as arrays can be used as constants only in PHP >=5.6 -$ALLOWED_LANGUAGES = [ - 'fr' => 'Français', - 'en' => 'English', - 'oc' => 'Occitan', - 'es' => 'Español', - 'de' => 'Deutsch', - 'nl' => 'Dutch', - 'it' => 'Italiano', - 'br' => 'Brezhoneg', -]; - -// Path to image file with the title -const IMAGE_TITRE = 'images/logo-framadate.png'; - -// Relative path to favicon -const FAVICON = 'favicon.ico'; - -// Clean URLs, boolean -const URL_PROPRE = false; - -// Use REMOTE_USER data provided by web server -const USE_REMOTE_USER = true; - -// Path to the log file -const LOG_FILE = 'admin/stdout.log'; - -// Days (after expiration date) before purging a poll -const PURGE_DELAY = 60; - -// Max slots per poll -const MAX_SLOTS_PER_POLL = 366; - -// Number of seconds before we allow to resend an "Remember Edit Link" email. -const TIME_EDIT_LINK_EMAIL = 60; - -// Config -$config = [ - /* general config */ - 'use_smtp' => true, // use email for polls creation/modification/responses notification - 'smtp_options' => [ - 'host' => 'localhost', // SMTP server (you could add many servers (main and backup for example) : use ";" like separator - 'auth' => false, // Enable SMTP authentication - 'username' => '', // SMTP username - 'password' => '', // SMTP password - 'secure' => '', // Enable encryption (false, tls or ssl) - 'port' => 25, // TCP port to connect to - ], - 'tracking_code' => '', // add HTML code to every page, useful for tools like Piwik - /* home */ - 'show_what_is_that' => true, // display "how to use" section - 'show_the_software' => true, // display technical information about the software - 'show_cultivate_your_garden' => true, // display "development and administration" information - /* create_classic_poll.php / create_date_poll.php */ - 'default_poll_duration' => 180, // default values for the new poll duration (number of days). - /* create_classic_poll.php */ - 'user_can_add_img_or_link' => true, // user can add link or URL when creating his poll. - 'markdown_editor_by_default' => true, // The markdown editor for the description is enabled by default - 'provide_fork_awesome' => true, // Whether the build-in fork-awesome should be provided -]; diff --git a/app/inc/smarty.php b/app/inc/smarty.php index 84c4e24..350350b 100644 --- a/app/inc/smarty.php +++ b/app/inc/smarty.php @@ -30,7 +30,7 @@ $smarty->assign('SERVER_URL', Utils::get_server_name()); $smarty->assign('SCRIPT_NAME', $_SERVER['SCRIPT_NAME']); $smarty->assign('TITLE_IMAGE', IMAGE_TITRE); $smarty->assign('use_nav_js', strstr($_SERVER['SERVER_NAME'], 'framadate.org')); -$smarty->assign('provide_fork_awesome', $config['provide_fork_awesome']); +$smarty->assign('provide_fork_awesome', isset($config['provide_fork_awesome']) && $config['provide_fork_awesome']); $smarty->assign('locale', $locale); $smarty->assign('langs', $ALLOWED_LANGUAGES); $smarty->assign('date_format', $date_format); diff --git a/tpl/admin/config.tpl b/tpl/admin/config.tpl index b0ae98f..253d283 100644 --- a/tpl/admin/config.tpl +++ b/tpl/admin/config.tpl @@ -86,6 +86,14 @@ const TIME_EDIT_LINK_EMAIL = 60; $config = [ /* general config */ 'use_smtp' => true, // use email for polls creation/modification/responses notification + 'smtp_options' => [ + 'host' => 'localhost', // SMTP server (you could add many servers (main and backup for example) : use ";" like separator + 'auth' => false, // Enable SMTP authentication + 'username' => '', // SMTP username + 'password' => '', // SMTP password + 'secure' => '', // Enable encryption (false, tls or ssl) + 'port' => 25, // TCP port to connect to + ], /* home */ 'show_what_is_that' => true, // display "how to use" section 'show_the_software' => true, // display technical information about the software @@ -94,5 +102,7 @@ $config = [ 'default_poll_duration' => 180, // default values for the new poll duration (number of days). /* create_classic_poll.php */ 'user_can_add_img_or_link' => true, // user can add link or URL when creating his poll. - 'markdown_editor_by_default' => true // The markdown editor for the description is enabled by default + 'markdown_editor_by_default' => true, // The markdown editor for the description is enabled by default + 'provide_fork_awesome' => true, // Whether the build-in fork-awesome should be provided ]; +