From 57e3436cb6c60f45dc187982fee95df8586fd873 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 26 Mar 2021 08:56:58 +0100 Subject: [PATCH] Fix --- check_process | 5 ++--- conf/data/configs/application.ini | 14 +++++++------- manifest.json | 2 +- scripts/install | 20 ++++---------------- scripts/upgrade | 13 +++++-------- sources/sso/sso.php | 6 +++--- 6 files changed, 22 insertions(+), 38 deletions(-) diff --git a/check_process b/check_process index 787fb87..ab6d52d 100644 --- a/check_process +++ b/check_process @@ -2,11 +2,10 @@ ; Manifest domain="domain.tld" (DOMAIN) path="/rainloop" (PATH) - lang="en" + language="en" is_public=1 (PUBLIC|public=1|private=0) password="pass" ldap=1 - ; Checks pkg_linter=1 setup_sub_dir=1 @@ -25,4 +24,4 @@ Notification=none ;;; Upgrade options ; commit=7a48f5b9b35ff22529190f282bfcf5f56944741a name=Upgrade to v.1.14.0 - manifest_arg=domain=DOMAIN&path=PATH&is_public=Yes&password=password&ldap=Yes&lang=en& + manifest_arg=domain=DOMAIN&path=PATH&is_public=Yes&password=password&ldap=Yes&language=en& diff --git a/conf/data/configs/application.ini b/conf/data/configs/application.ini index 1849204..e8873eb 100644 --- a/conf/data/configs/application.ini +++ b/conf/data/configs/application.ini @@ -17,10 +17,10 @@ allow_themes = On allow_user_background = Off ; Language used by default -language = "__LANGTOCHANGE__" +language = "__LANGUAGE__" ; Admin Panel interface language -language_admin = "__LANGTOCHANGE__" +language_admin = "__LANGUAGE__" ; Allow language selection on settings screen allow_languages_on_settings = On @@ -60,9 +60,9 @@ allow_sharing = On allow_sync = On sync_interval = 20 type = "mysql" -pdo_dsn = "mysql:host=127.0.0.1;port=3306;dbname=__MYSQLUSER__" -pdo_user = "__MYSQLUSER__" -pdo_password = "__MYSQLPASSWORD__" +pdo_dsn = "mysql:host=127.0.0.1;port=3306;dbname=__DB_NAME__" +pdo_user = "__DB_NAME__" +pdo_password = "__DB_PWD__" suggestions_limit = 30 [security] @@ -142,7 +142,7 @@ sign_me_auto = "DefaultOff" enable = On ; List of enabled plugins -enabled_list = "__PLUGINSTOENABLE__" +enabled_list = "__PLUGINS_" [defaults] ; Editor mode used by default (Plain, Html, HtmlForced or PlainForced) @@ -173,7 +173,7 @@ write_on_timeout_only = 0 ; Required for development purposes only. ; Disabling this option is not recommended. hide_passwords = On -time_offset = __TIME_ZONE__ +time_offset = __TIMEZONE__ session_filter = "" ; Log filename. diff --git a/manifest.json b/manifest.json index b40a865..ed08a74 100644 --- a/manifest.json +++ b/manifest.json @@ -54,7 +54,7 @@ "default": true }, { - "name": "lang", + "name": "language", "type": "string", "ask": { "en": "Select default language", diff --git a/scripts/install b/scripts/install index e3b9a0d..1f4bf47 100644 --- a/scripts/install +++ b/scripts/install @@ -23,7 +23,7 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC -lang=$YNH_APP_ARG_LANG +language=$YNH_APP_ARG_LANGUAGE password=$YNH_APP_ARG_PASSWORD ldap=$YNH_APP_ARG_LDAP @@ -47,7 +47,7 @@ ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=lang --value=$lang +ynh_app_setting_set --app=$app --key=lang --value=$language ynh_app_setting_set --app=$app --key=password --value=$password ynh_app_setting_set --app=$app --key=ldap --value=$ldap @@ -120,20 +120,11 @@ then fi ynh_app_setting_set --app=$app --key=plugins --value="$plugins" - mkdir -p "$final_path/app/data/_data_/_default_/configs/" application_file="$final_path/app/data/_data_/_default_/configs/application.ini" -cp ../conf/data/configs/application.ini "$application_file" -ynh_replace_string --match_string="__DOMAIN__" --replace_string=$domain --target_file="$application_file" -ynh_replace_string --match_string="__MYSQLUSER__" --replace_string=$db_name --target_file="$application_file" -ynh_replace_string --match_string="__MYSQLPASSWORD__" --replace_string="$db_pwd" --target_file="$application_file" -ynh_replace_string --match_string="__LANGTOCHANGE__" --replace_string=$lang --target_file="$application_file" -ynh_replace_string --match_string="__PLUGINSTOENABLE__" --replace_string="$plugins" --target_file="$application_file" -# FIXME Temporary fix for rainloop, waiting for https://github.com/YunoHost/yunohost/pull/752 to be released. -# ynh_replace_string --match_string="__TIME_ZONE__" --replace_string="$(date +%:::z)" --target_file="$application_file" timezone="$(date +%:::z)" -ynh_replace_string --match_string="__TIME_ZONE__" --replace_string="${timezone//-/\\-}" --target_file="$application_file" +ynh_add_config --template="../conf/data/configs/application.ini" --destination="$application_file" # Set admin password php"${phpversion}" ../conf/config.php --index="$final_path/app/index.php" --password="$password" @@ -150,10 +141,7 @@ cp ../conf/data/domains/default.ini "$final_path/app/data/_data_/_default_/domai # install SSO - at the moment the index is the SSO and rainloop is installed in /app -cp ../sources/sso/sso.php "$final_path/index.php" -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/index.php" -ynh_replace_string --match_string="__ALIASTOCHANGE__" --replace_string="$final_path" --target_file="$final_path/index.php" -ynh_replace_string --match_string="__ROOTTOCHANGE__" --replace_string="${path_url%/}" --target_file="$final_path/index.php" +ynh_add_config --template="../sources/sso/sso.php" --destination="$final_path/index.php" # Install PGPback by chtixof to allow users to backup/restore their PGP private keys on the server cp -rf ../sources/pgpback "$final_path/" diff --git a/scripts/upgrade b/scripts/upgrade index 3544c1e..80d9348 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,7 +19,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -lang=$(ynh_app_setting_get --app=$app --key=lang) +language=$(ynh_app_setting_get --app=$app --key=language) db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= @@ -45,14 +45,14 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi -case "$lang" in +case "$language" in Francais) lang="fr" - ynh_app_setting_set --app=$app --key=lang --value=$lang + ynh_app_setting_set --app=$app --key=language --value=$language ;; English) lang="en" - ynh_app_setting_set --app=$app --key=lang --value=$lang + ynh_app_setting_set --app=$app --key=language --value=$language ;; *) ;; @@ -138,10 +138,7 @@ timezone="$(date +%:::z)" ynh_replace_string --match_string="^time_offset = .*" --replace_string="time_offset = ${timezone//-/\\-}" --target_file="$final_path/app/data/_data_/_default_/configs/application.ini" # update SSO -cp ../sources/sso/sso.php "$final_path/index.php" -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/index.php" -ynh_replace_string --match_string="__ALIASTOCHANGE__" --replace_string="$final_path" --target_file="$final_path/index.php" -ynh_replace_string --match_string="__ROOTTOCHANGE__" --replace_string="${path_url%/}" --target_file="$final_path/index.php" +ynh_add_config --template="../sources/sso/sso.php" --destination="$final_path/index.php" # Install PGPback by chtixof to allow users to backup/restore their PGP private keys on the server cp -rf ../sources/pgpback "$final_path/" diff --git a/sources/sso/sso.php b/sources/sso/sso.php index b8a374a..fcbc92e 100644 --- a/sources/sso/sso.php +++ b/sources/sso/sso.php @@ -2,7 +2,7 @@ // Enable RainLoop Api and include index file $_ENV['RAINLOOP_INCLUDE_AS_API'] = true; -include '__ALIASTOCHANGE__/app/index.php'; +include '__FINALPATH__/app/index.php'; // Retrieve email and password if (isset($_SERVER['HTTP_EMAIL']) && isset($_SERVER['PHP_AUTH_PW'])) { @@ -11,8 +11,8 @@ if (isset($_SERVER['HTTP_EMAIL']) && isset($_SERVER['PHP_AUTH_PW'])) { $ssoHash = \RainLoop\Api::GetUserSsoHash($email, $password); // redirect to webmail sso url - \header('Location: https://__DOMAIN____ROOTTOCHANGE__/app/index.php?sso&hash='.$ssoHash); + \header('Location: https://__DOMAIN____PATH__app/index.php?sso&hash='.$ssoHash); } else { - \header('Location: https://__DOMAIN____ROOTTOCHANGE__/app/index.php'); + \header('Location: https://__DOMAIN____PATH__app/index.php'); }